@shumai-one/shumai 0.3.2 → 0.3.3

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.
Files changed (185) hide show
  1. package/bin/{chunk-dwswqq3g.js → chunk-0a0sdyta.js} +1 -1
  2. package/bin/{chunk-qmtvy2j4.js → chunk-0dcv6kpk.js} +2 -2
  3. package/bin/chunk-1cjgpspz.js +2 -0
  4. package/bin/chunk-1pgtq4rc.js +2 -0
  5. package/bin/chunk-1rsp4hc5.js +1 -0
  6. package/bin/{chunk-7eycsyk6.js → chunk-2475z7vk.js} +1 -1
  7. package/bin/chunk-25qj10ny.js +1 -0
  8. package/bin/{chunk-gn8snrnk.js → chunk-2fc5hk8r.js} +1 -1
  9. package/bin/{chunk-qc6dmzn0.js → chunk-2jvqhps9.js} +2 -2
  10. package/bin/{chunk-ve7v8wtv.js → chunk-3823qzr0.js} +2 -2
  11. package/bin/{chunk-zxpef55w.js → chunk-3g9g2c7h.js} +3 -3
  12. package/bin/chunk-3gcnj1eq.js +2 -0
  13. package/bin/chunk-41m51y08.js +2 -0
  14. package/bin/chunk-4g7h9qhr.js +8 -0
  15. package/bin/chunk-4v5ykazp.js +1 -0
  16. package/bin/{chunk-k20bhxed.js → chunk-525eypdk.js} +1 -1
  17. package/bin/{chunk-h2wsm7h3.js → chunk-57kgmgfs.js} +2 -2
  18. package/bin/{chunk-gvn079hy.js → chunk-5cm4vge8.js} +2 -2
  19. package/bin/{chunk-31mjcykb.js → chunk-5vwkfxy7.js} +2 -2
  20. package/bin/chunk-5x3vzer8.js +1 -0
  21. package/bin/chunk-67rr836p.js +3 -0
  22. package/bin/chunk-6jgq154r.js +2 -0
  23. package/bin/chunk-7436fyrg.js +2 -0
  24. package/bin/{chunk-s05f0v9t.js → chunk-749c09cw.js} +1 -1
  25. package/bin/{chunk-9p2d0mk1.js → chunk-7anqxx1z.js} +1 -1
  26. package/bin/{chunk-s7qpj715.js → chunk-7pjes19z.js} +2 -2
  27. package/bin/{chunk-f8cn9m28.js → chunk-7x7jtkh8.js} +1 -1
  28. package/bin/chunk-804ndet8.js +2 -0
  29. package/bin/chunk-8a75zqbz.js +2 -0
  30. package/bin/{chunk-tsncwscz.js → chunk-9a7a1p1j.js} +2 -2
  31. package/bin/chunk-9e99n265.js +12 -0
  32. package/bin/chunk-9g6vy76b.js +2 -0
  33. package/bin/{chunk-wap08p4j.js → chunk-9sdhdhv4.js} +2 -2
  34. package/bin/{chunk-g2dk56e7.js → chunk-9vgjhemh.js} +1 -1
  35. package/bin/{chunk-1dawjfk8.js → chunk-9zvteyz0.js} +2 -2
  36. package/bin/chunk-a8daqpfh.js +7 -0
  37. package/bin/{chunk-na2nympm.js → chunk-am1m29pv.js} +1 -1
  38. package/bin/{chunk-xawwxdq9.js → chunk-bd6x5ns9.js} +2 -2
  39. package/bin/{chunk-wr5byz6r.js → chunk-bn4ewsy8.js} +1 -1
  40. package/bin/{chunk-ss45w8ks.js → chunk-bw6wyw7k.js} +2 -2
  41. package/bin/{chunk-8e5zvy88.js → chunk-c0c88nje.js} +48 -48
  42. package/bin/chunk-c7rj0f5r.js +3 -0
  43. package/bin/chunk-cdqvg03f.js +3 -0
  44. package/bin/{chunk-zs9b0f3z.js → chunk-d3kpqay2.js} +2 -2
  45. package/bin/chunk-d6v81kjj.js +1 -0
  46. package/bin/chunk-dfcrtdk2.js +1 -0
  47. package/bin/chunk-eczsk2xd.js +62 -0
  48. package/bin/{chunk-yahb7wan.js → chunk-ey7vty63.js} +2 -2
  49. package/bin/{chunk-nzy3pjjm.js → chunk-fwqpq2sy.js} +2 -2
  50. package/bin/{chunk-vnfmh5ke.js → chunk-g097058z.js} +2 -2
  51. package/bin/{chunk-a76c5r3c.js → chunk-g224r7mc.js} +2 -2
  52. package/bin/chunk-g5e93f59.js +2 -0
  53. package/bin/chunk-g5xkj9p3.js +2 -0
  54. package/bin/chunk-gaemak59.js +4 -0
  55. package/bin/{chunk-hrzm70wg.js → chunk-gh4w2bdg.js} +1 -1
  56. package/bin/chunk-gpeyctxd.js +2 -0
  57. package/bin/{chunk-v2kfr8fx.js → chunk-gpmaaca1.js} +2 -2
  58. package/bin/{chunk-1d22tysv.js → chunk-h4a3ms2b.js} +2 -2
  59. package/bin/chunk-h73653yp.js +1 -0
  60. package/bin/chunk-hp139z0j.js +2 -0
  61. package/bin/chunk-hz6s7by4.js +11 -0
  62. package/bin/chunk-j4y8c864.js +1 -0
  63. package/bin/chunk-jkh04dka.js +8 -0
  64. package/bin/chunk-m268vcdm.js +2 -0
  65. package/bin/{chunk-vy24ncn2.js → chunk-m6sssvg3.js} +1 -1
  66. package/bin/chunk-mggfc9ya.js +2 -0
  67. package/bin/chunk-mhwp74hh.js +3 -0
  68. package/bin/{chunk-vgb8bzcg.js → chunk-mm810jv7.js} +2 -2
  69. package/bin/chunk-p1bcbtmg.js +3 -0
  70. package/bin/chunk-p86w1eaw.js +45 -0
  71. package/bin/{chunk-1nh6xgek.js → chunk-p8enen2a.js} +1 -1
  72. package/bin/chunk-pbb1tdwt.js +1 -0
  73. package/bin/chunk-pbfkw90e.js +1 -0
  74. package/bin/chunk-pdajhyqm.js +2 -0
  75. package/bin/{chunk-ph3e1bpp.js → chunk-pqxh0cg7.js} +2 -2
  76. package/bin/chunk-q8me9zev.js +1 -0
  77. package/bin/chunk-qshm5vcn.js +2 -0
  78. package/bin/chunk-qx2mzv89.js +2 -0
  79. package/bin/{chunk-amsb41z5.js → chunk-r5jmnsqj.js} +1 -1
  80. package/bin/{chunk-arpna31w.js → chunk-rt0pvhdf.js} +1 -1
  81. package/bin/{chunk-kgb16ggd.css → chunk-s10v4b01.css} +1 -1
  82. package/bin/{chunk-rrxjvewm.js → chunk-s1b5kf34.js} +2 -2
  83. package/bin/{chunk-ws07a9kv.js → chunk-t15a1vp6.js} +1 -1
  84. package/bin/{chunk-3rcc5s99.js → chunk-tc7q988r.js} +2 -2
  85. package/bin/chunk-ts9f4zqh.js +5 -0
  86. package/bin/chunk-tzmzqmcg.js +7 -0
  87. package/bin/chunk-v0xbr5e6.js +2 -0
  88. package/bin/{chunk-08mxv0sm.js → chunk-v0yhkcj5.js} +2 -2
  89. package/bin/{chunk-3t7mjvdv.js → chunk-v75fanse.js} +2 -2
  90. package/bin/chunk-va6hxm7n.js +3 -0
  91. package/bin/chunk-vf3bg920.js +3 -0
  92. package/bin/{chunk-ejfmxjw6.js → chunk-vg6mkdj1.js} +2 -2
  93. package/bin/{chunk-j0p1peav.js → chunk-wkth5xwr.js} +2 -2
  94. package/bin/chunk-wpntb95k.js +2 -0
  95. package/bin/{chunk-mahxw48e.js → chunk-wtzkfwmx.js} +2 -2
  96. package/bin/{chunk-hfp4hpca.js → chunk-x0r8dcq0.js} +2 -2
  97. package/bin/{chunk-etces6ff.js → chunk-xcbb21j9.js} +2 -2
  98. package/bin/{chunk-mcxsk75h.js → chunk-xgb533n0.js} +3 -3
  99. package/bin/{chunk-7jjc175m.js → chunk-xn9cpax1.js} +3 -3
  100. package/bin/{chunk-5vqan9c4.js → chunk-xsw3pb5p.js} +2 -2
  101. package/bin/chunk-yedr4r8a.js +2 -0
  102. package/bin/chunk-yfjn4qn2.js +1 -0
  103. package/bin/chunk-yfkcv10v.js +2 -0
  104. package/bin/{chunk-20y3wte3.js → chunk-yj6tmjsc.js} +2 -2
  105. package/bin/chunk-z9560a6e.js +1 -0
  106. package/bin/chunk-zgsy3k3h.js +3 -0
  107. package/bin/shumai-app.html +1 -1
  108. package/bin/shumai-app.js +375 -338
  109. package/package.json +7 -7
  110. package/prisma/migrations/20260801065040_add_audit_log/migration.sql +33 -0
  111. package/prisma/migrations/20260805021613_add_asset_autofill_context/migration.sql +2 -0
  112. package/prisma/schema.prisma +25 -0
  113. package/bin/chunk-08dr94gp.js +0 -2
  114. package/bin/chunk-0t4z17qr.js +0 -2
  115. package/bin/chunk-2ynx0den.js +0 -8
  116. package/bin/chunk-31a3k77j.js +0 -2
  117. package/bin/chunk-3jdef7n4.js +0 -6
  118. package/bin/chunk-4ahve1nf.js +0 -2
  119. package/bin/chunk-4hdnrwh1.js +0 -1
  120. package/bin/chunk-4hdx2tv0.js +0 -2
  121. package/bin/chunk-4htdb0xp.js +0 -1
  122. package/bin/chunk-4p7xpfey.js +0 -2
  123. package/bin/chunk-5f81c951.js +0 -1
  124. package/bin/chunk-5zntjzxw.js +0 -3
  125. package/bin/chunk-6a2eb3b5.js +0 -3
  126. package/bin/chunk-6t3gdd7e.js +0 -2
  127. package/bin/chunk-7d5kep8c.js +0 -2
  128. package/bin/chunk-7kzqkp5z.js +0 -1
  129. package/bin/chunk-7sh6409h.js +0 -1
  130. package/bin/chunk-7y8dng8t.js +0 -2
  131. package/bin/chunk-8m6zg15c.js +0 -4
  132. package/bin/chunk-8qyke29r.js +0 -7
  133. package/bin/chunk-90et6bwm.js +0 -3
  134. package/bin/chunk-9c7fxjej.js +0 -2
  135. package/bin/chunk-a10tf0d8.js +0 -3
  136. package/bin/chunk-b10meywb.js +0 -2
  137. package/bin/chunk-b1e3tec3.js +0 -62
  138. package/bin/chunk-bdjhb77e.js +0 -2
  139. package/bin/chunk-beay9amy.js +0 -1
  140. package/bin/chunk-c3fvs0bv.js +0 -4
  141. package/bin/chunk-c5my1b3k.js +0 -7
  142. package/bin/chunk-d3s00sn0.js +0 -2
  143. package/bin/chunk-dhekxndw.js +0 -3
  144. package/bin/chunk-dwaj1yn4.js +0 -2
  145. package/bin/chunk-er1rb6yj.js +0 -1
  146. package/bin/chunk-etqpzc9e.js +0 -3
  147. package/bin/chunk-fdpjw17x.js +0 -7
  148. package/bin/chunk-gqh4ttjh.js +0 -3
  149. package/bin/chunk-hz31j0hk.js +0 -4
  150. package/bin/chunk-jm6bxtzt.js +0 -41
  151. package/bin/chunk-jstc7pka.js +0 -2
  152. package/bin/chunk-k0a35mg9.js +0 -2
  153. package/bin/chunk-k9w6mk9d.js +0 -3
  154. package/bin/chunk-m4py21f3.js +0 -2
  155. package/bin/chunk-mm1j72a8.js +0 -7
  156. package/bin/chunk-nr89225z.js +0 -2
  157. package/bin/chunk-nrf5r23d.js +0 -1
  158. package/bin/chunk-nt9tfjx6.js +0 -12
  159. package/bin/chunk-p396vw9h.js +0 -8
  160. package/bin/chunk-p9xfyqh1.js +0 -2
  161. package/bin/chunk-pj0fgb2x.js +0 -6
  162. package/bin/chunk-pp072ksj.js +0 -2
  163. package/bin/chunk-q5cdjzbv.js +0 -3
  164. package/bin/chunk-qn96vbke.js +0 -2
  165. package/bin/chunk-qvgc9e08.js +0 -3
  166. package/bin/chunk-s5rfya1p.js +0 -1
  167. package/bin/chunk-scsy69bp.js +0 -1
  168. package/bin/chunk-sf6fwvrs.js +0 -8
  169. package/bin/chunk-t2txvzkp.js +0 -3
  170. package/bin/chunk-td54rdfj.js +0 -8
  171. package/bin/chunk-vb9m47z9.js +0 -1
  172. package/bin/chunk-vf066xwh.js +0 -3
  173. package/bin/chunk-w3a50kz8.js +0 -3
  174. package/bin/chunk-w9w5301f.js +0 -4
  175. package/bin/chunk-wny0qagx.js +0 -3
  176. package/bin/chunk-wqhk76de.js +0 -14
  177. package/bin/chunk-wrz9e73c.js +0 -2
  178. package/bin/chunk-x5dcgk62.js +0 -6
  179. package/bin/chunk-xwmsxg5x.js +0 -1
  180. package/bin/chunk-y2nw8rbx.js +0 -4
  181. package/bin/chunk-y9ttm07y.js +0 -3
  182. package/bin/chunk-z0ej44ak.js +0 -3
  183. package/bin/chunk-zemgtnk0.js +0 -1
  184. package/bin/chunk-zg0vm233.js +0 -2
  185. package/bin/chunk-zhd2mkbr.js +0 -1
@@ -0,0 +1,2 @@
1
+ import{gg as e}from"./chunk-9a7a1p1j.js";import{Ag as T,nj as v,tj as U}from"./chunk-eczsk2xd.js";var u={human:"human",agent:"agent"};var l={editor:"editor",reviewer:"reviewer"};var x={team:"team",project:"project"};var h={chat:"chat",autofill:"autofill",embedding:"embedding"};var n=e.object({cursor:e.string().optional(),total:e.number().optional(),totalSize:e.number().optional()}),r=e.object({first:e.coerce.number().optional(),after:e.string().optional()});var le=e.object({name:e.string()}),w=e.object({id:e.string(),name:e.string(),rootFolder:e.string().optional(),updatedAt:e.union([e.string(),e.date()])});var me=e.object({data:e.array(w),pageInfo:n}),fe=e.object({teamId:e.string(),userId:e.string()}),de=e.object({id:e.string(),name:e.string(),email:e.string().optional(),role:e.enum(["owner","editor","reviewer","bot","unknown"]),image:e.string().optional(),unreadNotificationCount:e.number().optional()}),ge=e.object({name:e.string().optional(),imageKey:e.string().nullable().optional()}),ye=e.object({id:e.string(),name:e.string(),role:e.enum(["owner","editor","reviewer","bot","unknown"]),email:e.string().optional(),type:e.nativeEnum(u).optional(),image:e.string().optional(),scope:e.nativeEnum(x).optional()}),ue=e.object({includeAgents:e.string().optional().transform((o)=>o==="true")}),C={best_match:"best_match",all:"all"},xe=e.union([e.object({key:e.literal("transcode.videoStrategy"),value:e.nativeEnum(C)})]),he=e.object({allowedDomains:e.array(e.string()),pendingDomains:e.array(e.string()).default([])});var Se=e.object({role:e.enum(["editor","reviewer"])});var S=e.nativeEnum(h),b=e.enum(["off","minimal","low","medium","high","xhigh"]),M=e.object({id:e.string().optional(),skillId:e.string(),skill:e.object({id:e.string(),name:e.string()}).optional()}),je=e.object({id:e.string(),name:e.string(),type:S,enabled:e.boolean(),avatar:e.string().optional(),providerId:e.string().optional(),modelId:e.string().optional(),thinkingLevel:b.optional().default("off"),systemPrompt:e.string().optional(),soul:e.string().optional(),skills:e.array(M).optional(),deniedTools:e.array(e.string()).optional()}),_=e.object({name:e.string().min(1),type:S,enabled:e.boolean().optional().default(!0),avatar:e.string().optional(),providerId:e.string().optional(),modelId:e.string().optional(),thinkingLevel:b.optional().default("off"),systemPrompt:e.string().optional(),soul:e.string().optional(),skills:e.array(e.string()).optional(),deniedTools:e.array(e.string()).optional()}),ke=_.superRefine((o,a)=>{if(o.type==="chat"||o.type==="autofill"){if(!o.providerId)a.addIssue({code:e.ZodIssueCode.custom,message:"providerId is required for chat/autofill agents",path:["providerId"]});if(!o.modelId)a.addIssue({code:e.ZodIssueCode.custom,message:"modelId is required for chat/autofill agents",path:["modelId"]})}}),Ie=_.superRefine((o,a)=>{if(o.type==="chat"||o.type==="autofill"){if(!o.providerId)a.addIssue({code:e.ZodIssueCode.custom,message:"providerId is required for chat/autofill agents",path:["providerId"]});if(!o.modelId)a.addIssue({code:e.ZodIssueCode.custom,message:"modelId is required for chat/autofill agents",path:["modelId"]})}}),qe=e.object({id:e.string(),sessionId:e.string(),entry:e.unknown()}),Te=e.object({id:e.string(),name:e.string().nullable().optional(),type:e.string(),createdAt:e.string(),creator:e.object({id:e.string(),name:e.string().nullable().optional(),email:e.string().nullable().optional(),image:e.string().nullable().optional()}).nullable().optional(),agentId:e.string().optional()});var Pe=e.object({apiKey:e.string().optional(),baseUrl:e.string().optional(),chatModels:e.array(e.string()).optional()}),F=e.enum(["1h","24h","7d","30d"]),we=e.object({timeframe:F.default("30d"),userId:e.string().optional()});var Ne=e.object({data:e.array(e.lazy(()=>V)),pageInfo:n}),R=e.object({proxyType:e.enum(["image","video","audio","pdf"]).nullable().optional(),thumbnailUrl:e.string().optional(),originalHeight:e.number().optional(),originalWidth:e.number().optional(),spriteUrl:e.string().optional(),duration:e.number().optional(),pageCount:e.number().optional()}),N=e.object({type:e.string().nullable(),preview:R.nullable()}),s=e.object({id:e.string(),name:e.string(),image:e.string().optional()}),L=e.object({fieldId:e.string(),value:e.any()}),E=e.object({id:e.string(),name:e.string()}),O=e.object({duration:e.number().optional(),originalWidth:e.number().optional(),originalHeight:e.number().optional(),frameRate:e.number().optional(),totalFrames:e.number().optional(),startTimecode:e.string().optional()}),V=e.object({id:e.string(),name:e.string(),sizeByte:e.number(),fileCount:e.number(),type:e.string(),targetType:e.string().optional().nullable(),status:e.string(),proxyType:e.enum(["image","video","audio","pdf"]).nullable().optional(),latestChildren:e.array(N).optional(),preview:R.nullable().optional(),createdAt:e.string(),updatedAt:e.string(),deletedAt:e.string().nullable().optional(),projectId:e.string().optional().nullable(),creator:s.nullable().optional(),fieldValues:e.array(L).optional(),sortIndex:e.string().optional().nullable(),startTime:e.number().optional().nullable(),endTime:e.number().optional().nullable(),media:e.object({original:e.object({downloadUrl:e.string(),key:e.string().optional()}).optional(),videoTranscodes:e.array(e.object({id:e.string(),url:e.string(),key:e.string(),width:e.number(),height:e.number(),size:e.number(),isRaw:e.boolean()})).optional(),imageTranscodes:e.array(e.object({id:e.string(),url:e.string(),key:e.string(),width:e.number(),height:e.number(),size:e.number(),isRaw:e.boolean()})).optional(),videoPreview:e.object({url:e.string(),key:e.string().optional()}).optional(),pdfTranscode:e.object({url:e.string(),key:e.string().optional()}).optional(),proxyType:e.enum(["image","video","audio","pdf"]).nullable().optional(),metadata:O.optional()}).optional(),ancestorFolders:e.array(E).optional(),versionStack:e.object({id:e.string(),versions:e.array(e.object({version:e.number(),current:e.boolean(),id:e.string(),name:e.string().optional().nullable(),previewUrl:e.string().optional().nullable(),creator:e.object({id:e.string(),name:e.string().nullable()}).nullable().optional()}))}).optional().nullable()}),Le=e.object({name:e.string(),type:e.string(),projectId:e.string().optional(),parentId:e.string().optional(),key:e.string().optional(),sizeByte:e.number().optional(),contentType:e.string().optional(),creatorId:e.string().optional()}),Ee=e.object({assetId:e.string()}),Oe=e.object({id:e.string(),name:e.string()}),Ve=e.object({assetId:e.string().optional(),assetType:e.string(),projectId:e.string().optional(),showDeleted:e.boolean().optional(),prefix:e.string().optional(),sort:e.string().optional(),order:e.string().optional(),...r.shape}),Qe=e.object({assetId:e.string(),userId:e.string(),replyToId:e.string().optional(),message:e.string(),annotations:e.any().optional(),second:e.number().optional(),attachmentIds:e.array(e.string())}),Q=e.object({id:e.string(),assetId:e.string(),url:e.string(),proxyType:e.enum(["image","video","audio","pdf"]).nullable().optional()}),K=e.object({id:e.string(),assetId:e.string(),message:e.string().nullable(),annotations:e.any(),second:e.number().nullable(),creator:s,replies:e.array(e.lazy(()=>K)),attachments:e.array(Q),mentions:e.array(s),createdAt:e.string(),updatedAt:e.string(),sessionId:e.string().nullable(),isCompleted:e.boolean(),completionLastChangedBy:s.nullable()}),Ke=e.object({isCompleted:e.boolean()}),We=e.object({newParentId:e.string(),assetIds:e.array(e.string()),creatorId:e.string().optional()}),Be=e.object({newParentId:e.string(),assetIds:e.array(e.string()),withComments:e.boolean().default(!1),creatorId:e.string().optional()}),De=e.object({name:e.string()}),Ze=e.object({beforeIndex:e.string().optional(),afterIndex:e.string().optional()}),Ge=e.object({ids:e.array(e.string())}),Je=e.object({ids:e.array(e.string())}),Ye=e.object({file:e.instanceof(File)}),He=e.object({key:e.string()}),Xe=e.object({fileName:e.string(),contentType:e.string(),size:e.number()}),$e=e.object({id:e.string(),uploadUrl:e.string()}),Ae=e.object({ids:e.array(e.string())}),W=e.object({id:e.string(),name:e.string(),url:e.string()}),ze=e.object({files:e.array(W)});var ot=e.object({userCount:e.number()}),rt=e.object({name:e.string().min(1,"Name is required").max(100,"Name is too long")}),at=e.object({id:e.string(),token:e.string(),name:e.string(),createdAt:e.string()});var B=e.enum(["is","eq","neq","gt","gte","lt","lte","contains","notContains","isEmpty","isNotEmpty","in","notIn","hasAny","hasAll","hasNone","isWithin"]),D=e.object({field:e.string(),operator:B,value:e.any()}),Z=e.enum(["asc","desc"]),G=e.object({field:e.string(),order:Z}),J=e.enum(["AND","OR"]),Y=e.enum(["file","folder"]),m=e.object({operator:J.optional().default("AND"),conditions:e.array(D).optional().default([]),sort:G.optional(),assetType:Y.optional(),showSymlink:e.boolean().optional(),recursively:e.boolean().optional().default(!0),query:e.string().optional(),isSemantic:e.boolean().optional().default(!1)}),pt=m.extend(r.shape);var f=e.object({sourceFolderId:e.string(),searchFilter:m}),H=e.object({id:e.string(),name:e.string(),filter:f,projectId:e.string(),createdAt:e.string(),updatedAt:e.string(),creator:e.object({id:e.string(),name:e.string(),image:e.string().optional().nullable()}).optional().nullable()}),dt=e.object({name:e.string(),filter:f}),gt=e.object({name:e.string().optional(),filter:f.optional()});var yt=e.object({data:e.array(H),pageInfo:e.object({cursor:e.string().optional(),total:e.number().optional()})});var ht=e.object({name:e.string(),parentId:e.string()}),St=e.object({name:e.string()}),bt=e.object({ids:e.array(e.string())}),_t=e.object({ids:e.array(e.string())});var It=e.object({code:e.string(),role:e.string(),teamId:e.string(),teamName:e.string(),projectId:e.string().optional(),projectName:e.string().optional(),inviterName:e.string(),isUsed:e.boolean()}),qt=e.object({role:e.nativeEnum(l)}),Tt=e.object({role:e.nativeEnum(l)}),vt=e.object({code:e.string()});var Mt={text:"text",longText:"longText",select:"select",selectMulti:"selectMulti",rating:"rating",number:"number",toggle:"toggle",date:"date",user:"user",userMulti:"userMulti"},Ft=e.object({id:e.string(),displayName:e.string(),color:e.string().optional()}),d=e.object({name:e.string(),type:e.enum(["text","longText","select","selectMulti","rating","number","toggle","date","user","userMulti"]),text:e.any().optional(),longText:e.any().optional(),select:e.any().optional(),selectMulti:e.any().optional(),rating:e.any().optional(),number:e.any().optional(),toggle:e.any().optional(),date:e.any().optional(),user:e.any().optional(),userMulti:e.any().optional()}),Nt=e.object({key:e.string().optional(),label:e.string().optional(),scope:e.string().optional(),config:d,aiAutofill:e.boolean().default(!1),description:e.string().default("")}),Lt=e.object({label:e.string().optional(),config:d,aiAutofill:e.boolean().optional(),description:e.string().optional()}),X=e.object({fieldId:e.string(),visible:e.boolean()}),Et=e.array(X),$=e.object({key:e.string(),value:e.any()}),Ot=e.array($),Vt=e.object({id:e.string(),config:d,scope:e.string(),readOnly:e.boolean(),visible:e.boolean(),description:e.string(),aiAutofill:e.boolean()});var j=e.object({id:e.string().optional(),name:e.string().optional(),role:e.string().optional()}),k=e.object({id:e.string().optional(),name:e.string().optional()}),A=e.object({id:e.string().optional(),proxyType:e.enum(["image","video","audio","pdf"]).nullable().optional(),name:e.string().optional(),preview:e.string().optional(),thumbnailUrl:e.string().optional(),originalWidth:e.number().optional(),originalHeight:e.number().optional()}),Wt=e.object({id:e.string().optional(),creator:j.optional(),type:e.string().optional(),team:k.optional(),project:k.optional(),asset:A.optional(),user:j.optional(),createdAt:e.string().optional(),isRead:e.boolean().optional()}),Bt=e.object({unreadOnly:e.union([e.boolean(),e.string()]).transform((o)=>o===!0||o==="true").optional(),after:e.string().optional(),pageSize:e.coerce.number().optional()}),Dt=e.object({notificationId:e.string().min(1)}),Zt=e.object({comments:e.boolean().default(!0),replies:e.boolean().default(!0),mentions:e.boolean().default(!0),yourUploads:e.boolean().default(!1),otherUploads:e.boolean().default(!0),statusUpdates:e.boolean().default(!0)});var Ht=e.object({name:e.string(),coverImageKey:e.string().optional(),enableNotification:e.boolean().default(!0)}),Xt=e.object({name:e.string().optional(),coverImageKey:e.string().optional(),enableNotification:e.boolean().optional()}),z=e.object({id:e.string(),name:e.string(),teamId:e.string(),rootFolder:e.string().optional(),coverImage:e.string().optional(),coverImageKey:e.string().optional(),enableNotification:e.boolean(),updatedAt:e.union([e.string(),e.date()])}),$t=e.object({sortBy:e.string().optional(),sortDirection:e.enum(["asc","desc"]).optional()}).merge(r),At=e.object({data:e.array(z),pageInfo:n}),zt=e.object({teamId:e.string()}),eo=e.object({id:e.string(),name:e.string(),role:e.enum(["owner","editor","reviewer","bot","unknown"]),image:e.string().optional(),scope:e.enum(["team","project"]).optional(),hasCustomRole:e.boolean().optional()}),to=e.object({id:e.string(),name:e.string()}),oo=e.object({assetType:e.string(),sort:e.enum(["createdAt","name","size"]).optional(),order:e.enum(["asc","desc"]).optional()}).merge(r),ro=e.object({role:e.enum(["editor","reviewer"])}),ao=e.object({userId:e.string(),role:e.enum(["owner","editor","reviewer"])}),no=e.object({id:e.string(),name:e.string(),role:e.enum(["owner","editor","reviewer","bot","unknown"]),image:e.string().optional()});var I=["openai-completions","mistral-conversations","openai-responses","azure-openai-responses","openai-codex-responses","anthropic-messages","bedrock-converse-stream","google-generative-ai","google-vertex"],ee=e.object({api:e.enum(I).optional(),reasoning:e.boolean().default(!1),input:e.array(e.enum(["text","image"])).default(["text"]),contextWindow:e.number().int().positive().default(128000),maxTokens:e.number().int().positive().default(4096),cost:e.object({input:e.number().nonnegative().default(0),output:e.number().nonnegative().default(0),cacheRead:e.number().nonnegative().default(0),cacheWrite:e.number().nonnegative().default(0)})}),g=e.object({id:e.string().optional(),modelId:e.string().min(1,"Model ID is required"),name:e.string().min(0).default(""),config:ee}),y=e.object({baseUrl:e.string().url("Must be a valid URL").optional().or(e.literal("")),apiKey:e.string().optional().or(e.literal("")),api:e.enum(I),headers:e.record(e.string(),e.string()).optional(),authHeader:e.boolean().optional()}),po=e.object({name:e.string().min(1,"Provider name is required"),config:y,models:e.array(g).min(1,"At least one model is required")}),co=e.object({config:y,models:e.array(g).min(1,"At least one model is required")}),lo=e.object({id:e.string(),name:e.string(),isBuiltin:e.boolean(),config:y,models:e.array(g).optional(),modelsCount:e.number().optional(),createdAt:e.date(),updatedAt:e.date()});var yo=e.object({name:e.string().min(1),expireAt:e.string().datetime().optional(),password:e.string().optional(),isDisabled:e.boolean().optional(),defaultSortOrder:e.string().optional(),viewMode:e.string().optional()}),uo=e.object({name:e.string().min(1).optional(),expireAt:e.string().datetime().optional().nullable(),password:e.string().optional().nullable(),isDisabled:e.boolean().optional(),defaultSortOrder:e.string().optional().nullable(),viewMode:e.string().optional().nullable(),fieldVisibility:e.record(e.string(),e.boolean()).optional().nullable()}),xo=r.extend({projectId:e.string().optional()}),ho=e.object({assetIds:e.array(e.string().min(1)).min(1)});var _o=e.object({assetId:e.string().optional(),githubUrl:e.string().optional(),override:e.boolean().optional()}),Ro=e.object({config:e.object({environmentVariables:e.array(e.object({name:e.string(),default:e.string().optional()}))})}),jo=e.object({permission:e.enum(["owner","editor","reviewer"])});var q=e.lazy(()=>e.object({name:e.string(),id:e.string(),size:e.number(),children:e.array(q),type:e.string(),mediaType:e.string().optional()})),qo=e.object({parentId:e.string(),files:e.array(q)}),te=e.object({id:e.string(),fileId:e.string(),url:e.string()}),To=e.object({taskId:e.string(),presignedUrls:e.array(te),createdAssets:e.array(e.object({tempId:e.string(),assetId:e.string()})).optional()}),vo=e.object({fileId:e.string(),errorMessage:e.string().optional()}),Uo=e.object({id:e.string(),name:e.string(),total:e.number(),uploaded:e.number(),createdAt:e.string()}),Po=e.object({bucket:e.string(),key:e.string(),Signature:e.string()}),wo=e.object({file:e.instanceof(File)});var oe=e.object({key:e.string(),value:e.unknown()}),Fo=e.object({value:e.unknown()}),No=e.array(oe);var Oo=e.object({fileIds:e.array(e.string())}),Vo=e.object({fileId:e.string(),beforeId:e.string()});var Wo=e.object({agentId:e.string(),textPrompt:e.string().optional(),attachedFiles:e.array(e.string()).optional(),assetIds:e.array(e.string()).optional(),sessionId:e.string().optional(),contextAssetId:e.string().optional(),projectId:e.string().optional()}).superRefine((o,a)=>{let p=o.textPrompt&&o.textPrompt.trim().length>0,c=o.attachedFiles&&o.attachedFiles.length>0,P=o.assetIds&&o.assetIds.length>0;if(!p&&!c&&!P)a.addIssue({code:e.ZodIssueCode.custom,message:"At least one of textPrompt, attachedFiles, or assetIds must be provided.",path:["textPrompt"]})}),Bo=e.object({id:e.string(),agentId:e.string(),userId:e.string().nullable(),assetId:e.string().nullable(),userCommentId:e.string().nullable(),name:e.string().nullable().optional(),createdAt:e.string(),updatedAt:e.string()}),Do=e.intersection(e.object({id:e.string()}),e.unknown());var i;((t)=>{t.team_create="team_create";t.team_update="team_update";t.team_delete="team_delete";t.team_member_add="team_member_add";t.team_member_update="team_member_update";t.team_member_remove="team_member_remove";t.project_create="project_create";t.project_update="project_update";t.project_delete="project_delete";t.project_empty_trash="project_empty_trash";t.project_member_add="project_member_add";t.project_member_update="project_member_update";t.project_member_remove="project_member_remove";t.file_create="file_create";t.file_update="file_update";t.file_delete="file_delete";t.folder_create="folder_create";t.folder_update="folder_update";t.folder_delete="folder_delete";t.asset_reparent="asset_reparent";t.asset_copy="asset_copy";t.share_create="share_create";t.share_update="share_update";t.share_delete="share_delete";t.agent_create="agent_create";t.agent_update="agent_update";t.agent_delete="agent_delete";t.skill_create="skill_create";t.skill_update="skill_update";t.skill_delete="skill_delete";t.provider_create="provider_create";t.provider_update="provider_update";t.provider_delete="provider_delete";t.invite_create="invite_create";t.invite_revoke="invite_revoke";t.metadata_field_create="metadata_field_create";t.metadata_field_update="metadata_field_update";t.metadata_field_delete="metadata_field_delete";t.comment_create="comment_create";t.comment_update="comment_update";t.comment_delete="comment_delete";t.comment_complete="comment_complete"})(i||={});var re=e.object({id:e.string(),action:e.nativeEnum(i),teamId:e.string(),userId:e.string().nullable().optional(),projectId:e.string().nullable().optional(),itemId:e.string().nullable().optional(),createdAt:e.string()}),Jo=e.object({first:e.coerce.number().optional(),after:e.string().optional(),actions:e.union([e.nativeEnum(i),e.array(e.nativeEnum(i))]).transform((o)=>Array.isArray(o)?o:[o]).optional(),userIds:e.union([e.string(),e.array(e.string())]).transform((o)=>Array.isArray(o)?o:[o]).optional(),itemId:e.string().optional()}),Yo=e.object({nodes:e.array(re),pageInfo:e.object({hasNextPage:e.boolean(),endCursor:e.string().nullable()}),total:e.number()});function _r({className:o,orientation:a="horizontal",decorative:p=!0,...c}){return T(v.Root,{"data-slot":"separator",decorative:p,orientation:a,className:U("shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",o),...c})}
2
+ export{b as Ua,Mt as Va,I as Wa,g as Xa,y as Ya,C as Za,i as _a,_r as $a};
@@ -0,0 +1,2 @@
1
+ import{ef as Hf,ff as Jf,gf as Kf,hf as Qf,if as Wf,lf as _f}from"./chunk-mggfc9ya.js";import{rf as Zf,sf as Gf}from"./chunk-vf3bg920.js";import{tf as $f}from"./chunk-xcbb21j9.js";import{wf as Rf,xf as Lf,yf as Vf,zf as Cf}from"./chunk-gpeyctxd.js";import{cg as zf}from"./chunk-57kgmgfs.js";import{ig as Sf,jg as a,kg as Nf,lg as Uf,mg as W,pg as qf,qg as g,rg as p,sg as l,tg as c,vg as Xf}from"./chunk-m268vcdm.js";import{Ag as f,Bg as V,Bj as X,Dh as e,Ih as j,Jh as r,Ng as u,Pg as d,Zh as n,ch as i,ei as o,hi as s,jh as x,li as ff,tj as D,zg as O}from"./chunk-eczsk2xd.js";function Yf({teamId:K,projectId:L,projectName:_,ancestorFolders:B,currentAsset:U,isRootFolder:Y,displayStyle:E,onDisplayStyleChange:h,isLeftSidebarCollapsed:P,onLeftSidebarToggle:T,isRightSidebarCollapsed:$,onRightSidebarToggle:v,isChatbotOpen:Z=!1,onChatbotToggle:N,isPublic:Q=!1,onFolderClick:w,fileId:q,shareId:G,downloadInfo:z,versions:S,compareMode:J=!1,canCompareVersions:b=!1,onCompareVersions:A}){let k=u(),{canEdit:y}=Xf(L),I=!1,m=(R)=>{if(!q)return;if(Q&&G){k({to:"/share/$shareId/files/$fileId",params:{shareId:G,fileId:q},search:(C)=>({...C,version:R})});return}if(!L)return;k({to:"/projects/$projectId/files/$fileId",params:{projectId:L,fileId:q},search:(C)=>({...C,version:R})})},M=async(R)=>{if(!q)return;try{let C=G?await i.api.shares[":shareId"].files[":fileId"]["download-url"].$post({param:{shareId:G,fileId:q},json:{key:R}}):await i.api.files["download-url"].$post({json:{key:R,assetId:q}});if(!C.ok)return;let{url:H}=await C.json(),F=document.createElement("a");F.href=H,F.download="",document.body.appendChild(F),F.click(),document.body.removeChild(F)}catch{}},Bf=U.proxyType!=="audio"&&z?.videoTranscodes&&z.videoTranscodes.filter((R)=>!R.isRaw).length>0,Ef=Q?[{name:_,id:"root"},...B.slice().reverse().map((R)=>({name:R.name||"",id:R.id}))]:[{name:X.all_projects(),path:`/teams/${K}`,isMuted:!0},{name:_,path:`/projects/${L}`},...B.slice().reverse().map((R)=>({name:R.name||"",path:`/projects/${L}/folders/${R.id}`}))];return V("div",{className:"flex h-14 flex-wrap items-center justify-between gap-2 border-b border-border bg-card px-4 py-2",children:[V("div",{className:"flex min-w-0 flex-shrink items-center gap-1",children:[Ef.map((R,C)=>V("div",{className:"flex items-center gap-1",children:[C>0&&f("span",{className:"text-muted-foreground",children:"/"}),R.path?f(d,{to:R.path,className:D("truncate rounded px-2 py-1 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground",R.isMuted?"text-muted-foreground":"text-foreground"),children:R.name}):f("button",{onClick:()=>R.id&&w?.(R.id),className:"truncate rounded px-2 py-1 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground text-foreground",children:R.name})]},C)),!Y&&!J&&V("div",{className:"flex items-center gap-1",children:[f("span",{className:"text-muted-foreground",children:"/"}),U.type==="folder"?f("span",{className:"truncate rounded px-2 py-1 text-sm font-medium text-foreground",children:U.name}):V(Sf,{children:[V(Nf,{className:"flex items-center gap-1 truncate rounded px-2 py-1 text-sm font-medium text-foreground transition-colors hover:bg-accent hover:text-accent-foreground",children:[f("span",{children:U.name}),U.version!==void 0&&V(zf,{variant:"outline",className:"px-1 py-0 text-xs",children:["v",U.version]}),f(r,{className:"h-4 w-4"})]}),V(Uf,{className:"w-56",children:[Bf?V(p,{children:[f(l,{className:"flex items-center gap-2",children:f("span",{children:X.download()})}),f(a,{children:V(c,{className:"w-48",children:[f(qf,{children:X.download()}),z?.videoTranscodes?.filter((R)=>!R.isRaw).map((R)=>{let C=Math.max(R.width,R.height),H=`${R.height}p`;if(C>=3840)H="2160p";else if(C>=1920)H="1080p";else if(C>=1280)H="720p";else if(C>=960)H="540p";else if(C>=640)H="360p";else if(C>=320)H="180p";return V(W,{onClick:()=>M(R.key),className:"flex items-center justify-between",children:[f("span",{children:H}),f("span",{className:"text-xs text-muted-foreground",children:"MP4"})]},H)}),z?.originalKey&&V(O,{children:[f(g,{}),V(W,{onClick:()=>M(z.originalKey),className:"flex items-center justify-between",children:[f("span",{children:"Original"}),f("span",{className:"text-xs text-muted-foreground",children:U.name?.split(".").pop()?.toUpperCase()||"RAW"})]})]})]})})]}):f(W,{onClick:()=>z?.originalKey&&M(z.originalKey),disabled:!z?.originalKey,children:X.download()}),y&&f(W,{onClick:()=>console.log("Rename"),children:"Rename"}),y&&f(W,{onClick:()=>console.log("Delete"),children:"Delete"}),b&&A&&V(O,{children:[f(g,{}),V(W,{onClick:()=>A(),children:[f(x,{className:"h-4 w-4"}),f("span",{children:X.compare_versions()})]})]}),S&&S.length>0&&V(O,{children:[f(g,{}),V(p,{children:[V(l,{className:"flex items-center gap-2",children:[f(o,{className:"h-4 w-4"}),f("span",{children:"Versions"})]}),f(a,{children:V(c,{className:"w-80 p-1",children:[f("div",{className:"flex flex-col gap-1 max-h-96 overflow-y-auto",children:S.map((R)=>{let C=U.version===R.version;return V(W,{onClick:()=>m(R.id),className:"flex items-center gap-3 py-2 px-3 rounded-md cursor-pointer focus:bg-accent focus:text-accent-foreground",children:[V("div",{className:"flex-shrink-0 flex items-center justify-center bg-muted dark:bg-muted-foreground/20 text-muted-foreground dark:text-muted-foreground rounded-full px-2 py-0.5 text-xs font-semibold select-none min-w-[2rem]",children:["v",R.version]}),f("div",{className:"h-10 w-16 flex-shrink-0 overflow-hidden rounded-md border border-border bg-muted flex items-center justify-center",children:R.previewUrl?f("img",{src:R.previewUrl,alt:R.name||void 0,className:"h-full w-full object-cover"}):f(n,{className:"h-4 w-4 text-muted-foreground"})}),V("div",{className:"flex flex-col flex-1 min-w-0 text-left",children:[f("span",{className:"truncate text-sm font-semibold text-foreground",children:R.name}),f("span",{className:"truncate text-xs text-muted-foreground",children:R.creator?.name||"Unknown"})]}),C&&f(j,{className:"h-4 w-4 text-primary ml-auto flex-shrink-0"})]},R.id)})}),f(g,{}),f("div",{className:"p-1",children:f("button",{className:"w-full text-center text-xs font-medium py-2 px-3 rounded-md bg-muted/80 hover:bg-muted text-foreground transition-colors",onClick:()=>console.log("Manage versions"),children:"Manage versions..."})})]})})]})]})]})]})]})]}),V("div",{className:"flex items-center gap-2",children:[V("div",{className:"flex flex-shrink-0 items-center gap-1 rounded-md border border-border bg-background p-1",children:[!q&&!Q&&T&&f("button",{onClick:T,className:"rounded p-1.5 text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground",title:P?"Show Left Sidebar":"Hide Left Sidebar",children:P?f(Hf,{className:"h-4 w-4"}):f(Kf,{className:"h-4 w-4 fill-primary stroke-0"})}),!q&&!Q&&E&&h&&V(O,{children:[f("button",{onClick:()=>h("card"),className:`rounded p-1.5 transition-colors ${E==="card"?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"}`,title:"Card View",children:f(s,{className:"h-4 w-4"})}),f("button",{onClick:()=>h("list"),className:`rounded p-1.5 transition-colors ${E==="list"?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"}`,title:"List View",children:f(ff,{className:"h-4 w-4"})})]}),f("button",{onClick:v,className:`rounded p-1.5 transition-colors ${!$&&!Z?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"}`,title:$?"Show Right Sidebar":"Hide Right Sidebar",children:!$&&!Z?f(Qf,{className:"h-4 w-4 fill-primary stroke-0"}):f(Jf,{className:"h-4 w-4"})})]}),!Q&&N&&f(Rf,{children:V(Lf,{children:[f(Vf,{asChild:!0,children:f("span",{children:f("button",{disabled:!1,onClick:N,className:D("h-9 w-9 flex items-center justify-center rounded-full border border-border bg-background transition-colors",Z?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground",!1),children:Z?f(Wf,{className:"h-6 w-6 text-primary transition-colors"}):f(e,{className:"h-6 w-6 text-muted-foreground transition-colors"})})})}),f(Cf,{children:f("p",{children:Z?X.hide_chatbot():X.show_chatbot()})})]})})]})]})}function cf(){let{projectState:K}=Zf(),L=$f(),{isChatbotOpen:_,setIsChatbotOpen:B}=Gf();if(!K)return f(hf,{});let{teamId:U,projectId:Y,projectName:E,ancestorFolders:h,currentAsset:P,isRootFolder:T,fileId:$,downloadInfo:v,versions:Z,isPublic:N,shareId:Q,onFolderClick:w,compareMode:q,canCompareVersions:G,onCompareVersions:z}=K,S=!!$,J=!!Q&&!S,b=S?L.fileViewLeftSidebarCollapsed:J?L.shareConfigLeftSidebarCollapsed:L.fileListLeftSidebarCollapsed,A=N?void 0:()=>S?L.setFileViewLeftSidebarCollapsed(!L.fileViewLeftSidebarCollapsed):J?L.setShareConfigLeftSidebarCollapsed(!L.shareConfigLeftSidebarCollapsed):L.setFileListLeftSidebarCollapsed(!L.fileListLeftSidebarCollapsed),k=N&&K.isRightSidebarCollapsed!==void 0?K.isRightSidebarCollapsed:S?L.fileViewRightSidebarCollapsed:J?L.shareConfigRightSidebarCollapsed:L.fileListRightSidebarCollapsed,y=N&&K.onRightSidebarToggle?K.onRightSidebarToggle:()=>{if(!N&&_)if(B(!1),S)L.setFileViewRightSidebarCollapsed(!1);else if(J)L.setShareConfigRightSidebarCollapsed(!1);else L.setFileListRightSidebarCollapsed(!1);else if(S)L.setFileViewRightSidebarCollapsed(!L.fileViewRightSidebarCollapsed);else if(J)L.setShareConfigRightSidebarCollapsed(!L.shareConfigRightSidebarCollapsed);else L.setFileListRightSidebarCollapsed(!L.fileListRightSidebarCollapsed)},I=N?void 0:()=>{B(!_)},m=Y?L.viewModes[Y]??"card":"card";return f(Yf,{teamId:U,projectId:Y,projectName:E,ancestorFolders:h,currentAsset:P,isRootFolder:T,displayStyle:S||J?void 0:m,onDisplayStyleChange:S||J?void 0:N?void 0:(t)=>{if(Y)L.setViewMode(Y,t)},isLeftSidebarCollapsed:b,onLeftSidebarToggle:A,isRightSidebarCollapsed:k,onRightSidebarToggle:y,isChatbotOpen:!N&&_,onChatbotToggle:I,isPublic:N,shareId:Q,fileId:$,downloadInfo:v,versions:Z,onFolderClick:w,compareMode:q,canCompareVersions:G,onCompareVersions:z})}function hf(){return f("div",{className:"flex h-14 flex-wrap items-center justify-center gap-2 border-b border-border bg-card px-4 py-2 flex-shrink-0",children:f(_f,{className:"w-10 h-10 text-orange-600"})})}
2
+ export{cf as Ke};
@@ -0,0 +1 @@
1
+ import{T as t}from"./chunk-pdajhyqm.js";import{Ha as r}from"./chunk-5vwkfxy7.js";import{Ja as a,Ka as s,La as e,Ma as E,Na as $,Oa as q}from"./chunk-7pjes19z.js";import"./chunk-x0r8dcq0.js";import{cb as x}from"./chunk-p8enen2a.js";import{db as j}from"./chunk-tc7q988r.js";import"./chunk-yj6tmjsc.js";import{Ce as l}from"./chunk-wkth5xwr.js";import{Ne as o}from"./chunk-3823qzr0.js";import{tf as i}from"./chunk-xcbb21j9.js";import{uf as d}from"./chunk-ey7vty63.js";import{ug as h}from"./chunk-m268vcdm.js";import{Ag as G,Bg as K,Bj as X,Cg as L,Gg as y,Gh as T,Hg as F,Ig as S,Ii as u,Ng as P,Sg as C,Th as g,Xh as b,ah as B,ch as A,ii as I,nh as f,vj as m,wj as p,xj as c,yg as OG,yj as n,zg as k}from"./chunk-eczsk2xd.js";import{Fk as qG}from"./chunk-t15a1vp6.js";var _=qG(OG(),1);var zG=(Y)=>{if(!Y)return"??";return Y.split(" ").map((z)=>z[0]).slice(0,2).join("").toUpperCase()};function BG(){let{projectId:Y}=MG.useParams(),{teamId:z,ensureTeamIdForProject:U}=h(),GG=L(),JG=P();_.useEffect(()=>{U(Y)},[Y,U]);let{data:M}=y(l(Y)),D=M?.rootFolder,[KG,XG]=_.useState(240),{shareConfigLeftSidebarCollapsed:Q,setShareConfigLeftSidebarCollapsed:YG}=i(),{data:V,isLoading:ZG,fetchNextPage:R,hasNextPage:v,isFetchingNextPage:W}=S({queryKey:["shares",Y],queryFn:async({pageParam:J})=>{let Z=await A.api.projects[":projectId"].shares.$get({param:{projectId:Y},query:{first:"20",after:J}});if(!Z.ok)throw Error("Failed to fetch share links");return await Z.json()},initialPageParam:"",getNextPageParam:(J)=>J.pageInfo?.cursor||void 0,enabled:!!Y}),{ref:_G,inView:w}=d();_.useEffect(()=>{if(w&&v&&!W)R()},[w,v,W,R]);let H=_.useMemo(()=>V?.pages.flatMap((J)=>J.data)||[],[V]),{mutate:$G}=F({mutationFn:async({id:J,isDisabled:Z})=>{let O=await A.api.shares[":shareId"].$put({param:{shareId:J},json:{isDisabled:Z}});if(!O.ok)throw Error("Failed to update share link");return await O.json()},onSuccess:()=>{GG.invalidateQueries({queryKey:["shares",Y]}),B.success(X.share_link_status_updated())},onError:(J)=>{B.error(X.error_message({message:J.message}))}});if(!z||!D||!M)return G(o,{});let N=async(J)=>{let Z=`${window.location.origin}/share/${J}`;if(await x(Z))B.success(X.link_copied())};return G("div",{className:"flex flex-1 flex-col bg-background min-h-0",children:K("div",{className:"flex flex-1 overflow-hidden relative",children:[!Q&&G("div",{className:"md:hidden fixed inset-0 bg-black/50 z-40",onClick:()=>YG(!0)}),!Q&&K(k,{children:[G("div",{className:"bg-background",style:{width:KG},children:G(t,{teamId:z,projectId:Y,projectName:M.name??"",rootFolderId:D})}),G(r,{onResize:(J)=>{XG((Z)=>Math.max(180,Math.min(400,Z+J)))},className:"hidden md:block"})]}),K("div",{className:"flex-1 flex flex-col min-h-0 bg-card overflow-hidden",children:[G("header",{className:"h-14 border-b flex items-center justify-between px-6 shrink-0 bg-background/50 backdrop-blur-sm sticky top-0 z-10",children:K("div",{className:"flex items-center gap-2",children:[G(u,{className:"h-5 w-5 text-primary"}),G("h1",{className:"font-bold text-lg text-foreground",children:X.all_share_links()})]})}),G("div",{className:"flex-1 overflow-y-auto p-6",children:ZG?G("div",{className:"flex justify-center items-center h-64",children:G("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):H.length===0?K("div",{className:"flex flex-col items-center justify-center h-64 text-muted-foreground gap-3",children:[G(I,{className:"h-10 w-10 text-muted-foreground/50"}),G("p",{children:X.no_share_links_yet()})]}):K("div",{className:"border border-border rounded-xl bg-background overflow-hidden shadow-xs",children:[K(a,{children:[G(s,{children:K(E,{className:"hover:bg-transparent bg-muted/20",children:[G($,{className:"font-semibold px-4 py-3",children:X.name()}),G($,{className:"font-semibold px-4 py-3",children:X.public_link()}),G($,{className:"font-semibold px-4 py-3",children:X.creator()}),G($,{className:"font-semibold px-4 py-3 w-[150px]",children:X.created_date()}),G($,{className:"font-semibold px-4 py-3 text-right w-[120px]",children:X.active()})]})}),G(e,{children:H.map((J)=>{let Z=`${window.location.origin}/share/${J.id}`;return K(E,{className:"hover:bg-muted/10 transition-colors",children:[G(q,{className:"font-medium px-4 py-3.5",children:G("span",{className:"cursor-pointer hover:underline text-foreground",onClick:()=>JG({to:"/projects/$projectId/shares/$shareId",params:{projectId:Y,shareId:J.id}}),children:J.name})}),G(q,{className:"px-4 py-3.5 max-w-[300px]",children:K("div",{className:"flex items-center gap-2 group",children:[G("span",{className:"truncate text-xs font-mono bg-muted/50 text-muted-foreground px-2 py-1 rounded-md border border-border cursor-pointer hover:bg-muted transition-colors flex-1",onClick:()=>N(J.id),title:X.click_to_copy_link(),children:Z}),G(m,{variant:"ghost",size:"icon-sm",className:"h-7 w-7 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>N(J.id),children:G(g,{className:"h-3.5 w-3.5"})}),G("a",{href:Z,target:"_blank",rel:"noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center",children:G(b,{className:"h-3.5 w-3.5"})})]})}),G(q,{className:"px-4 py-3.5",children:K("div",{className:"flex items-center gap-2",children:[K(p,{className:"h-6 w-6",children:[J.creator?.image&&G(c,{src:J.creator.image,alt:J.creator.name,className:"object-cover"}),G(n,{className:"text-[10px]",children:zG(J.creator?.name)})]}),G("span",{className:"text-sm font-medium text-foreground truncate max-w-[150px]",children:J.creator?.name||X.unknown()})]})}),G(q,{className:"px-4 py-3.5 text-muted-foreground text-sm",children:K("div",{className:"flex items-center gap-2",children:[G(T,{className:"h-3.5 w-3.5 text-muted-foreground/70"}),G("span",{children:new Date(J.createdAt).toLocaleDateString()})]})}),G(q,{className:"px-4 py-3.5 text-right",children:G("div",{className:"flex justify-end",children:G(j,{checked:!J.isDisabled,onCheckedChange:(O)=>$G({id:J.id,isDisabled:!O})})})})]},J.id)})})]}),G("div",{ref:_G,className:"h-10 w-full flex items-center justify-center",children:W&&G(f,{className:"h-6 w-6 animate-spin text-primary"})})]})})]})]})})}var MG=C("/projects/$projectId/shares/")({component:BG});export{MG as Route};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import"./chunk-xg9xscqz.js";import{Cc as I,Uc as w}from"./chunk-7jjc175m.js";import"./chunk-1dawjfk8.js";import"./chunk-ws07a9kv.js";function R(q,$){if(typeof q==="string"&&typeof $==="string")return q.toLowerCase()===$.toLowerCase();return q===$}function y(q,$){if(typeof q!=="string")return $.includes(q);return $.some((E)=>typeof E==="string"&&q.toLowerCase()===E.toLowerCase())}function j(q,$){return!y(q,$)}function g(q,$){if(typeof q!=="string"||typeof $!=="string")return!1;return q.toLowerCase().includes($.toLowerCase())}function f(q,$){if(typeof q!=="string"||typeof $!=="string")return!1;return q.toLowerCase().startsWith($.toLowerCase())}function V(q,$){if(typeof q!=="string"||typeof $!=="string")return!1;return q.toLowerCase().endsWith($.toLowerCase())}var v=(q,$)=>{let E=null,M=w({config:{adapterId:"memory",adapterName:"Memory Adapter",usePlural:!1,debugLogs:$?.debugLogs||!1,supportsArrays:!0,customTransformInput(P){if(P.options.advanced?.database?.generateId==="serial"&&P.field==="id"&&P.action==="create")return q[P.model].length+1;return P.data},transaction:async(P)=>{let A=structuredClone(q);try{return await P(M(E))}catch(_){throw Object.keys(q).forEach((S)=>{q[S]=A[S]}),_}}},adapter:({getFieldName:P,getDefaultFieldName:A,options:_,getModelName:S})=>{let N=(x,K,Y)=>{if(!K)return x;return x.sort((L,Z)=>{let z=P({model:Y,field:K.field}),D=L[z],X=Z[z],Q=0;if(D==null&&X==null)Q=0;else if(D==null)Q=-1;else if(X==null)Q=1;else if(typeof D==="string"&&typeof X==="string")Q=D.localeCompare(X);else if(D instanceof Date&&X instanceof Date)Q=D.getTime()-X.getTime();else if(typeof D==="number"&&typeof X==="number")Q=D-X;else if(typeof D==="boolean"&&typeof X==="boolean")Q=D===X?0:D?1:-1;else Q=String(D).localeCompare(String(X));return K.direction==="asc"?Q:-Q})};function F(x,K,Y,L){let Z=(()=>{let X=q[K];if(!X)throw I.error(`[MemoryAdapter] Model ${K} not found in the DB`,Object.keys(q)),Error(`Model ${K} not found`);let Q=(G,O)=>{let{field:J,value:H,operator:B,mode:k="sensitive"}=O,U=k==="insensitive"&&(typeof H==="string"||Array.isArray(H)&&H.every((W)=>typeof W==="string"));switch(B){case"in":if(!Array.isArray(H))throw Error("Value must be an array");if(U)return y(G[J],H);return H.includes(G[J]);case"not_in":if(!Array.isArray(H))throw Error("Value must be an array");if(U)return j(G[J],H);return!H.includes(G[J]);case"contains":if(U)return g(G[J],H);return G[J]?.includes(H);case"starts_with":if(U)return f(G[J],H);return G[J].startsWith(H);case"ends_with":if(U)return V(G[J],H);return G[J].endsWith(H);case"ne":return U?!R(G[J],H):G[J]!==H;case"gt":return H!=null&&Boolean(G[J]>H);case"gte":return H!=null&&Boolean(G[J]>=H);case"lt":return H!=null&&Boolean(G[J]<H);case"lte":return H!=null&&Boolean(G[J]<=H);default:if(U)return R(G[J],H);if(H===null)return G[J]==null;return G[J]===H}},T=X.filter((G)=>{if(!x.length||x.length===0)return!0;let O=Q(G,x[0]);for(let J of x){let H=Q(G,J);if(J.connector==="OR")O=O||H;else O=O&&H}return O});if(L?.length&&L.length>0)T=T.map((G)=>Object.fromEntries(Object.entries(G).filter(([O])=>L.includes(A({model:K,field:O})))));return T})();if(!Y)return Z;let z=new Map,D=new Map;for(let X of Z){let Q=String(X.id);if(!z.has(Q)){let G={...X};for(let[O,J]of Object.entries(Y)){let H=S(O);if(J.relation==="one-to-one")G[H]=null;else G[H]=[],D.set(`${Q}-${O}`,new Set)}z.set(Q,G)}let T=z.get(Q);for(let[G,O]of Object.entries(Y)){let J=S(G),H=q[J];if(!H)throw I.error(`[MemoryAdapter] JoinOption model ${J} not found in the DB`,Object.keys(q)),Error(`JoinOption model ${J} not found`);let B=H.filter((k)=>k[O.on.to]===X[O.on.from]);if(O.relation==="one-to-one")T[J]=B[0]||null;else{let k=D.get(`${Q}-${G}`),U=O.limit??100,W=0;for(let C of B){if(W>=U)break;if(!k.has(C.id))T[J].push(C),k.add(C.id),W++}}}}return Array.from(z.values())}return{create:async({model:x,data:K})=>{if(_.advanced?.database?.generateId==="serial")K.id=q[S(x)].length+1;if(!q[x])q[x]=[];return q[x].push(K),K},findOne:async({model:x,where:K,select:Y,join:L})=>{let Z=F(K,x,L,Y);if(L){let z=Z;if(!z.length)return null;return z[0]}return Z[0]||null},findMany:async({model:x,where:K,sortBy:Y,limit:L,select:Z,offset:z,join:D})=>{let X=F(K||[],x,D,Z);if(D){let T=X;if(!T.length)return[];N(T,Y,x);let G=T;if(z!==void 0)G=G.slice(z);if(L!==void 0)G=G.slice(0,L);return G}let Q=N(X,Y,x);if(z!==void 0)Q=Q.slice(z);if(L!==void 0)Q=Q.slice(0,L);return Q||[]},count:async({model:x,where:K})=>{if(K)return F(K,x).length;return q[x].length},update:async({model:x,where:K,update:Y})=>{let L=F(K,x);return L.forEach((Z)=>{Object.assign(Z,Y)}),L[0]||null},delete:async({model:x,where:K})=>{let Y=q[x],L=F(K,x);q[x]=Y.filter((Z)=>!L.includes(Z))},deleteMany:async({model:x,where:K})=>{let Y=q[x],L=F(K,x),Z=0;return q[x]=Y.filter((z)=>{if(L.includes(z))return Z++,!1;return!L.includes(z)}),Z},consumeOne:async({model:x,where:K})=>{let Y=q[x],L=F(K,x)[0];if(!L)return null;return q[x]=Y.filter((Z)=>Z!==L),L},updateMany({model:x,where:K,update:Y}){let L=F(K,x);return L.forEach((Z)=>{Object.assign(Z,Y)}),L[0]||null}}}});return(P)=>{return E=P,M(P)}};export{v as memoryAdapter};
2
+ import"./chunk-xg9xscqz.js";import{be as I,te as w}from"./chunk-xn9cpax1.js";import"./chunk-9zvteyz0.js";import"./chunk-t15a1vp6.js";function R(q,$){if(typeof q==="string"&&typeof $==="string")return q.toLowerCase()===$.toLowerCase();return q===$}function y(q,$){if(typeof q!=="string")return $.includes(q);return $.some((E)=>typeof E==="string"&&q.toLowerCase()===E.toLowerCase())}function j(q,$){return!y(q,$)}function g(q,$){if(typeof q!=="string"||typeof $!=="string")return!1;return q.toLowerCase().includes($.toLowerCase())}function f(q,$){if(typeof q!=="string"||typeof $!=="string")return!1;return q.toLowerCase().startsWith($.toLowerCase())}function V(q,$){if(typeof q!=="string"||typeof $!=="string")return!1;return q.toLowerCase().endsWith($.toLowerCase())}var v=(q,$)=>{let E=null,M=w({config:{adapterId:"memory",adapterName:"Memory Adapter",usePlural:!1,debugLogs:$?.debugLogs||!1,supportsArrays:!0,customTransformInput(P){if(P.options.advanced?.database?.generateId==="serial"&&P.field==="id"&&P.action==="create")return q[P.model].length+1;return P.data},transaction:async(P)=>{let A=structuredClone(q);try{return await P(M(E))}catch(_){throw Object.keys(q).forEach((S)=>{q[S]=A[S]}),_}}},adapter:({getFieldName:P,getDefaultFieldName:A,options:_,getModelName:S})=>{let N=(x,K,Y)=>{if(!K)return x;return x.sort((L,Z)=>{let z=P({model:Y,field:K.field}),D=L[z],X=Z[z],Q=0;if(D==null&&X==null)Q=0;else if(D==null)Q=-1;else if(X==null)Q=1;else if(typeof D==="string"&&typeof X==="string")Q=D.localeCompare(X);else if(D instanceof Date&&X instanceof Date)Q=D.getTime()-X.getTime();else if(typeof D==="number"&&typeof X==="number")Q=D-X;else if(typeof D==="boolean"&&typeof X==="boolean")Q=D===X?0:D?1:-1;else Q=String(D).localeCompare(String(X));return K.direction==="asc"?Q:-Q})};function F(x,K,Y,L){let Z=(()=>{let X=q[K];if(!X)throw I.error(`[MemoryAdapter] Model ${K} not found in the DB`,Object.keys(q)),Error(`Model ${K} not found`);let Q=(G,O)=>{let{field:J,value:H,operator:B,mode:k="sensitive"}=O,U=k==="insensitive"&&(typeof H==="string"||Array.isArray(H)&&H.every((W)=>typeof W==="string"));switch(B){case"in":if(!Array.isArray(H))throw Error("Value must be an array");if(U)return y(G[J],H);return H.includes(G[J]);case"not_in":if(!Array.isArray(H))throw Error("Value must be an array");if(U)return j(G[J],H);return!H.includes(G[J]);case"contains":if(U)return g(G[J],H);return G[J]?.includes(H);case"starts_with":if(U)return f(G[J],H);return G[J].startsWith(H);case"ends_with":if(U)return V(G[J],H);return G[J].endsWith(H);case"ne":return U?!R(G[J],H):G[J]!==H;case"gt":return H!=null&&Boolean(G[J]>H);case"gte":return H!=null&&Boolean(G[J]>=H);case"lt":return H!=null&&Boolean(G[J]<H);case"lte":return H!=null&&Boolean(G[J]<=H);default:if(U)return R(G[J],H);if(H===null)return G[J]==null;return G[J]===H}},T=X.filter((G)=>{if(!x.length||x.length===0)return!0;let O=Q(G,x[0]);for(let J of x){let H=Q(G,J);if(J.connector==="OR")O=O||H;else O=O&&H}return O});if(L?.length&&L.length>0)T=T.map((G)=>Object.fromEntries(Object.entries(G).filter(([O])=>L.includes(A({model:K,field:O})))));return T})();if(!Y)return Z;let z=new Map,D=new Map;for(let X of Z){let Q=String(X.id);if(!z.has(Q)){let G={...X};for(let[O,J]of Object.entries(Y)){let H=S(O);if(J.relation==="one-to-one")G[H]=null;else G[H]=[],D.set(`${Q}-${O}`,new Set)}z.set(Q,G)}let T=z.get(Q);for(let[G,O]of Object.entries(Y)){let J=S(G),H=q[J];if(!H)throw I.error(`[MemoryAdapter] JoinOption model ${J} not found in the DB`,Object.keys(q)),Error(`JoinOption model ${J} not found`);let B=H.filter((k)=>k[O.on.to]===X[O.on.from]);if(O.relation==="one-to-one")T[J]=B[0]||null;else{let k=D.get(`${Q}-${G}`),U=O.limit??100,W=0;for(let C of B){if(W>=U)break;if(!k.has(C.id))T[J].push(C),k.add(C.id),W++}}}}return Array.from(z.values())}return{create:async({model:x,data:K})=>{if(_.advanced?.database?.generateId==="serial")K.id=q[S(x)].length+1;if(!q[x])q[x]=[];return q[x].push(K),K},findOne:async({model:x,where:K,select:Y,join:L})=>{let Z=F(K,x,L,Y);if(L){let z=Z;if(!z.length)return null;return z[0]}return Z[0]||null},findMany:async({model:x,where:K,sortBy:Y,limit:L,select:Z,offset:z,join:D})=>{let X=F(K||[],x,D,Z);if(D){let T=X;if(!T.length)return[];N(T,Y,x);let G=T;if(z!==void 0)G=G.slice(z);if(L!==void 0)G=G.slice(0,L);return G}let Q=N(X,Y,x);if(z!==void 0)Q=Q.slice(z);if(L!==void 0)Q=Q.slice(0,L);return Q||[]},count:async({model:x,where:K})=>{if(K)return F(K,x).length;return q[x].length},update:async({model:x,where:K,update:Y})=>{let L=F(K,x);return L.forEach((Z)=>{Object.assign(Z,Y)}),L[0]||null},delete:async({model:x,where:K})=>{let Y=q[x],L=F(K,x);q[x]=Y.filter((Z)=>!L.includes(Z))},deleteMany:async({model:x,where:K})=>{let Y=q[x],L=F(K,x),Z=0;return q[x]=Y.filter((z)=>{if(L.includes(z))return Z++,!1;return!L.includes(z)}),Z},consumeOne:async({model:x,where:K})=>{let Y=q[x],L=F(K,x)[0];if(!L)return null;return q[x]=Y.filter((Z)=>Z!==L),L},updateMany({model:x,where:K,update:Y}){let L=F(K,x);return L.forEach((Z)=>{Object.assign(Z,Y)}),L[0]||null}}}});return(P)=>{return E=P,M(P)}};export{v as memoryAdapter};
@@ -0,0 +1 @@
1
+ import{b as RB,c as bB}from"./chunk-s1b5kf34.js";import{e as gB}from"./chunk-7436fyrg.js";import{i as LB,l as MB}from"./chunk-c0c88nje.js";import"./chunk-fwqpq2sy.js";import{I as NB}from"./chunk-804ndet8.js";import"./chunk-wpntb95k.js";import{Ha as DB}from"./chunk-5vwkfxy7.js";import"./chunk-8a75zqbz.js";import"./chunk-1cjgpspz.js";import"./chunk-x0r8dcq0.js";import"./chunk-tc7q988r.js";import"./chunk-yj6tmjsc.js";import{Oe as kB}from"./chunk-3823qzr0.js";import"./chunk-mggfc9ya.js";import{rf as VB,sf as wB}from"./chunk-vf3bg920.js";import{tf as EB}from"./chunk-xcbb21j9.js";import{uf as $B}from"./chunk-ey7vty63.js";import"./chunk-gpeyctxd.js";import"./chunk-9sdhdhv4.js";import"./chunk-9a7a1p1j.js";import"./chunk-wtzkfwmx.js";import{ug as PB}from"./chunk-m268vcdm.js";import{Ag as G,Ah as ZB,Bg as D,Bj as yB,Cg as HB,Fg as j,Hg as QB,Ng as qB,Pg as YB,Sg as TB,Zh as _B,ch as q,nh as p,tj as UB,wg as d,yg as XB,zg as zB}from"./chunk-eczsk2xd.js";import{Fk as KB}from"./chunk-t15a1vp6.js";var $=KB(XB(),1);var tB=({item:J})=>{if(J.preview?.thumbnailUrl)return G("img",{src:J.preview.thumbnailUrl,alt:"Preview",className:"w-full h-full object-cover"});if(J.preview?.proxyType==="audio"||J.proxyType==="audio")return G("div",{className:"w-full h-full flex items-center justify-center bg-muted",children:G(ZB,{className:"w-5 h-5 text-muted-foreground"})});return G("div",{className:"w-full h-full flex items-center justify-center bg-muted",children:G(_B,{className:"w-5 h-5 text-muted-foreground"})})},OB=({projectId:J,currentAssetId:X,parentFolderId:Q,initialFiles:_,initialNextCursor:w})=>{let{ref:z,inView:k}=$B({threshold:0,rootMargin:"200px"}),T=$.useRef(null),N=$.useRef(!1),[O,y]=$.useState(_),[Z,R]=$.useState(w),[b,S]=$.useState(!!w),[L,P]=$.useState(!1);return $.useEffect(()=>{y(_),R(w),S(!!w),N.current=!1},[_,w]),$.useEffect(()=>{(async()=>{if(!Z||L||!k||!b)return;P(!0);try{let W=await q.api.folders[":folderId"].search.$post({param:{folderId:Q},json:{assetType:"file",after:Z,first:200,recursively:!1,conditions:[]}});if(!W.ok)throw Error("Failed to fetch next page");let g=await W.json(),M=g.data||[];y((f)=>[...f,...M]),R(g.pageInfo?.cursor||void 0),S(!!g.pageInfo?.cursor&&M.length>0)}catch(W){console.error("Error fetching next page:",W)}finally{P(!1)}})()},[k,Z,b,L,Q]),$.useEffect(()=>{N.current=!1},[X]),$.useEffect(()=>{if(O.some((W)=>W?.id===X)&&T.current&&!N.current)T.current.scrollIntoView({block:"center",inline:"center",behavior:"smooth"}),N.current=!0},[O,X]),G("div",{className:"h-24 md:h-full w-full md:w-24 bg-gray-100 dark:bg-gray-950 flex flex-row md:flex-col flex-shrink-0 select-none",children:D("div",{className:"flex-1 overflow-x-auto overflow-y-hidden md:overflow-y-auto md:overflow-x-hidden px-4 md:px-0 py-2 md:py-4 flex flex-row md:flex-col items-center gap-3 no-scrollbar",children:[O.map((H)=>{if(!H)return null;let W=H.id===X;return G("div",{ref:H.id===X?T:null,className:"flex-shrink-0",children:G(YB,{to:"/projects/$projectId/files/$fileId",params:{projectId:J,fileId:H.id},search:{version:void 0},className:UB("rounded-lg border overflow-hidden flex items-center justify-center transition-all bg-muted/30 block",W?"w-[62px] h-[62px] opacity-100":"w-[52px] h-[52px] opacity-60 hover:opacity-100"),children:G(tB,{item:H})})},H.id)}),b&&G("div",{ref:z,className:"px-2 md:px-0 py-2 md:py-4 flex justify-center items-center h-full md:w-full flex-shrink-0",children:L&&G(p,{className:"h-5 w-5 animate-spin text-muted-foreground"})})]})})};var Y=KB(XB(),1);function eB(){let{projectId:J,fileId:X}=WB.useParams(),Q=WB.useSearch(),_=Q.version,w=Q.start,z=_||X,k=Q.cmpLeft,T=Q.cmpRight,N=Q.cmpActive??"left",O=!!Q.compare&&!!k&&!!T,y=Y.useRef(null),{teamId:Z,ensureTeamIdForProject:R}=PB(),[b,S]=Y.useState(360),[L,P]=Y.useState([]),{fileViewRightSidebarCollapsed:H}=EB(),{isChatbotOpen:W}=wB(),[g,M]=Y.useState(0),[f,C]=Y.useState(null),[l,AB]=Y.useState(null),[xB,jB]=Y.useState(void 0),[A,I]=Y.useState({show:!1,files:[],nextCursor:void 0,folderId:void 0}),SB=q.api.files[":fileId"].metadata.$patch,{mutate:CB}=QB({mutationFn:async(B)=>{let K=await SB(B);if(!K.ok)throw Error("Failed to patch metadata");return await K.json()}}),hB=HB(),{members:FB,fetchMembers:n}=NB();Y.useEffect(()=>{R(J)},[J,R]),Y.useEffect(()=>{if(Z)n(Z,!0)},[Z,n]);let{data:o,isLoading:vB,isError:pB,isFetching:fB}=j({queryKey:["files",X],queryFn:async()=>{let B=await q.api.files[":fileId"].$get({param:{fileId:X}});if(!B.ok)throw Error("Failed to fetch stack");return await B.json()},enabled:!!Z,placeholderData:d}),{data:IB,isLoading:mB,isError:uB,isFetching:cB}=j({queryKey:["files",_],queryFn:async()=>{let B=await q.api.files[":fileId"].$get({param:{fileId:_}});if(!B.ok)throw Error("Failed to fetch version");return await B.json()},enabled:!!Z&&!!_,placeholderData:d}),{data:dB}=j({queryKey:["version_stacks",X,"versions"],queryFn:async()=>{let B=await q.api.version_stacks[":stackId"].versions.$get({param:{stackId:X}});if(!B.ok)throw Error("Failed to fetch versions");return await B.json()},enabled:!!J&&!!X&&(!!_||O)}),{data:x}=j({queryKey:["projects",J],queryFn:async()=>{let B=await q.api.projects[":projectId"].$get({param:{projectId:J}});if(!B.ok)throw Error("Failed to fetch project");return await B.json()}}),h=qB(),{setProjectState:a,clearProjectState:r}=VB(),lB=vB||!!_&&mB,nB=pB||!!_&&uB,oB=fB||!!_&&cB,U=IB||o,V=_?dB:o?.versionStack?.versions;Y.useEffect(()=>{if(U&&x&&Z)a({teamId:Z,projectId:J,projectName:x.name??"",ancestorFolders:U.ancestorFolders??[],currentAsset:{name:U.name,type:"file",version:V?V.find((B)=>B.id===z)?.version??V.length:void 0,proxyType:U.proxyType},isRootFolder:!1,fileId:X,downloadInfo:{originalKey:U.media?.original?.key,videoTranscodes:U.media?.videoTranscodes?.map((B)=>({key:B.key,width:B.width,height:B.height,isRaw:B.isRaw}))},versions:V,compareMode:O,canCompareVersions:(V?.length??0)>=2,onCompareVersions:()=>{let B=LB(V);if(!B)return;h({to:"/projects/$projectId/files/$fileId",params:{projectId:J,fileId:X},search:(K)=>({...K,version:void 0,compare:!0,cmpLeft:B.left.id,cmpRight:B.right.id,cmpActive:"left"})})},onFolderClick:(B)=>{h({to:"/projects/$projectId/folders/$folderId",params:{projectId:J,folderId:B}})}});return()=>r()},[Z,J,x,U,V,z,X,O,a,r,h]);let E=U?.ancestorFolders?.[0]?.id??x?.rootFolder??"";if(Y.useEffect(()=>{if(!E||!z)return;if(A.folderId===E)return;let B=!0;return(async()=>{try{let F="",t=!1,e=[],BB=void 0;for(let GB=0;GB<5;GB++){let JB=await q.api.folders[":folderId"].search.$post({param:{folderId:E},json:{assetType:"file",after:F,first:200,recursively:!1,conditions:[]}});if(!JB.ok)throw Error("Failed to search parent folder for carousel");let v=await JB.json(),c=v.data||[];if(e.push(...c),c.some((sB)=>sB.id===z)){t=!0,BB=v.pageInfo?.cursor||void 0;break}if(!v.pageInfo?.cursor||c.length<200)break;F=v.pageInfo.cursor}if(B)if(t)I({show:!0,files:e,nextCursor:BB,folderId:E});else I({show:!1,files:[],nextCursor:void 0,folderId:E})}catch(F){if(console.error(F),B)I({show:!1,files:[],nextCursor:void 0,folderId:E})}})(),()=>{B=!1}},[E,z,A.folderId]),Y.useEffect(()=>{M(0),C(null),P([])},[U?.id]),Y.useEffect(()=>{C(null),P([])},[l?.id]),lB&&!U)return G(kB,{});if(nB||!U||!x||!Z)return G("div",{children:yB.file_not_found()});let m=O?l:U,i=m?.id??z,aB=(B,K)=>{if(!Z)return;CB({param:{fileId:i},json:[{key:B,value:K}]},{onSuccess:()=>{hB.invalidateQueries({queryKey:["files",i]})}})},u=(B)=>{h({to:"/projects/$projectId/files/$fileId",params:{projectId:J,fileId:X},search:(K)=>({...K,...B})})},rB=()=>{u({compare:void 0,cmpLeft:void 0,cmpRight:void 0,cmpActive:void 0,version:N==="left"?k:T})},iB=(B)=>{C(B.id||null);let K=B.annotations;if(K&&K.length>0)P(K);else P([]);if(O){if(B.second!==null&&B.second!==void 0)jB({second:B.second,nonce:Date.now()});return}if(B.second!==null&&B.second!==void 0)y.current?.seekTo(B.second),y.current?.pause();else if(K&&K.length>0)y.current?.pause()},s=()=>{P([]),C(null)};return G("div",{className:"h-full flex flex-1 flex-col bg-background",children:D("div",{className:"h-full flex flex-1 overflow-hidden",children:[D("div",{className:"flex-1 relative",children:[oB&&!O&&G("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-background/50",children:G(p,{className:"h-8 w-8 animate-spin text-foreground"})}),O&&k&&T?G(bB,{versions:V??[],leftId:k,rightId:T,activeSide:N,annotations:L,seekRequest:xB,onActiveSideChange:(B)=>u({cmpActive:B}),onSwitchVersion:(B,K)=>u(B==="left"?{cmpLeft:K}:{cmpRight:K}),onExit:rB,onActiveAssetChange:AB,onPlay:s,onTimeUpdate:M}):G(RB,{file:U,mediaControllerRef:y,onPlay:s,onTimeUpdate:M,annotations:L,startTime:w,children:A.show&&G(OB,{projectId:J,currentAssetId:z,parentFolderId:E,initialFiles:A.files,initialNextCursor:A.nextCursor})})]}),(!H||W)&&D(zB,{children:[G(DB,{onResize:(B)=>{S((K)=>Math.max(300,Math.min(600,K-B)))},className:"hidden md:block"}),G("div",{style:{width:b},className:"flex-shrink-0 bg-background flex flex-col",children:W?G(gB,{projectId:J,contextAssetId:z}):G(MB,{teamId:Z,projectId:J,file:m,onSaveField:aB,members:FB,onCommentSelect:iB,currentTime:g,onTyping:()=>{if(O)return;y.current?.pause()},selectedCommentId:f,hideAnnotationControl:m?.proxyType==="audio"})})]})]})})}var WB=TB("/projects/$projectId/files/$fileId")({component:eB});export{WB as Route};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  function x(f){let b={};for(let[w,q]of f.entries())b[w]=q;return b}function z(f){if(!f)return;let b={};for(let[w,q]of Object.entries(f))if(q!==null)b[w]=q;return Object.keys(b).length>0?b:void 0}
3
- export{x as nc,z as oc};
3
+ export{x as tk,z as uk};
@@ -1,2 +1,2 @@
1
- import{Fh as F,Mh as B}from"./chunk-b1e3tec3.js";var J=F((w,D)=>({metadata:{},isLoading:!1,error:null,fetchMetadata:async(A)=>{w({isLoading:!0,error:null});try{let h=await B.api.teams[":teamId"]["user-metadata"].$get({param:{teamId:A}});if(!h.ok)throw Error("failed to fetch user metadata");let C=(await h.json()).reduce((j,E)=>{return j[E.key]=E.value,j},{});w({metadata:C,isLoading:!1})}catch(h){w({error:h instanceof Error?h.message:String(h),isLoading:!1})}},setMetadata:async(A,h,q)=>{let C=D().metadata;w((j)=>({metadata:{...j.metadata,[h]:q}}));try{if(!(await B.api.teams[":teamId"]["user-metadata"][":key"].$put({param:{teamId:A,key:h},json:{value:q}})).ok)throw Error("failed to update user metadata")}catch(j){w({metadata:C}),console.error(j)}},getMetadata:(A,h)=>{let q=D().metadata[A];return q!==void 0?q:h}}));
2
- export{J as Af};
1
+ import{Xg as F,ch as B}from"./chunk-eczsk2xd.js";var J=F((w,D)=>({metadata:{},isLoading:!1,error:null,fetchMetadata:async(A)=>{w({isLoading:!0,error:null});try{let h=await B.api.teams[":teamId"]["user-metadata"].$get({param:{teamId:A}});if(!h.ok)throw Error("failed to fetch user metadata");let C=(await h.json()).reduce((j,E)=>{return j[E.key]=E.value,j},{});w({metadata:C,isLoading:!1})}catch(h){w({error:h instanceof Error?h.message:String(h),isLoading:!1})}},setMetadata:async(A,h,q)=>{let C=D().metadata;w((j)=>({metadata:{...j.metadata,[h]:q}}));try{if(!(await B.api.teams[":teamId"]["user-metadata"][":key"].$put({param:{teamId:A,key:h},json:{value:q}})).ok)throw Error("failed to update user metadata")}catch(j){w({metadata:C}),console.error(j)}},getMetadata:(A,h)=>{let q=D().metadata[A];return q!==void 0?q:h}}));
2
+ export{J as bg};
@@ -1,2 +1,2 @@
1
- import{sg as f}from"./chunk-yahb7wan.js";import{ih as b,jh as q}from"./chunk-b1e3tec3.js";function z(){return q("div",{className:"flex h-screen flex-col bg-background min-h-0",children:[q("div",{className:"flex h-14 items-center justify-between border-b px-6 shrink-0",children:[q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-4 w-24"}),b("span",{className:"text-muted-foreground",children:"/"}),b(f,{className:"h-4 w-32"})]}),q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-8 w-8 rounded-md"}),b(f,{className:"h-8 w-20 rounded-md"})]})]}),q("div",{className:"flex flex-1 overflow-hidden",children:[q("div",{className:"w-[240px] border-r p-4 space-y-4 hidden md:block shrink-0",children:[q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-4 w-4 rounded"}),b(f,{className:"h-4 w-24"})]}),q("div",{className:"pl-4 space-y-3",children:[q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-3 w-3 rounded"}),b(f,{className:"h-3 w-28"})]}),q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-3 w-3 rounded"}),b(f,{className:"h-3 w-20"})]}),q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-3 w-3 rounded"}),b(f,{className:"h-3 w-24"})]})]})]}),q("div",{className:"flex-1 p-6 space-y-6 overflow-y-auto",children:[q("div",{className:"flex items-center justify-between border-b pb-4",children:[q("div",{className:"flex items-center gap-4",children:[b(f,{className:"h-5 w-40"}),b(f,{className:"h-4 w-20"})]}),q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-8 w-8 rounded"}),b(f,{className:"h-8 w-8 rounded"}),b(f,{className:"h-8 w-32 rounded"})]})]}),q("div",{className:"space-y-4",children:[b("div",{className:"flex items-center gap-2",children:b(f,{className:"h-4 w-24"})}),b("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5",children:Array.from({length:10}).map((w,v)=>q("div",{className:"flex flex-col rounded-lg border bg-card p-3 space-y-3",children:[b(f,{className:"aspect-square w-full rounded-md"}),q("div",{className:"space-y-2",children:[b(f,{className:"h-4 w-3/4"}),q("div",{className:"flex justify-between items-center",children:[b(f,{className:"h-3 w-1/4"}),b(f,{className:"h-3 w-1/3"})]})]})]},v))})]})]})]})]})}function A(){return q("div",{className:"h-screen flex flex-col bg-background",children:[q("div",{className:"flex h-14 items-center justify-between border-b px-6 shrink-0",children:[q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-4 w-16"}),b("span",{className:"text-muted-foreground",children:"/"}),b(f,{className:"h-4 w-28"}),b("span",{className:"text-muted-foreground",children:"/"}),b(f,{className:"h-4 w-32"})]}),b("div",{className:"flex items-center gap-2",children:b(f,{className:"h-8 w-20 rounded"})})]}),q("div",{className:"flex flex-1 overflow-hidden",children:[q("div",{className:"w-[280px] border-r p-4 flex flex-col gap-4 shrink-0 hidden md:flex",children:[b(f,{className:"h-5 w-24"}),b("div",{className:"space-y-3 flex-1 overflow-y-auto",children:Array.from({length:4}).map((w,v)=>q("div",{className:"flex gap-3 p-2 rounded border",children:[b(f,{className:"h-12 w-12 rounded bg-muted shrink-0"}),q("div",{className:"space-y-2 flex-1",children:[b(f,{className:"h-3 w-2/3"}),b(f,{className:"h-2 w-1/2"})]})]},v))})]}),q("div",{className:"flex-1 bg-muted/20 p-6 flex flex-col justify-between relative min-w-0",children:[b("div",{className:"flex-1 flex items-center justify-center",children:b(f,{className:"w-full max-w-4xl aspect-video rounded-lg shadow-lg"})}),q("div",{className:"mt-4 flex items-center justify-between shrink-0",children:[q("div",{className:"flex items-center gap-4",children:[b(f,{className:"h-8 w-8 rounded-full"}),b(f,{className:"h-4 w-32"})]}),b(f,{className:"h-4 w-24"})]})]}),q("div",{className:"w-[360px] border-l p-4 flex flex-col gap-6 shrink-0 hidden lg:flex bg-card",children:[q("div",{className:"space-y-4",children:[b(f,{className:"h-5 w-32"}),b("div",{className:"space-y-3",children:Array.from({length:3}).map((w,v)=>q("div",{className:"flex justify-between items-center py-1 border-b",children:[b(f,{className:"h-3 w-20"}),b(f,{className:"h-3 w-32"})]},v))})]}),q("div",{className:"flex-1 flex flex-col gap-4",children:[b(f,{className:"h-5 w-24"}),b("div",{className:"space-y-3 flex-1 overflow-y-auto",children:Array.from({length:3}).map((w,v)=>q("div",{className:"flex gap-3 p-3 rounded-lg border bg-muted/10",children:[b(f,{className:"h-8 w-8 rounded-full shrink-0"}),q("div",{className:"space-y-2 flex-1",children:[q("div",{className:"flex justify-between",children:[b(f,{className:"h-3 w-24"}),b(f,{className:"h-2 w-12"})]}),b(f,{className:"h-3 w-full"}),b(f,{className:"h-3 w-5/6"})]})]},v))})]})]})]})]})}
2
- export{z as Bf,A as Cf};
1
+ import{vf as f}from"./chunk-ey7vty63.js";import{Ag as b,Bg as q}from"./chunk-eczsk2xd.js";function z(){return q("div",{className:"flex h-screen flex-col bg-background min-h-0",children:[q("div",{className:"flex h-14 items-center justify-between border-b px-6 shrink-0",children:[q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-4 w-24"}),b("span",{className:"text-muted-foreground",children:"/"}),b(f,{className:"h-4 w-32"})]}),q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-8 w-8 rounded-md"}),b(f,{className:"h-8 w-20 rounded-md"})]})]}),q("div",{className:"flex flex-1 overflow-hidden",children:[q("div",{className:"w-[240px] border-r p-4 space-y-4 hidden md:block shrink-0",children:[q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-4 w-4 rounded"}),b(f,{className:"h-4 w-24"})]}),q("div",{className:"pl-4 space-y-3",children:[q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-3 w-3 rounded"}),b(f,{className:"h-3 w-28"})]}),q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-3 w-3 rounded"}),b(f,{className:"h-3 w-20"})]}),q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-3 w-3 rounded"}),b(f,{className:"h-3 w-24"})]})]})]}),q("div",{className:"flex-1 p-6 space-y-6 overflow-y-auto",children:[q("div",{className:"flex items-center justify-between border-b pb-4",children:[q("div",{className:"flex items-center gap-4",children:[b(f,{className:"h-5 w-40"}),b(f,{className:"h-4 w-20"})]}),q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-8 w-8 rounded"}),b(f,{className:"h-8 w-8 rounded"}),b(f,{className:"h-8 w-32 rounded"})]})]}),q("div",{className:"space-y-4",children:[b("div",{className:"flex items-center gap-2",children:b(f,{className:"h-4 w-24"})}),b("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5",children:Array.from({length:10}).map((w,v)=>q("div",{className:"flex flex-col rounded-lg border bg-card p-3 space-y-3",children:[b(f,{className:"aspect-square w-full rounded-md"}),q("div",{className:"space-y-2",children:[b(f,{className:"h-4 w-3/4"}),q("div",{className:"flex justify-between items-center",children:[b(f,{className:"h-3 w-1/4"}),b(f,{className:"h-3 w-1/3"})]})]})]},v))})]})]})]})]})}function A(){return q("div",{className:"h-screen flex flex-col bg-background",children:[q("div",{className:"flex h-14 items-center justify-between border-b px-6 shrink-0",children:[q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-4 w-16"}),b("span",{className:"text-muted-foreground",children:"/"}),b(f,{className:"h-4 w-28"}),b("span",{className:"text-muted-foreground",children:"/"}),b(f,{className:"h-4 w-32"})]}),b("div",{className:"flex items-center gap-2",children:b(f,{className:"h-8 w-20 rounded"})})]}),q("div",{className:"flex flex-1 overflow-hidden",children:[q("div",{className:"w-[280px] border-r p-4 flex flex-col gap-4 shrink-0 hidden md:flex",children:[b(f,{className:"h-5 w-24"}),b("div",{className:"space-y-3 flex-1 overflow-y-auto",children:Array.from({length:4}).map((w,v)=>q("div",{className:"flex gap-3 p-2 rounded border",children:[b(f,{className:"h-12 w-12 rounded bg-muted shrink-0"}),q("div",{className:"space-y-2 flex-1",children:[b(f,{className:"h-3 w-2/3"}),b(f,{className:"h-2 w-1/2"})]})]},v))})]}),q("div",{className:"flex-1 bg-muted/20 p-6 flex flex-col justify-between relative min-w-0",children:[b("div",{className:"flex-1 flex items-center justify-center",children:b(f,{className:"w-full max-w-4xl aspect-video rounded-lg shadow-lg"})}),q("div",{className:"mt-4 flex items-center justify-between shrink-0",children:[q("div",{className:"flex items-center gap-4",children:[b(f,{className:"h-8 w-8 rounded-full"}),b(f,{className:"h-4 w-32"})]}),b(f,{className:"h-4 w-24"})]})]}),q("div",{className:"w-[360px] border-l p-4 flex flex-col gap-6 shrink-0 hidden lg:flex bg-card",children:[q("div",{className:"space-y-4",children:[b(f,{className:"h-5 w-32"}),b("div",{className:"space-y-3",children:Array.from({length:3}).map((w,v)=>q("div",{className:"flex justify-between items-center py-1 border-b",children:[b(f,{className:"h-3 w-20"}),b(f,{className:"h-3 w-32"})]},v))})]}),q("div",{className:"flex-1 flex flex-col gap-4",children:[b(f,{className:"h-5 w-24"}),b("div",{className:"space-y-3 flex-1 overflow-y-auto",children:Array.from({length:3}).map((w,v)=>q("div",{className:"flex gap-3 p-3 rounded-lg border bg-muted/10",children:[b(f,{className:"h-8 w-8 rounded-full shrink-0"}),q("div",{className:"space-y-2 flex-1",children:[q("div",{className:"flex justify-between",children:[b(f,{className:"h-3 w-24"}),b(f,{className:"h-2 w-12"})]}),b(f,{className:"h-3 w-full"}),b(f,{className:"h-3 w-5/6"})]})]},v))})]})]})]})]})}
2
+ export{z as Ne,A as Oe};
@@ -1,10 +1,10 @@
1
1
  // @bun
2
- import{Xk as I8,Yk as b,al as a}from"./chunk-ws07a9kv.js";var gZ=b((tU,fZ)=>{function O0(Z,$){if(typeof $==="boolean")$={forever:$};if(this._originalTimeouts=JSON.parse(JSON.stringify(Z)),this._timeouts=Z,this._options=$||{},this._maxRetryTime=$&&$.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever)this._cachedTimeouts=this._timeouts.slice(0)}fZ.exports=O0;O0.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};O0.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);if(this._timer)clearTimeout(this._timer);this._timeouts=[],this._cachedTimeouts=null};O0.prototype.retry=function(Z){if(this._timeout)clearTimeout(this._timeout);if(!Z)return!1;var $=new Date().getTime();if(Z&&$-this._operationStart>=this._maxRetryTime)return this._errors.push(Z),this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push(Z);var Q=this._timeouts.shift();if(Q===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),Q=this._cachedTimeouts.slice(-1);else return!1;var Y=this;if(this._timer=setTimeout(function(){if(Y._attempts++,Y._operationTimeoutCb){if(Y._timeout=setTimeout(function(){Y._operationTimeoutCb(Y._attempts)},Y._operationTimeout),Y._options.unref)Y._timeout.unref()}Y._fn(Y._attempts)},Q),this._options.unref)this._timer.unref();return!0};O0.prototype.attempt=function(Z,$){if(this._fn=Z,$){if($.timeout)this._operationTimeout=$.timeout;if($.cb)this._operationTimeoutCb=$.cb}var Q=this;if(this._operationTimeoutCb)this._timeout=setTimeout(function(){Q._operationTimeoutCb()},Q._operationTimeout);this._operationStart=new Date().getTime(),this._fn(this._attempts)};O0.prototype.try=function(Z){console.log("Using RetryOperation.try() is deprecated"),this.attempt(Z)};O0.prototype.start=function(Z){console.log("Using RetryOperation.start() is deprecated"),this.attempt(Z)};O0.prototype.start=O0.prototype.try;O0.prototype.errors=function(){return this._errors};O0.prototype.attempts=function(){return this._attempts};O0.prototype.mainError=function(){if(this._errors.length===0)return null;var Z={},$=null,Q=0;for(var Y=0;Y<this._errors.length;Y++){var W=this._errors[Y],J=W.message,K=(Z[J]||0)+1;if(Z[J]=K,K>=Q)$=W,Q=K}return $}});var mZ=b((kJ)=>{var hJ=gZ();kJ.operation=function(Z){var $=kJ.timeouts(Z);return new hJ($,{forever:Z&&(Z.forever||Z.retries===1/0),unref:Z&&Z.unref,maxRetryTime:Z&&Z.maxRetryTime})};kJ.timeouts=function(Z){if(Z instanceof Array)return[].concat(Z);var $={retries:10,factor:2,minTimeout:1000,maxTimeout:1/0,randomize:!1};for(var Q in Z)$[Q]=Z[Q];if($.minTimeout>$.maxTimeout)throw Error("minTimeout is greater than maxTimeout");var Y=[];for(var W=0;W<$.retries;W++)Y.push(this.createTimeout(W,$));if(Z&&Z.forever&&!Y.length)Y.push(this.createTimeout(W,$));return Y.sort(function(J,K){return J-K}),Y};kJ.createTimeout=function(Z,$){var Q=$.randomize?Math.random()+1:1,Y=Math.round(Q*Math.max($.minTimeout,1)*Math.pow($.factor,Z));return Y=Math.min(Y,$.maxTimeout),Y};kJ.wrap=function(Z,$,Q){if($ instanceof Array)Q=$,$=null;if(!Q){Q=[];for(var Y in Z)if(typeof Z[Y]==="function")Q.push(Y)}for(var W=0;W<Q.length;W++){var J=Q[W],K=Z[J];Z[J]=function(H){var w=kJ.operation($),F=Array.prototype.slice.call(arguments,1),z=F.pop();F.push(function(G){if(w.retry(G))return;if(G)arguments[0]=w.mainError();z.apply(this,arguments)}),w.attempt(function(){H.apply(Z,F)})}.bind(Z,K),Z[J].options=$}}});var dZ=b((ZD,H1)=>{var gJ=mZ(),bJ=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"];class z8 extends Error{constructor(Z){super();if(Z instanceof Error)this.originalError=Z,{message:Z}=Z;else this.originalError=Error(Z),this.originalError.stack=this.stack;this.name="AbortError",this.message=Z}}var mJ=(Z,$,Q)=>{let Y=Q.retries-($-1);return Z.attemptNumber=$,Z.retriesLeft=Y,Z},uJ=(Z)=>bJ.includes(Z),uZ=(Z,$)=>new Promise((Q,Y)=>{$={onFailedAttempt:()=>{},retries:10,...$};let W=gJ.operation($);W.attempt(async(J)=>{try{Q(await Z(J))}catch(K){if(!(K instanceof Error)){Y(TypeError(`Non-error was thrown: "${K}". You should only throw errors.`));return}if(K instanceof z8)W.stop(),Y(K.originalError);else if(K instanceof TypeError&&!uJ(K.message))W.stop(),Y(K);else{mJ(K,J,$);try{await $.onFailedAttempt(K)}catch(q){Y(q);return}if(!W.retry(K))Y(W.mainError())}}})});H1.exports=uZ;H1.exports.default=uZ;H1.exports.AbortError=z8});var F8=b(($D,sZ)=>{var w1=Object.prototype.hasOwnProperty,rZ=Object.prototype.toString,lZ=Object.defineProperty,cZ=Object.getOwnPropertyDescriptor,pZ=function($){if(typeof Array.isArray==="function")return Array.isArray($);return rZ.call($)==="[object Array]"},iZ=function($){if(!$||rZ.call($)!=="[object Object]")return!1;var Q=w1.call($,"constructor"),Y=$.constructor&&$.constructor.prototype&&w1.call($.constructor.prototype,"isPrototypeOf");if($.constructor&&!Q&&!Y)return!1;var W;for(W in $);return typeof W>"u"||w1.call($,W)},aZ=function($,Q){if(lZ&&Q.name==="__proto__")lZ($,Q.name,{enumerable:!0,configurable:!0,value:Q.newValue,writable:!0});else $[Q.name]=Q.newValue},nZ=function($,Q){if(Q==="__proto__"){if(!w1.call($,Q))return;else if(cZ)return cZ($,Q).value}return $[Q]};sZ.exports=function Z(){var $,Q,Y,W,J,K,q=arguments[0],H=1,w=arguments.length,F=!1;if(typeof q==="boolean")F=q,q=arguments[1]||{},H=2;if(q==null||typeof q!=="object"&&typeof q!=="function")q={};for(;H<w;++H)if($=arguments[H],$!=null){for(Q in $)if(Y=nZ(q,Q),W=nZ($,Q),q!==W){if(F&&W&&(iZ(W)||(J=pZ(W)))){if(J)J=!1,K=Y&&pZ(Y)?Y:[];else K=Y&&iZ(Y)?Y:{};aZ(q,{name:Q,newValue:Z(F,K,W)})}else if(typeof W<"u")aZ(q,{name:Q,newValue:W})}}return q}});var oZ=b((QD,dJ)=>{dJ.exports={name:"gaxios",version:"7.1.4",description:"A simple common HTTP client specifically for Google APIs and services.",main:"build/cjs/src/index.js",types:"build/cjs/src/index.d.ts",files:["build/"],exports:{".":{import:{types:"./build/esm/src/index.d.ts",default:"./build/esm/src/index.js"},require:{types:"./build/cjs/src/index.d.ts",default:"./build/cjs/src/index.js"}}},scripts:{lint:"gts check --no-inline-config",test:"c8 mocha build/esm/test","presystem-test":"npm run compile","system-test":"mocha build/esm/system-test --timeout 80000",compile:"tsc -b ./tsconfig.json ./tsconfig.cjs.json && node utils/enable-esm.mjs",fix:"gts fix",prepare:"npm run compile",pretest:"npm run compile",webpack:"webpack","prebrowser-test":"npm run compile","browser-test":"node build/browser-test/browser-test-runner.js",docs:"jsdoc -c .jsdoc.js","docs-test":"linkinator docs","predocs-test":"npm run docs","samples-test":"cd samples/ && npm link ../ && npm test && cd ../",prelint:"cd samples; npm link ../; npm install",clean:"gts clean"},repository:{type:"git",directory:"packages/gaxios",url:"https://github.com/googleapis/google-cloud-node-core.git"},keywords:["google"],engines:{node:">=18"},author:"Google, LLC",license:"Apache-2.0",devDependencies:{"@babel/plugin-proposal-private-methods":"^7.18.6","@types/cors":"^2.8.6","@types/express":"^5.0.0","@types/extend":"^3.0.1","@types/mocha":"^10.0.10","@types/multiparty":"4.2.1","@types/mv":"^2.1.0","@types/ncp":"^2.0.8","@types/node":"^22.13.1","@types/sinon":"^17.0.3","@types/tmp":"^0.2.6",assert:"^2.0.0",browserify:"^17.0.0",c8:"^10.1.3",cors:"^2.8.5",express:"^5.0.0",gts:"^6.0.2","is-docker":"^3.0.0",jsdoc:"^4.0.4","jsdoc-fresh":"^5.0.0","jsdoc-region-tag":"^4.0.0",karma:"^6.0.0","karma-chrome-launcher":"^3.0.0","karma-coverage":"^2.0.0","karma-firefox-launcher":"^2.0.0","karma-mocha":"^2.0.0","karma-remap-coverage":"^0.1.5","karma-sourcemap-loader":"^0.4.0","karma-webpack":"^5.0.1",linkinator:"^6.1.2",mocha:"^11.1.0",multiparty:"^4.2.1",mv:"^2.1.1",ncp:"^2.0.0",nock:"^14.0.5","null-loader":"^4.0.1","pack-n-play":"^4.0.0",puppeteer:"^24.0.0",sinon:"^21.0.0","stream-browserify":"^3.0.0",tmp:"0.2.5","ts-loader":"^9.5.2",typescript:"5.8.3",webpack:"^5.97.1","webpack-cli":"^6.0.1"},dependencies:{extend:"^3.0.2","https-proxy-agent":"^7.0.1","node-fetch":"^3.3.2"},homepage:"https://github.com/googleapis/google-cloud-node-core/tree/main/packages/gaxios"}});var eZ=b((YD,tZ)=>{var lJ=oZ();tZ.exports={pkg:lJ}});var D8=b((j0)=>{var $$=j0&&j0.__importDefault||function(Z){return Z&&Z.__esModule?Z:{default:Z}};Object.defineProperty(j0,"__esModule",{value:!0});j0.GaxiosError=j0.GAXIOS_ERROR_SYMBOL=void 0;j0.defaultErrorRedactor=Q$;var Z$=$$(F8()),cJ=$$(eZ()),G8=cJ.default.pkg;j0.GAXIOS_ERROR_SYMBOL=Symbol.for(`${G8.name}-gaxios-error`);class U8 extends Error{config;response;code;status;error;[j0.GAXIOS_ERROR_SYMBOL]=G8.version;static[Symbol.hasInstance](Z){if(Z&&typeof Z==="object"&&j0.GAXIOS_ERROR_SYMBOL in Z&&Z[j0.GAXIOS_ERROR_SYMBOL]===G8.version)return!0;return Function.prototype[Symbol.hasInstance].call(U8,Z)}constructor(Z,$,Q,Y){super(Z,{cause:Y});if(this.config=$,this.response=Q,this.error=Y instanceof Error?Y:void 0,this.config=(0,Z$.default)(!0,{},$),this.response)this.response.config=(0,Z$.default)(!0,{},this.response.config);if(this.response){try{this.response.data=pJ(this.config.responseType,this.response?.bodyUsed?this.response?.data:void 0)}catch{}this.status=this.response.status}if(Y instanceof DOMException)this.code=Y.name;else if(Y&&typeof Y==="object"&&"code"in Y&&(typeof Y.code==="string"||typeof Y.code==="number"))this.code=Y.code}static extractAPIErrorFromResponse(Z,$="The request failed"){let Q=$;if(typeof Z.data==="string")Q=Z.data;if(Z.data&&typeof Z.data==="object"&&"error"in Z.data&&Z.data.error&&!Z.ok){if(typeof Z.data.error==="string")return{message:Z.data.error,code:Z.status,status:Z.statusText};if(typeof Z.data.error==="object"){Q="message"in Z.data.error&&typeof Z.data.error.message==="string"?Z.data.error.message:Q;let Y="status"in Z.data.error&&typeof Z.data.error.status==="string"?Z.data.error.status:Z.statusText,W="code"in Z.data.error&&typeof Z.data.error.code==="number"?Z.data.error.code:Z.status;if("errors"in Z.data.error&&Array.isArray(Z.data.error.errors)){let J=[];for(let K of Z.data.error.errors)if(typeof K==="object"&&"message"in K&&typeof K.message==="string")J.push(K.message);return Object.assign({message:J.join(`
2
+ import{Fk as I8,Gk as b,Kk as a}from"./chunk-t15a1vp6.js";var gZ=b((tU,fZ)=>{function O0(Z,$){if(typeof $==="boolean")$={forever:$};if(this._originalTimeouts=JSON.parse(JSON.stringify(Z)),this._timeouts=Z,this._options=$||{},this._maxRetryTime=$&&$.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever)this._cachedTimeouts=this._timeouts.slice(0)}fZ.exports=O0;O0.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};O0.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);if(this._timer)clearTimeout(this._timer);this._timeouts=[],this._cachedTimeouts=null};O0.prototype.retry=function(Z){if(this._timeout)clearTimeout(this._timeout);if(!Z)return!1;var $=new Date().getTime();if(Z&&$-this._operationStart>=this._maxRetryTime)return this._errors.push(Z),this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push(Z);var Q=this._timeouts.shift();if(Q===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),Q=this._cachedTimeouts.slice(-1);else return!1;var Y=this;if(this._timer=setTimeout(function(){if(Y._attempts++,Y._operationTimeoutCb){if(Y._timeout=setTimeout(function(){Y._operationTimeoutCb(Y._attempts)},Y._operationTimeout),Y._options.unref)Y._timeout.unref()}Y._fn(Y._attempts)},Q),this._options.unref)this._timer.unref();return!0};O0.prototype.attempt=function(Z,$){if(this._fn=Z,$){if($.timeout)this._operationTimeout=$.timeout;if($.cb)this._operationTimeoutCb=$.cb}var Q=this;if(this._operationTimeoutCb)this._timeout=setTimeout(function(){Q._operationTimeoutCb()},Q._operationTimeout);this._operationStart=new Date().getTime(),this._fn(this._attempts)};O0.prototype.try=function(Z){console.log("Using RetryOperation.try() is deprecated"),this.attempt(Z)};O0.prototype.start=function(Z){console.log("Using RetryOperation.start() is deprecated"),this.attempt(Z)};O0.prototype.start=O0.prototype.try;O0.prototype.errors=function(){return this._errors};O0.prototype.attempts=function(){return this._attempts};O0.prototype.mainError=function(){if(this._errors.length===0)return null;var Z={},$=null,Q=0;for(var Y=0;Y<this._errors.length;Y++){var W=this._errors[Y],J=W.message,K=(Z[J]||0)+1;if(Z[J]=K,K>=Q)$=W,Q=K}return $}});var mZ=b((kJ)=>{var hJ=gZ();kJ.operation=function(Z){var $=kJ.timeouts(Z);return new hJ($,{forever:Z&&(Z.forever||Z.retries===1/0),unref:Z&&Z.unref,maxRetryTime:Z&&Z.maxRetryTime})};kJ.timeouts=function(Z){if(Z instanceof Array)return[].concat(Z);var $={retries:10,factor:2,minTimeout:1000,maxTimeout:1/0,randomize:!1};for(var Q in Z)$[Q]=Z[Q];if($.minTimeout>$.maxTimeout)throw Error("minTimeout is greater than maxTimeout");var Y=[];for(var W=0;W<$.retries;W++)Y.push(this.createTimeout(W,$));if(Z&&Z.forever&&!Y.length)Y.push(this.createTimeout(W,$));return Y.sort(function(J,K){return J-K}),Y};kJ.createTimeout=function(Z,$){var Q=$.randomize?Math.random()+1:1,Y=Math.round(Q*Math.max($.minTimeout,1)*Math.pow($.factor,Z));return Y=Math.min(Y,$.maxTimeout),Y};kJ.wrap=function(Z,$,Q){if($ instanceof Array)Q=$,$=null;if(!Q){Q=[];for(var Y in Z)if(typeof Z[Y]==="function")Q.push(Y)}for(var W=0;W<Q.length;W++){var J=Q[W],K=Z[J];Z[J]=function(H){var w=kJ.operation($),F=Array.prototype.slice.call(arguments,1),z=F.pop();F.push(function(G){if(w.retry(G))return;if(G)arguments[0]=w.mainError();z.apply(this,arguments)}),w.attempt(function(){H.apply(Z,F)})}.bind(Z,K),Z[J].options=$}}});var dZ=b((ZD,H1)=>{var gJ=mZ(),bJ=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"];class z8 extends Error{constructor(Z){super();if(Z instanceof Error)this.originalError=Z,{message:Z}=Z;else this.originalError=Error(Z),this.originalError.stack=this.stack;this.name="AbortError",this.message=Z}}var mJ=(Z,$,Q)=>{let Y=Q.retries-($-1);return Z.attemptNumber=$,Z.retriesLeft=Y,Z},uJ=(Z)=>bJ.includes(Z),uZ=(Z,$)=>new Promise((Q,Y)=>{$={onFailedAttempt:()=>{},retries:10,...$};let W=gJ.operation($);W.attempt(async(J)=>{try{Q(await Z(J))}catch(K){if(!(K instanceof Error)){Y(TypeError(`Non-error was thrown: "${K}". You should only throw errors.`));return}if(K instanceof z8)W.stop(),Y(K.originalError);else if(K instanceof TypeError&&!uJ(K.message))W.stop(),Y(K);else{mJ(K,J,$);try{await $.onFailedAttempt(K)}catch(q){Y(q);return}if(!W.retry(K))Y(W.mainError())}}})});H1.exports=uZ;H1.exports.default=uZ;H1.exports.AbortError=z8});var F8=b(($D,sZ)=>{var w1=Object.prototype.hasOwnProperty,rZ=Object.prototype.toString,lZ=Object.defineProperty,cZ=Object.getOwnPropertyDescriptor,pZ=function($){if(typeof Array.isArray==="function")return Array.isArray($);return rZ.call($)==="[object Array]"},iZ=function($){if(!$||rZ.call($)!=="[object Object]")return!1;var Q=w1.call($,"constructor"),Y=$.constructor&&$.constructor.prototype&&w1.call($.constructor.prototype,"isPrototypeOf");if($.constructor&&!Q&&!Y)return!1;var W;for(W in $);return typeof W>"u"||w1.call($,W)},aZ=function($,Q){if(lZ&&Q.name==="__proto__")lZ($,Q.name,{enumerable:!0,configurable:!0,value:Q.newValue,writable:!0});else $[Q.name]=Q.newValue},nZ=function($,Q){if(Q==="__proto__"){if(!w1.call($,Q))return;else if(cZ)return cZ($,Q).value}return $[Q]};sZ.exports=function Z(){var $,Q,Y,W,J,K,q=arguments[0],H=1,w=arguments.length,F=!1;if(typeof q==="boolean")F=q,q=arguments[1]||{},H=2;if(q==null||typeof q!=="object"&&typeof q!=="function")q={};for(;H<w;++H)if($=arguments[H],$!=null){for(Q in $)if(Y=nZ(q,Q),W=nZ($,Q),q!==W){if(F&&W&&(iZ(W)||(J=pZ(W)))){if(J)J=!1,K=Y&&pZ(Y)?Y:[];else K=Y&&iZ(Y)?Y:{};aZ(q,{name:Q,newValue:Z(F,K,W)})}else if(typeof W<"u")aZ(q,{name:Q,newValue:W})}}return q}});var oZ=b((QD,dJ)=>{dJ.exports={name:"gaxios",version:"7.1.4",description:"A simple common HTTP client specifically for Google APIs and services.",main:"build/cjs/src/index.js",types:"build/cjs/src/index.d.ts",files:["build/"],exports:{".":{import:{types:"./build/esm/src/index.d.ts",default:"./build/esm/src/index.js"},require:{types:"./build/cjs/src/index.d.ts",default:"./build/cjs/src/index.js"}}},scripts:{lint:"gts check --no-inline-config",test:"c8 mocha build/esm/test","presystem-test":"npm run compile","system-test":"mocha build/esm/system-test --timeout 80000",compile:"tsc -b ./tsconfig.json ./tsconfig.cjs.json && node utils/enable-esm.mjs",fix:"gts fix",prepare:"npm run compile",pretest:"npm run compile",webpack:"webpack","prebrowser-test":"npm run compile","browser-test":"node build/browser-test/browser-test-runner.js",docs:"jsdoc -c .jsdoc.js","docs-test":"linkinator docs","predocs-test":"npm run docs","samples-test":"cd samples/ && npm link ../ && npm test && cd ../",prelint:"cd samples; npm link ../; npm install",clean:"gts clean"},repository:{type:"git",directory:"packages/gaxios",url:"https://github.com/googleapis/google-cloud-node-core.git"},keywords:["google"],engines:{node:">=18"},author:"Google, LLC",license:"Apache-2.0",devDependencies:{"@babel/plugin-proposal-private-methods":"^7.18.6","@types/cors":"^2.8.6","@types/express":"^5.0.0","@types/extend":"^3.0.1","@types/mocha":"^10.0.10","@types/multiparty":"4.2.1","@types/mv":"^2.1.0","@types/ncp":"^2.0.8","@types/node":"^22.13.1","@types/sinon":"^17.0.3","@types/tmp":"^0.2.6",assert:"^2.0.0",browserify:"^17.0.0",c8:"^10.1.3",cors:"^2.8.5",express:"^5.0.0",gts:"^6.0.2","is-docker":"^3.0.0",jsdoc:"^4.0.4","jsdoc-fresh":"^5.0.0","jsdoc-region-tag":"^4.0.0",karma:"^6.0.0","karma-chrome-launcher":"^3.0.0","karma-coverage":"^2.0.0","karma-firefox-launcher":"^2.0.0","karma-mocha":"^2.0.0","karma-remap-coverage":"^0.1.5","karma-sourcemap-loader":"^0.4.0","karma-webpack":"^5.0.1",linkinator:"^6.1.2",mocha:"^11.1.0",multiparty:"^4.2.1",mv:"^2.1.1",ncp:"^2.0.0",nock:"^14.0.5","null-loader":"^4.0.1","pack-n-play":"^4.0.0",puppeteer:"^24.0.0",sinon:"^21.0.0","stream-browserify":"^3.0.0",tmp:"0.2.5","ts-loader":"^9.5.2",typescript:"5.8.3",webpack:"^5.97.1","webpack-cli":"^6.0.1"},dependencies:{extend:"^3.0.2","https-proxy-agent":"^7.0.1","node-fetch":"^3.3.2"},homepage:"https://github.com/googleapis/google-cloud-node-core/tree/main/packages/gaxios"}});var eZ=b((YD,tZ)=>{var lJ=oZ();tZ.exports={pkg:lJ}});var D8=b((j0)=>{var $$=j0&&j0.__importDefault||function(Z){return Z&&Z.__esModule?Z:{default:Z}};Object.defineProperty(j0,"__esModule",{value:!0});j0.GaxiosError=j0.GAXIOS_ERROR_SYMBOL=void 0;j0.defaultErrorRedactor=Q$;var Z$=$$(F8()),cJ=$$(eZ()),G8=cJ.default.pkg;j0.GAXIOS_ERROR_SYMBOL=Symbol.for(`${G8.name}-gaxios-error`);class U8 extends Error{config;response;code;status;error;[j0.GAXIOS_ERROR_SYMBOL]=G8.version;static[Symbol.hasInstance](Z){if(Z&&typeof Z==="object"&&j0.GAXIOS_ERROR_SYMBOL in Z&&Z[j0.GAXIOS_ERROR_SYMBOL]===G8.version)return!0;return Function.prototype[Symbol.hasInstance].call(U8,Z)}constructor(Z,$,Q,Y){super(Z,{cause:Y});if(this.config=$,this.response=Q,this.error=Y instanceof Error?Y:void 0,this.config=(0,Z$.default)(!0,{},$),this.response)this.response.config=(0,Z$.default)(!0,{},this.response.config);if(this.response){try{this.response.data=pJ(this.config.responseType,this.response?.bodyUsed?this.response?.data:void 0)}catch{}this.status=this.response.status}if(Y instanceof DOMException)this.code=Y.name;else if(Y&&typeof Y==="object"&&"code"in Y&&(typeof Y.code==="string"||typeof Y.code==="number"))this.code=Y.code}static extractAPIErrorFromResponse(Z,$="The request failed"){let Q=$;if(typeof Z.data==="string")Q=Z.data;if(Z.data&&typeof Z.data==="object"&&"error"in Z.data&&Z.data.error&&!Z.ok){if(typeof Z.data.error==="string")return{message:Z.data.error,code:Z.status,status:Z.statusText};if(typeof Z.data.error==="object"){Q="message"in Z.data.error&&typeof Z.data.error.message==="string"?Z.data.error.message:Q;let Y="status"in Z.data.error&&typeof Z.data.error.status==="string"?Z.data.error.status:Z.statusText,W="code"in Z.data.error&&typeof Z.data.error.code==="number"?Z.data.error.code:Z.status;if("errors"in Z.data.error&&Array.isArray(Z.data.error.errors)){let J=[];for(let K of Z.data.error.errors)if(typeof K==="object"&&"message"in K&&typeof K.message==="string")J.push(K.message);return Object.assign({message:J.join(`
3
3
  `)||Q,code:W,status:Y},Z.data.error)}return Object.assign({message:Q,code:W,status:Y},Z.data.error)}}return{message:Q,code:Z.status,status:Z.statusText}}}j0.GaxiosError=U8;function pJ(Z,$){switch(Z){case"stream":return $;case"json":return JSON.parse(JSON.stringify($));case"arraybuffer":return JSON.parse(Buffer.from($).toString("utf8"));case"blob":return JSON.parse($.text());default:return $}}function Q$(Z){function Q(J){if(!J)return;J.forEach((K,q)=>{if(/^authentication$/i.test(q)||/^authorization$/i.test(q)||/secret/i.test(q))J.set(q,"<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.")})}function Y(J,K){if(typeof J==="object"&&J!==null&&typeof J[K]==="string"){let q=J[K];if(/grant_type=/i.test(q)||/assertion=/i.test(q)||/secret/i.test(q))J[K]="<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>."}}function W(J){if(!J||typeof J!=="object")return;else if(J instanceof FormData||J instanceof URLSearchParams||"forEach"in J&&"set"in J)J.forEach((K,q)=>{if(["grant_type","assertion"].includes(q)||/secret/.test(q))J.set(q,"<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.")});else{if("grant_type"in J)J.grant_type="<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.";if("assertion"in J)J.assertion="<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.";if("client_secret"in J)J.client_secret="<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>."}}if(Z.config){if(Q(Z.config.headers),Y(Z.config,"data"),W(Z.config.data),Y(Z.config,"body"),W(Z.config.body),Z.config.url.searchParams.has("token"))Z.config.url.searchParams.set("token","<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.");if(Z.config.url.searchParams.has("client_secret"))Z.config.url.searchParams.set("client_secret","<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.")}if(Z.response){if(Q$({config:Z.response.config}),Q(Z.response.headers),Z.response.bodyUsed)Y(Z.response,"data"),W(Z.response.data)}return Z}});var V$=b((W$)=>{Object.defineProperty(W$,"__esModule",{value:!0});W$.getRetryConfig=iJ;async function iJ(Z){let $=Y$(Z);if(!Z||!Z.config||!$&&!Z.config.retry)return{shouldRetry:!1};$=$||{},$.currentRetryAttempt=$.currentRetryAttempt||0,$.retry=$.retry===void 0||$.retry===null?3:$.retry,$.httpMethodsToRetry=$.httpMethodsToRetry||["GET","HEAD","PUT","OPTIONS","DELETE"],$.noResponseRetries=$.noResponseRetries===void 0||$.noResponseRetries===null?2:$.noResponseRetries,$.retryDelayMultiplier=$.retryDelayMultiplier?$.retryDelayMultiplier:2,$.timeOfFirstRequest=$.timeOfFirstRequest?$.timeOfFirstRequest:Date.now(),$.totalTimeout=$.totalTimeout?$.totalTimeout:Number.MAX_SAFE_INTEGER,$.maxRetryDelay=$.maxRetryDelay?$.maxRetryDelay:Number.MAX_SAFE_INTEGER;let Q=[[100,199],[408,408],[429,429],[500,599]];if($.statusCodesToRetry=$.statusCodesToRetry||Q,Z.config.retryConfig=$,!await($.shouldRetry||aJ)(Z))return{shouldRetry:!1,config:Z.config};let W=nJ($);Z.config.retryConfig.currentRetryAttempt+=1;let J=$.retryBackoff?$.retryBackoff(Z,W):new Promise((K)=>{setTimeout(K,W)});if($.onRetryAttempt)await $.onRetryAttempt(Z);return await J,{shouldRetry:!0,config:Z.config}}function aJ(Z){let $=Y$(Z);if(Z.config.signal?.aborted&&Z.code!=="TimeoutError"||Z.code==="AbortError")return!1;if(!$||$.retry===0)return!1;if(!Z.response&&($.currentRetryAttempt||0)>=$.noResponseRetries)return!1;if(!$.httpMethodsToRetry||!$.httpMethodsToRetry.includes(Z.config.method?.toUpperCase()||"GET"))return!1;if(Z.response&&Z.response.status){let Q=!1;for(let[Y,W]of $.statusCodesToRetry){let J=Z.response.status;if(J>=Y&&J<=W){Q=!0;break}}if(!Q)return!1}if($.currentRetryAttempt=$.currentRetryAttempt||0,$.currentRetryAttempt>=$.retry)return!1;return!0}function Y$(Z){if(Z&&Z.config&&Z.config.retryConfig)return Z.config.retryConfig;return}function nJ(Z){let Q=(Z.currentRetryAttempt?0:Z.retryDelay??100)+(Math.pow(Z.retryDelayMultiplier,Z.currentRetryAttempt)-1)/2*1000,Y=Z.totalTimeout-(Date.now()-Z.timeOfFirstRequest);return Math.min(Q,Y,Z.maxRetryDelay)}});var M8=b((X$)=>{Object.defineProperty(X$,"__esModule",{value:!0});X$.GaxiosInterceptorManager=void 0;class J$ extends Set{}X$.GaxiosInterceptorManager=J$});var w$=b((T4)=>{var sJ=T4&&T4.__importDefault||function(Z){return Z&&Z.__esModule?Z:{default:Z}},N4;Object.defineProperty(T4,"__esModule",{value:!0});T4.Gaxios=void 0;var oJ=sJ(F8()),tJ=a("https"),z4=D8(),eJ=V$(),q$=a("stream"),H$=M8(),Z7=async()=>globalThis.crypto?.randomUUID()||(await import("crypto")).randomUUID(),$7=204;class N8{agentCache=new Map;defaults;interceptors;constructor(Z){this.defaults=Z||{},this.interceptors={request:new H$.GaxiosInterceptorManager,response:new H$.GaxiosInterceptorManager}}fetch(...Z){let $=Z[0],Q=Z[1],Y=void 0,W=new Headers;if(typeof $==="string")Y=new URL($);else if($ instanceof URL)Y=$;else if($&&$.url)Y=new URL($.url);if($&&typeof $==="object"&&"headers"in $)N4.mergeHeaders(W,$.headers);if(Q)N4.mergeHeaders(W,new Headers(Q.headers));if(typeof $==="object"&&!($ instanceof URL))return this.request({...Q,...$,headers:W,url:Y});else return this.request({...Q,headers:W,url:Y})}async request(Z={}){let $=await this.#Y(Z);return $=await this.#$($),this.#Q(this._request($))}async _defaultAdapter(Z){let $=Z.fetchImplementation||this.defaults.fetchImplementation||await N4.#K(),Q={...Z};delete Q.data;let Y=await $(Z.url,Q),W=await this.getResponseData(Z,Y);if(!Object.getOwnPropertyDescriptor(Y,"data")?.configurable)Object.defineProperties(Y,{data:{configurable:!0,writable:!0,enumerable:!0,value:W}});return Object.assign(Y,{config:Z,data:W})}async _request(Z){try{let $;if(Z.adapter)$=await Z.adapter(Z,this._defaultAdapter.bind(this));else $=await this._defaultAdapter(Z);if(!Z.validateStatus($.status)){if(Z.responseType==="stream"){let Y=[];for await(let W of $.data)Y.push(W);$.data=Y.toString()}let Q=z4.GaxiosError.extractAPIErrorFromResponse($,`Request failed with status code ${$.status}`);throw new z4.GaxiosError(Q?.message,Z,$,Q)}return $}catch($){let Q;if($ instanceof z4.GaxiosError)Q=$;else if($ instanceof Error)Q=new z4.GaxiosError($.message,Z,void 0,$);else Q=new z4.GaxiosError("Unexpected Gaxios Error",Z,void 0,$);let{shouldRetry:Y,config:W}=await(0,eJ.getRetryConfig)(Q);if(Y&&W)return Q.config.retryConfig.currentRetryAttempt=W.retryConfig.currentRetryAttempt,Z.retryConfig=Q.config?.retryConfig,this.#W(Z),this._request(Z);if(Z.errorRedactor)Z.errorRedactor(Q);throw Q}}async getResponseData(Z,$){if($.status===$7)return"";if(Z.maxContentLength&&$.headers.has("content-length")&&Z.maxContentLength<Number.parseInt($.headers?.get("content-length")||""))throw new z4.GaxiosError("Response's `Content-Length` is over the limit.",Z,Object.assign($,{config:Z}));switch(Z.responseType){case"stream":return $.body;case"json":{let Q=await $.text();try{return JSON.parse(Q)}catch{return Q}}case"arraybuffer":return $.arrayBuffer();case"blob":return $.blob();case"text":return $.text();default:return this.getResponseDataFromContentType($)}}#Z(Z,$=[]){let Q=new URL(Z),Y=[...$],W=(process.env.NO_PROXY??process.env.no_proxy)?.split(",")||[];for(let J of W)Y.push(J.trim());for(let J of Y)if(J instanceof RegExp){if(J.test(Q.toString()))return!1}else if(J instanceof URL){if(J.origin===Q.origin)return!1}else if(J.startsWith("*.")||J.startsWith(".")){let K=J.replace(/^\*\./,".");if(Q.hostname.endsWith(K))return!1}else if(J===Q.origin||J===Q.hostname||J===Q.href)return!1;return!0}async#$(Z){let $=Promise.resolve(Z);for(let Q of this.interceptors.request.values())if(Q)$=$.then(Q.resolved,Q.rejected);return $}async#Q(Z){let $=Promise.resolve(Z);for(let Q of this.interceptors.response.values())if(Q)$=$.then(Q.resolved,Q.rejected);return $}async#Y(Z){let $=new Headers(this.defaults.headers);N4.mergeHeaders($,Z.headers);let Q=(0,oJ.default)(!0,{},this.defaults,Z);if(!Q.url)throw Error("URL is required.");if(Q.baseURL)Q.url=new URL(Q.url,Q.baseURL);if(Q.url=new URL(Q.url),Q.params)if(Q.paramsSerializer){let J=Q.paramsSerializer(Q.params);if(J.startsWith("?"))J=J.slice(1);let K=Q.url.toString().includes("?")?"&":"?";Q.url=Q.url+K+J}else{let J=Q.url instanceof URL?Q.url:new URL(Q.url);for(let[K,q]of new URLSearchParams(Q.params))J.searchParams.append(K,q);Q.url=J}if(typeof Z.maxContentLength==="number")Q.size=Z.maxContentLength;if(typeof Z.maxRedirects==="number")Q.follow=Z.maxRedirects;let Y=typeof Q.data==="string"||Q.data instanceof ArrayBuffer||Q.data instanceof Blob||globalThis.File&&Q.data instanceof File||Q.data instanceof FormData||Q.data instanceof q$.Readable||Q.data instanceof ReadableStream||Q.data instanceof String||Q.data instanceof URLSearchParams||ArrayBuffer.isView(Q.data)||["Blob","File","FormData"].includes(Q.data?.constructor?.name||"");if(Q.multipart?.length){let J=await Z7();$.set("content-type",`multipart/related; boundary=${J}`),Q.body=q$.Readable.from(this.getMultipartRequest(Q.multipart,J))}else if(Y)Q.body=Q.data;else if(typeof Q.data==="object")if($.get("Content-Type")==="application/x-www-form-urlencoded")Q.body=Q.paramsSerializer?Q.paramsSerializer(Q.data):new URLSearchParams(Q.data);else{if(!$.has("content-type"))$.set("content-type","application/json");Q.body=JSON.stringify(Q.data)}else if(Q.data)Q.body=Q.data;if(Q.validateStatus=Q.validateStatus||this.validateStatus,Q.responseType=Q.responseType||"unknown",!$.has("accept")&&Q.responseType==="json")$.set("accept","application/json");let W=Q.proxy||process?.env?.HTTPS_PROXY||process?.env?.https_proxy||process?.env?.HTTP_PROXY||process?.env?.http_proxy;if(Q.agent);else if(W&&this.#Z(Q.url,Q.noProxy)){let J=await N4.#X();if(this.agentCache.has(W))Q.agent=this.agentCache.get(W);else Q.agent=new J(W,{cert:Q.cert,key:Q.key}),this.agentCache.set(W,Q.agent)}else if(Q.cert&&Q.key)if(this.agentCache.has(Q.key))Q.agent=this.agentCache.get(Q.key);else Q.agent=new tJ.Agent({cert:Q.cert,key:Q.key}),this.agentCache.set(Q.key,Q.agent);if(typeof Q.errorRedactor!=="function"&&Q.errorRedactor!==!1)Q.errorRedactor=z4.defaultErrorRedactor;if(Q.body&&!("duplex"in Q))Q.duplex="half";return this.#W(Q),Object.assign(Q,{headers:$,url:Q.url instanceof URL?Q.url:new URL(Q.url)})}#W(Z){if(Z.timeout){let $=AbortSignal.timeout(Z.timeout);if(Z.signal&&!Z.signal.aborted)Z.signal=AbortSignal.any([Z.signal,$]);else Z.signal=$}}validateStatus(Z){return Z>=200&&Z<300}async getResponseDataFromContentType(Z){let $=Z.headers.get("Content-Type");if($===null)return Z.text();if($=$.toLowerCase(),$.includes("application/json")){let Q=await Z.text();try{Q=JSON.parse(Q)}catch{}return Q}else if($.match(/^text\//))return Z.text();else return Z.blob()}async*getMultipartRequest(Z,$){let Q=`--${$}--`;for(let Y of Z){let W=Y.headers.get("Content-Type")||"application/octet-stream";if(yield`--${$}\r
4
4
  Content-Type: ${W}\r
5
5
  \r
6
6
  `,typeof Y.content==="string")yield Y.content;else yield*Y.content;yield`\r
7
- `}yield Q}static#V;static#J;static async#X(){return this.#V||=(await import("./chunk-arpna31w.js").then((m)=>I8(m.default))).HttpsProxyAgent,this.#V}static async#K(){let Z=typeof window<"u"&&!!window;return this.#J||=Z?window.fetch:(await import("node-fetch")).default,this.#J}static mergeHeaders(Z,...$){Z=Z instanceof Headers?Z:new Headers(Z);for(let Q of $)(Q instanceof Headers?Q:new Headers(Q)).forEach((W,J)=>{J==="set-cookie"?Z.append(J,W):Z.set(J,W)});return Z}}T4.Gaxios=N8;N4=N8});var G0=b((I0)=>{var Q7=I0&&I0.__createBinding||(Object.create?function(Z,$,Q,Y){if(Y===void 0)Y=Q;var W=Object.getOwnPropertyDescriptor($,Q);if(!W||("get"in W?!$.__esModule:W.writable||W.configurable))W={enumerable:!0,get:function(){return $[Q]}};Object.defineProperty(Z,Y,W)}:function(Z,$,Q,Y){if(Y===void 0)Y=Q;Z[Y]=$[Q]}),Y7=I0&&I0.__exportStar||function(Z,$){for(var Q in Z)if(Q!=="default"&&!Object.prototype.hasOwnProperty.call($,Q))Q7($,Z,Q)};Object.defineProperty(I0,"__esModule",{value:!0});I0.instance=I0.Gaxios=I0.GaxiosError=void 0;I0.request=V7;var z$=w$();Object.defineProperty(I0,"Gaxios",{enumerable:!0,get:function(){return z$.Gaxios}});var W7=D8();Object.defineProperty(I0,"GaxiosError",{enumerable:!0,get:function(){return W7.GaxiosError}});Y7(M8(),I0);I0.instance=new z$.Gaxios;async function V7(Z){return I0.instance.request(Z)}});var T8=b((F$,z1)=>{(function(Z){var $,Q=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Y=Math.ceil,W=Math.floor,J="[BigNumber Error] ",K=J+"Number primitive has more than 15 significant digits: ",q=100000000000000,H=14,w=9007199254740991,F=[1,10,100,1000,1e4,1e5,1e6,1e7,1e8,1e9,10000000000,100000000000,1000000000000,10000000000000],z=1e7,G=1e9;function D(f){var S,d,h,_=g.prototype={constructor:g,toString:null,valueOf:null},n=new g(1),o=20,t=4,J0=-7,$0=21,V0=-1e7,q0=1e7,L0=!1,R0=1,H0=0,H4={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},w4="0123456789abcdefghijklmnopqrstuvwxyz",X8=!0;function g(U,M){var N,v,L,A,j,B,R,E,C=this;if(!(C instanceof g))return new g(U,M);if(M==null){if(U&&U._isBigNumber===!0){if(C.s=U.s,!U.c||U.e>q0)C.c=C.e=null;else if(U.e<V0)C.c=[C.e=0];else C.e=U.e,C.c=U.c.slice();return}if((B=typeof U=="number")&&U*0==0){if(C.s=1/U<0?(U=-U,-1):1,U===~~U){for(A=0,j=U;j>=10;j/=10,A++);if(A>q0)C.c=C.e=null;else C.e=A,C.c=[U];return}E=String(U)}else{if(!Q.test(E=String(U)))return h(C,E,B);C.s=E.charCodeAt(0)==45?(E=E.slice(1),-1):1}if((A=E.indexOf("."))>-1)E=E.replace(".","");if((j=E.search(/e/i))>0){if(A<0)A=j;A+=+E.slice(j+1),E=E.substring(0,j)}else if(A<0)A=E.length}else{if(O(M,2,w4.length,"Base"),M==10&&X8)return C=new g(U),v0(C,o+C.e+1,t);if(E=String(U),B=typeof U=="number"){if(U*0!=0)return h(C,E,B,M);if(C.s=1/U<0?(E=E.slice(1),-1):1,g.DEBUG&&E.replace(/^0\.0*|\./,"").length>15)throw Error(K+U)}else C.s=E.charCodeAt(0)===45?(E=E.slice(1),-1):1;N=w4.slice(0,M),A=j=0;for(R=E.length;j<R;j++)if(N.indexOf(v=E.charAt(j))<0){if(v=="."){if(j>A){A=R;continue}}else if(!L){if(E==E.toUpperCase()&&(E=E.toLowerCase())||E==E.toLowerCase()&&(E=E.toUpperCase())){L=!0,j=-1,A=0;continue}}return h(C,String(U),B,M)}if(B=!1,E=d(E,M,10,C.s),(A=E.indexOf("."))>-1)E=E.replace(".","");else A=E.length}for(j=0;E.charCodeAt(j)===48;j++);for(R=E.length;E.charCodeAt(--R)===48;);if(E=E.slice(j,++R)){if(R-=j,B&&g.DEBUG&&R>15&&(U>w||U!==W(U)))throw Error(K+C.s*U);if((A=A-j-1)>q0)C.c=C.e=null;else if(A<V0)C.c=[C.e=0];else{if(C.e=A,C.c=[],j=(A+1)%H,A<0)j+=H;if(j<R){if(j)C.c.push(+E.slice(0,j));for(R-=H;j<R;)C.c.push(+E.slice(j,j+=H));j=H-(E=E.slice(j)).length}else j-=R;for(;j--;E+="0");C.c.push(+E)}}else C.c=[C.e=0]}g.clone=D,g.ROUND_UP=0,g.ROUND_DOWN=1,g.ROUND_CEIL=2,g.ROUND_FLOOR=3,g.ROUND_HALF_UP=4,g.ROUND_HALF_DOWN=5,g.ROUND_HALF_EVEN=6,g.ROUND_HALF_CEIL=7,g.ROUND_HALF_FLOOR=8,g.EUCLID=9,g.config=g.set=function(U){var M,N;if(U!=null)if(typeof U=="object"){if(U.hasOwnProperty(M="DECIMAL_PLACES"))N=U[M],O(N,0,G,M),o=N;if(U.hasOwnProperty(M="ROUNDING_MODE"))N=U[M],O(N,0,8,M),t=N;if(U.hasOwnProperty(M="EXPONENTIAL_AT"))if(N=U[M],N&&N.pop)O(N[0],-G,0,M),O(N[1],0,G,M),J0=N[0],$0=N[1];else O(N,-G,G,M),J0=-($0=N<0?-N:N);if(U.hasOwnProperty(M="RANGE"))if(N=U[M],N&&N.pop)O(N[0],-G,-1,M),O(N[1],1,G,M),V0=N[0],q0=N[1];else if(O(N,-G,G,M),N)V0=-(q0=N<0?-N:N);else throw Error(J+M+" cannot be zero: "+N);if(U.hasOwnProperty(M="CRYPTO"))if(N=U[M],N===!!N)if(N)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))L0=N;else throw L0=!N,Error(J+"crypto unavailable");else L0=N;else throw Error(J+M+" not true or false: "+N);if(U.hasOwnProperty(M="MODULO_MODE"))N=U[M],O(N,0,9,M),R0=N;if(U.hasOwnProperty(M="POW_PRECISION"))N=U[M],O(N,0,G,M),H0=N;if(U.hasOwnProperty(M="FORMAT"))if(N=U[M],typeof N=="object")H4=N;else throw Error(J+M+" not an object: "+N);if(U.hasOwnProperty(M="ALPHABET"))if(N=U[M],typeof N=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(N))X8=N.slice(0,10)=="0123456789",w4=N;else throw Error(J+M+" invalid: "+N)}else throw Error(J+"Object expected: "+U);return{DECIMAL_PLACES:o,ROUNDING_MODE:t,EXPONENTIAL_AT:[J0,$0],RANGE:[V0,q0],CRYPTO:L0,MODULO_MODE:R0,POW_PRECISION:H0,FORMAT:H4,ALPHABET:w4}},g.isBigNumber=function(U){if(!U||U._isBigNumber!==!0)return!1;if(!g.DEBUG)return!0;var M,N,v=U.c,L=U.e,A=U.s;Z:if({}.toString.call(v)=="[object Array]"){if((A===1||A===-1)&&L>=-G&&L<=G&&L===W(L)){if(v[0]===0){if(L===0&&v.length===1)return!0;break Z}if(M=(L+1)%H,M<1)M+=H;if(String(v[0]).length==M){for(M=0;M<v.length;M++)if(N=v[M],N<0||N>=q||N!==W(N))break Z;if(N!==0)return!0}}}else if(v===null&&L===null&&(A===null||A===1||A===-1))return!0;throw Error(J+"Invalid BigNumber: "+U)},g.maximum=g.max=function(){return xZ(arguments,-1)},g.minimum=g.min=function(){return xZ(arguments,1)},g.random=function(){var U=9007199254740992,M=Math.random()*U&2097151?function(){return W(Math.random()*U)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(N){var v,L,A,j,B,R=0,E=[],C=new g(n);if(N==null)N=o;else O(N,0,G);if(j=Y(N/H),L0)if(crypto.getRandomValues){v=crypto.getRandomValues(new Uint32Array(j*=2));for(;R<j;)if(B=v[R]*131072+(v[R+1]>>>11),B>=9000000000000000)L=crypto.getRandomValues(new Uint32Array(2)),v[R]=L[0],v[R+1]=L[1];else E.push(B%100000000000000),R+=2;R=j/2}else if(crypto.randomBytes){v=crypto.randomBytes(j*=7);for(;R<j;)if(B=(v[R]&31)*281474976710656+v[R+1]*1099511627776+v[R+2]*4294967296+v[R+3]*16777216+(v[R+4]<<16)+(v[R+5]<<8)+v[R+6],B>=9000000000000000)crypto.randomBytes(7).copy(v,R);else E.push(B%100000000000000),R+=7;R=j/7}else throw L0=!1,Error(J+"crypto unavailable");if(!L0){for(;R<j;)if(B=M(),B<9000000000000000)E[R++]=B%100000000000000}if(j=E[--R],N%=H,j&&N)B=F[H-N],E[R]=W(j/B)*B;for(;E[R]===0;E.pop(),R--);if(R<0)E=[A=0];else{for(A=-1;E[0]===0;E.splice(0,1),A-=H);for(R=1,B=E[0];B>=10;B/=10,R++);if(R<H)A-=H-R}return C.e=A,C.c=E,C}}(),g.sum=function(){var U=1,M=arguments,N=new g(M[0]);for(;U<M.length;)N=N.plus(M[U++]);return N},d=function(){var U="0123456789";function M(N,v,L,A){var j,B=[0],R,E=0,C=N.length;for(;E<C;){for(R=B.length;R--;B[R]*=v);B[0]+=A.indexOf(N.charAt(E++));for(j=0;j<B.length;j++)if(B[j]>L-1){if(B[j+1]==null)B[j+1]=0;B[j+1]+=B[j]/L|0,B[j]%=L}}return B.reverse()}return function(N,v,L,A,j){var B,R,E,C,k,c,p,Q0,X0=N.indexOf("."),z0=o,e=t;if(X0>=0)C=H0,H0=0,N=N.replace(".",""),Q0=new g(v),c=Q0.pow(N.length-X0),H0=C,Q0.c=M(m(I(c.c),c.e,"0"),10,L,U),Q0.e=Q0.c.length;p=M(N,v,L,j?(B=w4,U):(B=U,w4)),E=C=p.length;for(;p[--C]==0;p.pop());if(!p[0])return B.charAt(0);if(X0<0)--E;else c.c=p,c.e=E,c.s=A,c=S(c,Q0,z0,e,L),p=c.c,k=c.r,E=c.e;if(R=E+z0+1,X0=p[R],C=L/2,k=k||R<0||p[R+1]!=null,k=e<4?(X0!=null||k)&&(e==0||e==(c.s<0?3:2)):X0>C||X0==C&&(e==4||k||e==6&&p[R-1]&1||e==(c.s<0?8:7)),R<1||!p[0])N=k?m(B.charAt(1),-z0,B.charAt(0)):B.charAt(0);else{if(p.length=R,k){for(--L;++p[--R]>L;)if(p[R]=0,!R)++E,p=[1].concat(p)}for(C=p.length;!p[--C];);for(X0=0,N="";X0<=C;N+=B.charAt(p[X0++]));N=m(N,E,B.charAt(0))}return N}}(),S=function(){function U(v,L,A){var j,B,R,E,C=0,k=v.length,c=L%z,p=L/z|0;for(v=v.slice();k--;)R=v[k]%z,E=v[k]/z|0,j=p*R+E*c,B=c*R+j%z*z+C,C=(B/A|0)+(j/z|0)+p*E,v[k]=B%A;if(C)v=[C].concat(v);return v}function M(v,L,A,j){var B,R;if(A!=j)R=A>j?1:-1;else for(B=R=0;B<A;B++)if(v[B]!=L[B]){R=v[B]>L[B]?1:-1;break}return R}function N(v,L,A,j){var B=0;for(;A--;)v[A]-=B,B=v[A]<L[A]?1:0,v[A]=B*j+v[A]-L[A];for(;!v[0]&&v.length>1;v.splice(0,1));}return function(v,L,A,j,B){var R,E,C,k,c,p,Q0,X0,z0,e,Y0,D0,q1,H8,w8,l0,u4,E0=v.s==L.s?1:-1,M0=v.c,K0=L.c;if(!M0||!M0[0]||!K0||!K0[0])return new g(!v.s||!L.s||(M0?K0&&M0[0]==K0[0]:!K0)?NaN:M0&&M0[0]==0||!K0?E0*0:E0/0);if(X0=new g(E0),z0=X0.c=[],E=v.e-L.e,E0=A+E+1,!B)B=q,E=T(v.e/H)-T(L.e/H),E0=E0/H|0;for(C=0;K0[C]==(M0[C]||0);C++);if(K0[C]>(M0[C]||0))E--;if(E0<0)z0.push(1),k=!0;else{if(H8=M0.length,l0=K0.length,C=0,E0+=2,c=W(B/(K0[0]+1)),c>1)K0=U(K0,c,B),M0=U(M0,c,B),l0=K0.length,H8=M0.length;q1=l0,e=M0.slice(0,l0),Y0=e.length;for(;Y0<l0;e[Y0++]=0);if(u4=K0.slice(),u4=[0].concat(u4),w8=K0[0],K0[1]>=B/2)w8++;do{if(c=0,R=M(K0,e,l0,Y0),R<0){if(D0=e[0],l0!=Y0)D0=D0*B+(e[1]||0);if(c=W(D0/w8),c>1){if(c>=B)c=B-1;p=U(K0,c,B),Q0=p.length,Y0=e.length;while(M(p,e,Q0,Y0)==1)c--,N(p,l0<Q0?u4:K0,Q0,B),Q0=p.length,R=1}else{if(c==0)R=c=1;p=K0.slice(),Q0=p.length}if(Q0<Y0)p=[0].concat(p);if(N(e,p,Y0,B),Y0=e.length,R==-1)while(M(K0,e,l0,Y0)<1)c++,N(e,l0<Y0?u4:K0,Y0,B),Y0=e.length}else if(R===0)c++,e=[0];if(z0[C++]=c,e[0])e[Y0++]=M0[q1]||0;else e=[M0[q1]],Y0=1}while((q1++<H8||e[0]!=null)&&E0--);if(k=e[0]!=null,!z0[0])z0.splice(0,1)}if(B==q){for(C=1,E0=z0[0];E0>=10;E0/=10,C++);v0(X0,A+(X0.e=C+E*H-1)+1,j,k)}else X0.e=E,X0.r=+k;return X0}}();function K8(U,M,N,v){var L,A,j,B,R;if(N==null)N=t;else O(N,0,8);if(!U.c)return U.toString();if(L=U.c[0],j=U.e,M==null)R=I(U.c),R=v==1||v==2&&(j<=J0||j>=$0)?x(R,j):m(R,j,"0");else if(U=v0(new g(U),M,N),A=U.e,R=I(U.c),B=R.length,v==1||v==2&&(M<=A||A<=J0)){for(;B<M;R+="0",B++);R=x(R,A)}else if(M-=j+(v===2&&A>j),R=m(R,A,"0"),A+1>B){if(--M>0)for(R+=".";M--;R+="0");}else if(M+=A-B,M>0){if(A+1==B)R+=".";for(;M--;R+="0");}return U.s<0&&L?"-"+R:R}function xZ(U,M){var N,v,L=1,A=new g(U[0]);for(;L<U.length;L++)if(v=new g(U[L]),!v.s||(N=P(A,v))===M||N===0&&A.s===M)A=v;return A}function q8(U,M,N){var v=1,L=M.length;for(;!M[--L];M.pop());for(L=M[0];L>=10;L/=10,v++);if((N=v+N*H-1)>q0)U.c=U.e=null;else if(N<V0)U.c=[U.e=0];else U.e=N,U.c=M;return U}h=function(){var U=/^(-?)0([xbo])(?=\w[\w.]*$)/i,M=/^([^.]+)\.$/,N=/^\.([^.]+)$/,v=/^-?(Infinity|NaN)$/,L=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(A,j,B,R){var E,C=B?j:j.replace(L,"");if(v.test(C))A.s=isNaN(C)?null:C<0?-1:1;else{if(!B){if(C=C.replace(U,function(k,c,p){return E=(p=p.toLowerCase())=="x"?16:p=="b"?2:8,!R||R==E?c:k}),R)E=R,C=C.replace(M,"$1").replace(N,"0.$1");if(j!=C)return new g(C,E)}if(g.DEBUG)throw Error(J+"Not a"+(R?" base "+R:"")+" number: "+j);A.s=null}A.c=A.e=null}}();function v0(U,M,N,v){var L,A,j,B,R,E,C,k=U.c,c=F;if(k){Z:{for(L=1,B=k[0];B>=10;B/=10,L++);if(A=M-L,A<0)A+=H,j=M,R=k[E=0],C=W(R/c[L-j-1]%10);else if(E=Y((A+1)/H),E>=k.length)if(v){for(;k.length<=E;k.push(0));R=C=0,L=1,A%=H,j=A-H+1}else break Z;else{R=B=k[E];for(L=1;B>=10;B/=10,L++);A%=H,j=A-H+L,C=j<0?0:W(R/c[L-j-1]%10)}if(v=v||M<0||k[E+1]!=null||(j<0?R:R%c[L-j-1]),v=N<4?(C||v)&&(N==0||N==(U.s<0?3:2)):C>5||C==5&&(N==4||v||N==6&&(A>0?j>0?R/c[L-j]:0:k[E-1])%10&1||N==(U.s<0?8:7)),M<1||!k[0]){if(k.length=0,v)M-=U.e+1,k[0]=c[(H-M%H)%H],U.e=-M||0;else k[0]=U.e=0;return U}if(A==0)k.length=E,B=1,E--;else k.length=E+1,B=c[H-A],k[E]=j>0?W(R/c[L-j]%c[j])*B:0;if(v)for(;;)if(E==0){for(A=1,j=k[0];j>=10;j/=10,A++);j=k[0]+=B;for(B=1;j>=10;j/=10,B++);if(A!=B){if(U.e++,k[0]==q)k[0]=1}break}else{if(k[E]+=B,k[E]!=q)break;k[E--]=0,B=1}for(A=k.length;k[--A]===0;k.pop());}if(U.e>q0)U.c=U.e=null;else if(U.e<V0)U.c=[U.e=0]}return U}function n0(U){var M,N=U.e;if(N===null)return U.toString();return M=I(U.c),M=N<=J0||N>=$0?x(M,N):m(M,N,"0"),U.s<0?"-"+M:M}if(_.absoluteValue=_.abs=function(){var U=new g(this);if(U.s<0)U.s=1;return U},_.comparedTo=function(U,M){return P(this,new g(U,M))},_.decimalPlaces=_.dp=function(U,M){var N,v,L,A=this;if(U!=null){if(O(U,0,G),M==null)M=t;else O(M,0,8);return v0(new g(A),U+A.e+1,M)}if(!(N=A.c))return null;if(v=((L=N.length-1)-T(this.e/H))*H,L=N[L])for(;L%10==0;L/=10,v--);if(v<0)v=0;return v},_.dividedBy=_.div=function(U,M){return S(this,new g(U,M),o,t)},_.dividedToIntegerBy=_.idiv=function(U,M){return S(this,new g(U,M),0,1)},_.exponentiatedBy=_.pow=function(U,M){var N,v,L,A,j,B,R,E,C,k=this;if(U=new g(U),U.c&&!U.isInteger())throw Error(J+"Exponent not an integer: "+n0(U));if(M!=null)M=new g(M);if(B=U.e>14,!k.c||!k.c[0]||k.c[0]==1&&!k.e&&k.c.length==1||!U.c||!U.c[0])return C=new g(Math.pow(+n0(k),B?U.s*(2-y(U)):+n0(U))),M?C.mod(M):C;if(R=U.s<0,M){if(M.c?!M.c[0]:!M.s)return new g(NaN);if(v=!R&&k.isInteger()&&M.isInteger(),v)k=k.mod(M)}else if(U.e>9&&(k.e>0||k.e<-1||(k.e==0?k.c[0]>1||B&&k.c[1]>=240000000:k.c[0]<80000000000000||B&&k.c[0]<=99999750000000))){if(A=k.s<0&&y(U)?-0:0,k.e>-1)A=1/A;return new g(R?1/A:A)}else if(H0)A=Y(H0/H+2);if(B){if(N=new g(0.5),R)U.s=1;E=y(U)}else L=Math.abs(+n0(U)),E=L%2;C=new g(n);for(;;){if(E){if(C=C.times(k),!C.c)break;if(A){if(C.c.length>A)C.c.length=A}else if(v)C=C.mod(M)}if(L){if(L=W(L/2),L===0)break;E=L%2}else if(U=U.times(N),v0(U,U.e+1,1),U.e>14)E=y(U);else{if(L=+n0(U),L===0)break;E=L%2}if(k=k.times(k),A){if(k.c&&k.c.length>A)k.c.length=A}else if(v)k=k.mod(M)}if(v)return C;if(R)C=n.div(C);return M?C.mod(M):A?v0(C,H0,t,j):C},_.integerValue=function(U){var M=new g(this);if(U==null)U=t;else O(U,0,8);return v0(M,M.e+1,U)},_.isEqualTo=_.eq=function(U,M){return P(this,new g(U,M))===0},_.isFinite=function(){return!!this.c},_.isGreaterThan=_.gt=function(U,M){return P(this,new g(U,M))>0},_.isGreaterThanOrEqualTo=_.gte=function(U,M){return(M=P(this,new g(U,M)))===1||M===0},_.isInteger=function(){return!!this.c&&T(this.e/H)>this.c.length-2},_.isLessThan=_.lt=function(U,M){return P(this,new g(U,M))<0},_.isLessThanOrEqualTo=_.lte=function(U,M){return(M=P(this,new g(U,M)))===-1||M===0},_.isNaN=function(){return!this.s},_.isNegative=function(){return this.s<0},_.isPositive=function(){return this.s>0},_.isZero=function(){return!!this.c&&this.c[0]==0},_.minus=function(U,M){var N,v,L,A,j=this,B=j.s;if(U=new g(U,M),M=U.s,!B||!M)return new g(NaN);if(B!=M)return U.s=-M,j.plus(U);var R=j.e/H,E=U.e/H,C=j.c,k=U.c;if(!R||!E){if(!C||!k)return C?(U.s=-M,U):new g(k?j:NaN);if(!C[0]||!k[0])return k[0]?(U.s=-M,U):new g(C[0]?j:t==3?-0:0)}if(R=T(R),E=T(E),C=C.slice(),B=R-E){if(A=B<0)B=-B,L=C;else E=R,L=k;L.reverse();for(M=B;M--;L.push(0));L.reverse()}else{v=(A=(B=C.length)<(M=k.length))?B:M;for(B=M=0;M<v;M++)if(C[M]!=k[M]){A=C[M]<k[M];break}}if(A)L=C,C=k,k=L,U.s=-U.s;if(M=(v=k.length)-(N=C.length),M>0)for(;M--;C[N++]=0);M=q-1;for(;v>B;){if(C[--v]<k[v]){for(N=v;N&&!C[--N];C[N]=M);--C[N],C[v]+=q}C[v]-=k[v]}for(;C[0]==0;C.splice(0,1),--E);if(!C[0])return U.s=t==3?-1:1,U.c=[U.e=0],U;return q8(U,C,E)},_.modulo=_.mod=function(U,M){var N,v,L=this;if(U=new g(U,M),!L.c||!U.s||U.c&&!U.c[0])return new g(NaN);else if(!U.c||L.c&&!L.c[0])return new g(L);if(R0==9)v=U.s,U.s=1,N=S(L,U,0,3),U.s=v,N.s*=v;else N=S(L,U,0,R0);if(U=L.minus(N.times(U)),!U.c[0]&&R0==1)U.s=L.s;return U},_.multipliedBy=_.times=function(U,M){var N,v,L,A,j,B,R,E,C,k,c,p,Q0,X0,z0,e=this,Y0=e.c,D0=(U=new g(U,M)).c;if(!Y0||!D0||!Y0[0]||!D0[0]){if(!e.s||!U.s||Y0&&!Y0[0]&&!D0||D0&&!D0[0]&&!Y0)U.c=U.e=U.s=null;else if(U.s*=e.s,!Y0||!D0)U.c=U.e=null;else U.c=[0],U.e=0;return U}if(v=T(e.e/H)+T(U.e/H),U.s*=e.s,R=Y0.length,k=D0.length,R<k)Q0=Y0,Y0=D0,D0=Q0,L=R,R=k,k=L;for(L=R+k,Q0=[];L--;Q0.push(0));X0=q,z0=z;for(L=k;--L>=0;){N=0,c=D0[L]%z0,p=D0[L]/z0|0;for(j=R,A=L+j;A>L;)E=Y0[--j]%z0,C=Y0[j]/z0|0,B=p*E+C*c,E=c*E+B%z0*z0+Q0[A]+N,N=(E/X0|0)+(B/z0|0)+p*C,Q0[A--]=E%X0;Q0[A]=N}if(N)++v;else Q0.splice(0,1);return q8(U,Q0,v)},_.negated=function(){var U=new g(this);return U.s=-U.s||null,U},_.plus=function(U,M){var N,v=this,L=v.s;if(U=new g(U,M),M=U.s,!L||!M)return new g(NaN);if(L!=M)return U.s=-M,v.minus(U);var A=v.e/H,j=U.e/H,B=v.c,R=U.c;if(!A||!j){if(!B||!R)return new g(L/0);if(!B[0]||!R[0])return R[0]?U:new g(B[0]?v:L*0)}if(A=T(A),j=T(j),B=B.slice(),L=A-j){if(L>0)j=A,N=R;else L=-L,N=B;N.reverse();for(;L--;N.push(0));N.reverse()}if(L=B.length,M=R.length,L-M<0)N=R,R=B,B=N,M=L;for(L=0;M;)L=(B[--M]=B[M]+R[M]+L)/q|0,B[M]=q===B[M]?0:B[M]%q;if(L)B=[L].concat(B),++j;return q8(U,B,j)},_.precision=_.sd=function(U,M){var N,v,L,A=this;if(U!=null&&U!==!!U){if(O(U,1,G),M==null)M=t;else O(M,0,8);return v0(new g(A),U,M)}if(!(N=A.c))return null;if(L=N.length-1,v=L*H+1,L=N[L]){for(;L%10==0;L/=10,v--);for(L=N[0];L>=10;L/=10,v++);}if(U&&A.e+1>v)v=A.e+1;return v},_.shiftedBy=function(U){return O(U,-w,w),this.times("1e"+U)},_.squareRoot=_.sqrt=function(){var U,M,N,v,L,A=this,j=A.c,B=A.s,R=A.e,E=o+4,C=new g("0.5");if(B!==1||!j||!j[0])return new g(!B||B<0&&(!j||j[0])?NaN:j?A:1/0);if(B=Math.sqrt(+n0(A)),B==0||B==1/0){if(M=I(j),(M.length+R)%2==0)M+="0";if(B=Math.sqrt(+M),R=T((R+1)/2)-(R<0||R%2),B==1/0)M="5e"+R;else M=B.toExponential(),M=M.slice(0,M.indexOf("e")+1)+R;N=new g(M)}else N=new g(B+"");if(N.c[0]){if(R=N.e,B=R+E,B<3)B=0;for(;;)if(L=N,N=C.times(L.plus(S(A,L,E,1))),I(L.c).slice(0,B)===(M=I(N.c)).slice(0,B)){if(N.e<R)--B;if(M=M.slice(B-3,B+1),M=="9999"||!v&&M=="4999"){if(!v){if(v0(L,L.e+o+2,0),L.times(L).eq(A)){N=L;break}}E+=4,B+=4,v=1}else{if(!+M||!+M.slice(1)&&M.charAt(0)=="5")v0(N,N.e+o+2,1),U=!N.times(N).eq(A);break}}}return v0(N,N.e+o+1,t,U)},_.toExponential=function(U,M){if(U!=null)O(U,0,G),U++;return K8(this,U,M,1)},_.toFixed=function(U,M){if(U!=null)O(U,0,G),U=U+this.e+1;return K8(this,U,M)},_.toFormat=function(U,M,N){var v,L=this;if(N==null)if(U!=null&&M&&typeof M=="object")N=M,M=null;else if(U&&typeof U=="object")N=U,U=M=null;else N=H4;else if(typeof N!="object")throw Error(J+"Argument not an object: "+N);if(v=L.toFixed(U,M),L.c){var A,j=v.split("."),B=+N.groupSize,R=+N.secondaryGroupSize,E=N.groupSeparator||"",C=j[0],k=j[1],c=L.s<0,p=c?C.slice(1):C,Q0=p.length;if(R)A=B,B=R,R=A,Q0-=A;if(B>0&&Q0>0){A=Q0%B||B,C=p.substr(0,A);for(;A<Q0;A+=B)C+=E+p.substr(A,B);if(R>0)C+=E+p.slice(A);if(c)C="-"+C}v=k?C+(N.decimalSeparator||"")+((R=+N.fractionGroupSize)?k.replace(new RegExp("\\d{"+R+"}\\B","g"),"$&"+(N.fractionGroupSeparator||"")):k):C}return(N.prefix||"")+v+(N.suffix||"")},_.toFraction=function(U){var M,N,v,L,A,j,B,R,E,C,k,c,p=this,Q0=p.c;if(U!=null){if(B=new g(U),!B.isInteger()&&(B.c||B.s!==1)||B.lt(n))throw Error(J+"Argument "+(B.isInteger()?"out of range: ":"not an integer: ")+n0(B))}if(!Q0)return new g(p);M=new g(n),E=N=new g(n),v=R=new g(n),c=I(Q0),A=M.e=c.length-p.e-1,M.c[0]=F[(j=A%H)<0?H+j:j],U=!U||B.comparedTo(M)>0?A>0?M:E:B,j=q0,q0=1/0,B=new g(c),R.c[0]=0;for(;;){if(C=S(B,M,0,1),L=N.plus(C.times(v)),L.comparedTo(U)==1)break;N=v,v=L,E=R.plus(C.times(L=E)),R=L,M=B.minus(C.times(L=M)),B=L}return L=S(U.minus(N),v,0,1),R=R.plus(L.times(E)),N=N.plus(L.times(v)),R.s=E.s=p.s,A=A*2,k=S(E,v,A,t).minus(p).abs().comparedTo(S(R,N,A,t).minus(p).abs())<1?[E,v]:[R,N],q0=j,k},_.toNumber=function(){return+n0(this)},_.toPrecision=function(U,M){if(U!=null)O(U,1,G);return K8(this,U,M,2)},_.toString=function(U){var M,N=this,v=N.s,L=N.e;if(L===null)if(v){if(M="Infinity",v<0)M="-"+M}else M="NaN";else{if(U==null)M=L<=J0||L>=$0?x(I(N.c),L):m(I(N.c),L,"0");else if(U===10&&X8)N=v0(new g(N),o+L+1,t),M=m(I(N.c),N.e,"0");else O(U,2,w4.length,"Base"),M=d(m(I(N.c),L,"0"),10,U,v,!0);if(v<0&&N.c[0])M="-"+M}return M},_.valueOf=_.toJSON=function(){return n0(this)},_._isBigNumber=!0,f!=null)g.set(f);return g}function T(f){var S=f|0;return f>0||f===S?S:S-1}function I(f){var S,d,h=1,_=f.length,n=f[0]+"";for(;h<_;){S=f[h++]+"",d=H-S.length;for(;d--;S="0"+S);n+=S}for(_=n.length;n.charCodeAt(--_)===48;);return n.slice(0,_+1||1)}function P(f,S){var d,h,_=f.c,n=S.c,o=f.s,t=S.s,J0=f.e,$0=S.e;if(!o||!t)return null;if(d=_&&!_[0],h=n&&!n[0],d||h)return d?h?0:-t:o;if(o!=t)return o;if(d=o<0,h=J0==$0,!_||!n)return h?0:!_^d?1:-1;if(!h)return J0>$0^d?1:-1;t=(J0=_.length)<($0=n.length)?J0:$0;for(o=0;o<t;o++)if(_[o]!=n[o])return _[o]>n[o]^d?1:-1;return J0==$0?0:J0>$0^d?1:-1}function O(f,S,d,h){if(f<S||f>d||f!==W(f))throw Error(J+(h||"Argument")+(typeof f=="number"?f<S||f>d?" out of range: ":" not an integer: ":" not a primitive number: ")+String(f))}function y(f){var S=f.c.length-1;return T(f.e/H)==S&&f.c[S]%2!=0}function x(f,S){return(f.length>1?f.charAt(0)+"."+f.slice(1):f)+(S<0?"e":"e+")+S}function m(f,S,d){var h,_;if(S<0){for(_=d+".";++S;_+=d);f=_+f}else if(h=f.length,++S>h){for(_=d,S-=h;--S;_+=d);f+=_}else if(S<h)f=f.slice(0,S)+"."+f.slice(S);return f}if($=D(),$.default=$.BigNumber=$,typeof define=="function"&&define.amd)define(function(){return $});else if(typeof z1<"u"&&z1.exports)z1.exports=$;else{if(!Z)Z=typeof self<"u"&&self?self:window;Z.BigNumber=$}})(F$)});var M$=b((qD,D$)=>{var G$=T8(),U$=qD;(function(){function Z(w){return w<10?"0"+w:w}var $=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,Q=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,Y,W,J={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':"\\\"","\\":"\\\\"},K;function q(w){return Q.lastIndex=0,Q.test(w)?'"'+w.replace(Q,function(F){var z=J[F];return typeof z==="string"?z:"\\u"+("0000"+F.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+w+'"'}function H(w,F){var z,G,D,T,I=Y,P,O=F[w],y=O!=null&&(O instanceof G$||G$.isBigNumber(O));if(O&&typeof O==="object"&&typeof O.toJSON==="function")O=O.toJSON(w);if(typeof K==="function")O=K.call(F,w,O);switch(typeof O){case"string":if(y)return O;else return q(O);case"number":return isFinite(O)?String(O):"null";case"boolean":case"null":case"bigint":return String(O);case"object":if(!O)return"null";if(Y+=W,P=[],Object.prototype.toString.apply(O)==="[object Array]"){T=O.length;for(z=0;z<T;z+=1)P[z]=H(z,O)||"null";return D=P.length===0?"[]":Y?`[
7
+ `}yield Q}static#V;static#J;static async#X(){return this.#V||=(await import("./chunk-rt0pvhdf.js").then((m)=>I8(m.default))).HttpsProxyAgent,this.#V}static async#K(){let Z=typeof window<"u"&&!!window;return this.#J||=Z?window.fetch:(await import("node-fetch")).default,this.#J}static mergeHeaders(Z,...$){Z=Z instanceof Headers?Z:new Headers(Z);for(let Q of $)(Q instanceof Headers?Q:new Headers(Q)).forEach((W,J)=>{J==="set-cookie"?Z.append(J,W):Z.set(J,W)});return Z}}T4.Gaxios=N8;N4=N8});var G0=b((I0)=>{var Q7=I0&&I0.__createBinding||(Object.create?function(Z,$,Q,Y){if(Y===void 0)Y=Q;var W=Object.getOwnPropertyDescriptor($,Q);if(!W||("get"in W?!$.__esModule:W.writable||W.configurable))W={enumerable:!0,get:function(){return $[Q]}};Object.defineProperty(Z,Y,W)}:function(Z,$,Q,Y){if(Y===void 0)Y=Q;Z[Y]=$[Q]}),Y7=I0&&I0.__exportStar||function(Z,$){for(var Q in Z)if(Q!=="default"&&!Object.prototype.hasOwnProperty.call($,Q))Q7($,Z,Q)};Object.defineProperty(I0,"__esModule",{value:!0});I0.instance=I0.Gaxios=I0.GaxiosError=void 0;I0.request=V7;var z$=w$();Object.defineProperty(I0,"Gaxios",{enumerable:!0,get:function(){return z$.Gaxios}});var W7=D8();Object.defineProperty(I0,"GaxiosError",{enumerable:!0,get:function(){return W7.GaxiosError}});Y7(M8(),I0);I0.instance=new z$.Gaxios;async function V7(Z){return I0.instance.request(Z)}});var T8=b((F$,z1)=>{(function(Z){var $,Q=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Y=Math.ceil,W=Math.floor,J="[BigNumber Error] ",K=J+"Number primitive has more than 15 significant digits: ",q=100000000000000,H=14,w=9007199254740991,F=[1,10,100,1000,1e4,1e5,1e6,1e7,1e8,1e9,10000000000,100000000000,1000000000000,10000000000000],z=1e7,G=1e9;function D(f){var S,d,h,_=g.prototype={constructor:g,toString:null,valueOf:null},n=new g(1),o=20,t=4,J0=-7,$0=21,V0=-1e7,q0=1e7,L0=!1,R0=1,H0=0,H4={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},w4="0123456789abcdefghijklmnopqrstuvwxyz",X8=!0;function g(U,M){var N,v,L,A,j,B,R,E,C=this;if(!(C instanceof g))return new g(U,M);if(M==null){if(U&&U._isBigNumber===!0){if(C.s=U.s,!U.c||U.e>q0)C.c=C.e=null;else if(U.e<V0)C.c=[C.e=0];else C.e=U.e,C.c=U.c.slice();return}if((B=typeof U=="number")&&U*0==0){if(C.s=1/U<0?(U=-U,-1):1,U===~~U){for(A=0,j=U;j>=10;j/=10,A++);if(A>q0)C.c=C.e=null;else C.e=A,C.c=[U];return}E=String(U)}else{if(!Q.test(E=String(U)))return h(C,E,B);C.s=E.charCodeAt(0)==45?(E=E.slice(1),-1):1}if((A=E.indexOf("."))>-1)E=E.replace(".","");if((j=E.search(/e/i))>0){if(A<0)A=j;A+=+E.slice(j+1),E=E.substring(0,j)}else if(A<0)A=E.length}else{if(O(M,2,w4.length,"Base"),M==10&&X8)return C=new g(U),v0(C,o+C.e+1,t);if(E=String(U),B=typeof U=="number"){if(U*0!=0)return h(C,E,B,M);if(C.s=1/U<0?(E=E.slice(1),-1):1,g.DEBUG&&E.replace(/^0\.0*|\./,"").length>15)throw Error(K+U)}else C.s=E.charCodeAt(0)===45?(E=E.slice(1),-1):1;N=w4.slice(0,M),A=j=0;for(R=E.length;j<R;j++)if(N.indexOf(v=E.charAt(j))<0){if(v=="."){if(j>A){A=R;continue}}else if(!L){if(E==E.toUpperCase()&&(E=E.toLowerCase())||E==E.toLowerCase()&&(E=E.toUpperCase())){L=!0,j=-1,A=0;continue}}return h(C,String(U),B,M)}if(B=!1,E=d(E,M,10,C.s),(A=E.indexOf("."))>-1)E=E.replace(".","");else A=E.length}for(j=0;E.charCodeAt(j)===48;j++);for(R=E.length;E.charCodeAt(--R)===48;);if(E=E.slice(j,++R)){if(R-=j,B&&g.DEBUG&&R>15&&(U>w||U!==W(U)))throw Error(K+C.s*U);if((A=A-j-1)>q0)C.c=C.e=null;else if(A<V0)C.c=[C.e=0];else{if(C.e=A,C.c=[],j=(A+1)%H,A<0)j+=H;if(j<R){if(j)C.c.push(+E.slice(0,j));for(R-=H;j<R;)C.c.push(+E.slice(j,j+=H));j=H-(E=E.slice(j)).length}else j-=R;for(;j--;E+="0");C.c.push(+E)}}else C.c=[C.e=0]}g.clone=D,g.ROUND_UP=0,g.ROUND_DOWN=1,g.ROUND_CEIL=2,g.ROUND_FLOOR=3,g.ROUND_HALF_UP=4,g.ROUND_HALF_DOWN=5,g.ROUND_HALF_EVEN=6,g.ROUND_HALF_CEIL=7,g.ROUND_HALF_FLOOR=8,g.EUCLID=9,g.config=g.set=function(U){var M,N;if(U!=null)if(typeof U=="object"){if(U.hasOwnProperty(M="DECIMAL_PLACES"))N=U[M],O(N,0,G,M),o=N;if(U.hasOwnProperty(M="ROUNDING_MODE"))N=U[M],O(N,0,8,M),t=N;if(U.hasOwnProperty(M="EXPONENTIAL_AT"))if(N=U[M],N&&N.pop)O(N[0],-G,0,M),O(N[1],0,G,M),J0=N[0],$0=N[1];else O(N,-G,G,M),J0=-($0=N<0?-N:N);if(U.hasOwnProperty(M="RANGE"))if(N=U[M],N&&N.pop)O(N[0],-G,-1,M),O(N[1],1,G,M),V0=N[0],q0=N[1];else if(O(N,-G,G,M),N)V0=-(q0=N<0?-N:N);else throw Error(J+M+" cannot be zero: "+N);if(U.hasOwnProperty(M="CRYPTO"))if(N=U[M],N===!!N)if(N)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))L0=N;else throw L0=!N,Error(J+"crypto unavailable");else L0=N;else throw Error(J+M+" not true or false: "+N);if(U.hasOwnProperty(M="MODULO_MODE"))N=U[M],O(N,0,9,M),R0=N;if(U.hasOwnProperty(M="POW_PRECISION"))N=U[M],O(N,0,G,M),H0=N;if(U.hasOwnProperty(M="FORMAT"))if(N=U[M],typeof N=="object")H4=N;else throw Error(J+M+" not an object: "+N);if(U.hasOwnProperty(M="ALPHABET"))if(N=U[M],typeof N=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(N))X8=N.slice(0,10)=="0123456789",w4=N;else throw Error(J+M+" invalid: "+N)}else throw Error(J+"Object expected: "+U);return{DECIMAL_PLACES:o,ROUNDING_MODE:t,EXPONENTIAL_AT:[J0,$0],RANGE:[V0,q0],CRYPTO:L0,MODULO_MODE:R0,POW_PRECISION:H0,FORMAT:H4,ALPHABET:w4}},g.isBigNumber=function(U){if(!U||U._isBigNumber!==!0)return!1;if(!g.DEBUG)return!0;var M,N,v=U.c,L=U.e,A=U.s;Z:if({}.toString.call(v)=="[object Array]"){if((A===1||A===-1)&&L>=-G&&L<=G&&L===W(L)){if(v[0]===0){if(L===0&&v.length===1)return!0;break Z}if(M=(L+1)%H,M<1)M+=H;if(String(v[0]).length==M){for(M=0;M<v.length;M++)if(N=v[M],N<0||N>=q||N!==W(N))break Z;if(N!==0)return!0}}}else if(v===null&&L===null&&(A===null||A===1||A===-1))return!0;throw Error(J+"Invalid BigNumber: "+U)},g.maximum=g.max=function(){return xZ(arguments,-1)},g.minimum=g.min=function(){return xZ(arguments,1)},g.random=function(){var U=9007199254740992,M=Math.random()*U&2097151?function(){return W(Math.random()*U)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(N){var v,L,A,j,B,R=0,E=[],C=new g(n);if(N==null)N=o;else O(N,0,G);if(j=Y(N/H),L0)if(crypto.getRandomValues){v=crypto.getRandomValues(new Uint32Array(j*=2));for(;R<j;)if(B=v[R]*131072+(v[R+1]>>>11),B>=9000000000000000)L=crypto.getRandomValues(new Uint32Array(2)),v[R]=L[0],v[R+1]=L[1];else E.push(B%100000000000000),R+=2;R=j/2}else if(crypto.randomBytes){v=crypto.randomBytes(j*=7);for(;R<j;)if(B=(v[R]&31)*281474976710656+v[R+1]*1099511627776+v[R+2]*4294967296+v[R+3]*16777216+(v[R+4]<<16)+(v[R+5]<<8)+v[R+6],B>=9000000000000000)crypto.randomBytes(7).copy(v,R);else E.push(B%100000000000000),R+=7;R=j/7}else throw L0=!1,Error(J+"crypto unavailable");if(!L0){for(;R<j;)if(B=M(),B<9000000000000000)E[R++]=B%100000000000000}if(j=E[--R],N%=H,j&&N)B=F[H-N],E[R]=W(j/B)*B;for(;E[R]===0;E.pop(),R--);if(R<0)E=[A=0];else{for(A=-1;E[0]===0;E.splice(0,1),A-=H);for(R=1,B=E[0];B>=10;B/=10,R++);if(R<H)A-=H-R}return C.e=A,C.c=E,C}}(),g.sum=function(){var U=1,M=arguments,N=new g(M[0]);for(;U<M.length;)N=N.plus(M[U++]);return N},d=function(){var U="0123456789";function M(N,v,L,A){var j,B=[0],R,E=0,C=N.length;for(;E<C;){for(R=B.length;R--;B[R]*=v);B[0]+=A.indexOf(N.charAt(E++));for(j=0;j<B.length;j++)if(B[j]>L-1){if(B[j+1]==null)B[j+1]=0;B[j+1]+=B[j]/L|0,B[j]%=L}}return B.reverse()}return function(N,v,L,A,j){var B,R,E,C,k,c,p,Q0,X0=N.indexOf("."),z0=o,e=t;if(X0>=0)C=H0,H0=0,N=N.replace(".",""),Q0=new g(v),c=Q0.pow(N.length-X0),H0=C,Q0.c=M(m(I(c.c),c.e,"0"),10,L,U),Q0.e=Q0.c.length;p=M(N,v,L,j?(B=w4,U):(B=U,w4)),E=C=p.length;for(;p[--C]==0;p.pop());if(!p[0])return B.charAt(0);if(X0<0)--E;else c.c=p,c.e=E,c.s=A,c=S(c,Q0,z0,e,L),p=c.c,k=c.r,E=c.e;if(R=E+z0+1,X0=p[R],C=L/2,k=k||R<0||p[R+1]!=null,k=e<4?(X0!=null||k)&&(e==0||e==(c.s<0?3:2)):X0>C||X0==C&&(e==4||k||e==6&&p[R-1]&1||e==(c.s<0?8:7)),R<1||!p[0])N=k?m(B.charAt(1),-z0,B.charAt(0)):B.charAt(0);else{if(p.length=R,k){for(--L;++p[--R]>L;)if(p[R]=0,!R)++E,p=[1].concat(p)}for(C=p.length;!p[--C];);for(X0=0,N="";X0<=C;N+=B.charAt(p[X0++]));N=m(N,E,B.charAt(0))}return N}}(),S=function(){function U(v,L,A){var j,B,R,E,C=0,k=v.length,c=L%z,p=L/z|0;for(v=v.slice();k--;)R=v[k]%z,E=v[k]/z|0,j=p*R+E*c,B=c*R+j%z*z+C,C=(B/A|0)+(j/z|0)+p*E,v[k]=B%A;if(C)v=[C].concat(v);return v}function M(v,L,A,j){var B,R;if(A!=j)R=A>j?1:-1;else for(B=R=0;B<A;B++)if(v[B]!=L[B]){R=v[B]>L[B]?1:-1;break}return R}function N(v,L,A,j){var B=0;for(;A--;)v[A]-=B,B=v[A]<L[A]?1:0,v[A]=B*j+v[A]-L[A];for(;!v[0]&&v.length>1;v.splice(0,1));}return function(v,L,A,j,B){var R,E,C,k,c,p,Q0,X0,z0,e,Y0,D0,q1,H8,w8,l0,u4,E0=v.s==L.s?1:-1,M0=v.c,K0=L.c;if(!M0||!M0[0]||!K0||!K0[0])return new g(!v.s||!L.s||(M0?K0&&M0[0]==K0[0]:!K0)?NaN:M0&&M0[0]==0||!K0?E0*0:E0/0);if(X0=new g(E0),z0=X0.c=[],E=v.e-L.e,E0=A+E+1,!B)B=q,E=T(v.e/H)-T(L.e/H),E0=E0/H|0;for(C=0;K0[C]==(M0[C]||0);C++);if(K0[C]>(M0[C]||0))E--;if(E0<0)z0.push(1),k=!0;else{if(H8=M0.length,l0=K0.length,C=0,E0+=2,c=W(B/(K0[0]+1)),c>1)K0=U(K0,c,B),M0=U(M0,c,B),l0=K0.length,H8=M0.length;q1=l0,e=M0.slice(0,l0),Y0=e.length;for(;Y0<l0;e[Y0++]=0);if(u4=K0.slice(),u4=[0].concat(u4),w8=K0[0],K0[1]>=B/2)w8++;do{if(c=0,R=M(K0,e,l0,Y0),R<0){if(D0=e[0],l0!=Y0)D0=D0*B+(e[1]||0);if(c=W(D0/w8),c>1){if(c>=B)c=B-1;p=U(K0,c,B),Q0=p.length,Y0=e.length;while(M(p,e,Q0,Y0)==1)c--,N(p,l0<Q0?u4:K0,Q0,B),Q0=p.length,R=1}else{if(c==0)R=c=1;p=K0.slice(),Q0=p.length}if(Q0<Y0)p=[0].concat(p);if(N(e,p,Y0,B),Y0=e.length,R==-1)while(M(K0,e,l0,Y0)<1)c++,N(e,l0<Y0?u4:K0,Y0,B),Y0=e.length}else if(R===0)c++,e=[0];if(z0[C++]=c,e[0])e[Y0++]=M0[q1]||0;else e=[M0[q1]],Y0=1}while((q1++<H8||e[0]!=null)&&E0--);if(k=e[0]!=null,!z0[0])z0.splice(0,1)}if(B==q){for(C=1,E0=z0[0];E0>=10;E0/=10,C++);v0(X0,A+(X0.e=C+E*H-1)+1,j,k)}else X0.e=E,X0.r=+k;return X0}}();function K8(U,M,N,v){var L,A,j,B,R;if(N==null)N=t;else O(N,0,8);if(!U.c)return U.toString();if(L=U.c[0],j=U.e,M==null)R=I(U.c),R=v==1||v==2&&(j<=J0||j>=$0)?x(R,j):m(R,j,"0");else if(U=v0(new g(U),M,N),A=U.e,R=I(U.c),B=R.length,v==1||v==2&&(M<=A||A<=J0)){for(;B<M;R+="0",B++);R=x(R,A)}else if(M-=j+(v===2&&A>j),R=m(R,A,"0"),A+1>B){if(--M>0)for(R+=".";M--;R+="0");}else if(M+=A-B,M>0){if(A+1==B)R+=".";for(;M--;R+="0");}return U.s<0&&L?"-"+R:R}function xZ(U,M){var N,v,L=1,A=new g(U[0]);for(;L<U.length;L++)if(v=new g(U[L]),!v.s||(N=P(A,v))===M||N===0&&A.s===M)A=v;return A}function q8(U,M,N){var v=1,L=M.length;for(;!M[--L];M.pop());for(L=M[0];L>=10;L/=10,v++);if((N=v+N*H-1)>q0)U.c=U.e=null;else if(N<V0)U.c=[U.e=0];else U.e=N,U.c=M;return U}h=function(){var U=/^(-?)0([xbo])(?=\w[\w.]*$)/i,M=/^([^.]+)\.$/,N=/^\.([^.]+)$/,v=/^-?(Infinity|NaN)$/,L=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(A,j,B,R){var E,C=B?j:j.replace(L,"");if(v.test(C))A.s=isNaN(C)?null:C<0?-1:1;else{if(!B){if(C=C.replace(U,function(k,c,p){return E=(p=p.toLowerCase())=="x"?16:p=="b"?2:8,!R||R==E?c:k}),R)E=R,C=C.replace(M,"$1").replace(N,"0.$1");if(j!=C)return new g(C,E)}if(g.DEBUG)throw Error(J+"Not a"+(R?" base "+R:"")+" number: "+j);A.s=null}A.c=A.e=null}}();function v0(U,M,N,v){var L,A,j,B,R,E,C,k=U.c,c=F;if(k){Z:{for(L=1,B=k[0];B>=10;B/=10,L++);if(A=M-L,A<0)A+=H,j=M,R=k[E=0],C=W(R/c[L-j-1]%10);else if(E=Y((A+1)/H),E>=k.length)if(v){for(;k.length<=E;k.push(0));R=C=0,L=1,A%=H,j=A-H+1}else break Z;else{R=B=k[E];for(L=1;B>=10;B/=10,L++);A%=H,j=A-H+L,C=j<0?0:W(R/c[L-j-1]%10)}if(v=v||M<0||k[E+1]!=null||(j<0?R:R%c[L-j-1]),v=N<4?(C||v)&&(N==0||N==(U.s<0?3:2)):C>5||C==5&&(N==4||v||N==6&&(A>0?j>0?R/c[L-j]:0:k[E-1])%10&1||N==(U.s<0?8:7)),M<1||!k[0]){if(k.length=0,v)M-=U.e+1,k[0]=c[(H-M%H)%H],U.e=-M||0;else k[0]=U.e=0;return U}if(A==0)k.length=E,B=1,E--;else k.length=E+1,B=c[H-A],k[E]=j>0?W(R/c[L-j]%c[j])*B:0;if(v)for(;;)if(E==0){for(A=1,j=k[0];j>=10;j/=10,A++);j=k[0]+=B;for(B=1;j>=10;j/=10,B++);if(A!=B){if(U.e++,k[0]==q)k[0]=1}break}else{if(k[E]+=B,k[E]!=q)break;k[E--]=0,B=1}for(A=k.length;k[--A]===0;k.pop());}if(U.e>q0)U.c=U.e=null;else if(U.e<V0)U.c=[U.e=0]}return U}function n0(U){var M,N=U.e;if(N===null)return U.toString();return M=I(U.c),M=N<=J0||N>=$0?x(M,N):m(M,N,"0"),U.s<0?"-"+M:M}if(_.absoluteValue=_.abs=function(){var U=new g(this);if(U.s<0)U.s=1;return U},_.comparedTo=function(U,M){return P(this,new g(U,M))},_.decimalPlaces=_.dp=function(U,M){var N,v,L,A=this;if(U!=null){if(O(U,0,G),M==null)M=t;else O(M,0,8);return v0(new g(A),U+A.e+1,M)}if(!(N=A.c))return null;if(v=((L=N.length-1)-T(this.e/H))*H,L=N[L])for(;L%10==0;L/=10,v--);if(v<0)v=0;return v},_.dividedBy=_.div=function(U,M){return S(this,new g(U,M),o,t)},_.dividedToIntegerBy=_.idiv=function(U,M){return S(this,new g(U,M),0,1)},_.exponentiatedBy=_.pow=function(U,M){var N,v,L,A,j,B,R,E,C,k=this;if(U=new g(U),U.c&&!U.isInteger())throw Error(J+"Exponent not an integer: "+n0(U));if(M!=null)M=new g(M);if(B=U.e>14,!k.c||!k.c[0]||k.c[0]==1&&!k.e&&k.c.length==1||!U.c||!U.c[0])return C=new g(Math.pow(+n0(k),B?U.s*(2-y(U)):+n0(U))),M?C.mod(M):C;if(R=U.s<0,M){if(M.c?!M.c[0]:!M.s)return new g(NaN);if(v=!R&&k.isInteger()&&M.isInteger(),v)k=k.mod(M)}else if(U.e>9&&(k.e>0||k.e<-1||(k.e==0?k.c[0]>1||B&&k.c[1]>=240000000:k.c[0]<80000000000000||B&&k.c[0]<=99999750000000))){if(A=k.s<0&&y(U)?-0:0,k.e>-1)A=1/A;return new g(R?1/A:A)}else if(H0)A=Y(H0/H+2);if(B){if(N=new g(0.5),R)U.s=1;E=y(U)}else L=Math.abs(+n0(U)),E=L%2;C=new g(n);for(;;){if(E){if(C=C.times(k),!C.c)break;if(A){if(C.c.length>A)C.c.length=A}else if(v)C=C.mod(M)}if(L){if(L=W(L/2),L===0)break;E=L%2}else if(U=U.times(N),v0(U,U.e+1,1),U.e>14)E=y(U);else{if(L=+n0(U),L===0)break;E=L%2}if(k=k.times(k),A){if(k.c&&k.c.length>A)k.c.length=A}else if(v)k=k.mod(M)}if(v)return C;if(R)C=n.div(C);return M?C.mod(M):A?v0(C,H0,t,j):C},_.integerValue=function(U){var M=new g(this);if(U==null)U=t;else O(U,0,8);return v0(M,M.e+1,U)},_.isEqualTo=_.eq=function(U,M){return P(this,new g(U,M))===0},_.isFinite=function(){return!!this.c},_.isGreaterThan=_.gt=function(U,M){return P(this,new g(U,M))>0},_.isGreaterThanOrEqualTo=_.gte=function(U,M){return(M=P(this,new g(U,M)))===1||M===0},_.isInteger=function(){return!!this.c&&T(this.e/H)>this.c.length-2},_.isLessThan=_.lt=function(U,M){return P(this,new g(U,M))<0},_.isLessThanOrEqualTo=_.lte=function(U,M){return(M=P(this,new g(U,M)))===-1||M===0},_.isNaN=function(){return!this.s},_.isNegative=function(){return this.s<0},_.isPositive=function(){return this.s>0},_.isZero=function(){return!!this.c&&this.c[0]==0},_.minus=function(U,M){var N,v,L,A,j=this,B=j.s;if(U=new g(U,M),M=U.s,!B||!M)return new g(NaN);if(B!=M)return U.s=-M,j.plus(U);var R=j.e/H,E=U.e/H,C=j.c,k=U.c;if(!R||!E){if(!C||!k)return C?(U.s=-M,U):new g(k?j:NaN);if(!C[0]||!k[0])return k[0]?(U.s=-M,U):new g(C[0]?j:t==3?-0:0)}if(R=T(R),E=T(E),C=C.slice(),B=R-E){if(A=B<0)B=-B,L=C;else E=R,L=k;L.reverse();for(M=B;M--;L.push(0));L.reverse()}else{v=(A=(B=C.length)<(M=k.length))?B:M;for(B=M=0;M<v;M++)if(C[M]!=k[M]){A=C[M]<k[M];break}}if(A)L=C,C=k,k=L,U.s=-U.s;if(M=(v=k.length)-(N=C.length),M>0)for(;M--;C[N++]=0);M=q-1;for(;v>B;){if(C[--v]<k[v]){for(N=v;N&&!C[--N];C[N]=M);--C[N],C[v]+=q}C[v]-=k[v]}for(;C[0]==0;C.splice(0,1),--E);if(!C[0])return U.s=t==3?-1:1,U.c=[U.e=0],U;return q8(U,C,E)},_.modulo=_.mod=function(U,M){var N,v,L=this;if(U=new g(U,M),!L.c||!U.s||U.c&&!U.c[0])return new g(NaN);else if(!U.c||L.c&&!L.c[0])return new g(L);if(R0==9)v=U.s,U.s=1,N=S(L,U,0,3),U.s=v,N.s*=v;else N=S(L,U,0,R0);if(U=L.minus(N.times(U)),!U.c[0]&&R0==1)U.s=L.s;return U},_.multipliedBy=_.times=function(U,M){var N,v,L,A,j,B,R,E,C,k,c,p,Q0,X0,z0,e=this,Y0=e.c,D0=(U=new g(U,M)).c;if(!Y0||!D0||!Y0[0]||!D0[0]){if(!e.s||!U.s||Y0&&!Y0[0]&&!D0||D0&&!D0[0]&&!Y0)U.c=U.e=U.s=null;else if(U.s*=e.s,!Y0||!D0)U.c=U.e=null;else U.c=[0],U.e=0;return U}if(v=T(e.e/H)+T(U.e/H),U.s*=e.s,R=Y0.length,k=D0.length,R<k)Q0=Y0,Y0=D0,D0=Q0,L=R,R=k,k=L;for(L=R+k,Q0=[];L--;Q0.push(0));X0=q,z0=z;for(L=k;--L>=0;){N=0,c=D0[L]%z0,p=D0[L]/z0|0;for(j=R,A=L+j;A>L;)E=Y0[--j]%z0,C=Y0[j]/z0|0,B=p*E+C*c,E=c*E+B%z0*z0+Q0[A]+N,N=(E/X0|0)+(B/z0|0)+p*C,Q0[A--]=E%X0;Q0[A]=N}if(N)++v;else Q0.splice(0,1);return q8(U,Q0,v)},_.negated=function(){var U=new g(this);return U.s=-U.s||null,U},_.plus=function(U,M){var N,v=this,L=v.s;if(U=new g(U,M),M=U.s,!L||!M)return new g(NaN);if(L!=M)return U.s=-M,v.minus(U);var A=v.e/H,j=U.e/H,B=v.c,R=U.c;if(!A||!j){if(!B||!R)return new g(L/0);if(!B[0]||!R[0])return R[0]?U:new g(B[0]?v:L*0)}if(A=T(A),j=T(j),B=B.slice(),L=A-j){if(L>0)j=A,N=R;else L=-L,N=B;N.reverse();for(;L--;N.push(0));N.reverse()}if(L=B.length,M=R.length,L-M<0)N=R,R=B,B=N,M=L;for(L=0;M;)L=(B[--M]=B[M]+R[M]+L)/q|0,B[M]=q===B[M]?0:B[M]%q;if(L)B=[L].concat(B),++j;return q8(U,B,j)},_.precision=_.sd=function(U,M){var N,v,L,A=this;if(U!=null&&U!==!!U){if(O(U,1,G),M==null)M=t;else O(M,0,8);return v0(new g(A),U,M)}if(!(N=A.c))return null;if(L=N.length-1,v=L*H+1,L=N[L]){for(;L%10==0;L/=10,v--);for(L=N[0];L>=10;L/=10,v++);}if(U&&A.e+1>v)v=A.e+1;return v},_.shiftedBy=function(U){return O(U,-w,w),this.times("1e"+U)},_.squareRoot=_.sqrt=function(){var U,M,N,v,L,A=this,j=A.c,B=A.s,R=A.e,E=o+4,C=new g("0.5");if(B!==1||!j||!j[0])return new g(!B||B<0&&(!j||j[0])?NaN:j?A:1/0);if(B=Math.sqrt(+n0(A)),B==0||B==1/0){if(M=I(j),(M.length+R)%2==0)M+="0";if(B=Math.sqrt(+M),R=T((R+1)/2)-(R<0||R%2),B==1/0)M="5e"+R;else M=B.toExponential(),M=M.slice(0,M.indexOf("e")+1)+R;N=new g(M)}else N=new g(B+"");if(N.c[0]){if(R=N.e,B=R+E,B<3)B=0;for(;;)if(L=N,N=C.times(L.plus(S(A,L,E,1))),I(L.c).slice(0,B)===(M=I(N.c)).slice(0,B)){if(N.e<R)--B;if(M=M.slice(B-3,B+1),M=="9999"||!v&&M=="4999"){if(!v){if(v0(L,L.e+o+2,0),L.times(L).eq(A)){N=L;break}}E+=4,B+=4,v=1}else{if(!+M||!+M.slice(1)&&M.charAt(0)=="5")v0(N,N.e+o+2,1),U=!N.times(N).eq(A);break}}}return v0(N,N.e+o+1,t,U)},_.toExponential=function(U,M){if(U!=null)O(U,0,G),U++;return K8(this,U,M,1)},_.toFixed=function(U,M){if(U!=null)O(U,0,G),U=U+this.e+1;return K8(this,U,M)},_.toFormat=function(U,M,N){var v,L=this;if(N==null)if(U!=null&&M&&typeof M=="object")N=M,M=null;else if(U&&typeof U=="object")N=U,U=M=null;else N=H4;else if(typeof N!="object")throw Error(J+"Argument not an object: "+N);if(v=L.toFixed(U,M),L.c){var A,j=v.split("."),B=+N.groupSize,R=+N.secondaryGroupSize,E=N.groupSeparator||"",C=j[0],k=j[1],c=L.s<0,p=c?C.slice(1):C,Q0=p.length;if(R)A=B,B=R,R=A,Q0-=A;if(B>0&&Q0>0){A=Q0%B||B,C=p.substr(0,A);for(;A<Q0;A+=B)C+=E+p.substr(A,B);if(R>0)C+=E+p.slice(A);if(c)C="-"+C}v=k?C+(N.decimalSeparator||"")+((R=+N.fractionGroupSize)?k.replace(new RegExp("\\d{"+R+"}\\B","g"),"$&"+(N.fractionGroupSeparator||"")):k):C}return(N.prefix||"")+v+(N.suffix||"")},_.toFraction=function(U){var M,N,v,L,A,j,B,R,E,C,k,c,p=this,Q0=p.c;if(U!=null){if(B=new g(U),!B.isInteger()&&(B.c||B.s!==1)||B.lt(n))throw Error(J+"Argument "+(B.isInteger()?"out of range: ":"not an integer: ")+n0(B))}if(!Q0)return new g(p);M=new g(n),E=N=new g(n),v=R=new g(n),c=I(Q0),A=M.e=c.length-p.e-1,M.c[0]=F[(j=A%H)<0?H+j:j],U=!U||B.comparedTo(M)>0?A>0?M:E:B,j=q0,q0=1/0,B=new g(c),R.c[0]=0;for(;;){if(C=S(B,M,0,1),L=N.plus(C.times(v)),L.comparedTo(U)==1)break;N=v,v=L,E=R.plus(C.times(L=E)),R=L,M=B.minus(C.times(L=M)),B=L}return L=S(U.minus(N),v,0,1),R=R.plus(L.times(E)),N=N.plus(L.times(v)),R.s=E.s=p.s,A=A*2,k=S(E,v,A,t).minus(p).abs().comparedTo(S(R,N,A,t).minus(p).abs())<1?[E,v]:[R,N],q0=j,k},_.toNumber=function(){return+n0(this)},_.toPrecision=function(U,M){if(U!=null)O(U,1,G);return K8(this,U,M,2)},_.toString=function(U){var M,N=this,v=N.s,L=N.e;if(L===null)if(v){if(M="Infinity",v<0)M="-"+M}else M="NaN";else{if(U==null)M=L<=J0||L>=$0?x(I(N.c),L):m(I(N.c),L,"0");else if(U===10&&X8)N=v0(new g(N),o+L+1,t),M=m(I(N.c),N.e,"0");else O(U,2,w4.length,"Base"),M=d(m(I(N.c),L,"0"),10,U,v,!0);if(v<0&&N.c[0])M="-"+M}return M},_.valueOf=_.toJSON=function(){return n0(this)},_._isBigNumber=!0,f!=null)g.set(f);return g}function T(f){var S=f|0;return f>0||f===S?S:S-1}function I(f){var S,d,h=1,_=f.length,n=f[0]+"";for(;h<_;){S=f[h++]+"",d=H-S.length;for(;d--;S="0"+S);n+=S}for(_=n.length;n.charCodeAt(--_)===48;);return n.slice(0,_+1||1)}function P(f,S){var d,h,_=f.c,n=S.c,o=f.s,t=S.s,J0=f.e,$0=S.e;if(!o||!t)return null;if(d=_&&!_[0],h=n&&!n[0],d||h)return d?h?0:-t:o;if(o!=t)return o;if(d=o<0,h=J0==$0,!_||!n)return h?0:!_^d?1:-1;if(!h)return J0>$0^d?1:-1;t=(J0=_.length)<($0=n.length)?J0:$0;for(o=0;o<t;o++)if(_[o]!=n[o])return _[o]>n[o]^d?1:-1;return J0==$0?0:J0>$0^d?1:-1}function O(f,S,d,h){if(f<S||f>d||f!==W(f))throw Error(J+(h||"Argument")+(typeof f=="number"?f<S||f>d?" out of range: ":" not an integer: ":" not a primitive number: ")+String(f))}function y(f){var S=f.c.length-1;return T(f.e/H)==S&&f.c[S]%2!=0}function x(f,S){return(f.length>1?f.charAt(0)+"."+f.slice(1):f)+(S<0?"e":"e+")+S}function m(f,S,d){var h,_;if(S<0){for(_=d+".";++S;_+=d);f=_+f}else if(h=f.length,++S>h){for(_=d,S-=h;--S;_+=d);f+=_}else if(S<h)f=f.slice(0,S)+"."+f.slice(S);return f}if($=D(),$.default=$.BigNumber=$,typeof define=="function"&&define.amd)define(function(){return $});else if(typeof z1<"u"&&z1.exports)z1.exports=$;else{if(!Z)Z=typeof self<"u"&&self?self:window;Z.BigNumber=$}})(F$)});var M$=b((qD,D$)=>{var G$=T8(),U$=qD;(function(){function Z(w){return w<10?"0"+w:w}var $=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,Q=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,Y,W,J={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':"\\\"","\\":"\\\\"},K;function q(w){return Q.lastIndex=0,Q.test(w)?'"'+w.replace(Q,function(F){var z=J[F];return typeof z==="string"?z:"\\u"+("0000"+F.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+w+'"'}function H(w,F){var z,G,D,T,I=Y,P,O=F[w],y=O!=null&&(O instanceof G$||G$.isBigNumber(O));if(O&&typeof O==="object"&&typeof O.toJSON==="function")O=O.toJSON(w);if(typeof K==="function")O=K.call(F,w,O);switch(typeof O){case"string":if(y)return O;else return q(O);case"number":return isFinite(O)?String(O):"null";case"boolean":case"null":case"bigint":return String(O);case"object":if(!O)return"null";if(Y+=W,P=[],Object.prototype.toString.apply(O)==="[object Array]"){T=O.length;for(z=0;z<T;z+=1)P[z]=H(z,O)||"null";return D=P.length===0?"[]":Y?`[
8
8
  `+Y+P.join(`,
9
9
  `+Y)+`
10
10
  `+I+"]":"["+P.join(",")+"]",Y=I,D}if(K&&typeof K==="object"){T=K.length;for(z=0;z<T;z+=1)if(typeof K[z]==="string"){if(G=K[z],D=H(G,O),D)P.push(q(G)+(Y?": ":":")+D)}}else Object.keys(O).forEach(function(x){var m=H(x,O);if(m)P.push(q(x)+(Y?": ":":")+m)});return D=P.length===0?"{}":Y?`{
@@ -41,4 +41,4 @@ ${z}`)}return K},b0=DU(DJ);class OZ extends V8{create(Z,$){var Q;let{api_version
41
41
  `,"\r"]);K1.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function IU(Z,$){let W=$!==null&&$!==void 0?$:0,J=Z.indexOf(10,W),K=Z.indexOf(13,W);if(J===-1&&K===-1)return null;let q;if(J!==-1&&K!==-1)q=Math.min(J,K);else q=J!==-1?J:K;if(Z[q]===10)return{preceding:q,index:q+1,carriage:!1};return{preceding:q,index:q+1,carriage:!0}}var t1={off:0,error:200,warn:300,info:400,debug:500},WV=(Z,$,Q)=>{if(!Z)return;if(ZU(t1,Z))return Z;N0(Q).warn(`${$} was set to ${JSON.stringify(Z)}, expected one of ${JSON.stringify(Object.keys(t1))}`);return};function V1(){}function c1(Z,$,Q){if(!$||t1[Z]>t1[Q])return V1;else return $[Z].bind($)}var NU={error:V1,warn:V1,info:V1,debug:V1},VV=new WeakMap;function N0(Z){var $;let Q=Z.logger,Y=($=Z.logLevel)!==null&&$!==void 0?$:"off";if(!Q)return NU;let W=VV.get(Q);if(W&&W[0]===Y)return W[1];let J={error:c1("error",Q,Y),warn:c1("warn",Q,Y),info:c1("info",Q,Y),debug:c1("debug",Q,Y)};return VV.set(Q,[Y,J]),J}var M4=(Z)=>{if(Z.options)Z.options=Object.assign({},Z.options),delete Z.options.headers;if(Z.headers)Z.headers=Object.fromEntries((Z.headers instanceof Headers?[...Z.headers]:Object.entries(Z.headers)).map(([$,Q])=>[$,$.toLowerCase()==="x-goog-api-key"||$.toLowerCase()==="authorization"||$.toLowerCase()==="cookie"||$.toLowerCase()==="set-cookie"?"***":Q]));if("retryOfRequestLogID"in Z){if(Z.retryOfRequestLogID)Z.retryOf=Z.retryOfRequestLogID;delete Z.retryOfRequestLogID}return Z};class k4{constructor(Z,$,Q){this.iterator=Z,this.controller=$,this.client=Q}static fromSSEResponse(Z,$,Q){let Y=!1,W=Q?N0(Q):console;function J(){return m0(this,arguments,function*(){var q,H,w,F;if(Y)throw new C0("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Y=!0;let z=!1;try{try{for(var G=!0,D=u0(TU(Z,$)),T;T=yield r(D.next()),q=T.done,!q;G=!0){F=T.value,G=!1;let I=F;if(z)continue;if(I.data.startsWith("[DONE]")){z=!0;continue}else try{yield yield r(JSON.parse(I.data))}catch(P){throw W.error("Could not parse message into JSON:",I.data),W.error("From chunk:",I.raw),P}}}catch(I){H={error:I}}finally{try{if(!G&&!q&&(w=D.return))yield r(w.call(D))}finally{if(H)throw H.error}}z=!0}catch(I){if(XZ(I))return yield r(void 0);throw I}finally{if(!z)$.abort()}})}return new k4(J,$,Q)}static fromReadableStream(Z,$,Q){let Y=!1;function W(){return m0(this,arguments,function*(){var q,H,w,F;let z=new K1,G=FJ(Z);try{for(var D=!0,T=u0(G),I;I=yield r(T.next()),q=I.done,!q;D=!0){F=I.value,D=!1;let P=F;for(let O of z.decode(P))yield yield r(O)}}catch(P){H={error:P}}finally{try{if(!D&&!q&&(w=T.return))yield r(w.call(T))}finally{if(H)throw H.error}}for(let P of z.flush())yield yield r(P)})}function J(){return m0(this,arguments,function*(){var q,H,w,F;if(Y)throw new C0("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Y=!0;let z=!1;try{try{for(var G=!0,D=u0(W()),T;T=yield r(D.next()),q=T.done,!q;G=!0){F=T.value,G=!1;let I=F;if(z)continue;if(I)yield yield r(JSON.parse(I))}}catch(I){H={error:I}}finally{try{if(!G&&!q&&(w=D.return))yield r(w.call(D))}finally{if(H)throw H.error}}z=!0}catch(I){if(XZ(I))return yield r(void 0);throw I}finally{if(!z)$.abort()}})}return new k4(J,$,Q)}[Symbol.asyncIterator](){return this.iterator()}tee(){let Z=[],$=[],Q=this.iterator(),Y=(W)=>{return{next:()=>{if(W.length===0){let J=Q.next();Z.push(J),$.push(J)}return W.shift()}}};return[new k4(()=>Y(Z),this.controller,this.client),new k4(()=>Y($),this.controller,this.client)]}toReadableStream(){let Z=this,$;return zJ({async start(){$=Z[Symbol.asyncIterator]()},async pull(Q){try{let{value:Y,done:W}=await $.next();if(W)return Q.close();let J=kZ(JSON.stringify(Y)+`
42
42
  `);Q.enqueue(J)}catch(Y){Q.error(Y)}},async cancel(){var Q;await((Q=$.return)===null||Q===void 0?void 0:Q.call($))}})}}function TU(Z,$){return m0(this,arguments,function*(){var Y,W,J,K;if(!Z.body){if($.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new C0("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new C0("Attempted to iterate over a response with no body")}let q=new MJ,H=new K1,w=FJ(Z.body);try{for(var F=!0,z=u0(BU(w)),G;G=yield r(z.next()),Y=G.done,!Y;F=!0){K=G.value,F=!1;let D=K;for(let T of H.decode(D)){let I=q.decode(T);if(I)yield yield r(I)}}}catch(D){W={error:D}}finally{try{if(!F&&!Y&&(J=z.return))yield r(J.call(z))}finally{if(W)throw W.error}}for(let D of H.flush()){let T=q.decode(D);if(T)yield yield r(T)}})}function BU(Z){return m0(this,arguments,function*(){var Q,Y,W,J;try{for(var K=!0,q=u0(Z),H;H=yield r(q.next()),Q=H.done,!Q;K=!0){J=H.value,K=!1;let w=J;if(w==null)continue;let F=w instanceof ArrayBuffer?new Uint8Array(w):typeof w==="string"?kZ(w):w;yield yield r(F)}}catch(w){Y={error:w}}finally{try{if(!K&&!Q&&(W=q.return))yield r(W.call(q))}finally{if(Y)throw Y.error}}})}class MJ{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(Z){if(Z.endsWith("\r"))Z=Z.substring(0,Z.length-1);if(!Z){if(!this.event&&!this.data.length)return null;let W={event:this.event,data:this.data.join(`
43
43
  `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],W}if(this.chunks.push(Z),Z.startsWith(":"))return null;let[$,Q,Y]=LU(Z,":");if(Y.startsWith(" "))Y=Y.substring(1);if($==="event")this.event=Y;else if($==="data")this.data.push(Y);return null}}function LU(Z,$){let Q=Z.indexOf($);if(Q!==-1)return[Z.substring(0,Q),$,Z.substring(Q+$.length)];return[Z,"",""]}async function RU(Z,$){let{response:Q,requestLogID:Y,retryOfRequestLogID:W,startTime:J}=$,K=await(async()=>{var q;if($.options.stream){if(N0(Z).debug("response",Q.status,Q.url,Q.headers,Q.body),$.options.__streamClass)return $.options.__streamClass.fromSSEResponse(Q,$.controller,Z);return k4.fromSSEResponse(Q,$.controller,Z)}if(Q.status===204)return null;if($.options.__binaryResponse)return Q;let H=Q.headers.get("content-type"),w=(q=H===null||H===void 0?void 0:H.split(";")[0])===null||q===void 0?void 0:q.trim();if((w===null||w===void 0?void 0:w.includes("application/json"))||(w===null||w===void 0?void 0:w.endsWith("+json"))){if(Q.headers.get("content-length")==="0")return;return await Q.json()}return await Q.text()})();return N0(Z).debug(`[${Y}] response parsed`,M4({retryOfRequestLogID:W,url:Q.url,status:Q.status,body:K,durationMs:Date.now()-J})),K}class yZ extends Promise{constructor(Z,$,Q=RU){super((Y)=>{Y(null)});this.responsePromise=$,this.parseResponse=Q,this.client=Z}_thenUnwrap(Z){return new yZ(this.client,this.responsePromise,async($,Q)=>Z(await this.parseResponse($,Q),Q))}asResponse(){return this.responsePromise.then((Z)=>Z.response)}async withResponse(){let[Z,$]=await Promise.all([this.parse(),this.asResponse()]);return{data:Z,response:$}}parse(){if(!this.parsedPromise)this.parsedPromise=this.responsePromise.then((Z)=>this.parseResponse(this.client,Z));return this.parsedPromise}then(Z,$){return this.parse().then(Z,$)}catch(Z){return this.parse().catch(Z)}finally(Z){return this.parse().finally(Z)}}var IJ=Symbol("brand.privateNullableHeaders");function*AU(Z){if(!Z)return;if(IJ in Z){let{values:Y,nulls:W}=Z;yield*Y.entries();for(let J of W)yield[J,null];return}let $=!1,Q;if(Z instanceof Headers)Q=Z.entries();else if(ZV(Z))Q=Z;else $=!0,Q=Object.entries(Z!==null&&Z!==void 0?Z:{});for(let Y of Q){let W=Y[0];if(typeof W!=="string")throw TypeError("expected header name to be a string");let J=ZV(Y[1])?Y[1]:[Y[1]],K=!1;for(let q of J){if(q===void 0)continue;if($&&!K)K=!0,yield[W,null];yield[W,q]}}}var Y1=(Z)=>{let $=new Headers,Q=new Set;for(let Y of Z){let W=new Set;for(let[J,K]of AU(Y)){let q=J.toLowerCase();if(!W.has(q))$.delete(J),W.add(q);if(K===null)$.delete(J),Q.add(q);else $.append(J,K),Q.delete(q)}}return{[IJ]:!0,values:$,nulls:Q}},d6=(Z)=>{var $,Q,Y,W,J;if(typeof globalThis.process<"u")return((Q=($=globalThis.process.env)===null||$===void 0?void 0:$[Z])===null||Q===void 0?void 0:Q.trim())||void 0;if(typeof globalThis.Deno<"u")return((J=(W=(Y=globalThis.Deno.env)===null||Y===void 0?void 0:Y.get)===null||W===void 0?void 0:W.call(Y,Z))===null||J===void 0?void 0:J.trim())||void 0;return},NJ;class J8{constructor(Z){var $,Q,Y,W,J,K,q,{baseURL:H=d6("GEMINI_NEXT_GEN_API_BASE_URL"),apiKey:w=($=d6("GEMINI_API_KEY"))!==null&&$!==void 0?$:null,apiVersion:F="v1beta"}=Z,z=V4(Z,["baseURL","apiKey","apiVersion"]);let G=Object.assign(Object.assign({apiKey:w,apiVersion:F},z),{baseURL:H||"https://generativelanguage.googleapis.com"});this.baseURL=G.baseURL,this.timeout=(Q=G.timeout)!==null&&Q!==void 0?Q:J8.DEFAULT_TIMEOUT,this.logger=(Y=G.logger)!==null&&Y!==void 0?Y:console;let D="warn";this.logLevel=D,this.logLevel=(J=(W=WV(G.logLevel,"ClientOptions.logLevel",this))!==null&&W!==void 0?W:WV(d6("GEMINI_NEXT_GEN_API_LOG"),"process.env['GEMINI_NEXT_GEN_API_LOG']",this))!==null&&J!==void 0?J:D,this.fetchOptions=G.fetchOptions,this.maxRetries=(K=G.maxRetries)!==null&&K!==void 0?K:2,this.fetch=(q=G.fetch)!==null&&q!==void 0?q:WU(),this.encoder=XU,this._options=G,this.apiKey=w,this.apiVersion=F,this.clientAdapter=G.clientAdapter}withOptions(Z){return new this.constructor(Object.assign(Object.assign(Object.assign({},this._options),{baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,apiVersion:this.apiVersion}),Z))}baseURLOverridden(){return this.baseURL!=="https://generativelanguage.googleapis.com"}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:Z,nulls:$}){if(Z.has("authorization")||Z.has("x-goog-api-key"))return;if(this.apiKey&&Z.get("x-goog-api-key"))return;if($.has("x-goog-api-key"))return;throw Error('Could not resolve authentication method. Expected the apiKey to be set. Or for the "x-goog-api-key" headers to be explicitly omitted')}async authHeaders(Z){let $=Y1([Z.headers]);if($.values.has("authorization")||$.values.has("x-goog-api-key"))return;if(this.apiKey)return Y1([{"x-goog-api-key":this.apiKey}]);if(this.clientAdapter&&this.clientAdapter.isVertexAI())return Y1([await this.clientAdapter.getAuthHeaders()]);return}stringifyQuery(Z){return KU(Z)}getUserAgent(){return`${this.constructor.name}/JS ${qU}`}defaultIdempotencyKey(){return`stainless-node-retry-${rG()}`}makeStatusError(Z,$,Q,Y){return T0.generate(Z,$,Q,Y)}buildURL(Z,$,Q){let Y=!this.baseURLOverridden()&&Q||this.baseURL,W=oG(Z)?new URL(Z):new URL(Y+(Y.endsWith("/")&&Z.startsWith("/")?Z.slice(1):Z)),J=this.defaultQuery(),K=Object.fromEntries(W.searchParams);if(!$V(J)||!$V(K))$=Object.assign(Object.assign(Object.assign({},K),J),$);if(typeof $==="object"&&$&&!Array.isArray($))W.search=this.stringifyQuery($);return W.toString()}async prepareOptions(Z){if(this.clientAdapter&&this.clientAdapter.isVertexAI()&&!Z.path.startsWith(`/${this.apiVersion}/projects/`)){let $=Z.path.slice(this.apiVersion.length+1);Z.path=`/${this.apiVersion}/projects/${this.clientAdapter.getProject()}/locations/${this.clientAdapter.getLocation()}${$}`}}async prepareRequest(Z,{url:$,options:Q}){}get(Z,$){return this.methodRequest("get",Z,$)}post(Z,$){return this.methodRequest("post",Z,$)}patch(Z,$){return this.methodRequest("patch",Z,$)}put(Z,$){return this.methodRequest("put",Z,$)}delete(Z,$){return this.methodRequest("delete",Z,$)}methodRequest(Z,$,Q){return this.request(Promise.resolve(Q).then((Y)=>{return Object.assign({method:Z,path:$},Y)}))}request(Z,$=null){return new yZ(this,this.makeRequest(Z,$,void 0))}async makeRequest(Z,$,Q){var Y,W,J;let K=await Z,q=(Y=K.maxRetries)!==null&&Y!==void 0?Y:this.maxRetries;if($==null)$=q;await this.prepareOptions(K);let{req:H,url:w,timeout:F}=await this.buildRequest(K,{retryCount:q-$});await this.prepareRequest(H,{url:w,options:K});let z="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),G=Q===void 0?"":`, retryOf: ${Q}`,D=Date.now();if(N0(this).debug(`[${z}] sending request`,M4({retryOfRequestLogID:Q,method:K.method,url:w,options:K,headers:H.headers})),(W=K.signal)===null||W===void 0?void 0:W.aborted)throw new o1;let T=new AbortController,I=await this.fetchWithTimeout(w,H,F,T).catch(KZ),P=Date.now();if(I instanceof globalThis.Error){let y=`retrying, ${$} attempts remaining`;if((J=K.signal)===null||J===void 0?void 0:J.aborted)throw new o1;let x=XZ(I)||/timed? ?out/i.test(String(I)+("cause"in I?String(I.cause):""));if($)return N0(this).info(`[${z}] connection ${x?"timed out":"failed"} - ${y}`),N0(this).debug(`[${z}] connection ${x?"timed out":"failed"} (${y})`,M4({retryOfRequestLogID:Q,url:w,durationMs:P-D,message:I.message})),this.retryRequest(K,$,Q!==null&&Q!==void 0?Q:z);if(N0(this).info(`[${z}] connection ${x?"timed out":"failed"} - error; no more retries left`),N0(this).debug(`[${z}] connection ${x?"timed out":"failed"} (error; no more retries left)`,M4({retryOfRequestLogID:Q,url:w,durationMs:P-D,message:I.message})),x)throw new BZ;throw new X1({cause:I})}let O=`[${z}${G}] ${H.method} ${w} ${I.ok?"succeeded":"failed"} with status ${I.status} in ${P-D}ms`;if(!I.ok){let y=await this.shouldRetry(I);if($&&y){let h=`retrying, ${$} attempts remaining`;return await JU(I.body),N0(this).info(`${O} - ${h}`),N0(this).debug(`[${z}] response error (${h})`,M4({retryOfRequestLogID:Q,url:I.url,status:I.status,headers:I.headers,durationMs:P-D})),this.retryRequest(K,$,Q!==null&&Q!==void 0?Q:z,I.headers)}let x=y?"error; no more retries left":"error; not retryable";N0(this).info(`${O} - ${x}`);let m=await I.text().catch((h)=>KZ(h).message),f=QU(m),S=f?void 0:m;throw N0(this).debug(`[${z}] response error (${x})`,M4({retryOfRequestLogID:Q,url:I.url,status:I.status,headers:I.headers,message:S,durationMs:Date.now()-D})),this.makeStatusError(I.status,f,S,I.headers)}return N0(this).info(O),N0(this).debug(`[${z}] response start`,M4({retryOfRequestLogID:Q,url:I.url,status:I.status,headers:I.headers,durationMs:P-D})),{response:I,options:K,controller:T,requestLogID:z,retryOfRequestLogID:Q,startTime:D}}async fetchWithTimeout(Z,$,Q,Y){let W=$||{},{signal:J,method:K}=W,q=V4(W,["signal","method"]),H=this._makeAbort(Y);if(J)J.addEventListener("abort",H,{once:!0});let w=setTimeout(H,Q),F=globalThis.ReadableStream&&q.body instanceof globalThis.ReadableStream||typeof q.body==="object"&&q.body!==null&&Symbol.asyncIterator in q.body,z=Object.assign(Object.assign(Object.assign({signal:Y.signal},F?{duplex:"half"}:{}),{method:"GET"}),q);if(K)z.method=K.toUpperCase();try{return await this.fetch.call(void 0,Z,z)}finally{clearTimeout(w)}}async shouldRetry(Z){let $=Z.headers.get("x-should-retry");if($==="true")return!0;if($==="false")return!1;if(Z.status===408)return!0;if(Z.status===409)return!0;if(Z.status===429)return!0;if(Z.status>=500)return!0;return!1}async retryRequest(Z,$,Q,Y){var W;let J,K=Y===null||Y===void 0?void 0:Y.get("retry-after-ms");if(K){let H=parseFloat(K);if(!Number.isNaN(H))J=H}let q=Y===null||Y===void 0?void 0:Y.get("retry-after");if(q&&!J){let H=parseFloat(q);if(!Number.isNaN(H))J=H*1000;else J=Date.parse(q)-Date.now()}if(J===void 0){let H=(W=Z.maxRetries)!==null&&W!==void 0?W:this.maxRetries;J=this.calculateDefaultRetryTimeoutMillis($,H)}return await YU(J),this.makeRequest(Z,$-1,Q)}calculateDefaultRetryTimeoutMillis(Z,$){let W=$-Z,J=Math.min(0.5*Math.pow(2,W),8),K=1-Math.random()*0.25;return J*K*1000}async buildRequest(Z,{retryCount:$=0}={}){var Q,Y,W;let J=Object.assign({},Z),{method:K,path:q,query:H,defaultBaseURL:w}=J,F=this.buildURL(q,H,w);if("timeout"in J)$U("timeout",J.timeout);J.timeout=(Q=J.timeout)!==null&&Q!==void 0?Q:this.timeout;let{bodyHeaders:z,body:G}=this.buildBody({options:J}),D=await this.buildHeaders({options:Z,method:K,bodyHeaders:z,retryCount:$});return{req:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({method:K,headers:D},J.signal&&{signal:J.signal}),globalThis.ReadableStream&&G instanceof globalThis.ReadableStream&&{duplex:"half"}),G&&{body:G}),(Y=this.fetchOptions)!==null&&Y!==void 0?Y:{}),(W=J.fetchOptions)!==null&&W!==void 0?W:{}),url:F,timeout:J.timeout}}async buildHeaders({options:Z,method:$,bodyHeaders:Q,retryCount:Y}){let W={};if(this.idempotencyHeader&&$!=="get"){if(!Z.idempotencyKey)Z.idempotencyKey=this.defaultIdempotencyKey();W[this.idempotencyHeader]=Z.idempotencyKey}let J=await this.authHeaders(Z),K=Y1([W,{Accept:"application/json","User-Agent":this.getUserAgent()},this._options.defaultHeaders,Q,Z.headers,J]);return this.validateHeaders(K),K.values}_makeAbort(Z){return()=>Z.abort()}buildBody({options:{body:Z,headers:$}}){if(!Z)return{bodyHeaders:void 0,body:void 0};let Q=Y1([$]);if(ArrayBuffer.isView(Z)||Z instanceof ArrayBuffer||Z instanceof DataView||typeof Z==="string"&&Q.values.has("content-type")||globalThis.Blob&&Z instanceof globalThis.Blob||Z instanceof FormData||Z instanceof URLSearchParams||globalThis.ReadableStream&&Z instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:Z};else if(typeof Z==="object"&&((Symbol.asyncIterator in Z)||(Symbol.iterator in Z)&&("next"in Z)&&typeof Z.next==="function"))return{bodyHeaders:void 0,body:VU(Z)};else if(typeof Z==="object"&&Q.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(Z)};else return this.encoder({body:Z,headers:Q})}}J8.DEFAULT_TIMEOUT=60000;class w0 extends J8{constructor(){super(...arguments);this.interactions=new jZ(this),this.webhooks=new hZ(this)}}NJ=w0;w0.GeminiNextGenAPIClient=NJ;w0.GeminiNextGenAPIClientError=C0;w0.APIError=T0;w0.APIConnectionError=X1;w0.APIConnectionTimeoutError=BZ;w0.APIUserAbortError=o1;w0.NotFoundError=PZ;w0.ConflictError=SZ;w0.RateLimitError=vZ;w0.BadRequestError=LZ;w0.AuthenticationError=RZ;w0.InternalServerError=EZ;w0.PermissionDeniedError=AZ;w0.UnprocessableEntityError=CZ;w0.toFile=GU;w0.Interactions=jZ;w0.Webhooks=hZ;var JV="x-goog-api-key",W1="https://www.googleapis.com/auth/cloud-platform";class TJ{constructor(Z){if(Z.apiKey!==void 0){this.apiKey=Z.apiKey;return}let $=PU(Z.googleAuthOptions);this.googleAuth=new KV.GoogleAuth($)}async addAuthHeaders(Z,$){if(this.apiKey!==void 0){if(this.apiKey.startsWith("auth_tokens/"))throw Error("Ephemeral tokens are only supported by the live API.");this.addKeyHeader(Z);return}return this.addGoogleAuthHeaders(Z,$)}addKeyHeader(Z){if(Z.get(JV)!==null)return;if(this.apiKey===void 0)throw Error("Trying to set API key header but apiKey is not set");Z.append(JV,this.apiKey)}async addGoogleAuthHeaders(Z,$){if(this.googleAuth===void 0)throw Error("Trying to set google-auth headers but googleAuth is unset");let Q=await this.googleAuth.getRequestHeaders($);for(let[Y,W]of Q){if(Z.get(Y)!==null)continue;Z.append(Y,W)}}}function PU(Z){let $;if(!Z)return $={scopes:[W1]},$;else{if($=Z,!$.scopes)return $.scopes=[W1],$;else if(typeof $.scopes==="string"&&$.scopes!==W1||Array.isArray($.scopes)&&$.scopes.indexOf(W1)<0)throw Error(`Invalid auth scopes. Scopes must include: ${W1}`);return $}}class BJ{async download(Z,$){if(Z.downloadPath){let Q=await SU(Z,$);if(Q instanceof I4){let Y=Jw(Z.downloadPath);Kw.fromWeb(Q.responseInternal.body).pipe(Y),await qw(Y)}else try{await Xw(Z.downloadPath,Q,{encoding:"base64"})}catch(Y){throw Error(`Failed to write file to ${Z.downloadPath}: ${Y}`)}}}}async function SU(Z,$){var Q,Y,W;let J=NZ(Z.file);if(J!==void 0)return await $.request({path:`files/${J}:download`,httpMethod:"GET",queryParams:{alt:"media"},httpOptions:(Q=Z.config)===null||Q===void 0?void 0:Q.httpOptions,abortSignal:(Y=Z.config)===null||Y===void 0?void 0:Y.abortSignal});else if(_V(Z.file)){let K=(W=Z.file.video)===null||W===void 0?void 0:W.videoBytes;if(typeof K==="string")return K;else throw Error("Failed to download generated video, Uri or videoBytes not found.")}else if(hV(Z.file)){let K=Z.file.videoBytes;if(typeof K==="string")return K;else throw Error("Failed to download video, Uri or videoBytes not found.")}else throw Error("Unsupported file type")}class LJ{create(Z,$,Q){return new RJ(Z,$,Q)}}class RJ{constructor(Z,$,Q){this.url=Z,this.headers=$,this.callbacks=Q}connect(){this.ws=new qV.WebSocket(this.url,{headers:this.headers}),this.ws.onopen=this.callbacks.onopen,this.ws.onerror=this.callbacks.onerror,this.ws.onclose=this.callbacks.onclose,this.ws.onmessage=this.callbacks.onmessage}send(Z){if(this.ws===void 0)throw Error("WebSocket is not connected");this.ws.send(Z)}close(){if(this.ws===void 0)throw Error("WebSocket is not connected");this.ws.close()}}function CU(Z,$){let Q={},Y=V(Z,["name"]);if(Y!=null)X(Q,["_url","name"],Y);return Q}function vU(Z,$){let Q={},Y=V(Z,["name"]);if(Y!=null)X(Q,["_url","name"],Y);return Q}function EU(Z,$){let Q={},Y=V(Z,["sdkHttpResponse"]);if(Y!=null)X(Q,["sdkHttpResponse"],Y);return Q}function OU(Z,$){let Q={},Y=V(Z,["sdkHttpResponse"]);if(Y!=null)X(Q,["sdkHttpResponse"],Y);return Q}function jU(Z,$,Q){let Y={};if(V(Z,["validationDataset"])!==void 0)throw Error("validationDataset parameter is not supported in Gemini API.");let W=V(Z,["tunedModelDisplayName"]);if($!==void 0&&W!=null)X($,["displayName"],W);if(V(Z,["description"])!==void 0)throw Error("description parameter is not supported in Gemini API.");let J=V(Z,["epochCount"]);if($!==void 0&&J!=null)X($,["tuningTask","hyperparameters","epochCount"],J);let K=V(Z,["learningRateMultiplier"]);if(K!=null)X(Y,["tuningTask","hyperparameters","learningRateMultiplier"],K);if(V(Z,["exportLastCheckpointOnly"])!==void 0)throw Error("exportLastCheckpointOnly parameter is not supported in Gemini API.");if(V(Z,["preTunedModelCheckpointId"])!==void 0)throw Error("preTunedModelCheckpointId parameter is not supported in Gemini API.");if(V(Z,["adapterSize"])!==void 0)throw Error("adapterSize parameter is not supported in Gemini API.");if(V(Z,["tuningMode"])!==void 0)throw Error("tuningMode parameter is not supported in Gemini API.");if(V(Z,["customBaseModel"])!==void 0)throw Error("customBaseModel parameter is not supported in Gemini API.");let q=V(Z,["batchSize"]);if($!==void 0&&q!=null)X($,["tuningTask","hyperparameters","batchSize"],q);let H=V(Z,["learningRate"]);if($!==void 0&&H!=null)X($,["tuningTask","hyperparameters","learningRate"],H);if(V(Z,["labels"])!==void 0)throw Error("labels parameter is not supported in Gemini API.");if(V(Z,["beta"])!==void 0)throw Error("beta parameter is not supported in Gemini API.");if(V(Z,["baseTeacherModel"])!==void 0)throw Error("baseTeacherModel parameter is not supported in Gemini API.");if(V(Z,["tunedTeacherModelSource"])!==void 0)throw Error("tunedTeacherModelSource parameter is not supported in Gemini API.");if(V(Z,["sftLossWeightMultiplier"])!==void 0)throw Error("sftLossWeightMultiplier parameter is not supported in Gemini API.");if(V(Z,["outputUri"])!==void 0)throw Error("outputUri parameter is not supported in Gemini API.");if(V(Z,["encryptionSpec"])!==void 0)throw Error("encryptionSpec parameter is not supported in Gemini API.");return Y}function _U(Z,$,Q){let Y={},W=V(Q,["config","method"]);if(W===void 0)W="SUPERVISED_FINE_TUNING";if(W==="SUPERVISED_FINE_TUNING"){let S=V(Z,["validationDataset"]);if($!==void 0&&S!=null)X($,["supervisedTuningSpec"],l6(S))}else if(W==="PREFERENCE_TUNING"){let S=V(Z,["validationDataset"]);if($!==void 0&&S!=null)X($,["preferenceOptimizationSpec"],l6(S))}else if(W==="DISTILLATION"){let S=V(Z,["validationDataset"]);if($!==void 0&&S!=null)X($,["distillationSpec"],l6(S))}let J=V(Z,["tunedModelDisplayName"]);if($!==void 0&&J!=null)X($,["tunedModelDisplayName"],J);let K=V(Z,["description"]);if($!==void 0&&K!=null)X($,["description"],K);let q=V(Q,["config","method"]);if(q===void 0)q="SUPERVISED_FINE_TUNING";if(q==="SUPERVISED_FINE_TUNING"){let S=V(Z,["epochCount"]);if($!==void 0&&S!=null)X($,["supervisedTuningSpec","hyperParameters","epochCount"],S)}else if(q==="PREFERENCE_TUNING"){let S=V(Z,["epochCount"]);if($!==void 0&&S!=null)X($,["preferenceOptimizationSpec","hyperParameters","epochCount"],S)}else if(q==="DISTILLATION"){let S=V(Z,["epochCount"]);if($!==void 0&&S!=null)X($,["distillationSpec","hyperParameters","epochCount"],S)}let H=V(Q,["config","method"]);if(H===void 0)H="SUPERVISED_FINE_TUNING";if(H==="SUPERVISED_FINE_TUNING"){let S=V(Z,["learningRateMultiplier"]);if($!==void 0&&S!=null)X($,["supervisedTuningSpec","hyperParameters","learningRateMultiplier"],S)}else if(H==="PREFERENCE_TUNING"){let S=V(Z,["learningRateMultiplier"]);if($!==void 0&&S!=null)X($,["preferenceOptimizationSpec","hyperParameters","learningRateMultiplier"],S)}else if(H==="DISTILLATION"){let S=V(Z,["learningRateMultiplier"]);if($!==void 0&&S!=null)X($,["distillationSpec","hyperParameters","learningRateMultiplier"],S)}let w=V(Q,["config","method"]);if(w===void 0)w="SUPERVISED_FINE_TUNING";if(w==="SUPERVISED_FINE_TUNING"){let S=V(Z,["exportLastCheckpointOnly"]);if($!==void 0&&S!=null)X($,["supervisedTuningSpec","exportLastCheckpointOnly"],S)}else if(w==="PREFERENCE_TUNING"){let S=V(Z,["exportLastCheckpointOnly"]);if($!==void 0&&S!=null)X($,["preferenceOptimizationSpec","exportLastCheckpointOnly"],S)}else if(w==="DISTILLATION"){let S=V(Z,["exportLastCheckpointOnly"]);if($!==void 0&&S!=null)X($,["distillationSpec","exportLastCheckpointOnly"],S)}let F=V(Q,["config","method"]);if(F===void 0)F="SUPERVISED_FINE_TUNING";if(F==="SUPERVISED_FINE_TUNING"){let S=V(Z,["adapterSize"]);if($!==void 0&&S!=null)X($,["supervisedTuningSpec","hyperParameters","adapterSize"],S)}else if(F==="PREFERENCE_TUNING"){let S=V(Z,["adapterSize"]);if($!==void 0&&S!=null)X($,["preferenceOptimizationSpec","hyperParameters","adapterSize"],S)}else if(F==="DISTILLATION"){let S=V(Z,["adapterSize"]);if($!==void 0&&S!=null)X($,["distillationSpec","hyperParameters","adapterSize"],S)}let z=V(Q,["config","method"]);if(z===void 0)z="SUPERVISED_FINE_TUNING";if(z==="SUPERVISED_FINE_TUNING"){let S=V(Z,["tuningMode"]);if($!==void 0&&S!=null)X($,["supervisedTuningSpec","tuningMode"],S)}else if(z==="DISTILLATION"){let S=V(Z,["tuningMode"]);if($!==void 0&&S!=null)X($,["distillationSpec","tuningMode"],S)}let G=V(Z,["customBaseModel"]);if($!==void 0&&G!=null)X($,["customBaseModel"],G);let D=V(Q,["config","method"]);if(D===void 0)D="SUPERVISED_FINE_TUNING";if(D==="SUPERVISED_FINE_TUNING"){let S=V(Z,["batchSize"]);if($!==void 0&&S!=null)X($,["supervisedTuningSpec","hyperParameters","batchSize"],S)}else if(D==="DISTILLATION"){let S=V(Z,["batchSize"]);if($!==void 0&&S!=null)X($,["distillationSpec","hyperParameters","batchSize"],S)}let T=V(Q,["config","method"]);if(T===void 0)T="SUPERVISED_FINE_TUNING";if(T==="SUPERVISED_FINE_TUNING"){let S=V(Z,["learningRate"]);if($!==void 0&&S!=null)X($,["supervisedTuningSpec","hyperParameters","learningRate"],S)}else if(T==="DISTILLATION"){let S=V(Z,["learningRate"]);if($!==void 0&&S!=null)X($,["distillationSpec","hyperParameters","learningRate"],S)}let I=V(Z,["labels"]);if($!==void 0&&I!=null)X($,["labels"],I);let P=V(Z,["beta"]);if($!==void 0&&P!=null)X($,["preferenceOptimizationSpec","hyperParameters","beta"],P);let O=V(Z,["baseTeacherModel"]);if($!==void 0&&O!=null)X($,["distillationSpec","baseTeacherModel"],O);let y=V(Z,["tunedTeacherModelSource"]);if($!==void 0&&y!=null)X($,["distillationSpec","tunedTeacherModelSource"],y);let x=V(Z,["sftLossWeightMultiplier"]);if($!==void 0&&x!=null)X($,["distillationSpec","hyperParameters","sftLossWeightMultiplier"],x);let m=V(Z,["outputUri"]);if($!==void 0&&m!=null)X($,["outputUri"],m);let f=V(Z,["encryptionSpec"]);if($!==void 0&&f!=null)X($,["encryptionSpec"],f);return Y}function hU(Z,$){let Q={},Y=V(Z,["baseModel"]);if(Y!=null)X(Q,["baseModel"],Y);let W=V(Z,["preTunedModel"]);if(W!=null)X(Q,["preTunedModel"],W);let J=V(Z,["trainingDataset"]);if(J!=null)uU(J);let K=V(Z,["config"]);if(K!=null)jU(K,Q);return Q}function kU(Z,$){let Q={},Y=V(Z,["baseModel"]);if(Y!=null)X(Q,["baseModel"],Y);let W=V(Z,["preTunedModel"]);if(W!=null)X(Q,["preTunedModel"],W);let J=V(Z,["trainingDataset"]);if(J!=null)dU(J,Q,$);let K=V(Z,["config"]);if(K!=null)_U(K,Q,$);return Q}function yU(Z,$){let Q={},Y=V(Z,["name"]);if(Y!=null)X(Q,["_url","name"],Y);return Q}function xU(Z,$){let Q={},Y=V(Z,["name"]);if(Y!=null)X(Q,["_url","name"],Y);return Q}function fU(Z,$,Q){let Y={},W=V(Z,["pageSize"]);if($!==void 0&&W!=null)X($,["_query","pageSize"],W);let J=V(Z,["pageToken"]);if($!==void 0&&J!=null)X($,["_query","pageToken"],J);let K=V(Z,["filter"]);if($!==void 0&&K!=null)X($,["_query","filter"],K);return Y}function gU(Z,$){let Q={},Y=V(Z,["config"]);if(Y!=null)fU(Y,Q);return Q}function bU(Z,$){let Q={},Y=V(Z,["sdkHttpResponse"]);if(Y!=null)X(Q,["sdkHttpResponse"],Y);let W=V(Z,["nextPageToken"]);if(W!=null)X(Q,["nextPageToken"],W);let J=V(Z,["tuningJobs"]);if(J!=null){let K=J;if(Array.isArray(K))K=K.map((q)=>{return wZ(q)});X(Q,["tuningJobs"],K)}return Q}function mU(Z,$){let Q={},Y=V(Z,["name"]);if(Y!=null)X(Q,["model"],Y);let W=V(Z,["name"]);if(W!=null)X(Q,["endpoint"],W);return Q}function uU(Z,$){let Q={};if(V(Z,["gcsUri"])!==void 0)throw Error("gcsUri parameter is not supported in Gemini API.");if(V(Z,["vertexDatasetResource"])!==void 0)throw Error("vertexDatasetResource parameter is not supported in Gemini API.");let Y=V(Z,["examples"]);if(Y!=null){let W=Y;if(Array.isArray(W))W=W.map((J)=>{return J});X(Q,["examples","examples"],W)}return Q}function dU(Z,$,Q){let Y={},W=V(Q,["config","method"]);if(W===void 0)W="SUPERVISED_FINE_TUNING";if(W==="SUPERVISED_FINE_TUNING"){let K=V(Z,["gcsUri"]);if($!==void 0&&K!=null)X($,["supervisedTuningSpec","trainingDatasetUri"],K)}else if(W==="PREFERENCE_TUNING"){let K=V(Z,["gcsUri"]);if($!==void 0&&K!=null)X($,["preferenceOptimizationSpec","trainingDatasetUri"],K)}else if(W==="DISTILLATION"){let K=V(Z,["gcsUri"]);if($!==void 0&&K!=null)X($,["distillationSpec","promptDatasetUri"],K)}let J=V(Q,["config","method"]);if(J===void 0)J="SUPERVISED_FINE_TUNING";if(J==="SUPERVISED_FINE_TUNING"){let K=V(Z,["vertexDatasetResource"]);if($!==void 0&&K!=null)X($,["supervisedTuningSpec","trainingDatasetUri"],K)}else if(J==="PREFERENCE_TUNING"){let K=V(Z,["vertexDatasetResource"]);if($!==void 0&&K!=null)X($,["preferenceOptimizationSpec","trainingDatasetUri"],K)}else if(J==="DISTILLATION"){let K=V(Z,["vertexDatasetResource"]);if($!==void 0&&K!=null)X($,["distillationSpec","promptDatasetUri"],K)}if(V(Z,["examples"])!==void 0)throw Error("examples parameter is not supported in Gemini Enterprise Agent Platform (previously known as Vertex AI).");return Y}function lU(Z,$){let Q={},Y=V(Z,["sdkHttpResponse"]);if(Y!=null)X(Q,["sdkHttpResponse"],Y);let W=V(Z,["name"]);if(W!=null)X(Q,["name"],W);let J=V(Z,["state"]);if(J!=null)X(Q,["state"],jV(J));let K=V(Z,["createTime"]);if(K!=null)X(Q,["createTime"],K);let q=V(Z,["tuningTask","startTime"]);if(q!=null)X(Q,["startTime"],q);let H=V(Z,["tuningTask","completeTime"]);if(H!=null)X(Q,["endTime"],H);let w=V(Z,["updateTime"]);if(w!=null)X(Q,["updateTime"],w);let F=V(Z,["description"]);if(F!=null)X(Q,["description"],F);let z=V(Z,["baseModel"]);if(z!=null)X(Q,["baseModel"],z);let G=V(Z,["_self"]);if(G!=null)X(Q,["tunedModel"],mU(G));return Q}function wZ(Z,$){let Q={},Y=V(Z,["sdkHttpResponse"]);if(Y!=null)X(Q,["sdkHttpResponse"],Y);let W=V(Z,["name"]);if(W!=null)X(Q,["name"],W);let J=V(Z,["state"]);if(J!=null)X(Q,["state"],jV(J));let K=V(Z,["createTime"]);if(K!=null)X(Q,["createTime"],K);let q=V(Z,["startTime"]);if(q!=null)X(Q,["startTime"],q);let H=V(Z,["endTime"]);if(H!=null)X(Q,["endTime"],H);let w=V(Z,["updateTime"]);if(w!=null)X(Q,["updateTime"],w);let F=V(Z,["error"]);if(F!=null)X(Q,["error"],F);let z=V(Z,["description"]);if(z!=null)X(Q,["description"],z);let G=V(Z,["baseModel"]);if(G!=null)X(Q,["baseModel"],G);let D=V(Z,["tunedModel"]);if(D!=null)X(Q,["tunedModel"],D);let T=V(Z,["preTunedModel"]);if(T!=null)X(Q,["preTunedModel"],T);let I=V(Z,["supervisedTuningSpec"]);if(I!=null)X(Q,["supervisedTuningSpec"],I);let P=V(Z,["preferenceOptimizationSpec"]);if(P!=null)X(Q,["preferenceOptimizationSpec"],P);let O=V(Z,["distillationSpec"]);if(O!=null)X(Q,["distillationSpec"],O);let y=V(Z,["tuningDataStats"]);if(y!=null)X(Q,["tuningDataStats"],y);let x=V(Z,["encryptionSpec"]);if(x!=null)X(Q,["encryptionSpec"],x);let m=V(Z,["partnerModelTuningSpec"]);if(m!=null)X(Q,["partnerModelTuningSpec"],m);let f=V(Z,["customBaseModel"]);if(f!=null)X(Q,["customBaseModel"],f);let S=V(Z,["evaluateDatasetRuns"]);if(S!=null){let R0=S;if(Array.isArray(R0))R0=R0.map((H0)=>{return H0});X(Q,["evaluateDatasetRuns"],R0)}let d=V(Z,["experiment"]);if(d!=null)X(Q,["experiment"],d);let h=V(Z,["fullFineTuningSpec"]);if(h!=null)X(Q,["fullFineTuningSpec"],h);let _=V(Z,["labels"]);if(_!=null)X(Q,["labels"],_);let n=V(Z,["outputUri"]);if(n!=null)X(Q,["outputUri"],n);let o=V(Z,["pipelineJob"]);if(o!=null)X(Q,["pipelineJob"],o);let t=V(Z,["serviceAccount"]);if(t!=null)X(Q,["serviceAccount"],t);let J0=V(Z,["tunedModelDisplayName"]);if(J0!=null)X(Q,["tunedModelDisplayName"],J0);let $0=V(Z,["tuningJobState"]);if($0!=null)X(Q,["tuningJobState"],$0);let V0=V(Z,["veoTuningSpec"]);if(V0!=null)X(Q,["veoTuningSpec"],V0);let q0=V(Z,["distillationSamplingSpec"]);if(q0!=null)X(Q,["distillationSamplingSpec"],q0);let L0=V(Z,["tuningJobMetadata"]);if(L0!=null)X(Q,["tuningJobMetadata"],L0);return Q}function cU(Z,$){let Q={},Y=V(Z,["sdkHttpResponse"]);if(Y!=null)X(Q,["sdkHttpResponse"],Y);let W=V(Z,["name"]);if(W!=null)X(Q,["name"],W);let J=V(Z,["metadata"]);if(J!=null)X(Q,["metadata"],J);let K=V(Z,["done"]);if(K!=null)X(Q,["done"],K);let q=V(Z,["error"]);if(q!=null)X(Q,["error"],q);return Q}function l6(Z,$){let Q={},Y=V(Z,["gcsUri"]);if(Y!=null)X(Q,["validationDatasetUri"],Y);let W=V(Z,["vertexDatasetResource"]);if(W!=null)X(Q,["validationDatasetUri"],W);return Q}class AJ extends a0{constructor(Z){super();this.apiClient=Z,this.list=async($={})=>{return new q4(e0.PAGED_ITEM_TUNING_JOBS,(Q)=>this.listInternal(Q),await this.listInternal($),$)},this.get=async($)=>{return await this.getInternal($)},this.tune=async($)=>{var Q;if(this.apiClient.isVertexAI())if($.baseModel.startsWith("projects/")){let Y={tunedModelName:$.baseModel};if((Q=$.config)===null||Q===void 0?void 0:Q.preTunedModelCheckpointId)Y.checkpointId=$.config.preTunedModelCheckpointId;let W=Object.assign(Object.assign({},$),{preTunedModel:Y});return W.baseModel=void 0,await this.tuneInternal(W)}else{let Y=Object.assign({},$);return await this.tuneInternal(Y)}else{let Y=Object.assign({},$),W=await this.tuneMldevInternal(Y),J="";if(W.metadata!==void 0&&W.metadata.tunedModel!==void 0)J=W.metadata.tunedModel;else if(W.name!==void 0&&W.name.includes("/operations/"))J=W.name.split("/operations/")[0];return{name:J,state:p6.JOB_STATE_QUEUED}}}}async getInternal(Z){var $,Q,Y,W;let J,K="",q={};if(this.apiClient.isVertexAI()){let H=xU(Z);return K=u("{name}",H._url),q=H._query,delete H._url,delete H._query,J=this.apiClient.request({path:K,queryParams:q,body:JSON.stringify(H),httpMethod:"GET",httpOptions:($=Z.config)===null||$===void 0?void 0:$.httpOptions,abortSignal:(Q=Z.config)===null||Q===void 0?void 0:Q.abortSignal}).then((w)=>{return w.json().then((F)=>{let z=F;return z.sdkHttpResponse={headers:w.headers},z})}),J.then((w)=>{return wZ(w)})}else{let H=yU(Z);return K=u("{name}",H._url),q=H._query,delete H._url,delete H._query,J=this.apiClient.request({path:K,queryParams:q,body:JSON.stringify(H),httpMethod:"GET",httpOptions:(Y=Z.config)===null||Y===void 0?void 0:Y.httpOptions,abortSignal:(W=Z.config)===null||W===void 0?void 0:W.abortSignal}).then((w)=>{return w.json().then((F)=>{let z=F;return z.sdkHttpResponse={headers:w.headers},z})}),J.then((w)=>{return lU(w)})}}async listInternal(Z){var $,Q;let Y,W="",J={};if(this.apiClient.isVertexAI()){let K=gU(Z);return W=u("tuningJobs",K._url),J=K._query,delete K._url,delete K._query,Y=this.apiClient.request({path:W,queryParams:J,body:JSON.stringify(K),httpMethod:"GET",httpOptions:($=Z.config)===null||$===void 0?void 0:$.httpOptions,abortSignal:(Q=Z.config)===null||Q===void 0?void 0:Q.abortSignal}).then((q)=>{return q.json().then((H)=>{let w=H;return w.sdkHttpResponse={headers:q.headers},w})}),Y.then((q)=>{let H=bU(q),w=new DV;return Object.assign(w,H),w})}else throw Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async cancel(Z){var $,Q,Y,W;let J,K="",q={};if(this.apiClient.isVertexAI()){let H=vU(Z);return K=u("{name}:cancel",H._url),q=H._query,delete H._url,delete H._query,J=this.apiClient.request({path:K,queryParams:q,body:JSON.stringify(H),httpMethod:"POST",httpOptions:($=Z.config)===null||$===void 0?void 0:$.httpOptions,abortSignal:(Q=Z.config)===null||Q===void 0?void 0:Q.abortSignal}).then((w)=>{return w.json().then((F)=>{let z=F;return z.sdkHttpResponse={headers:w.headers},z})}),J.then((w)=>{let F=OU(w),z=new t6;return Object.assign(z,F),z})}else{let H=CU(Z);return K=u("{name}:cancel",H._url),q=H._query,delete H._url,delete H._query,J=this.apiClient.request({path:K,queryParams:q,body:JSON.stringify(H),httpMethod:"POST",httpOptions:(Y=Z.config)===null||Y===void 0?void 0:Y.httpOptions,abortSignal:(W=Z.config)===null||W===void 0?void 0:W.abortSignal}).then((w)=>{return w.json().then((F)=>{let z=F;return z.sdkHttpResponse={headers:w.headers},z})}),J.then((w)=>{let F=EU(w),z=new t6;return Object.assign(z,F),z})}}async tuneInternal(Z){var $,Q;let Y,W="",J={};if(this.apiClient.isVertexAI()){let K=kU(Z,Z);return W=u("tuningJobs",K._url),J=K._query,delete K._url,delete K._query,Y=this.apiClient.request({path:W,queryParams:J,body:JSON.stringify(K),httpMethod:"POST",httpOptions:($=Z.config)===null||$===void 0?void 0:$.httpOptions,abortSignal:(Q=Z.config)===null||Q===void 0?void 0:Q.abortSignal}).then((q)=>{return q.json().then((H)=>{let w=H;return w.sdkHttpResponse={headers:q.headers},w})}),Y.then((q)=>{return wZ(q)})}else throw Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async tuneMldevInternal(Z){var $,Q;let Y,W="",J={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");else{let K=hU(Z);return W=u("tunedModels",K._url),J=K._query,delete K._url,delete K._query,Y=this.apiClient.request({path:W,queryParams:J,body:JSON.stringify(K),httpMethod:"POST",httpOptions:($=Z.config)===null||$===void 0?void 0:$.httpOptions,abortSignal:(Q=Z.config)===null||Q===void 0?void 0:Q.abortSignal}).then((q)=>{return q.json().then((H)=>{let w=H;return w.sdkHttpResponse={headers:q.headers},w})}),Y.then((q)=>{return cU(q)})}}}var PJ=8388608,SJ=3,CJ=1000,vJ=2,J4="x-goog-upload-status";async function pU(Z,$,Q,Y){var W;let J=await EJ(Z,$,Q,Y),K=await(J===null||J===void 0?void 0:J.json());if(((W=J===null||J===void 0?void 0:J.headers)===null||W===void 0?void 0:W[J4])!=="final")throw Error("Failed to upload file: Upload status is not finalized.");return K.file}async function iU(Z,$,Q,Y){var W;let J=await EJ(Z,$,Q,Y),K=await(J===null||J===void 0?void 0:J.json());if(((W=J===null||J===void 0?void 0:J.headers)===null||W===void 0?void 0:W[J4])!=="final")throw Error("Failed to upload file: Upload status is not finalized.");let q=FZ(K),H=new $8;return Object.assign(H,q),H}async function EJ(Z,$,Q,Y){var W,J,K;let q=$,H=(Y===null||Y===void 0?void 0:Y.baseUrl)||((W=Q.clientOptions.httpOptions)===null||W===void 0?void 0:W.baseUrl);if(H){let D=new URL(H),T=new URL($);T.protocol=D.protocol,T.host=D.host,T.port=D.port,q=T.toString()}let w=0,F=0,z=new I4(new Response),G="upload";w=Z.size;while(F<w){let D=Math.min(PJ,w-F),T=Z.slice(F,F+D);if(F+D>=w)G+=", finalize";let I=0,P=CJ;while(I<SJ){let O=Object.assign(Object.assign({},(Y===null||Y===void 0?void 0:Y.headers)||{}),{"X-Goog-Upload-Command":G,"X-Goog-Upload-Offset":String(F),"Content-Length":String(D)});if(z=await Q.request({path:"",body:T,httpMethod:"POST",httpOptions:Object.assign(Object.assign({},Y),{apiVersion:"",baseUrl:q,headers:O})}),(J=z===null||z===void 0?void 0:z.headers)===null||J===void 0?void 0:J[J4])break;I++,await OJ(P),P=P*vJ}if(F+=D,((K=z===null||z===void 0?void 0:z.headers)===null||K===void 0?void 0:K[J4])!=="active")break;if(w<=F)throw Error("All content has been uploaded, but the upload status is not finalized.")}return z}async function aU(Z){return{size:Z.size,type:Z.type}}function OJ(Z){return new Promise(($)=>setTimeout($,Z))}class jJ{async stat(Z){let $={size:0,type:void 0};if(typeof Z==="string"){let Q=await Z8.stat(Z);return $.size=Q.size,$.type=this.inferMimeType(Z),$}else return await aU(Z)}async upload(Z,$,Q,Y){if(typeof Z==="string")return await this.uploadFileFromPath(Z,$,Q,Y);else return pU(Z,$,Q,Y)}async uploadToFileSearchStore(Z,$,Q,Y){if(typeof Z==="string")return await this.uploadFileToFileSearchStoreFromPath(Z,$,Q,Y);else return iU(Z,$,Q,Y)}inferMimeType(Z){let $=Z.slice(Z.lastIndexOf(".")+1);return{aac:"audio/aac",abw:"application/x-abiword",arc:"application/x-freearc",avi:"video/x-msvideo",azw:"application/vnd.amazon.ebook",bin:"application/octet-stream",bmp:"image/bmp",bz:"application/x-bzip",bz2:"application/x-bzip2",csh:"application/x-csh",css:"text/css",csv:"text/csv",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",eot:"application/vnd.ms-fontobject",epub:"application/epub+zip",gz:"application/gzip",gif:"image/gif",htm:"text/html",html:"text/html",ico:"image/vnd.microsoft.icon",ics:"text/calendar",jar:"application/java-archive",jpeg:"image/jpeg",jpg:"image/jpeg",js:"text/javascript",json:"application/json",jsonld:"application/ld+json",kml:"application/vnd.google-earth.kml+xml",kmz:"application/vnd.google-earth.kmz+xml",mjs:"text/javascript",mp3:"audio/mpeg",mp4:"video/mp4",mpeg:"video/mpeg",mpkg:"application/vnd.apple.installer+xml",odt:"application/vnd.oasis.opendocument.text",oga:"audio/ogg",ogv:"video/ogg",ogx:"application/ogg",opus:"audio/opus",otf:"font/otf",png:"image/png",pdf:"application/pdf",php:"application/x-httpd-php",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",rar:"application/vnd.rar",rtf:"application/rtf",sh:"application/x-sh",svg:"image/svg+xml",swf:"application/x-shockwave-flash",tar:"application/x-tar",tif:"image/tiff",tiff:"image/tiff",ts:"video/mp2t",ttf:"font/ttf",txt:"text/plain",vsd:"application/vnd.visio",wav:"audio/wav",weba:"audio/webm",webm:"video/webm",webp:"image/webp",woff:"font/woff",woff2:"font/woff2",xhtml:"application/xhtml+xml",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xml:"application/xml",xul:"application/vnd.mozilla.xul+xml",zip:"application/zip","3gp":"video/3gpp","3g2":"video/3gpp2","7z":"application/x-7z-compressed"}[$.toLowerCase()]}async uploadFileFromPath(Z,$,Q,Y){var W;let J=await this.uploadFileFromPathInternal(Z,$,Q,Y),K=await(J===null||J===void 0?void 0:J.json());if(((W=J===null||J===void 0?void 0:J.headers)===null||W===void 0?void 0:W[J4])!=="final")throw Error("Failed to upload file: Upload status is not finalized.");return K.file}async uploadFileToFileSearchStoreFromPath(Z,$,Q,Y){var W;let J=await this.uploadFileFromPathInternal(Z,$,Q,Y),K=await(J===null||J===void 0?void 0:J.json());if(((W=J===null||J===void 0?void 0:J.headers)===null||W===void 0?void 0:W[J4])!=="final")throw Error("Failed to upload file: Upload status is not finalized.");let q=FZ(K),H=new $8;return Object.assign(H,q),H}async uploadFileFromPathInternal(Z,$,Q,Y){var W,J,K;let q=$,H=(Y===null||Y===void 0?void 0:Y.baseUrl)||((W=Q.clientOptions.httpOptions)===null||W===void 0?void 0:W.baseUrl);if(H){let I=new URL(H),P=new URL($);P.protocol=I.protocol,P.host=I.host,P.port=I.port,q=P.toString()}let w=0,F=0,z=new I4(new Response),G="upload",D,T=HV.basename(Z);try{if(D=await Z8.open(Z,"r"),!D)throw Error("Failed to open file");w=(await D.stat()).size;while(F<w){let I=Math.min(PJ,w-F);if(F+I>=w)G+=", finalize";let P=new Uint8Array(I),{bytesRead:O}=await D.read(P,0,I,F);if(O!==I)throw Error(`Failed to read ${I} bytes from file at offset ${F}. bytes actually read: ${O}`);let y=new Blob([P]),x=0,m=CJ;while(x<SJ){let f=Object.assign(Object.assign({},(Y===null||Y===void 0?void 0:Y.headers)||{}),{"X-Goog-Upload-Command":G,"X-Goog-Upload-Offset":String(F),"Content-Length":String(O),"X-Goog-Upload-File-Name":T});if(z=await Q.request({path:"",body:y,httpMethod:"POST",httpOptions:Object.assign(Object.assign({},Y),{apiVersion:"",baseUrl:q,headers:f})}),(J=z===null||z===void 0?void 0:z.headers)===null||J===void 0?void 0:J[J4])break;x++,await OJ(m),m=m*vJ}if(F+=O,((K=z===null||z===void 0?void 0:z.headers)===null||K===void 0?void 0:K[J4])!=="active")break;if(w<=F)throw Error("All content has been uploaded, but the upload status is not finalized.")}return z}finally{if(D)await D.close()}}}class _J extends pV{async registerFiles(Z){if(typeof process>"u"||!process.versions||!process.versions.node)throw Error("registerFiles is only supported in Node.js environments.");let Q=await Z.auth.getRequestHeaders(),Y=Z.config||{},W=Y.httpOptions||{},J=Object.assign({},W.headers||{});if(Q)if(typeof Q[Symbol.iterator]==="function")for(let[K,q]of Q)J[K]=q;else for(let[K,q]of Object.entries(Q))J[K]=q;return this._registerFiles({uris:Z.uris,config:Object.assign(Object.assign({},Y),{httpOptions:Object.assign(Object.assign({},W),{headers:J})})})}}var nU="gl-node/";function rU(Z){var $;if(Z.enterprise!==void 0||Z.vertexai!==void 0){if(Z.enterprise!==void 0&&Z.vertexai!==void 0&&Z.enterprise!==Z.vertexai)throw Error("enterprise and vertexAI flags have conflicting values, please set enterprise value only.");return($=Z.enterprise)!==null&&$!==void 0?$:Z.vertexai}let Q=X4("GOOGLE_GENAI_USE_ENTERPRISE"),Y=X4("GOOGLE_GENAI_USE_VERTEXAI"),W=XV(Q),J=XV(Y);if(Q!==void 0&&Y!==void 0&&W!==J)console.warn("Warning: Both GOOGLE_GENAI_USE_ENTERPRISE and GOOGLE_GENAI_USE_VERTEXAI are set with conflicting values. The value of GOOGLE_GENAI_USE_ENTERPRISE will be used.");if(Q!==void 0)return W;if(Y!==void 0)return J;return!1}class sU{getNextGenClient(){var Z;let $=this.httpOptions;if(this._nextGenClient===void 0)this._nextGenClient=new w0({baseURL:this.apiClient.getBaseUrl(),apiKey:this.apiKey,apiVersion:this.apiClient.getApiVersion(),clientAdapter:this.apiClient,defaultHeaders:this.apiClient.getDefaultHeaders(),timeout:$===null||$===void 0?void 0:$.timeout,maxRetries:(Z=$===null||$===void 0?void 0:$.retryOptions)===null||Z===void 0?void 0:Z.attempts});if($===null||$===void 0?void 0:$.extraBody)console.warn("GoogleGenAI.interactions: Client level httpOptions.extraBody is not supported by the interactions client and will be ignored.");return this._nextGenClient}get interactions(){if(this._interactions!==void 0)return this._interactions;return console.warn("GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions."),this._interactions=this.getNextGenClient().interactions,this._interactions}get webhooks(){if(this._webhooks!==void 0)return this._webhooks;return this._webhooks=this.getNextGenClient().webhooks,this._webhooks}constructor(Z){var $,Q,Y,W;if((Z.project||Z.location)&&Z.apiKey)throw Error("Project/location and API key are mutually exclusive in the client initializer.");this.vertexai=rU(Z);let J=oU(),K=X4("GOOGLE_CLOUD_PROJECT"),q=X4("GOOGLE_CLOUD_LOCATION");if(this.apiKey=($=Z.apiKey)!==null&&$!==void 0?$:J,this.project=(Q=Z.project)!==null&&Q!==void 0?Q:K,this.location=(Y=Z.location)!==null&&Y!==void 0?Y:q,!this.vertexai&&!this.apiKey)console.warn("API key should be set when using the Gemini API.");if(this.vertexai){if((W=Z.googleAuthOptions)===null||W===void 0?void 0:W.credentials)console.debug("The user provided Google Cloud credentials will take precedence over the API key from the environment variable."),this.apiKey=void 0;if((K||q)&&Z.apiKey)console.debug("The user provided Vertex AI API key will take precedence over the project/location from the environment variables."),this.project=void 0,this.location=void 0;else if((Z.project||Z.location)&&J)console.debug("The user provided project/location will take precedence over the API key from the environment variables."),this.apiKey=void 0;else if((K||q)&&J)console.debug("The project/location from the environment variables will take precedence over the API key from the environment variables."),this.apiKey=void 0;if(!this.location&&!this.apiKey)this.location="global"}let H=Fw(Z.httpOptions,this.vertexai,X4("GOOGLE_VERTEX_BASE_URL"),X4("GOOGLE_GEMINI_BASE_URL"));if(H)if(Z.httpOptions)Z.httpOptions.baseUrl=H;else Z.httpOptions={baseUrl:H};this.apiVersion=Z.apiVersion,this.httpOptions=Z.httpOptions;let w=new TJ({apiKey:this.apiKey,googleAuthOptions:Z.googleAuthOptions});this.apiClient=new eV({auth:w,project:this.project,location:this.location,apiVersion:this.apiVersion,apiKey:this.apiKey,vertexai:this.vertexai,httpOptions:this.httpOptions,userAgentExtra:nU+process.version,uploader:new jJ,downloader:new BJ}),this.models=new JJ(this.apiClient),this.live=new WJ(this.apiClient,w,new LJ),this.batches=new mV(this.apiClient),this.chats=new lV(this.models,this.apiClient),this.caches=new uV(this.apiClient),this.files=new _J(this.apiClient),this.operations=new XJ(this.apiClient),this.authTokens=new KJ(this.apiClient),this.tunings=new AJ(this.apiClient),this.fileSearchStores=new HJ(this.apiClient)}}function X4(Z){var $,Q,Y;return(Y=(Q=($=process===null||process===void 0?void 0:process.env)===null||$===void 0?void 0:$[Z])===null||Q===void 0?void 0:Q.trim())!==null&&Y!==void 0?Y:void 0}function XV(Z){if(Z===void 0)return!1;return Z.toLowerCase()==="true"}function oU(){let Z=X4("GOOGLE_API_KEY"),$=X4("GEMINI_API_KEY");if(Z&&$)console.warn("Both GOOGLE_API_KEY and GEMINI_API_KEY are set. Using GOOGLE_API_KEY.");return Z||$||void 0}
44
- export{bW as Lk,mW as Mk,iW as Nk,i6 as Ok,sU as Pk};
44
+ export{bW as ck,mW as dk,iW as ek,i6 as fk,sU as gk};