@kyro-cms/core 0.12.48 → 0.12.49
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/README.md +1 -0
- package/dist/api-handler-graphql.cjs +1 -1
- package/dist/api-handler-graphql.js +1 -1
- package/dist/api-handler-trpc.cjs +1 -1
- package/dist/api-handler-trpc.js +1 -1
- package/dist/api-handler.cjs +1 -1
- package/dist/api-handler.js +1 -1
- package/dist/auth-session-DHVGXHOH.cjs +1 -0
- package/dist/auth-session-O7IIH7EP.js +1 -0
- package/dist/bcryptjs-ZEEHSMAG.js +2 -0
- package/dist/{better-sqlite3-42Q3FG3E.js → better-sqlite3-B34RIU4C.js} +1 -1
- package/dist/bootstrap-4FK3LPPH.js +1 -0
- package/dist/bootstrap-F4SDJLPK.cjs +1 -0
- package/dist/{bowser-FI5JQGKZ.js → bowser-SB3ZUPO4.js} +1 -1
- package/dist/chokidar-5RVQZVHP.cjs +5 -0
- package/dist/chokidar-BOYGRT4Q.js +6 -0
- package/dist/{chunk-DS5DE5BU.js → chunk-24L3UEJJ.js} +1 -1
- package/dist/{chunk-HT44I66C.js → chunk-2HA6EKXX.js} +1 -1
- package/dist/{chunk-7AQSH3KR.js → chunk-3NSZZCOJ.js} +1 -1
- package/dist/{chunk-VIUU4D5I.js → chunk-47CXBWMA.js} +1 -1
- package/dist/{chunk-6MSS5X77.js → chunk-5M3FKE2V.js} +1 -1
- package/dist/chunk-63BSQ3FK.cjs +1 -0
- package/dist/chunk-6TPICJ2L.js +7 -0
- package/dist/{chunk-K7YNEKVE.js → chunk-7FXEXHK6.js} +1 -1
- package/dist/{chunk-WSP7PSXC.js → chunk-7MNDQU6K.js} +1 -1
- package/dist/{chunk-7V67ONUD.js → chunk-7N7U2ERH.js} +1 -1
- package/dist/{chunk-BPMA2ECA.js → chunk-7NH7H3WA.js} +1 -1
- package/dist/{chunk-ZJE3VAAW.js → chunk-BU6O3TP7.js} +3 -3
- package/dist/{chunk-W46LZ4MY.js → chunk-C7QCZX7X.js} +1 -1
- package/dist/chunk-CFZVJTXW.cjs +264 -0
- package/dist/{chunk-2WFTETFB.js → chunk-CIVA6SKW.js} +1 -1
- package/dist/chunk-EFGOYI57.js +265 -0
- package/dist/{chunk-2BUODBE2.js → chunk-EML5FDUU.js} +1 -1
- package/dist/{chunk-66BJXVFJ.js → chunk-FLMUMPDE.js} +1 -1
- package/dist/{chunk-QYI3GOHF.cjs → chunk-HKNQVI76.cjs} +1 -1
- package/dist/{chunk-IP6JUEH3.js → chunk-HRAY65XH.js} +1 -1
- package/dist/{chunk-KH7LM52S.js → chunk-IKGVPXMK.js} +1 -1
- package/dist/{chunk-M2QRXAWT.js → chunk-JR6IOJO7.js} +2 -2
- package/dist/{chunk-XOACKBG7.js → chunk-JRUQ5ABB.js} +2 -2
- package/dist/{chunk-OMWQVPV7.js → chunk-JV4HJBXW.js} +1 -1
- package/dist/{chunk-X54XZACS.cjs → chunk-KZHXYXSH.cjs} +2 -2
- package/dist/{chunk-UD6ZPO7T.js → chunk-L2QXP26Q.js} +1 -1
- package/dist/{chunk-ORG67NXX.js → chunk-L3Q64RUX.js} +1 -1
- package/dist/chunk-LELK3TYX.js +3 -0
- package/dist/chunk-LGYBTBWE.js +2 -0
- package/dist/{chunk-7I6URA6F.js → chunk-LVBHOZZF.js} +1 -1
- package/dist/{chunk-R3NEPC4I.js → chunk-LWM4WABU.js} +1 -1
- package/dist/{chunk-TR3ZS3T3.js → chunk-M75VGFCI.js} +1 -1
- package/dist/chunk-MCIZG4A3.cjs +1 -0
- package/dist/{chunk-VBPAAQEF.js → chunk-N5POANYV.js} +1 -1
- package/dist/chunk-O4YE57OS.cjs +6 -0
- package/dist/{chunk-A73AVVFR.js → chunk-OBYAIJVU.js} +1 -1
- package/dist/chunk-OLRCZ6E3.js +2 -0
- package/dist/{chunk-WGESLAWV.js → chunk-OXGJOYEO.js} +1 -1
- package/dist/{chunk-CGPAS4U5.js → chunk-P6JITOFF.js} +1 -1
- package/dist/{chunk-JUJZOG6P.js → chunk-PA4ZZREG.js} +1 -1
- package/dist/{chunk-45TJAB5X.js → chunk-PENOCINR.js} +3 -3
- package/dist/{chunk-MZOWPV4D.js → chunk-PRMILS4Y.js} +1 -1
- package/dist/chunk-QDBGBDCT.js +2 -0
- package/dist/{chunk-XBH4YMC7.js → chunk-R25WLKX4.js} +1 -1
- package/dist/{chunk-J6U5LWZ7.js → chunk-RPRGGGIW.js} +3 -3
- package/dist/{chunk-E27KEZPT.js → chunk-RTHJ6SS5.js} +1 -1
- package/dist/{chunk-MCZ3YZ2L.js → chunk-SLMIYECU.js} +1 -1
- package/dist/{chunk-IPXOY4RI.js → chunk-SQBTIMWF.js} +1 -1
- package/dist/{chunk-VJ2WMKPK.js → chunk-SZT6BLUR.js} +1 -1
- package/dist/{chunk-6KRR7YHA.js → chunk-TBHNE4VV.js} +1 -1
- package/dist/{chunk-OSAVAYJZ.js → chunk-TYQYKKWJ.js} +1 -1
- package/dist/{chunk-ICVQWR2A.js → chunk-U6KFONKM.js} +1 -1
- package/dist/chunk-UT7RGIYS.js +2 -0
- package/dist/{chunk-PBOZJOKN.js → chunk-UWHWSWDE.js} +1 -1
- package/dist/chunk-VVVCCB6R.js +2 -0
- package/dist/{chunk-MY42EWZP.js → chunk-W45TLOOT.js} +1 -1
- package/dist/{chunk-FAAAHE5O.cjs → chunk-WC7H45ZG.cjs} +3 -3
- package/dist/chunk-WJBQ2NBD.cjs +1 -0
- package/dist/{chunk-ATBH763U.js → chunk-WPM6LFCY.js} +1 -1
- package/dist/chunk-XBQ6HV3T.cjs +114 -0
- package/dist/{chunk-C2PXMVR5.js → chunk-Y2YAKDEQ.js} +1 -1
- package/dist/chunk-YENNL5HG.js +2 -0
- package/dist/{chunk-SYEP5QLG.js → chunk-YUUXFD73.js} +1 -1
- package/dist/{chunk-NWCREF47.js → chunk-YZEMLLD2.js} +1 -1
- package/dist/chunk-ZKHTFR5S.cjs +2 -0
- package/dist/{chunk-7T35572E.js → chunk-ZMG7Z3KF.js} +1 -1
- package/dist/{chunk-HLAEJB5R.js → chunk-ZRIBWDYJ.js} +1 -1
- package/dist/chunk-ZWDBPEXL.js +115 -0
- package/dist/cli/index.cjs +1 -1
- package/dist/cli/index.js +2 -2
- package/dist/client.js +1 -1
- package/dist/{d1-VPH75GI2.js → d1-HPB6B253.js} +1 -1
- package/dist/{dist-es-6TQTDPE7.js → dist-es-64F22JL2.js} +2 -2
- package/dist/{dist-es-XZBHIIKY.js → dist-es-F2ZR55UK.js} +2 -2
- package/dist/dist-es-IPSSZNFP.js +1 -0
- package/dist/{dist-es-SJ76GYCI.js → dist-es-M2F7M27Y.js} +1 -1
- package/dist/{dist-es-U4ZB3ZDA.js → dist-es-M66JKZF5.js} +1 -1
- package/dist/{dist-es-MNIQZC4U.js → dist-es-OKLLRYI3.js} +2 -2
- package/dist/{dist-es-TX4DBXEW.js → dist-es-SVHZDVUF.js} +2 -2
- package/dist/{dist-es-EMUQ6ZNZ.js → dist-es-WFI55HKT.js} +1 -1
- package/dist/drizzle/index.cjs +1 -1
- package/dist/drizzle/index.d.cts +1 -0
- package/dist/drizzle/index.d.ts +1 -0
- package/dist/drizzle/index.js +1 -1
- package/dist/drizzle-orm-XRTSOQJS.js +1 -0
- package/dist/event-streams-7NAWZW2I.js +1 -0
- package/dist/fields/index.js +1 -1
- package/dist/fs-KWBRQ6T6.js +1 -0
- package/dist/fs-ZQYOJOIO.cjs +1 -0
- package/dist/graphql/index.js +1 -1
- package/dist/index.cjs +9 -9
- package/dist/index.js +10 -10
- package/dist/integration.js +1 -1
- package/dist/{jsonwebtoken-S7BG2YWK.js → jsonwebtoken-OD67R5JS.js} +3 -3
- package/dist/{lib-IYW32OER.js → lib-XXYYUPMW.js} +3 -3
- package/dist/{loadSso-YTG2GQGW.js → loadSso-UQR6545M.js} +1 -1
- package/dist/local-3V3XEQUY.js +1 -0
- package/dist/media-E762GEHL.js +1 -0
- package/dist/mongo-auth-adapter-QDXVHREJ.js +1 -0
- package/dist/{mongo-auth-adapter-7K64Y2QM.cjs → mongo-auth-adapter-W3HLB7OR.cjs} +1 -1
- package/dist/mongodb/index.cjs +1 -1
- package/dist/mongodb/index.js +1 -1
- package/dist/{nodemailer-AXROO37D.js → nodemailer-NITB45SS.js} +3 -3
- package/dist/postgres-auth-adapter-SK3N3OSS.js +1 -0
- package/dist/postgres-auth-adapter-ZO6HK5AK.cjs +1 -0
- package/dist/postgres-js-3Y54EXVQ.cjs +1 -1
- package/dist/postgres-js-4CI7FMYS.js +1 -0
- package/dist/redis-adapter-QPCTMF55.js +1 -0
- package/dist/rest/index.cjs +1 -1
- package/dist/rest/index.js +1 -1
- package/dist/schema-YFMSJK2P.js +2 -0
- package/dist/{signin-KZBIAHGS.js → signin-N3T2KF5Q.js} +1 -1
- package/dist/sqlite-adapter-4TPNROJK.js +1 -0
- package/dist/src-QBADSZV4.js +1 -0
- package/dist/{sso-oidc-SX5OIQGG.js → sso-oidc-UB7G4END.js} +1 -1
- package/dist/{sts-HVGDJYIF.js → sts-WAA6I22C.js} +1 -1
- package/dist/templates/index.js +1 -1
- package/dist/trpc/index.js +1 -1
- package/dist/ws/index.js +1 -1
- package/package.json +2 -2
- package/dist/bcryptjs-AZA6WEN2.js +0 -2
- package/dist/bootstrap-7CI3NVSY.js +0 -1
- package/dist/bootstrap-DOOM2CNQ.cjs +0 -1
- package/dist/chokidar-24HVS6XD.cjs +0 -5
- package/dist/chokidar-43DT7CVN.js +0 -6
- package/dist/chunk-5DWYVUQR.cjs +0 -1
- package/dist/chunk-6QWLXJ7L.js +0 -2
- package/dist/chunk-B3GDQ7UI.cjs +0 -114
- package/dist/chunk-BLH2MRK4.js +0 -2
- package/dist/chunk-EOOZDOL7.js +0 -3
- package/dist/chunk-IIOVJTCD.cjs +0 -1
- package/dist/chunk-L4ZAI2XB.cjs +0 -269
- package/dist/chunk-PL5AIE6F.js +0 -2
- package/dist/chunk-QDHP5E4P.cjs +0 -2
- package/dist/chunk-R2CLQMNJ.js +0 -270
- package/dist/chunk-R4LXRAMX.js +0 -2
- package/dist/chunk-SVYUTQVE.js +0 -115
- package/dist/chunk-UB5TJHQR.js +0 -2
- package/dist/chunk-XPPVX4GQ.cjs +0 -1
- package/dist/chunk-XRINX47D.js +0 -2
- package/dist/dist-es-6SVFVYN3.js +0 -1
- package/dist/drizzle-orm-7YTX5NTT.js +0 -1
- package/dist/event-streams-25YJ2Z6R.js +0 -1
- package/dist/fs-DGKZLRM6.cjs +0 -1
- package/dist/fs-YZJ5FM6J.js +0 -2
- package/dist/local-VDCSEMC2.js +0 -1
- package/dist/media-HK2IZMUZ.js +0 -1
- package/dist/mongo-auth-adapter-BUKINEZL.js +0 -1
- package/dist/postgres-auth-adapter-2M4RNEY3.cjs +0 -1
- package/dist/postgres-auth-adapter-MKSHIJDL.js +0 -1
- package/dist/postgres-js-INQPBHJP.js +0 -1
- package/dist/redis-adapter-SXOXLHNH.js +0 -1
- package/dist/schema-XC5ISGNR.js +0 -2
- package/dist/sqlite-adapter-DV7ZX2EJ.js +0 -1
- package/dist/src-GZRZ4VAO.js +0 -1
- /package/dist/{chunk-P7XYIKL6.cjs → chunk-YUER4JU3.cjs} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {a}from'./chunk-OLRCZ6E3.js';import {g as g$1}from'./chunk-Y2YAKDEQ.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
2
|
g$1();function g(i){let{title:e,previewText:t=e,badgeText:r="Security Notification",badgeType:s="info",bodyHtml:o,ctaText:a,ctaUrl:n,secondaryCtaText:l,secondaryCtaUrl:p}=i,u="#eff6ff",f="#bfdbfe",h="#1d4ed8";return s==="success"?(u="#ecfdf5",f="#a7f3d0",h="#047857"):s==="warning"?(u="#fffbeb",f="#fde68a",h="#b45309"):s==="error"&&(u="#fef2f2",f="#fecaca",h="#b91c1c"),`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
@@ -283,7 +283,7 @@ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:o,text:a}}g$1();fun
|
|
|
283
283
|
Accept your invitation here:
|
|
284
284
|
${i}
|
|
285
285
|
|
|
286
|
-
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:o,text:a}}g$1();function k(){return {verifyEmail:(i,e)=>x(i,e),resetPassword:(i,e)=>_(i,e),welcome:(i,e)=>S(i,e),passwordChanged:i=>T(i),magicLink:(i,e,t)=>w(i,e,t),accountLocked:(i,e,t)=>C(i,e,t),newLogin:(i,e,t="User")=>{let r="Security Alert: New Sign-in to Kyro CMS",s=`New login detected for ${t} at ${e} from ${i}.`,o=`<p>${s}</p>`;return {subject:r,html:o,text:s}},userInvite:(i,e,t)=>E(i,e,t)}}g$1();var v=false,b=class i{db;cache={};loaded=false;static SENSITIVE_KEYS=["storage.s3.secret_access_key","storage.r2.secret_access_key","storage.gcs.private_key","storage.backblaze.application_key","storage.wasabi.secret_access_key","storage.ftp.password","storage.bunny.api_key","storage.cloudinary.api_secret","storage.imgix.sign_key","email.smtp.pass","auth.jwt_secret","auth.github_secret","auth.google_secret","auth.app_secret","database.url","redis.url","auth.admin_password"];constructor(e){this.db=e;}async load(){if(!this.loaded){await this.ensureSettingsTable();try{if(typeof this.db?.select=="function"){let e=await this.db.select().from(a);this.cache=e.reduce((t,r)=>(t[r.key]=r.value,t),{});}await this.loadFromGlobals();}catch{console.warn("ConfigService: Could not load settings from database, using environment fallbacks.");}this.loaded=true;}}async ensureSettingsTable(){if(!v)try{if(typeof this.db?.execute=="function"){let{sql:e}=await import('./drizzle-orm-
|
|
286
|
+
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:o,text:a}}g$1();function k(){return {verifyEmail:(i,e)=>x(i,e),resetPassword:(i,e)=>_(i,e),welcome:(i,e)=>S(i,e),passwordChanged:i=>T(i),magicLink:(i,e,t)=>w(i,e,t),accountLocked:(i,e,t)=>C(i,e,t),newLogin:(i,e,t="User")=>{let r="Security Alert: New Sign-in to Kyro CMS",s=`New login detected for ${t} at ${e} from ${i}.`,o=`<p>${s}</p>`;return {subject:r,html:o,text:s}},userInvite:(i,e,t)=>E(i,e,t)}}g$1();var v=false,b=class i{db;cache={};loaded=false;static SENSITIVE_KEYS=["storage.s3.secret_access_key","storage.r2.secret_access_key","storage.gcs.private_key","storage.backblaze.application_key","storage.wasabi.secret_access_key","storage.ftp.password","storage.bunny.api_key","storage.cloudinary.api_secret","storage.imgix.sign_key","email.smtp.pass","auth.jwt_secret","auth.github_secret","auth.google_secret","auth.app_secret","database.url","redis.url","auth.admin_password"];constructor(e){this.db=e;}async load(){if(!this.loaded){await this.ensureSettingsTable();try{if(typeof this.db?.select=="function"){let e=await this.db.select().from(a);this.cache=e.reduce((t,r)=>(t[r.key]=r.value,t),{});}await this.loadFromGlobals();}catch{console.warn("ConfigService: Could not load settings from database, using environment fallbacks.");}this.loaded=true;}}async ensureSettingsTable(){if(!v)try{if(typeof this.db?.execute=="function"){let{sql:e}=await import('./drizzle-orm-XRTSOQJS.js');await this.db.execute(e`
|
|
287
287
|
CREATE TABLE IF NOT EXISTS "settings" (
|
|
288
288
|
"key" VARCHAR(255) PRIMARY KEY,
|
|
289
289
|
"value" TEXT NOT NULL,
|
|
@@ -297,5 +297,5 @@ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:o,text:a}}g$1();fun
|
|
|
297
297
|
description TEXT,
|
|
298
298
|
updated_at TEXT
|
|
299
299
|
)
|
|
300
|
-
`),v=!0);}catch{}}async loadFromGlobals(){try{let e=null;if(typeof this.db?.findOne=="function")try{let s=await this.db.findOne({collection:"_globals_storage-settings",where:{},draft:!0});s&&(e=s);}catch{}if(!e&&typeof this.db?.execute=="function"){let{sql:s}=await import('./drizzle-orm-7YTX5NTT.js'),o=['"_globals_storage-settings"','"_globals_storage_settings"','"global_storage_settings"'];for(let a of o)try{let n=await this.db.execute(s`SELECT * FROM ${s.raw(a)} LIMIT 1`);if(e=Array.isArray(n)?n[0]:n?.rows?n.rows[0]:null,e)break}catch{}}else if(!e&&typeof this.db?.prepare=="function"){let s=['"_globals_storage-settings"','"_globals_storage_settings"','"global_storage_settings"'];for(let o of s)try{if(e=this.db.prepare(`SELECT * FROM ${o} LIMIT 1`).get(),e)break}catch{}}if(!e)return;let t=s=>{if(!s)return null;if(typeof s=="string")try{return JSON.parse(s)}catch{return null}return s},r=e.provider||"local";if(this.cache["storage.type"]=r,r==="local"){let s=t(e.local);this.cache["storage.local.dir"]=s?.uploadDir||"./public/uploads",this.cache["storage.local.url"]=s?.baseUrl||"/uploads";}if(r==="aws"){let s=t(e.aws);this.cache["storage.s3.bucket"]=s?.bucket||"",this.cache["storage.s3.region"]=s?.region||"us-east-1",this.cache["storage.s3.access_key_id"]=s?.accessKeyId||"",this.cache["storage.s3.secret_access_key"]=s?.secretAccessKey||"",this.cache["storage.s3.endpoint"]=s?.endpoint||"",this.cache["storage.s3.cdn_url"]=s?.cdnUrl||"",this.cache["storage.s3.prefix"]=s?.prefix||"";}if(r==="r2"){let s=t(e.r2);this.cache["storage.r2.account_id"]=s?.accountId||"",this.cache["storage.r2.access_key_id"]=s?.accessKeyId||"",this.cache["storage.r2.secret_access_key"]=s?.secretAccessKey||"",this.cache["storage.r2.bucket"]=s?.bucket||"",this.cache["storage.r2.cdn_url"]=s?.cdnUrl||"",this.cache["storage.r2.prefix"]=s?.prefix||"";}if(r==="cloudinary"){let s=t(e.cloudinary);this.cache["storage.cloudinary.cloud_name"]=s?.cloudName||"",this.cache["storage.cloudinary.api_key"]=s?.apiKey||"",this.cache["storage.cloudinary.api_secret"]=s?.apiSecret||"",this.cache["storage.cloudinary.folder"]=s?.folder||"";}if(r==="ftp"){let s=t(e.ftp);this.cache["storage.ftp.host"]=s?.host||"",this.cache["storage.ftp.port"]=String(s?.port||"21"),this.cache["storage.ftp.user"]=s?.user||"",this.cache["storage.ftp.password"]=s?.password||"",this.cache["storage.ftp.secure"]=s?.secure?"true":"false",this.cache["storage.ftp.base_url"]=s?.baseUrl||"",this.cache["storage.ftp.prefix"]=s?.prefix||"";}}catch(e){console.warn("ConfigService: Could not load storage settings from globals table:",e);}try{let e=null;if(typeof this.db?.findOne=="function")try{let t=await this.db.findOne({collection:"_globals_email-settings",where:{},draft:!0});t&&(e=t);}catch{}if(!e&&typeof this.db?.execute=="function"){let{sql:t}=await import('./drizzle-orm-7YTX5NTT.js'),r=['"_globals_email-settings"','"_globals_email_settings"','"global_email_settings"'];for(let s of r)try{let o=await this.db.execute(t`SELECT * FROM ${t.raw(s)} LIMIT 1`);if(e=Array.isArray(o)?o[0]:o?.rows?o.rows[0]:null,e)break}catch{}}else if(!e&&typeof this.db?.prepare=="function"){let t=['"_globals_email-settings"','"_globals_email_settings"','"global_email_settings"'];for(let r of t)try{if(e=this.db.prepare(`SELECT * FROM ${r} LIMIT 1`).get(),e)break}catch{}}if(e){let t=r=>{if(!r)return null;if(typeof r=="string")try{return JSON.parse(r)}catch{return null}return r};if(this.cache["email.provider"]=e.provider||"smtp",this.cache["email.smtp.from"]=e.fromEmail||"",this.cache["email.smtp.from_name"]=e.fromName||"",this.cache["email.smtp.reply_to"]=e.replyTo||"",e.provider==="smtp"){let r=t(e.smtp);this.cache["email.smtp.host"]=r?.host||"",this.cache["email.smtp.port"]=String(r?.port||"587"),this.cache["email.smtp.user"]=r?.username||"",this.cache["email.smtp.pass"]=r?.password||"",this.cache["email.smtp.secure"]=r?.secure?"true":"false";}else if(e.provider==="resend"){let r=t(e.resend);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="sendgrid"){let r=t(e.sendgrid);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="mailgun"){let r=t(e.mailgun);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="ses"){let r=t(e.ses);this.cache["email.smtp.user"]=r?.accessKeyId||"",this.cache["email.smtp.pass"]=r?.secretAccessKey||"";}}}catch(e){console.warn("ConfigService: Could not load email settings from globals table:",e);}}get(e,t,r){return this.cache[e]?this.cache[e]:t&&process.env[t]?process.env[t]:r}getStorageConfig(){let e="local";return typeof globalThis.STORAGE_BUCKET<"u"&&(e="cloudflare_r2"),{type:this.get("storage.type","STORAGE_TYPE",e),s3:{bucket:this.get("storage.s3.bucket","STORAGE_BUCKET"),region:this.get("storage.s3.region","STORAGE_REGION","us-east-1"),accessKeyId:this.get("storage.s3.access_key_id","STORAGE_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.s3.secret_access_key","STORAGE_SECRET_ACCESS_KEY"),endpoint:this.get("storage.s3.endpoint","STORAGE_ENDPOINT"),cdnUrl:this.get("storage.s3.cdn_url","STORAGE_CDN_URL"),prefix:this.get("storage.s3.prefix","STORAGE_PREFIX")},r2:{accountId:this.get("storage.r2.account_id","R2_ACCOUNT_ID"),accessKeyId:this.get("storage.r2.access_key_id","R2_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.r2.secret_access_key","R2_SECRET_ACCESS_KEY"),bucket:this.get("storage.r2.bucket","R2_BUCKET"),cdnUrl:this.get("storage.r2.cdn_url","R2_CDN_URL"),prefix:this.get("storage.r2.prefix","R2_PREFIX")},gcs:{bucket:this.get("storage.gcs.bucket","GCS_BUCKET"),projectId:this.get("storage.gcs.project_id","GCS_PROJECT_ID"),clientEmail:this.get("storage.gcs.client_email","GCS_CLIENT_EMAIL"),privateKey:this.get("storage.gcs.private_key","GCS_PRIVATE_KEY"),cdnUrl:this.get("storage.gcs.cdn_url","GCS_CDN_URL"),prefix:this.get("storage.gcs.prefix","GCS_PREFIX")},digitalocean:{bucket:this.get("storage.digitalocean.bucket","DO_BUCKET"),region:this.get("storage.digitalocean.region","DO_REGION","nyc3"),accessKeyId:this.get("storage.digitalocean.access_key_id","DO_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.digitalocean.secret_access_key","DO_SECRET_ACCESS_KEY"),cdnUrl:this.get("storage.digitalocean.cdn_url","DO_CDN_URL"),prefix:this.get("storage.digitalocean.prefix","DO_PREFIX")},backblaze:{bucket:this.get("storage.backblaze.bucket","BB_BUCKET"),accountId:this.get("storage.backblaze.account_id","BB_ACCOUNT_ID"),applicationKeyId:this.get("storage.backblaze.application_key_id","BB_APPLICATION_KEY_ID"),applicationKey:this.get("storage.backblaze.application_key","BB_APPLICATION_KEY"),cdnUrl:this.get("storage.backblaze.cdn_url","BB_CDN_URL"),prefix:this.get("storage.backblaze.prefix","BB_PREFIX")},wasabi:{bucket:this.get("storage.wasabi.bucket","WASABI_BUCKET"),region:this.get("storage.wasabi.region","WASABI_REGION","us-east-1"),accessKeyId:this.get("storage.wasabi.access_key_id","WASABI_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.wasabi.secret_access_key","WASABI_SECRET_ACCESS_KEY"),cdnUrl:this.get("storage.wasabi.cdn_url","WASABI_CDN_URL"),prefix:this.get("storage.wasabi.prefix","WASABI_PREFIX")},bunny:{storageZone:this.get("storage.bunny.storage_zone","BUNNY_STORAGE_ZONE"),apiKey:this.get("storage.bunny.api_key","BUNNY_API_KEY"),cdnUrl:this.get("storage.bunny.cdn_url","BUNNY_CDN_URL"),prefix:this.get("storage.bunny.prefix","BUNNY_PREFIX")},ftp:{host:this.get("storage.ftp.host","FTP_HOST"),port:parseInt(this.get("storage.ftp.port","FTP_PORT","21"),10),user:this.get("storage.ftp.user","FTP_USER"),password:this.get("storage.ftp.password","FTP_PASSWORD"),secure:this.get("storage.ftp.secure","FTP_SECURE")==="true",baseUrl:this.get("storage.ftp.base_url","FTP_BASE_URL"),prefix:this.get("storage.ftp.prefix","FTP_PREFIX")},cloudinary:{cloudName:this.get("storage.cloudinary.cloud_name","CLOUDINARY_CLOUD_NAME"),apiKey:this.get("storage.cloudinary.api_key","CLOUDINARY_API_KEY"),apiSecret:this.get("storage.cloudinary.api_secret","CLOUDINARY_API_SECRET"),folder:this.get("storage.cloudinary.folder","CLOUDINARY_FOLDER")},imgix:{domain:this.get("storage.imgix.domain","IMGIX_DOMAIN"),signKey:this.get("storage.imgix.sign_key","IMGIX_SIGN_KEY")},local:{uploadDir:this.get("storage.local.dir","STORAGE_LOCAL_DIR","./public/uploads"),baseUrl:this.get("storage.local.url","STORAGE_LOCAL_URL","/uploads")}}}getEmailConfig(){return {provider:this.get("email.provider","EMAIL_PROVIDER","smtp"),host:this.get("email.smtp.host","SMTP_HOST"),port:parseInt(this.get("email.smtp.port","SMTP_PORT","587"),10),secure:this.get("email.smtp.secure","SMTP_SECURE")==="true",user:this.get("email.smtp.user","SMTP_USER"),pass:this.get("email.smtp.pass","SMTP_PASS"),from:this.get("email.smtp.from","SMTP_FROM","noreply@example.com"),fromName:this.get("email.smtp.from_name","SMTP_FROM_NAME","Kyro CMS"),replyTo:this.get("email.smtp.reply_to","SMTP_REPLY_TO")}}maskSensitive(e,t){return t&&(i.SENSITIVE_KEYS.includes(e)?"********":t)}async set(e,t,r){await this.db.insert(a).values({key:e,value:t,description:r,updatedAt:new Date}).onConflictDoUpdate({target:[a.key],set:{value:t,description:r,updatedAt:new Date}}),this.cache[e]=t;}};g$1();var A=class i{transporter;config;templates;transporterInitialized=false;constructor(e,t){this.config=e,this.templates={...k(),...t};}async ensureTransporter(){if(this.transporterInitialized)return this.transporter;let{default:e}=await import('./nodemailer-AXROO37D.js');return this.config.provider==="smtp"&&this.config.smtp?this.transporter=e.createTransport({host:this.config.smtp.host,port:this.config.smtp.port,secure:this.config.smtp.secure,auth:this.config.smtp.auth}):this.config.provider==="ses"&&this.config.ses&&(this.transporter=e.createTransport({host:`email-smtp.${this.config.ses.region}.amazonaws.com`,port:587,secure:false,auth:{user:this.config.ses.accessKeyId,pass:this.config.ses.secretAccessKey}})),this.transporterInitialized=true,this.transporter}async send(e){let{provider:t,from:r,fromName:s,replyTo:o}=this.config,a=`"${s||"Kyro CMS"}" <${r}>`,n=e.replyTo||o;try{let l;switch(t){case "smtp":case "ses":{let p=await this.ensureTransporter();if(!p)throw new Error(`${t} transporter not initialized`);l=await p.sendMail({from:a,to:Array.isArray(e.to)?e.to.join(", "):e.to,subject:e.subject,html:e.html,text:e.text,replyTo:n});}break;case "resend":l=await this.sendViaResend(a,e,n);break;case "sendgrid":l=await this.sendViaSendGrid(a,e,n);break;case "mailgun":l=await this.sendViaMailgun(a,e,n);break;default:throw new Error(`Unsupported email provider: ${t}`)}return l}catch(l){throw console.error("[EmailTransport] FAILED to send email:",l.message),l.response&&console.error("[EmailTransport] Provider Error Detail:",JSON.stringify(l.response,null,2)),l}}async sendViaResend(e,t,r){let s=this.config.resend?.apiKey;if(!s)throw new Error("Resend API Key missing");let o={from:e,to:t.to,subject:t.subject,html:t.html,text:t.text,reply_to:r},a=await fetch("https://api.resend.com/emails",{method:"POST",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!a.ok){let n=await a.json();throw new Error(`Resend Error: ${JSON.stringify(n)}`)}return a.json()}async sendViaSendGrid(e,t,r){let s=this.config.sendgrid?.apiKey;if(!s)throw new Error("SendGrid API Key missing");let o={personalizations:[{to:Array.isArray(t.to)?t.to.map(n=>({email:n})):[{email:t.to}]}],from:{email:e.match(/<(.+)>/)?.[1]||e,name:e.match(/"(.+)"/)?.[1]},subject:t.subject,content:[{type:"text/plain",value:t.text||""},{type:"text/html",value:t.html}],reply_to:r?{email:r}:void 0},a=await fetch("https://api.sendgrid.com/v3/mail/send",{method:"POST",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!a.ok){let n=await a.json();throw new Error(`SendGrid Error: ${JSON.stringify(n)}`)}return {success:true}}async sendViaMailgun(e,t,r){let{apiKey:s,domain:o,region:a}=this.config.mailgun||{};if(!s||!o)throw new Error("Mailgun config missing");let n=a==="eu"?"api.eu.mailgun.net":"api.mailgun.net",l=btoa(`api:${s}`),p=new URLSearchParams;p.append("from",e);let u=Array.isArray(t.to)?t.to.join(", "):t.to;p.append("to",u),p.append("subject",t.subject),p.append("html",t.html),t.text&&p.append("text",t.text),r&&p.append("h:Reply-To",r);let f=await fetch(`https://${n}/v3/${o}/messages`,{method:"POST",headers:{Authorization:`Basic ${l}`,"Content-Type":"application/x-www-form-urlencoded"},body:p});if(!f.ok){let h=await f.json();throw new Error(`Mailgun Error: ${JSON.stringify(h)}`)}return f.json()}getTemplates(){return this.templates}async verifyConnection(){if(this.config.provider==="smtp"||this.config.provider==="ses")try{let e=await this.ensureTransporter();if(e)return await e.verify(),!0}catch{return false}return !!(this.config.resend?.apiKey||this.config.sendgrid?.apiKey||this.config.mailgun?.apiKey)}static async fromConfig(e){let t=new b(e);await t.load();let r=t.getEmailConfig();if(!r.provider)return this.fromEnv();let s={provider:r.provider||"smtp",from:r.from||"noreply@example.com",fromName:r.fromName,replyTo:r.replyTo,smtp:r.provider==="smtp"?{host:r.host||"",port:r.port||587,secure:r.secure||false,auth:{user:r.user||"",pass:r.pass||""}}:void 0,resend:r.provider==="resend"?{apiKey:r.pass||""}:void 0,sendgrid:r.provider==="sendgrid"?{apiKey:r.pass||""}:void 0,mailgun:r.provider==="mailgun"?{apiKey:r.pass||"",domain:r.host||"",region:r.secure?"eu":"us"}:void 0,ses:r.provider==="ses"?{accessKeyId:r.user||"",secretAccessKey:r.pass||"",region:r.host||"us-east-1"}:void 0};return new i(s)}static fromEnv(){let e=process.env.EMAIL_PROVIDER||"smtp",t=process.env.SMTP_FROM||process.env.DEFAULT_FROM||"noreply@example.com",r=process.env.SMTP_FROM_NAME||"Kyro CMS",s=process.env.SMTP_REPLY_TO;if(e==="smtp"){let o=process.env.SMTP_HOST,a=process.env.SMTP_USER,n=process.env.SMTP_PASS;return !o||!a||!n?null:new i({provider:"smtp",from:t,fromName:r,replyTo:s,smtp:{host:o,port:parseInt(process.env.SMTP_PORT||"587",10),secure:process.env.SMTP_SECURE==="true",auth:{user:a,pass:n}}})}if(e==="resend"){let o=process.env.RESEND_API_KEY||process.env.SMTP_PASS;return o?new i({provider:"resend",from:t,fromName:r,replyTo:s,resend:{apiKey:o}}):null}if(e==="sendgrid"){let o=process.env.SENDGRID_API_KEY||process.env.SMTP_PASS;return o?new i({provider:"sendgrid",from:t,fromName:r,replyTo:s,sendgrid:{apiKey:o}}):null}if(e==="mailgun"){let o=process.env.MAILGUN_API_KEY||process.env.SMTP_PASS,a=process.env.MAILGUN_DOMAIN||process.env.SMTP_HOST;return !o||!a?null:new i({provider:"mailgun",from:t,fromName:r,replyTo:s,mailgun:{apiKey:o,domain:a,region:process.env.MAILGUN_REGION||(process.env.SMTP_SECURE==="true"?"eu":"us")}})}if(e==="ses"){let o=process.env.AWS_ACCESS_KEY_ID||process.env.SMTP_USER,a=process.env.AWS_SECRET_ACCESS_KEY||process.env.SMTP_PASS,n=process.env.AWS_REGION||process.env.SMTP_HOST||"us-east-1";return !o||!a?null:new i({provider:"ses",from:t,fromName:r,replyTo:s,ses:{accessKeyId:o,secretAccessKey:a,region:n}})}return null}};g$1();var I={minLength:12,requireUppercase:true,requireLowercase:true,requireNumbers:true,requireSpecialChars:true,preventReuse:5,maxLength:128},P=class{config;constructor(e={}){this.config={...I,...e};}validate(e){let t=[];return this.config.maxLength&&e.length>this.config.maxLength&&t.push(`Password must not exceed ${this.config.maxLength} characters`),e.length<this.config.minLength&&t.push(`Password must be at least ${this.config.minLength} characters`),this.config.requireUppercase&&!/[A-Z]/.test(e)&&t.push("Password must contain at least one uppercase letter"),this.config.requireLowercase&&!/[a-z]/.test(e)&&t.push("Password must contain at least one lowercase letter"),this.config.requireNumbers&&!/[0-9]/.test(e)&&t.push("Password must contain at least one number"),this.config.requireSpecialChars&&!/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(e)&&t.push("Password must contain at least one special character"),["password","123456","12345678","qwerty","abc123","monkey","1234567","letmein","trustno1","dragon","baseball","iloveyou","master","sunshine","ashley","football","password1","shadow","123123","654321"].includes(e.toLowerCase())&&t.push("This password is too common. Please choose a more secure password"),(/^[a-zA-Z]+$/.test(e)||/^[0-9]+$/.test(e))&&t.push("Password must contain a mix of letters, numbers, and/or special characters"),/(.)\1{2,}/.test(e)&&t.push("Password must not contain more than 2 consecutive identical characters"),/^(012|123|234|345|456|567|678|789|890|098|987|876|765|654|543|432|321|210)+$/i.test(e)&&t.push("Password must not contain sequential numbers or letters"),{valid:t.length===0,errors:t}}async checkReuse(e,t,r){return {valid:true,errors:[]}}async isInHistory(e,t,r){for(let s of t)if(await r(e,s))return true;return false}generatePassword(e=16){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZ",r="abcdefghijklmnopqrstuvwxyz",s="0123456789",o="!@#$%^&*()_+-=[]{}|;:,.<>?",a="";a+=t[Math.floor(Math.random()*t.length)],a+=r[Math.floor(Math.random()*r.length)],a+=s[Math.floor(Math.random()*s.length)],a+=o[Math.floor(Math.random()*o.length)];let n=t+r+s+o;for(let l=a.length;l<e;l++)a+=n[Math.floor(Math.random()*n.length)];return a.split("").sort(()=>Math.random()-.5).join("")}getStrength(e){let t=0,r=[];e.length>=8&&(t+=1),e.length>=12&&(t+=1),e.length>=16&&(t+=1),/[a-z]/.test(e)&&(t+=1),/[A-Z]/.test(e)&&(t+=1),/[0-9]/.test(e)&&(t+=1),/[!@#$%^&*()_+\-=\[\]{}|;:,.<>?]/.test(e)&&(t+=1),e.length>8&&(t+=1),e.length>12&&(t+=1);let s=new Set(e).size;s>6&&(t+=1),s>10&&(t+=1);let o;return t<=3?(o="Weak",r.push("Add more characters"),r.push("Include uppercase and lowercase letters")):t<=5?(o="Fair",r.push("Add special characters"),r.push("Consider making it longer")):t<=7?(o="Good",r.push("Consider making it longer for extra security")):o="Strong",{score:t,label:o,feedback:r}}setConfig(e){this.config={...this.config,...e};}getConfig(){return {...this.config}}};
|
|
300
|
+
`),v=!0);}catch{}}async loadFromGlobals(){try{let e=null;if(typeof this.db?.findOne=="function")try{let s=await this.db.findOne({collection:"_globals_storage-settings",where:{},draft:!0});s&&(e=s);}catch{}if(!e&&typeof this.db?.execute=="function"){let{sql:s}=await import('./drizzle-orm-XRTSOQJS.js'),o=['"_globals_storage-settings"','"_globals_storage_settings"','"global_storage_settings"'];for(let a of o)try{let n=await this.db.execute(s`SELECT * FROM ${s.raw(a)} LIMIT 1`);if(e=Array.isArray(n)?n[0]:n?.rows?n.rows[0]:null,e)break}catch{}}else if(!e&&typeof this.db?.prepare=="function"){let s=['"_globals_storage-settings"','"_globals_storage_settings"','"global_storage_settings"'];for(let o of s)try{if(e=this.db.prepare(`SELECT * FROM ${o} LIMIT 1`).get(),e)break}catch{}}if(!e)return;let t=s=>{if(!s)return null;if(typeof s=="string")try{return JSON.parse(s)}catch{return null}return s},r=e.provider||"local";if(this.cache["storage.type"]=r,r==="local"){let s=t(e.local);this.cache["storage.local.dir"]=s?.uploadDir||"./public/uploads",this.cache["storage.local.url"]=s?.baseUrl||"/uploads";}if(r==="aws"){let s=t(e.aws);this.cache["storage.s3.bucket"]=s?.bucket||"",this.cache["storage.s3.region"]=s?.region||"us-east-1",this.cache["storage.s3.access_key_id"]=s?.accessKeyId||"",this.cache["storage.s3.secret_access_key"]=s?.secretAccessKey||"",this.cache["storage.s3.endpoint"]=s?.endpoint||"",this.cache["storage.s3.cdn_url"]=s?.cdnUrl||"",this.cache["storage.s3.prefix"]=s?.prefix||"";}if(r==="r2"){let s=t(e.r2);this.cache["storage.r2.account_id"]=s?.accountId||"",this.cache["storage.r2.access_key_id"]=s?.accessKeyId||"",this.cache["storage.r2.secret_access_key"]=s?.secretAccessKey||"",this.cache["storage.r2.bucket"]=s?.bucket||"",this.cache["storage.r2.cdn_url"]=s?.cdnUrl||"",this.cache["storage.r2.prefix"]=s?.prefix||"";}if(r==="cloudinary"){let s=t(e.cloudinary);this.cache["storage.cloudinary.cloud_name"]=s?.cloudName||"",this.cache["storage.cloudinary.api_key"]=s?.apiKey||"",this.cache["storage.cloudinary.api_secret"]=s?.apiSecret||"",this.cache["storage.cloudinary.folder"]=s?.folder||"";}if(r==="ftp"){let s=t(e.ftp);this.cache["storage.ftp.host"]=s?.host||"",this.cache["storage.ftp.port"]=String(s?.port||"21"),this.cache["storage.ftp.user"]=s?.user||"",this.cache["storage.ftp.password"]=s?.password||"",this.cache["storage.ftp.secure"]=s?.secure?"true":"false",this.cache["storage.ftp.base_url"]=s?.baseUrl||"",this.cache["storage.ftp.prefix"]=s?.prefix||"";}}catch(e){console.warn("ConfigService: Could not load storage settings from globals table:",e);}try{let e=null;if(typeof this.db?.findOne=="function")try{let t=await this.db.findOne({collection:"_globals_email-settings",where:{},draft:!0});t&&(e=t);}catch{}if(!e&&typeof this.db?.execute=="function"){let{sql:t}=await import('./drizzle-orm-XRTSOQJS.js'),r=['"_globals_email-settings"','"_globals_email_settings"','"global_email_settings"'];for(let s of r)try{let o=await this.db.execute(t`SELECT * FROM ${t.raw(s)} LIMIT 1`);if(e=Array.isArray(o)?o[0]:o?.rows?o.rows[0]:null,e)break}catch{}}else if(!e&&typeof this.db?.prepare=="function"){let t=['"_globals_email-settings"','"_globals_email_settings"','"global_email_settings"'];for(let r of t)try{if(e=this.db.prepare(`SELECT * FROM ${r} LIMIT 1`).get(),e)break}catch{}}if(e){let t=r=>{if(!r)return null;if(typeof r=="string")try{return JSON.parse(r)}catch{return null}return r};if(this.cache["email.provider"]=e.provider||"smtp",this.cache["email.smtp.from"]=e.fromEmail||"",this.cache["email.smtp.from_name"]=e.fromName||"",this.cache["email.smtp.reply_to"]=e.replyTo||"",e.provider==="smtp"){let r=t(e.smtp);this.cache["email.smtp.host"]=r?.host||"",this.cache["email.smtp.port"]=String(r?.port||"587"),this.cache["email.smtp.user"]=r?.username||"",this.cache["email.smtp.pass"]=r?.password||"",this.cache["email.smtp.secure"]=r?.secure?"true":"false";}else if(e.provider==="resend"){let r=t(e.resend);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="sendgrid"){let r=t(e.sendgrid);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="mailgun"){let r=t(e.mailgun);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="ses"){let r=t(e.ses);this.cache["email.smtp.user"]=r?.accessKeyId||"",this.cache["email.smtp.pass"]=r?.secretAccessKey||"";}}}catch(e){console.warn("ConfigService: Could not load email settings from globals table:",e);}}get(e,t,r){return this.cache[e]?this.cache[e]:t&&process.env[t]?process.env[t]:r}getStorageConfig(){let e="local";return typeof globalThis.STORAGE_BUCKET<"u"&&(e="cloudflare_r2"),{type:this.get("storage.type","STORAGE_TYPE",e),s3:{bucket:this.get("storage.s3.bucket","STORAGE_BUCKET"),region:this.get("storage.s3.region","STORAGE_REGION","us-east-1"),accessKeyId:this.get("storage.s3.access_key_id","STORAGE_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.s3.secret_access_key","STORAGE_SECRET_ACCESS_KEY"),endpoint:this.get("storage.s3.endpoint","STORAGE_ENDPOINT"),cdnUrl:this.get("storage.s3.cdn_url","STORAGE_CDN_URL"),prefix:this.get("storage.s3.prefix","STORAGE_PREFIX")},r2:{accountId:this.get("storage.r2.account_id","R2_ACCOUNT_ID"),accessKeyId:this.get("storage.r2.access_key_id","R2_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.r2.secret_access_key","R2_SECRET_ACCESS_KEY"),bucket:this.get("storage.r2.bucket","R2_BUCKET"),cdnUrl:this.get("storage.r2.cdn_url","R2_CDN_URL"),prefix:this.get("storage.r2.prefix","R2_PREFIX")},gcs:{bucket:this.get("storage.gcs.bucket","GCS_BUCKET"),projectId:this.get("storage.gcs.project_id","GCS_PROJECT_ID"),clientEmail:this.get("storage.gcs.client_email","GCS_CLIENT_EMAIL"),privateKey:this.get("storage.gcs.private_key","GCS_PRIVATE_KEY"),cdnUrl:this.get("storage.gcs.cdn_url","GCS_CDN_URL"),prefix:this.get("storage.gcs.prefix","GCS_PREFIX")},digitalocean:{bucket:this.get("storage.digitalocean.bucket","DO_BUCKET"),region:this.get("storage.digitalocean.region","DO_REGION","nyc3"),accessKeyId:this.get("storage.digitalocean.access_key_id","DO_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.digitalocean.secret_access_key","DO_SECRET_ACCESS_KEY"),cdnUrl:this.get("storage.digitalocean.cdn_url","DO_CDN_URL"),prefix:this.get("storage.digitalocean.prefix","DO_PREFIX")},backblaze:{bucket:this.get("storage.backblaze.bucket","BB_BUCKET"),accountId:this.get("storage.backblaze.account_id","BB_ACCOUNT_ID"),applicationKeyId:this.get("storage.backblaze.application_key_id","BB_APPLICATION_KEY_ID"),applicationKey:this.get("storage.backblaze.application_key","BB_APPLICATION_KEY"),cdnUrl:this.get("storage.backblaze.cdn_url","BB_CDN_URL"),prefix:this.get("storage.backblaze.prefix","BB_PREFIX")},wasabi:{bucket:this.get("storage.wasabi.bucket","WASABI_BUCKET"),region:this.get("storage.wasabi.region","WASABI_REGION","us-east-1"),accessKeyId:this.get("storage.wasabi.access_key_id","WASABI_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.wasabi.secret_access_key","WASABI_SECRET_ACCESS_KEY"),cdnUrl:this.get("storage.wasabi.cdn_url","WASABI_CDN_URL"),prefix:this.get("storage.wasabi.prefix","WASABI_PREFIX")},bunny:{storageZone:this.get("storage.bunny.storage_zone","BUNNY_STORAGE_ZONE"),apiKey:this.get("storage.bunny.api_key","BUNNY_API_KEY"),cdnUrl:this.get("storage.bunny.cdn_url","BUNNY_CDN_URL"),prefix:this.get("storage.bunny.prefix","BUNNY_PREFIX")},ftp:{host:this.get("storage.ftp.host","FTP_HOST"),port:parseInt(this.get("storage.ftp.port","FTP_PORT","21"),10),user:this.get("storage.ftp.user","FTP_USER"),password:this.get("storage.ftp.password","FTP_PASSWORD"),secure:this.get("storage.ftp.secure","FTP_SECURE")==="true",baseUrl:this.get("storage.ftp.base_url","FTP_BASE_URL"),prefix:this.get("storage.ftp.prefix","FTP_PREFIX")},cloudinary:{cloudName:this.get("storage.cloudinary.cloud_name","CLOUDINARY_CLOUD_NAME"),apiKey:this.get("storage.cloudinary.api_key","CLOUDINARY_API_KEY"),apiSecret:this.get("storage.cloudinary.api_secret","CLOUDINARY_API_SECRET"),folder:this.get("storage.cloudinary.folder","CLOUDINARY_FOLDER")},imgix:{domain:this.get("storage.imgix.domain","IMGIX_DOMAIN"),signKey:this.get("storage.imgix.sign_key","IMGIX_SIGN_KEY")},local:{uploadDir:this.get("storage.local.dir","STORAGE_LOCAL_DIR","./public/uploads"),baseUrl:this.get("storage.local.url","STORAGE_LOCAL_URL","/uploads")}}}getEmailConfig(){return {provider:this.get("email.provider","EMAIL_PROVIDER","smtp"),host:this.get("email.smtp.host","SMTP_HOST"),port:parseInt(this.get("email.smtp.port","SMTP_PORT","587"),10),secure:this.get("email.smtp.secure","SMTP_SECURE")==="true",user:this.get("email.smtp.user","SMTP_USER"),pass:this.get("email.smtp.pass","SMTP_PASS"),from:this.get("email.smtp.from","SMTP_FROM","noreply@example.com"),fromName:this.get("email.smtp.from_name","SMTP_FROM_NAME","Kyro CMS"),replyTo:this.get("email.smtp.reply_to","SMTP_REPLY_TO")}}maskSensitive(e,t){return t&&(i.SENSITIVE_KEYS.includes(e)?"********":t)}async set(e,t,r){await this.db.insert(a).values({key:e,value:t,description:r,updatedAt:new Date}).onConflictDoUpdate({target:[a.key],set:{value:t,description:r,updatedAt:new Date}}),this.cache[e]=t;}};g$1();var A=class i{transporter;config;templates;transporterInitialized=false;constructor(e,t){this.config=e,this.templates={...k(),...t};}async ensureTransporter(){if(this.transporterInitialized)return this.transporter;let{default:e}=await import('./nodemailer-NITB45SS.js');return this.config.provider==="smtp"&&this.config.smtp?this.transporter=e.createTransport({host:this.config.smtp.host,port:this.config.smtp.port,secure:this.config.smtp.secure,auth:this.config.smtp.auth}):this.config.provider==="ses"&&this.config.ses&&(this.transporter=e.createTransport({host:`email-smtp.${this.config.ses.region}.amazonaws.com`,port:587,secure:false,auth:{user:this.config.ses.accessKeyId,pass:this.config.ses.secretAccessKey}})),this.transporterInitialized=true,this.transporter}async send(e){let{provider:t,from:r,fromName:s,replyTo:o}=this.config,a=`"${s||"Kyro CMS"}" <${r}>`,n=e.replyTo||o;try{let l;switch(t){case "smtp":case "ses":{let p=await this.ensureTransporter();if(!p)throw new Error(`${t} transporter not initialized`);l=await p.sendMail({from:a,to:Array.isArray(e.to)?e.to.join(", "):e.to,subject:e.subject,html:e.html,text:e.text,replyTo:n});}break;case "resend":l=await this.sendViaResend(a,e,n);break;case "sendgrid":l=await this.sendViaSendGrid(a,e,n);break;case "mailgun":l=await this.sendViaMailgun(a,e,n);break;default:throw new Error(`Unsupported email provider: ${t}`)}return l}catch(l){throw console.error("[EmailTransport] FAILED to send email:",l.message),l.response&&console.error("[EmailTransport] Provider Error Detail:",JSON.stringify(l.response,null,2)),l}}async sendViaResend(e,t,r){let s=this.config.resend?.apiKey;if(!s)throw new Error("Resend API Key missing");let o={from:e,to:t.to,subject:t.subject,html:t.html,text:t.text,reply_to:r},a=await fetch("https://api.resend.com/emails",{method:"POST",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!a.ok){let n=await a.json();throw new Error(`Resend Error: ${JSON.stringify(n)}`)}return a.json()}async sendViaSendGrid(e,t,r){let s=this.config.sendgrid?.apiKey;if(!s)throw new Error("SendGrid API Key missing");let o={personalizations:[{to:Array.isArray(t.to)?t.to.map(n=>({email:n})):[{email:t.to}]}],from:{email:e.match(/<(.+)>/)?.[1]||e,name:e.match(/"(.+)"/)?.[1]},subject:t.subject,content:[{type:"text/plain",value:t.text||""},{type:"text/html",value:t.html}],reply_to:r?{email:r}:void 0},a=await fetch("https://api.sendgrid.com/v3/mail/send",{method:"POST",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!a.ok){let n=await a.json();throw new Error(`SendGrid Error: ${JSON.stringify(n)}`)}return {success:true}}async sendViaMailgun(e,t,r){let{apiKey:s,domain:o,region:a}=this.config.mailgun||{};if(!s||!o)throw new Error("Mailgun config missing");let n=a==="eu"?"api.eu.mailgun.net":"api.mailgun.net",l=btoa(`api:${s}`),p=new URLSearchParams;p.append("from",e);let u=Array.isArray(t.to)?t.to.join(", "):t.to;p.append("to",u),p.append("subject",t.subject),p.append("html",t.html),t.text&&p.append("text",t.text),r&&p.append("h:Reply-To",r);let f=await fetch(`https://${n}/v3/${o}/messages`,{method:"POST",headers:{Authorization:`Basic ${l}`,"Content-Type":"application/x-www-form-urlencoded"},body:p});if(!f.ok){let h=await f.json();throw new Error(`Mailgun Error: ${JSON.stringify(h)}`)}return f.json()}getTemplates(){return this.templates}async verifyConnection(){if(this.config.provider==="smtp"||this.config.provider==="ses")try{let e=await this.ensureTransporter();if(e)return await e.verify(),!0}catch{return false}return !!(this.config.resend?.apiKey||this.config.sendgrid?.apiKey||this.config.mailgun?.apiKey)}static async fromConfig(e){let t=new b(e);await t.load();let r=t.getEmailConfig();if(!r.provider)return this.fromEnv();let s={provider:r.provider||"smtp",from:r.from||"noreply@example.com",fromName:r.fromName,replyTo:r.replyTo,smtp:r.provider==="smtp"?{host:r.host||"",port:r.port||587,secure:r.secure||false,auth:{user:r.user||"",pass:r.pass||""}}:void 0,resend:r.provider==="resend"?{apiKey:r.pass||""}:void 0,sendgrid:r.provider==="sendgrid"?{apiKey:r.pass||""}:void 0,mailgun:r.provider==="mailgun"?{apiKey:r.pass||"",domain:r.host||"",region:r.secure?"eu":"us"}:void 0,ses:r.provider==="ses"?{accessKeyId:r.user||"",secretAccessKey:r.pass||"",region:r.host||"us-east-1"}:void 0};return new i(s)}static fromEnv(){let e=process.env.EMAIL_PROVIDER||"smtp",t=process.env.SMTP_FROM||process.env.DEFAULT_FROM||"noreply@example.com",r=process.env.SMTP_FROM_NAME||"Kyro CMS",s=process.env.SMTP_REPLY_TO;if(e==="smtp"){let o=process.env.SMTP_HOST,a=process.env.SMTP_USER,n=process.env.SMTP_PASS;return !o||!a||!n?null:new i({provider:"smtp",from:t,fromName:r,replyTo:s,smtp:{host:o,port:parseInt(process.env.SMTP_PORT||"587",10),secure:process.env.SMTP_SECURE==="true",auth:{user:a,pass:n}}})}if(e==="resend"){let o=process.env.RESEND_API_KEY||process.env.SMTP_PASS;return o?new i({provider:"resend",from:t,fromName:r,replyTo:s,resend:{apiKey:o}}):null}if(e==="sendgrid"){let o=process.env.SENDGRID_API_KEY||process.env.SMTP_PASS;return o?new i({provider:"sendgrid",from:t,fromName:r,replyTo:s,sendgrid:{apiKey:o}}):null}if(e==="mailgun"){let o=process.env.MAILGUN_API_KEY||process.env.SMTP_PASS,a=process.env.MAILGUN_DOMAIN||process.env.SMTP_HOST;return !o||!a?null:new i({provider:"mailgun",from:t,fromName:r,replyTo:s,mailgun:{apiKey:o,domain:a,region:process.env.MAILGUN_REGION||(process.env.SMTP_SECURE==="true"?"eu":"us")}})}if(e==="ses"){let o=process.env.AWS_ACCESS_KEY_ID||process.env.SMTP_USER,a=process.env.AWS_SECRET_ACCESS_KEY||process.env.SMTP_PASS,n=process.env.AWS_REGION||process.env.SMTP_HOST||"us-east-1";return !o||!a?null:new i({provider:"ses",from:t,fromName:r,replyTo:s,ses:{accessKeyId:o,secretAccessKey:a,region:n}})}return null}};g$1();var I={minLength:12,requireUppercase:true,requireLowercase:true,requireNumbers:true,requireSpecialChars:true,preventReuse:5,maxLength:128},P=class{config;constructor(e={}){this.config={...I,...e};}validate(e){let t=[];return this.config.maxLength&&e.length>this.config.maxLength&&t.push(`Password must not exceed ${this.config.maxLength} characters`),e.length<this.config.minLength&&t.push(`Password must be at least ${this.config.minLength} characters`),this.config.requireUppercase&&!/[A-Z]/.test(e)&&t.push("Password must contain at least one uppercase letter"),this.config.requireLowercase&&!/[a-z]/.test(e)&&t.push("Password must contain at least one lowercase letter"),this.config.requireNumbers&&!/[0-9]/.test(e)&&t.push("Password must contain at least one number"),this.config.requireSpecialChars&&!/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(e)&&t.push("Password must contain at least one special character"),["password","123456","12345678","qwerty","abc123","monkey","1234567","letmein","trustno1","dragon","baseball","iloveyou","master","sunshine","ashley","football","password1","shadow","123123","654321"].includes(e.toLowerCase())&&t.push("This password is too common. Please choose a more secure password"),(/^[a-zA-Z]+$/.test(e)||/^[0-9]+$/.test(e))&&t.push("Password must contain a mix of letters, numbers, and/or special characters"),/(.)\1{2,}/.test(e)&&t.push("Password must not contain more than 2 consecutive identical characters"),/^(012|123|234|345|456|567|678|789|890|098|987|876|765|654|543|432|321|210)+$/i.test(e)&&t.push("Password must not contain sequential numbers or letters"),{valid:t.length===0,errors:t}}async checkReuse(e,t,r){return {valid:true,errors:[]}}async isInHistory(e,t,r){for(let s of t)if(await r(e,s))return true;return false}generatePassword(e=16){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZ",r="abcdefghijklmnopqrstuvwxyz",s="0123456789",o="!@#$%^&*()_+-=[]{}|;:,.<>?",a="";a+=t[Math.floor(Math.random()*t.length)],a+=r[Math.floor(Math.random()*r.length)],a+=s[Math.floor(Math.random()*s.length)],a+=o[Math.floor(Math.random()*o.length)];let n=t+r+s+o;for(let l=a.length;l<e;l++)a+=n[Math.floor(Math.random()*n.length)];return a.split("").sort(()=>Math.random()-.5).join("")}getStrength(e){let t=0,r=[];e.length>=8&&(t+=1),e.length>=12&&(t+=1),e.length>=16&&(t+=1),/[a-z]/.test(e)&&(t+=1),/[A-Z]/.test(e)&&(t+=1),/[0-9]/.test(e)&&(t+=1),/[!@#$%^&*()_+\-=\[\]{}|;:,.<>?]/.test(e)&&(t+=1),e.length>8&&(t+=1),e.length>12&&(t+=1);let s=new Set(e).size;s>6&&(t+=1),s>10&&(t+=1);let o;return t<=3?(o="Weak",r.push("Add more characters"),r.push("Include uppercase and lowercase letters")):t<=5?(o="Fair",r.push("Add special characters"),r.push("Consider making it longer")):t<=7?(o="Good",r.push("Consider making it longer for extra security")):o="Strong",{score:t,label:o,feedback:r}}setConfig(e){this.config={...this.config,...e};}getConfig(){return {...this.config}}};
|
|
301
301
|
export{g as a,x as b,_ as c,S as d,T as e,w as f,C as g,E as h,k as i,b as j,A as k,P as l};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {a,c,b,d}from'./chunk-SLMIYECU.js';import {a as a$1}from'./chunk-VVVCCB6R.js';import {g}from'./chunk-Y2YAKDEQ.js';import {createRequire}from'module';import {randomBytes}from'crypto';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
2
|
g();g();var _;function x(){return _||(_=createRequire("file:///")("node:sqlite").DatabaseSync,_)}function N(T){let e=[];for(let a of T)if(a.type==="tabs"&&"tabs"in a)for(let n of a.tabs)e.push(...N(n.fields));else a.type==="row"&&"fields"in a?e.push(...N(a.fields)):a.type==="collapsible"&&"fields"in a?e.push(...N(a.fields)):e.push(a);return e}function B(T,e){let a=e,n=T[a.name];if(a.type==="json"||a.type==="richtext"||a.type==="array"||a.type==="group"||a.type==="blocks"||a.type==="list"||a.type==="relationship-block")try{n=n?JSON.parse(n):null;}catch{n=null;}if(a.type==="checkbox"&&(n=!!n),a.type==="date"&&n)try{let i=new Date(n);isNaN(i.getTime())?n=null:n=i.toISOString();}catch{n=null;}if((a.type==="upload"||a.type==="image")&&n)try{let i=JSON.parse(n);Array.isArray(i)?n=i.map(o=>typeof o=="object"&&o!==null?o:{id:o}):n=typeof i=="object"?i:{id:i};}catch{n={id:n};}if(a.type==="relationship"&&n)try{let i=JSON.parse(n);Array.isArray(i),n=i;}catch{n={relationTo:Array.isArray(a.relationTo)?a.relationTo[0]:a.relationTo,value:n};}if(a.type==="list"&&n)try{let i=JSON.parse(n);n=Array.isArray(i)?i:[];}catch{n=[];}if(a.type==="relationship-block"&&n)try{let i=JSON.parse(n);n=Array.isArray(i)?i:[];}catch{n=[];}return n}function P(T,e){return Array.isArray(T)?T.map(a=>{if(!a||typeof a!="object")return a;let n=a.data?{...a.data}:void 0;if(!n)return a;let i=e.find(o=>o.slug===a.type||o.slug===a.slug);if(!i||!Array.isArray(i.fields))return a;for(let o of i.fields){if(o.name&&(o.type==="upload"||o.type==="image")&&n[o.name]){let t=n[o.name];Array.isArray(t)?n[o.name]=t.map(s=>typeof s=="string"?{id:s}:s):typeof t=="string"&&(n[o.name]={id:t});}if(o.type==="blocks"&&o.name&&n[o.name]){let t=o.blocks||[];n[o.name]=P(n[o.name],t);}}return {...a,data:n}}):T}function O(T,e){try{return T.prepare(`PRAGMA table_info(${e})`).all().map(n=>n.name)}catch{return []}}var L=class extends a{db;path;migrations=new Map;versionsTableName="kyro_versions";constructor(e){super(),this.path=e.path,e.db?this.db=e.db:this.db=null;}async connect(){if(!this.db)this.db=new(x())(this.path||":memory:");else try{this.db.exec("SELECT 1");}catch{this.db=new(x())(this.path||":memory:");}if(this.db&&typeof this.db.prepare=="function"&&!this.db.prepare.__wrapped){let e=this.db.prepare.bind(this.db),a=n=>{let i=e(n),o=t=>typeof t=="boolean"?t?1:0:t===void 0?null:t;return new Proxy(i,{get(t,s,r){if(s==="all")return (...c)=>t.all(...c.map(o));if(s==="get")return (...c)=>t.get(...c.map(o));if(s==="run")return (...c)=>t.run(...c.map(o));let l=Reflect.get(t,s,r);return typeof l=="function"?l.bind(t):l}})};a.__wrapped=true,this.db.prepare=a;}this.db.exec("PRAGMA journal_mode = WAL"),this.db.exec("PRAGMA foreign_keys = ON"),this.connected=true;}async disconnect(){if(this.db){try{this.db.close();}catch{}this.db=null;}this.connected=false;}ensureTable(e,a){let n=a||this.getTableNameFor(e.slug),i=["id TEXT PRIMARY KEY"];for(let s of N(e.fields)){if(!s.name||s.name==="id")continue;let r=this.fieldToSQL(s);r&&i.push(r);}let o=N(e.fields);o.some(s=>s.name==="createdAt")||i.push(`${this.col("createdAt")} TEXT DEFAULT (datetime('now'))`),o.some(s=>s.name==="updatedAt")||i.push(`${this.col("updatedAt")} TEXT DEFAULT (datetime('now'))`),o.some(s=>s.name==="status")||i.push("status TEXT DEFAULT 'draft'"),o.some(s=>s.name==="hasDraft")||i.push("hasDraft INTEGER DEFAULT 0"),e.tenantScoped&&i.push("tenant_id TEXT NOT NULL");let t=O(this.db,n);if(t.length===0){let s=`CREATE TABLE IF NOT EXISTS ${n} (${i.join(", ")})`;this.db.exec(s),this.db.exec(`CREATE INDEX IF NOT EXISTS idx_${n}_status ON ${n}(status)`);for(let r of N(e.fields))r.name&&r.indexed&&this.db.exec(`CREATE INDEX IF NOT EXISTS idx_${n}_${r.name} ON ${n}(${this.col(r.name)})`),r.name&&r.unique&&this.db.exec(`CREATE UNIQUE INDEX IF NOT EXISTS idx_${n}_${r.name}_unique ON ${n}(${this.col(r.name)})`);}else {let s=new Set(t);for(let r of i){let l=r.split(" ")[0].replace(/^"/,"").replace(/"$/,"");if(!s.has(l)&&l!=="id")try{l==="status"?this.db.exec(`ALTER TABLE ${n} ADD COLUMN ${this.col(l)} TEXT DEFAULT 'published'`):l==="hasDraft"?this.db.exec(`ALTER TABLE ${n} ADD COLUMN ${this.col(l)} INTEGER DEFAULT 0`):this.db.exec(`ALTER TABLE ${n} ADD COLUMN ${this.col(l)} TEXT`);}catch{}}}this.migrations.set(n,true);}ensureVersionsTable(){this.db.exec(`
|
|
3
3
|
CREATE TABLE IF NOT EXISTS ${this.versionsTableName} (
|
|
4
4
|
id TEXT PRIMARY KEY,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {a}from'./chunk-7NH7H3WA.js';import {g,e}from'./chunk-Y2YAKDEQ.js';import {randomBytes}from'crypto';import {mkdirSync}from'fs';import {dirname}from'path';import {createRequire}from'module';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
2
|
g();var E=e(a(),1);var c;function k(){return c||(c=createRequire("file:///")("node:sqlite").DatabaseSync,c)}var A=5e3,y=1e3,R=-64e3,L=268435456,p=class{db=null;path;saltRounds;externalDb;busyTimeout;walAutoCheckpoint;cacheSize;mmapSize;preparedStatements=new Map;constructor(e={}){this.path=e.path||"./data/auth.db",this.saltRounds=e.saltRounds||12,this.externalDb=!!e.db,this.busyTimeout=e.busyTimeout??A,this.walAutoCheckpoint=e.walAutoCheckpoint??y,this.cacheSize=e.cacheSize??R,this.mmapSize=e.mmapSize??L,e.db&&(this.db=e.db);}async connect(){if(this.db)return;let e=dirname(this.path);e&&e!=="."&&mkdirSync(e,{recursive:true}),this.db=new(k())(this.path),this.db.exec(`PRAGMA busy_timeout = ${this.busyTimeout}`),this.db.exec("PRAGMA journal_mode = WAL"),this.db.exec("PRAGMA synchronous = NORMAL"),this.db.exec("PRAGMA cache_size = "+this.cacheSize),this.db.exec("PRAGMA mmap_size = "+this.mmapSize),this.db.exec("PRAGMA wal_autocheckpoint = "+this.walAutoCheckpoint),this.db.exec("PRAGMA foreign_keys = ON"),this.db.exec("PRAGMA temp_store = MEMORY"),this.ensureTables(),this.prepareStatements();}async disconnect(){this.db&&!this.externalDb&&(this.db.exec("PRAGMA wal_checkpoint(TRUNCATE)"),this.db.close(),this.db=null,this.preparedStatements.clear());}async ensureConnected(){if(this.db||await this.connect(),!this.db)throw new Error("Failed to connect to SQLite database");return this.db}ensureTables(){if(this.db){this.db.exec(`
|
|
3
3
|
CREATE TABLE IF NOT EXISTS kyro_users (
|
|
4
4
|
id TEXT PRIMARY KEY,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
var ue=c((br,Fe)=>{g();var $t=a("path"),z="\\\\/",Pe=`[^${z}]`,mt=0,V="\\.",Ht="\\+",Tt="\\?",fe="\\/",Lt="(?=.)",De="[^/]",_e=`(?:${fe}|$)`,Ge=`(?:^|${fe})`,ge=`${V}{1,2}${_e}`,Ot=`(?!${V})`,vt=`(?!${Ge}${ge})`,wt=`(?!${V}{0,1}${_e})`,It=`(?!${ge})`,kt=`[^.${fe}]`,Nt=`${De}*?`,Me={DOT_LITERAL:V,PLUS_LITERAL:Ht,QMARK_LITERAL:Tt,SLASH_LITERAL:fe,ONE_CHAR:Lt,QMARK:De,END_ANCHOR:_e,DOTS_SLASH:ge,NO_DOT:Ot,NO_DOTS:vt,NO_DOT_SLASH:wt,NO_DOTS_SLASH:It,QMARK_NO_DOT:kt,STAR:Nt,START_ANCHOR:Ge},Bt={...Me,SLASH_LITERAL:`[${z}]`,QMARK:Pe,STAR:`${Pe}*?`,DOTS_SLASH:`${V}{1,2}(?:[${z}]|$)`,NO_DOT:`(?!${V})`,NO_DOTS:`(?!(?:^|[${z}])${V}{1,2}(?:[${z}]|$))`,NO_DOT_SLASH:`(?!${V}{0,1}(?:[${z}]|$))`,NO_DOTS_SLASH:`(?!${V}{1,2}(?:[${z}]|$))`,QMARK_NO_DOT:`[^.${z}]`,START_ANCHOR:`(?:^|[${z}])`,END_ANCHOR:`(?:[${z}]|$)`},Pt={__proto__:null,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"};Fe.exports={DEFAULT_MAX_EXTGLOB_RECURSION:mt,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Pt,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:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},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:$t.sep,extglobChars(e){return {"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(e){return e===true?Bt:Me}};});var he=c(M=>{g();var Dt=a("path"),Gt=process.platform==="win32",{REGEX_BACKSLASH:Mt,REGEX_REMOVE_BACKSLASH:Ft,REGEX_SPECIAL_CHARS:Ut,REGEX_SPECIAL_CHARS_GLOBAL:Kt}=ue();M.isObject=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);M.hasRegexChars=e=>Ut.test(e);M.isRegexChar=e=>e.length===1&&M.hasRegexChars(e);M.escapeRegex=e=>e.replace(Kt,"\\$1");M.toPosixSlashes=e=>e.replace(Mt,"/");M.removeBackslashes=e=>e.replace(Ft,r=>r==="\\"?"":r);M.supportsLookbehinds=()=>{let e=process.version.slice(1).split(".").map(Number);return e.length===3&&e[0]>=9||e[0]===8&&e[1]>=10};M.isWindows=e=>e&&typeof e.windows=="boolean"?e.windows:Gt===true||Dt.sep==="\\";M.escapeLast=(e,r,t)=>{let i=e.lastIndexOf(r,t);return i===-1?e:e[i-1]==="\\"?M.escapeLast(e,r,i-1):`${e.slice(0,i)}\\${e.slice(i)}`};M.removePrefix=(e,r={})=>{let t=e;return t.startsWith("./")&&(t=t.slice(2),r.prefix="./"),t};M.wrapOutput=(e,r={},t={})=>{let i=t.contains?"":"^",a=t.contains?"":"$",p=`${i}(?:${e})${a}`;return r.negated===true&&(p=`(?:^(?!${p}).*$)`),p};});var ze=c((mr,je)=>{g();var Ue=he(),{CHAR_ASTERISK:Ee,CHAR_AT:qt,CHAR_BACKWARD_SLASH:ae,CHAR_COMMA:Xt,CHAR_DOT:de,CHAR_EXCLAMATION_MARK:xe,CHAR_FORWARD_SLASH:Qe,CHAR_LEFT_CURLY_BRACE:ye,CHAR_LEFT_PARENTHESES:be,CHAR_LEFT_SQUARE_BRACKET:Wt,CHAR_PLUS:Qt,CHAR_QUESTION_MARK:Ke,CHAR_RIGHT_CURLY_BRACE:jt,CHAR_RIGHT_PARENTHESES:qe,CHAR_RIGHT_SQUARE_BRACKET:zt}=ue(),Xe=e=>e===Qe||e===ae,We=e=>{e.isPrefix!==true&&(e.depth=e.isGlobstar?1/0:1);},Vt=(e,r)=>{let t=r||{},i=e.length-1,a=t.parts===true||t.scanToEnd===true,p=[],u=[],f=[],h=e,d=-1,R=0,$=0,O=false,P=false,y=false,T=false,J=false,K=false,U=false,L=false,q=false,N=false,ee=0,D,A,x={value:"",depth:0,isGlob:false},k=()=>d>=i,o=()=>h.charCodeAt(d+1),m=()=>(D=A,h.charCodeAt(++d));for(;d<i;){A=m();let G;if(A===ae){U=x.backslashes=true,A=m(),A===ye&&(K=true);continue}if(K===true||A===ye){for(ee++;k()!==true&&(A=m());){if(A===ae){U=x.backslashes=true,m();continue}if(A===ye){ee++;continue}if(K!==true&&A===de&&(A=m())===de){if(O=x.isBrace=true,y=x.isGlob=true,N=true,a===true)continue;break}if(K!==true&&A===Xt){if(O=x.isBrace=true,y=x.isGlob=true,N=true,a===true)continue;break}if(A===jt&&(ee--,ee===0)){K=false,O=x.isBrace=true,N=true;break}}if(a===true)continue;break}if(A===Qe){if(p.push(d),u.push(x),x={value:"",depth:0,isGlob:false},N===true)continue;if(D===de&&d===R+1){R+=2;continue}$=d+1;continue}if(t.noext!==true&&(A===Qt||A===qt||A===Ee||A===Ke||A===xe)===true&&o()===be){if(y=x.isGlob=true,T=x.isExtglob=true,N=true,A===xe&&d===R&&(q=true),a===true){for(;k()!==true&&(A=m());){if(A===ae){U=x.backslashes=true,A=m();continue}if(A===qe){y=x.isGlob=true,N=true;break}}continue}break}if(A===Ee){if(D===Ee&&(J=x.isGlobstar=true),y=x.isGlob=true,N=true,a===true)continue;break}if(A===Ke){if(y=x.isGlob=true,N=true,a===true)continue;break}if(A===Wt){for(;k()!==true&&(G=m());){if(G===ae){U=x.backslashes=true,m();continue}if(G===zt){P=x.isBracket=true,y=x.isGlob=true,N=true;break}}if(a===true)continue;break}if(t.nonegate!==true&&A===xe&&d===R){L=x.negated=true,R++;continue}if(t.noparen!==true&&A===be){if(y=x.isGlob=true,a===true){for(;k()!==true&&(A=m());){if(A===be){U=x.backslashes=true,A=m();continue}if(A===qe){N=true;break}}continue}break}if(y===true){if(N=true,a===true)continue;break}}t.noext===true&&(T=false,y=false);let S=h,te="",n="";R>0&&(te=h.slice(0,R),h=h.slice(R),$-=R),S&&y===true&&$>0?(S=h.slice(0,$),n=h.slice($)):y===true?(S="",n=h):S=h,S&&S!==""&&S!=="/"&&S!==h&&Xe(S.charCodeAt(S.length-1))&&(S=S.slice(0,-1)),t.unescape===true&&(n&&(n=Ue.removeBackslashes(n)),S&&U===true&&(S=Ue.removeBackslashes(S)));let s={prefix:te,input:e,start:R,base:S,glob:n,isBrace:O,isBracket:P,isGlob:y,isExtglob:T,isGlobstar:J,negated:L,negatedExtglob:q};if(t.tokens===true&&(s.maxDepth=0,Xe(A)||u.push(x),s.tokens=u),t.parts===true||t.tokens===true){let G;for(let E=0;E<p.length;E++){let X=G?G+1:R,W=p[E],F=e.slice(X,W);t.tokens&&(E===0&&R!==0?(u[E].isPrefix=true,u[E].value=te):u[E].value=F,We(u[E]),s.maxDepth+=u[E].depth),(E!==0||F!=="")&&f.push(F),G=W;}if(G&&G+1<e.length){let E=e.slice(G+1);f.push(E),t.tokens&&(u[u.length-1].value=E,We(u[u.length-1]),s.maxDepth+=u[u.length-1].depth);}s.slashes=p,s.parts=f;}return s};je.exports=Vt;});var et=c((Tr,Je)=>{g();var ie=ue(),B=he(),{MAX_LENGTH:Ae,POSIX_REGEX_SOURCE:Zt,REGEX_NON_SPECIAL_CHARS:Yt,REGEX_SPECIAL_CHARS_BACKREF:Jt,REPLACEMENTS:Ve}=ie,er=(e,r)=>{if(typeof r.expandRange=="function")return r.expandRange(...e,r);e.sort();let t=`[${e.join("-")}]`;try{new RegExp(t);}catch{return e.map(a=>B.escapeRegex(a)).join("..")}return t},oe=(e,r)=>`Missing ${e}: "${r}" - use "\\\\${r}" to match literal characters`,Ze=e=>{let r=[],t=0,i=0,a=0,p="",u=false;for(let f of e){if(u===true){p+=f,u=false;continue}if(f==="\\"){p+=f,u=true;continue}if(f==='"'){a=a===1?0:1,p+=f;continue}if(a===0){if(f==="[")t++;else if(f==="]"&&t>0)t--;else if(t===0){if(f==="(")i++;else if(f===")"&&i>0)i--;else if(f==="|"&&i===0){r.push(p),p="";continue}}}p+=f;}return r.push(p),r},tr=e=>{let r=false;for(let t of e){if(r===true){r=false;continue}if(t==="\\"){r=true;continue}if(/[?*+@!()[\]{}]/.test(t))return false}return true},Ye=e=>{let r=e.trim(),t=true;for(;t===true;)t=false,/^@\([^\\()[\]{}|]+\)$/.test(r)&&(r=r.slice(2,-1),t=true);if(tr(r))return r.replace(/\\(.)/g,"$1")},rr=e=>{let r=e.map(Ye).filter(Boolean);for(let t=0;t<r.length;t++)for(let i=t+1;i<r.length;i++){let a=r[t],p=r[i],u=a[0];if(!(!u||a!==u.repeat(a.length)||p!==u.repeat(p.length))&&(a===p||a.startsWith(p)||p.startsWith(a)))return true}return false},Se=(e,r=true)=>{if(e[0]!=="+"&&e[0]!=="*"||e[1]!=="(")return;let t=0,i=0,a=0,p=false;for(let u=1;u<e.length;u++){let f=e[u];if(p===true){p=false;continue}if(f==="\\"){p=true;continue}if(f==='"'){a=a===1?0:1;continue}if(a!==1){if(f==="["){t++;continue}if(f==="]"&&t>0){t--;continue}if(!(t>0)){if(f==="("){i++;continue}if(f===")"&&(i--,i===0))return r===true&&u!==e.length-1?void 0:{type:e[0],body:e.slice(2,u),end:u}}}}},nr=e=>{let r=0,t=[];for(;r<e.length;){let a=Se(e.slice(r),false);if(!a||a.type!=="*")return;let p=Ze(a.body).map(f=>f.trim());if(p.length!==1)return;let u=Ye(p[0]);if(!u||u.length!==1)return;t.push(u),r+=a.end+1;}return t.length<1?void 0:`${t.length===1?B.escapeRegex(t[0]):`[${t.map(a=>B.escapeRegex(a)).join("")}]`}*`},sr=e=>{let r=0,t=e.trim(),i=Se(t);for(;i;)r++,t=i.body.trim(),i=Se(t);return r},or=(e,r)=>{if(r.maxExtglobRecursion===false)return {risky:false};let t=typeof r.maxExtglobRecursion=="number"?r.maxExtglobRecursion:ie.DEFAULT_MAX_EXTGLOB_RECURSION,i=Ze(e).map(a=>a.trim());if(i.length>1&&(i.some(a=>a==="")||i.some(a=>/^[*?]+$/.test(a))||rr(i)))return {risky:true};for(let a of i){let p=nr(a);if(p)return {risky:true,safeOutput:p};if(sr(a)>t)return {risky:true}}return {risky:false}},Ce=(e,r)=>{if(typeof e!="string")throw new TypeError("Expected a string");e=Ve[e]||e;let t={...r},i=typeof t.maxLength=="number"?Math.min(Ae,t.maxLength):Ae,a=e.length;if(a>i)throw new SyntaxError(`Input length: ${a}, exceeds maximum allowed length: ${i}`);let p={type:"bos",value:"",output:t.prepend||""},u=[p],f=t.capture?"":"?:",h=B.isWindows(r),d=ie.globChars(h),R=ie.extglobChars(d),{DOT_LITERAL:$,PLUS_LITERAL:O,SLASH_LITERAL:P,ONE_CHAR:y,DOTS_SLASH:T,NO_DOT:J,NO_DOT_SLASH:K,NO_DOTS_SLASH:U,QMARK:L,QMARK_NO_DOT:q,STAR:N,START_ANCHOR:ee}=d,D=l=>`(${f}(?:(?!${ee}${l.dot?T:$}).)*?)`,A=t.dot?"":J,x=t.dot?L:q,k=t.bash===true?D(t):N;t.capture&&(k=`(${k})`),typeof t.noext=="boolean"&&(t.noextglob=t.noext);let o={input:e,index:-1,start:0,dot:t.dot===true,consumed:"",output:"",prefix:"",backtrack:false,negated:false,brackets:0,braces:0,parens:0,quotes:0,globstar:false,tokens:u};e=B.removePrefix(e,o),a=e.length;let m=[],S=[],te=[],n=p,s,G=()=>o.index===a-1,E=o.peek=(l=1)=>e[o.index+l],X=o.advance=()=>e[++o.index]||"",W=()=>e.slice(o.index+1),F=(l="",H=0)=>{o.consumed+=l,o.index+=H;},ce=l=>{o.output+=l.output!=null?l.output:l.value,F(l.value);},yt=()=>{let l=1;for(;E()==="!"&&(E(2)!=="("||E(3)==="?");)X(),o.start++,l++;return l%2===0?false:(o.negated=true,o.start++,true)},le=l=>{o[l]++,te.push(l);},re=l=>{o[l]--,te.pop();},g=l=>{if(n.type==="globstar"){let H=o.braces>0&&(l.type==="comma"||l.type==="brace"),c=l.extglob===true||m.length&&(l.type==="pipe"||l.type==="paren");l.type!=="slash"&&l.type!=="paren"&&!H&&!c&&(o.output=o.output.slice(0,-n.output.length),n.type="star",n.value="*",n.output=k,o.output+=n.output);}if(m.length&&l.type!=="paren"&&(m[m.length-1].inner+=l.value),(l.value||l.output)&&ce(l),n&&n.type==="text"&&l.type==="text"){n.value+=l.value,n.output=(n.output||"")+l.value;return}l.prev=n,u.push(l),n=l;},pe=(l,H)=>{let c={...R[H],conditions:1,inner:""};c.prev=n,c.parens=o.parens,c.output=o.output,c.startIndex=o.index,c.tokensIndex=u.length;let _=(t.capture?"(":"")+c.open;le("parens"),g({type:l,value:H,output:o.output?"":y}),g({type:"paren",extglob:true,value:X(),output:_}),m.push(c);},bt=l=>{let H=e.slice(l.startIndex,o.index+1),c=e.slice(l.startIndex+2,o.index),_=or(c,t);if((l.type==="plus"||l.type==="star")&&_.risky){let b=_.safeOutput?(l.output?"":y)+(t.capture?`(${_.safeOutput})`:_.safeOutput):void 0,Q=u[l.tokensIndex];Q.type="text",Q.value=H,Q.output=b||B.escapeRegex(H);for(let j=l.tokensIndex+1;j<u.length;j++)u[j].value="",u[j].output="",delete u[j].suffix;o.output=l.output+Q.output,o.backtrack=true,g({type:"paren",extglob:true,value:s,output:""}),re("parens");return}let C=l.close+(t.capture?")":""),I;if(l.type==="negate"){let b=k;if(l.inner&&l.inner.length>1&&l.inner.includes("/")&&(b=D(t)),(b!==k||G()||/^\)+$/.test(W()))&&(C=l.close=`)$))${b}`),l.inner.includes("*")&&(I=W())&&/^\.[^\\/.]+$/.test(I)){let Q=Ce(I,{...r,fastpaths:false}).output;C=l.close=`)${Q})${b})`;}l.prev.type==="bos"&&(o.negatedExtglob=true);}g({type:"paren",extglob:true,value:s,output:C}),re("parens");};if(t.fastpaths!==false&&!/(^[*!]|[/()[\]{}"])/.test(e)){let l=false,H=e.replace(Jt,(c,_,C,I,b,Q)=>I==="\\"?(l=true,c):I==="?"?_?_+I+(b?L.repeat(b.length):""):Q===0?x+(b?L.repeat(b.length):""):L.repeat(C.length):I==="."?$.repeat(C.length):I==="*"?_?_+I+(b?k:""):k:_?c:`\\${c}`);return l===true&&(t.unescape===true?H=H.replace(/\\/g,""):H=H.replace(/\\+/g,c=>c.length%2===0?"\\\\":c?"\\":"")),H===e&&t.contains===true?(o.output=e,o):(o.output=B.wrapOutput(H,o,r),o)}for(;!G();){if(s=X(),s==="\0")continue;if(s==="\\"){let c=E();if(c==="/"&&t.bash!==true||c==="."||c===";")continue;if(!c){s+="\\",g({type:"text",value:s});continue}let _=/^\\+/.exec(W()),C=0;if(_&&_[0].length>2&&(C=_[0].length,o.index+=C,C%2!==0&&(s+="\\")),t.unescape===true?s=X():s+=X(),o.brackets===0){g({type:"text",value:s});continue}}if(o.brackets>0&&(s!=="]"||n.value==="["||n.value==="[^")){if(t.posix!==false&&s===":"){let c=n.value.slice(1);if(c.includes("[")&&(n.posix=true,c.includes(":"))){let _=n.value.lastIndexOf("["),C=n.value.slice(0,_),I=n.value.slice(_+2),b=Zt[I];if(b){n.value=C+b,o.backtrack=true,X(),!p.output&&u.indexOf(n)===1&&(p.output=y);continue}}}(s==="["&&E()!==":"||s==="-"&&E()==="]")&&(s=`\\${s}`),s==="]"&&(n.value==="["||n.value==="[^")&&(s=`\\${s}`),t.posix===true&&s==="!"&&n.value==="["&&(s="^"),n.value+=s,ce({value:s});continue}if(o.quotes===1&&s!=='"'){s=B.escapeRegex(s),n.value+=s,ce({value:s});continue}if(s==='"'){o.quotes=o.quotes===1?0:1,t.keepQuotes===true&&g({type:"text",value:s});continue}if(s==="("){le("parens"),g({type:"paren",value:s});continue}if(s===")"){if(o.parens===0&&t.strictBrackets===true)throw new SyntaxError(oe("opening","("));let c=m[m.length-1];if(c&&o.parens===c.parens+1){bt(m.pop());continue}g({type:"paren",value:s,output:o.parens?")":"\\)"}),re("parens");continue}if(s==="["){if(t.nobracket===true||!W().includes("]")){if(t.nobracket!==true&&t.strictBrackets===true)throw new SyntaxError(oe("closing","]"));s=`\\${s}`;}else le("brackets");g({type:"bracket",value:s});continue}if(s==="]"){if(t.nobracket===true||n&&n.type==="bracket"&&n.value.length===1){g({type:"text",value:s,output:`\\${s}`});continue}if(o.brackets===0){if(t.strictBrackets===true)throw new SyntaxError(oe("opening","["));g({type:"text",value:s,output:`\\${s}`});continue}re("brackets");let c=n.value.slice(1);if(n.posix!==true&&c[0]==="^"&&!c.includes("/")&&(s=`/${s}`),n.value+=s,ce({value:s}),t.literalBrackets===false||B.hasRegexChars(c))continue;let _=B.escapeRegex(n.value);if(o.output=o.output.slice(0,-n.value.length),t.literalBrackets===true){o.output+=_,n.value=_;continue}n.value=`(${f}${_}|${n.value})`,o.output+=n.value;continue}if(s==="{"&&t.nobrace!==true){le("braces");let c={type:"brace",value:s,output:"(",outputIndex:o.output.length,tokensIndex:o.tokens.length};S.push(c),g(c);continue}if(s==="}"){let c=S[S.length-1];if(t.nobrace===true||!c){g({type:"text",value:s,output:s});continue}let _=")";if(c.dots===true){let C=u.slice(),I=[];for(let b=C.length-1;b>=0&&(u.pop(),C[b].type!=="brace");b--)C[b].type!=="dots"&&I.unshift(C[b].value);_=er(I,t),o.backtrack=true;}if(c.comma!==true&&c.dots!==true){let C=o.output.slice(0,c.outputIndex),I=o.tokens.slice(c.tokensIndex);c.value=c.output="\\{",s=_="\\}",o.output=C;for(let b of I)o.output+=b.output||b.value;}g({type:"brace",value:s,output:_}),re("braces"),S.pop();continue}if(s==="|"){m.length>0&&m[m.length-1].conditions++,g({type:"text",value:s});continue}if(s===","){let c=s,_=S[S.length-1];_&&te[te.length-1]==="braces"&&(_.comma=true,c="|"),g({type:"comma",value:s,output:c});continue}if(s==="/"){if(n.type==="dot"&&o.index===o.start+1){o.start=o.index+1,o.consumed="",o.output="",u.pop(),n=p;continue}g({type:"slash",value:s,output:P});continue}if(s==="."){if(o.braces>0&&n.type==="dot"){n.value==="."&&(n.output=$);let c=S[S.length-1];n.type="dots",n.output+=s,n.value+=s,c.dots=true;continue}if(o.braces+o.parens===0&&n.type!=="bos"&&n.type!=="slash"){g({type:"text",value:s,output:$});continue}g({type:"dot",value:s,output:$});continue}if(s==="?"){if(!(n&&n.value==="(")&&t.noextglob!==true&&E()==="("&&E(2)!=="?"){pe("qmark",s);continue}if(n&&n.type==="paren"){let _=E(),C=s;if(_==="<"&&!B.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(n.value==="("&&!/[!=<:]/.test(_)||_==="<"&&!/<([!=]|\w+>)/.test(W()))&&(C=`\\${s}`),g({type:"text",value:s,output:C});continue}if(t.dot!==true&&(n.type==="slash"||n.type==="bos")){g({type:"qmark",value:s,output:q});continue}g({type:"qmark",value:s,output:L});continue}if(s==="!"){if(t.noextglob!==true&&E()==="("&&(E(2)!=="?"||!/[!=<:]/.test(E(3)))){pe("negate",s);continue}if(t.nonegate!==true&&o.index===0){yt();continue}}if(s==="+"){if(t.noextglob!==true&&E()==="("&&E(2)!=="?"){pe("plus",s);continue}if(n&&n.value==="("||t.regex===false){g({type:"plus",value:s,output:O});continue}if(n&&(n.type==="bracket"||n.type==="paren"||n.type==="brace")||o.parens>0){g({type:"plus",value:s});continue}g({type:"plus",value:O});continue}if(s==="@"){if(t.noextglob!==true&&E()==="("&&E(2)!=="?"){g({type:"at",extglob:true,value:s,output:""});continue}g({type:"text",value:s});continue}if(s!=="*"){(s==="$"||s==="^")&&(s=`\\${s}`);let c=Yt.exec(W());c&&(s+=c[0],o.index+=c[0].length),g({type:"text",value:s});continue}if(n&&(n.type==="globstar"||n.star===true)){n.type="star",n.star=true,n.value+=s,n.output=k,o.backtrack=true,o.globstar=true,F(s);continue}let l=W();if(t.noextglob!==true&&/^\([^?]/.test(l)){pe("star",s);continue}if(n.type==="star"){if(t.noglobstar===true){F(s);continue}let c=n.prev,_=c.prev,C=c.type==="slash"||c.type==="bos",I=_&&(_.type==="star"||_.type==="globstar");if(t.bash===true&&(!C||l[0]&&l[0]!=="/")){g({type:"star",value:s,output:""});continue}let b=o.braces>0&&(c.type==="comma"||c.type==="brace"),Q=m.length&&(c.type==="pipe"||c.type==="paren");if(!C&&c.type!=="paren"&&!b&&!Q){g({type:"star",value:s,output:""});continue}for(;l.slice(0,3)==="/**";){let j=e[o.index+4];if(j&&j!=="/")break;l=l.slice(3),F("/**",3);}if(c.type==="bos"&&G()){n.type="globstar",n.value+=s,n.output=D(t),o.output=n.output,o.globstar=true,F(s);continue}if(c.type==="slash"&&c.prev.type!=="bos"&&!I&&G()){o.output=o.output.slice(0,-(c.output+n.output).length),c.output=`(?:${c.output}`,n.type="globstar",n.output=D(t)+(t.strictSlashes?")":"|$)"),n.value+=s,o.globstar=true,o.output+=c.output+n.output,F(s);continue}if(c.type==="slash"&&c.prev.type!=="bos"&&l[0]==="/"){let j=l[1]!==void 0?"|$":"";o.output=o.output.slice(0,-(c.output+n.output).length),c.output=`(?:${c.output}`,n.type="globstar",n.output=`${D(t)}${P}|${P}${j})`,n.value+=s,o.output+=c.output+n.output,o.globstar=true,F(s+X()),g({type:"slash",value:"/",output:""});continue}if(c.type==="bos"&&l[0]==="/"){n.type="globstar",n.value+=s,n.output=`(?:^|${P}|${D(t)}${P})`,o.output=n.output,o.globstar=true,F(s+X()),g({type:"slash",value:"/",output:""});continue}o.output=o.output.slice(0,-n.output.length),n.type="globstar",n.output=D(t),n.value+=s,o.output+=n.output,o.globstar=true,F(s);continue}let H={type:"star",value:s,output:k};if(t.bash===true){H.output=".*?",(n.type==="bos"||n.type==="slash")&&(H.output=A+H.output),g(H);continue}if(n&&(n.type==="bracket"||n.type==="paren")&&t.regex===true){H.output=s,g(H);continue}(o.index===o.start||n.type==="slash"||n.type==="dot")&&(n.type==="dot"?(o.output+=K,n.output+=K):t.dot===true?(o.output+=U,n.output+=U):(o.output+=A,n.output+=A),E()!=="*"&&(o.output+=y,n.output+=y)),g(H);}for(;o.brackets>0;){if(t.strictBrackets===true)throw new SyntaxError(oe("closing","]"));o.output=B.escapeLast(o.output,"["),re("brackets");}for(;o.parens>0;){if(t.strictBrackets===true)throw new SyntaxError(oe("closing",")"));o.output=B.escapeLast(o.output,"("),re("parens");}for(;o.braces>0;){if(t.strictBrackets===true)throw new SyntaxError(oe("closing","}"));o.output=B.escapeLast(o.output,"{"),re("braces");}if(t.strictSlashes!==true&&(n.type==="star"||n.type==="bracket")&&g({type:"maybe_slash",value:"",output:`${P}?`}),o.backtrack===true){o.output="";for(let l of o.tokens)o.output+=l.output!=null?l.output:l.value,l.suffix&&(o.output+=l.suffix);}return o};Ce.fastpaths=(e,r)=>{let t={...r},i=typeof t.maxLength=="number"?Math.min(Ae,t.maxLength):Ae,a=e.length;if(a>i)throw new SyntaxError(`Input length: ${a}, exceeds maximum allowed length: ${i}`);e=Ve[e]||e;let p=B.isWindows(r),{DOT_LITERAL:u,SLASH_LITERAL:f,ONE_CHAR:h,DOTS_SLASH:d,NO_DOT:R,NO_DOTS:$,NO_DOTS_SLASH:O,STAR:P,START_ANCHOR:y}=ie.globChars(p),T=t.dot?$:R,J=t.dot?O:R,K=t.capture?"":"?:",U={negated:false,prefix:""},L=t.bash===true?".*?":P;t.capture&&(L=`(${L})`);let q=A=>A.noglobstar===true?L:`(${K}(?:(?!${y}${A.dot?d:u}).)*?)`,N=A=>{switch(A){case "*":return `${T}${h}${L}`;case ".*":return `${u}${h}${L}`;case "*.*":return `${T}${L}${u}${h}${L}`;case "*/*":return `${T}${L}${f}${h}${J}${L}`;case "**":return T+q(t);case "**/*":return `(?:${T}${q(t)}${f})?${J}${h}${L}`;case "**/*.*":return `(?:${T}${q(t)}${f})?${J}${L}${u}${h}${L}`;case "**/.*":return `(?:${T}${q(t)}${f})?${u}${h}${L}`;default:{let x=/^(.*?)\.(\w+)$/.exec(A);if(!x)return;let k=N(x[1]);return k?k+u+x[2]:void 0}}},ee=B.removePrefix(e,U),D=N(ee);return D&&t.strictSlashes!==true&&(D+=`${f}?`),D};Je.exports=Ce;});var rt=c((Or,tt)=>{g();var ur=a("path"),ar=ze(),$e=et(),me=he(),ir=ue(),cr=e=>e&&typeof e=="object"&&!Array.isArray(e),v=(e,r,t=false)=>{if(Array.isArray(e)){let R=e.map(O=>v(O,r,t));return O=>{for(let P of R){let y=P(O);if(y)return y}return false}}let i=cr(e)&&e.tokens&&e.input;if(e===""||typeof e!="string"&&!i)throw new TypeError("Expected pattern to be a non-empty string");let a=r||{},p=me.isWindows(r),u=i?v.compileRe(e,r):v.makeRe(e,r,false,true),f=u.state;delete u.state;let h=()=>false;if(a.ignore){let R={...r,ignore:null,onMatch:null,onResult:null};h=v(a.ignore,R,t);}let d=(R,$=false)=>{let{isMatch:O,match:P,output:y}=v.test(R,u,r,{glob:e,posix:p}),T={glob:e,state:f,regex:u,posix:p,input:R,output:y,match:P,isMatch:O};return typeof a.onResult=="function"&&a.onResult(T),O===false?(T.isMatch=false,$?T:false):h(R)?(typeof a.onIgnore=="function"&&a.onIgnore(T),T.isMatch=false,$?T:false):(typeof a.onMatch=="function"&&a.onMatch(T),$?T:true)};return t&&(d.state=f),d};v.test=(e,r,t,{glob:i,posix:a}={})=>{if(typeof e!="string")throw new TypeError("Expected input to be a string");if(e==="")return {isMatch:false,output:""};let p=t||{},u=p.format||(a?me.toPosixSlashes:null),f=e===i,h=f&&u?u(e):e;return f===false&&(h=u?u(e):e,f=h===i),(f===false||p.capture===true)&&(p.matchBase===true||p.basename===true?f=v.matchBase(e,r,t,a):f=r.exec(h)),{isMatch:!!f,match:f,output:h}};v.matchBase=(e,r,t,i=me.isWindows(t))=>(r instanceof RegExp?r:v.makeRe(r,t)).test(ur.basename(e));v.isMatch=(e,r,t)=>v(r,t)(e);v.parse=(e,r)=>Array.isArray(e)?e.map(t=>v.parse(t,r)):$e(e,{...r,fastpaths:false});v.scan=(e,r)=>ar(e,r);v.compileRe=(e,r,t=false,i=false)=>{if(t===true)return e.output;let a=r||{},p=a.contains?"":"^",u=a.contains?"":"$",f=`${p}(?:${e.output})${u}`;e&&e.negated===true&&(f=`^(?!${f}).*$`);let h=v.toRegex(f,r);return i===true&&(h.state=e),h};v.makeRe=(e,r={},t=false,i=false)=>{if(!e||typeof e!="string")throw new TypeError("Expected a non-empty string");let a={negated:false,fastpaths:true};return r.fastpaths!==false&&(e[0]==="."||e[0]==="*")&&(a.output=$e.fastpaths(e,r)),a.output||(a=$e(e,r)),v.compileRe(a,r,t,i)};v.toRegex=(e,r)=>{try{let t=r||{};return new RegExp(e,t.flags||(t.nocase?"i":""))}catch(t){if(r&&r.debug===true)throw t;return /$^/}};v.constants=ir;tt.exports=v;});var st=c((wr,nt)=>{g();nt.exports=rt();});var ut=c((kr,ot)=>{g();ot.exports=function(e,r){if(typeof e!="string")throw new TypeError("expected path to be a string");if(e==="\\"||e==="/")return "/";var t=e.length;if(t<=1)return e;var i="";if(t>4&&e[3]==="\\"){var a=e[2];(a==="?"||a===".")&&e.slice(0,2)==="\\\\"&&(e=e.slice(2),i="//");}var p=e.split(/[/\\]+/);return r!==false&&p[p.length-1]===""&&p.pop(),i+p.join("/")};});var ft=c((lt,pt)=>{g();Object.defineProperty(lt,"__esModule",{value:true});var ct=st(),lr=ut(),at="!",pr={returnIndex:false},fr=e=>Array.isArray(e)?e:[e],hr=(e,r)=>{if(typeof e=="function")return e;if(typeof e=="string"){let t=ct(e,r);return i=>e===i||t(i)}return e instanceof RegExp?t=>e.test(t):t=>false},it=(e,r,t,i)=>{let a=Array.isArray(t),p=a?t[0]:t;if(!a&&typeof p!="string")throw new TypeError("anymatch: second argument must be a string: got "+Object.prototype.toString.call(p));let u=lr(p,false);for(let h=0;h<r.length;h++){let d=r[h];if(d(u))return i?-1:false}let f=a&&[u].concat(t.slice(1));for(let h=0;h<e.length;h++){let d=e[h];if(a?d(...f):d(u))return i?h:true}return i?-1:false},He=(e,r,t=pr)=>{if(e==null)throw new TypeError("anymatch: specify first argument");let i=typeof t=="boolean"?{returnIndex:t}:t,a=i.returnIndex||false,p=fr(e),u=p.filter(h=>typeof h=="string"&&h.charAt(0)===at).map(h=>h.slice(1)).map(h=>ct(h,i)),f=p.filter(h=>typeof h!="string"||typeof h=="string"&&h.charAt(0)!==at).map(h=>hr(h,i));return r==null?(h,d=false)=>it(f,u,h,typeof d=="boolean"?d:false):it(f,u,r,a)};He.default=He;pt.exports=He;});function Te(e){return e.code==="ENOENT"||e.code==="EISDIR"?null:e}function ht(e){return e.code==="EEXIST"?null:e}async function Le(e,r,t){return await Et(dirname(e)),promises.writeFile(e,r,t)}function Oe(e,r){return promises.readFile(e,r).catch(Te)}function _t(e){return promises.unlink(e).catch(Te)}function gt(e){return promises.readdir(e,{withFileTypes:true}).catch(Te).then(r=>r||[])}async function Et(e){existsSync(e)||(await Et(dirname(e)).catch(ht),await promises.mkdir(e).catch(ht));}async function ve(e,r,t){if(r&&r(e))return [];let i=await gt(e),a=[];return await Promise.all(i.map(async p=>{let u=resolve(e,p.name);if(p.isDirectory()){if(t===void 0||t>0){let f=await ve(u,r,t===void 0?void 0:t-1);a.push(...f.map(h=>p.name+"/"+h));}}else r&&r(p.name)||a.push(p.name);})),a}async function we(e){let r=await gt(e);await Promise.all(r.map(t=>{let i=resolve(e,t.name);return t.isDirectory()?we(i).then(()=>promises.rmdir(i)):promises.unlink(i)}));}var dt=b(()=>{g();});var xt,xr,Ie,Wr,yr=b(()=>{g();xt=e(ft(),1);c$1();dt();xr=/\.\.:|\.\.$/,Ie="fs",Wr=(e={})=>{if(!e.base)throw b$1(Ie,"base");let r=resolve(e.base),t=(0, xt.default)(e.ignore||["**/node_modules/**","**/.git/**"]),i=u=>{if(xr.test(u))throw a$1(Ie,`Invalid key: ${JSON.stringify(u)}. It should not contain .. segments`);return join(r,u.replace(/:/g,"/"))},a,p=async()=>{a&&(await a.close(),a=void 0);};return {name:Ie,options:e,flags:{maxDepth:true},hasItem(u){return existsSync(i(u))},getItem(u){return Oe(i(u),"utf8")},getItemRaw(u){return Oe(i(u))},async getMeta(u){let{atime:f,mtime:h,size:d,birthtime:R,ctime:$}=await promises.stat(i(u)).catch(()=>({}));return {atime:f,mtime:h,size:d,birthtime:R,ctime:$}},setItem(u,f){if(!e.readOnly)return Le(i(u),f,"utf8")},setItemRaw(u,f){if(!e.readOnly)return Le(i(u),f)},removeItem(u){if(!e.readOnly)return _t(i(u))},getKeys(u,f){return ve(i("."),t,f?.maxDepth)},async clear(){e.readOnly||e.noClear||await we(i("."));},async dispose(){a&&await a.close();},async watch(u){if(a)return p;let{watch:f}=await import('./chokidar-43DT7CVN.js');return await new Promise((h,d)=>{let R={ignoreInitial:true,...e.watchOptions};R.ignored?Array.isArray(R.ignored)?R.ignored=[...R.ignored]:R.ignored=[R.ignored]:R.ignored=[],R.ignored.push(t),a=f(r,R).on("ready",()=>{h();}).on("error",d).on("all",($,O)=>{O=relative(r,O),$==="change"||$==="add"?u("update",O):$==="unlink"&&u("remove",O);});}),p}}};});/*! Bundled license information:
|
|
1
|
+
import {b,a as a$1}from'./chunk-YENNL5HG.js';import {c,g,a,e}from'./chunk-Y2YAKDEQ.js';import {promises,existsSync}from'fs';import {resolve,relative,join,dirname}from'path';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
|
+
var ue=c((Er,Me)=>{g();var bt=a("path"),z="\\\\/",Be=`[^${z}]`,St=0,V="\\.",Ct="\\+",$t="\\?",fe="\\/",mt="(?=.)",Pe="[^/]",_e=`(?:${fe}|$)`,De=`(?:^|${fe})`,ge=`${V}{1,2}${_e}`,Ht=`(?!${V})`,Tt=`(?!${De}${ge})`,Lt=`(?!${V}{0,1}${_e})`,Ot=`(?!${ge})`,vt=`[^.${fe}]`,wt=`${Pe}*?`,Ge={DOT_LITERAL:V,PLUS_LITERAL:Ct,QMARK_LITERAL:$t,SLASH_LITERAL:fe,ONE_CHAR:mt,QMARK:Pe,END_ANCHOR:_e,DOTS_SLASH:ge,NO_DOT:Ht,NO_DOTS:Tt,NO_DOT_SLASH:Lt,NO_DOTS_SLASH:Ot,QMARK_NO_DOT:vt,STAR:wt,START_ANCHOR:De},It={...Ge,SLASH_LITERAL:`[${z}]`,QMARK:Be,STAR:`${Be}*?`,DOTS_SLASH:`${V}{1,2}(?:[${z}]|$)`,NO_DOT:`(?!${V})`,NO_DOTS:`(?!(?:^|[${z}])${V}{1,2}(?:[${z}]|$))`,NO_DOT_SLASH:`(?!${V}{0,1}(?:[${z}]|$))`,NO_DOTS_SLASH:`(?!${V}{1,2}(?:[${z}]|$))`,QMARK_NO_DOT:`[^.${z}]`,START_ANCHOR:`(?:^|[${z}])`,END_ANCHOR:`(?:[${z}]|$)`},kt={__proto__:null,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"};Me.exports={DEFAULT_MAX_EXTGLOB_RECURSION:St,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:kt,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:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},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:bt.sep,extglobChars(e){return {"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(e){return e===true?It:Ge}};});var he=c(M=>{g();var Nt=a("path"),Bt=process.platform==="win32",{REGEX_BACKSLASH:Pt,REGEX_REMOVE_BACKSLASH:Dt,REGEX_SPECIAL_CHARS:Gt,REGEX_SPECIAL_CHARS_GLOBAL:Mt}=ue();M.isObject=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);M.hasRegexChars=e=>Gt.test(e);M.isRegexChar=e=>e.length===1&&M.hasRegexChars(e);M.escapeRegex=e=>e.replace(Mt,"\\$1");M.toPosixSlashes=e=>e.replace(Pt,"/");M.removeBackslashes=e=>e.replace(Dt,r=>r==="\\"?"":r);M.supportsLookbehinds=()=>{let e=process.version.slice(1).split(".").map(Number);return e.length===3&&e[0]>=9||e[0]===8&&e[1]>=10};M.isWindows=e=>e&&typeof e.windows=="boolean"?e.windows:Bt===true||Nt.sep==="\\";M.escapeLast=(e,r,t)=>{let i=e.lastIndexOf(r,t);return i===-1?e:e[i-1]==="\\"?M.escapeLast(e,r,i-1):`${e.slice(0,i)}\\${e.slice(i)}`};M.removePrefix=(e,r={})=>{let t=e;return t.startsWith("./")&&(t=t.slice(2),r.prefix="./"),t};M.wrapOutput=(e,r={},t={})=>{let i=t.contains?"":"^",a=t.contains?"":"$",p=`${i}(?:${e})${a}`;return r.negated===true&&(p=`(?:^(?!${p}).*$)`),p};});var je=c((br,Qe)=>{g();var Fe=he(),{CHAR_ASTERISK:Ee,CHAR_AT:Ft,CHAR_BACKWARD_SLASH:ae,CHAR_COMMA:Ut,CHAR_DOT:de,CHAR_EXCLAMATION_MARK:xe,CHAR_FORWARD_SLASH:We,CHAR_LEFT_CURLY_BRACE:ye,CHAR_LEFT_PARENTHESES:be,CHAR_LEFT_SQUARE_BRACKET:Kt,CHAR_PLUS:qt,CHAR_QUESTION_MARK:Ue,CHAR_RIGHT_CURLY_BRACE:Xt,CHAR_RIGHT_PARENTHESES:Ke,CHAR_RIGHT_SQUARE_BRACKET:Wt}=ue(),qe=e=>e===We||e===ae,Xe=e=>{e.isPrefix!==true&&(e.depth=e.isGlobstar?1/0:1);},Qt=(e,r)=>{let t=r||{},i=e.length-1,a=t.parts===true||t.scanToEnd===true,p=[],u=[],f=[],h=e,d=-1,R=0,$=0,O=false,P=false,y=false,T=false,J=false,K=false,U=false,L=false,q=false,N=false,ee=0,D,A,x={value:"",depth:0,isGlob:false},k=()=>d>=i,o=()=>h.charCodeAt(d+1),m=()=>(D=A,h.charCodeAt(++d));for(;d<i;){A=m();let G;if(A===ae){U=x.backslashes=true,A=m(),A===ye&&(K=true);continue}if(K===true||A===ye){for(ee++;k()!==true&&(A=m());){if(A===ae){U=x.backslashes=true,m();continue}if(A===ye){ee++;continue}if(K!==true&&A===de&&(A=m())===de){if(O=x.isBrace=true,y=x.isGlob=true,N=true,a===true)continue;break}if(K!==true&&A===Ut){if(O=x.isBrace=true,y=x.isGlob=true,N=true,a===true)continue;break}if(A===Xt&&(ee--,ee===0)){K=false,O=x.isBrace=true,N=true;break}}if(a===true)continue;break}if(A===We){if(p.push(d),u.push(x),x={value:"",depth:0,isGlob:false},N===true)continue;if(D===de&&d===R+1){R+=2;continue}$=d+1;continue}if(t.noext!==true&&(A===qt||A===Ft||A===Ee||A===Ue||A===xe)===true&&o()===be){if(y=x.isGlob=true,T=x.isExtglob=true,N=true,A===xe&&d===R&&(q=true),a===true){for(;k()!==true&&(A=m());){if(A===ae){U=x.backslashes=true,A=m();continue}if(A===Ke){y=x.isGlob=true,N=true;break}}continue}break}if(A===Ee){if(D===Ee&&(J=x.isGlobstar=true),y=x.isGlob=true,N=true,a===true)continue;break}if(A===Ue){if(y=x.isGlob=true,N=true,a===true)continue;break}if(A===Kt){for(;k()!==true&&(G=m());){if(G===ae){U=x.backslashes=true,m();continue}if(G===Wt){P=x.isBracket=true,y=x.isGlob=true,N=true;break}}if(a===true)continue;break}if(t.nonegate!==true&&A===xe&&d===R){L=x.negated=true,R++;continue}if(t.noparen!==true&&A===be){if(y=x.isGlob=true,a===true){for(;k()!==true&&(A=m());){if(A===be){U=x.backslashes=true,A=m();continue}if(A===Ke){N=true;break}}continue}break}if(y===true){if(N=true,a===true)continue;break}}t.noext===true&&(T=false,y=false);let S=h,te="",n="";R>0&&(te=h.slice(0,R),h=h.slice(R),$-=R),S&&y===true&&$>0?(S=h.slice(0,$),n=h.slice($)):y===true?(S="",n=h):S=h,S&&S!==""&&S!=="/"&&S!==h&&qe(S.charCodeAt(S.length-1))&&(S=S.slice(0,-1)),t.unescape===true&&(n&&(n=Fe.removeBackslashes(n)),S&&U===true&&(S=Fe.removeBackslashes(S)));let s={prefix:te,input:e,start:R,base:S,glob:n,isBrace:O,isBracket:P,isGlob:y,isExtglob:T,isGlobstar:J,negated:L,negatedExtglob:q};if(t.tokens===true&&(s.maxDepth=0,qe(A)||u.push(x),s.tokens=u),t.parts===true||t.tokens===true){let G;for(let E=0;E<p.length;E++){let X=G?G+1:R,W=p[E],F=e.slice(X,W);t.tokens&&(E===0&&R!==0?(u[E].isPrefix=true,u[E].value=te):u[E].value=F,Xe(u[E]),s.maxDepth+=u[E].depth),(E!==0||F!=="")&&f.push(F),G=W;}if(G&&G+1<e.length){let E=e.slice(G+1);f.push(E),t.tokens&&(u[u.length-1].value=E,Xe(u[u.length-1]),s.maxDepth+=u[u.length-1].depth);}s.slashes=p,s.parts=f;}return s};Qe.exports=Qt;});var Je=c((Cr,Ye)=>{g();var ie=ue(),B=he(),{MAX_LENGTH:Ae,POSIX_REGEX_SOURCE:jt,REGEX_NON_SPECIAL_CHARS:zt,REGEX_SPECIAL_CHARS_BACKREF:Vt,REPLACEMENTS:ze}=ie,Zt=(e,r)=>{if(typeof r.expandRange=="function")return r.expandRange(...e,r);e.sort();let t=`[${e.join("-")}]`;try{new RegExp(t);}catch{return e.map(a=>B.escapeRegex(a)).join("..")}return t},oe=(e,r)=>`Missing ${e}: "${r}" - use "\\\\${r}" to match literal characters`,Ve=e=>{let r=[],t=0,i=0,a=0,p="",u=false;for(let f of e){if(u===true){p+=f,u=false;continue}if(f==="\\"){p+=f,u=true;continue}if(f==='"'){a=a===1?0:1,p+=f;continue}if(a===0){if(f==="[")t++;else if(f==="]"&&t>0)t--;else if(t===0){if(f==="(")i++;else if(f===")"&&i>0)i--;else if(f==="|"&&i===0){r.push(p),p="";continue}}}p+=f;}return r.push(p),r},Yt=e=>{let r=false;for(let t of e){if(r===true){r=false;continue}if(t==="\\"){r=true;continue}if(/[?*+@!()[\]{}]/.test(t))return false}return true},Ze=e=>{let r=e.trim(),t=true;for(;t===true;)t=false,/^@\([^\\()[\]{}|]+\)$/.test(r)&&(r=r.slice(2,-1),t=true);if(Yt(r))return r.replace(/\\(.)/g,"$1")},Jt=e=>{let r=e.map(Ze).filter(Boolean);for(let t=0;t<r.length;t++)for(let i=t+1;i<r.length;i++){let a=r[t],p=r[i],u=a[0];if(!(!u||a!==u.repeat(a.length)||p!==u.repeat(p.length))&&(a===p||a.startsWith(p)||p.startsWith(a)))return true}return false},Se=(e,r=true)=>{if(e[0]!=="+"&&e[0]!=="*"||e[1]!=="(")return;let t=0,i=0,a=0,p=false;for(let u=1;u<e.length;u++){let f=e[u];if(p===true){p=false;continue}if(f==="\\"){p=true;continue}if(f==='"'){a=a===1?0:1;continue}if(a!==1){if(f==="["){t++;continue}if(f==="]"&&t>0){t--;continue}if(!(t>0)){if(f==="("){i++;continue}if(f===")"&&(i--,i===0))return r===true&&u!==e.length-1?void 0:{type:e[0],body:e.slice(2,u),end:u}}}}},er=e=>{let r=0,t=[];for(;r<e.length;){let a=Se(e.slice(r),false);if(!a||a.type!=="*")return;let p=Ve(a.body).map(f=>f.trim());if(p.length!==1)return;let u=Ze(p[0]);if(!u||u.length!==1)return;t.push(u),r+=a.end+1;}return t.length<1?void 0:`${t.length===1?B.escapeRegex(t[0]):`[${t.map(a=>B.escapeRegex(a)).join("")}]`}*`},tr=e=>{let r=0,t=e.trim(),i=Se(t);for(;i;)r++,t=i.body.trim(),i=Se(t);return r},rr=(e,r)=>{if(r.maxExtglobRecursion===false)return {risky:false};let t=typeof r.maxExtglobRecursion=="number"?r.maxExtglobRecursion:ie.DEFAULT_MAX_EXTGLOB_RECURSION,i=Ve(e).map(a=>a.trim());if(i.length>1&&(i.some(a=>a==="")||i.some(a=>/^[*?]+$/.test(a))||Jt(i)))return {risky:true};for(let a of i){let p=er(a);if(p)return {risky:true,safeOutput:p};if(tr(a)>t)return {risky:true}}return {risky:false}},Ce=(e,r)=>{if(typeof e!="string")throw new TypeError("Expected a string");e=ze[e]||e;let t={...r},i=typeof t.maxLength=="number"?Math.min(Ae,t.maxLength):Ae,a=e.length;if(a>i)throw new SyntaxError(`Input length: ${a}, exceeds maximum allowed length: ${i}`);let p={type:"bos",value:"",output:t.prepend||""},u=[p],f=t.capture?"":"?:",h=B.isWindows(r),d=ie.globChars(h),R=ie.extglobChars(d),{DOT_LITERAL:$,PLUS_LITERAL:O,SLASH_LITERAL:P,ONE_CHAR:y,DOTS_SLASH:T,NO_DOT:J,NO_DOT_SLASH:K,NO_DOTS_SLASH:U,QMARK:L,QMARK_NO_DOT:q,STAR:N,START_ANCHOR:ee}=d,D=l=>`(${f}(?:(?!${ee}${l.dot?T:$}).)*?)`,A=t.dot?"":J,x=t.dot?L:q,k=t.bash===true?D(t):N;t.capture&&(k=`(${k})`),typeof t.noext=="boolean"&&(t.noextglob=t.noext);let o={input:e,index:-1,start:0,dot:t.dot===true,consumed:"",output:"",prefix:"",backtrack:false,negated:false,brackets:0,braces:0,parens:0,quotes:0,globstar:false,tokens:u};e=B.removePrefix(e,o),a=e.length;let m=[],S=[],te=[],n=p,s,G=()=>o.index===a-1,E=o.peek=(l=1)=>e[o.index+l],X=o.advance=()=>e[++o.index]||"",W=()=>e.slice(o.index+1),F=(l="",H=0)=>{o.consumed+=l,o.index+=H;},ce=l=>{o.output+=l.output!=null?l.output:l.value,F(l.value);},dt=()=>{let l=1;for(;E()==="!"&&(E(2)!=="("||E(3)==="?");)X(),o.start++,l++;return l%2===0?false:(o.negated=true,o.start++,true)},le=l=>{o[l]++,te.push(l);},re=l=>{o[l]--,te.pop();},g=l=>{if(n.type==="globstar"){let H=o.braces>0&&(l.type==="comma"||l.type==="brace"),c=l.extglob===true||m.length&&(l.type==="pipe"||l.type==="paren");l.type!=="slash"&&l.type!=="paren"&&!H&&!c&&(o.output=o.output.slice(0,-n.output.length),n.type="star",n.value="*",n.output=k,o.output+=n.output);}if(m.length&&l.type!=="paren"&&(m[m.length-1].inner+=l.value),(l.value||l.output)&&ce(l),n&&n.type==="text"&&l.type==="text"){n.value+=l.value,n.output=(n.output||"")+l.value;return}l.prev=n,u.push(l),n=l;},pe=(l,H)=>{let c={...R[H],conditions:1,inner:""};c.prev=n,c.parens=o.parens,c.output=o.output,c.startIndex=o.index,c.tokensIndex=u.length;let _=(t.capture?"(":"")+c.open;le("parens"),g({type:l,value:H,output:o.output?"":y}),g({type:"paren",extglob:true,value:X(),output:_}),m.push(c);},xt=l=>{let H=e.slice(l.startIndex,o.index+1),c=e.slice(l.startIndex+2,o.index),_=rr(c,t);if((l.type==="plus"||l.type==="star")&&_.risky){let b=_.safeOutput?(l.output?"":y)+(t.capture?`(${_.safeOutput})`:_.safeOutput):void 0,Q=u[l.tokensIndex];Q.type="text",Q.value=H,Q.output=b||B.escapeRegex(H);for(let j=l.tokensIndex+1;j<u.length;j++)u[j].value="",u[j].output="",delete u[j].suffix;o.output=l.output+Q.output,o.backtrack=true,g({type:"paren",extglob:true,value:s,output:""}),re("parens");return}let C=l.close+(t.capture?")":""),I;if(l.type==="negate"){let b=k;if(l.inner&&l.inner.length>1&&l.inner.includes("/")&&(b=D(t)),(b!==k||G()||/^\)+$/.test(W()))&&(C=l.close=`)$))${b}`),l.inner.includes("*")&&(I=W())&&/^\.[^\\/.]+$/.test(I)){let Q=Ce(I,{...r,fastpaths:false}).output;C=l.close=`)${Q})${b})`;}l.prev.type==="bos"&&(o.negatedExtglob=true);}g({type:"paren",extglob:true,value:s,output:C}),re("parens");};if(t.fastpaths!==false&&!/(^[*!]|[/()[\]{}"])/.test(e)){let l=false,H=e.replace(Vt,(c,_,C,I,b,Q)=>I==="\\"?(l=true,c):I==="?"?_?_+I+(b?L.repeat(b.length):""):Q===0?x+(b?L.repeat(b.length):""):L.repeat(C.length):I==="."?$.repeat(C.length):I==="*"?_?_+I+(b?k:""):k:_?c:`\\${c}`);return l===true&&(t.unescape===true?H=H.replace(/\\/g,""):H=H.replace(/\\+/g,c=>c.length%2===0?"\\\\":c?"\\":"")),H===e&&t.contains===true?(o.output=e,o):(o.output=B.wrapOutput(H,o,r),o)}for(;!G();){if(s=X(),s==="\0")continue;if(s==="\\"){let c=E();if(c==="/"&&t.bash!==true||c==="."||c===";")continue;if(!c){s+="\\",g({type:"text",value:s});continue}let _=/^\\+/.exec(W()),C=0;if(_&&_[0].length>2&&(C=_[0].length,o.index+=C,C%2!==0&&(s+="\\")),t.unescape===true?s=X():s+=X(),o.brackets===0){g({type:"text",value:s});continue}}if(o.brackets>0&&(s!=="]"||n.value==="["||n.value==="[^")){if(t.posix!==false&&s===":"){let c=n.value.slice(1);if(c.includes("[")&&(n.posix=true,c.includes(":"))){let _=n.value.lastIndexOf("["),C=n.value.slice(0,_),I=n.value.slice(_+2),b=jt[I];if(b){n.value=C+b,o.backtrack=true,X(),!p.output&&u.indexOf(n)===1&&(p.output=y);continue}}}(s==="["&&E()!==":"||s==="-"&&E()==="]")&&(s=`\\${s}`),s==="]"&&(n.value==="["||n.value==="[^")&&(s=`\\${s}`),t.posix===true&&s==="!"&&n.value==="["&&(s="^"),n.value+=s,ce({value:s});continue}if(o.quotes===1&&s!=='"'){s=B.escapeRegex(s),n.value+=s,ce({value:s});continue}if(s==='"'){o.quotes=o.quotes===1?0:1,t.keepQuotes===true&&g({type:"text",value:s});continue}if(s==="("){le("parens"),g({type:"paren",value:s});continue}if(s===")"){if(o.parens===0&&t.strictBrackets===true)throw new SyntaxError(oe("opening","("));let c=m[m.length-1];if(c&&o.parens===c.parens+1){xt(m.pop());continue}g({type:"paren",value:s,output:o.parens?")":"\\)"}),re("parens");continue}if(s==="["){if(t.nobracket===true||!W().includes("]")){if(t.nobracket!==true&&t.strictBrackets===true)throw new SyntaxError(oe("closing","]"));s=`\\${s}`;}else le("brackets");g({type:"bracket",value:s});continue}if(s==="]"){if(t.nobracket===true||n&&n.type==="bracket"&&n.value.length===1){g({type:"text",value:s,output:`\\${s}`});continue}if(o.brackets===0){if(t.strictBrackets===true)throw new SyntaxError(oe("opening","["));g({type:"text",value:s,output:`\\${s}`});continue}re("brackets");let c=n.value.slice(1);if(n.posix!==true&&c[0]==="^"&&!c.includes("/")&&(s=`/${s}`),n.value+=s,ce({value:s}),t.literalBrackets===false||B.hasRegexChars(c))continue;let _=B.escapeRegex(n.value);if(o.output=o.output.slice(0,-n.value.length),t.literalBrackets===true){o.output+=_,n.value=_;continue}n.value=`(${f}${_}|${n.value})`,o.output+=n.value;continue}if(s==="{"&&t.nobrace!==true){le("braces");let c={type:"brace",value:s,output:"(",outputIndex:o.output.length,tokensIndex:o.tokens.length};S.push(c),g(c);continue}if(s==="}"){let c=S[S.length-1];if(t.nobrace===true||!c){g({type:"text",value:s,output:s});continue}let _=")";if(c.dots===true){let C=u.slice(),I=[];for(let b=C.length-1;b>=0&&(u.pop(),C[b].type!=="brace");b--)C[b].type!=="dots"&&I.unshift(C[b].value);_=Zt(I,t),o.backtrack=true;}if(c.comma!==true&&c.dots!==true){let C=o.output.slice(0,c.outputIndex),I=o.tokens.slice(c.tokensIndex);c.value=c.output="\\{",s=_="\\}",o.output=C;for(let b of I)o.output+=b.output||b.value;}g({type:"brace",value:s,output:_}),re("braces"),S.pop();continue}if(s==="|"){m.length>0&&m[m.length-1].conditions++,g({type:"text",value:s});continue}if(s===","){let c=s,_=S[S.length-1];_&&te[te.length-1]==="braces"&&(_.comma=true,c="|"),g({type:"comma",value:s,output:c});continue}if(s==="/"){if(n.type==="dot"&&o.index===o.start+1){o.start=o.index+1,o.consumed="",o.output="",u.pop(),n=p;continue}g({type:"slash",value:s,output:P});continue}if(s==="."){if(o.braces>0&&n.type==="dot"){n.value==="."&&(n.output=$);let c=S[S.length-1];n.type="dots",n.output+=s,n.value+=s,c.dots=true;continue}if(o.braces+o.parens===0&&n.type!=="bos"&&n.type!=="slash"){g({type:"text",value:s,output:$});continue}g({type:"dot",value:s,output:$});continue}if(s==="?"){if(!(n&&n.value==="(")&&t.noextglob!==true&&E()==="("&&E(2)!=="?"){pe("qmark",s);continue}if(n&&n.type==="paren"){let _=E(),C=s;if(_==="<"&&!B.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(n.value==="("&&!/[!=<:]/.test(_)||_==="<"&&!/<([!=]|\w+>)/.test(W()))&&(C=`\\${s}`),g({type:"text",value:s,output:C});continue}if(t.dot!==true&&(n.type==="slash"||n.type==="bos")){g({type:"qmark",value:s,output:q});continue}g({type:"qmark",value:s,output:L});continue}if(s==="!"){if(t.noextglob!==true&&E()==="("&&(E(2)!=="?"||!/[!=<:]/.test(E(3)))){pe("negate",s);continue}if(t.nonegate!==true&&o.index===0){dt();continue}}if(s==="+"){if(t.noextglob!==true&&E()==="("&&E(2)!=="?"){pe("plus",s);continue}if(n&&n.value==="("||t.regex===false){g({type:"plus",value:s,output:O});continue}if(n&&(n.type==="bracket"||n.type==="paren"||n.type==="brace")||o.parens>0){g({type:"plus",value:s});continue}g({type:"plus",value:O});continue}if(s==="@"){if(t.noextglob!==true&&E()==="("&&E(2)!=="?"){g({type:"at",extglob:true,value:s,output:""});continue}g({type:"text",value:s});continue}if(s!=="*"){(s==="$"||s==="^")&&(s=`\\${s}`);let c=zt.exec(W());c&&(s+=c[0],o.index+=c[0].length),g({type:"text",value:s});continue}if(n&&(n.type==="globstar"||n.star===true)){n.type="star",n.star=true,n.value+=s,n.output=k,o.backtrack=true,o.globstar=true,F(s);continue}let l=W();if(t.noextglob!==true&&/^\([^?]/.test(l)){pe("star",s);continue}if(n.type==="star"){if(t.noglobstar===true){F(s);continue}let c=n.prev,_=c.prev,C=c.type==="slash"||c.type==="bos",I=_&&(_.type==="star"||_.type==="globstar");if(t.bash===true&&(!C||l[0]&&l[0]!=="/")){g({type:"star",value:s,output:""});continue}let b=o.braces>0&&(c.type==="comma"||c.type==="brace"),Q=m.length&&(c.type==="pipe"||c.type==="paren");if(!C&&c.type!=="paren"&&!b&&!Q){g({type:"star",value:s,output:""});continue}for(;l.slice(0,3)==="/**";){let j=e[o.index+4];if(j&&j!=="/")break;l=l.slice(3),F("/**",3);}if(c.type==="bos"&&G()){n.type="globstar",n.value+=s,n.output=D(t),o.output=n.output,o.globstar=true,F(s);continue}if(c.type==="slash"&&c.prev.type!=="bos"&&!I&&G()){o.output=o.output.slice(0,-(c.output+n.output).length),c.output=`(?:${c.output}`,n.type="globstar",n.output=D(t)+(t.strictSlashes?")":"|$)"),n.value+=s,o.globstar=true,o.output+=c.output+n.output,F(s);continue}if(c.type==="slash"&&c.prev.type!=="bos"&&l[0]==="/"){let j=l[1]!==void 0?"|$":"";o.output=o.output.slice(0,-(c.output+n.output).length),c.output=`(?:${c.output}`,n.type="globstar",n.output=`${D(t)}${P}|${P}${j})`,n.value+=s,o.output+=c.output+n.output,o.globstar=true,F(s+X()),g({type:"slash",value:"/",output:""});continue}if(c.type==="bos"&&l[0]==="/"){n.type="globstar",n.value+=s,n.output=`(?:^|${P}|${D(t)}${P})`,o.output=n.output,o.globstar=true,F(s+X()),g({type:"slash",value:"/",output:""});continue}o.output=o.output.slice(0,-n.output.length),n.type="globstar",n.output=D(t),n.value+=s,o.output+=n.output,o.globstar=true,F(s);continue}let H={type:"star",value:s,output:k};if(t.bash===true){H.output=".*?",(n.type==="bos"||n.type==="slash")&&(H.output=A+H.output),g(H);continue}if(n&&(n.type==="bracket"||n.type==="paren")&&t.regex===true){H.output=s,g(H);continue}(o.index===o.start||n.type==="slash"||n.type==="dot")&&(n.type==="dot"?(o.output+=K,n.output+=K):t.dot===true?(o.output+=U,n.output+=U):(o.output+=A,n.output+=A),E()!=="*"&&(o.output+=y,n.output+=y)),g(H);}for(;o.brackets>0;){if(t.strictBrackets===true)throw new SyntaxError(oe("closing","]"));o.output=B.escapeLast(o.output,"["),re("brackets");}for(;o.parens>0;){if(t.strictBrackets===true)throw new SyntaxError(oe("closing",")"));o.output=B.escapeLast(o.output,"("),re("parens");}for(;o.braces>0;){if(t.strictBrackets===true)throw new SyntaxError(oe("closing","}"));o.output=B.escapeLast(o.output,"{"),re("braces");}if(t.strictSlashes!==true&&(n.type==="star"||n.type==="bracket")&&g({type:"maybe_slash",value:"",output:`${P}?`}),o.backtrack===true){o.output="";for(let l of o.tokens)o.output+=l.output!=null?l.output:l.value,l.suffix&&(o.output+=l.suffix);}return o};Ce.fastpaths=(e,r)=>{let t={...r},i=typeof t.maxLength=="number"?Math.min(Ae,t.maxLength):Ae,a=e.length;if(a>i)throw new SyntaxError(`Input length: ${a}, exceeds maximum allowed length: ${i}`);e=ze[e]||e;let p=B.isWindows(r),{DOT_LITERAL:u,SLASH_LITERAL:f,ONE_CHAR:h,DOTS_SLASH:d,NO_DOT:R,NO_DOTS:$,NO_DOTS_SLASH:O,STAR:P,START_ANCHOR:y}=ie.globChars(p),T=t.dot?$:R,J=t.dot?O:R,K=t.capture?"":"?:",U={negated:false,prefix:""},L=t.bash===true?".*?":P;t.capture&&(L=`(${L})`);let q=A=>A.noglobstar===true?L:`(${K}(?:(?!${y}${A.dot?d:u}).)*?)`,N=A=>{switch(A){case "*":return `${T}${h}${L}`;case ".*":return `${u}${h}${L}`;case "*.*":return `${T}${L}${u}${h}${L}`;case "*/*":return `${T}${L}${f}${h}${J}${L}`;case "**":return T+q(t);case "**/*":return `(?:${T}${q(t)}${f})?${J}${h}${L}`;case "**/*.*":return `(?:${T}${q(t)}${f})?${J}${L}${u}${h}${L}`;case "**/.*":return `(?:${T}${q(t)}${f})?${u}${h}${L}`;default:{let x=/^(.*?)\.(\w+)$/.exec(A);if(!x)return;let k=N(x[1]);return k?k+u+x[2]:void 0}}},ee=B.removePrefix(e,U),D=N(ee);return D&&t.strictSlashes!==true&&(D+=`${f}?`),D};Ye.exports=Ce;});var tt=c((mr,et)=>{g();var nr=a("path"),sr=je(),$e=Je(),me=he(),or=ue(),ur=e=>e&&typeof e=="object"&&!Array.isArray(e),v=(e,r,t=false)=>{if(Array.isArray(e)){let R=e.map(O=>v(O,r,t));return O=>{for(let P of R){let y=P(O);if(y)return y}return false}}let i=ur(e)&&e.tokens&&e.input;if(e===""||typeof e!="string"&&!i)throw new TypeError("Expected pattern to be a non-empty string");let a=r||{},p=me.isWindows(r),u=i?v.compileRe(e,r):v.makeRe(e,r,false,true),f=u.state;delete u.state;let h=()=>false;if(a.ignore){let R={...r,ignore:null,onMatch:null,onResult:null};h=v(a.ignore,R,t);}let d=(R,$=false)=>{let{isMatch:O,match:P,output:y}=v.test(R,u,r,{glob:e,posix:p}),T={glob:e,state:f,regex:u,posix:p,input:R,output:y,match:P,isMatch:O};return typeof a.onResult=="function"&&a.onResult(T),O===false?(T.isMatch=false,$?T:false):h(R)?(typeof a.onIgnore=="function"&&a.onIgnore(T),T.isMatch=false,$?T:false):(typeof a.onMatch=="function"&&a.onMatch(T),$?T:true)};return t&&(d.state=f),d};v.test=(e,r,t,{glob:i,posix:a}={})=>{if(typeof e!="string")throw new TypeError("Expected input to be a string");if(e==="")return {isMatch:false,output:""};let p=t||{},u=p.format||(a?me.toPosixSlashes:null),f=e===i,h=f&&u?u(e):e;return f===false&&(h=u?u(e):e,f=h===i),(f===false||p.capture===true)&&(p.matchBase===true||p.basename===true?f=v.matchBase(e,r,t,a):f=r.exec(h)),{isMatch:!!f,match:f,output:h}};v.matchBase=(e,r,t,i=me.isWindows(t))=>(r instanceof RegExp?r:v.makeRe(r,t)).test(nr.basename(e));v.isMatch=(e,r,t)=>v(r,t)(e);v.parse=(e,r)=>Array.isArray(e)?e.map(t=>v.parse(t,r)):$e(e,{...r,fastpaths:false});v.scan=(e,r)=>sr(e,r);v.compileRe=(e,r,t=false,i=false)=>{if(t===true)return e.output;let a=r||{},p=a.contains?"":"^",u=a.contains?"":"$",f=`${p}(?:${e.output})${u}`;e&&e.negated===true&&(f=`^(?!${f}).*$`);let h=v.toRegex(f,r);return i===true&&(h.state=e),h};v.makeRe=(e,r={},t=false,i=false)=>{if(!e||typeof e!="string")throw new TypeError("Expected a non-empty string");let a={negated:false,fastpaths:true};return r.fastpaths!==false&&(e[0]==="."||e[0]==="*")&&(a.output=$e.fastpaths(e,r)),a.output||(a=$e(e,r)),v.compileRe(a,r,t,i)};v.toRegex=(e,r)=>{try{let t=r||{};return new RegExp(e,t.flags||(t.nocase?"i":""))}catch(t){if(r&&r.debug===true)throw t;return /$^/}};v.constants=or;et.exports=v;});var nt=c((Tr,rt)=>{g();rt.exports=tt();});var ot=c((Or,st)=>{g();st.exports=function(e,r){if(typeof e!="string")throw new TypeError("expected path to be a string");if(e==="\\"||e==="/")return "/";var t=e.length;if(t<=1)return e;var i="";if(t>4&&e[3]==="\\"){var a=e[2];(a==="?"||a===".")&&e.slice(0,2)==="\\\\"&&(e=e.slice(2),i="//");}var p=e.split(/[/\\]+/);return r!==false&&p[p.length-1]===""&&p.pop(),i+p.join("/")};});var pt=c((ct,lt)=>{g();Object.defineProperty(ct,"__esModule",{value:true});var it=nt(),ar=ot(),ut="!",ir={returnIndex:false},cr=e=>Array.isArray(e)?e:[e],lr=(e,r)=>{if(typeof e=="function")return e;if(typeof e=="string"){let t=it(e,r);return i=>e===i||t(i)}return e instanceof RegExp?t=>e.test(t):t=>false},at=(e,r,t,i)=>{let a=Array.isArray(t),p=a?t[0]:t;if(!a&&typeof p!="string")throw new TypeError("anymatch: second argument must be a string: got "+Object.prototype.toString.call(p));let u=ar(p,false);for(let h=0;h<r.length;h++){let d=r[h];if(d(u))return i?-1:false}let f=a&&[u].concat(t.slice(1));for(let h=0;h<e.length;h++){let d=e[h];if(a?d(...f):d(u))return i?h:true}return i?-1:false},He=(e,r,t=ir)=>{if(e==null)throw new TypeError("anymatch: specify first argument");let i=typeof t=="boolean"?{returnIndex:t}:t,a=i.returnIndex||false,p=cr(e),u=p.filter(h=>typeof h=="string"&&h.charAt(0)===ut).map(h=>h.slice(1)).map(h=>it(h,i)),f=p.filter(h=>typeof h!="string"||typeof h=="string"&&h.charAt(0)!==ut).map(h=>lr(h,i));return r==null?(h,d=false)=>at(f,u,h,typeof d=="boolean"?d:false):at(f,u,r,a)};He.default=He;lt.exports=He;});g();var Et=e(pt(),1);g();function Te(e){return e.code==="ENOENT"||e.code==="EISDIR"?null:e}function ft(e){return e.code==="EEXIST"?null:e}async function Le(e,r,t){return await gt(dirname(e)),promises.writeFile(e,r,t)}function Oe(e,r){return promises.readFile(e,r).catch(Te)}function Rt(e){return promises.unlink(e).catch(Te)}function _t(e){return promises.readdir(e,{withFileTypes:true}).catch(Te).then(r=>r||[])}async function gt(e){existsSync(e)||(await gt(dirname(e)).catch(ft),await promises.mkdir(e).catch(ft));}async function ve(e,r,t){if(r&&r(e))return [];let i=await _t(e),a=[];return await Promise.all(i.map(async p=>{let u=resolve(e,p.name);if(p.isDirectory()){if(t===void 0||t>0){let f=await ve(u,r,t===void 0?void 0:t-1);a.push(...f.map(h=>p.name+"/"+h));}}else r&&r(p.name)||a.push(p.name);})),a}async function we(e){let r=await _t(e);await Promise.all(r.map(t=>{let i=resolve(e,t.name);return t.isDirectory()?we(i).then(()=>promises.rmdir(i)):promises.unlink(i)}));}var gr=/\.\.:|\.\.$/,Ie="fs",Ur=(e={})=>{if(!e.base)throw b(Ie,"base");let r=resolve(e.base),t=(0, Et.default)(e.ignore||["**/node_modules/**","**/.git/**"]),i=u=>{if(gr.test(u))throw a$1(Ie,`Invalid key: ${JSON.stringify(u)}. It should not contain .. segments`);return join(r,u.replace(/:/g,"/"))},a,p=async()=>{a&&(await a.close(),a=void 0);};return {name:Ie,options:e,flags:{maxDepth:true},hasItem(u){return existsSync(i(u))},getItem(u){return Oe(i(u),"utf8")},getItemRaw(u){return Oe(i(u))},async getMeta(u){let{atime:f,mtime:h,size:d,birthtime:R,ctime:$}=await promises.stat(i(u)).catch(()=>({}));return {atime:f,mtime:h,size:d,birthtime:R,ctime:$}},setItem(u,f){if(!e.readOnly)return Le(i(u),f,"utf8")},setItemRaw(u,f){if(!e.readOnly)return Le(i(u),f)},removeItem(u){if(!e.readOnly)return Rt(i(u))},getKeys(u,f){return ve(i("."),t,f?.maxDepth)},async clear(){e.readOnly||e.noClear||await we(i("."));},async dispose(){a&&await a.close();},async watch(u){if(a)return p;let{watch:f}=await import('./chokidar-BOYGRT4Q.js');return await new Promise((h,d)=>{let R={ignoreInitial:true,...e.watchOptions};R.ignored?Array.isArray(R.ignored)?R.ignored=[...R.ignored]:R.ignored=[R.ignored]:R.ignored=[],R.ignored.push(t),a=f(r,R).on("ready",()=>{h();}).on("error",d).on("all",($,O)=>{O=relative(r,O),$==="change"||$==="add"?u("update",O):$==="unlink"&&u("remove",O);});}),p}}};/*! Bundled license information:
|
|
3
3
|
|
|
4
4
|
normalize-path/index.js:
|
|
5
5
|
(*!
|
|
@@ -8,4 +8,4 @@ normalize-path/index.js:
|
|
|
8
8
|
* Copyright (c) 2014-2018, Jon Schlinkert.
|
|
9
9
|
* Released under the MIT License.
|
|
10
10
|
*)
|
|
11
|
-
*/export{
|
|
11
|
+
*/export{Ur as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {g as g$1}from'./chunk-Y2YAKDEQ.js';import {timingSafeEqual}from'crypto';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
2
|
g$1();async function p(e,r){return typeof e=="boolean"?e:typeof e=="function"?await e(r):true}function h(...e){let r={};for(let t of e)t&&typeof t=="object"&&Object.assign(r,t);return r}function x(e,r){return p(e,r).then(t=>{if(t!==true)return t===false?{_id:{$eq:null}}:t})}g$1();var u="api_keys";function g(e){return e.substring(0,8)}function y(e,r){if(e.length!==r.length)return false;try{return timingSafeEqual(Buffer.from(e),Buffer.from(r))}catch{return false}}async function P(e,r,t){if(!e||typeof e!="string")return {valid:false,error:"No API key provided"};if(!e.startsWith("kyro_"))return {valid:false,error:"Invalid API key format"};let l=g(e);try{let s=await r.find({collection:u,where:{keyPrefix:{equals:l}},limit:100,page:1});if(!s.docs||s.docs.length===0)return {valid:!1,error:"Invalid API key"};let n=null;for(let i of s.docs){let c=i;if(y(c.key,e)){n=c;break}}if(!n)return {valid:!1,error:"Invalid API key"};if(n.expiresAt&&new Date(n.expiresAt)<new Date)return {valid:!1,error:"API key has expired"};try{await r.update({collection:u,id:n.id,data:{lastUsedAt:new Date().toISOString()}});}catch{}let o={id:n.userId,role:n.role||"author",tenantId:n.tenantId};if(t){let i=await t(n.userId);i&&Object.assign(o,i);}return {valid:!0,userId:n.userId,user:o,permissions:n.permissions||[],apiKeyId:n.id,tenantId:o.tenantId,role:o.role}}catch(s){return console.error("[ApiKey] Validation error:",s),{valid:false,error:"Failed to validate API key"}}}function K(e){let r=e.headers.get("Authorization");if(r){if(r.startsWith("ApiKey "))return r.slice(7).trim();if(r.startsWith("Bearer "))return null}let t=e.headers.get("X-API-Key");return t?t.trim():null}function k(e){return !e.valid||!e.userId?null:{userId:e.userId,user:e.user||{},permissions:e.permissions||[],apiKeyId:e.apiKeyId||"",tenantId:e.tenantId,role:e.role}}function v(e,r){if(e.length===0)return false;if(e.includes("*")||e.includes(r))return true;let[t,l]=r.split(":");return !!e.includes(`${t}:*`)}function b(){let e="abcdefghijklmnopqrstuvwxyz0123456789",r="";for(let t=0;t<32;t++)r+=e[Math.floor(Math.random()*e.length)];return `kyro_${r}`}function R(e){return e.substring(0,8)}export{p as a,h as b,x as c,u as d,P as e,K as f,k as g,v as h,b as i,R as j};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {b}from'./chunk-TBHNE4VV.js';import {g as g$1}from'./chunk-Y2YAKDEQ.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
2
|
g$1();var d=class{collections=new Map;globals=new Map;connected=false;tenantContext;setTenantContext(e){this.tenantContext=e;}getTenantContext(){return this.tenantContext}async init(e,n=[]){for(let t of e)this.collections.set(t.slug,t);for(let t of n)this.globals.set(t.slug,t);await this.connect();}getCollection(e){let n=this.collections.get(e);if(!n)throw console.error(`[Adapter] Missing collection "${e}". Available collections:`,Array.from(this.collections.keys())),new Error(`Collection "${e}" not found in adapter`);return n}applyTenantFilter(e={},n){return n?{...e,tenantId:{equals:n}}:e}getTableName(e){return e.replace(/-/g,"_")}prepareData(e,n){let t={...e};if(n.timestamps){let r=new Date().toISOString();t.updatedAt=r,t.createdAt||(t.createdAt=r);}return n.auth&&t.password,t}processRelationships(e,n,t){return e}parseSort(e){return e?e.startsWith("-")?{field:e.slice(1),direction:"desc"}:{field:e,direction:"asc"}:{field:"createdAt",direction:"desc"}}calculatePagination(e,n,t){let r=Math.ceil(t/n);return {totalDocs:t,limit:n,totalPages:r,page:e,pagingCounter:(e-1)*n+1,hasPrevPage:e>1,hasNextPage:e<r,prevPage:e>1?e-1:null,nextPage:e<r?e+1:null}}selectFields(e,n){if(!n||n.length===0)return e;let t={};for(let r of n)r in e&&(t[r]=e[r]);return t.id=e.id,t}isRelationshipField(e){return e.type==="relationship"}isUploadField(e){return e.type==="upload"}getRelationshipFields(e){let n=[];for(let t of e)t.type==="relationship"?n.push(t):"fields"in t&&t.fields&&n.push(...this.getRelationshipFields(t.fields));return n}getUploadFields(e){let n=[];for(let t of e)t.type==="upload"?n.push(t):"fields"in t&&t.fields&&n.push(...this.getUploadFields(t.fields));return n}};g$1();var o={tenantEnabled:true,tenantField:"tenantId",ownershipRules:{posts:{ownerField:"authorId",bypassRoles:["super_admin","admin","editor"]},pages:{ownerField:"authorId",bypassRoles:["super_admin","admin","editor"]},media:{ownerField:"uploadedBy",bypassRoles:["super_admin","admin","editor"]},orders:{ownerField:"customerId",bypassRoles:["super_admin","admin","editor"]},customers:{ownerField:"id",bypassRoles:["super_admin","admin"]},navigation:{ownerField:"id",bypassRoles:["super_admin","admin"]}}};function g(i,e,n=o){return !n.tenantEnabled||e.isSuperAdmin?i:{...i,where:{...i.where,[n.tenantField]:e.tenantId}}}function p(i,e,n,t=o){let r=t.ownershipRules[e];return !r||r.bypassRoles&&b({role:n.role},r.bypassRoles)?i:r.ownerField==="id"&&n.userId?{...i,where:{...i.where,id:n.userId}}:r.ownerField&&n.userId?{...i,where:{...i.where,[r.ownerField]:n.userId}}:i}function m(i,e,n,t=o){let r=i;return r=g(r,n,t),r=p(r,e,n,t),r}function h(i,e,n,t=o){if(n.isSuperAdmin)return true;if(t.tenantEnabled&&i[t.tenantField]!==n.tenantId)return false;let r=t.ownershipRules[e];return !r||r.bypassRoles&&b({role:n.role},r.bypassRoles)?true:r.ownerField==="id"?i.id===n.userId:r.ownerField?i[r.ownerField]===n.userId:true}export{d as a,o as b,m as c,h as d};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {g}from'./chunk-Y2YAKDEQ.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
2
|
g();function i(){return {name:"seo",type:"group",label:"SEO Settings",fields:[{name:"metaTitle",type:"text",label:"Meta Title",admin:{description:"The title used for search engines (recommended < 60 chars).",autoGenerate:"title"}},{name:"metaDescription",type:"textarea",label:"Meta Description",admin:{description:"A brief summary for search engines (recommended < 160 chars).",autoGenerate:"content"}},{name:"keywords",type:"text",label:"Keywords",admin:{description:"Comma-separated list of keywords for this page."}},{name:"ogImage",type:"upload",label:"OpenGraph Image",relationTo:"media",admin:{description:"The image shown when the post is shared on social media (Facebook, LinkedIn)."}},{name:"twitter",type:"group",label:"Twitter Card",fields:[{name:"title",type:"text",label:"Twitter Title"},{name:"description",type:"textarea",label:"Twitter Description"},{name:"image",type:"upload",label:"Twitter Image",relationTo:"media"}]},{name:"advanced",type:"group",label:"Advanced Search Settings",fields:[{name:"noindex",type:"checkbox",label:"Hide from search engines (noindex)",defaultValue:false},{name:"nofollow",type:"checkbox",label:"Do not follow links (nofollow)",defaultValue:false},{name:"canonicalUrl",type:"text",label:"Canonical URL Override",admin:{description:"Leave empty to use the default canonical URL."}},{name:"structuredData",type:"code",label:"JSON-LD Structured Data",admin:{description:"Custom JSON-LD schema for this specific page."}}]}]}}export{i as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {g}from'./chunk-Y2YAKDEQ.js';import r from'path';import m from'fs';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
2
|
g();var l=o=>{let s=r.join(process.cwd(),"node_modules","@kyro-cms","core"),e=r.resolve(s,"src",`${o}.ts`);return m.existsSync(e)?e:r.resolve(s,"dist",`${o}.js`)},E=l("api-handler"),x=l("api-handler-graphql"),P=l("api-handler-trpc"),S=["@kyro-cms/core","@kyro-cms/admin","@kyro-cms/astro","@kyro-cms/ai","@kyro-cms/connect"],_=["better-sqlite3","pg","mongodb","ioredis","sharp","ssh2","cpu-features","ssh2-sftp-client","nodemailer","jsonwebtoken","@mapbox/node-pre-gyp","mock-aws-s3","aws-sdk","nock"],A=["crypto","node:crypto","module","node:module","fs","node:fs","fs/promises","node:fs/promises","path","node:path","util","node:util","stream","node:stream","events","node:events","url","node:url","http","node:http","https","node:https","os","node:os","child_process","node:child_process","assert","node:assert","zlib","node:zlib","buffer","node:buffer"],f=[...S,..._],N=[...S,...A,..._];function R(o={}){let{configPath:s="./kyro.config.ts",apiPath:e="/api",adminPath:a="/admin",admin:O=true,enableGraphQL:c=false,enableTRPC:p=false,enableWebSocket:h=false}=o;return {name:"@kyro-cms/core",hooks:{"astro:config:setup":async({config:y,updateConfig:b,injectRoute:i,logger:n})=>{if(n.info(`Setting up Kyro CMS (API: ${e}, Admin: ${a})`),e===a)throw new Error(`Kyro CMS: apiPath and adminPath cannot be the same ("${e}")`);let u=r.resolve(y.root.pathname,s),g=u;m.existsSync(u)||n.warn(`Kyro config file not found at ${s}. The API will fail to boot if collections are needed.`),b({security:{checkOrigin:false},vite:{ssr:{external:N},build:{rollupOptions:{external:f}},optimizeDeps:{exclude:f},server:{watch:{ignored:["**/*.db","**/*.db-*","**/data/**","**/public/uploads/**","**/.kyro/**"]}},plugins:[{name:"use-sync-external-store-shim-fix",enforce:"pre",resolveId(t){if(t==="use-sync-external-store/shim"||t==="use-sync-external-store/shim/index.js")return "\0virtual:use-sync-external-store-shim";if(t==="use-sync-external-store/shim/with-selector"||t==="use-sync-external-store/shim/with-selector.js")return "\0virtual:use-sync-external-store-shim-with-selector"},load(t){if(t==="\0virtual:use-sync-external-store-shim")return 'export { useSyncExternalStore } from "react";';if(t==="\0virtual:use-sync-external-store-shim-with-selector")return `
|
|
3
3
|
import { useSyncExternalStore, useMemo } from "react";
|
|
4
4
|
export function useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {g as g$1}from'./chunk-Y2YAKDEQ.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
2
|
g$1();var g=[{name:"super_admin",level:100,inherits:[],description:"Full system access across all tenants"},{name:"admin",level:90,inherits:["editor"],description:"Full tenant access with all content permissions"},{name:"editor",level:70,inherits:["author"],description:"Edit and publish all content"},{name:"author",level:50,inherits:["customer"],description:"Create and edit own content"},{name:"customer",level:30,inherits:[],description:"Access own data and make purchases"},{name:"guest",level:10,inherits:[],description:"Public read-only access"}];var u={super_admin:["*"],admin:["users:admin","users:read","users:update","audit_logs:read","posts:admin","posts:read","posts:create","posts:update","posts:delete","pages:admin","pages:read","pages:create","pages:update","pages:delete","media:admin","media:read","media:create","media:update","media:delete","categories:admin","categories:read","categories:create","categories:update","categories:delete","products:admin","products:read","products:create","products:update","products:delete","orders:admin","orders:read","orders:update","customers:admin","customers:read","customers:update","coupons:admin","coupons:read","coupons:create","coupons:update","coupons:delete","navigation:admin","navigation:read","navigation:create","navigation:update","navigation:delete","settings:admin","settings:read","settings:update","profile:admin","profile:read","profile:update"],editor:["posts:admin","posts:read","posts:create","posts:update","posts:delete","pages:admin","pages:read","pages:create","pages:update","pages:delete","media:read","media:create","media:update","categories:read","categories:create","categories:update","products:read","orders:read","orders:update","navigation:read","navigation:create","navigation:update","profile:read","profile:update"],author:["posts:read","posts:create","posts:update","media:read","media:create","categories:read","profile:read","profile:update"],customer:["profile:read","profile:update","orders:read","orders:create"],guest:["posts:read","pages:read","products:read"]};function d(e,s=g){let t=[e],r=new Map(s.map(o=>[o.name,o])),n=o=>{let i=r.get(o);if(i&&i.inherits)for(let c of i.inherits)t.includes(c)||(t.push(c),n(c));};return n(e),t}g$1();function R(e,s,t=u){if(!e||!e.role)return false;let r=m(e,t);if(r.includes("*")||r.includes(s))return true;let[n,o]=s.split(":");return !!(r.includes(`${n}:*`)||r.includes(`${n}:admin`))}function A(e,s){if(!e||!e.role)return false;let t=d(e.role);return s.some(r=>t.includes(r))}function m(e,s=u){if(!e||!e.role)return [];let t=d(e.role),r=new Set;for(let n of t){let o=s[n];if(o)for(let i of o)r.add(i);}return Array.from(r)}export{R as a,A as b};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {g as g$1}from'./chunk-Y2YAKDEQ.js';import {getRandomValues}from'crypto';import {ReadStream,lstatSync,fstatSync}from'fs';import {Readable,Writable}from'stream';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
2
|
g$1();g$1();g$1();var J=e=>typeof ArrayBuffer=="function"&&e instanceof ArrayBuffer||Object.prototype.toString.call(e)==="[object ArrayBuffer]";var B=(e,t=0,r=e.byteLength-t)=>{if(!J(e))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof e} (${e})`);return Buffer.from(e,t,r)},U=(e,t)=>{if(typeof e!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof e} (${e})`);return t?Buffer.from(e,t):Buffer.from(e)};var R=e=>{let t=U(e,"utf8");return new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT)};g$1();var se=e=>{if(typeof e=="string")return e;if(typeof e!="object"||typeof e.byteOffset!="number"||typeof e.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return B(e.buffer,e.byteOffset,e.byteLength).toString("utf8")};g$1();var ie={},W={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();t.length===1&&(t=`0${t}`),ie[e]=t,W[t]=e;}function De(e){if(e.length%2!==0)throw new Error("Hex encoded strings must have an even number length");let t=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2){let n=e.slice(r,r+2).toLowerCase();if(n in W)t[r/2]=W[n];else throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`)}return t}function z(e){let t="";for(let r=0;r<e.byteLength;r++)t+=ie[e[r]];return t}g$1();g$1();var _e=/^[A-Za-z0-9+/]*={0,2}$/,ae=e=>{if(e.length*3%4!==0)throw new TypeError("Incorrect padding on base64 string.");if(!_e.exec(e))throw new TypeError("Invalid base64 string.");let t=U(e,"base64");return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)};g$1();var F=e=>{let t;if(typeof e=="string"?t=R(e):t=e,typeof t!="object"||typeof t.byteOffset!="number"||typeof t.byteLength!="number")throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");return B(t.buffer,t.byteOffset,t.byteLength).toString("base64")};g$1();function fe(e,t,r,n){return class O extends Uint8Array{static fromString(s,a="utf-8"){if(typeof s=="string")return a==="base64"?O.mutate(n(s)):O.mutate(t(s));throw new Error(`Unsupported conversion from ${typeof s} to Uint8ArrayBlobAdapter.`)}static mutate(s){return Object.setPrototypeOf(s,O.prototype),s}transformToString(s="utf-8"){return s==="base64"?r(this):e(this)}}}g$1();var l=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function ce(e){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?()=>crypto.randomUUID():()=>{let t=new Uint8Array(16);return e(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128,l[t[0]]+l[t[1]]+l[t[2]]+l[t[3]]+"-"+l[t[4]]+l[t[5]]+"-"+l[t[6]]+l[t[7]]+"-"+l[t[8]]+l[t[9]]+"-"+l[t[10]]+l[t[11]]+l[t[12]]+l[t[13]]+l[t[14]]+l[t[15]]}}g$1();g$1();var j=e=>{if(e!=null){if(typeof e=="string"){let t=parseFloat(e);if(!Number.isNaN(t))return String(t)!==String(e)&&ze.warn(We(`Expected number but observed string: ${e}`)),t}if(typeof e=="number")return e;throw new TypeError(`Expected number, got ${typeof e}: ${e}`)}},ke=Math.ceil(34028234663852886e22),ue=e=>{let t=j(e);if(t!==void 0&&!Number.isNaN(t)&&t!==1/0&&t!==-1/0&&Math.abs(t)>ke)throw new TypeError(`Expected 32-bit float, got ${e}`);return t},Pe=e=>{if(e!=null){if(Number.isInteger(e)&&!Number.isNaN(e))return e;throw new TypeError(`Expected integer, got ${typeof e}: ${e}`)}};var de=e=>me(e,16),pe=e=>me(e,8),me=(e,t)=>{let r=Pe(e);if(r!==void 0&&He(r,t)!==r)throw new TypeError(`Expected ${t}-bit integer, got ${e}`);return r},He=(e,t)=>{switch(t){case 32:return Int32Array.of(e)[0];case 16:return Int16Array.of(e)[0];case 8:return Int8Array.of(e)[0]}};var he=e=>j(typeof e=="string"?L(e):e);var ye=e=>ue(typeof e=="string"?L(e):e),Je=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,L=e=>{let t=e.match(Je);if(t===null||t[0].length!==e.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(e)};var N=e=>de(typeof e=="string"?L(e):e),le=e=>pe(typeof e=="string"?L(e):e),We=e=>String(new TypeError(e).stack||e).split(`
|
|
3
3
|
`).slice(0,5).filter(t=>!t.includes("stackTraceWarning")).join(`
|
|
4
4
|
`),ze={warn:console.warn};var je=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Y=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function qe(e){let t=e.getUTCFullYear(),r=e.getUTCMonth(),n=e.getUTCDay(),o=e.getUTCDate(),s=e.getUTCHours(),a=e.getUTCMinutes(),f=e.getUTCSeconds(),c=o<10?`0${o}`:`${o}`,u=s<10?`0${s}`:`${s}`,m=a<10?`0${a}`:`${a}`,h=f<10?`0${f}`:`${f}`;return `${je[n]}, ${c} ${Y[r]} ${t} ${u}:${m}:${h} GMT`}var Ye=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/),Ve=e=>{if(e==null)return;if(typeof e!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let t=Ye.exec(e);if(!t)throw new TypeError("Invalid RFC-3339 date-time value");let[r,n,o,s,a,f,c,u]=t,m=N(C(n)),h=w(o,"month",1,12),y=w(s,"day",1,31);return M(m,h,y,{hours:a,minutes:f,seconds:c,fractionalMilliseconds:u})},Ge=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}:\d{2})|[zZ])$/),Xe=e=>{if(e==null)return;if(typeof e!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let t=Ge.exec(e);if(!t)throw new TypeError("Invalid RFC-3339 date-time value");let[r,n,o,s,a,f,c,u,m]=t,h=N(C(n)),y=w(o,"month",1,12),b=w(s,"day",1,31),x=M(h,y,b,{hours:a,minutes:f,seconds:c,fractionalMilliseconds:u});return m.toUpperCase()!="Z"&&x.setTime(x.getTime()-ft(m)),x},Ze=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),Ke=new RegExp(/^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),Qe=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/),ve=e=>{if(e==null)return;if(typeof e!="string")throw new TypeError("RFC-7231 date-times must be expressed as strings");let t=Ze.exec(e);if(t){let[r,n,o,s,a,f,c,u]=t;return M(N(C(s)),q(o),w(n,"day",1,31),{hours:a,minutes:f,seconds:c,fractionalMilliseconds:u})}if(t=Ke.exec(e),t){let[r,n,o,s,a,f,c,u]=t;return nt(M(tt(s),q(o),w(n,"day",1,31),{hours:a,minutes:f,seconds:c,fractionalMilliseconds:u}))}if(t=Qe.exec(e),t){let[r,n,o,s,a,f,c,u]=t;return M(N(C(u)),q(n),w(o.trimLeft(),"day",1,31),{hours:s,minutes:a,seconds:f,fractionalMilliseconds:c})}throw new TypeError("Invalid RFC-7231 date-time value")},et=e=>{if(e==null)return;let t;if(typeof e=="number")t=e;else if(typeof e=="string")t=he(e);else if(typeof e=="object"&&e.tag===1)t=e.value;else throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");if(Number.isNaN(t)||t===1/0||t===-1/0)throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");return new Date(Math.round(t*1e3))},M=(e,t,r,n)=>{let o=t-1;return st(e,o,r),new Date(Date.UTC(e,o,r,w(n.hours,"hour",0,23),w(n.minutes,"minute",0,59),w(n.seconds,"seconds",0,60),at(n.fractionalMilliseconds)))},tt=e=>{let t=new Date().getUTCFullYear(),r=Math.floor(t/100)*100+N(C(e));return r<t?r+100:r},rt=50*365*24*60*60*1e3,nt=e=>e.getTime()-new Date().getTime()>rt?new Date(Date.UTC(e.getUTCFullYear()-100,e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds())):e,q=e=>{let t=Y.indexOf(e);if(t<0)throw new TypeError(`Invalid month: ${e}`);return t+1},ot=[31,28,31,30,31,30,31,31,30,31,30,31],st=(e,t,r)=>{let n=ot[t];if(t===1&&it(e)&&(n=29),r>n)throw new TypeError(`Invalid day for ${Y[t]} in ${e}: ${r}`)},it=e=>e%4===0&&(e%100!==0||e%400===0),w=(e,t,r,n)=>{let o=le(C(e));if(o<r||o>n)throw new TypeError(`${t} must be between ${r} and ${n}, inclusive`);return o},at=e=>e==null?0:ye("0."+e)*1e3,ft=e=>{let t=e[0],r=1;if(t=="+")r=1;else if(t=="-")r=-1;else throw new TypeError(`Offset direction, ${t}, must be "+" or "-"`);let n=Number(e.substring(1,3)),o=Number(e.substring(4,6));return r*(n*60+o)*60*1e3},C=e=>{let t=0;for(;t<e.length-1&&e.charAt(t)==="0";)t++;return t===0?e:e.slice(t)};g$1();var T=function(t){return Object.assign(new String(t),{deserializeJSON(){return JSON.parse(String(t))},toString(){return String(t)},toJSON(){return String(t)}})};T.from=e=>e&&typeof e=="object"&&(e instanceof T||"deserializeJSON"in e)?e:typeof e=="string"||Object.getPrototypeOf(e)===String.prototype?T(String(e)):T(JSON.stringify(e));T.fromObject=T.from;g$1();function ct(e){return (e.includes(",")||e.includes('"'))&&(e=`"${e.replace(/"/g,'\\"')}"`),e}g$1();var V="(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)(?:[ne|u?r]?s?day)?",G="(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)",X="(\\d?\\d):(\\d{2}):(\\d{2})(?:\\.(\\d+))?",be="(\\d?\\d)",ge="(\\d{4})",ut=new RegExp(/^(\d{4})-(\d\d)-(\d\d)[tT](\d\d):(\d\d):(\d\d)(\.(\d+))?(([-+]\d\d:\d\d)|[zZ])$/),dt=new RegExp(`^${V}, ${be} ${G} ${ge} ${X} GMT$`),pt=new RegExp(`^${V}, ${be}-${G}-(\\d\\d) ${X} GMT$`),mt=new RegExp(`^${V} ${G} ( [1-9]|\\d\\d) ${X} ${ge}$`),ht=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],yt=e=>{if(e==null)return;let t=NaN;if(typeof e=="number")t=e;else if(typeof e=="string"){if(!/^-?\d*\.?\d+$/.test(e))throw new TypeError("parseEpochTimestamp - numeric string invalid.");t=Number.parseFloat(e);}else typeof e=="object"&&e.tag===1&&(t=e.value);if(isNaN(t)||Math.abs(t)===1/0)throw new TypeError("Epoch timestamps must be valid finite numbers.");return new Date(Math.round(t*1e3))},lt=e=>{if(e==null)return;if(typeof e!="string")throw new TypeError("RFC3339 timestamps must be strings");let t=ut.exec(e);if(!t)throw new TypeError(`Invalid RFC3339 timestamp format ${e}`);let[,r,n,o,s,a,f,,c,u]=t;S(n,1,12),S(o,1,31),S(s,0,23),S(a,0,59),S(f,0,60);let m=new Date(Date.UTC(Number(r),Number(n)-1,Number(o),Number(s),Number(a),Number(f),Number(c)?Math.round(parseFloat(`0.${c}`)*1e3):0));if(m.setUTCFullYear(Number(r)),u.toUpperCase()!="Z"){let[,h,y,b]=/([+-])(\d\d):(\d\d)/.exec(u)||[void 0,"+",0,0],x=h==="-"?1:-1;m.setTime(m.getTime()+x*(Number(y)*60*60*1e3+Number(b)*60*1e3));}return m},bt=e=>{if(e==null)return;if(typeof e!="string")throw new TypeError("RFC7231 timestamps must be strings.");let t,r,n,o,s,a,f,c;if((c=dt.exec(e))?[,t,r,n,o,s,a,f]=c:(c=pt.exec(e))?([,t,r,n,o,s,a,f]=c,n=(Number(n)+1900).toString()):(c=mt.exec(e))&&([,r,t,o,s,a,f,n]=c),n&&a){let u=Date.UTC(Number(n),ht.indexOf(r),Number(t),Number(o),Number(s),Number(a),f?Math.round(parseFloat(`0.${f}`)*1e3):0);S(t,1,31),S(o,0,23),S(s,0,59),S(a,0,60);let m=new Date(u);return m.setUTCFullYear(Number(n)),m}throw new TypeError(`Invalid RFC7231 date-time value ${e}.`)};function S(e,t,r){let n=Number(e);if(n<t||n>r)throw new Error(`Value ${n} out of range [${t}, ${r}]`)}g$1();function gt(e,t,r){if(r<=0||!Number.isInteger(r))throw new Error("Invalid number of delimiters ("+r+") for splitEvery.");let n=e.split(t);if(r===1)return n;let o=[],s="";for(let a=0;a<n.length;a++)s===""?s=n[a]:s+=t+n[a],(a+1)%r===0&&(o.push(s),s="");return s!==""&&o.push(s),o}g$1();var wt=e=>{let t=e.length,r=[],n=false,o,s=0;for(let a=0;a<t;++a){let f=e[a];switch(f){case '"':o!=="\\"&&(n=!n);break;case ",":n||(r.push(e.slice(s,a)),s=a+1);break;}o=f;}return r.push(e.slice(s)),r.map(a=>{a=a.trim();let f=a.length;return f<2?a:(a[0]==='"'&&a[f-1]==='"'&&(a=a.slice(1,f-1)),a.replace(/\\"/g,'"'))})};g$1();var we=/^-?\d*(\.\d+)?$/,Z=class e{string;type;constructor(t,r){if(this.string=t,this.type=r,!we.test(t))throw new Error('@smithy/core/serde - NumericValue must only contain [0-9], at most one decimal point ".", and an optional negation prefix "-".')}toString(){return this.string}static[Symbol.hasInstance](t){if(!t||typeof t!="object")return false;let r=t;return e.prototype.isPrototypeOf(t)||r.type==="bigDecimal"&&we.test(r.string)}};g$1();var Tt=e=>{if(!e)return 0;if(typeof e=="string")return Buffer.byteLength(e);if(typeof e.byteLength=="number")return e.byteLength;if(typeof e.size=="number")return e.size;if(typeof e.start=="number"&&typeof e.end=="number")return e.end+1-e.start;if(e instanceof ReadStream){if(e.path!=null)return lstatSync(e.path).size;if(typeof e.fd=="number")return fstatSync(e.fd).size}throw new Error(`Body Length computation failed for ${e}`)};g$1();var $t=e=>e instanceof Uint8Array?e:typeof e=="string"?R(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e);g$1();function I(e,t){if(t===void 0){t=0;for(let o of e)t+=o.byteLength;}let r=new Uint8Array(t),n=0;for(let o of e)r.set(o,n),n+=o.byteLength;return r}g$1();var D=class extends Readable{expectedChecksum;checksumSourceLocation;checksum;source;base64Encoder;constructor({expectedChecksum:t,checksum:r,source:n,checksumSourceLocation:o,base64Encoder:s}){if(super(),typeof n.pipe!="function")throw new Error(`@smithy/util-stream: unsupported source type ${n?.constructor?.name??n} in ChecksumStream.`);this.source=n,this.base64Encoder=s??F,this.expectedChecksum=t,this.checksum=r,this.checksumSourceLocation=o,this.source.on("data",this.onSourceData),this.source.on("end",this.onSourceEnd),this.source.on("error",this.onSourceError),this.source.on("close",this.onSourceClose),this.source.pause();}onSourceData=t=>{if(!this.destroyed){try{this.checksum.update(t);}catch(r){this.destroy(r);return}this.push(t)||this.source.pause();}};onSourceEnd=async()=>{if(!this.destroyed){try{let t=await this.checksum.digest(),r=this.base64Encoder(t);if(this.expectedChecksum!==r){this.destroy(new Error(`Checksum mismatch: expected "${this.expectedChecksum}" but received "${r}" in response header "${this.checksumSourceLocation}".`));return}}catch(t){this.destroy(t);return}this.push(null);}};onSourceError=t=>{this.destroy(t);};onSourceClose=()=>{!this.destroyed&&!this.source.readableEnded&&this.destroy(new Error("Connection lost or stream closed before all data was received."));};_read(t){this.source.resume();}_destroy(t,r){this.source?.removeListener("data",this.onSourceData),this.source?.removeListener("end",this.onSourceEnd),this.source?.removeListener("error",this.onSourceError),this.source?.removeListener("close",this.onSourceClose),this.source?.destroy(),r(t);}};g$1();g$1();var g=e=>typeof ReadableStream=="function"&&(e?.constructor?.name===ReadableStream.name||e instanceof ReadableStream),_=e=>typeof Blob=="function"&&(e?.constructor?.name===Blob.name||e instanceof Blob);g$1();g$1();g$1();var xe=e=>new TextEncoder().encode(e);g$1();var Se="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";Object.entries(Se).reduce((e,[t,r])=>(e[r]=Number(t),e),{});var Ee=Se.split(""),k=6,K=8,Te=63;function P(e){let t;typeof e=="string"?t=xe(e):t=e;let r=typeof t=="object"&&typeof t.length=="number",n=typeof t=="object"&&typeof t.byteOffset=="number"&&typeof t.byteLength=="number";if(!r&&!n)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let o="";for(let s=0;s<t.length;s+=3){let a=0,f=0;for(let u=s,m=Math.min(s+3,t.length);u<m;u++)a|=t[u]<<(m-u-1)*K,f+=K;let c=Math.ceil(f/k);a<<=c*k-f;for(let u=1;u<=c;u++){let m=(c-u)*k;o+=Ee[(a&Te<<m)>>m];}o+="==".slice(0,4-c);}return o}g$1();var Bt=typeof ReadableStream=="function"?ReadableStream:function(){},H=class extends Bt{};var $e=({expectedChecksum:e,checksum:t,source:r,checksumSourceLocation:n,base64Encoder:o})=>{if(!g(r))throw new Error(`@smithy/util-stream: unsupported source type ${r?.constructor?.name??r} in ChecksumStream.`);let s=o??P;if(typeof TransformStream!="function")throw new Error("@smithy/util-stream: unable to instantiate ChecksumStream because API unavailable: ReadableStream/TransformStream.");let a=new TransformStream({start(){},async transform(c,u){t.update(c),u.enqueue(c);},async flush(c){let u=await t.digest(),m=s(u);if(e!==m){let h=new Error(`Checksum mismatch: expected "${e}" but received "${m}" in response header "${n}".`);c.error(h);}else c.terminate();}});r.pipeThrough(a);let f=a.readable;return Object.setPrototypeOf(f,H.prototype),f};function Rt(e){return typeof ReadableStream=="function"&&g(e.source)?$e(e):new D(e)}g$1();g$1();var $=class{allocByteArray;byteLength=0;byteArrays=[];constructor(t){this.allocByteArray=t;}push(t){this.byteArrays.push(t),this.byteLength+=t.byteLength;}flush(){if(this.byteArrays.length===1){let n=this.byteArrays[0];return this.reset(),n}let t=this.allocByteArray(this.byteLength),r=0;for(let n=0;n<this.byteArrays.length;++n){let o=this.byteArrays[n];t.set(o,r),r+=o.byteLength;}return this.reset(),t}reset(){this.byteArrays=[],this.byteLength=0;}};g$1();function Ae(e,t,r){let n=e.getReader(),o=false,s=0,a=["",new $(u=>new Uint8Array(u))],f=-1,c=async u=>{let{value:m,done:h}=await n.read(),y=m;if(h){if(f!==-1){let b=A(a,f);E(b)>0&&u.enqueue(b);}u.close();}else {let b=v(y,false);if(f!==b&&(f>=0&&u.enqueue(A(a,f)),f=b),f===-1){u.enqueue(y);return}let x=E(y);s+=x;let Le=E(a[f]);if(x>=t&&Le===0)u.enqueue(y);else {let Ie=Q(a,f,y);!o&&s>t*2&&(o=true,r?.warn(`@smithy/util-stream - stream chunk size ${x} is below threshold of ${t}, automatically buffering.`)),Ie>=t?u.enqueue(A(a,f)):await c(u);}}};return new ReadableStream({pull:c})}function Q(e,t,r){switch(t){case 0:return e[0]+=r,E(e[0]);case 1:case 2:return e[t].push(r),E(e[t])}}function A(e,t){switch(t){case 0:let r=e[0];return e[0]="",r;case 1:case 2:return e[t].flush()}throw new Error(`@smithy/util-stream - invalid index ${t} given to flush()`)}function E(e){return e?.byteLength??e?.length??0}function v(e,t=true){return t&&typeof Buffer<"u"&&e instanceof Buffer?2:e instanceof Uint8Array?1:typeof e=="string"?0:-1}function Ct(e,t,r){if(g(e))return Ae(e,t,r);let n=new Readable({read(){}}),o=false,s=0,a=["",new $(c=>new Uint8Array(c)),new $(c=>Buffer.from(new Uint8Array(c)))],f=-1;return e.on("data",c=>{let u=v(c,true);if(f!==u&&(f>=0&&n.push(A(a,f)),f=u),f===-1){n.push(c);return}let m=E(c);s+=m;let h=E(a[f]);if(m>=t&&h===0)n.push(c);else {let y=Q(a,f,c);!o&&s>t*2&&(o=true,r?.warn(`@smithy/util-stream - stream chunk size ${m} is below threshold of ${t}, automatically buffering.`)),y>=t&&n.push(A(a,f));}}),e.on("end",()=>{if(f!==-1){let c=A(a,f);E(c)>0&&n.push(c);}n.push(null);}),n}g$1();g$1();var Be=(e,t)=>{let{base64Encoder:r,bodyLengthChecker:n,checksumAlgorithmFn:o,checksumLocationName:s,streamHasher:a}=t,f=r!==void 0&&n!==void 0&&o!==void 0&&s!==void 0&&a!==void 0,c=f?a(o,e):void 0,u=e.getReader();return new ReadableStream({async pull(m){let{value:h,done:y}=await u.read();if(y){if(m.enqueue(`0\r
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {v as v$1}from'./chunk-TYQYKKWJ.js';import {g}from'./chunk-Y2YAKDEQ.js';import*as N from'zlib';import {Writable}from'stream';import {createHash,createHmac}from'crypto';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
2
|
g();g();var M=new Uint32Array(256);for(let n=0;n<256;++n){let e=n;for(let t=0;t<8;++t)e=e&1?3988292384^e>>>1:e>>>1;M[n]=e>>>0;}var H=4294967295,w=class{digestLength=4;checksum=H;update(e){for(let t=0;t<e.length;++t)this.checksum=this.checksum>>>8^M[(this.checksum^e[t])&255];}digestSync(){return (this.checksum^H)>>>0}async digest(){let e=this.digestSync(),t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,false),t}reset(){this.checksum=H;}};var v=typeof N.crc32=="function"?N.crc32:void 0,E=v?G(v):w;function G(n){return class{digestLength=4;value=0;update(t){this.value=n(t,this.value);}digestSync(){return this.value>>>0}async digest(){let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,this.digestSync(),false),t}reset(){this.value=0;}}}g();g();var A=class extends Writable{hash;constructor(e,t){super(t),this.hash=e;}_write(e,t,r){try{this.hash.update(v$1(e));}catch(s){return r(s)}r();}};g();var _=(n,e)=>{if(e.readableFlowing!==null)throw new Error("Unable to calculate hash for flowing readable stream");let t=new n,r=new A(t);return e.pipe(r),new Promise((s,f)=>{e.on("error",h=>{r.end(),f(h);}),r.on("error",f),r.on("finish",()=>{t.digest().then(s).catch(f);});})};g();var U=class{digestLength=16;state=Uint32Array.from(I);writeBuffer=new DataView(new ArrayBuffer(64));bufferLength=0;bytesHashed=0;update(e){let t=v$1(e),r=0,s=t.byteLength;for(this.bytesHashed+=s;s>0;)this.writeBuffer.setUint8(this.bufferLength++,t[r++]),--s,this.bufferLength===64&&(S(this.state,this.writeBuffer),this.bufferLength=0);}async digest(){let e=Uint32Array.from(this.state),t=new DataView(this.writeBuffer.buffer.slice(0)),r=this.bufferLength,s=this.bytesHashed*8;if(t.setUint8(r++,128),this.bufferLength%64>=56){for(let i=r;i<64;++i)t.setUint8(i,0);S(e,t),r=0;}for(let i=r;i<56;++i)t.setUint8(i,0);t.setUint32(56,s>>>0,true),t.setUint32(60,Math.floor(s/2**32),true),S(e,t);let f=new Uint8Array(16),h=new DataView(f.buffer);for(let i=0;i<4;++i)h.setUint32(i*4,e[i],true);return f}reset(){this.state.set(I),this.writeBuffer=new DataView(new ArrayBuffer(64)),this.bufferLength=0,this.bytesHashed=0;}},I=[1732584193,4023233417,2562383102,271733878],y=4294967295,R=Uint8Array.of(7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21),F=Array.from({length:64},(n,e)=>Math.abs(Math.sin(e+1))*2**32>>>0);function S(n,e){let t=n[0],r=n[1],s=n[2],f=n[3];for(let h=0;h<64;++h){let i,c;h<16?(i=r&s|~r&f,c=h):h<32?(i=f&r|s&~f,c=(5*h+1)%16):h<48?(i=r^s^f,c=(3*h+5)%16):(i=s^(r|~f),c=7*h%16);let m=e.getUint32(c*4,true),p=f;f=s,s=r;let g=R[(h>>4)*4+(h&3)],a=(t+i&y)+(m+F[h]&y)&y;r=r+((a<<g|a>>>32-g)>>>0)&y,t=p;}n[0]=n[0]+t&y,n[1]=n[1]+r&y,n[2]=n[2]+s&y,n[3]=n[3]+f&y;}g();var P=(()=>{try{return createHash("md5"),!0}catch{return false}})(),D=P?X():U;function X(){return class{digestLength=16;hash=createHash("md5");update(e){this.hash.update(v$1(e));}async digest(){let e=this.hash.copy().digest();return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}reset(){this.hash=createHash("md5");}}}g();var u=64,V=32,q=2**53-1,L=class n{digestLength=V;state=Int32Array.from(k);w;buffer=new Uint8Array(64);bufferLength=0;bytesHashed=0;finished=false;inner;outer;constructor(e){if(e){let t=n.normalizeKey(e);this.inner=new n,this.outer=new n;let{inner:r,outer:s}=this,f=new Uint8Array(u*2);for(let h=0;h<u;++h)f[h]=54^t[h],f[h+u]=92^t[h];r.update(f.subarray(0,u)),s.update(f.subarray(u));}}update(e){if(this.finished)throw new Error("Attempted to update an already finished HMAC.");if(this.inner){this.inner.update(e);return}let t=v$1(e),r=0,{byteLength:s}=t;if(this.bytesHashed+=s,this.bytesHashed*8>q)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;s>0;)this.buffer[this.bufferLength++]=t[r++],s--,this.bufferLength===u&&(this.hashBuffer(),this.bufferLength=0);}async digest(){let{inner:e,outer:t}=this;if(e&&t){if(this.finished)throw new Error("Attempted to digest an already finished HMAC.");this.finished=true;let r=e.digestSync();return t.update(r),t.digestSync()}return this.digestSync()}reset(){this.state=Int32Array.from(k),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0;}digestSync(){let e=this.state.slice(),t=this.buffer.slice(),r=this.bufferLength,s=this.bytesHashed*8,f=new DataView(t.buffer,t.byteOffset,t.byteLength);if(f.setUint8(r++,128),(r-1)%u>=u-8){for(let i=r;i<u;++i)f.setUint8(i,0);this.hashBufferWith(e,t),r=0;}for(let i=r;i<u-8;++i)f.setUint8(i,0);f.setUint32(u-8,Math.floor(s/4294967296),false),f.setUint32(u-4,s,false),this.hashBufferWith(e,t);let h=new Uint8Array(V);for(let i=0;i<8;++i)h[i*4]=e[i]>>>24&255,h[i*4+1]=e[i]>>>16&255,h[i*4+2]=e[i]>>>8&255,h[i*4+3]=e[i]>>>0&255;return h}static normalizeKey(e){let t=v$1(e);if(t.byteLength>u){let r=new n;r.update(t);let s=r.digestSync(),f=new Uint8Array(u);return f.set(s),f}if(t.byteLength<u){let r=new Uint8Array(u);return r.set(t),r}return t}hashBuffer(){this.hashBufferWith(this.state,this.buffer);}hashBufferWith(e,t){let r=this.w??=new Int32Array(64),s=e[0],f=e[1],h=e[2],i=e[3],c=e[4],m=e[5],p=e[6],g=e[7];for(let a=0;a<u;++a){if(a<16)r[a]=(t[a*4]&255)<<24|(t[a*4+1]&255)<<16|(t[a*4+2]&255)<<8|t[a*4+3]&255;else {let d=r[a-2],W=(d>>>17|d<<15)^(d>>>19|d<<13)^d>>>10;d=r[a-15];let K=(d>>>7|d<<25)^(d>>>18|d<<14)^d>>>3;r[a]=(W+r[a-7]|0)+(K+r[a-16]|0);}let C=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&m^~c&p)|0)+(g+(Q[a]+r[a]|0)|0)|0,O=((s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10))+(s&f^s&h^f&h)|0;g=p,p=m,m=c,c=i+C|0,i=h,h=f,f=s,s=C+O|0;}e[0]+=s,e[1]+=f,e[2]+=h,e[3]+=i,e[4]+=c,e[5]+=m,e[6]+=p,e[7]+=g;}},k=new Int32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Q=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);g();var Z=(()=>{try{return createHash("sha256"),!0}catch{return false}})(),z=Z?$():L;function $(){return class{digestLength=32;secret;hash;isHmac;finished=false;constructor(e){this.secret=e,this.isHmac=!!e,this.hash=this.createHash();}update(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");this.hash.update(e);}async digest(){let e;return this.isHmac?(this.finished=true,e=this.hash.digest()):e=this.hash.copy().digest(),new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}reset(){this.hash=this.createHash(),this.finished=false;}createHash(){return this.secret?createHmac("sha256",j(this.secret)):createHash("sha256")}}}function j(n){return typeof n=="string"?n:ArrayBuffer.isView(n)?Buffer.from(n.buffer,n.byteOffset,n.byteLength):Buffer.from(n)}export{_ as a,D as b,E as c,z as d};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {a}from'./chunk-7NH7H3WA.js';import {g as g$1,e}from'./chunk-Y2YAKDEQ.js';import {randomUUID,randomBytes}from'crypto';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
|
+
g$1();var c=e(a(),1);var g=class{db;adapter;prefix;sessionTTL;refreshTokenTTL;indexesEnsured=false;constructor(e){this.db=e.db,this.adapter=e.adapter,this.prefix=e.collectionPrefix||"",this.sessionTTL=e.sessionTTL||86400,this.refreshTokenTTL=e.refreshTokenTTL||604800;}getDatabase(){let e=typeof this.db=="function"?this.db():this.db;if(!e&&this.adapter&&(this.adapter.db?e=this.adapter.db:this.adapter.client&&(this.adapter.db=this.adapter.client.db(this.adapter.database||"kyro_cms"),e=this.adapter.db)),!e)throw new Error("MongoDB database not initialized");return e}col(e){return this.getDatabase().collection(`${this.prefix}${e}`)}async connect(){this.adapter&&!this.adapter.connected&&await this.adapter.connect(),this.indexesEnsured||await this.ensureIndexes();}async disconnect(){}async ensureIndexes(){await this.col("users").createIndex({email:1},{unique:true}),await this.col("users").createIndex({tenantId:1}),await this.col("users").createIndex({role:1}),await this.col("sessions").createIndex({token:1},{unique:true}),await this.col("sessions").createIndex({refreshToken:1}),await this.col("sessions").createIndex({userId:1}),await this.col("sessions").createIndex({expiresAt:1},{expireAfterSeconds:0}),await this.col("audit_logs").createIndex({timestamp:-1}),await this.col("audit_logs").createIndex({userId:1}),await this.col("audit_logs").createIndex({action:1}),await this.col("audit_logs").createIndex({resource:1}),await this.col("password_history").createIndex({userId:1,createdAt:-1}),await this.col("lockouts").createIndex({userId:1},{unique:true}),await this.col("lockouts").createIndex({lockedUntil:1}),this.indexesEnsured=true;}async createUser(e){let s=randomUUID(),t=new Date,i=await this.hashPassword(e.password),r={_id:s,name:e.name||null,email:e.email.toLowerCase(),passwordHash:i,role:e.role||"customer",avatar:e.avatar||null,tenantId:e.tenantId||null,emailVerified:false,locked:false,lastLogin:null,failedLoginAttempts:0,createdAt:t,updatedAt:t};return await this.col("users").insertOne(r),this.docToAuthUser(r)}async findUserByEmail(e){let s=await this.col("users").findOne({email:e.toLowerCase()});return s?this.docToAuthUser(s):null}async findUserById(e){let s=await this.col("users").findOne({_id:e});return s?this.docToAuthUser(s):null}async updateUser(e,s){let t={updatedAt:new Date};s.name!==void 0&&(t.name=s.name),s.email!==void 0&&(t.email=s.email),s.passwordHash!==void 0&&(t.passwordHash=s.passwordHash),s.role!==void 0&&(t.role=s.role),s.avatar!==void 0&&(t.avatar=s.avatar),s.tenantId!==void 0&&(t.tenantId=s.tenantId),s.emailVerified!==void 0&&(t.emailVerified=s.emailVerified),s.locked!==void 0&&(t.locked=s.locked),s.lastLogin!==void 0&&(t.lastLogin=s.lastLogin?new Date(s.lastLogin):null),s.failedLoginAttempts!==void 0&&(t.failedLoginAttempts=s.failedLoginAttempts);let i=await this.col("users").findOneAndUpdate({_id:e},{$set:t},{returnDocument:"after"});return i?this.docToAuthUser(i):null}async deleteUser(e){return (await this.col("users").deleteOne({_id:e})).deletedCount>0}async verifyPassword(e,s){let t=await this.findUserByEmail(e);if(!t)return null;let i=await this.col("users").findOne({email:e.toLowerCase()},{projection:{passwordHash:1}});return i?.passwordHash&&await c.default.compare(s,i.passwordHash)?t:null}async hashPassword(e){return c.default.hash(e,12)}async createSession(e,s){let t=randomUUID(),i=randomBytes(32).toString("base64url"),r=randomBytes(32).toString("base64url"),o=new Date,u=new Date(o.getTime()+this.sessionTTL*1e3),d={_id:t,userId:e,token:i,refreshToken:r,ipAddress:s?.ipAddress||null,userAgent:s?.userAgent||null,expiresAt:u,createdAt:o};return await this.col("sessions").insertOne(d),this.docToSession(d)}async findSessionByToken(e){let s=await this.col("sessions").findOne({token:e,expiresAt:{$gt:new Date}});return s?this.docToSession(s):null}async findSessionByRefreshToken(e){let s=await this.col("sessions").findOne({refreshToken:e,expiresAt:{$gt:new Date}});return s?this.docToSession(s):null}async deleteSession(e){return (await this.col("sessions").deleteOne({_id:e})).deletedCount>0}async deleteUserSessions(e){return (await this.col("sessions").deleteMany({userId:e})).deletedCount}async hasAnyUsers(){return await this.col("users").countDocuments()>0}async addPasswordToHistory(e,s){await this.col("password_history").insertOne({userId:e,passwordHash:s,createdAt:new Date});}async getPasswordHistory(e,s=5){return (await this.col("password_history").find({userId:e}).sort({createdAt:-1}).limit(s).toArray()).map(i=>i.passwordHash)}async isPasswordInHistory(e,s,t=5){let i=await this.getPasswordHistory(s,t);for(let r of i)if(await c.default.compare(e,r))return true;return false}async findAuditLogs(e){let{limit:s=50,offset:t=0,userId:i,action:r,resource:o,resourceId:u,success:d,startDate:f,endDate:h}=e,a={};i&&(a.userId=i),r&&(Array.isArray(r)?a.action={$in:r}:a.action=r),o&&(a.resource=o),u&&(a.resourceId=u),d!==void 0&&(a.success=d),(f||h)&&(a.timestamp={},f&&(a.timestamp.$gte=f),h&&(a.timestamp.$lte=h));let w=await this.col("audit_logs").countDocuments(a);return {logs:(await this.col("audit_logs").find(a).sort({timestamp:-1}).skip(t).limit(s).toArray()).map(n=>({id:n._id,timestamp:n.timestamp,action:n.action,userId:n.userId||void 0,userEmail:n.userEmail||void 0,role:n.role||void 0,resource:n.resource,resourceId:n.resourceId||void 0,changes:n.changes||void 0,ipAddress:n.ipAddress||void 0,userAgent:n.userAgent||void 0,success:n.success,error:n.error||void 0,metadata:n.metadata||void 0})),total:w}}async createAuditLog(e){let s=randomUUID(),t=new Date;return await this.col("audit_logs").insertOne({_id:s,action:e.action,userId:e.userId||null,userEmail:e.userEmail||null,role:e.role||null,resource:e.resource,resourceId:e.resourceId||null,changes:e.changes||null,ipAddress:e.ipAddress||null,userAgent:e.userAgent||null,success:e.success,error:e.error||null,metadata:e.metadata||null,timestamp:t}),{...e,id:s,timestamp:t}}docToAuthUser(e){return {id:e._id,name:e.name||void 0,email:e.email,passwordHash:e.passwordHash||void 0,role:e.role,tenantId:e.tenantId||void 0,avatar:e.avatar||void 0,emailVerified:e.emailVerified||false,locked:e.locked||false,lastLogin:e.lastLogin?.toISOString?.()||e.lastLogin||void 0,failedLoginAttempts:e.failedLoginAttempts||0,createdAt:e.createdAt?.toISOString?.()||e.createdAt,updatedAt:e.updatedAt?.toISOString?.()||e.updatedAt}}docToSession(e){return {id:e._id,userId:e.userId,token:e.token,refreshToken:e.refreshToken||void 0,expiresAt:e.expiresAt?.toISOString?.()||e.expiresAt,createdAt:e.createdAt?.toISOString?.()||e.createdAt,ipAddress:e.ipAddress||void 0,userAgent:e.userAgent||void 0}}async createEmailVerificationToken(e){let s=randomBytes(32).toString("hex"),t=new Date(Date.now()+1440*60*1e3),i=await import('./lib-XXYYUPMW.js'),r=i.ObjectId??i.default?.ObjectId;return await this.db.collection("email_verifications").insertOne({userId:new r(e),token:s,expiresAt:t,createdAt:new Date}),{token:s,expiresAt:t}}async verifyEmailToken(e){let s=await this.db.collection("email_verifications").findOne({token:e});return s?s.expiresAt<new Date?{success:false,error:"Verification token has expired"}:(await this.db.collection("users").updateOne({_id:s.userId},{$set:{emailVerified:true}}),await this.db.collection("email_verifications").deleteOne({_id:s._id}),{success:true,userId:s.userId.toString()}):{success:false,error:"Invalid verification token"}}async createPasswordResetToken(e){let s=await this.findUserByEmail(e);if(!s)return {token:"",expiresAt:new Date,error:"User not found"};let t=randomBytes(32).toString("hex"),i=new Date(Date.now()+3600*1e3),r=await import('./lib-XXYYUPMW.js'),o=r.ObjectId??r.default?.ObjectId;return await this.db.collection("password_resets").insertOne({userId:new o(s.id),token:t,expiresAt:i,createdAt:new Date}),{token:t,expiresAt:i}}async resetPasswordWithToken(e,s){let t=await this.db.collection("password_resets").findOne({token:e});if(!t)return {success:false,error:"Invalid reset token"};if(t.expiresAt<new Date)return {success:false,error:"Reset token has expired"};if(t.usedAt)return {success:false,error:"Reset token has already been used"};let i=await this.hashPassword(s);return await this.db.collection("users").updateOne({_id:t.userId},{$set:{passwordHash:i,updatedAt:new Date}}),await this.db.collection("password_resets").updateOne({_id:t._id},{$set:{usedAt:new Date}}),await this.db.collection("sessions").deleteMany({userId:t.userId}),{success:true}}};export{g as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {d,g as g$2,h,f}from'./chunk-JV4HJBXW.js';import {c,a as a$1,d as d$1,e}from'./chunk-N5POANYV.js';import {i,k,j as j$1,l as l$1,Z}from'./chunk-HRAY65XH.js';import {U as U$1,a,R,X,c as c$1,A as A$1,i as i$1,N,l,t,S,j,J as J$1,V as V$1,T as T$1,H as H$1,n}from'./chunk-3NSZZCOJ.js';import {g as g$1}from'./chunk-Y2YAKDEQ.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
2
|
g$1();g$1();g$1();function g(o){return c$1(o,d)?[`${o[t.Symbol.BaseName]}`]:c$1(o,i$1)?o._.usedTables??[]:c$1(o,A$1)?o.usedTables??[]:[]}var T=class extends i{constructor(e,t,i,s){super(),this.table=e,this.session=t,this.dialect=i,this.config={table:e,withList:s};}static[a]="SQLiteDelete";config;where(e){return this.config.where=e,this}orderBy(...e){if(typeof e[0]=="function"){let t$1=e[0](new Proxy(this.config.table[t.Symbol.Columns],new a$1({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(t$1)?t$1:[t$1];this.config.orderBy=i;}else {let t=e;this.config.orderBy=t;}return this}limit(e){return this.config.limit=e,this}returning(e=this.table[d.Symbol.Columns]){return this.config.returning=R(e),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e=true){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",true,void 0,{type:"delete",tables:g(this.config.table)})}prepare(){return this._prepare(false)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(e){return this._prepare().execute(e)}$dynamic(){return this}};g$1();g$1();g$1();var y=class{static[a]="SQLiteSelectBuilder";fields;session;dialect;withList;distinct;constructor(e){this.fields=e.fields,this.session=e.session,this.dialect=e.dialect,this.withList=e.withList,this.distinct=e.distinct;}from(e){let t=!!this.fields,i;return this.fields?i=this.fields:c$1(e,i$1)?i=Object.fromEntries(Object.keys(e._.selectedFields).map(s=>[s,e[s]])):c$1(e,f)?i=e[l].selectedFields:c$1(e,A$1)?i={}:i=V$1(e),new P({table:e,fields:i,isPartialSelect:t,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct})}},U=class extends c{static[a]="SQLiteSelectQueryBuilder";_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;cacheConfig=void 0;usedTables=new Set;constructor({table:e,fields:t,isPartialSelect:i,session:s,dialect:r,withList:n,distinct:f}){super(),this.config={withList:n,table:e,fields:{...t},distinct:f,setOperators:[]},this.isPartialSelect=i,this.session=s,this.dialect=r,this._={selectedFields:t,config:this.config},this.tableName=X(e),this.joinsNotNullableMap=typeof this.tableName=="string"?{[this.tableName]:true}:{};for(let d of g(e))this.usedTables.add(d);}getUsedTables(){return [...this.usedTables]}createJoin(e){return (t$1,i)=>{let s=this.tableName,r=X(t$1);for(let n of g(t$1))this.usedTables.add(n);if(typeof r=="string"&&this.config.joins?.some(n=>n.alias===r))throw new Error(`Alias "${r}" is already used in this query`);if(!this.isPartialSelect&&(Object.keys(this.joinsNotNullableMap).length===1&&typeof s=="string"&&(this.config.fields={[s]:this.config.fields}),typeof r=="string"&&!c$1(t$1,A$1))){let n=c$1(t$1,i$1)?t$1._.selectedFields:c$1(t$1,N)?t$1[l].selectedFields:t$1[t.Symbol.Columns];this.config.fields[r]=n;}if(typeof i=="function"&&(i=i(new Proxy(this.config.fields,new a$1({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.joins||(this.config.joins=[]),this.config.joins.push({on:i,table:t$1,joinType:e,alias:r}),typeof r=="string")switch(e){case "left":{this.joinsNotNullableMap[r]=false;break}case "right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([n])=>[n,false])),this.joinsNotNullableMap[r]=true;break}case "cross":case "inner":{this.joinsNotNullableMap[r]=true;break}case "full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([n])=>[n,false])),this.joinsNotNullableMap[r]=false;break}}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");crossJoin=this.createJoin("cross");createSetOperator(e,t){return i=>{let s=typeof i=="function"?i(ce()):i;if(!S(this.getSelectedFields(),s.getSelectedFields()))throw new Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return this.config.setOperators.push({type:e,isAll:t,rightSelect:s}),this}}union=this.createSetOperator("union",false);unionAll=this.createSetOperator("union",true);intersect=this.createSetOperator("intersect",false);except=this.createSetOperator("except",false);addSetOperators(e){return this.config.setOperators.push(...e),this}where(e){return typeof e=="function"&&(e=e(new Proxy(this.config.fields,new a$1({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.where=e,this}having(e){return typeof e=="function"&&(e=e(new Proxy(this.config.fields,new a$1({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.having=e,this}groupBy(...e){if(typeof e[0]=="function"){let t=e[0](new Proxy(this.config.fields,new a$1({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(t)?t:[t];}else this.config.groupBy=e;return this}orderBy(...e){if(typeof e[0]=="function"){let t=e[0](new Proxy(this.config.fields,new a$1({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(t)?t:[t];this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=i:this.config.orderBy=i;}else {let t=e;this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=t:this.config.orderBy=t;}return this}limit(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).limit=e:this.config.limit=e,this}offset(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).offset=e:this.config.offset=e,this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}as(e){let t=[];if(t.push(...g(this.config.table)),this.config.joins)for(let i of this.config.joins)t.push(...g(i.table));return new Proxy(new i$1(this.getSQL(),this.config.fields,e,false,[...new Set(t)]),new a$1({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new a$1({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}},P=class extends U{static[a]="SQLiteSelect";_prepare(e=true){if(!this.session)throw new Error("Cannot execute a query on a query builder. Please use a database instance instead.");let t=R(this.config.fields),i=this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),t,"all",true,void 0,{type:"select",tables:[...this.usedTables]},this.cacheConfig);return i.joinsNotNullableMap=this.joinsNotNullableMap,i}$withCache(e){return this.cacheConfig=e===void 0?{config:{},enable:true,autoInvalidate:true}:e===false?{enable:false}:{enable:true,autoInvalidate:true,...e},this}prepare(){return this._prepare(false)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(){return this.all()}};U$1(P,[i]);function F(o,e){return (t,i,...s)=>{let r=[i,...s].map(n=>({type:o,isAll:e,rightSelect:n}));for(let n of r)if(!S(t.getSelectedFields(),n.rightSelect.getSelectedFields()))throw new Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return t.addSetOperators(r)}}var ce=()=>({union:ue,unionAll:fe,intersect:de,except:pe}),ue=F("union",false),fe=F("union",true),de=F("intersect",false),pe=F("except",false);var q=class{static[a]="SQLiteQueryBuilder";dialect;dialectConfig;constructor(e){this.dialect=c$1(e,g$2)?e:void 0,this.dialectConfig=c$1(e,g$2)?void 0:e;}$with=(e,t)=>{let i=this;return {as:r=>(typeof r=="function"&&(r=r(i)),new Proxy(new j(r.getSQL(),t??("getSelectedFields"in r?r.getSelectedFields()??{}:{}),e,true),new a$1({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"})))}};with(...e){let t=this;function i(r){return new y({fields:r??void 0,session:void 0,dialect:t.getDialect(),withList:e})}function s(r){return new y({fields:r??void 0,session:void 0,dialect:t.getDialect(),withList:e,distinct:true})}return {select:i,selectDistinct:s}}select(e){return new y({fields:e??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct(e){return new y({fields:e??void 0,session:void 0,dialect:this.getDialect(),distinct:true})}getDialect(){return this.dialect||(this.dialect=new h(this.dialectConfig)),this.dialect}};var A=class{constructor(e,t,i,s){this.table=e,this.session=t,this.dialect=i,this.withList=s;}static[a]="SQLiteInsertBuilder";values(e){if(e=Array.isArray(e)?e:[e],e.length===0)throw new Error("values() must be called with at least one value");let t$1=e.map(i=>{let s={},r=this.table[t.Symbol.Columns];for(let n of Object.keys(i)){let f=i[n];s[n]=c$1(f,A$1)?f:new H$1(f,r[n]);}return s});return new E(this.table,t$1,this.session,this.dialect,this.withList)}select(e){let t=typeof e=="function"?e(new q):e;if(!c$1(t,A$1)&&!S(this.table[n],t._.selectedFields))throw new Error("Insert select error: selected fields are not the same or are in a different order compared to the table definition");return new E(this.table,t,this.session,this.dialect,this.withList,true)}},E=class extends i{constructor(e,t,i,s,r,n){super(),this.session=i,this.dialect=s,this.config={table:e,values:t,withList:r,select:n};}static[a]="SQLiteInsert";config;returning(e=this.config.table[d.Symbol.Columns]){return this.config.returning=R(e),this}onConflictDoNothing(e={}){if(this.config.onConflict||(this.config.onConflict=[]),e.target===void 0)this.config.onConflict.push(J$1` on conflict do nothing`);else {let t=Array.isArray(e.target)?J$1`${e.target}`:J$1`${[e.target]}`,i=e.where?J$1` where ${e.where}`:J$1``;this.config.onConflict.push(J$1` on conflict ${t} do nothing${i}`);}return this}onConflictDoUpdate(e){if(e.where&&(e.targetWhere||e.setWhere))throw new Error('You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.');this.config.onConflict||(this.config.onConflict=[]);let t=e.where?J$1` where ${e.where}`:void 0,i=e.targetWhere?J$1` where ${e.targetWhere}`:void 0,s=e.setWhere?J$1` where ${e.setWhere}`:void 0,r=Array.isArray(e.target)?J$1`${e.target}`:J$1`${[e.target]}`,n=this.dialect.buildUpdateSet(this.config.table,T$1(this.config.table,e.set));return this.config.onConflict.push(J$1` on conflict ${r}${i} do update set ${n}${t}${s}`),this}getSQL(){return this.dialect.buildInsertQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e=true){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",true,void 0,{type:"insert",tables:g(this.config.table)})}prepare(){return this._prepare(false)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(){return this.config.returning?this.all():this.run()}$dynamic(){return this}};g$1();var M=class{constructor(e,t,i,s){this.table=e,this.session=t,this.dialect=i,this.withList=s;}static[a]="SQLiteUpdateBuilder";set(e){return new I(this.table,T$1(this.table,e),this.session,this.dialect,this.withList)}},I=class extends i{constructor(e,t,i,s,r){super(),this.session=i,this.dialect=s,this.config={set:t,table:e,withList:r,joins:[]};}static[a]="SQLiteUpdate";config;from(e){return this.config.from=e,this}createJoin(e){return (t$1,i)=>{let s=X(t$1);if(typeof s=="string"&&this.config.joins.some(r=>r.alias===s))throw new Error(`Alias "${s}" is already used in this query`);if(typeof i=="function"){let r=this.config.from?c$1(t$1,d)?t$1[t.Symbol.Columns]:c$1(t$1,i$1)?t$1._.selectedFields:c$1(t$1,f)?t$1[l].selectedFields:void 0:void 0;i=i(new Proxy(this.config.table[t.Symbol.Columns],new a$1({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})),r&&new Proxy(r,new a$1({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));}return this.config.joins.push({on:i,table:t$1,joinType:e,alias:s}),this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");where(e){return this.config.where=e,this}orderBy(...e){if(typeof e[0]=="function"){let t$1=e[0](new Proxy(this.config.table[t.Symbol.Columns],new a$1({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(t$1)?t$1:[t$1];this.config.orderBy=i;}else {let t=e;this.config.orderBy=t;}return this}limit(e){return this.config.limit=e,this}returning(e=this.config.table[d.Symbol.Columns]){return this.config.returning=R(e),this}getSQL(){return this.dialect.buildUpdateQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e=true){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",true,void 0,{type:"insert",tables:g(this.config.table)})}prepare(){return this._prepare(false)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(){return this.config.returning?this.all():this.run()}$dynamic(){return this}};g$1();var K=class o extends A$1{constructor(e){super(o.buildEmbeddedCount(e.source,e.filters).queryChunks),this.params=e,this.session=e.session,this.sql=o.buildCount(e.source,e.filters);}sql;static[a]="SQLiteCountBuilderAsync";[Symbol.toStringTag]="SQLiteCountBuilderAsync";session;static buildEmbeddedCount(e,t){return J$1`(select count(*) from ${e}${J$1.raw(" where ").if(t)}${t})`}static buildCount(e,t){return J$1`select count(*) from ${e}${J$1.raw(" where ").if(t)}${t}`}then(e,t){return Promise.resolve(this.session.count(this.sql)).then(e,t)}catch(e){return this.then(void 0,e)}finally(e){return this.then(t=>(e?.(),t),t=>{throw e?.(),t})}};g$1();var D=class{constructor(e,t,i,s,r,n,f,d){this.mode=e,this.fullSchema=t,this.schema=i,this.tableNamesMap=s,this.table=r,this.tableConfig=n,this.dialect=f,this.session=d;}static[a]="SQLiteAsyncRelationalQueryBuilder";findMany(e){return this.mode==="sync"?new J(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e||{},"many"):new O(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e||{},"many")}findFirst(e){return this.mode==="sync"?new J(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e?{...e,limit:1}:{limit:1},"first"):new O(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e?{...e,limit:1}:{limit:1},"first")}},O=class extends i{constructor(e,t,i,s,r,n,f,d,he){super(),this.fullSchema=e,this.schema=t,this.tableNamesMap=i,this.table=s,this.tableConfig=r,this.dialect=n,this.session=f,this.config=d,this.mode=he;}static[a]="SQLiteAsyncRelationalQuery";mode;getSQL(){return this.dialect.buildRelationalQuery({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName}).sql}_prepare(e=false){let{query:t,builtQuery:i}=this._toSQL();return this.session[e?"prepareOneTimeQuery":"prepareQuery"](i,void 0,this.mode==="first"?"get":"all",true,(s,r)=>{let n=s.map(f=>Z(this.schema,this.tableConfig,f,t.selection,r));return this.mode==="first"?n[0]:n})}prepare(){return this._prepare(false)}_toSQL(){let e=this.dialect.buildRelationalQuery({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName}),t=this.dialect.sqlToQuery(e.sql);return {query:e,builtQuery:t}}toSQL(){return this._toSQL().builtQuery}executeRaw(){return this.mode==="first"?this._prepare(false).get():this._prepare(false).all()}async execute(){return this.executeRaw()}},J=class extends O{static[a]="SQLiteSyncRelationalQuery";sync(){return this.executeRaw()}};g$1();var C=class extends i{constructor(e,t,i,s,r){super(),this.execute=e,this.getSQL=t,this.dialect=s,this.mapBatchResult=r,this.config={action:i};}static[a]="SQLiteRaw";config;getQuery(){return {...this.dialect.sqlToQuery(this.getSQL()),method:this.config.action}}mapResult(e,t){return t?this.mapBatchResult(e):e}_prepare(){return this}isResponseInArrayMode(){return false}};var V=class{constructor(e,t,i,s){this.resultKind=e,this.dialect=t,this.session=i,this._=s?{schema:s.schema,fullSchema:s.fullSchema,tableNamesMap:s.tableNamesMap}:{schema:void 0,fullSchema:{},tableNamesMap:{}},this.query={};let r=this.query;if(this._.schema)for(let[n,f]of Object.entries(this._.schema))r[n]=new D(e,s.fullSchema,this._.schema,this._.tableNamesMap,s.fullSchema[n],f,t,i);this.$cache={invalidate:async n=>{}};}static[a]="BaseSQLiteDatabase";query;$with=(e,t)=>{let i=this;return {as:r=>(typeof r=="function"&&(r=r(new q(i.dialect))),new Proxy(new j(r.getSQL(),t??("getSelectedFields"in r?r.getSelectedFields()??{}:{}),e,true),new a$1({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"})))}};$count(e,t){return new K({source:e,filters:t,session:this.session})}with(...e){let t=this;function i(d){return new y({fields:d??void 0,session:t.session,dialect:t.dialect,withList:e})}function s(d){return new y({fields:d??void 0,session:t.session,dialect:t.dialect,withList:e,distinct:true})}function r(d){return new M(d,t.session,t.dialect,e)}function n(d){return new A(d,t.session,t.dialect,e)}function f(d){return new T(d,t.session,t.dialect,e)}return {select:i,selectDistinct:s,update:r,insert:n,delete:f}}select(e){return new y({fields:e??void 0,session:this.session,dialect:this.dialect})}selectDistinct(e){return new y({fields:e??void 0,session:this.session,dialect:this.dialect,distinct:true})}update(e){return new M(e,this.session,this.dialect)}$cache;insert(e){return new A(e,this.session,this.dialect)}delete(e){return new T(e,this.session,this.dialect)}run(e){let t=typeof e=="string"?J$1.raw(e):e.getSQL();return this.resultKind==="async"?new C(async()=>this.session.run(t),()=>t,"run",this.dialect,this.session.extractRawRunValueFromBatchResult.bind(this.session)):this.session.run(t)}all(e){let t=typeof e=="string"?J$1.raw(e):e.getSQL();return this.resultKind==="async"?new C(async()=>this.session.all(t),()=>t,"all",this.dialect,this.session.extractRawAllValueFromBatchResult.bind(this.session)):this.session.all(t)}get(e){let t=typeof e=="string"?J$1.raw(e):e.getSQL();return this.resultKind==="async"?new C(async()=>this.session.get(t),()=>t,"get",this.dialect,this.session.extractRawGetValueFromBatchResult.bind(this.session)):this.session.get(t)}values(e){let t=typeof e=="string"?J$1.raw(e):e.getSQL();return this.resultKind==="async"?new C(async()=>this.session.values(t),()=>t,"values",this.dialect,this.session.extractRawValuesValueFromBatchResult.bind(this.session)):this.session.values(t)}transaction(e,t){return this.session.transaction(e,t)}};g$1();var H=class extends i{constructor(e){super(),this.resultCb=e;}static[a]="ExecuteResultSync";async execute(){return this.resultCb()}sync(){return this.resultCb()}},oe=class{constructor(e,t,i,s,r,n){this.mode=e,this.executeMethod=t,this.query=i,this.cache=s,this.queryMetadata=r,this.cacheConfig=n,s&&s.strategy()==="all"&&n===void 0&&(this.cacheConfig={enable:true,autoInvalidate:true}),this.cacheConfig?.enable||(this.cacheConfig=void 0);}static[a]="PreparedQuery";joinsNotNullableMap;async queryWithCache(e$1,t,i){if(this.cache===void 0||c$1(this.cache,d$1)||this.queryMetadata===void 0)try{return await i()}catch(s){throw new k(e$1,t,s)}if(this.cacheConfig&&!this.cacheConfig.enable)try{return await i()}catch(s){throw new k(e$1,t,s)}if((this.queryMetadata.type==="insert"||this.queryMetadata.type==="update"||this.queryMetadata.type==="delete")&&this.queryMetadata.tables.length>0)try{let[s]=await Promise.all([i(),this.cache.onMutate({tables:this.queryMetadata.tables})]);return s}catch(s){throw new k(e$1,t,s)}if(!this.cacheConfig)try{return await i()}catch(s){throw new k(e$1,t,s)}if(this.queryMetadata.type==="select"){let s=await this.cache.get(this.cacheConfig.tag??await e(e$1,t),this.queryMetadata.tables,this.cacheConfig.tag!==void 0,this.cacheConfig.autoInvalidate);if(s===void 0){let r;try{r=await i();}catch(n){throw new k(e$1,t,n)}return await this.cache.put(this.cacheConfig.tag??await e(e$1,t),r,this.cacheConfig.autoInvalidate?this.queryMetadata.tables:[],this.cacheConfig.tag!==void 0,this.cacheConfig.config),r}return s}try{return await i()}catch(s){throw new k(e$1,t,s)}}getQuery(){return this.query}mapRunResult(e,t){return e}mapAllResult(e,t){throw new Error("Not implemented")}mapGetResult(e,t){throw new Error("Not implemented")}execute(e){return this.mode==="async"?this[this.executeMethod](e):new H(()=>this[this.executeMethod](e))}mapResult(e,t){switch(this.executeMethod){case "run":return this.mapRunResult(e,t);case "all":return this.mapAllResult(e,t);case "get":return this.mapGetResult(e,t)}}},ae=class{constructor(e){this.dialect=e;}static[a]="SQLiteSession";prepareOneTimeQuery(e,t,i,s,r,n,f){return this.prepareQuery(e,t,i,s,r,n,f)}run(e){let t=this.dialect.sqlToQuery(e);try{return this.prepareOneTimeQuery(t,void 0,"run",!1).run()}catch(i){throw new j$1({cause:i,message:`Failed to run the query '${t.sql}'`})}}extractRawRunValueFromBatchResult(e){return e}all(e){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(e),void 0,"run",false).all()}extractRawAllValueFromBatchResult(e){throw new Error("Not implemented")}get(e){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(e),void 0,"run",false).get()}extractRawGetValueFromBatchResult(e){throw new Error("Not implemented")}values(e){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(e),void 0,"run",false).values()}async count(e){return (await this.values(e))[0][0]}extractRawValuesValueFromBatchResult(e){throw new Error("Not implemented")}},le=class extends V{constructor(e,t,i,s,r=0){super(e,t,i,s),this.schema=s,this.nestedIndex=r;}static[a]="SQLiteTransaction";rollback(){throw new l$1}};export{V as a,oe as b,ae as c,le as d};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {g}from'./chunk-Y2YAKDEQ.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
|
+
g();function o(e){if(e==null)return e;if(Array.isArray(e))return e.map(n=>o(n));if(typeof e=="object"&&!(e instanceof Date)&&!(e instanceof RegExp)){let n={};for(let r of Object.keys(e))/^\d+$/.test(r)||(n[r]=o(e[r]));return n}return e}export{o as a};
|