@arcgis/portal-components 5.2.0-next.8 → 5.2.0-next.85

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 (515) hide show
  1. package/LICENSE.md +4 -2
  2. package/README.md +2 -2
  3. package/dist/cdn/2GBRZSEC.js +2 -0
  4. package/dist/cdn/2Q3FIPE2.js +2 -0
  5. package/dist/cdn/{GQFWFZXP.js → 3OBIA66A.js} +1 -1
  6. package/dist/cdn/3YCG5UCH.js +2 -0
  7. package/dist/cdn/44ORWHRO.js +2 -0
  8. package/dist/cdn/4QA4AYHJ.js +3 -0
  9. package/dist/cdn/4UANPBCB.js +2 -0
  10. package/dist/cdn/{QNUYUNEY.js → 5A54YFFZ.js} +1 -1
  11. package/dist/cdn/{WOZDQW3S.js → 5CB5N3QF.js} +1 -1
  12. package/dist/cdn/5HEZSRAM.js +2 -0
  13. package/dist/cdn/5MVBQWW3.js +2 -0
  14. package/dist/cdn/{7WZHZP6U.js → 63THOLAY.js} +9 -3
  15. package/dist/cdn/6BALICUQ.js +660 -0
  16. package/dist/cdn/6KVA4AKM.js +2 -0
  17. package/dist/cdn/6TO2BYXU.js +2 -0
  18. package/dist/cdn/76A6NXMY.js +2 -0
  19. package/dist/cdn/77U3PPBC.js +2 -0
  20. package/dist/cdn/7FISFQAB.js +2 -0
  21. package/dist/cdn/AMBLICID.js +2 -0
  22. package/dist/cdn/APIPQGZL.js +2 -0
  23. package/dist/cdn/BBVFGC6Y.js +2 -0
  24. package/dist/cdn/BSUUZZ2V.js +2 -0
  25. package/dist/cdn/BTLJZVSE.js +2 -0
  26. package/dist/cdn/{DHHSKOUY.js → BXCQOWAD.js} +1 -1
  27. package/dist/cdn/C747DAF4.js +2 -0
  28. package/dist/cdn/{DKBTJJMW.js → C7ZFXRPS.js} +1 -1
  29. package/dist/cdn/CD2GV5YW.js +2 -0
  30. package/dist/cdn/CFBSBZSS.js +2 -0
  31. package/dist/cdn/DHWAQSKG.js +2 -0
  32. package/dist/cdn/DPDTU2XT.js +2 -0
  33. package/dist/cdn/E4D3U6ZA.js +2 -0
  34. package/dist/cdn/EBYEZR4N.js +2 -0
  35. package/dist/cdn/ECA5GSSU.js +2 -0
  36. package/dist/cdn/EHJZA2TD.js +2 -0
  37. package/dist/cdn/EZYI6JU7.js +2 -0
  38. package/dist/cdn/F3ODJVJC.js +2 -0
  39. package/dist/cdn/FUZGJQMO.js +66 -0
  40. package/dist/cdn/FWJOBVEA.js +2 -0
  41. package/dist/cdn/GADH24KO.js +2 -0
  42. package/dist/cdn/GAZBGDIO.js +2 -0
  43. package/dist/cdn/GP3HHUGX.js +2 -0
  44. package/dist/cdn/{ZTHTFEYA.js → GY2BYUKF.js} +1 -1
  45. package/dist/cdn/H4SORY4B.js +2 -0
  46. package/dist/cdn/H5X6CZD4.js +2 -0
  47. package/dist/cdn/IJ3CLFAU.js +22 -0
  48. package/dist/cdn/ILDTKRON.js +2 -0
  49. package/dist/cdn/J57ZXL3U.js +2 -0
  50. package/dist/cdn/JCYCRSPL.js +451 -0
  51. package/dist/cdn/K3HEPB7Q.js +2 -0
  52. package/dist/cdn/KL4DIIKW.js +2 -0
  53. package/dist/cdn/{3PAHY5KA.js → KNRJ3WXR.js} +1 -1
  54. package/dist/cdn/KQCTBRGJ.js +2 -0
  55. package/dist/cdn/{F6V7MLPY.js → L6KBBJEC.js} +1 -1
  56. package/dist/cdn/LDIZD36E.js +2 -0
  57. package/dist/cdn/LRADZ46B.js +2 -0
  58. package/dist/cdn/MK3S5P4U.js +2 -0
  59. package/dist/cdn/NASFEWDT.js +2 -0
  60. package/dist/cdn/O2WST7EA.js +2 -0
  61. package/dist/cdn/{LQ3DMZ3K.js → O3RR6UMN.js} +1 -1
  62. package/dist/cdn/OAKVCMNN.js +2 -0
  63. package/dist/cdn/OBBYT2AV.js +2 -0
  64. package/dist/cdn/OHEUIODH.js +2 -0
  65. package/dist/cdn/OSA2BEVZ.js +2 -0
  66. package/dist/cdn/{53MSUMA3.js → OT4PZJNB.js} +17 -1
  67. package/dist/cdn/OTP4IA4V.js +2 -0
  68. package/dist/cdn/P2PZMKRD.js +2 -0
  69. package/dist/cdn/{LAFNDBTQ.js → P7YQCAM2.js} +1 -1
  70. package/dist/cdn/QE4CNVDQ.js +34 -0
  71. package/dist/cdn/{AQWTJKUH.js → QKCV7CY2.js} +10 -8
  72. package/dist/cdn/QREMLELA.js +2 -0
  73. package/dist/cdn/QS3GXAIH.js +2 -0
  74. package/dist/cdn/R5MGNFM2.js +2 -0
  75. package/dist/cdn/RHABZWTF.js +2 -0
  76. package/dist/cdn/SKRCLDPZ.js +2 -0
  77. package/dist/cdn/SLTFLCVR.js +99 -0
  78. package/dist/cdn/SOJ5KMMZ.js +2 -0
  79. package/dist/cdn/{GT26WGJS.js → T3LU5V74.js} +1 -1
  80. package/dist/cdn/T4DHIZOR.js +2 -0
  81. package/dist/cdn/TGTT2CVD.js +2 -0
  82. package/dist/cdn/{DXCPWJU4.js → TKCE4WYE.js} +1 -1
  83. package/dist/cdn/TUBYAQ6R.js +2 -0
  84. package/dist/cdn/TZ4TGONL.js +2 -0
  85. package/dist/cdn/UEL7BVMB.js +2 -0
  86. package/dist/cdn/UZLQALHY.js +2 -0
  87. package/dist/cdn/{RR4BIAPA.js → V4EYW3O6.js} +1 -1
  88. package/dist/cdn/V6N5BWDA.js +2 -0
  89. package/dist/cdn/V6VNED6L.js +2 -0
  90. package/dist/cdn/VBJRF4J7.js +2 -0
  91. package/dist/cdn/VMQIDO4Z.js +2 -0
  92. package/dist/cdn/{74XFARCV.js → VW7DSKPH.js} +1 -1
  93. package/dist/cdn/W2SYL7IJ.js +71 -0
  94. package/dist/cdn/{W6PSG4GX.js → W4FGRGLV.js} +10 -5
  95. package/dist/cdn/{SYJSVUUR.js → W4SAWMXS.js} +1 -1
  96. package/dist/cdn/WBZLQZYR.js +134 -0
  97. package/dist/cdn/WNZF3XVD.js +2 -0
  98. package/dist/cdn/XEK22IDA.js +2 -0
  99. package/dist/cdn/XRPX4IA3.js +2 -0
  100. package/dist/cdn/Y36YTONO.js +2 -0
  101. package/dist/cdn/Y72RYETN.js +2 -0
  102. package/dist/cdn/YDYJ5MIY.js +2 -0
  103. package/dist/cdn/YVKSTDL6.js +2 -0
  104. package/dist/cdn/ZAB6B2B6.js +2 -0
  105. package/dist/cdn/ZD6WCKLD.js +2 -0
  106. package/dist/cdn/assets/portal-account-switcher/t9n/messages.en.json +1 -0
  107. package/dist/cdn/assets/portal-ai-assistant/t9n/messages.en.json +1 -1
  108. package/dist/cdn/assets/portal-browser/t9n/messages.en.json +1 -0
  109. package/dist/cdn/assets/portal-group-browser/t9n/messages.en.json +1 -0
  110. package/dist/cdn/assets/portal-group-card/t9n/messages.en.json +1 -0
  111. package/dist/cdn/assets/portal-item-badges/t9n/messages.en.json +1 -0
  112. package/dist/cdn/assets/portal-item-card/t9n/messages.en.json +1 -0
  113. package/dist/cdn/assets/portal-item-favorite/t9n/messages.en.json +1 -0
  114. package/dist/cdn/assets/portal-item-type/icons/applicationtheme16.svg +1 -0
  115. package/dist/cdn/assets/portal-item-type/icons/applicationtheme32.svg +1 -0
  116. package/dist/cdn/assets/portal-item-type/icons/knowledgegraphconfiguration16.svg +1 -0
  117. package/dist/cdn/assets/portal-item-type/icons/knowledgegraphconfiguration32.svg +1 -0
  118. package/dist/cdn/assets/portal-item-type/icons/layout16.svg +1 -0
  119. package/dist/cdn/assets/portal-item-type/icons/layout32.svg +1 -0
  120. package/dist/cdn/assets/portal-item-type/icons/parquetfeaturelayer16.svg +1 -0
  121. package/dist/cdn/assets/portal-item-type/icons/parquetfeaturelayer32.svg +1 -0
  122. package/dist/cdn/assets/portal-item-type/icons/storymapframe16.svg +1 -0
  123. package/dist/cdn/assets/portal-item-type/icons/storymapframe32.svg +1 -0
  124. package/dist/cdn/assets/portal-item-type/t9n/messages.en.json +1 -1
  125. package/dist/cdn/assets/portal-navigation/apps/api-for-python.avif +0 -0
  126. package/dist/cdn/assets/portal-navigation/apps/appstudio.avif +0 -0
  127. package/dist/cdn/assets/portal-navigation/apps/arcade.avif +0 -0
  128. package/dist/cdn/assets/portal-navigation/apps/arcgis-360-vr.avif +0 -0
  129. package/dist/cdn/assets/portal-navigation/apps/arcgis-earth.avif +0 -0
  130. package/dist/cdn/assets/portal-navigation/apps/arcgis-enterprise.avif +0 -0
  131. package/dist/cdn/assets/portal-navigation/apps/arcgis-experience-builder.avif +0 -0
  132. package/dist/cdn/assets/portal-navigation/apps/arcgis-geoanalytics.avif +0 -0
  133. package/dist/cdn/assets/portal-navigation/apps/arcgis-hub.avif +0 -0
  134. package/dist/cdn/assets/portal-navigation/apps/arcgis-online.avif +0 -0
  135. package/dist/cdn/assets/portal-navigation/apps/arcgis-pro.avif +0 -0
  136. package/dist/cdn/assets/portal-navigation/apps/arcgis-reality-studio.avif +0 -0
  137. package/dist/cdn/assets/portal-navigation/apps/arcgis-urban.avif +0 -0
  138. package/dist/cdn/assets/portal-navigation/apps/blank.avif +0 -0
  139. package/dist/cdn/assets/portal-navigation/apps/business-analyst.avif +0 -0
  140. package/dist/cdn/assets/portal-navigation/apps/city-engine.avif +0 -0
  141. package/dist/cdn/assets/portal-navigation/apps/collector.avif +0 -0
  142. package/dist/cdn/assets/portal-navigation/apps/community-analyst.avif +0 -0
  143. package/dist/cdn/assets/portal-navigation/apps/configurable-apps.avif +0 -0
  144. package/dist/cdn/assets/portal-navigation/apps/dashboards-beta.avif +0 -0
  145. package/dist/cdn/assets/portal-navigation/apps/dashboards-classic.avif +0 -0
  146. package/dist/cdn/assets/portal-navigation/apps/data-pipelines.avif +0 -0
  147. package/dist/cdn/assets/portal-navigation/apps/deeplearningstudio.avif +0 -0
  148. package/dist/cdn/assets/portal-navigation/apps/demographics.avif +0 -0
  149. package/dist/cdn/assets/portal-navigation/apps/drone2map.avif +0 -0
  150. package/dist/cdn/assets/portal-navigation/apps/esri-events.avif +0 -0
  151. package/dist/cdn/assets/portal-navigation/apps/essential-apps.avif +0 -0
  152. package/dist/cdn/assets/portal-navigation/apps/excalibur.avif +0 -0
  153. package/dist/cdn/assets/portal-navigation/apps/explorer.avif +0 -0
  154. package/dist/cdn/assets/portal-navigation/apps/field-apps.avif +0 -0
  155. package/dist/cdn/assets/portal-navigation/apps/fieldmaps-beta.avif +0 -0
  156. package/dist/cdn/assets/portal-navigation/apps/fieldmaps-ea.avif +0 -0
  157. package/dist/cdn/assets/portal-navigation/apps/fieldmaps.avif +0 -0
  158. package/dist/cdn/assets/portal-navigation/apps/generic-app.avif +0 -0
  159. package/dist/cdn/assets/portal-navigation/apps/geobim.avif +0 -0
  160. package/dist/cdn/assets/portal-navigation/apps/geoplanner.avif +0 -0
  161. package/dist/cdn/assets/portal-navigation/apps/grid-view-9.avif +0 -0
  162. package/dist/cdn/assets/portal-navigation/apps/indoor.avif +0 -0
  163. package/dist/cdn/assets/portal-navigation/apps/indoors.avif +0 -0
  164. package/dist/cdn/assets/portal-navigation/apps/insights.avif +0 -0
  165. package/dist/cdn/assets/portal-navigation/apps/instant-apps.avif +0 -0
  166. package/dist/cdn/assets/portal-navigation/apps/ips.avif +0 -0
  167. package/dist/cdn/assets/portal-navigation/apps/knowledge-studio.avif +0 -0
  168. package/dist/cdn/assets/portal-navigation/apps/living-atlas.avif +0 -0
  169. package/dist/cdn/assets/portal-navigation/apps/location-platform.avif +0 -0
  170. package/dist/cdn/assets/portal-navigation/apps/map-maker.avif +0 -0
  171. package/dist/cdn/assets/portal-navigation/apps/map-viewer-beta.avif +0 -0
  172. package/dist/cdn/assets/portal-navigation/apps/map-viewer-classic.avif +0 -0
  173. package/dist/cdn/assets/portal-navigation/apps/map-viewer.avif +0 -0
  174. package/dist/cdn/assets/portal-navigation/apps/maps-adobe-cloud.avif +0 -0
  175. package/dist/cdn/assets/portal-navigation/apps/maps-for-office.avif +0 -0
  176. package/dist/cdn/assets/portal-navigation/apps/maps-for-power-bi.avif +0 -0
  177. package/dist/cdn/assets/portal-navigation/apps/maps-for-sharepoint.avif +0 -0
  178. package/dist/cdn/assets/portal-navigation/apps/marketplace.avif +0 -0
  179. package/dist/cdn/assets/portal-navigation/apps/mission.avif +0 -0
  180. package/dist/cdn/assets/portal-navigation/apps/monitor.avif +0 -0
  181. package/dist/cdn/assets/portal-navigation/apps/navigator.avif +0 -0
  182. package/dist/cdn/assets/portal-navigation/apps/notebook.avif +0 -0
  183. package/dist/cdn/assets/portal-navigation/apps/office-apps.avif +0 -0
  184. package/dist/cdn/assets/portal-navigation/apps/open-data.avif +0 -0
  185. package/dist/cdn/assets/portal-navigation/apps/operations-dashboard.avif +0 -0
  186. package/dist/cdn/assets/portal-navigation/apps/ortho-maker.avif +0 -0
  187. package/dist/cdn/assets/portal-navigation/apps/pro-extension.avif +0 -0
  188. package/dist/cdn/assets/portal-navigation/apps/quick-capture.avif +0 -0
  189. package/dist/cdn/assets/portal-navigation/apps/redistricting.avif +0 -0
  190. package/dist/cdn/assets/portal-navigation/apps/runtime.avif +0 -0
  191. package/dist/cdn/assets/portal-navigation/apps/scene-viewer.avif +0 -0
  192. package/dist/cdn/assets/portal-navigation/apps/sites.avif +0 -0
  193. package/dist/cdn/assets/portal-navigation/apps/solutions.avif +0 -0
  194. package/dist/cdn/assets/portal-navigation/apps/story-maps.avif +0 -0
  195. package/dist/cdn/assets/portal-navigation/apps/streetmap-premium.avif +0 -0
  196. package/dist/cdn/assets/portal-navigation/apps/survey123.avif +0 -0
  197. package/dist/cdn/assets/portal-navigation/apps/svg-app-circle.svg +1 -0
  198. package/dist/cdn/assets/portal-navigation/apps/svg-app-icon.svg +1 -0
  199. package/dist/cdn/assets/portal-navigation/apps/track-viewer.avif +0 -0
  200. package/dist/cdn/assets/portal-navigation/apps/user-type-extension-online.avif +0 -0
  201. package/dist/cdn/assets/portal-navigation/apps/user-type-extension.avif +0 -0
  202. package/dist/cdn/assets/portal-navigation/apps/vector-tile-style-editor.avif +0 -0
  203. package/dist/cdn/assets/portal-navigation/apps/velocity.avif +0 -0
  204. package/dist/cdn/assets/portal-navigation/apps/web-app-builder.avif +0 -0
  205. package/dist/cdn/assets/portal-navigation/apps/web-editor.avif +0 -0
  206. package/dist/cdn/assets/portal-navigation/apps/web-mapping.avif +0 -0
  207. package/dist/cdn/assets/portal-navigation/apps/workflow-manager-beta.avif +0 -0
  208. package/dist/cdn/assets/portal-navigation/apps/workflow-manager.avif +0 -0
  209. package/dist/cdn/assets/portal-navigation/apps/workforce.avif +0 -0
  210. package/dist/cdn/assets/portal-navigation/product-logos/advanced-editing-user-type-extension-glyph-32.svg +1 -0
  211. package/dist/cdn/assets/portal-navigation/product-logos/arc-hydro-glyph-32.svg +1 -0
  212. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-360-vr-glyph-32.svg +1 -0
  213. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-api-for-python-glyph-32.svg +1 -0
  214. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-appstudio-glyph-32.svg +1 -0
  215. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-arcade-expression-language-glyph-32.svg +1 -0
  216. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-business-analyst-glyph-32.svg +1 -0
  217. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-cityengine-glyph-32.svg +1 -0
  218. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-collector-glyph-32.svg +1 -0
  219. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-community-analyst-glyph-32.svg +1 -0
  220. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-connectors-for-power-automate-glyph-32.svg +1 -0
  221. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-dashboards-glyph-32.svg +1 -0
  222. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-data-interoperability-glyph-32.svg +1 -0
  223. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-data-pipelines-glyph-32.svg +1 -0
  224. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-data-reviewer-glyph-32.svg +1 -0
  225. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-deep-learning-studio-glyph-32.svg +1 -0
  226. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-drone2map-glyph-32.svg +1 -0
  227. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-earth-glyph-32.svg +1 -0
  228. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-enterprise-glyph-32.svg +1 -0
  229. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-excalibur-glyph-32.svg +1 -0
  230. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-excalibur-gray-glyph-32.svg +1 -0
  231. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-experience-builder-glyph-32.svg +1 -0
  232. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-explorer-glyph-32.svg +1 -0
  233. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-field-maps-designer-ea-glyph-32.svg +1 -0
  234. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-field-maps-glyph-32.svg +1 -0
  235. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-flight-glyph-32.svg +1 -0
  236. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-for-autocad-glyph-32.svg +1 -0
  237. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-for-autodesk-forma-glyph-32.svg +1 -0
  238. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-for-developers-glyph-32.svg +1 -0
  239. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-for-excel-glyph-32.svg +1 -0
  240. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-for-microsoft-365-glyph-32.svg +1 -0
  241. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-for-power-apps-glyph-32.svg +1 -0
  242. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-for-teams-glyph-32.svg +1 -0
  243. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-geoanalytics-engine-glyph-32.svg +1 -0
  244. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-geobim-glyph-32.svg +1 -0
  245. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-geoplanner-glyph-32.svg +1 -0
  246. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-hub-glyph-32.svg +1 -0
  247. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-image-glyph-32.svg +1 -0
  248. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-indoors-glyph-32.svg +1 -0
  249. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-insights-glyph-32.svg +1 -0
  250. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-instant-apps-glyph-32.svg +1 -0
  251. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-knowledge-glyph-32.svg +1 -0
  252. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-living-atlas-of-the-world-glyph-32.svg +1 -0
  253. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-location-platform-glyph-32.svg +1 -0
  254. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-logo-glyph-32.svg +76 -0
  255. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-maps-for-adobe-creative-cloud-glyph-32.svg +1 -0
  256. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-maps-for-power-bi-glyph-32.svg +1 -0
  257. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-maps-for-sharepoint-glyph-32.svg +1 -0
  258. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-maps-sdk-for-javascript-glyph-32.svg +1 -0
  259. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-maps-sdks-for-game-engines-glyph-32.svg +1 -0
  260. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-maps-sdks-for-native-apps-glyph-32.svg +1 -0
  261. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-maritime-glyph-32.svg +1 -0
  262. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-marketplace-glyph-32.svg +1 -0
  263. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-mission-glyph-32.svg +1 -0
  264. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-monitor-glyph-32.svg +1 -0
  265. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-monitor-white-glyph-32.svg +1 -0
  266. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-navigator-glyph-32.svg +1 -0
  267. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-notebooks-glyph-32.svg +1 -0
  268. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-online-glyph-32.svg +1 -0
  269. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-open-data-glyph-32.svg +1 -0
  270. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-open-source-apps-glyph-32.svg +1 -0
  271. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-ortho-maker-glyph-32.svg +1 -0
  272. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-parcel-fabric-glyph-32.svg +1 -0
  273. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-pipeline-referencing-glyph-32.svg +1 -0
  274. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-pro-for-intelligence-glyph-32.svg +1 -0
  275. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-pro-glyph-32.svg +1 -0
  276. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-quickcapture-glyph-32.svg +1 -0
  277. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-reality-studio-glyph-32.svg +1 -0
  278. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-roads-and-highways-glyph-32.svg +1 -0
  279. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-sites-glyph-32.svg +1 -0
  280. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-solutions-glyph-32.svg +1 -0
  281. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-storymaps-glyph-32.svg +1 -0
  282. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-streetmap-premium-glyph-32.svg +1 -0
  283. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-survey123-connect-glyph-32.svg +1 -0
  284. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-survey123-glyph-32.svg +1 -0
  285. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-tracker-glyph-32.svg +1 -0
  286. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-urban-glyph-32.svg +1 -0
  287. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-utility-network-management-glyph-32.svg +1 -0
  288. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-velocity-glyph-32.svg +6 -0
  289. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-web-appbuilder-glyph-32.svg +1 -0
  290. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-web-editor-glyph-32.svg +1 -0
  291. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-workflow-manager-glyph-32.svg +1 -0
  292. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-workforce-glyph-32.svg +1 -0
  293. package/dist/cdn/assets/portal-navigation/product-logos/arcgis-world-geocoder-glyph-32.svg +1 -0
  294. package/dist/cdn/assets/portal-navigation/product-logos/calcite-design-system-glyph-32.svg +1 -0
  295. package/dist/cdn/assets/portal-navigation/product-logos/esri-community-glyph-32.svg +1 -0
  296. package/dist/cdn/assets/portal-navigation/product-logos/esri-demographics-glyph-32.svg +1 -0
  297. package/dist/cdn/assets/portal-navigation/product-logos/esri-events-glyph-32.svg +1 -0
  298. package/dist/cdn/assets/portal-navigation/product-logos/esri-offline-documentation-center--glyph-32.svg +1 -0
  299. package/dist/cdn/assets/portal-navigation/product-logos/esri-redistricting-glyph-32.svg +1 -0
  300. package/dist/cdn/assets/portal-navigation/product-logos/esri-reports-glyph-32.svg +1 -0
  301. package/dist/cdn/assets/portal-navigation/product-logos/esri-support-glyph-32.svg +1 -0
  302. package/dist/cdn/assets/portal-navigation/product-logos/map-viewer-glyph-32.svg +1 -0
  303. package/dist/cdn/assets/portal-navigation/product-logos/sceneviewer-glyph-32.svg +1 -0
  304. package/dist/cdn/assets/portal-navigation/product-logos/site-scan-for-arcgis-glyph-32.svg +1 -0
  305. package/dist/cdn/assets/portal-navigation/product-logos/site-scan-for-arcgis-le-glyph-32.svg +1 -0
  306. package/dist/cdn/assets/portal-navigation/product-logos/vector-tile-style-editor-glyph-32.svg +1 -0
  307. package/dist/cdn/assets/portal-navigation/product-logos/xr-viewer-glyph-32.svg +1 -0
  308. package/dist/cdn/assets/portal-navigation/t9n/messages.en.json +1 -0
  309. package/dist/cdn/index.js +1 -1
  310. package/dist/cdn/main.css +1 -1
  311. package/dist/chunks/dom.js +41 -0
  312. package/dist/chunks/fieldAddDelete.js +1 -1
  313. package/dist/chunks/functionalities.js +6 -4
  314. package/dist/chunks/groups.js +8 -83
  315. package/dist/chunks/groups2.js +64 -0
  316. package/dist/chunks/icons.js +11 -0
  317. package/dist/chunks/info.js +179 -0
  318. package/dist/chunks/item.js +29 -123
  319. package/dist/chunks/item2.js +128 -0
  320. package/dist/chunks/items.js +16 -0
  321. package/dist/chunks/loadClassificationData.js +19 -19
  322. package/dist/chunks/portal-account-switcher.js +6 -0
  323. package/dist/chunks/portal-browser.js +220 -0
  324. package/dist/chunks/portal-item-badge.js +349 -0
  325. package/dist/chunks/portal.js +91 -8
  326. package/dist/chunks/portal2.js +59 -0
  327. package/dist/chunks/query.js +159 -0
  328. package/dist/chunks/request.js +87 -0
  329. package/dist/chunks/requests.js +92 -44
  330. package/dist/chunks/store.js +14 -0
  331. package/dist/chunks/string.js +36 -0
  332. package/dist/chunks/thumbnail.js +189 -0
  333. package/dist/chunks/ui.js +9 -0
  334. package/dist/chunks/url.js +17 -0
  335. package/dist/chunks/user.js +99 -4
  336. package/dist/chunks/user2.js +13 -107
  337. package/dist/chunks/users.js +7 -0
  338. package/dist/chunks/utils.js +88 -0
  339. package/dist/chunks/utils2.js +656 -0
  340. package/dist/chunks/verified.js +40 -0
  341. package/dist/components/arcgis-portal-account-switcher/customElement.d.ts +99 -0
  342. package/dist/components/arcgis-portal-account-switcher/customElement.js +365 -0
  343. package/dist/components/arcgis-portal-account-switcher/index.d.ts +1 -0
  344. package/dist/components/arcgis-portal-account-switcher/index.js +11 -0
  345. package/dist/components/arcgis-portal-account-switcher-accounts/customElement.d.ts +100 -0
  346. package/dist/components/arcgis-portal-account-switcher-accounts/customElement.js +31 -0
  347. package/dist/components/arcgis-portal-account-switcher-accounts/index.d.ts +1 -0
  348. package/dist/components/arcgis-portal-account-switcher-accounts/index.js +5 -0
  349. package/dist/components/arcgis-portal-account-switcher-list/customElement.d.ts +104 -0
  350. package/dist/components/arcgis-portal-account-switcher-list/customElement.js +51 -0
  351. package/dist/components/arcgis-portal-account-switcher-list/index.d.ts +1 -0
  352. package/dist/components/arcgis-portal-account-switcher-list/index.js +7 -0
  353. package/dist/components/arcgis-portal-ai-assistant/agents/portalRouteKeys.d.ts +26 -0
  354. package/dist/components/arcgis-portal-ai-assistant/agents/types.d.ts +77 -3
  355. package/dist/components/arcgis-portal-ai-assistant/customElement.d.ts +59 -3
  356. package/dist/components/arcgis-portal-ai-assistant/customElement.js +1911 -595
  357. package/dist/components/arcgis-portal-ai-assistant/data/capability-registries/types.d.ts +34 -0
  358. package/dist/components/arcgis-portal-browser/customElement.d.ts +243 -0
  359. package/dist/components/arcgis-portal-browser/customElement.js +16 -0
  360. package/dist/components/arcgis-portal-browser/index.d.ts +1 -0
  361. package/dist/components/arcgis-portal-browser/index.js +6 -0
  362. package/dist/components/arcgis-portal-browser/utils/store.d.ts +35 -0
  363. package/dist/components/arcgis-portal-browser/utils/types.d.ts +24 -0
  364. package/dist/components/arcgis-portal-browser-actions/customElement.d.ts +185 -0
  365. package/dist/components/arcgis-portal-browser-actions/customElement.js +73 -0
  366. package/dist/components/arcgis-portal-browser-actions/index.d.ts +1 -0
  367. package/dist/components/arcgis-portal-browser-actions/index.js +6 -0
  368. package/dist/components/arcgis-portal-browser-actions/types.d.ts +9 -0
  369. package/dist/components/arcgis-portal-browser-filter-status/customElement.d.ts +193 -0
  370. package/dist/components/arcgis-portal-browser-filter-status/customElement.js +56 -0
  371. package/dist/components/arcgis-portal-browser-filter-status/index.d.ts +1 -0
  372. package/dist/components/arcgis-portal-browser-filter-status/index.js +5 -0
  373. package/dist/components/arcgis-portal-browser-pagination/customElement.d.ts +194 -0
  374. package/dist/components/arcgis-portal-browser-pagination/customElement.js +49 -0
  375. package/dist/components/arcgis-portal-browser-pagination/index.d.ts +1 -0
  376. package/dist/components/arcgis-portal-browser-pagination/index.js +2 -0
  377. package/dist/components/arcgis-portal-browser-search/customElement.d.ts +195 -0
  378. package/dist/components/arcgis-portal-browser-search/customElement.js +62 -0
  379. package/dist/components/arcgis-portal-browser-search/index.d.ts +1 -0
  380. package/dist/components/arcgis-portal-browser-search/index.js +3 -0
  381. package/dist/components/arcgis-portal-browser-sort/customElement.d.ts +196 -0
  382. package/dist/components/arcgis-portal-browser-sort/customElement.js +93 -0
  383. package/dist/components/arcgis-portal-browser-sort/index.d.ts +1 -0
  384. package/dist/components/arcgis-portal-browser-sort/index.js +9 -0
  385. package/dist/components/arcgis-portal-browser-sort/utils.d.ts +3 -0
  386. package/dist/components/arcgis-portal-browser-top-bar/customElement.d.ts +190 -0
  387. package/dist/components/arcgis-portal-browser-top-bar/customElement.js +50 -0
  388. package/dist/components/arcgis-portal-browser-top-bar/index.d.ts +1 -0
  389. package/dist/components/arcgis-portal-browser-top-bar/index.js +3 -0
  390. package/dist/components/arcgis-portal-browser-view/customElement.d.ts +21 -0
  391. package/dist/components/arcgis-portal-browser-view/customElement.js +30 -0
  392. package/dist/components/arcgis-portal-browser-view/index.d.ts +1 -0
  393. package/dist/components/arcgis-portal-browser-view/index.js +5 -0
  394. package/dist/components/arcgis-portal-classification-config/customElement.js +7 -7
  395. package/dist/components/arcgis-portal-classification-favorite/customElement.js +1 -1
  396. package/dist/components/arcgis-portal-field-delete/customElement.js +2 -1
  397. package/dist/components/arcgis-portal-group-badges/customElement.d.ts +0 -1
  398. package/dist/components/arcgis-portal-group-badges/customElement.js +26 -33
  399. package/dist/components/arcgis-portal-group-browser/customElement.d.ts +475 -0
  400. package/dist/components/arcgis-portal-group-browser/customElement.js +493 -0
  401. package/dist/components/arcgis-portal-group-browser/index.d.ts +1 -0
  402. package/dist/components/arcgis-portal-group-browser/index.js +6 -0
  403. package/dist/components/arcgis-portal-group-browser/types.d.ts +209 -0
  404. package/dist/components/arcgis-portal-group-browser-preview/customElement.d.ts +225 -0
  405. package/dist/components/arcgis-portal-group-browser-preview/customElement.js +150 -0
  406. package/dist/components/arcgis-portal-group-browser-preview/index.d.ts +1 -0
  407. package/dist/components/arcgis-portal-group-browser-preview/index.js +12 -0
  408. package/dist/components/arcgis-portal-group-browser-preview-card/customElement.d.ts +82 -0
  409. package/dist/components/arcgis-portal-group-browser-preview-card/customElement.js +93 -0
  410. package/dist/components/arcgis-portal-group-browser-preview-card/index.d.ts +1 -0
  411. package/dist/components/arcgis-portal-group-browser-preview-card/index.js +6 -0
  412. package/dist/components/arcgis-portal-group-card/customElement.d.ts +171 -0
  413. package/dist/components/arcgis-portal-group-card/customElement.js +163 -0
  414. package/dist/components/arcgis-portal-group-card/index.d.ts +1 -0
  415. package/dist/components/arcgis-portal-group-card/index.js +8 -0
  416. package/dist/components/arcgis-portal-info-banner/customElement.d.ts +14 -0
  417. package/dist/components/arcgis-portal-info-banner/customElement.js +31 -0
  418. package/dist/components/arcgis-portal-info-banner/index.d.ts +1 -0
  419. package/dist/components/arcgis-portal-info-banner/index.js +1 -0
  420. package/dist/components/arcgis-portal-item-actions/customElement.d.ts +74 -0
  421. package/dist/components/arcgis-portal-item-actions/customElement.js +89 -0
  422. package/dist/components/arcgis-portal-item-actions/index.d.ts +1 -0
  423. package/dist/components/arcgis-portal-item-actions/index.js +5 -0
  424. package/dist/components/arcgis-portal-item-badge/customElement.d.ts +260 -0
  425. package/dist/components/arcgis-portal-item-badge/customElement.js +9 -0
  426. package/dist/components/arcgis-portal-item-badge/index.d.ts +1 -0
  427. package/dist/components/arcgis-portal-item-badge/index.js +5 -0
  428. package/dist/components/arcgis-portal-item-badges/customElement.d.ts +48 -0
  429. package/dist/components/arcgis-portal-item-badges/customElement.js +35 -0
  430. package/dist/components/arcgis-portal-item-badges/index.d.ts +1 -0
  431. package/dist/components/arcgis-portal-item-badges/index.js +2 -0
  432. package/dist/components/arcgis-portal-item-badges/types.d.ts +1 -0
  433. package/dist/components/arcgis-portal-item-card/customElement.d.ts +215 -0
  434. package/dist/components/arcgis-portal-item-card/customElement.js +190 -0
  435. package/dist/components/arcgis-portal-item-card/index.d.ts +1 -0
  436. package/dist/components/arcgis-portal-item-card/index.js +10 -0
  437. package/dist/components/arcgis-portal-item-favorite/customElement.d.ts +36 -0
  438. package/dist/components/arcgis-portal-item-favorite/customElement.js +66 -0
  439. package/dist/components/arcgis-portal-item-favorite/index.d.ts +1 -0
  440. package/dist/components/arcgis-portal-item-favorite/index.js +3 -0
  441. package/dist/components/arcgis-portal-item-favorite/utils.d.ts +4 -0
  442. package/dist/components/arcgis-portal-item-type/customElement.d.ts +3 -1
  443. package/dist/components/arcgis-portal-item-type/customElement.js +22 -651
  444. package/dist/components/arcgis-portal-mentionable-text-area/customElement.js +40 -38
  445. package/dist/components/arcgis-portal-navigation/customElement.d.ts +530 -0
  446. package/dist/components/arcgis-portal-navigation/customElement.js +1858 -0
  447. package/dist/components/arcgis-portal-navigation/index.d.ts +1 -0
  448. package/dist/components/arcgis-portal-navigation/index.js +30 -0
  449. package/dist/components/arcgis-portal-navigation/types.d.ts +44 -0
  450. package/dist/components/arcgis-portal-replacement-item-redirect/customElement.js +53 -410
  451. package/dist/components/arcgis-portal-user-avatar/customElement.js +2 -2
  452. package/dist/components/arcgis-portal-user-popup/customElement.d.ts +5 -2
  453. package/dist/components/arcgis-portal-user-popup/customElement.js +82 -141
  454. package/dist/components/arcgis-portal-voice-input/customElement.d.ts +1 -1
  455. package/dist/components/portal-browser/components/portal-browser-filter/customElement.js +14 -0
  456. package/dist/components/portal-browser/components/portal-browser-filter/index.js +3 -0
  457. package/dist/components/portal-browser/components/portal-browser-filter-date/customElement.js +59 -0
  458. package/dist/components/portal-browser/components/portal-browser-filter-date/index.js +4 -0
  459. package/dist/components/portal-browser/components/portal-browser-filters/customElement.js +11 -0
  460. package/dist/components/portal-browser/components/portal-browser-filters/index.js +2 -0
  461. package/dist/components/portal-group-browser-filters/customElement.js +129 -0
  462. package/dist/components/portal-group-browser-filters/index.js +5 -0
  463. package/dist/components/portal-group-browser-pagination/customElement.js +13 -0
  464. package/dist/components/portal-group-browser-pagination/index.js +2 -0
  465. package/dist/components/portal-group-browser-sort/customElement.js +16 -0
  466. package/dist/components/portal-group-browser-sort/index.js +2 -0
  467. package/dist/docs/api.json +1 -1
  468. package/dist/docs/docs.json +1 -1
  469. package/dist/docs/vscode.css-custom-data.json +1 -1
  470. package/dist/docs/vscode.html-custom-data.json +1 -1
  471. package/dist/docs/web-types.json +1 -1
  472. package/dist/index.d.ts +198 -2
  473. package/dist/loader.js +26 -4
  474. package/dist/types/app-switcher.d.ts +71 -0
  475. package/dist/types/group.d.ts +14 -16
  476. package/dist/types/item.d.ts +80 -1
  477. package/dist/types/lumina.d.ts +160 -1
  478. package/dist/types/portal.d.ts +6 -0
  479. package/dist/types/preact.d.ts +182 -1
  480. package/dist/types/react.d.ts +204 -1
  481. package/dist/types/search.d.ts +30 -0
  482. package/dist/types/stencil.d.ts +162 -3
  483. package/dist/types/user.d.ts +16 -3
  484. package/package.json +10 -11
  485. package/dist/cdn/2EV3TV75.js +0 -65
  486. package/dist/cdn/35SKVD6F.js +0 -2
  487. package/dist/cdn/5VSDGPHH.js +0 -2
  488. package/dist/cdn/72N3KAXN.js +0 -2
  489. package/dist/cdn/ANPXRYLV.js +0 -5
  490. package/dist/cdn/B7633S2A.js +0 -422
  491. package/dist/cdn/BEHLBKKM.js +0 -2
  492. package/dist/cdn/EVDOPN3G.js +0 -54
  493. package/dist/cdn/F2AM2M4H.js +0 -2
  494. package/dist/cdn/G47ZZQYL.js +0 -2
  495. package/dist/cdn/GAHILDQF.js +0 -45
  496. package/dist/cdn/GHQ3ZW4U.js +0 -2
  497. package/dist/cdn/JNRN6DTV.js +0 -2
  498. package/dist/cdn/K3HS2LQ7.js +0 -2
  499. package/dist/cdn/KEKBRUUC.js +0 -2
  500. package/dist/cdn/MX3F5ZCL.js +0 -2
  501. package/dist/cdn/O3KBWLGU.js +0 -2
  502. package/dist/cdn/OQDPULPD.js +0 -2
  503. package/dist/cdn/QB34ACZ2.js +0 -2
  504. package/dist/cdn/RBC6VGDJ.js +0 -516
  505. package/dist/cdn/RNLVNDGG.js +0 -2
  506. package/dist/cdn/TMYTUOSS.js +0 -2
  507. package/dist/cdn/UPEVTVNZ.js +0 -2
  508. package/dist/cdn/V2EOXGK2.js +0 -2
  509. package/dist/cdn/WZC4LHVH.js +0 -2
  510. package/dist/cdn/X5NBQPTM.js +0 -2
  511. package/dist/cdn/YG5YYL6X.js +0 -2
  512. package/dist/cdn/YIMNOUTF.js +0 -2
  513. package/dist/cdn/YL7PGYWC.js +0 -5
  514. package/dist/cdn/YMPTDKT6.js +0 -2
  515. package/dist/cdn/YVJRXWM3.js +0 -3
@@ -0,0 +1,451 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{a as Va,b as On,c as qu}from"./UZLQALHY.js";var TI=Va((iW,Kg)=>{"use strict";var b4=Object.prototype.hasOwnProperty,cr="~";function al(){}Object.create&&(al.prototype=Object.create(null),new al().__proto__||(cr=!1));function w4(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function II(e,t,r,n,i){if(typeof r!="function")throw new TypeError("The listener must be a function");var a=new w4(r,n||e,i),o=cr?cr+t:t;return e._events[o]?e._events[o].fn?e._events[o]=[e._events[o],a]:e._events[o].push(a):(e._events[o]=a,e._eventsCount++),e}function Wd(e,t){--e._eventsCount===0?e._events=new al:delete e._events[t]}function Ht(){this._events=new al,this._eventsCount=0}Ht.prototype.eventNames=function(){var t=[],r,n;if(this._eventsCount===0)return t;for(n in r=this._events)b4.call(r,n)&&t.push(cr?n.slice(1):n);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(r)):t};Ht.prototype.listeners=function(t){var r=cr?cr+t:t,n=this._events[r];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=new Array(a);i<a;i++)o[i]=n[i].fn;return o};Ht.prototype.listenerCount=function(t){var r=cr?cr+t:t,n=this._events[r];return n?n.fn?1:n.length:0};Ht.prototype.emit=function(t,r,n,i,a,o){var s=cr?cr+t:t;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,r),!0;case 3:return c.fn.call(c.context,r,n),!0;case 4:return c.fn.call(c.context,r,n,i),!0;case 5:return c.fn.call(c.context,r,n,i,a),!0;case 6:return c.fn.call(c.context,r,n,i,a,o),!0}for(d=1,u=new Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(t,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,r);break;case 3:c[d].fn.call(c[d].context,r,n);break;case 4:c[d].fn.call(c[d].context,r,n,i);break;default:if(!u)for(p=1,u=new Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0};Ht.prototype.on=function(t,r,n){return II(this,t,r,n,!1)};Ht.prototype.once=function(t,r,n){return II(this,t,r,n,!0)};Ht.prototype.removeListener=function(t,r,n,i){var a=cr?cr+t:t;if(!this._events[a])return this;if(!r)return Wd(this,a),this;var o=this._events[a];if(o.fn)o.fn===r&&(!i||o.once)&&(!n||o.context===n)&&Wd(this,a);else{for(var s=0,c=[],l=o.length;s<l;s++)(o[s].fn!==r||i&&!o[s].once||n&&o[s].context!==n)&&c.push(o[s]);c.length?this._events[a]=c.length===1?c[0]:c:Wd(this,a)}return this};Ht.prototype.removeAllListeners=function(t){var r;return t?(r=cr?cr+t:t,this._events[r]&&Wd(this,r)):(this._events=new al,this._eventsCount=0),this};Ht.prototype.off=Ht.prototype.removeListener;Ht.prototype.addListener=Ht.prototype.on;Ht.prefixed=cr;Ht.EventEmitter=Ht;typeof Kg<"u"&&(Kg.exports=Ht)});var AI=Va((aW,CI)=>{"use strict";CI.exports=(e,t)=>(t=t||(()=>{}),e.then(r=>new Promise(n=>{n(t())}).then(()=>r),r=>new Promise(n=>{n(t())}).then(()=>{throw r})))});var PI=Va((oW,Kd)=>{"use strict";var x4=AI(),Jd=class extends Error{constructor(t){super(t),this.name="TimeoutError"}},OI=(e,t,r)=>new Promise((n,i)=>{if(typeof t!="number"||t<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(t===1/0){n(e);return}let a=setTimeout(()=>{if(typeof r=="function"){try{n(r())}catch(c){i(c)}return}let o=typeof r=="string"?r:`Promise timed out after ${t} milliseconds`,s=r instanceof Error?r:new Jd(o);typeof e.cancel=="function"&&e.cancel(),i(s)},t);x4(e.then(n,i),()=>{clearTimeout(a)})});Kd.exports=OI;Kd.exports.default=OI;Kd.exports.TimeoutError=Jd});var NI=Va(qg=>{"use strict";Object.defineProperty(qg,"__esModule",{value:!0});function S4(e,t,r){let n=0,i=e.length;for(;i>0;){let a=i/2|0,o=n+a;r(e[o],t)<=0?(n=++o,i-=a+1):i=a}return n}qg.default=S4});var RI=Va(Xg=>{"use strict";Object.defineProperty(Xg,"__esModule",{value:!0});var k4=NI(),Yg=class{constructor(){this._queue=[]}enqueue(t,r){r=Object.assign({priority:0},r);let n={priority:r.priority,run:t};if(this.size&&this._queue[this.size-1].priority>=r.priority){this._queue.push(n);return}let i=k4.default(this._queue,n,(a,o)=>o.priority-a.priority);this._queue.splice(i,0,n)}dequeue(){let t=this._queue.shift();return t?.run}filter(t){return this._queue.filter(r=>r.priority===t.priority).map(r=>r.run)}get size(){return this._queue.length}};Xg.default=Yg});var Yd=Va(e_=>{"use strict";Object.defineProperty(e_,"__esModule",{value:!0});var E4=TI(),MI=PI(),$4=RI(),qd=()=>{},I4=new MI.TimeoutError,Qg=class extends E4{constructor(t){var r,n,i,a;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=qd,this._resolveIdle=qd,t=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:$4.default},t),!(typeof t.intervalCap=="number"&&t.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(n=(r=t.intervalCap)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:""}\` (${typeof t.intervalCap})`);if(t.interval===void 0||!(Number.isFinite(t.interval)&&t.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(a=(i=t.interval)===null||i===void 0?void 0:i.toString())!==null&&a!==void 0?a:""}\` (${typeof t.interval})`);this._carryoverConcurrencyCount=t.carryoverConcurrencyCount,this._isIntervalIgnored=t.intervalCap===1/0||t.interval===0,this._intervalCap=t.intervalCap,this._interval=t.interval,this._queue=new t.queueClass,this._queueClass=t.queueClass,this.concurrency=t.concurrency,this._timeout=t.timeout,this._throwOnTimeout=t.throwOnTimeout===!0,this._isPaused=t.autoStart===!1}get _doesIntervalAllowAnother(){return this._isIntervalIgnored||this._intervalCount<this._intervalCap}get _doesConcurrentAllowAnother(){return this._pendingCount<this._concurrency}_next(){this._pendingCount--,this._tryToStartAnother(),this.emit("next")}_resolvePromises(){this._resolveEmpty(),this._resolveEmpty=qd,this._pendingCount===0&&(this._resolveIdle(),this._resolveIdle=qd,this.emit("idle"))}_onResumeInterval(){this._onInterval(),this._initializeIntervalIfNeeded(),this._timeoutId=void 0}_isIntervalPaused(){let t=Date.now();if(this._intervalId===void 0){let r=this._intervalEnd-t;if(r<0)this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0;else return this._timeoutId===void 0&&(this._timeoutId=setTimeout(()=>{this._onResumeInterval()},r)),!0}return!1}_tryToStartAnother(){if(this._queue.size===0)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){let t=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother){let r=this._queue.dequeue();return r?(this.emit("active"),r(),t&&this._initializeIntervalIfNeeded(),!0):!1}}return!1}_initializeIntervalIfNeeded(){this._isIntervalIgnored||this._intervalId!==void 0||(this._intervalId=setInterval(()=>{this._onInterval()},this._interval),this._intervalEnd=Date.now()+this._interval)}_onInterval(){this._intervalCount===0&&this._pendingCount===0&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue()}_processQueue(){for(;this._tryToStartAnother(););}get concurrency(){return this._concurrency}set concurrency(t){if(!(typeof t=="number"&&t>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${t}\` (${typeof t})`);this._concurrency=t,this._processQueue()}async add(t,r={}){return new Promise((n,i)=>{let a=async()=>{this._pendingCount++,this._intervalCount++;try{let o=this._timeout===void 0&&r.timeout===void 0?t():MI.default(Promise.resolve(t()),r.timeout===void 0?this._timeout:r.timeout,()=>{(r.throwOnTimeout===void 0?this._throwOnTimeout:r.throwOnTimeout)&&i(I4)});n(await o)}catch(o){i(o)}this._next()};this._queue.enqueue(a,r),this._tryToStartAnother(),this.emit("add")})}async addAll(t,r){return Promise.all(t.map(async n=>this.add(n,r)))}start(){return this._isPaused?(this._isPaused=!1,this._processQueue(),this):this}pause(){this._isPaused=!0}clear(){this._queue=new this._queueClass}async onEmpty(){if(this._queue.size!==0)return new Promise(t=>{let r=this._resolveEmpty;this._resolveEmpty=()=>{r(),t()}})}async onIdle(){if(!(this._pendingCount===0&&this._queue.size===0))return new Promise(t=>{let r=this._resolveIdle;this._resolveIdle=()=>{r(),t()}})}get size(){return this._queue.size}sizeBy(t){return this._queue.filter(t).length}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}get timeout(){return this._timeout}set timeout(t){this._timeout=t}};e_.default=Qg});var QO=Va(Jp=>{"use strict";Jp.byteLength=TF;Jp.toByteArray=AF;Jp.fromByteArray=NF;var Xn=[],tn=[],IF=typeof Uint8Array<"u"?Uint8Array:Array,Ix="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Vo=0,YO=Ix.length;Vo<YO;++Vo)Xn[Vo]=Ix[Vo],tn[Ix.charCodeAt(Vo)]=Vo;var Vo,YO;tn[45]=62;tn[95]=63;function XO(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function TF(e){var t=XO(e),r=t[0],n=t[1];return(r+n)*3/4-n}function CF(e,t,r){return(t+r)*3/4-r}function AF(e){var t,r=XO(e),n=r[0],i=r[1],a=new IF(CF(e,n,i)),o=0,s=i>0?n-4:n,c;for(c=0;c<s;c+=4)t=tn[e.charCodeAt(c)]<<18|tn[e.charCodeAt(c+1)]<<12|tn[e.charCodeAt(c+2)]<<6|tn[e.charCodeAt(c+3)],a[o++]=t>>16&255,a[o++]=t>>8&255,a[o++]=t&255;return i===2&&(t=tn[e.charCodeAt(c)]<<2|tn[e.charCodeAt(c+1)]>>4,a[o++]=t&255),i===1&&(t=tn[e.charCodeAt(c)]<<10|tn[e.charCodeAt(c+1)]<<4|tn[e.charCodeAt(c+2)]>>2,a[o++]=t>>8&255,a[o++]=t&255),a}function OF(e){return Xn[e>>18&63]+Xn[e>>12&63]+Xn[e>>6&63]+Xn[e&63]}function PF(e,t,r){for(var n,i=[],a=t;a<r;a+=3)n=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(OF(n));return i.join("")}function NF(e){for(var t,r=e.length,n=r%3,i=[],a=16383,o=0,s=r-n;o<s;o+=a)i.push(PF(e,o,o+a>s?s:o+a));return n===1?(t=e[r-1],i.push(Xn[t>>2]+Xn[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(Xn[t>>10]+Xn[t>>4&63]+Xn[t<<2&63]+"=")),i.join("")}});function $k(e,t){if(e!=null){if(typeof e!="number"||Number.isNaN(e)||e<=0)throw new Error(`${t} must be greater than 0`);return e}}function Hi(e){if(e==null)return;let t=typeof e=="number"?{runTimeout:e}:e,r=t.refreshOn??"auto";if(r!=="auto"&&r!=="heartbeat")throw new Error('refreshOn must be "auto" or "heartbeat"');let n=$k(t.runTimeout,"runTimeout"),i=$k(t.idleTimeout,"idleTimeout");if(!(n===void 0&&i===void 0))return{runTimeout:n,idleTimeout:i,refreshOn:r}}var Je="__start__",et="__end__",Nn="__input__";var Gi="__error__",Uc="__error_source_node__",Yu="__pregel_ns_writes";function Ik(){let e=typeof process<"u"?process.env?.LANGGRAPH_DELTA_MAX_SUPERSTEPS_SINCE_SNAPSHOT:void 0;if(e!==void 0&&e!==""){let t=Number.parseInt(e,10);if(Number.isFinite(t)&&t>0)return t}return 5e3}var Bt="__pregel_send",Rn="__pregel_call",tr="__pregel_read",Vr="__pregel_checkpointer",Ha="__pregel_resuming",ts="__pregel_task_id",Lc="__pregel_stream",lj="__pregel_resume_value",Ga="__pregel_resume_map",rr="__pregel_scratchpad",Wi="__pregel_previous",uj="__pregel_durability",Ji="checkpoint_id",Cr="checkpoint_ns",Tk="__pregel_node_finished",Fc="__pregel_node_error",Vt="checkpoint_map",Xu="__pregel_replay_state",Ck="__pregel_abort_signals",Le="__interrupt__",nr="__resume__",Bc="__no_writes__",Ki="__return__",qi="__previous__",ht="langsmith:hidden";var Zh="__self__",Mn="__pregel_tasks",ir="__pregel_push",Qu="__pregel_pull",ar="00000000-0000-0000-0000-000000000000",Ak=[ht,Nn,Le,nr,Gi,Uc,Bc,Bt,tr,Vr,uj,Lc,Ha,ts,Rn,lj,rr,Wi,Vt,Cr,Ji,Xu],Vh=Symbol.for("langgraph.command"),Ok=class{[Vh];constructor(e){this[Vh]=e}};function ed(e){let t=e;return t!=null&&typeof t.node=="string"&&t.args!==void 0}var Za=class{lg_name="Send";node;args;timeout;constructor(e,t,r){this.node=e,this.args=zc(t),this.timeout=Hi(r?.timeout)}toJSON(){return{lg_name:this.lg_name,node:this.node,args:this.args,timeout:this.timeout}}};function wt(e){return e instanceof Za}var Pn="__overwrite__",dj=class{lg_name="Overwrite";[Pn];constructor(e){this[Pn]=e}get value(){return this[Pn]}toJSON(){return{[Pn]:this[Pn]}}static isInstance(e){return!e||typeof e!="object"?!1:"__overwrite__"in e||"lg_name"in e&&e.lg_name==="Overwrite"}};function cn(e){if(typeof e=="object"&&e!==null){if("__overwrite__"in e)return[!0,e[Pn]];let t=e;if(t.type==="__overwrite__"&&"value"in t)return[!0,t.value]}return[!1,void 0]}function Wa(e){return cn(e)[0]}function Ja(e){return!e||typeof e!="object"||!("__interrupt__"in e)?!1:Array.isArray(e[Le])}var _r=class extends Ok{lg_name="Command";lc_direct_tool_output=!0;graph;update;resume;goto=[];static PARENT="__parent__";constructor(e){super(e),this.resume=e.resume,this.graph=e.graph,this.update=e.update,e.goto&&(this.goto=Array.isArray(e.goto)?zc(e.goto):[zc(e.goto)])}_updateAsTuples(){return this.update&&typeof this.update=="object"&&!Array.isArray(this.update)?Object.entries(this.update):Array.isArray(this.update)&&this.update.every(e=>Array.isArray(e)&&e.length===2&&typeof e[0]=="string")?this.update:[["__root__",this.update]]}toJSON(){let e;return typeof this.goto=="string"?e=this.goto:wt(this.goto)?e=this.goto.toJSON():e=this.goto?.map(t=>typeof t=="string"?t:t.toJSON()),{lg_name:this.lg_name,update:this.update,resume:this.resume,goto:e}}};function At(e){return typeof e!="object"||e==null?!1:"lg_name"in e&&e.lg_name==="Command"}function fj(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function zc(e,t=new Map){if(e!=null&&typeof e=="object"){if(t.has(e))return t.get(e);let r;if(Array.isArray(e))r=[],t.set(e,r),e.forEach((n,i)=>{r[i]=zc(n,t)});else if(e instanceof _r||e instanceof Za||!fj(e))r=e,t.set(e,r);else if(At(e))r=new _r(e),t.set(e,r);else if(ed(e))r=new Za(e.node,e.args,e.timeout!==void 0?{timeout:e.timeout}:void 0),t.set(e,r);else if("lc_serializable"in e&&e.lc_serializable)r=e,t.set(e,r);else{r={},t.set(e,r);for(let[n,i]of Object.entries(e))r[n]=zc(i,t)}return r}return e}var Zr=class extends Error{lc_error_code;constructor(e,t){let r=e??"";t?.lc_error_code&&(r=`${r}
3
+
4
+ Troubleshooting URL: https://docs.langchain.com/oss/javascript/langgraph/${t.lc_error_code}/
5
+ `),super(r),this.lc_error_code=t?.lc_error_code}},td=class extends Zr{get is_bubble_up(){return!0}},Hh=class extends Zr{constructor(e,t){super(e,t),this.name="GraphRecursionError"}static get unminifiable_name(){return"GraphRecursionError"}},Ka=class extends Zr{constructor(e,t){super(e,t),this.name="GraphValueError"}static get unminifiable_name(){return"GraphValueError"}},rd=class extends td{reason;constructor(e="shutdown",t){super(`Graph drained: ${e}`,t),this.name="GraphDrained",this.reason=e}static get unminifiable_name(){return"GraphDrained"}};function nd(e){return e!==void 0&&e.name===rd.unminifiable_name}var li=class extends td{interrupts;constructor(e,t){super(JSON.stringify(e,null,2),t),this.name="GraphInterrupt",this.interrupts=e??[]}static get unminifiable_name(){return"GraphInterrupt"}},id=class extends li{constructor(e,t){super([{value:e}],t),this.name="NodeInterrupt"}static get unminifiable_name(){return"NodeInterrupt"}},ad=class{node;error;constructor(e,t){this.node=e,this.error=t}static get unminifiable_name(){return"NodeError"}};function pj(e){return e!=null&&typeof e=="object"&&e.constructor!=null&&e.constructor.unminifiable_name===ad.unminifiable_name}var od=class extends td{command;constructor(e){super(),this.name="ParentCommand",this.command=e}static get unminifiable_name(){return"ParentCommand"}};function Gh(e){return e!==void 0&&e.name===od.unminifiable_name}function Yi(e){return e!==void 0&&e.is_bubble_up===!0}function ui(e){return e!==void 0&&[li.unminifiable_name,id.unminifiable_name].includes(e.name)}var sd=class extends Zr{node;kind;timeout;elapsed;runTimeout;idleTimeout;constructor(e,t){let{node:r,elapsed:n,kind:i,runTimeout:a,idleTimeout:o}=e,s,c;if(i==="idle"){if(o===void 0)throw new Error("idleTimeout is required when kind='idle'");c=o,s=`Node "${r}" exceeded its idle timeout of ${o}ms without making progress (elapsed: ${n}ms).`}else{if(a===void 0)throw new Error("runTimeout is required when kind='run'");c=a,s=`Node "${r}" exceeded its run timeout of ${a}ms (elapsed: ${n}ms).`}super(s,t),this.name="NodeTimeoutError",this.node=r,this.kind=i,this.timeout=c,this.elapsed=n,this.runTimeout=a,this.idleTimeout=o}static get unminifiable_name(){return"NodeTimeoutError"}};function mj(e){return e!==void 0&&e.name===sd.unminifiable_name}var cd=class extends Zr{constructor(e,t){super(e,t),this.name="EmptyInputError"}static get unminifiable_name(){return"EmptyInputError"}},je=class extends Zr{constructor(e,t){let r=Error.stackTraceLimit;Error.stackTraceLimit=0,super(e,t),Error.stackTraceLimit=r,this.name="EmptyChannelError"}static get unminifiable_name(){return"EmptyChannelError"}},ve=class extends Zr{constructor(e,t){super(e,t),this.name="InvalidUpdateError"}static get unminifiable_name(){return"InvalidUpdateError"}},hj=class extends Zr{constructor(e,t){super(e,t),this.name="MultipleSubgraphError"}static get unminifiable_name(){return"MultipleSubgraphError"}},Wh=class extends Zr{constructor(e,t){super(e,t),this.name="UnreachableNodeError"}static get unminifiable_name(){return"UnreachableNodeError"}},gj=class extends Zr{constructor(e,t){super(e,t),this.name="RemoteException"}static get unminifiable_name(){return"RemoteException"}},Vc=class extends Zr{constructor(e,t){super(e,t),this.name="StateGraphInputError",this.message="Invalid StateGraph input. Make sure to pass a valid StateDefinition, Annotation.Root, or Zod schema."}static get unminifiable_name(){return"StateGraphInputError"}},_j=()=>(globalThis[Symbol.for("LG_CHECKPOINT_SEEN_NS_SET")]===void 0&&(globalThis[Symbol.for("LG_CHECKPOINT_SEEN_NS_SET")]=new Set),globalThis[Symbol.for("LG_CHECKPOINT_SEEN_NS_SET")]);var Pk=Object.defineProperty,T=(e,t)=>{let r={};for(var n in e)Pk(r,n,{get:e[n],enumerable:!0});return t||Pk(r,Symbol.toStringTag,{value:"Module"}),r};var Nk="ffffffff-ffff-ffff-ffff-ffffffffffff";var Rk="00000000-0000-0000-0000-000000000000";var Mk=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function Xi(e){return typeof e=="string"&&Mk.test(e)}function qa(e){if(!Xi(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,t&255,(t=parseInt(e.slice(9,13),16))>>>8,t&255,(t=parseInt(e.slice(14,18),16))>>>8,t&255,(t=parseInt(e.slice(19,23),16))>>>8,t&255,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255)}var jt=[];for(let e=0;e<256;++e)jt.push((e+256).toString(16).slice(1));function Ar(e,t=0){return(jt[e[t+0]]+jt[e[t+1]]+jt[e[t+2]]+jt[e[t+3]]+"-"+jt[e[t+4]]+jt[e[t+5]]+"-"+jt[e[t+6]]+jt[e[t+7]]+"-"+jt[e[t+8]]+jt[e[t+9]]+"-"+jt[e[t+10]]+jt[e[t+11]]+jt[e[t+12]]+jt[e[t+13]]+jt[e[t+14]]+jt[e[t+15]]).toLowerCase()}function jk(e,t=0){let r=Ar(e,t);if(!Xi(r))throw TypeError("Stringified UUID is invalid");return r}var yj=new Uint8Array(16);function Qi(){return crypto.getRandomValues(yj)}var Zc={};function ld(e,t,r){let n,i=e?._v6??!1;if(e){let a=Object.keys(e);a.length===1&&a[0]==="_v6"&&(e=void 0)}if(e)n=Dk(e.random??e.rng?.()??Qi(),e.msecs,e.nsecs,e.clockseq,e.node,t,r);else{let a=Date.now(),o=Qi();vj(Zc,a,o),n=Dk(o,Zc.msecs,Zc.nsecs,i?void 0:Zc.clockseq,i?void 0:Zc.node,t,r)}return t??Ar(n)}function vj(e,t,r){return e.msecs??=-1/0,e.nsecs??=0,t===e.msecs?(e.nsecs++,e.nsecs>=1e4&&(e.node=void 0,e.nsecs=0)):t>e.msecs?e.nsecs=0:t<e.msecs&&(e.node=void 0),e.node||(e.node=r.slice(10,16),e.node[0]|=1,e.clockseq=(r[8]<<8|r[9])&16383),e.msecs=t,e}function Dk(e,t,r,n,i,a,o=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(!a)a=new Uint8Array(16),o=0;else if(o<0||o+16>a.length)throw new RangeError(`UUID byte range ${o}:${o+15} is out of buffer bounds`);t??=Date.now(),r??=0,n??=(e[8]<<8|e[9])&16383,i??=e.slice(10,16),t+=122192928e5;let s=((t&268435455)*1e4+r)%4294967296;a[o++]=s>>>24&255,a[o++]=s>>>16&255,a[o++]=s>>>8&255,a[o++]=s&255;let c=t/4294967296*1e4&268435455;a[o++]=c>>>8&255,a[o++]=c&255,a[o++]=c>>>24&15|16,a[o++]=c>>>16&255,a[o++]=n>>>8|128,a[o++]=n&255;for(let l=0;l<6;++l)a[o++]=i[l];return a}function zk(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():bj(e,t,r)}function bj(e,t,r){e=e||{};let n=e.random??e.rng?.()??Qi();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)t[r+i]=n[i];return t}return Ar(n)}function wj(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:return t^r^n;case 2:return t&r^t&n^r&n;case 3:return t^r^n}}function Jh(e,t){return e<<t|e>>>32-t}function Uk(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(e.length+1);n.set(e),n[e.length]=128,e=n;let i=e.length/4+2,a=Math.ceil(i/16),o=new Array(a);for(let s=0;s<a;++s){let c=new Uint32Array(16);for(let l=0;l<16;++l)c[l]=e[s*64+l*4]<<24|e[s*64+l*4+1]<<16|e[s*64+l*4+2]<<8|e[s*64+l*4+3];o[s]=c}o[a-1][14]=(e.length-1)*8/2**32,o[a-1][14]=Math.floor(o[a-1][14]),o[a-1][15]=(e.length-1)*8&4294967295;for(let s=0;s<a;++s){let c=new Uint32Array(80);for(let m=0;m<16;++m)c[m]=o[s][m];for(let m=16;m<80;++m)c[m]=Jh(c[m-3]^c[m-8]^c[m-14]^c[m-16],1);let l=r[0],u=r[1],d=r[2],f=r[3],p=r[4];for(let m=0;m<80;++m){let h=Math.floor(m/20),_=Jh(l,5)+wj(h,u,d,f)+p+t[h]+c[m]>>>0;p=f,f=d,d=Jh(u,30)>>>0,u=l,l=_}r[0]=r[0]+l>>>0,r[1]=r[1]+u>>>0,r[2]=r[2]+d>>>0,r[3]=r[3]+f>>>0,r[4]=r[4]+p>>>0}return Uint8Array.of(r[0]>>24,r[0]>>16,r[0]>>8,r[0],r[1]>>24,r[1]>>16,r[1]>>8,r[1],r[2]>>24,r[2]>>16,r[2]>>8,r[2],r[3]>>24,r[3]>>16,r[3]>>8,r[3],r[4]>>24,r[4]>>16,r[4]>>8,r[4])}function xj(e){e=unescape(encodeURIComponent(e));let t=new Uint8Array(e.length);for(let r=0;r<e.length;++r)t[r]=e.charCodeAt(r);return t}var Lk="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Fk="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function Bk(e,t,r,n,i,a){let o=typeof r=="string"?xj(r):r,s=typeof n=="string"?qa(n):n;if(typeof n=="string"&&(n=qa(n)),n?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+o.length);if(c.set(s),c.set(o,s.length),c=t(c),c[6]=c[6]&15|e,c[8]=c[8]&63|128,i){if(a??=0,a<0||a+16>i.length)throw new RangeError(`UUID byte range ${a}:${a+15} is out of buffer bounds`);for(let l=0;l<16;++l)i[a+l]=c[l];return i}return Ar(c)}function ud(e,t,r,n){return Bk(80,Uk,e,t,r,n)}ud.DNS=Lk;ud.URL=Fk;function Vk(e){let t=Sj(typeof e=="string"?qa(e):e);return typeof e=="string"?Ar(t):t}function Sj(e){return Uint8Array.of((e[6]&15)<<4|e[7]>>4&15,(e[7]&15)<<4|(e[4]&240)>>4,(e[4]&15)<<4|(e[5]&240)>>4,(e[5]&15)<<4|(e[0]&240)>>4,(e[0]&15)<<4|(e[1]&240)>>4,(e[1]&15)<<4|(e[2]&240)>>4,96|e[2]&15,e[3],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}function Zk(e,t,r){e??={},r??=0;let n=ld({...e,_v6:!0},new Uint8Array(16));if(n=Vk(n),t){if(r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;i++)t[r+i]=n[i];return t}return Ar(n)}var Kh={};function Gk(e,t,r){let n;if(e)n=Hk(e.random??e.rng?.()??Qi(),e.msecs,e.seq,t,r);else{let i=Date.now(),a=Qi();kj(Kh,i,a),n=Hk(a,Kh.msecs,Kh.seq,t,r)}return t??Ar(n)}function kj(e,t,r){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=r[6]<<23|r[7]<<16|r[8]<<8|r[9],e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}function Hk(e,t,r,n,i=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(!n)n=new Uint8Array(16),i=0;else if(i<0||i+16>n.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return t??=Date.now(),r??=e[6]*127<<24|e[7]<<16|e[8]<<8|e[9],n[i++]=t/1099511627776&255,n[i++]=t/4294967296&255,n[i++]=t/16777216&255,n[i++]=t/65536&255,n[i++]=t/256&255,n[i++]=t&255,n[i++]=112|r>>>28&15,n[i++]=r>>>20&255,n[i++]=128|r>>>14&63,n[i++]=r>>>6&255,n[i++]=r<<2&255|e[10]&3,n[i++]=e[11],n[i++]=e[12],n[i++]=e[13],n[i++]=e[14],n[i++]=e[15],n}function Wk(e){if(!Xi(e))throw TypeError("Invalid UUID");return parseInt(e.slice(14,15),16)}var Jk=T({MAX:()=>Ej,NIL:()=>$j,parse:()=>Ij,stringify:()=>Tj,v1:()=>Cj,v4:()=>ea,v5:()=>rs,v6:()=>qh,v7:()=>Hr,validate:()=>di,version:()=>Aj}),Ej=Nk,$j=Rk,Ij=qa,Tj=jk,Cj=ld,ea=zk,rs=ud,qh=Zk,Hr=Gk,di=Xi,Aj=Wk;var Yh=0,Hc=0;function Gc(e){let t=Date.now();return t<=Yh?(Hc+=1,Hc>=1e4&&(Hc=0,t=Yh+1)):Hc=0,Yh=t,qh({clockseq:e,msecs:t,nsecs:Hc})}function jn(e,t){let r=t.replace(/-/g,"").match(/.{2}/g).map(n=>parseInt(n,16));return rs(e,new Uint8Array(r))}var Wc="__pregel_tasks",Xh="__error__",Ya="__scheduled__",Qh="__interrupt__",eg="__resume__",ns=class{lg_name="DeltaSnapshot";value;constructor(e){this.value=e}};function tg(e){return e!=null&&typeof e=="object"&&e.lg_name==="DeltaSnapshot"}var Kk="[...]",Oj="[Circular]",dd=[],is=[];function Pj(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function qk(e,t,r,n){typeof n>"u"&&(n=Pj()),ng(e,"",0,[],void 0,0,n);var i;try{is.length===0?i=JSON.stringify(e,t,r):i=JSON.stringify(e,Nj(t),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;dd.length!==0;){var a=dd.pop();a.length===4?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}}return i}function rg(e,t,r,n){var i=Object.getOwnPropertyDescriptor(n,r);i.get!==void 0?i.configurable?(Object.defineProperty(n,r,{value:e}),dd.push([n,r,t,i])):is.push([t,r,e]):(n[r]=e,dd.push([n,r,t]))}function ng(e,t,r,n,i,a,o){a+=1;var s;if(typeof e=="object"&&e!==null){for(s=0;s<n.length;s++)if(n[s]===e){rg(Oj,e,t,i);return}if(typeof o.depthLimit<"u"&&a>o.depthLimit){rg(Kk,e,t,i);return}if(typeof o.edgesLimit<"u"&&r+1>o.edgesLimit){rg(Kk,e,t,i);return}if(n.push(e),Array.isArray(e))for(s=0;s<e.length;s++)ng(e[s],s,s,n,e,a,o);else{var c=Object.keys(e);for(s=0;s<c.length;s++){var l=c[s];ng(e[l],l,s,n,e,a,o)}}n.pop()}}function Nj(e){return e=typeof e<"u"?e:function(t,r){return r},function(t,r){if(is.length>0)for(var n=0;n<is.length;n++){var i=is[n];if(i[1]===t&&i[0]===r){r=i[2],is.splice(n,1);break}}return e.call(this,t,r)}}var Rj=/([A-Z]+)([A-Z][a-z0-9]+)/g,Mj=/([a-z0-9])([A-Z])/g,Yk=/[-_\s]+/g;function jj(e){return e.replace(Rj,"$1_$2").replace(Mj,"$1_$2").replace(Yk,"_").toLowerCase()}function Dj(e){let t=e.trim();return/[-_\s]/.test(t)?t.replace(Yk,"_").toLowerCase().replace(/_+([a-z0-9])/g,(r,n)=>n.toUpperCase()):t}function Xk(e,t){return t?.[e]||jj(e)}function Qk(e,t){return t?.[e]||Dj(e)}function fd(e,t,r){let n={};for(let i in e)Object.hasOwn(e,i)&&(n[t(i,r)]=e[i]);return n}var eE="__lc_escaped__";function zj(e){return"lc"in e||Object.keys(e).length===1&&"__lc_escaped__"in e}function Uj(e){return{[eE]:e}}function ig(e){return Object.keys(e).length===1&&"__lc_escaped__"in e}function Lj(e){return e!==null&&typeof e=="object"&&"lc_serializable"in e&&typeof e.toJSON=="function"}function Fj(e){let t;return e!==null&&typeof e=="object"?"lc_id"in e&&Array.isArray(e.lc_id)?t=e.lc_id:t=[e.constructor?.name??"Object"]:t=[typeof e],{lc:1,type:"not_implemented",id:t}}function pd(e,t=new WeakSet){if(e!==null&&typeof e=="object"&&!Array.isArray(e)){if(t.has(e))return Fj(e);if(Lj(e))return e;t.add(e);let r=e;if(zj(r))return t.delete(e),Uj(r);let n={};for(let[i,a]of Object.entries(r))n[i]=pd(a,t);return t.delete(e),n}return Array.isArray(e)?e.map(r=>pd(r,t)):e}function md(e){if(e!==null&&typeof e=="object"&&!Array.isArray(e)){let t=e;if(ig(t))return t[eE];let r={};for(let[n,i]of Object.entries(t))r[n]=md(i);return r}return Array.isArray(e)?e.map(t=>md(t)):e}var rE=T({Serializable:()=>pt,get_lc_unique_name:()=>as});function tE(e){return Array.isArray(e)?[...e]:{...e}}function Bj(e,t){let r=tE(e);for(let[n,i]of Object.entries(t)){let[a,...o]=n.split(".").reverse(),s=r;for(let c of o.reverse()){if(s[c]===void 0)break;s[c]=tE(s[c]),s=s[c]}s[a]!==void 0&&(s[a]={lc:1,type:"secret",id:[i]})}return r}function as(e){let t=Object.getPrototypeOf(e);return typeof e.lc_name=="function"&&(typeof t.lc_name!="function"||e.lc_name()!==t.lc_name())?e.lc_name():e.name}var pt=class nE{lc_serializable=!1;lc_kwargs;static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,as(this.constructor)]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}constructor(t,...r){this.lc_serializable_keys!==void 0?this.lc_kwargs=Object.fromEntries(Object.entries(t||{}).filter(([n])=>this.lc_serializable_keys?.includes(n))):this.lc_kwargs=t??{}}toJSON(){if(!this.lc_serializable)return this.toJSONNotImplemented();if(this.lc_kwargs instanceof nE||typeof this.lc_kwargs!="object"||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();let t={},r={},n=Object.keys(this.lc_kwargs).reduce((s,c)=>(s[c]=c in this?this[c]:this.lc_kwargs[c],s),{});for(let s=Object.getPrototypeOf(this);s;s=Object.getPrototypeOf(s))Object.assign(t,Reflect.get(s,"lc_aliases",this)),Object.assign(r,Reflect.get(s,"lc_secrets",this)),Object.assign(n,Reflect.get(s,"lc_attributes",this));Object.keys(r).forEach(s=>{let c=this,l=n,[u,...d]=s.split(".").reverse();for(let f of d.reverse()){if(!(f in c)||c[f]===void 0)return;(!(f in l)||l[f]===void 0)&&(typeof c[f]=="object"&&c[f]!=null?l[f]={}:Array.isArray(c[f])&&(l[f]=[])),c=c[f],l=l[f]}u in c&&c[u]!==void 0&&(l[u]=l[u]||c[u])});let i={},a=new WeakSet;a.add(this);for(let[s,c]of Object.entries(n))i[s]=pd(c,a);let o=fd(Object.keys(r).length?Bj(i,r):i,Xk,t);return{lc:1,type:"constructor",id:this.lc_id,kwargs:o}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}};var iE=T({getEnv:()=>lE,getEnvironmentVariable:()=>xt,getRuntimeEnvironment:()=>og,isBrowser:()=>aE,isDeno:()=>hd,isJsDom:()=>sE,isNode:()=>cE,isWebWorker:()=>oE}),aE=()=>typeof window<"u"&&typeof window.document<"u",oE=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",sE=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),hd=()=>typeof Deno<"u",cE=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!hd(),lE=()=>{let e;return aE()?e="browser":cE()?e="node":oE()?e="webworker":sE()?e="jsdom":hd()?e="deno":e="other",e},ag;function og(){return ag===void 0&&(ag={library:"langchain-js",runtime:lE()}),ag}function xt(e){try{return typeof process<"u"?process.env?.[e]:hd()?Deno?.env.get(e):void 0}catch{return}}var uE=[];var dE=T({});var fE=T({});var ee="0123456789abcdef".split(""),Vj=[-2147483648,8388608,32768,128],ln=[24,16,8,0],gd=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],Ot=[];function un(e,t){t?(Ot[0]=Ot[16]=Ot[1]=Ot[2]=Ot[3]=Ot[4]=Ot[5]=Ot[6]=Ot[7]=Ot[8]=Ot[9]=Ot[10]=Ot[11]=Ot[12]=Ot[13]=Ot[14]=Ot[15]=0,this.blocks=Ot):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],e?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=e}un.prototype.update=function(e){if(!this.finalized){var t,r=typeof e;if(r!=="string"){if(r==="object"){if(e===null)throw new Error(ERROR);if(ARRAY_BUFFER&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(e)))throw new Error(ERROR)}else throw new Error(ERROR);t=!0}for(var n,i=0,a,o=e.length,s=this.blocks;i<o;){if(this.hashed&&(this.hashed=!1,s[0]=this.block,this.block=s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0),t)for(a=this.start;i<o&&a<64;++i)s[a>>>2]|=e[i]<<ln[a++&3];else for(a=this.start;i<o&&a<64;++i)n=e.charCodeAt(i),n<128?s[a>>>2]|=n<<ln[a++&3]:n<2048?(s[a>>>2]|=(192|n>>>6)<<ln[a++&3],s[a>>>2]|=(128|n&63)<<ln[a++&3]):n<55296||n>=57344?(s[a>>>2]|=(224|n>>>12)<<ln[a++&3],s[a>>>2]|=(128|n>>>6&63)<<ln[a++&3],s[a>>>2]|=(128|n&63)<<ln[a++&3]):(n=65536+((n&1023)<<10|e.charCodeAt(++i)&1023),s[a>>>2]|=(240|n>>>18)<<ln[a++&3],s[a>>>2]|=(128|n>>>12&63)<<ln[a++&3],s[a>>>2]|=(128|n>>>6&63)<<ln[a++&3],s[a>>>2]|=(128|n&63)<<ln[a++&3]);this.lastByteIndex=a,this.bytes+=a-this.start,a>=64?(this.block=s[16],this.start=a-64,this.hash(),this.hashed=!0):this.start=a}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}};un.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>>2]|=Vj[t&3],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}};un.prototype.hash=function(){var e=this.h0,t=this.h1,r=this.h2,n=this.h3,i=this.h4,a=this.h5,o=this.h6,s=this.h7,c=this.blocks,l,u,d,f,p,m,h,_,y,w,x;for(l=16;l<64;++l)p=c[l-15],u=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,p=c[l-2],d=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10,c[l]=c[l-16]+u+c[l-7]+d<<0;for(x=t&r,l=0;l<64;l+=4)this.first?(this.is224?(_=300032,p=c[0]-1413257819,s=p-150054599<<0,n=p+24177077<<0):(_=704751109,p=c[0]-210244248,s=p-1521486534<<0,n=p+143694565<<0),this.first=!1):(u=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),d=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),_=e&t,f=_^e&r^x,h=i&a^~i&o,p=s+d+h+gd[l]+c[l],m=u+f,s=n+p<<0,n=p+m<<0),u=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),d=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),y=n&e,f=y^n&t^_,h=o&s^~o&i,p=a+d+h+gd[l+1]+c[l+1],m=u+f,o=r+p<<0,r=p+m<<0,u=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),d=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),w=r&n,f=w^r&e^y,h=a&o^~a&s,p=i+d+h+gd[l+2]+c[l+2],m=u+f,a=t+p<<0,t=p+m<<0,u=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),d=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),x=t&r,f=x^t&n^w,h=a&o^~a&s,p=i+d+h+gd[l+3]+c[l+3],m=u+f,i=e+p<<0,e=p+m<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+e<<0,this.h1=this.h1+t<<0,this.h2=this.h2+r<<0,this.h3=this.h3+n<<0,this.h4=this.h4+i<<0,this.h5=this.h5+a<<0,this.h6=this.h6+o<<0,this.h7=this.h7+s<<0};un.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,r=this.h2,n=this.h3,i=this.h4,a=this.h5,o=this.h6,s=this.h7,c=ee[e>>>28&15]+ee[e>>>24&15]+ee[e>>>20&15]+ee[e>>>16&15]+ee[e>>>12&15]+ee[e>>>8&15]+ee[e>>>4&15]+ee[e&15]+ee[t>>>28&15]+ee[t>>>24&15]+ee[t>>>20&15]+ee[t>>>16&15]+ee[t>>>12&15]+ee[t>>>8&15]+ee[t>>>4&15]+ee[t&15]+ee[r>>>28&15]+ee[r>>>24&15]+ee[r>>>20&15]+ee[r>>>16&15]+ee[r>>>12&15]+ee[r>>>8&15]+ee[r>>>4&15]+ee[r&15]+ee[n>>>28&15]+ee[n>>>24&15]+ee[n>>>20&15]+ee[n>>>16&15]+ee[n>>>12&15]+ee[n>>>8&15]+ee[n>>>4&15]+ee[n&15]+ee[i>>>28&15]+ee[i>>>24&15]+ee[i>>>20&15]+ee[i>>>16&15]+ee[i>>>12&15]+ee[i>>>8&15]+ee[i>>>4&15]+ee[i&15]+ee[a>>>28&15]+ee[a>>>24&15]+ee[a>>>20&15]+ee[a>>>16&15]+ee[a>>>12&15]+ee[a>>>8&15]+ee[a>>>4&15]+ee[a&15]+ee[o>>>28&15]+ee[o>>>24&15]+ee[o>>>20&15]+ee[o>>>16&15]+ee[o>>>12&15]+ee[o>>>8&15]+ee[o>>>4&15]+ee[o&15];return this.is224||(c+=ee[s>>>28&15]+ee[s>>>24&15]+ee[s>>>20&15]+ee[s>>>16&15]+ee[s>>>12&15]+ee[s>>>8&15]+ee[s>>>4&15]+ee[s&15]),c};un.prototype.toString=un.prototype.hex;un.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,r=this.h2,n=this.h3,i=this.h4,a=this.h5,o=this.h6,s=this.h7,c=[e>>>24&255,e>>>16&255,e>>>8&255,e&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255,r>>>24&255,r>>>16&255,r>>>8&255,r&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255,i>>>24&255,i>>>16&255,i>>>8&255,i&255,a>>>24&255,a>>>16&255,a>>>8&255,a&255,o>>>24&255,o>>>16&255,o>>>8&255,o&255];return this.is224||c.push(s>>>24&255,s>>>16&255,s>>>8&255,s&255),c};un.prototype.array=un.prototype.digest;un.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(this.is224?28:32),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),this.is224||t.setUint32(28,this.h7),e};var os=(...e)=>new un(!1,!0).update(e.join("")).hex();var pE=T({sha256:()=>os});function mE(e){let t=Symbol.for(e);return{brand(r,n){let i=n?Symbol.for(`${e}.${n}`):t;class a extends r{[i]=!0;constructor(...s){super(...s)}static isInstance(s){return typeof s=="object"&&s!==null&&i in s&&s[i]===!0}static[Symbol.hasInstance](s){return this.isInstance(s)}}return Object.defineProperty(a,"name",{value:r.name}),a},sub(r){return mE(`${e}.${r}`)},isInstance(r){return typeof r=="object"&&r!==null&&t in r&&r[t]===!0}}}var hE=mE("langchain");var gE=T({ContextOverflowError:()=>Zj,LangChainError:()=>cg,ModelAbortError:()=>yd,addLangChainErrorFields:()=>fi,getRetryable:()=>sg,ns:()=>_d,stampRetryable:()=>pi});function fi(e,t){return e.lc_error_code=t,e.message=`${e.message}
6
+
7
+ Troubleshooting URL: https://docs.langchain.com/oss/javascript/langchain/errors/${t}/
8
+ `,e}var _d=hE.sub("error"),_E=Symbol.for("langchain.errors.retryable");function pi(e,t){if(typeof e!="object"||e===null)return e;try{Object.defineProperty(e,_E,{value:t,configurable:!0})}catch{}return e}function sg(e){if(!(typeof e!="object"||e===null))return Object.getOwnPropertyDescriptor(e,_E)?.value}var cg=class extends _d.brand(Error){name="LangChainError";constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},yd=class extends _d.brand(cg,"model-abort"){name="ModelAbortError";partialOutput;constructor(e,t){super(e),this.partialOutput=t,pi(this,!1)}},Zj=class yE extends _d.brand(cg,"context-overflow"){name="ContextOverflowError";cause;constructor(t){super(t??"Input exceeded the model's context window."),pi(this,!1)}static fromError(t){let r=new yE(t.message);return r.cause=t,r}};function Dn(e){return typeof e=="object"&&e!==null&&"type"in e&&typeof e.type=="string"&&"source_type"in e&&(e.source_type==="url"||e.source_type==="base64"||e.source_type==="text"||e.source_type==="id")}function ss(e){return Dn(e)&&e.source_type==="url"&&"url"in e&&typeof e.url=="string"}function cs(e){return Dn(e)&&e.source_type==="base64"&&"data"in e&&typeof e.data=="string"}function vE(e){return Dn(e)&&e.source_type==="text"&&"text"in e&&typeof e.text=="string"}function vd(e){return Dn(e)&&e.source_type==="id"&&"id"in e&&typeof e.id=="string"}function bd(e){if(Dn(e)){if(e.source_type==="url")return{type:"image_url",image_url:{url:e.url}};if(e.source_type==="base64"){if(!e.mime_type)throw new Error("mime_type key is required for base64 data.");return{type:"image_url",image_url:{url:`data:${e.mime_type};base64,${e.data}`}}}}throw new Error("Unsupported source type. Only 'url' and 'base64' are supported.")}function bE(e){let t=e.split(";")[0].split("/");if(t.length!==2)throw new Error(`Invalid mime type: "${e}" - does not match type/subtype format.`);let r=t[0].trim(),n=t[1].trim();if(r===""||n==="")throw new Error(`Invalid mime type: "${e}" - type or subtype is empty.`);let i={};for(let a of e.split(";").slice(1)){let o=a.split("=");if(o.length!==2)throw new Error(`Invalid parameter syntax in mime type: "${e}".`);let s=o[0].trim(),c=o[1].trim();if(s==="")throw new Error(`Invalid parameter syntax in mime type: "${e}".`);i[s]=c}return{type:r,subtype:n,parameters:i}}function Jc({dataUrl:e,asTypedArray:t=!1}){let r=e.match(/^data:(\w+\/\w+);base64,([A-Za-z0-9+/]+=*)$/),n;if(r){n=r[1].toLowerCase();let i=t?Uint8Array.from(atob(r[2]),a=>a.charCodeAt(0)):r[2];return{mime_type:n,data:i}}}function wE(e,t){if(e.type==="text"){if(!t.fromStandardTextBlock)throw new Error(`Converter for ${t.providerName} does not implement \`fromStandardTextBlock\` method.`);return t.fromStandardTextBlock(e)}if(e.type==="image"){if(!t.fromStandardImageBlock)throw new Error(`Converter for ${t.providerName} does not implement \`fromStandardImageBlock\` method.`);return t.fromStandardImageBlock(e)}if(e.type==="audio"){if(!t.fromStandardAudioBlock)throw new Error(`Converter for ${t.providerName} does not implement \`fromStandardAudioBlock\` method.`);return t.fromStandardAudioBlock(e)}if(e.type==="file"){if(!t.fromStandardFileBlock)throw new Error(`Converter for ${t.providerName} does not implement \`fromStandardFileBlock\` method.`);return t.fromStandardFileBlock(e)}throw new Error(`Unable to convert content block type '${e.type}' to provider-specific format: not recognized.`)}function H(e,t){return te(e)&&e.type===t}function te(e){return typeof e=="object"&&e!==null}function St(e){return Array.isArray(e)}function A(e){return typeof e=="string"}function Or(e){return typeof e=="number"}function wd(e){return e instanceof Uint8Array}function lg(e){try{return JSON.parse(e)}catch{return}}var Pr=e=>e();function Hj(e){if(e.type==="char_location"&&A(e.document_title)&&Or(e.start_char_index)&&Or(e.end_char_index)&&A(e.cited_text)){let{document_title:t,start_char_index:r,end_char_index:n,cited_text:i,...a}=e;return{...a,type:"citation",source:"char",title:t??void 0,startIndex:r,endIndex:n,citedText:i}}if(e.type==="page_location"&&A(e.document_title)&&Or(e.start_page_number)&&Or(e.end_page_number)&&A(e.cited_text)){let{document_title:t,start_page_number:r,end_page_number:n,cited_text:i,...a}=e;return{...a,type:"citation",source:"page",title:t??void 0,startIndex:r,endIndex:n,citedText:i}}if(e.type==="content_block_location"&&A(e.document_title)&&Or(e.start_block_index)&&Or(e.end_block_index)&&A(e.cited_text)){let{document_title:t,start_block_index:r,end_block_index:n,cited_text:i,...a}=e;return{...a,type:"citation",source:"block",title:t??void 0,startIndex:r,endIndex:n,citedText:i}}if(e.type==="web_search_result_location"&&A(e.url)&&A(e.title)&&A(e.encrypted_index)&&A(e.cited_text)){let{url:t,title:r,encrypted_index:n,cited_text:i,...a}=e;return{...a,type:"citation",source:"url",url:t,title:r,startIndex:Number(n),endIndex:Number(n),citedText:i}}if(e.type==="search_result_location"&&A(e.source)&&A(e.title)&&Or(e.start_block_index)&&Or(e.end_block_index)&&A(e.cited_text)){let{source:t,title:r,start_block_index:n,end_block_index:i,cited_text:a,...o}=e;return{...o,type:"citation",source:"search",url:t,title:r??void 0,startIndex:n,endIndex:i,citedText:a}}}function SE(e){if(H(e,"document")&&te(e.source)&&"type"in e.source){if(e.source.type==="base64"&&A(e.source.media_type)&&A(e.source.data))return{type:"file",mimeType:e.source.media_type,data:e.source.data};if(e.source.type==="url"&&A(e.source.url))return{type:"file",url:e.source.url};if(e.source.type==="file"&&A(e.source.file_id))return{type:"file",fileId:e.source.file_id};if(e.source.type==="text"&&A(e.source.data))return{type:"file",mimeType:String(e.source.media_type??"text/plain"),data:e.source.data}}else if(H(e,"image")&&te(e.source)&&"type"in e.source){if(e.source.type==="base64"&&A(e.source.media_type)&&A(e.source.data))return{type:"image",mimeType:e.source.media_type,data:e.source.data};if(e.source.type==="url"&&A(e.source.url))return{type:"image",url:e.source.url};if(e.source.type==="file"&&A(e.source.file_id))return{type:"image",fileId:e.source.file_id}}}function kE(e){function*t(){for(let r of e){let n=SE(r);n?yield n:yield r}}return Array.from(t())}function xE(e){function*t(){let r=typeof e.content=="string"?[{type:"text",text:e.content}]:e.content;for(let n of r){if(H(n,"text")&&A(n.text)){let{text:i,citations:a,...o}=n;if(St(a)&&a.length){let s=a.reduce((c,l)=>{let u=Hj(l);return u?[...c,u]:c},[]);yield{...o,type:"text",text:i,annotations:s};continue}else{yield{...o,type:"text",text:i};continue}}else if(H(n,"thinking")&&A(n.thinking)){let{thinking:i,signature:a,...o}=n;yield{...o,type:"reasoning",reasoning:i,signature:a};continue}else if(H(n,"redacted_thinking")){yield{type:"non_standard",value:n};continue}else if(H(n,"tool_use")&&A(n.name)&&A(n.id)){yield{type:"tool_call",id:n.id,name:n.name,args:n.input};continue}else if(H(n,"input_json_delta")){if(Gj(e)&&e.tool_call_chunks?.length){let i=e.tool_call_chunks[0];yield{type:"tool_call_chunk",id:i.id,name:i.name,args:i.args,index:i.index};continue}}else if(H(n,"server_tool_use")&&A(n.name)&&A(n.id)){let{name:i,id:a}=n;if(i==="web_search"){yield{id:a,type:"server_tool_call",name:"web_search",args:{query:Pr(()=>{if(typeof n.input=="string")return n.input;if(te(n.input)&&A(n.input.query))return n.input.query;if(A(n.partial_json)){let o=lg(n.partial_json);if(o?.query)return o.query}return""})}};continue}else if(n.name==="code_execution"){yield{id:a,type:"server_tool_call",name:"code_execution",args:{code:Pr(()=>{if(typeof n.input=="string")return n.input;if(te(n.input)&&A(n.input.code))return n.input.code;if(A(n.partial_json)){let o=lg(n.partial_json);if(o?.code)return o.code}return""})}};continue}}else if(H(n,"web_search_tool_result")&&A(n.tool_use_id)&&St(n.content)){let{content:i,tool_use_id:a}=n;yield{type:"server_tool_call_result",name:"web_search",toolCallId:a,status:"success",output:{urls:i.reduce((o,s)=>H(s,"web_search_result")?[...o,s.url]:o,[])}};continue}else if(H(n,"code_execution_tool_result")&&A(n.tool_use_id)&&te(n.content)){yield{type:"server_tool_call_result",name:"code_execution",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(H(n,"mcp_tool_use")){yield{id:n.id,type:"server_tool_call",name:"mcp_tool_use",args:n.input};continue}else if(H(n,"mcp_tool_result")&&A(n.tool_use_id)&&te(n.content)){yield{type:"server_tool_call_result",name:"mcp_tool_use",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(H(n,"container_upload")){yield{type:"server_tool_call",name:"container_upload",args:n.input};continue}else if(H(n,"search_result")){yield{id:n.id,type:"non_standard",value:n};continue}else if(H(n,"tool_result")){yield{id:n.id,type:"non_standard",value:n};continue}else{let i=SE(n);if(i){yield i;continue}}yield{type:"non_standard",value:n}}}return Array.from(t())}var EE={translateContent:xE,translateContentChunk:xE};function Gj(e){return typeof e?._getType=="function"&&typeof e.concat=="function"&&e._getType()==="ai"}function Wj(e){return ss(e)?{type:e.type,mimeType:e.mime_type,url:e.url,metadata:e.metadata}:cs(e)?{type:e.type,mimeType:e.mime_type??"application/octet-stream",data:e.data,metadata:e.metadata}:vd(e)?{type:e.type,mimeType:e.mime_type,fileId:e.id,metadata:e.metadata}:e}function $E(e){return e.map(Wj)}function IE(e){return!!(H(e,"image_url")&&te(e.image_url)||H(e,"input_audio")&&te(e.input_audio)||H(e,"file")&&te(e.file))}function TE(e){if(H(e,"image_url")&&te(e.image_url)&&A(e.image_url.url)){let t=Jc({dataUrl:e.image_url.url});return t?{type:"image",mimeType:t.mime_type,data:t.data}:{type:"image",url:e.image_url.url}}else{if(H(e,"input_audio")&&te(e.input_audio)&&A(e.input_audio.data)&&A(e.input_audio.format))return{type:"audio",data:e.input_audio.data,mimeType:`audio/${e.input_audio.format}`};if(H(e,"file")&&te(e.file)&&A(e.file.data)){let t=Jc({dataUrl:e.file.data});if(t)return{type:"file",data:t.data,mimeType:t.mime_type};if(A(e.file.file_id))return{type:"file",fileId:e.file.file_id}}}return e}function Jj(e){let t=[];typeof e.content=="string"?e.content.length>0&&t.push({type:"text",text:e.content}):t.push(...xd(e.content));for(let r of e.tool_calls??[])t.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return t}function Kj(e){let t=[];typeof e.content=="string"?e.content.length>0&&t.push({type:"text",text:e.content}):t.push(...xd(e.content));for(let r of e.tool_calls??[])t.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return t}function xd(e){let t=[];for(let r of e)IE(r)?t.push(TE(r)):t.push(r);return t}function qj(e){if(e.type==="url_citation"){let{url:t,title:r,start_index:n,end_index:i}=e;return{type:"citation",url:t,title:r,startIndex:n,endIndex:i}}if(e.type==="file_citation"){let{file_id:t,filename:r,index:n}=e;return{type:"citation",title:r,startIndex:n,endIndex:n,fileId:t}}return e}function CE(e){function*t(){te(e.additional_kwargs?.reasoning)&&St(e.additional_kwargs.reasoning.summary)&&(yield{type:"reasoning",reasoning:e.additional_kwargs.reasoning.summary.reduce((n,i)=>te(i)&&A(i.text)?`${n}${i.text}`:n,"")});let r=typeof e.content=="string"?[{type:"text",text:e.content}]:e.content;for(let n of r)if(H(n,"text")){let{text:i,annotations:a,phase:o,extras:s,...c}=n,l=te(s)?{...s}:{};A(o)&&(l.phase=o);let u=Object.keys(l).length>0?{extras:l}:{};Array.isArray(a)?yield{...c,...u,type:"text",text:String(i),annotations:a.map(qj)}:yield{...c,...u,type:"text",text:String(i)}}for(let n of e.tool_calls??[])yield{type:"tool_call",id:n.id,name:n.name,args:n.args};if(te(e.additional_kwargs)&&St(e.additional_kwargs.tool_outputs))for(let n of e.additional_kwargs.tool_outputs){if(H(n,"web_search_call")){let i={};if(te(n.action)&&A(n.action.query)&&(i.query=n.action.query),yield{id:n.id,type:"server_tool_call",name:"web_search",args:i},n.status==="completed"||n.status==="failed"){let a={};te(n.action)&&(a.action=n.action),yield{type:"server_tool_call_result",toolCallId:A(n.id)?n.id:"",status:n.status==="completed"?"success":"error",output:a}}continue}else if(H(n,"file_search_call")){yield{id:n.id,type:"server_tool_call",name:"file_search",args:{queries:St(n.queries)?n.queries:[]}},(n.status==="completed"||n.status==="failed")&&(yield{type:"server_tool_call_result",toolCallId:A(n.id)?n.id:"",status:n.status==="completed"?"success":"error",output:St(n.results)?{results:n.results}:{}});continue}else if(H(n,"computer_call")){yield{type:"non_standard",value:n};continue}else if(H(n,"code_interpreter_call")){if(A(n.code)&&(yield{id:n.id,type:"server_tool_call",name:"code_interpreter",args:{code:n.code}}),St(n.outputs)){let i=Pr(()=>{if(n.status!=="in_progress"){if(n.status==="completed")return 0;if(n.status==="incomplete")return 127;if(n.status!=="interpreting"&&n.status==="failed")return 1}});for(let a of n.outputs)if(H(a,"logs")){yield{type:"server_tool_call_result",toolCallId:n.id??"",status:"success",output:{type:"code_interpreter_output",returnCode:i??0,stderr:[0,void 0].includes(i)?void 0:String(a.logs),stdout:[0,void 0].includes(i)?String(a.logs):void 0}};continue}}continue}else if(H(n,"mcp_call")){yield{id:n.id,type:"server_tool_call",name:"mcp_call",args:n.input};continue}else if(H(n,"mcp_list_tools")){yield{id:n.id,type:"server_tool_call",name:"mcp_list_tools",args:n.input};continue}else if(H(n,"mcp_approval_request")){yield{type:"non_standard",value:n};continue}else if(H(n,"tool_search_call")){let i={};te(n.arguments)&&Object.assign(i,n.arguments);let a={};A(n.execution)&&(a.execution=n.execution),A(n.status)&&(a.status=n.status),A(n.call_id)&&(a.call_id=n.call_id),yield{id:A(n.id)?n.id:"",type:"server_tool_call",name:"tool_search",args:i,...Object.keys(a).length>0?{extras:a}:{}};continue}else if(H(n,"tool_search_output")){let i={name:"tool_search"};A(n.execution)&&(i.execution=n.execution),yield{type:"server_tool_call_result",toolCallId:A(n.id)?n.id:"",status:n.status==="completed"?"success":n.status==="failed"?"error":"success",output:{tools:St(n.tools)?n.tools:[]},extras:i};continue}else if(H(n,"image_generation_call")){A(n.result)&&(yield{type:"image",mimeType:"image/png",data:n.result,id:A(n.id)?n.id:void 0,metadata:{status:A(n.status)?n.status:void 0}}),yield{type:"non_standard",value:n};continue}te(n)&&(yield{type:"non_standard",value:n})}}return Array.from(t())}function Yj(e){function*t(){yield*CE(e);for(let r of e.tool_call_chunks??[])yield{type:"tool_call_chunk",id:r.id,name:r.name,args:r.args}}return Array.from(t())}var AE={translateContent:e=>typeof e.content=="string"?Jj(e):CE(e),translateContentChunk:e=>typeof e.content=="string"?Kj(e):Yj(e)};function Sd(e){return typeof e=="object"&&e!==null&&"type"in e&&"content"in e&&(typeof e.content=="string"||Array.isArray(e.content))}function OE(e,t="pretty"){return t==="pretty"?Xj(e):JSON.stringify(e)}function Xj(e){let t=[],r=` ${e.type.charAt(0).toUpperCase()+e.type.slice(1)} Message `,n=Math.floor((80-r.length)/2),i="=".repeat(n),a=r.length%2===0?i:`${i}=`;if(t.push(`${i}${r}${a}`),e.type==="ai"){let o=e;if(o.tool_calls&&o.tool_calls.length>0){t.push("Tool Calls:");for(let s of o.tool_calls){t.push(` ${s.name} (${s.id})`),t.push(` Call ID: ${s.id}`),t.push(" Args:");for(let[c,l]of Object.entries(s.args))t.push(` ${c}: ${typeof l=="object"?JSON.stringify(l):l}`)}}}if(e.type==="tool"){let o=e;o.name&&t.push(`Name: ${o.name}`)}return typeof e.content=="string"&&e.content.trim()&&(t.length>1&&t.push(""),t.push(e.content)),t.join(`
9
+ `)}var ug=Symbol.for("langchain.message");function PE(e){return Array.isArray(e)?e:typeof e=="string"?e===""?[]:[{type:"text",text:e}]:e==null?[]:[e]}function Zt(e,t){if(typeof e=="string")return e===""?t:typeof t=="string"?e+t:Array.isArray(t)&&t.length===0?e:Array.isArray(t)&&t.some(r=>Dn(r))?[{type:"text",source_type:"text",text:e},...t]:[{type:"text",text:e},...t];if(Array.isArray(t)){let r=PE(e);return ta(r,t)??[...r,...t]}else return t===""?e:Array.isArray(e)&&e.some(r=>Dn(r))?[...e,{type:"file",source_type:"text",text:t}]:[...PE(e),{type:"text",text:t}]}function kd(e,t){return e==="error"||t==="error"?"error":"success"}function Qj(e,t){function r(n,i){if(typeof n!="object"||n===null||n===void 0)return n;if(i>=t)return Array.isArray(n)?"[Array]":"[Object]";if(Array.isArray(n))return n.map(o=>r(o,i+1));let a={};for(let o of Object.keys(n))a[o]=r(n[o],i+1);return a}return JSON.stringify(r(e,0),null,2)}var Pe=class extends pt{lc_namespace=["langchain_core","messages"];lc_serializable=!0;get lc_aliases(){return{additional_kwargs:"additional_kwargs",response_metadata:"response_metadata"}}[ug]=!0;id;name;content;additional_kwargs;response_metadata;_getType(){return this.type}getType(){return this._getType()}constructor(e){let t=typeof e=="string"||Array.isArray(e)?{content:e}:e;t.additional_kwargs||(t.additional_kwargs={}),t.response_metadata||(t.response_metadata={}),super(t),this.name=t.name,t.content===void 0&&t.contentBlocks!==void 0?(this.content=t.contentBlocks,this.response_metadata={output_version:"v1",...t.response_metadata}):t.content!==void 0?(this.content=t.content??[],this.response_metadata=t.response_metadata):(this.content=[],this.response_metadata=t.response_metadata),this.additional_kwargs=t.additional_kwargs,this.id=t.id}get text(){return typeof this.content=="string"?this.content:Array.isArray(this.content)?this.content.map(e=>typeof e=="string"?e:e.type==="text"?e.text:"").join(""):""}get contentBlocks(){let e=typeof this.content=="string"?[{type:"text",text:this.content}]:this.content;return[$E,xd,kE].reduce((t,r)=>r(t),e)}toDict(){return{type:this.getType(),data:this.toJSON().kwargs}}static lc_name(){return"BaseMessage"}get _printableFields(){return{id:this.id,content:this.content,name:this.name,additional_kwargs:this.additional_kwargs,response_metadata:this.response_metadata}}static isInstance(e){return typeof e=="object"&&e!==null&&ug in e&&e[ug]===!0&&Sd(e)}static[Symbol.hasInstance](e){return this.isInstance(e)}_updateId(e){this.id=e,this.lc_kwargs.id=e}get[Symbol.toStringTag](){return this.constructor.lc_name()}[Symbol.for("nodejs.util.inspect.custom")](e){if(e===null)return this;let t=Qj(this._printableFields,Math.max(4,e));return`${this.constructor.lc_name()} ${t}`}toFormattedString(e="pretty"){return OE(this,e)}};function jE(e){return Array.isArray(e)&&e.every(t=>typeof t.index=="number")}var dg=["index","created","timestamp"];function tt(e,t,r){let n=r?.ignoreKeys??dg;if(e==null&&t==null)return;if(e==null||t==null)return e??t;let i={...e};for(let[a,o]of Object.entries(t))if(i[a]==null)i[a]=o;else{if(o==null)continue;if(typeof i[a]!=typeof o||Array.isArray(i[a])!==Array.isArray(o))throw new Error(`field[${a}] already exists in the message chunk, but with a different type.`);if(typeof i[a]=="string"){if(a==="type")continue;if(["id","name","output_version","model_provider"].includes(a))o&&(i[a]=o);else{if(n.includes(a))continue;i[a]+=o}}else if(typeof i[a]=="number"){if(n.includes(a))continue;i[a]=i[a]+o}else if(typeof i[a]=="object"&&!Array.isArray(i[a]))i[a]=tt(i[a],o,r);else if(Array.isArray(i[a]))i[a]=ta(i[a],o,r);else{if(i[a]===o)continue;console.warn(`field[${a}] already exists in this message chunk and value has unsupported type.`)}}return i}function eD(e){return typeof e=="number"||typeof e=="string"}function NE(e){return typeof e!="object"||e===null||!("index"in e)?!1:eD(e.index)}function RE(e){if(typeof e!="object"||e===null||!("id"in e))return!1;let t=e.id;return t!=null&&t!==""}function ME(e){return e.endsWith("_delta")?e.slice(0,-6):e}function tD(e,t){return typeof e!="object"||e===null||typeof t!="object"||t===null||!("type"in e)||!("type"in t)?!1:typeof e.type=="string"&&typeof t.type=="string"&&ME(e.type)!==ME(t.type)}function rD(e,t){let r=NE(t),n=RE(t);return!r&&!n?-1:e.findIndex(i=>{let a=NE(i),o=RE(i);return r&&a?i.index!==t.index||tD(i,t)?!1:o&&n?i.id===t.id:!0:!r&&!a&&n&&o?i.id===t.id:!1})}function ta(e,t,r){if(!(e==null&&t==null)){if(e==null||t==null)return e||t;{let n=[...e];for(let i of t){let a=rD(n,i);if(a!==-1)n[a]=tt(n[a],i,r);else{if(typeof i=="object"&&i!==null&&"text"in i&&i.text==="")continue;n.push(i)}}return n}}}function Ed(e,t,r){if(!(e==null&&t==null)){if(e==null||t==null)return e??t;if(typeof e!=typeof t)throw new Error(`Cannot merge objects of different types.
10
+ Left ${typeof e}
11
+ Right ${typeof t}`);if(typeof e=="string"&&typeof t=="string")return e+t;if(Array.isArray(e)&&Array.isArray(t))return ta(e,t,r);if(typeof e=="object"&&typeof t=="object")return tt(e,t,r);if(e===t)return e;throw new Error(`Can not merge objects of different types.
12
+ Left ${e}
13
+ Right ${t}`)}}var Pt=class DE extends Pe{static isInstance(t){if(!super.isInstance(t))return!1;let r=Object.getPrototypeOf(t);for(;r!==null;){if(r===DE.prototype)return!0;r=Object.getPrototypeOf(r)}return!1}static[Symbol.hasInstance](t){return this.isInstance(t)}};function $d(e){return typeof e.role=="string"}function rt(e){return typeof e?._getType=="function"}function mi(e){return Pt.isInstance(e)}var zE=T({ToolMessage:()=>kt,ToolMessageChunk:()=>ls,defaultToolCallParser:()=>qc,isDirectToolOutput:()=>Kc,isToolMessage:()=>Yc,isToolMessageChunk:()=>fg});function Kc(e){return e!=null&&typeof e=="object"&&"lc_direct_tool_output"in e&&e.lc_direct_tool_output===!0}var kt=class extends Pe{static lc_name(){return"ToolMessage"}get lc_aliases(){return{tool_call_id:"tool_call_id"}}lc_direct_tool_output=!0;type="tool";status;tool_call_id;metadata;artifact;constructor(e,t,r){let n=typeof e=="string"||Array.isArray(e)?{content:e,name:r,tool_call_id:t}:e;super(n),this.tool_call_id=n.tool_call_id,this.artifact=n.artifact,this.status=n.status,this.metadata=n.metadata}static isInstance(e){return super.isInstance(e)&&e.type==="tool"}static[Symbol.hasInstance](e){return this.isInstance(e)}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}},ls=class extends Pt{type="tool";tool_call_id;status;artifact;constructor(e){super(e),this.tool_call_id=e.tool_call_id,this.artifact=e.artifact,this.status=e.status}static lc_name(){return"ToolMessageChunk"}concat(e){let t=this.constructor;return new t({content:Zt(this.content,e.content),additional_kwargs:tt(this.additional_kwargs,e.additional_kwargs),response_metadata:tt(this.response_metadata,e.response_metadata),artifact:Ed(this.artifact,e.artifact),tool_call_id:this.tool_call_id,id:this.id??e.id,status:kd(this.status,e.status)})}static isInstance(e){return super.isInstance(e)&&e.type==="tool"}static[Symbol.hasInstance](e){return this.isInstance(e)}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}};function qc(e){let t=[],r=[];for(let n of e)if(n.function){let i=n.function.name;try{let a=JSON.parse(n.function.arguments);t.push({name:i||"",args:a||{},id:n.id})}catch{r.push({name:i,args:n.function.arguments,id:n.id,error:"Malformed args."})}}else continue;return[t,r]}function Yc(e){return typeof e=="object"&&e!==null&&"getType"in e&&typeof e.getType=="function"&&e.getType()==="tool"}function fg(e){return e._getType()==="tool"}function ra(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="tool_call")}function UE(e){return!!(e&&typeof e=="object"&&"toolCall"in e&&e.toolCall!=null&&typeof e.toolCall=="object"&&"id"in e.toolCall&&typeof e.toolCall.id=="string")}var us=class extends Error{output;constructor(e,t){super(e),this.output=t}};function Xa(e,t=dn){e=e.trim();let r=e.indexOf("```");if(r===-1)return t(e);let n=e.substring(r+3);n.startsWith(`json
14
+ `)?n=n.substring(5):n.startsWith("json")?n=n.substring(4):n.startsWith(`
15
+ `)&&(n=n.substring(1));let i=n.indexOf("```"),a=n;return i!==-1&&(a=n.substring(0,i)),t(a.trim())}function nD(e){try{return JSON.parse(e)}catch{}let t=e.trim();if(t.length===0)throw new Error("Unexpected end of JSON input");let r=0;function n(){for(;r<t.length&&/\s/.test(t[r]);)r+=1}function i(){if(t[r]!=='"')throw new Error(`Expected '"' at position ${r}, got '${t[r]}'`);r+=1;let u="",d=!1;for(;r<t.length;){let f=t[r];if(d){if(f==="n")u+=`
16
+ `;else if(f==="t")u+=" ";else if(f==="r")u+="\r";else if(f==="\\")u+="\\";else if(f==='"')u+='"';else if(f==="b")u+="\b";else if(f==="f")u+="\f";else if(f==="/")u+="/";else if(f==="u"){let p=t.substring(r+1,r+5);if(/^[0-9A-Fa-f]{0,4}$/.test(p))p.length===4?u+=String.fromCharCode(Number.parseInt(p,16)):u+=`u${p}`,r+=p.length;else throw new Error(`Invalid unicode escape sequence '\\u${p}' at position ${r}`)}else throw new Error(`Invalid escape sequence '\\${f}' at position ${r}`);d=!1}else if(f==="\\")d=!0;else{if(f==='"')return r+=1,u;u+=f}r+=1}return d&&(u+="\\"),u}function a(){let u=r,d="";if(t[r]==="-"&&(d+="-",r+=1),r<t.length&&t[r]==="0"&&(d+="0",r+=1,t[r]>="0"&&t[r]<="9"))throw new Error(`Invalid number at position ${u}`);if(r<t.length&&t[r]>="1"&&t[r]<="9")for(;r<t.length&&t[r]>="0"&&t[r]<="9";)d+=t[r],r+=1;if(r<t.length&&t[r]===".")for(d+=".",r+=1;r<t.length&&t[r]>="0"&&t[r]<="9";)d+=t[r],r+=1;if(r<t.length&&(t[r]==="e"||t[r]==="E"))for(d+=t[r],r+=1,r<t.length&&(t[r]==="+"||t[r]==="-")&&(d+=t[r],r+=1);r<t.length&&t[r]>="0"&&t[r]<="9";)d+=t[r],r+=1;if(d==="-")return-0;let f=Number.parseFloat(d);if(Number.isNaN(f))throw r=u,new Error(`Invalid number '${d}' at position ${u}`);return f}function o(){if(n(),r>=t.length)throw new Error(`Unexpected end of input at position ${r}`);let u=t[r];if(u==="{")return c();if(u==="[")return s();if(u==='"')return i();if("null".startsWith(t.substring(r,r+4)))return r+=Math.min(4,t.length-r),null;if("true".startsWith(t.substring(r,r+4)))return r+=Math.min(4,t.length-r),!0;if("false".startsWith(t.substring(r,r+5)))return r+=Math.min(5,t.length-r),!1;if(u==="-"||u>="0"&&u<="9")return a();throw new Error(`Unexpected character '${u}' at position ${r}`)}function s(){if(t[r]!=="[")throw new Error(`Expected '[' at position ${r}, got '${t[r]}'`);let u=[];if(r+=1,n(),r>=t.length)return u;if(t[r]==="]")return r+=1,u;for(;r<t.length;){if(n(),r>=t.length||(u.push(o()),n(),r>=t.length))return u;if(t[r]==="]")return r+=1,u;if(t[r]===","){r+=1;continue}throw new Error(`Expected ',' or ']' at position ${r}, got '${t[r]}'`)}return u}function c(){if(t[r]!=="{")throw new Error(`Expected '{' at position ${r}, got '${t[r]}'`);let u={};if(r+=1,n(),r>=t.length)return u;if(t[r]==="}")return r+=1,u;for(;r<t.length;){if(n(),r>=t.length)return u;let d=i();if(n(),r>=t.length)return u;if(t[r]!==":")throw new Error(`Expected ':' at position ${r}, got '${t[r]}'`);if(r+=1,n(),r>=t.length||(u[d]=o(),n(),r>=t.length))return u;if(t[r]==="}")return r+=1,u;if(t[r]===","){r+=1;continue}throw new Error(`Expected ',' or '}' at position ${r}, got '${t[r]}'`)}return u}let l=o();if(n(),r<t.length)throw new Error(`Unexpected character '${t[r]}' at position ${r}`);return l}function dn(e){try{return typeof e>"u"?null:nD(e)}catch{return null}}function pg(e){switch(e){case"csv":return"text/csv";case"doc":return"application/vnd.openxmlformats-officedocument.wordprocessingml.document";case"docx":return"application/vnd.openxmlformats-officedocument.wordprocessingml.document";case"html":return"text/html";case"md":return"text/markdown";case"pdf":return"application/pdf";case"txt":return"text/plain";case"xls":return"application/vnd.ms-excel";case"xlsx":return"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";case"gif":return"image/gif";case"jpeg":return"image/jpeg";case"jpg":return"image/jpeg";case"png":return"image/png";case"webp":return"image/webp";case"flv":return"video/flv";case"mkv":return"video/mkv";case"mov":return"video/mov";case"mp4":return"video/mp4";case"mpeg":return"video/mpeg";case"mpg":return"video/mpg";case"three_gp":return"video/three_gp";case"webm":return"video/webm";case"wmv":return"video/wmv";default:return"application/octet-stream"}}function iD(e){if(te(e.document)&&te(e.document.source)){let t=pg(te(e.document)&&A(e.document.format)?e.document.format:"");if(te(e.document.source)){if(te(e.document.source.s3Location)&&A(e.document.source.s3Location.uri))return{type:"file",mimeType:t,fileId:e.document.source.s3Location.uri};if(wd(e.document.source.bytes))return{type:"file",mimeType:t,data:e.document.source.bytes};if(A(e.document.source.text))return{type:"file",mimeType:t,data:Buffer.from(e.document.source.text).toString("base64")};if(St(e.document.source.content))return{type:"file",mimeType:t,data:e.document.source.content.reduce((r,n)=>te(n)&&A(n.text)?r+n.text:r,"")}}}return{type:"non_standard",value:e}}function aD(e){if(H(e,"image")&&te(e.image)){let t=pg(te(e.image)&&A(e.image.format)?e.image.format:"");if(te(e.image.source)){if(te(e.image.source.s3Location)&&A(e.image.source.s3Location.uri))return{type:"image",mimeType:t,fileId:e.image.source.s3Location.uri};if(wd(e.image.source.bytes))return{type:"image",mimeType:t,data:e.image.source.bytes}}}return{type:"non_standard",value:e}}function oD(e){if(H(e,"video")&&te(e.video)){let t=pg(te(e.video)&&A(e.video.format)?e.video.format:"");if(te(e.video.source)){if(te(e.video.source.s3Location)&&A(e.video.source.s3Location.uri))return{type:"video",mimeType:t,fileId:e.video.source.s3Location.uri};if(wd(e.video.source.bytes))return{type:"video",mimeType:t,data:e.video.source.bytes}}}return{type:"non_standard",value:e}}function LE(e){function*t(){let r=typeof e.content=="string"?[{type:"text",text:e.content}]:e.content;for(let n of r){if(H(n,"reasoning")&&A(n.reasoning)){yield{...n,type:"reasoning",reasoning:n.reasoning};continue}else if(H(n,"cache_point")){yield{type:"non_standard",value:n};continue}else if(H(n,"citations_content")&&te(n.citationsContent)){yield{type:"text",text:St(n.citationsContent.content)?n.citationsContent.content.reduce((i,a)=>te(a)&&A(a.text)?i+a.text:i,""):"",annotations:St(n.citationsContent.citations)?n.citationsContent.citations.reduce((i,a)=>{if(te(a)){let o=St(a.sourceContent)?a.sourceContent.reduce((c,l)=>te(l)&&A(l.text)?c+l.text:c,""):"",s=Pr(()=>{if(te(a.location)){let c=a.location.documentChar||a.location.documentPage||a.location.documentChunk;if(te(c))return{source:Or(c.documentIndex)?c.documentIndex.toString():void 0,startIndex:Or(c.start)?c.start:void 0,endIndex:Or(c.end)?c.end:void 0}}return{}});i.push({type:"citation",citedText:o,...s})}return i},[]):[]};continue}else if(H(n,"document")&&te(n.document)){yield iD(n);continue}else if(H(n,"guard_content")){yield{type:"non_standard",value:n};continue}else if(H(n,"image")&&te(n.image)){yield aD(n);continue}else if(H(n,"reasoning_content")&&te(n.reasoningText)&&A(n.reasoningText.text)){yield{type:"reasoning",reasoning:n.reasoningText.text,...A(n.reasoningText.signature)?{signature:n.reasoningText.signature}:{}};continue}else if(H(n,"reasoning_content")&&A(n.reasoningText)){yield{type:"reasoning",reasoning:n.reasoningText};continue}else if(H(n,"text")&&A(n.text)){yield{type:"text",text:n.text};continue}else if(H(n,"tool_result")){yield{type:"non_standard",value:n};continue}else{if(H(n,"tool_call"))continue;if(H(n,"video")&&te(n.video)){yield oD(n);continue}}yield{type:"non_standard",value:n}}}return Array.from(t())}var FE={translateContent:LE,translateContentChunk:LE};function BE(e){let t=[],r=e.additional_kwargs?.reasoning_content;if(A(r)&&r.length>0&&t.push({type:"reasoning",reasoning:r}),typeof e.content=="string")e.content.length>0&&t.push({type:"text",text:e.content});else for(let n of e.content)typeof n=="object"&&"type"in n&&n.type==="text"&&"text"in n&&A(n.text)&&t.push({type:"text",text:n.text});for(let n of e.tool_calls??[])t.push({type:"tool_call",id:n.id,name:n.name,args:n.args});return t}var VE={translateContent:BE,translateContentChunk:BE};function ZE(e){function*t(){let r=typeof e.content=="string"?[{type:"text",text:e.content}]:e.content;for(let n of r){if(H(n,"text")&&A(n.text)){yield{type:"text",text:n.text};continue}else if(H(n,"thinking")&&A(n.thinking)){yield{type:"reasoning",reasoning:n.thinking,...n.signature?{signature:n.signature}:{}};continue}else if(H(n,"inlineData")&&te(n.inlineData)&&A(n.inlineData.mimeType)&&A(n.inlineData.data)){yield{type:"file",mimeType:n.inlineData.mimeType,data:n.inlineData.data};continue}else if(H(n,"functionCall")&&te(n.functionCall)&&A(n.functionCall.name)&&te(n.functionCall.args)){yield{type:"tool_call",id:e.id,name:n.functionCall.name,args:n.functionCall.args};continue}else if(H(n,"functionResponse")){yield{type:"non_standard",value:n};continue}else if(H(n,"fileData")&&te(n.fileData)&&A(n.fileData.mimeType)&&A(n.fileData.fileUri)){yield{type:"file",mimeType:n.fileData.mimeType,fileId:n.fileData.fileUri};continue}else if(H(n,"executableCode")){yield{type:"non_standard",value:n};continue}else if(H(n,"codeExecutionResult")){yield{type:"non_standard",value:n};continue}yield{type:"non_standard",value:n}}}return Array.from(t())}var HE={translateContent:ZE,translateContentChunk:ZE};function GE(e){function*t(){let r=typeof e.content=="string"?[{type:"text",text:e.content}]:e.content;for(let n of r){if(H(n,"reasoning")&&A(n.reasoning)){let i=Pr(()=>{let a=r.indexOf(n);if(St(e.additional_kwargs?.signatures)&&a>=0)return e.additional_kwargs.signatures.at(a)});A(i)?yield{type:"reasoning",reasoning:n.reasoning,signature:i}:yield{type:"reasoning",reasoning:n.reasoning};continue}else if(H(n,"thinking")&&A(n.thinking)){yield{type:"reasoning",reasoning:n.thinking,...n.signature?{signature:n.signature}:{}};continue}else if(H(n,"text")&&A(n.text)){yield{type:"text",text:n.text};continue}else if(H(n,"image_url")){if(A(n.image_url))if(n.image_url.startsWith("data:")){let i=n.image_url.match(/^data:([^;]+);base64,(.+)$/);i?yield{type:"image",data:i[2],mimeType:i[1]}:yield{type:"image",url:n.image_url}}else yield{type:"image",url:n.image_url};continue}else if(H(n,"media")&&A(n.mimeType)&&A(n.data)){yield{type:"file",mimeType:n.mimeType,data:n.data};continue}yield{type:"non_standard",value:n}}}return Array.from(t())}var WE={translateContent:GE,translateContentChunk:GE};function JE(e){let t=[],r=e.additional_kwargs?.reasoning;if(A(r)&&r.length>0&&t.push({type:"reasoning",reasoning:r}),typeof e.content=="string"){let n=e.content,i=n.match(/<think>([\s\S]*?)<\/think>/);if(i){let a=i[1].trim();a.length>0&&t.push({type:"reasoning",reasoning:a}),n=n.replace(/<think>[\s\S]*?<\/think>/,"").trim()}n.length>0&&t.push({type:"text",text:n})}else for(let n of e.content)if(typeof n=="object"&&"type"in n&&n.type==="text"&&"text"in n&&A(n.text)){let i=n.text,a=i.match(/<think>([\s\S]*?)<\/think>/);if(a){let o=a[1].trim();o.length>0&&t.push({type:"reasoning",reasoning:o}),i=i.replace(/<think>[\s\S]*?<\/think>/,"").trim()}i.length>0&&t.push({type:"text",text:i})}for(let n of e.tool_calls??[])t.push({type:"tool_call",id:n.id,name:n.name,args:n.args});return t}var KE={translateContent:JE,translateContentChunk:JE};function qE(e){let t=[],r=e.additional_kwargs?.reasoning_content;if(A(r)&&r.length>0&&t.push({type:"reasoning",reasoning:r}),typeof e.content=="string")e.content.length>0&&t.push({type:"text",text:e.content});else for(let n of e.content)typeof n=="object"&&"type"in n&&n.type==="text"&&"text"in n&&A(n.text)&&t.push({type:"text",text:n.text});for(let n of e.tool_calls??[])t.push({type:"tool_call",id:n.id,name:n.name,args:n.args});return t}var YE={translateContent:qE,translateContentChunk:qE};function XE(e){let t=[],r=e.additional_kwargs?.reasoning_details,n=!1;if(Array.isArray(r)&&r.length>0)for(let i of r){if(i==null||typeof i!="object")continue;let a=i.type;if(a==="reasoning.summary"){let o=i.summary;A(o)&&o.length>0&&(t.push({type:"reasoning",reasoning:o}),n=!0)}else if(a==="reasoning.text"){let o=i.text;A(o)&&o.length>0&&(t.push({type:"reasoning",reasoning:o}),n=!0)}}if(!n){let i=e.additional_kwargs?.reasoning_content;A(i)&&i.length>0&&t.push({type:"reasoning",reasoning:i})}if(typeof e.content=="string")e.content.length>0&&t.push({type:"text",text:e.content});else for(let i of e.content)typeof i=="object"&&"type"in i&&i.type==="text"&&"text"in i&&A(i.text)&&t.push({type:"text",text:i.text});for(let i of e.tool_calls??[])t.push({type:"tool_call",id:i.id,name:i.name,args:i.args});return t}var QE={translateContent:XE,translateContentChunk:XE};function e$(e){let t=[];if(te(e.additional_kwargs?.reasoning)){let n=e.additional_kwargs.reasoning;if(St(n.summary)){let i=n.summary.reduce((a,o)=>te(o)&&A(o.text)?`${a}${o.text}`:a,"");i.length>0&&t.push({type:"reasoning",reasoning:i})}}let r=e.additional_kwargs?.reasoning_content;if(A(r)&&r.length>0&&t.push({type:"reasoning",reasoning:r}),typeof e.content=="string")e.content.length>0&&t.push({type:"text",text:e.content});else for(let n of e.content)typeof n=="object"&&"type"in n&&n.type==="text"&&"text"in n&&A(n.text)&&t.push({type:"text",text:n.text});for(let n of e.tool_calls??[])t.push({type:"tool_call",id:n.id,name:n.name,args:n.args});return t}var t$={translateContent:e$,translateContentChunk:e$};function r$(e){function*t(){let r=Pr(()=>{if(typeof e.content=="string")return e.additional_kwargs.originalTextContentBlock?[{...e.additional_kwargs.originalTextContentBlock,type:"text"}]:[{type:"text",text:e.content}];{let n=e.additional_kwargs?.originalTextContentBlock;if(n?.thoughtSignature&&!e.content.some(i=>"thoughtSignature"in i)){let i=[...e.content];for(let a=i.length-1;a>=0;a--){let o=i[a];if(o.type==="text"&&!o.thought)return o.thoughtSignature=n.thoughtSignature,i}}return e.content}});for(let n of r){let i=Pr(()=>H(n,"text")&&A(n.text)?{type:"text",text:n.text}:H(n,"inlineData")&&te(n.inlineData)&&A(n.inlineData.mimeType)&&A(n.inlineData.data)?{type:"file",mimeType:n.inlineData.mimeType,data:n.inlineData.data}:H(n,"functionCall")&&te(n.functionCall)&&A(n.functionCall.name)&&te(n.functionCall.args)?{type:"tool_call",id:e.id,name:n.functionCall.name,args:n.functionCall.args}:H(n,"functionResponse")?{type:"non_standard",value:n}:H(n,"fileData")&&te(n.fileData)&&A(n.fileData.mimeType)&&A(n.fileData.fileUri)?{type:"file",mimeType:n.fileData.mimeType,fileId:n.fileData.fileUri}:H(n,"executableCode")?{type:"non_standard",value:n}:H(n,"codeExecutionResult")?{type:"non_standard",value:n}:{type:"non_standard",value:n}),a=Pr(()=>"thought"in n&&n.thought?{type:"reasoning",reasoning:i.type==="text"?i.text:"",reasoningContentBlock:i}:i),o={thought:n.thought,thoughtSignature:n.thoughtSignature,partMetadata:n.partMetadata,...a};for(let s in o)o[s]===void 0&&delete o[s];yield o}}return Array.from(t())}var n$={translateContent:r$,translateContentChunk:r$};globalThis.lc_block_translators_registry??=new Map([["anthropic",EE],["bedrock-converse",FE],["deepseek",VE],["google",n$],["google-genai",HE],["google-vertexai",WE],["groq",KE],["ollama",YE],["openai",AE],["openrouter",QE],["xai",t$]]);function mg(e){return globalThis.lc_block_translators_registry.get(e)}function Id(e,t){return tt(e,t)??{}}function i$(e,t){let r={};return(e?.audio!==void 0||t?.audio!==void 0)&&(r.audio=(e?.audio??0)+(t?.audio??0)),(e?.image!==void 0||t?.image!==void 0)&&(r.image=(e?.image??0)+(t?.image??0)),(e?.video!==void 0||t?.video!==void 0)&&(r.video=(e?.video??0)+(t?.video??0)),(e?.document!==void 0||t?.document!==void 0)&&(r.document=(e?.document??0)+(t?.document??0)),(e?.text!==void 0||t?.text!==void 0)&&(r.text=(e?.text??0)+(t?.text??0)),r}function sD(e,t){let r={...i$(e,t)};return(e?.cache_read!==void 0||t?.cache_read!==void 0)&&(r.cache_read=(e?.cache_read??0)+(t?.cache_read??0)),(e?.cache_creation!==void 0||t?.cache_creation!==void 0)&&(r.cache_creation=(e?.cache_creation??0)+(t?.cache_creation??0)),r}function cD(e,t){let r={...i$(e,t)};return(e?.reasoning!==void 0||t?.reasoning!==void 0)&&(r.reasoning=(e?.reasoning??0)+(t?.reasoning??0)),r}function ds(e,t){return{input_tokens:(e?.input_tokens??0)+(t?.input_tokens??0),output_tokens:(e?.output_tokens??0)+(t?.output_tokens??0),total_tokens:(e?.total_tokens??0)+(t?.total_tokens??0),input_token_details:sD(e?.input_token_details,t?.input_token_details),output_token_details:cD(e?.output_token_details,t?.output_token_details)}}function a$(e){return typeof e=="string"?e.length>0?[{type:"text",text:e}]:[]:Array.isArray(e)?e:e==null?[]:[e]}var Ne=class extends Pe{type="ai";tool_calls=[];invalid_tool_calls=[];usage_metadata;get lc_aliases(){return{...super.lc_aliases,tool_calls:"tool_calls",invalid_tool_calls:"invalid_tool_calls",usage_metadata:"usage_metadata"}}constructor(e){let t;if(typeof e=="string"||Array.isArray(e))t={content:e,tool_calls:[],invalid_tool_calls:[],additional_kwargs:{}};else{t=e;let r=t.additional_kwargs?.tool_calls,n=t.tool_calls;r!=null&&r.length>0&&(n===void 0||n.length===0)&&console.warn(["New LangChain packages are available that more efficiently handle",`tool calling.
17
+
18
+ Please upgrade your packages to versions that set`,"message tool calls. e.g., `pnpm install @langchain/anthropic`,","pnpm install @langchain/openai`, etc."].join(" "));try{if(r!=null&&n===void 0){let[i,a]=qc(r);t.tool_calls=i??[],t.invalid_tool_calls=a??[]}else t.tool_calls=t.tool_calls??[],t.invalid_tool_calls=t.invalid_tool_calls??[]}catch{t.tool_calls=[],t.invalid_tool_calls=[]}if(t.response_metadata!==void 0&&"output_version"in t.response_metadata&&t.response_metadata.output_version==="v1"&&t.content!==void 0&&(t.contentBlocks=a$(t.content),t.content=void 0),t.contentBlocks!==void 0){if(Array.isArray(t.contentBlocks)||(t.contentBlocks=a$(t.contentBlocks)),t.tool_calls){let a=t.tool_calls.filter(o=>!t.contentBlocks?.some(s=>s.type==="tool_call"&&s.id===o.id&&s.name===o.name));t.contentBlocks.push(...a.map(o=>({type:"tool_call",id:o.id,name:o.name,args:o.args})))}let i=t.contentBlocks.filter(a=>a.type==="tool_call").filter(a=>!t.tool_calls?.some(o=>o.id===a.id&&o.name===a.name));i.length>0&&(t.tool_calls=[...t.tool_calls??[],...i.map(a=>({type:"tool_call",id:a.id,name:a.name,args:a.args}))])}}super(t),typeof t!="string"&&(this.tool_calls=t.tool_calls??this.tool_calls,this.invalid_tool_calls=t.invalid_tool_calls??this.invalid_tool_calls),this.usage_metadata=t.usage_metadata}static lc_name(){return"AIMessage"}get contentBlocks(){if(this.response_metadata&&"output_version"in this.response_metadata&&this.response_metadata.output_version==="v1")return this.content;if(this.response_metadata&&"model_provider"in this.response_metadata&&typeof this.response_metadata.model_provider=="string"){let t=mg(this.response_metadata.model_provider);if(t)return t.translateContent(this)}let e=super.contentBlocks;if(this.tool_calls){let t=this.tool_calls.filter(r=>!e.some(n=>n.id===r.id&&n.name===r.name));e.push(...t.map(r=>({type:"tool_call",id:r.id,name:r.name,args:r.args})))}return e}get _printableFields(){return{...super._printableFields,tool_calls:this.tool_calls,invalid_tool_calls:this.invalid_tool_calls,usage_metadata:this.usage_metadata}}static isInstance(e){return super.isInstance(e)&&e.type==="ai"}static[Symbol.hasInstance](e){return this.isInstance(e)}};function fs(e){return e._getType()==="ai"}function Xc(e){return e._getType()==="ai"}var it=class extends Pt{type="ai";tool_calls=[];invalid_tool_calls=[];tool_call_chunks=[];usage_metadata;constructor(e){let t;if(typeof e=="string"||Array.isArray(e))t={content:e,tool_calls:[],invalid_tool_calls:[],tool_call_chunks:[]};else if(e.tool_call_chunks===void 0||e.tool_call_chunks.length===0)t={...e,tool_calls:e.tool_calls??[],invalid_tool_calls:[],tool_call_chunks:[],usage_metadata:e.usage_metadata!==void 0?e.usage_metadata:void 0};else{let r=Td(e.tool_call_chunks??[]);t={...e,tool_call_chunks:r.tool_call_chunks,tool_calls:r.tool_calls,invalid_tool_calls:r.invalid_tool_calls,usage_metadata:e.usage_metadata!==void 0?e.usage_metadata:void 0}}super(t),this.tool_call_chunks=t.tool_call_chunks??this.tool_call_chunks,this.tool_calls=t.tool_calls??this.tool_calls,this.invalid_tool_calls=t.invalid_tool_calls??this.invalid_tool_calls,this.usage_metadata=t.usage_metadata}get lc_aliases(){return{...super.lc_aliases,tool_calls:"tool_calls",invalid_tool_calls:"invalid_tool_calls",tool_call_chunks:"tool_call_chunks",usage_metadata:"usage_metadata"}}static lc_name(){return"AIMessageChunk"}get contentBlocks(){if(this.response_metadata&&"output_version"in this.response_metadata&&this.response_metadata.output_version==="v1")return this.content;if(this.response_metadata&&"model_provider"in this.response_metadata&&typeof this.response_metadata.model_provider=="string"){let t=mg(this.response_metadata.model_provider);if(t)return t.translateContent(this)}let e=super.contentBlocks;if(this.tool_calls&&typeof this.content!="string"){let t=this.content.filter(r=>r.type==="tool_call").map(r=>r.id);for(let r of this.tool_calls)r.id&&!t.includes(r.id)&&e.push({...r,type:"tool_call",id:r.id,name:r.name,args:r.args})}return e}get _printableFields(){return{...super._printableFields,tool_calls:this.tool_calls,tool_call_chunks:this.tool_call_chunks,invalid_tool_calls:this.invalid_tool_calls,usage_metadata:this.usage_metadata}}concat(e){let t={content:Zt(this.content,e.content),additional_kwargs:tt(this.additional_kwargs,e.additional_kwargs),response_metadata:Id(this.response_metadata,e.response_metadata),tool_call_chunks:[],tool_calls:[],id:this.id??e.id};if(this.tool_call_chunks!==void 0||e.tool_call_chunks!==void 0){let n=ta(this.tool_call_chunks,e.tool_call_chunks);n!==void 0&&n.length>0&&(t.tool_call_chunks=n)}if(this.tool_calls!==void 0||e.tool_calls!==void 0){let n=ta(this.tool_calls,e.tool_calls);n!==void 0&&n.length>0&&(t.tool_calls=n)}(this.usage_metadata!==void 0||e.usage_metadata!==void 0)&&(t.usage_metadata=ds(this.usage_metadata,e.usage_metadata));let r=this.constructor;return new r(t)}static isInstance(e){return super.isInstance(e)&&e.type==="ai"}static[Symbol.hasInstance](e){return this.isInstance(e)}};var fn=class o$ extends Pe{static lc_name(){return"ChatMessage"}type="generic";role;static _chatMessageClass(){return o$}constructor(t,r){(typeof t=="string"||Array.isArray(t))&&(t={content:t,role:r}),super(t),this.role=t.role}static isInstance(t){return super.isInstance(t)&&t.type==="generic"}static[Symbol.hasInstance](t){return this.isInstance(t)}get _printableFields(){return{...super._printableFields,role:this.role}}},Qa=class extends Pt{static lc_name(){return"ChatMessageChunk"}type="generic";role;constructor(e,t){(typeof e=="string"||Array.isArray(e))&&(e={content:e,role:t}),super(e),this.role=e.role}concat(e){let t=this.constructor;return new t({content:Zt(this.content,e.content),additional_kwargs:tt(this.additional_kwargs,e.additional_kwargs),response_metadata:tt(this.response_metadata,e.response_metadata),role:this.role,id:this.id??e.id})}static isInstance(e){return super.isInstance(e)&&e.type==="generic"}static[Symbol.hasInstance](e){return this.isInstance(e)}get _printableFields(){return{...super._printableFields,role:this.role}}};function s$(e){return e._getType()==="generic"}function c$(e){return e._getType()==="generic"}var eo=class extends Pe{static lc_name(){return"FunctionMessage"}type="function";name;constructor(e){super(e),this.name=e.name}static isInstance(e){return super.isInstance(e)&&e.type==="function"}static[Symbol.hasInstance](e){return this.isInstance(e)}},to=class extends Pt{static lc_name(){return"FunctionMessageChunk"}type="function";concat(e){let t=this.constructor;return new t({content:Zt(this.content,e.content),additional_kwargs:tt(this.additional_kwargs,e.additional_kwargs),response_metadata:tt(this.response_metadata,e.response_metadata),name:this.name??"",id:this.id??e.id})}static isInstance(e){return super.isInstance(e)&&e.type==="function"}static[Symbol.hasInstance](e){return this.isInstance(e)}};function l$(e){return e._getType()==="function"}function u$(e){return e._getType()==="function"}var ot=class extends Pe{static lc_name(){return"HumanMessage"}type="human";constructor(e){super(e)}static isInstance(e){return super.isInstance(e)&&e.type==="human"}static[Symbol.hasInstance](e){return this.isInstance(e)}},ro=class extends Pt{static lc_name(){return"HumanMessageChunk"}type="human";constructor(e){super(e)}concat(e){let t=this.constructor;return new t({content:Zt(this.content,e.content),additional_kwargs:tt(this.additional_kwargs,e.additional_kwargs),response_metadata:tt(this.response_metadata,e.response_metadata),id:this.id??e.id})}static isInstance(e){return super.isInstance(e)&&e.type==="human"}static[Symbol.hasInstance](e){return this.isInstance(e)}};function d$(e){return e.getType()==="human"}function f$(e){return e.getType()==="human"}var Nr=class extends Pe{type="remove";id;constructor(e){super({...e,content:[]}),this.id=e.id}get _printableFields(){return{...super._printableFields,id:this.id}}static isInstance(e){return super.isInstance(e)&&e.type==="remove"}static[Symbol.hasInstance](e){return this.isInstance(e)}};var or=class Cd extends Pe{static lc_name(){return"SystemMessage"}type="system";constructor(t){super(t)}concat(t){if(typeof t=="string")return new Cd({content:Zt(this.content,t),additional_kwargs:this.additional_kwargs,response_metadata:this.response_metadata,id:this.id,name:this.name});if(Cd.isInstance(t))return new Cd({content:Zt(this.content,t.content),additional_kwargs:{...this.additional_kwargs,...t.additional_kwargs},response_metadata:{...this.response_metadata,...t.response_metadata},id:this.id??t.id,name:this.name??t.name});throw new Error("Unexpected chunk type for system message")}static isInstance(t){return super.isInstance(t)&&t.type==="system"}static[Symbol.hasInstance](t){return this.isInstance(t)}},hi=class extends Pt{static lc_name(){return"SystemMessageChunk"}type="system";constructor(e){super(e)}concat(e){let t=this.constructor;return new t({content:Zt(this.content,e.content),additional_kwargs:tt(this.additional_kwargs,e.additional_kwargs),response_metadata:tt(this.response_metadata,e.response_metadata),id:this.id??e.id})}static isInstance(e){return super.isInstance(e)&&e.type==="system"}static[Symbol.hasInstance](e){return this.isInstance(e)}};function p$(e){return e._getType()==="system"}function m$(e){return e._getType()==="system"}function lD(e){return e.isCustomTool===!0}var h$=e=>e();function uD(e){return ra(e)?e:typeof e.id=="string"&&e.type==="function"&&typeof e.function=="object"&&e.function!==null&&"arguments"in e.function&&typeof e.function.arguments=="string"&&"name"in e.function&&typeof e.function.name=="string"?{id:e.id,args:JSON.parse(e.function.arguments),name:e.function.name,type:"tool_call"}:e}function dD(e){return typeof e=="object"&&e!=null&&e.lc===1&&Array.isArray(e.id)&&e.kwargs!=null&&typeof e.kwargs=="object"}function hg(e){let t,r;if(dD(e)){let n=e.id.at(-1);n==="HumanMessage"||n==="HumanMessageChunk"?t="user":n==="AIMessage"||n==="AIMessageChunk"?t="assistant":n==="SystemMessage"||n==="SystemMessageChunk"?t="system":n==="FunctionMessage"||n==="FunctionMessageChunk"?t="function":n==="ToolMessage"||n==="ToolMessageChunk"?t="tool":t="unknown",r=e.kwargs}else{let{type:n,...i}=e;t=n,r=i}if(t==="human"||t==="user")return new ot(r);if(t==="ai"||t==="assistant"){let{tool_calls:n,...i}=r;if(!Array.isArray(n))return new Ne(r);let a=n.map(uD);return new Ne({...i,tool_calls:a})}else{if(t==="system")return new or(r);if(t==="developer")return new or({...r,additional_kwargs:{...r.additional_kwargs,__openai_role__:"developer"}});if(t==="tool"&&"tool_call_id"in r)return new kt({...r,content:r.content,tool_call_id:r.tool_call_id,name:r.name});if(t==="remove"&&"id"in r&&typeof r.id=="string")return new Nr({...r,id:r.id});throw fi(new Error(`Unable to coerce message from array: only human, AI, system, developer, or tool message coercion is currently supported.
19
+
20
+ Received: ${JSON.stringify(e,null,2)}`),"MESSAGE_COERCION_FAILURE")}}function Et(e){if(typeof e=="string")return new ot(e);if(rt(e))return e;if(Array.isArray(e)){let[t,r]=e;return hg({type:t,content:r})}else if($d(e)){let{role:t,...r}=e;return hg({...r,type:t})}else return hg(e)}function fD(e){if(typeof e=="string")return e;switch(e.type){case"text":return e.text??"";case"text-plain":return e.text??"[text-plain file]";case"image":case"image_url":return"[image]";case"audio":case"input_audio":return"[audio]";case"video":return"[video]";case"file":return"[file]";case"reasoning":case"tool_call":case"tool_call_chunk":case"invalid_tool_call":case"server_tool_call":case"server_tool_call_chunk":case"server_tool_call_result":case"non_standard":return"";default:return e.type?`[${e.type}]`:""}}function ps(e,t="Human",r="AI"){let n=[];for(let i of e){let a;if(i.type==="human")a=t;else if(i.type==="ai")a=r;else if(i.type==="system")a="System";else if(i.type==="tool")a="Tool";else if(i.type==="generic")a=i.role;else throw new Error(`Got unsupported message type: ${i.type}`);let o=i.name?`${i.name}, `:"",s=typeof i.content=="string"?i.content:Array.isArray(i.content)?i.content.map(fD).filter(Boolean).join(""):"",c=`${a}: ${o}${s}`;if(i.type==="ai"){let l=i;l.tool_calls&&l.tool_calls.length>0?c+=JSON.stringify(l.tool_calls):l.additional_kwargs&&"function_call"in l.additional_kwargs&&(c+=JSON.stringify(l.additional_kwargs.function_call))}n.push(c)}return n.join(`
21
+ `)}function pD(e){if(e.data!==void 0)return e;{let t=e;return{type:t.type,data:{content:t.text,role:t.role,name:void 0,tool_call_id:void 0}}}}function Qc(e){let t=pD(e);switch(t.type){case"human":return new ot(t.data);case"ai":return new Ne(t.data);case"system":return new or(t.data);case"function":if(t.data.name===void 0)throw new Error("Name must be defined for function messages");return new eo(t.data);case"tool":if(t.data.tool_call_id===void 0)throw new Error("Tool call ID must be defined for tool messages");return new kt(t.data);case"generic":if(t.data.role===void 0)throw new Error("Role must be defined for chat messages");return new fn(t.data);default:throw new Error(`Got unexpected type: ${t.type}`)}}function g$(e){return e.map(Qc)}function _$(e){return e.map(t=>t.toDict())}function no(e){let t=e._getType();if(t==="human")return new ro({...e});if(t==="ai"){let r={...e};return"tool_calls"in r&&(r={...r,tool_call_chunks:r.tool_calls?.map(n=>({...n,type:"tool_call_chunk",index:void 0,args:JSON.stringify(n.args)}))}),new it({...r})}else{if(t==="system")return new hi({...e});if(t==="function")return new to({...e});if(fn.isInstance(e))return new Qa({...e});throw new Error("Unknown message type.")}}function Td(e){let t=e.reduce((i,a)=>{let o=i.findIndex(([s])=>"id"in a&&a.id&&"index"in a&&a.index!==void 0?a.id===s.id&&a.index===s.index:"id"in a&&a.id?a.id===s.id:"index"in a&&a.index!==void 0?a.index===s.index:!1);return o!==-1?i[o].push(a):i.push([a]),i},[]),r=[],n=[];for(let i of t){let a=null,o=i.some(lD),s=i[0]?.name??"",c=i.map(f=>f.args||"").join(""),l=o?c:c.trim(),u=l.length?l:"{}",d=i.find(f=>f.id)?.id??i[0]?.id;if(o&&d){r.push({name:s,args:{input:l},id:d,type:"tool_call"});continue}try{if(a=dn(u),!d||a===null||typeof a!="object"||Array.isArray(a))throw new Error("Malformed tool call chunk args.");r.push({name:s,args:a,id:d,type:"tool_call"})}catch{n.push({name:s,args:u,id:d,error:"Malformed args.",type:"invalid_tool_call"})}}return{tool_call_chunks:e,tool_calls:r,invalid_tool_calls:n}}var y$=T({BaseCache:()=>b$,InMemoryCache:()=>gg,defaultHashKeyEncoder:()=>v$,deserializeStoredGeneration:()=>mD,serializeGeneration:()=>hD}),v$=(...e)=>os(e.join("_"));function mD(e){return e.message!==void 0?{text:e.text,message:Qc(e.message)}:{text:e.text}}function hD(e){let t={text:e.text};return e.message!==void 0&&(t.message=e.message.toDict()),t}var b$=class{keyEncoder=v$;makeDefaultKeyEncoder(e){this.keyEncoder=e}},gD=new Map,gg=class w$ extends b${cache;constructor(t){super(),this.cache=t??new Map}lookup(t,r){return Promise.resolve(this.cache.get(this.keyEncoder(t,r))??null)}async update(t,r,n){this.cache.set(this.keyEncoder(t,r),n)}static global(){return new w$(gD)}};var x$=T({BaseCallbackHandler:()=>sr,callbackHandlerPrefersChatModelStreamEvents:()=>_g,callbackHandlerPrefersStreaming:()=>el,isBaseCallbackHandler:()=>yg}),_D=class{};function el(e){return"lc_prefer_streaming"in e&&e.lc_prefer_streaming}function _g(e){return"lc_prefer_chat_model_stream_events"in e&&e.lc_prefer_chat_model_stream_events}var sr=class extends _D{lc_serializable=!1;get lc_namespace(){return["langchain_core","callbacks",this.name]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,as(this.constructor)]}lc_kwargs;ignoreLLM=!1;ignoreChain=!1;ignoreAgent=!1;ignoreRetriever=!1;ignoreCustomEvent=!1;raiseError=!1;awaitHandlers=xt("LANGCHAIN_CALLBACKS_BACKGROUND")==="false";constructor(e){super(),this.lc_kwargs=e||{},e&&(this.ignoreLLM=e.ignoreLLM??this.ignoreLLM,this.ignoreChain=e.ignoreChain??this.ignoreChain,this.ignoreAgent=e.ignoreAgent??this.ignoreAgent,this.ignoreRetriever=e.ignoreRetriever??this.ignoreRetriever,this.ignoreCustomEvent=e.ignoreCustomEvent??this.ignoreCustomEvent,this.raiseError=e.raiseError??this.raiseError,this.awaitHandlers=this.raiseError||(e._awaitHandler??this.awaitHandlers))}copy(){return new this.constructor(this)}toJSON(){return pt.prototype.toJSON.call(this)}toJSONNotImplemented(){return pt.prototype.toJSONNotImplemented.call(this)}static fromMethods(e){class t extends sr{name=Hr();constructor(){super(),Object.assign(this,e)}}return new t}},yg=e=>{let t=e;return t!==void 0&&typeof t.copy=="function"&&typeof t.name=="string"&&typeof t.awaitHandlers=="boolean"};var S$=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function yD(e){return typeof e=="string"&&S$.test(e)}var tl=yD;function vD(e){if(!tl(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,t&255,(t=parseInt(e.slice(9,13),16))>>>8,t&255,(t=parseInt(e.slice(14,18),16))>>>8,t&255,(t=parseInt(e.slice(19,23),16))>>>8,t&255,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255)}var Ad=vD;var Dt=[];for(let e=0;e<256;++e)Dt.push((e+256).toString(16).slice(1));function ms(e,t=0){return(Dt[e[t+0]]+Dt[e[t+1]]+Dt[e[t+2]]+Dt[e[t+3]]+"-"+Dt[e[t+4]]+Dt[e[t+5]]+"-"+Dt[e[t+6]]+Dt[e[t+7]]+"-"+Dt[e[t+8]]+Dt[e[t+9]]+"-"+Dt[e[t+10]]+Dt[e[t+11]]+Dt[e[t+12]]+Dt[e[t+13]]+Dt[e[t+14]]+Dt[e[t+15]]).toLowerCase()}var bD=new Uint8Array(16);function hs(){return crypto.getRandomValues(bD)}function wD(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():xD(e,t,r)}function xD(e,t,r){e=e||{};let n=e.random??e.rng?.()??hs();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)t[r+i]=n[i];return t}return ms(n)}var io=wD;function SD(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:return t^r^n;case 2:return t&r^t&n^r&n;case 3:return t^r^n}}function vg(e,t){return e<<t|e>>>32-t}function kD(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(e.length+1);n.set(e),n[e.length]=128,e=n;let i=e.length/4+2,a=Math.ceil(i/16),o=new Array(a);for(let s=0;s<a;++s){let c=new Uint32Array(16);for(let l=0;l<16;++l)c[l]=e[s*64+l*4]<<24|e[s*64+l*4+1]<<16|e[s*64+l*4+2]<<8|e[s*64+l*4+3];o[s]=c}o[a-1][14]=(e.length-1)*8/2**32,o[a-1][14]=Math.floor(o[a-1][14]),o[a-1][15]=(e.length-1)*8&4294967295;for(let s=0;s<a;++s){let c=new Uint32Array(80);for(let m=0;m<16;++m)c[m]=o[s][m];for(let m=16;m<80;++m)c[m]=vg(c[m-3]^c[m-8]^c[m-14]^c[m-16],1);let l=r[0],u=r[1],d=r[2],f=r[3],p=r[4];for(let m=0;m<80;++m){let h=Math.floor(m/20),_=vg(l,5)+SD(h,u,d,f)+p+t[h]+c[m]>>>0;p=f,f=d,d=vg(u,30)>>>0,u=l,l=_}r[0]=r[0]+l>>>0,r[1]=r[1]+u>>>0,r[2]=r[2]+d>>>0,r[3]=r[3]+f>>>0,r[4]=r[4]+p>>>0}return Uint8Array.of(r[0]>>24,r[0]>>16,r[0]>>8,r[0],r[1]>>24,r[1]>>16,r[1]>>8,r[1],r[2]>>24,r[2]>>16,r[2]>>8,r[2],r[3]>>24,r[3]>>16,r[3]>>8,r[3],r[4]>>24,r[4]>>16,r[4]>>8,r[4])}var k$=kD;function ED(e){e=unescape(encodeURIComponent(e));let t=new Uint8Array(e.length);for(let r=0;r<e.length;++r)t[r]=e.charCodeAt(r);return t}var bg="6ba7b810-9dad-11d1-80b4-00c04fd430c8",wg="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function xg(e,t,r,n,i,a){let o=typeof r=="string"?ED(r):r,s=typeof n=="string"?Ad(n):n;if(typeof n=="string"&&(n=Ad(n)),n?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+o.length);if(c.set(s),c.set(o,s.length),c=t(c),c[6]=c[6]&15|e,c[8]=c[8]&63|128,i){if(a??=0,a<0||a+16>i.length)throw new RangeError(`UUID byte range ${a}:${a+15} is out of buffer bounds`);for(let l=0;l<16;++l)i[a+l]=c[l];return i}return ms(c)}function Sg(e,t,r,n){return xg(80,k$,e,t,r,n)}Sg.DNS=bg;Sg.URL=wg;var kg=Sg;var Eg={};function $D(e,t,r){let n;if(e)n=E$(e.random??e.rng?.()??hs(),e.msecs,e.seq,t,r);else{let i=Date.now(),a=hs();ID(Eg,i,a),n=E$(a,Eg.msecs,Eg.seq,t,r)}return t??ms(n)}function ID(e,t,r){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=r[6]<<23|r[7]<<16|r[8]<<8|r[9],e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}function E$(e,t,r,n,i=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(!n)n=new Uint8Array(16),i=0;else if(i<0||i+16>n.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return t??=Date.now(),r??=e[6]*127<<24|e[7]<<16|e[8]<<8|e[9],n[i++]=t/1099511627776&255,n[i++]=t/4294967296&255,n[i++]=t/16777216&255,n[i++]=t/65536&255,n[i++]=t/256&255,n[i++]=t&255,n[i++]=112|r>>>28&15,n[i++]=r>>>20&255,n[i++]=128|r>>>14&63,n[i++]=r>>>6&255,n[i++]=r<<2&255|e[10]&3,n[i++]=e[11],n[i++]=e[12],n[i++]=e[13],n[i++]=e[14],n[i++]=e[15],n}var gs=$D;var $$="gen_ai.operation.name",I$="gen_ai.system",$g="gen_ai.request.model",T$="gen_ai.response.model",Ig="gen_ai.usage.input_tokens",Tg="gen_ai.usage.output_tokens",Cg="gen_ai.usage.total_tokens",C$="gen_ai.request.max_tokens",A$="gen_ai.request.temperature",O$="gen_ai.request.top_p",P$="gen_ai.request.frequency_penalty",N$="gen_ai.request.presence_penalty",R$="gen_ai.response.finish_reasons",M$="gen_ai.prompt",j$="gen_ai.completion",D$="gen_ai.request.extra_query",z$="gen_ai.request.extra_body",U$="gen_ai.serialized.name",L$="gen_ai.serialized.signature",F$="gen_ai.serialized.doc",B$="gen_ai.response.id",V$="gen_ai.response.service_tier",Z$="gen_ai.response.system_fingerprint",H$="gen_ai.usage.input_token_details",G$="gen_ai.usage.output_token_details",W$="langsmith.trace.session_id",J$="langsmith.trace.session_name",K$="langsmith.span.kind",q$="langsmith.trace.name",Y$="langsmith.metadata",Ag="langsmith.span.tags";var X$="langsmith.request.streaming",Q$="langsmith.request.headers";var Og="langsmith.usage_metadata";var AD=(...e)=>fetch(...e),OD,eI=Symbol.for("ls:fetch_implementation");var tI=()=>globalThis[eI]===void 0?!0:OD??!1,rI=e=>async(...t)=>{if(e||Ke("DEBUG")==="true"){let[n,i]=t;console.log(`\u2192 ${i?.method||"GET"} ${n}`)}let r=await(globalThis[eI]??AD)(...t);return(e||Ke("DEBUG")==="true")&&console.log(`\u2190 ${r.status} ${r.statusText} ${r.url}`),r};var rl=()=>Ke("PROJECT")??Nt("LANGCHAIN_SESSION")??"default";var nI={};function ao(e){nI[e]||(console.warn(e),nI[e]=!0)}var N=e=>BigInt(e),sI=N("0x9E3779B1"),cI=N("0x85EBCA77"),PD=N("0xC2B2AE3D"),na=N("0x9E3779B185EBCA87"),oo=N("0xC2B2AE3D27D4EB4F"),lI=N("0x165667B19E3779F9"),Mg=N("0x85EBCA77C2B2AE63"),ND=N("0x27D4EB2F165667C5"),RD=N("0x165667919E3779F9"),MD=N("0x9FB21C651E98DF25");function jD(e){let t=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2)t[r/2]=parseInt(e.substring(r,r+2),16);return t}var zn=jD("b8fe6c3923a44bbe7c01812cf721ad1cded46de9839097db7240a4a4b7b3671fcb79e64eccc0e578825ad07dccff7221b8084674f743248ee03590e6813a264c3c2852bb91c300cb88d0658b1b532ea371644897a20df94e3819ef46a9deacd8a8fa763fe39c343ff9dcbbc7c70b4f1d8a51e04bcdb45931c89f7ec9d9787364eac5ac8334d3ebc3c581a0fffa1363eb170ddd51b7f0da49d316552629d4689e2b16be587d47a1fc8ff8b8d17ad031ce45cb3a8f95160428afd7fbcabb4b407e"),ys=(N(1)<<N(128))-N(1),be=(N(1)<<N(64))-N(1),Rd=(N(1)<<N(32))-N(1),gi=64,uI=gi/8,DD=8,Od=4;function He(e,t=0){return new Uint8Array(e.buffer,e.byteOffset+t,e.length-t)}function qe(e,t=0){return new DataView(e.buffer,e.byteOffset+t).getBigUint64(0,!0)}function _s(e,t=0){return new DataView(e.buffer,e.byteOffset+t).getUint32(0,!0)}function Pg(e,t=0){return e[t]}var zD=e=>(e&N(255))<<N(56)|(e&N(65280))<<N(40)|(e&N(16711680))<<N(24)|(e&N(4278190080))<<N(8)|(e&N(0xff00000000))>>N(8)|(e&N(0xff0000000000))>>N(24)|(e&N(0xff000000000000))>>N(40)|(e&N(0xff00000000000000))>>N(56),UD=e=>(e=(e&N(65535))<<N(16)|(e&N(4294901760))>>N(16),e=(e&N(16711935))<<N(8)|(e&N(4278255360))>>N(8),e),LD=(e,t)=>(e&Rd)*(t&Rd)&be,vs=e=>{if(!e)throw new Error("Assert failed")};function FD(e,t){return(e<<t|e>>N(32)-t)&Rd}function dI(e,t,r){for(let n=0;n<uI;n++){let i=qe(t,n*8),a=i^qe(r,n*8);e[n^1]+=i,e[n]+=LD(a,a>>N(32))}return e}function iI(e,t,r,n){for(let i=0;i<n;i++)dI(e,He(t,i*gi),He(r,i*8));return e}function BD(e,t){for(let r=0;r<uI;r++){let n=qe(t,r*8),i=e[r];i=Ng(i,N(47)),i^=n,i*=sI,e[r]=i&be}return e}function Pd(e,t){return fI(e[0]^qe(t,0),e[1]^qe(t,DD))}function aI(e,t,r){let n=r;return n+=Pd(e.slice(0),He(t,0*Od)),n+=Pd(e.slice(2),He(t,4*Od)),n+=Pd(e.slice(4),He(t,8*Od)),n+=Pd(e.slice(6),He(t,12*Od)),Un(n&be)}function VD(e,t,r,n,i){let a=Math.floor((r.byteLength-gi)/8),o=gi*a,s=Math.floor((t.byteLength-1)/o);for(let c=0;c<s;c++)e=iI(e,He(t,c*o),r,a),e=i(e,He(r,r.byteLength-gi));{let c=Math.floor((t.byteLength-1-o*s)/gi);e=iI(e,He(t,s*o),r,c),e=n(e,He(t,t.byteLength-gi),He(r,r.byteLength-gi-7))}return e}function ZD(e,t,r){let n=new BigUint64Array([PD,na,oo,lI,Mg,cI,ND,sI]);vs(e.length>128),n=VD(n,e,t,dI,BD),vs(n.length*8==64);{let i=aI(n,He(t,11),N(e.byteLength)*na&be);return aI(n,He(t,t.byteLength-gi-11),~(N(e.byteLength)*oo)&be)<<N(64)|i}}function fI(e,t){let r=e*t&ys;return r&be^r>>N(64)}function oI(e,t,r){return fI((qe(e,0)^qe(t,0)+r)&be,(qe(e,8)^qe(t,8)-r)&be)}function Nd(e,t,r,n,i){let a=e&be,o=e>>N(64)&be;return a+=oI(t,n,i),a^=qe(r,0)+qe(r,8),a&=be,o+=oI(r,He(n,16),i),o^=qe(t,0)+qe(t,8),o&=be,o<<N(64)|a}function Un(e){return e^=e>>N(37),e*=RD,e&=be,e^=e>>N(32),e}function Md(e){return e^=e>>N(33),e*=oo,e&=be,e^=e>>N(29),e*=lI,e&=be,e^=e>>N(32),e}function HD(e,t,r){let n=e.byteLength;vs(n>0&&n<=3);let i=N(Pg(e,n-1))|N(n<<8)|N(Pg(e,0)<<16)|N(Pg(e,n>>1)<<24),a=(N(_s(t,0))^N(_s(t,4)))+r,o=(i^a)&be,s=(N(_s(t,8))^N(_s(t,12)))-r,c=(FD(UD(i),N(13))^s)&be;return(Md(c)&be)<<N(64)|Md(o)}function Ng(e,t){return e^e>>t}function GD(e,t,r){let n=e.byteLength;vs(n>=4&&n<=8);{let i=_s(e,0),a=_s(e,n-4),o=N(i)|N(a)<<N(32),s=(qe(t,16)^qe(t,24))+r&be,l=(o^s)*(na+(N(n)<<N(2)))&ys;return l+=(l&be)<<N(65),l&=ys,l^=l>>N(67),Ng(Ng(l&be,N(35))*MD&be,N(28))|Un(l>>N(64))<<N(64)}}function WD(e,t,r){let n=e.byteLength;vs(n>=9&&n<=16);{let i=(qe(t,32)^qe(t,40))+r&be,a=(qe(t,48)^qe(t,56))-r&be,o=qe(e),s=qe(e,n-8),c=(o^s^i)*na,l=(c&be)+(N(n-1)<<N(54));c=c&(ys^be)|l,s^=a,c+=s+(s&Rd)*(cI-N(1))<<N(64),c&=ys,c^=zD(c>>N(64));let u=(c&be)*oo;return u+=(c>>N(64))*oo<<N(64),u&=ys,Un(u&be)|Un(u>>N(64))<<N(64)}}function JD(e,t){let r=e.byteLength;return vs(r<=16),r>8?WD(e,zn,t):r>=4?GD(e,zn,t):r>0?HD(e,zn,t):Md(t^qe(zn,64)^qe(zn,72))|Md(t^qe(zn,80)^qe(zn,88))<<N(64)}function Rg(e){return~e+N(1)&be}function KD(e,t,r){let n=N(e.byteLength)*na&be,i=N(e.byteLength-1)/N(32);for(;i>=0;){let s=Number(i);n=Nd(n,He(e,16*s),He(e,e.byteLength-16*(s+1)),He(t,32*s),r),i--}let a=n+(n>>N(64))&be;a=Un(a);let o=(n&be)*na+(n>>N(64))*Mg+(N(e.byteLength)-r&be)*oo;return o&=be,o=Rg(Un(o)),a|o<<N(64)}function qD(e,t,r){let n=N(e.byteLength)*na&be;for(let o=32;o<160;o+=32)n=Nd(n,He(e,o-32),He(e,o-16),He(t,o-32),r);n=Un(n&be)|Un(n>>N(64))<<N(64);for(let o=160;o<=e.byteLength;o+=32)n=Nd(n,He(e,o-32),He(e,o-16),He(t,3+o-160),r);n=Nd(n,He(e,e.byteLength-16),He(e,e.byteLength-32),He(t,103),Rg(r));let i=n+(n>>N(64))&be;i=Un(i);let a=(n&be)*na+(n>>N(64))*Mg+(N(e.byteLength)-r&be)*oo;return a&=be,a=Rg(Un(a)),i|a<<N(64)}function pI(e,t=N(0)){let r=e.byteLength;return r<=16?JD(e,t):r<=128?KD(e,zn,t):r<=240?qD(e,zn,t):ZD(e,zn,t)}function mI(e){let t=new Uint8Array(16),r=new DataView(t.buffer),n=e&be,i=e>>N(64);return r.setBigUint64(0,i,!1),r.setBigUint64(8,n,!1),t}var hI=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function he(e,t){if(!hI.test(e)){let r=t!==void 0?`Invalid UUID for ${t}: ${e}`:`Invalid UUID: ${e}`;throw new Error(r)}return e}function jd(e){let t=typeof e=="string"?Date.parse(e):e;return gs({msecs:t,seq:0})}function YD(e){if(!hI.test(e))return null;let t=e[14];return parseInt(t,16)}function XD(e){let t=e.replace(/-/g,""),r=new Uint8Array(16);for(let n=0;n<16;n++)r[n]=parseInt(t.slice(n*2,n*2+2),16);return r}function QD(e){let t=Array.from(e).map(r=>r.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}var e4=new TextEncoder;function t4(e){let t=e4.encode(e),r=pI(t);return mI(r)}function nl(e,t){let r=`${e}:${t}`,n=t4(r),i=new Uint8Array(16);if(YD(e)===7){let o=XD(e);i.set(o.slice(0,6),0)}else{let o=Date.now();i[0]=o/1099511627776&255,i[1]=o/4294967296&255,i[2]=o/16777216&255,i[3]=o/65536&255,i[4]=o/256&255,i[5]=o&255}return i[6]=112|n[0]&15,i[7]=n[1],i[8]=128|n[2]&63,i.set(n.slice(3,10),9),QD(i)}var so={join:(...e)=>e.join("/"),dirname:e=>e.split("/").slice(0,-1).join("/")};async function gI(e){}async function Dd(e,t){}async function _I(e){return[]}async function yI(e){return{size:0}}function bs(e){return!1}function zd(e){return""}function r4(e,t){return t===null?!1:Date.now()-e.createdAt>t*1e3}var Ud=class{constructor(t={}){Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ttlSeconds",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"refreshIntervalSeconds",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"refreshTimer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_metrics",{enumerable:!0,configurable:!0,writable:!0,value:{hits:0,misses:0,refreshes:0,refreshErrors:0}}),this.configure(t)}get metrics(){return{...this._metrics}}get totalRequests(){return this._metrics.hits+this._metrics.misses}get hitRate(){let t=this.totalRequests;return t>0?this._metrics.hits/t:0}resetMetrics(){this._metrics={hits:0,misses:0,refreshes:0,refreshErrors:0}}get(t,r){if(this.maxSize===0)return;let n=this.cache.get(t);if(!n){this._metrics.misses+=1;return}return this.cache.delete(t),this.cache.set(t,{...n,refreshFunc:r}),this._metrics.hits+=1,n.value}set(t,r,n){if(this.maxSize===0)return;if(this.refreshTimer===void 0&&this.startRefreshLoop(),!this.cache.has(t)&&this.cache.size>=this.maxSize){let a=this.cache.keys().next().value;a!==void 0&&this.cache.delete(a)}let i={value:r,createdAt:Date.now(),refreshFunc:n};this.cache.delete(t),this.cache.set(t,i)}invalidate(t){this.cache.delete(t)}clear(){this.cache.clear()}get size(){return this.cache.size}stop(){this.refreshTimer&&(clearInterval(this.refreshTimer),this.refreshTimer=void 0)}dump(t){let r={};for(let[a,o]of this.cache.entries())r[a]=o.value;let n=so.dirname(t);bs(n)||void 0;let i=`${t}.tmp`;try{JSON.stringify({entries:r},null,2)}catch(a){throw bs(i)&&void 0,a}}load(t){if(!bs(t))return 0;let r;try{let a=zd(t);r=JSON.parse(a).entries??null}catch{return 0}if(!r)return 0;let n=0,i=Date.now();for(let[a,o]of Object.entries(r)){if(this.cache.size>=this.maxSize)break;let s={value:o,createdAt:i};this.cache.set(a,s),n+=1}return n}startRefreshLoop(){this.stop(),this.ttlSeconds!==null&&(this.refreshTimer=setInterval(()=>{this.refreshStaleEntries().catch(t=>{console.warn("Unexpected error in cache refresh loop:",t)})},this.refreshIntervalSeconds*1e3),this.refreshTimer.unref&&this.refreshTimer.unref())}getStaleEntries(){let t=[];for(let[r,n]of this.cache.entries())r4(n,this.ttlSeconds)&&t.push([r,n]);return t}async refreshStaleEntries(){let t=this.getStaleEntries();if(t.length!==0){for(let[r,n]of t)if(n.refreshFunc!==void 0)try{let i=await n.refreshFunc();this.set(r,i,n.refreshFunc),this._metrics.refreshes+=1}catch(i){this._metrics.refreshErrors+=1,console.warn(`Failed to refresh cache entry ${r}:`,i)}}}configure(t){this.stop(),this.refreshIntervalSeconds=t.refreshIntervalSeconds??60,this.maxSize=t.maxSize??100,this.ttlSeconds=t.ttlSeconds??300}},Ld=new Ud;var Fd="0.6.3";var Fn,n4=()=>typeof window<"u"&&typeof window.document<"u",i4=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",a4=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),xI=()=>typeof Deno<"u",o4=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!xI(),il=()=>Fn||(typeof Bun<"u"?Fn="bun":n4()?Fn="browser":o4()?Fn="node":i4()?Fn="webworker":a4()?Fn="jsdom":xI()?Fn="deno":Fn="other",Fn),jg;function Bd(){if(jg===void 0){let e=il(),t=c4();jg={library:"langsmith",runtime:e,sdk:"langsmith-js",sdk_version:Fd,...t}}return jg}function zg(){let e=s4(),t={},r=["LANGCHAIN_API_KEY","LANGCHAIN_ENDPOINT","LANGCHAIN_TRACING_V2","LANGCHAIN_PROJECT","LANGCHAIN_SESSION","LANGSMITH_API_KEY","LANGSMITH_ENDPOINT","LANGSMITH_TRACING_V2","LANGSMITH_CONFIG_FILE","LANGSMITH_PROJECT","LANGSMITH_SESSION"];for(let[n,i]of Object.entries(e))typeof i=="string"&&!r.includes(n)&&!n.toLowerCase().includes("key")&&!n.toLowerCase().includes("secret")&&!n.toLowerCase().includes("token")&&(n==="LANGCHAIN_REVISION_ID"?t.revision_id=i:t[n]=i);return t}function s4(){let e={};try{if(typeof process<"u"&&process.env)for(let[t,r]of Object.entries(process.env))(t.startsWith("LANGCHAIN_")||t.startsWith("LANGSMITH_"))&&r!=null&&((t.toLowerCase().includes("key")||t.toLowerCase().includes("secret")||t.toLowerCase().includes("token"))&&typeof r=="string"?e[t]=r.slice(0,2)+"*".repeat(r.length-4)+r.slice(-2):e[t]=r)}catch{}return e}function Nt(e){try{return typeof process<"u"?process.env?.[e]:void 0}catch{return}}function Ke(e){return Nt(`LANGSMITH_${e}`)||Nt(`LANGCHAIN_${e}`)}var Dg;function c4(){if(Dg!==void 0)return Dg;let e=["VERCEL_GIT_COMMIT_SHA","NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA","COMMIT_REF","RENDER_GIT_COMMIT","CI_COMMIT_SHA","CIRCLE_SHA1","CF_PAGES_COMMIT_SHA","REACT_APP_GIT_SHA","SOURCE_VERSION","GITHUB_SHA","TRAVIS_COMMIT","GIT_COMMIT","BUILD_VCS_NUMBER","bamboo_planRepository_revision","Build.SourceVersion","BITBUCKET_COMMIT","DRONE_COMMIT_SHA","SEMAPHORE_GIT_SHA","BUILDKITE_COMMIT"],t={};for(let r of e){let n=Nt(r);n!==void 0&&(t[r]=n)}return Dg=t,t}function bI(){return Nt("OTEL_ENABLED")==="true"||Ke("OTEL_ENABLED")==="true"}var wI=new Set(["langsmith","otel"]);function Vd(e){if(e!==void 0)return e;let t=Ke("TRACING_MODE");if(t!==void 0&&t!==""){let r=t.toLowerCase();if(!wI.has(r))throw new Error(`Invalid LANGSMITH_TRACING_MODE=${JSON.stringify(t)}. Must be one of: ${[...wI].sort().join(", ")}`);return bI()&&console.warn("Both LANGSMITH_TRACING_MODE and the legacy OTEL_ENABLED / LANGSMITH_OTEL_ENABLED env vars are set. LANGSMITH_TRACING_MODE takes precedence."),r}return bI()?"otel":"langsmith"}var Fg=class{constructor(){Object.defineProperty(this,"hasWarned",{enumerable:!0,configurable:!0,writable:!0,value:!1})}startActiveSpan(t,...r){!this.hasWarned&&Vd()==="otel"&&(console.warn('OTel tracing mode is active (via LANGSMITH_TRACING_MODE, OTEL_ENABLED, or LANGSMITH_OTEL_ENABLED), but the required OTEL instances have not been initialized. Please add:\n```\nimport { initializeOTEL } from "langsmith/experimental/otel/setup";\ninitializeOTEL();\n```\nat the beginning of your code.'),this.hasWarned=!0);let n;if(r.length===1&&typeof r[0]=="function"?n=r[0]:r.length===2&&typeof r[1]=="function"?n=r[1]:r.length===3&&typeof r[2]=="function"&&(n=r[2]),typeof n=="function")return n()}},Bg=class{constructor(){Object.defineProperty(this,"mockTracer",{enumerable:!0,configurable:!0,writable:!0,value:new Fg})}getTracer(t,r){return this.mockTracer}getActiveSpan(){}setSpan(t,r){return t}getSpan(t){}setSpanContext(t,r){return t}getTracerProvider(){}setGlobalTracerProvider(t){return!1}},Vg=class{active(){return{}}with(t,r){return r()}},Ug=Symbol.for("ls:otel_trace"),Lg=Symbol.for("ls:otel_context"),SI=Symbol.for("ls:otel_get_default_otlp_tracer_provider"),l4=new Bg,u4=new Vg,Zg=class{getTraceInstance(){return globalThis[Ug]??l4}getContextInstance(){return globalThis[Lg]??u4}initializeGlobalInstances(t){globalThis[Ug]===void 0&&(globalThis[Ug]=t.trace),globalThis[Lg]===void 0&&(globalThis[Lg]=t.context)}setDefaultOTLPTracerComponents(t){globalThis[SI]=t}getDefaultOTLPTracerComponents(){return globalThis[SI]??void 0}},Hg=new Zg;function Zd(){return Hg.getTraceInstance()}function kI(){return Hg.getContextInstance()}function EI(){return Hg.getDefaultOTLPTracerComponents()}var d4={llm:"chat",tool:"execute_tool",retriever:"embeddings",embedding:"embeddings",prompt:"chat"};function f4(e){return d4[e]||e}function p4(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}var Hd=class{constructor(){Object.defineProperty(this,"spans",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}exportBatch(t,r){for(let n of t)try{if(!n.run)continue;if(n.operation==="post"){let i=this.createSpanForRun(n,n.run,r.get(n.id));i&&!n.run.end_time&&this.spans.set(n.id,i)}else this.updateSpanForRun(n,n.run)}catch(i){console.error(`Error processing operation ${n.id}:`,i)}}createSpanForRun(t,r,n){let i=n&&Zd().getSpan(n);if(i)try{return this.finishSpanSetup(i,r,t)}catch(a){console.error(`Failed to create span for run ${t.id}:`,a);return}}finishSpanSetup(t,r,n){return this.setSpanAttributes(t,r,n),r.error?(t.setStatus({code:2}),t.recordException(new Error(r.error))):t.setStatus({code:1}),r.end_time&&t.end(new Date(r.end_time)),t}updateSpanForRun(t,r){try{let n=this.spans.get(t.id);if(!n){console.debug(`No span found for run ${t.id} during update`);return}this.setSpanAttributes(n,r,t),r.error?(n.setStatus({code:2}),n.recordException(new Error(r.error))):n.setStatus({code:1});let i=r.end_time;i&&(n.end(new Date(i)),this.spans.delete(t.id))}catch(n){console.error(`Failed to update span for run ${t.id}:`,n)}}extractModelName(t){if(t.extra?.metadata){let r=t.extra.metadata;if(r.ls_model_name)return r.ls_model_name;if(r.invocation_params){let n=r.invocation_params;if(n.model)return n.model;if(n.model_name)return n.model_name}}}setSpanAttributes(t,r,n){if("run_type"in r&&r.run_type){t.setAttribute(K$,r.run_type);let s=f4(r.run_type||"chain");t.setAttribute($$,s)}"name"in r&&r.name&&t.setAttribute(q$,r.name),"session_id"in r&&r.session_id&&t.setAttribute(W$,r.session_id),"session_name"in r&&r.session_name&&t.setAttribute(J$,r.session_name),this.setGenAiSystem(t,r);let i=this.extractModelName(r);i&&t.setAttribute($g,i),r.extra?.metadata?.usage_metadata&&typeof r.extra.metadata.usage_metadata=="object"&&t.setAttribute(Og,JSON.stringify(r.extra.metadata.usage_metadata)),"prompt_tokens"in r&&typeof r.prompt_tokens=="number"&&t.setAttribute(Ig,r.prompt_tokens),"completion_tokens"in r&&typeof r.completion_tokens=="number"&&t.setAttribute(Tg,r.completion_tokens),"total_tokens"in r&&typeof r.total_tokens=="number"&&t.setAttribute(Cg,r.total_tokens),this.setInvocationParameters(t,r);let a=r.extra?.metadata||{};for(let[s,c]of Object.entries(a))c!=null&&t.setAttribute(`${Y$}.${s}`,p4(c)?String(c):JSON.stringify(c));let o=r.tags;if(o&&Array.isArray(o)?t.setAttribute(Ag,o.join(", ")):o&&t.setAttribute(Ag,String(o)),"serialized"in r&&typeof r.serialized=="object"){let s=r.serialized;s.name&&t.setAttribute(U$,String(s.name)),s.signature&&t.setAttribute(L$,String(s.signature)),s.doc&&t.setAttribute(F$,String(s.doc))}this.setIOAttributes(t,n)}setGenAiSystem(t,r){let n="langchain",i=this.extractModelName(r);if(i){let a=i.toLowerCase();a.includes("anthropic")||a.startsWith("claude")?n="anthropic":a.includes("bedrock")?n="aws.bedrock":a.includes("azure")&&a.includes("openai")?n="az.ai.openai":a.includes("azure")&&a.includes("inference")?n="az.ai.inference":a.includes("cohere")?n="cohere":a.includes("deepseek")?n="deepseek":a.includes("gemini")?n="gemini":a.includes("groq")?n="groq":a.includes("watson")||a.includes("ibm")?n="ibm.watsonx.ai":a.includes("mistral")?n="mistral_ai":a.includes("gpt")||a.includes("openai")?n="openai":a.includes("perplexity")||a.includes("sonar")?n="perplexity":a.includes("vertex")?n="vertex_ai":(a.includes("xai")||a.includes("grok"))&&(n="xai")}t.setAttribute(I$,n)}setInvocationParameters(t,r){if(!r.extra?.metadata?.invocation_params)return;let n=r.extra.metadata.invocation_params;n.max_tokens!==void 0&&t.setAttribute(C$,n.max_tokens),n.temperature!==void 0&&t.setAttribute(A$,n.temperature),n.top_p!==void 0&&t.setAttribute(O$,n.top_p),n.frequency_penalty!==void 0&&t.setAttribute(P$,n.frequency_penalty),n.presence_penalty!==void 0&&t.setAttribute(N$,n.presence_penalty)}setIOAttributes(t,r){if(r.run.inputs)try{let n=r.run.inputs;typeof n=="object"&&n!==null&&(n.model&&Array.isArray(n.messages)&&t.setAttribute($g,n.model),n.stream!==void 0&&t.setAttribute(X$,n.stream),n.extra_headers&&t.setAttribute(Q$,JSON.stringify(n.extra_headers)),n.extra_query&&t.setAttribute(D$,JSON.stringify(n.extra_query)),n.extra_body&&t.setAttribute(z$,JSON.stringify(n.extra_body))),t.setAttribute(M$,JSON.stringify(n))}catch(n){console.debug(`Failed to process inputs for run ${r.id}`,n)}if(r.run.outputs)try{let n=r.run.outputs,i=this.getUnifiedRunTokens(n);if(i&&(t.setAttribute(Ig,i[0]),t.setAttribute(Tg,i[1]),t.setAttribute(Cg,i[0]+i[1])),n&&typeof n=="object"){if(n.model&&t.setAttribute(T$,String(n.model)),n.id&&t.setAttribute(B$,n.id),n.choices&&Array.isArray(n.choices)){let a=n.choices.map(o=>o.finish_reason).filter(o=>o).map(String);a.length>0&&t.setAttribute(R$,a.join(", "))}if(n.service_tier&&t.setAttribute(V$,n.service_tier),n.system_fingerprint&&t.setAttribute(Z$,n.system_fingerprint),n.usage_metadata&&typeof n.usage_metadata=="object"){let a=n.usage_metadata;t.setAttribute(Og,JSON.stringify(a)),a.input_token_details&&t.setAttribute(H$,JSON.stringify(a.input_token_details)),a.output_token_details&&t.setAttribute(G$,JSON.stringify(a.output_token_details))}}t.setAttribute(j$,JSON.stringify(n))}catch(n){console.debug(`Failed to process outputs for run ${r.id}`,n)}}getUnifiedRunTokens(t){if(!t)return null;let r=this.extractUnifiedRunTokens(t.usage_metadata);if(r)return r;let n=Object.keys(t);for(let o of n){let s=t[o];if(!(!s||typeof s!="object")&&(r=this.extractUnifiedRunTokens(s.usage_metadata),r||s.lc===1&&s.kwargs&&typeof s.kwargs=="object"&&(r=this.extractUnifiedRunTokens(s.kwargs.usage_metadata),r)))return r}let i=t.generations||[];if(!Array.isArray(i))return null;let a=Array.isArray(i[0])?i.flat():i;for(let o of a)if(typeof o=="object"&&o.message&&typeof o.message=="object"&&o.message.kwargs&&typeof o.message.kwargs=="object"&&(r=this.extractUnifiedRunTokens(o.message.kwargs.usage_metadata),r))return r;return null}extractUnifiedRunTokens(t){return!t||typeof t!="object"||typeof t.input_tokens!="number"||typeof t.output_tokens!="number"?null:[t.input_tokens,t.output_tokens]}};var m4=Object.prototype.toString,h4=e=>m4.call(e)==="[object Error]",g4=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]);function Gg(e){if(!(e&&h4(e)&&e.name==="TypeError"&&typeof e.message=="string"))return!1;let{message:r,stack:n}=e;return r==="Load failed"?n===void 0||"__sentry_captured__"in e:r.startsWith("error sending request for url")?!0:g4.has(r)}function _4(e){if(typeof e=="number"){if(e<0)throw new TypeError("Expected `retries` to be a non-negative number.");if(Number.isNaN(e))throw new TypeError("Expected `retries` to be a valid number or Infinity, got NaN.")}else if(e!==void 0)throw new TypeError("Expected `retries` to be a number or Infinity.")}function Gd(e,t,{min:r=0,allowInfinity:n=!1}={}){if(t!==void 0){if(typeof t!="number"||Number.isNaN(t))throw new TypeError(`Expected \`${e}\` to be a number${n?" or Infinity":""}.`);if(!n&&!Number.isFinite(t))throw new TypeError(`Expected \`${e}\` to be a finite number.`);if(t<r)throw new TypeError(`Expected \`${e}\` to be \u2265 ${r}.`)}}var Wg=class extends Error{constructor(t){super(),t instanceof Error?(this.originalError=t,{message:t}=t):(this.originalError=new Error(t),this.originalError.stack=this.stack),this.name="AbortError",this.message=t}};function y4(e,t){let r=Math.max(1,e+1),n=t.randomize?Math.random()+1:1,i=Math.round(n*t.minTimeout*t.factor**(r-1));return i=Math.min(i,t.maxTimeout),i}function $I(e,t){return Number.isFinite(t)?t-(performance.now()-e):t}async function v4({error:e,attemptNumber:t,retriesConsumed:r,startTime:n,options:i}){let a=e instanceof Error?e:new TypeError(`Non-error was thrown: "${e}". You should only throw errors.`);if(a instanceof Wg)throw a.originalError;let o=Number.isFinite(i.retries)?Math.max(0,i.retries-r):i.retries,s=i.maxRetryTime??Number.POSITIVE_INFINITY,c=Object.freeze({error:a,attemptNumber:t,retriesLeft:o,retriesConsumed:r});if(await i.onFailedAttempt(c),$I(n,s)<=0)throw a;let l=await i.shouldConsumeRetry(c),u=$I(n,s);if(u<=0||o<=0)throw a;if(a instanceof TypeError&&!Gg(a)){if(l)throw a;return i.signal?.throwIfAborted(),!1}if(!await i.shouldRetry(c))throw a;if(!l)return i.signal?.throwIfAborted(),!1;let d=y4(r,i),f=Math.min(d,u);return f>0&&await new Promise((p,m)=>{let h=()=>{clearTimeout(_),i.signal?.removeEventListener("abort",h),m(i.signal.reason)},_=setTimeout(()=>{i.signal?.removeEventListener("abort",h),p()},f);i.unref&&_.unref?.(),i.signal?.addEventListener("abort",h,{once:!0})}),i.signal?.throwIfAborted(),!0}async function Jg(e,t={}){if(t={...t},_4(t.retries),Object.hasOwn(t,"forever"))throw new Error("The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.");t.retries??=10,t.factor??=2,t.minTimeout??=1e3,t.maxTimeout??=Number.POSITIVE_INFINITY,t.maxRetryTime??=Number.POSITIVE_INFINITY,t.randomize??=!1,t.onFailedAttempt??=()=>{},t.shouldRetry??=()=>!0,t.shouldConsumeRetry??=()=>!0,Gd("factor",t.factor,{min:0,allowInfinity:!1}),Gd("minTimeout",t.minTimeout,{min:0,allowInfinity:!1}),Gd("maxTimeout",t.maxTimeout,{min:0,allowInfinity:!0}),Gd("maxRetryTime",t.maxRetryTime,{min:0,allowInfinity:!0}),t.factor>0||(t.factor=1),t.signal?.throwIfAborted();let r=0,n=0,i=performance.now();for(;!Number.isFinite(t.retries)||n<=t.retries;){r++;try{t.signal?.throwIfAborted();let a=await e(r);return t.signal?.throwIfAborted(),a}catch(a){await v4({error:a,attemptNumber:r,retriesConsumed:n,startTime:i,options:t})&&n++}}throw new Error("Retry attempts exhausted without throwing an error.")}var Xd=qu(Yd(),1),jI="default"in Xd.default?Xd.default.default:Xd.default;var T4=[408,425,429,500,502,503,504],ol=class{constructor(t){Object.defineProperty(this,"maxConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxRetries",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxQueueSizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"queue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onFailedResponseHook",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"queueSizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:0}),this.maxConcurrency=t.maxConcurrency??1/0,this.maxRetries=t.maxRetries??6,this.maxQueueSizeBytes=t.maxQueueSizeBytes,this.queue=new jI({concurrency:this.maxConcurrency}),this.onFailedResponseHook=t?.onFailedResponseHook}call(t,...r){return this.callWithOptions({},t,...r)}callWithOptions(t,r,...n){let i=t.sizeBytes??0;if(this.maxQueueSizeBytes!==void 0&&i>0&&this.queueSizeBytes+i>this.maxQueueSizeBytes)return Promise.reject(new Error(`Queue size limit (${this.maxQueueSizeBytes} bytes) exceeded. Current queue size: ${this.queueSizeBytes} bytes, attempted addition: ${i} bytes.`));i>0&&(this.queueSizeBytes+=i);let a=this.onFailedResponseHook,o=this.queue.add(()=>Jg(()=>r(...n).catch(s=>{throw s instanceof Error?s:new Error(s)}),{async onFailedAttempt({error:s}){if(typeof s!="object"||s==null)throw s;let c="message"in s&&typeof s.message=="string"?s.message:void 0;if(c?.startsWith("Cancel")||c?.startsWith("TimeoutError")||c?.startsWith("AbortError")||"name"in s&&s.name==="TimeoutError"||"code"in s&&s.code==="ECONNABORTED")throw s;let l="response"in s?s.response:void 0;if(a&&await a(l))return;let u=l?.status??("status"in s?s.status:void 0);if(u!=null&&(typeof u=="number"||typeof u=="string")&&!T4.includes(+u))throw s},retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0});return i>0&&(o=o.finally(()=>{this.queueSizeBytes-=i})),t.signal?Promise.race([o,new Promise((s,c)=>{t.signal?.addEventListener("abort",()=>{c(new Error("AbortError"))})})]):o}};function t_(e){return typeof e?._getType=="function"}function r_(e){let t={type:e._getType(),data:{content:e.content}};return e?.additional_kwargs&&Object.keys(e.additional_kwargs).length>0&&(t.data.additional_kwargs={...e.additional_kwargs}),t}function ef(e){return`Invalid prompt identifier format: "${e}". Expected one of:
22
+ - "prompt-name" (for private prompts)
23
+ - "owner/prompt-name" (for prompts with explicit owner)
24
+ - "prompt-name:commit-hash" (with commit reference)
25
+ - "owner/prompt-name:commit-hash" (with owner and commit)`}var n_=class extends Error{constructor(t){super(t),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="LangSmithConflictError",this.status=409}},i_=class extends Error{constructor(t){super(t),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="LangSmithNotFoundError",this.status=404}};function tf(e){return e!=null&&typeof e=="object"&&"name"in e&&e?.name==="LangSmithNotFoundError"}function DI(e){return e!=null&&typeof e=="object"&&"name"in e&&e?.name==="LangSmithConflictError"}async function Y(e,t,r){let n;if(e.ok){r&&(n=await e.text());return}if(e.status===403)try{(await e.json())?.error==="org_scoped_key_requires_workspace"&&(n="This API key is org-scoped and requires workspace specification. Please provide 'workspaceId' parameter, or set LANGSMITH_WORKSPACE_ID environment variable.")}catch{let s=new Error(`${e.status} ${e.statusText}`);throw s.status=e?.status,s}if(n===void 0)try{n=await e.text()}catch{n=""}let i=`Failed to ${t}. Received status [${e.status}]: ${e.statusText}. Message: ${n}`;if(e.status===404)throw new i_(i);if(e.status===409)throw new n_(i);let a=new Error(i);throw a.status=e.status,a}var zI="ERR_CONFLICTING_ENDPOINTS",Qd=class extends Error{constructor(){super("You cannot provide both LANGSMITH_ENDPOINT / LANGCHAIN_ENDPOINT and LANGSMITH_RUNS_ENDPOINTS."),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:zI}),this.name="ConflictingEndpointsError"}};function UI(e){return typeof e=="object"&&e!==null&&e.code===zI}function Gt(e){if(!e||e.split("/").length>2||e.startsWith("/")||e.endsWith("/")||e.split(":").length>2)throw new Error(ef(e));let[t,r]=e.split(":"),n=r||"latest";if(t.includes("/")){let[i,a]=t.split("/",2);if(!i||!a)throw new Error(ef(e));return[i,a,n]}else{if(!t)throw new Error(ef(e));return["-",t,n]}}var rf="https://api.smith.langchain.com",C4="langsmith-cli",A4=6e4,O4=1e4;function P4(){let e=il();return e==="browser"||e==="webworker"}function N4(){let e=Nt("LANGSMITH_CONFIG_FILE");if(e)return e;let t=Nt("HOME")??Nt("USERPROFILE");if(t)return so.join(t,".langsmith","config.json")}function R4(e){let t=Nt("LANGSMITH_PROFILE");if(t)return t;if(e.current_profile)return e.current_profile;if(e.profiles?.default)return"default"}function M4(){if(P4())return;let e=N4();if(!(!e||!bs(e)))try{let t=JSON.parse(zd(e)),r=R4(t),n=r?t.profiles?.[r]:void 0;return!r||!n?void 0:{configPath:e,config:t,profileName:r,profile:n}}catch{return}}function Gr(e){return e!=null&&e.trim()!==""}function ia(e){return e?.trim().replace(/^["']|["']$/g,"")}function j4(e){let t=e.oauth;if(!t?.refresh_token)return!1;if(!t.access_token)return!0;if(!t.expires_at)return!1;let r=Date.parse(t.expires_at);return Number.isNaN(r)?!1:r<=Date.now()+A4}function D4(e){let t=e;for(;t.endsWith("/");)t=t.slice(0,-1);let r="/api/v1";return t.endsWith(r)?t.slice(0,-r.length):t}function z4(e,t){e.oauth??={},t.access_token&&(e.oauth.access_token=t.access_token),t.refresh_token&&(e.oauth.refresh_token=t.refresh_token),typeof t.expires_in=="number"&&t.expires_in>0&&(e.oauth.expires_at=new Date(Date.now()+t.expires_in*1e3).toISOString())}function LI(e){return e.reason??new Error("The operation was aborted.")}async function U4(e,t){if(!t)return e;if(t.aborted)throw LI(t);let r,n=new Promise((i,a)=>{let o=()=>{a(LI(t))};t.addEventListener("abort",o,{once:!0}),r=()=>{t.removeEventListener("abort",o)}});try{return await Promise.race([e,n])}finally{r?.()}}function FI(){let e=M4(),t=e?.profile;if(!e||!t)return{};let r=ia(t.api_key),n=ia(t.oauth?.access_token),i=ia(t.oauth?.refresh_token);return{apiUrl:t.api_url,apiKey:r,workspaceId:t.workspace_id,oauthAccessToken:n,oauthRefreshToken:i,profileAuth:r||n||i?new a_(e):void 0}}var a_=class{constructor(t){Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"refreshPromise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"managedAuthorizationValue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.rememberProfileAuthHeader(this.currentAuthHeader())}currentAuthHeader(){let t=L4(this.state.profile);return this.rememberProfileAuthHeader(t),t}async getAuthHeader(t,r){j4(this.state.profile)&&(this.refreshPromise||(this.refreshPromise=this.refreshOAuthToken(t).finally(()=>{this.refreshPromise=void 0})),await U4(this.refreshPromise,r));let n=BI(this.state.profile);return this.rememberProfileAuthHeader(n),n}isProfileAuthorizationHeader(t){return t===this.managedAuthorizationValue}async refreshOAuthToken(t){let r=this.state.profile.oauth?.refresh_token;if(!r)return;let n=ia(this.state.profile.api_url)??rf;try{let i=new URLSearchParams({grant_type:"refresh_token",client_id:C4,refresh_token:r}),a=await t(`${D4(n)}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:i.toString(),signal:AbortSignal.timeout(O4)});if(!a.ok)return;let o=await a.json();if(!o.access_token)return;z4(this.state.profile,o),this.state.config.profiles??={},this.state.config.profiles[this.state.profileName]=this.state.profile,await Dd(this.state.configPath,`${JSON.stringify(this.state.config,null,2)}
26
+ `)}catch{return}}rememberProfileAuthHeader(t){this.managedAuthorizationValue=t?.name==="Authorization"?t.value:void 0}};function L4(e){let t=ia(e.oauth?.access_token);if(t)return{name:"Authorization",value:`Bearer ${t}`};if(!ia(e.oauth?.refresh_token))return BI(e)}function BI(e){let t=ia(e.oauth?.access_token);if(t)return{name:"Authorization",value:`Bearer ${t}`};let r=ia(e.api_key);if(r)return{name:"x-api-key",value:r}}var VI="[...]",F4={result:"[Circular]"},af=[],ws=[],B4=new TextEncoder;function V4(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function nf(e){return B4.encode(e)}function ZI(e){if(e&&typeof e=="object"&&e!==null){if(e instanceof Map)return Object.fromEntries(e);if(e instanceof Set)return Array.from(e);if(e instanceof Date)return e.toISOString();if(e instanceof RegExp)return e.toString();if(e instanceof Error)return{name:e.name,message:e.message}}else if(typeof e=="bigint")return e.toString();return e}function Z4(e){return function(t,r){if(e){let n=e.call(this,t,r);if(n!==void 0)return n}return ZI(r)}}function HI(e){try{let i=function(u){let d=n(u);return d>r&&(r=d),d+2},a=function(u){return u===0?2:2+u*4},o=function(u){return u===void 0||typeof u=="function"||typeof u=="symbol"},s=function(u){return u===void 0||typeof u=="function"||typeof u=="symbol"?4:c(u)},c=function(u){if(u===null)return 4;if(u===void 0)return 0;let d=typeof u;if(d==="boolean")return 5;if(d==="number")return Number.isFinite(u)?u.toString().length:4;if(d==="bigint")return u.toString().length+2;if(d==="string")return i(u);if(d==="function"||d==="symbol")return 0;let f=u;if(f instanceof Date)return 26;if(f instanceof RegExp)return n(f.toString())+2;if(f instanceof Error){let m=f.name??"",h=f.message??"";return 22+n(m)+n(h)}if(typeof Buffer<"u"&&f instanceof Buffer)return 28+a(f.byteLength);if(ArrayBuffer.isView(f)){if(f instanceof DataView)return 2;let m=f.length??0,_=f instanceof Float32Array||f instanceof Float64Array?30:12;return 2+m*_}if(f instanceof ArrayBuffer)return 2;if(t.has(f))return 24;if(typeof f.toJSON=="function"){let m;try{m=f.toJSON("")}catch{return 16}t.add(f);let h=c(m);return t.delete(f),h}t.add(f);let p;if(Array.isArray(f)){p=2;let m=f.length;for(let h=0;h<m;h++)p+=s(f[h]),h<m-1&&(p+=1)}else if(f instanceof Map){p=2;let m=0;for(let[h,_]of f){if(o(_))continue;m>0&&(p+=1);let y=typeof h=="string"?h:String(h);p+=n(y)+3,p+=c(_),m++}}else if(f instanceof Set){p=2;let m=0;for(let h of f)m>0&&(p+=1),p+=s(h),m++}else{p=2;let m=0,h=Object.keys(f);for(let _=0;_<h.length;_++){let y=h[_],w=f[y];o(w)||(m>0&&(p+=1),p+=n(y)+3,p+=c(w),m++)}}return t.delete(f),p},t=new Set,r=0,n=typeof Buffer<"u"&&typeof Buffer.byteLength=="function"?u=>Buffer.byteLength(u,"utf8"):u=>u.length;return{size:c(e),maxStringLen:r}}catch{return{size:Wt(e).length,maxStringLen:0}}}function Wt(e,t,r,n,i){try{let a=JSON.stringify(e,Z4(r),n);return nf(a)}catch(a){if(!a.message?.includes("Converting circular structure to JSON"))return console.warn(`[WARNING]: LangSmith received unserializable value.${t?`
27
+ Context: ${t}`:""}`),nf("[Unserializable]");Ke("SUPPRESS_CIRCULAR_JSON_WARNINGS")!=="true"&&console.warn(`[WARNING]: LangSmith received circular JSON. This will decrease tracer performance. ${t?`
28
+ Context: ${t}`:""}`),typeof i>"u"&&(i=V4()),s_(e,"",0,[],void 0,0,i);let o;try{ws.length===0?o=JSON.stringify(e,r,n):o=JSON.stringify(e,H4(r),n)}catch{return nf("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;af.length!==0;){let s=af.pop();s.length===4?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return nf(o)}}function o_(e,t,r,n){var i=Object.getOwnPropertyDescriptor(n,r);i.get!==void 0?i.configurable?(Object.defineProperty(n,r,{value:e}),af.push([n,r,t,i])):ws.push([t,r,e]):(n[r]=e,af.push([n,r,t]))}function s_(e,t,r,n,i,a,o){a+=1;var s;if(typeof e=="object"&&e!==null){for(s=0;s<n.length;s++)if(n[s]===e){o_(F4,e,t,i);return}if(typeof o.depthLimit<"u"&&a>o.depthLimit){o_(VI,e,t,i);return}if(typeof o.edgesLimit<"u"&&r+1>o.edgesLimit){o_(VI,e,t,i);return}if(n.push(e),Array.isArray(e))for(s=0;s<e.length;s++)s_(e[s],s,s,n,e,a,o);else{e=ZI(e);var c=Object.keys(e);for(s=0;s<c.length;s++){var l=c[s];s_(e[l],l,s,n,e,a,o)}}n.pop()}}function H4(e){return e=typeof e<"u"?e:function(t,r){return r},function(t,r){if(ws.length>0)for(var n=0;n<ws.length;n++){var i=ws[n];if(i[1]===t&&i[0]===r){r=i[2],ws.splice(n,1);break}}return e.call(this,t,r)}}var W4=`
29
+ const { parentPort } = require("worker_threads");
30
+
31
+ const CIRCULAR_REPLACE_NODE = { result: "[Circular]" };
32
+
33
+ function serializeWellKnownTypes(val) {
34
+ if (val && typeof val === "object") {
35
+ if (val instanceof Map) return Object.fromEntries(val);
36
+ if (val instanceof Set) return Array.from(val);
37
+ if (val instanceof Date) return val.toISOString();
38
+ if (val instanceof RegExp) return val.toString();
39
+ if (val instanceof Error) return { name: val.name, message: val.message };
40
+ } else if (typeof val === "bigint") {
41
+ return val.toString();
42
+ }
43
+ return val;
44
+ }
45
+
46
+ function defaultReplacer(_key, val) {
47
+ return serializeWellKnownTypes(val);
48
+ }
49
+
50
+ // Decirculate in-place: replace circular refs with { result: "[Circular]" }
51
+ // then restore after stringify. Mirrors fast-safe-stringify's decirc().
52
+ const restoreStack = [];
53
+ function decirc(val, k, stack, parent) {
54
+ if (typeof val === "object" && val !== null) {
55
+ for (let i = 0; i < stack.length; i++) {
56
+ if (stack[i] === val) {
57
+ const orig = parent[k];
58
+ parent[k] = CIRCULAR_REPLACE_NODE;
59
+ restoreStack.push([parent, k, orig]);
60
+ return;
61
+ }
62
+ }
63
+ stack.push(val);
64
+ if (Array.isArray(val)) {
65
+ for (let i = 0; i < val.length; i++) decirc(val[i], i, stack, val);
66
+ } else {
67
+ const normalized = serializeWellKnownTypes(val);
68
+ // Only recurse into normalized if it's still an object (arrays/objects),
69
+ // else it was replaced with a primitive (e.g. Date -> string).
70
+ if (normalized === val) {
71
+ const keys = Object.keys(val);
72
+ for (let i = 0; i < keys.length; i++) decirc(val[keys[i]], keys[i], stack, val);
73
+ }
74
+ }
75
+ stack.pop();
76
+ }
77
+ }
78
+
79
+ function serialize(obj) {
80
+ try {
81
+ return JSON.stringify(obj, defaultReplacer);
82
+ } catch (e) {
83
+ if (!String(e && e.message).includes("Converting circular structure to JSON")) {
84
+ return "[Unserializable]";
85
+ }
86
+ decirc(obj, "", [], { "": obj });
87
+ try {
88
+ return JSON.stringify(obj, defaultReplacer);
89
+ } catch (_) {
90
+ return "[unable to serialize, circular reference is too complex to analyze]";
91
+ } finally {
92
+ while (restoreStack.length) {
93
+ const [p, k, v] = restoreStack.pop();
94
+ p[k] = v;
95
+ }
96
+ }
97
+ }
98
+ }
99
+
100
+ parentPort.on("message", (msg) => {
101
+ const { id, op, payload } = msg;
102
+ try {
103
+ if (op === "serialize") {
104
+ const str = serialize(payload);
105
+ const buf = Buffer.from(str, "utf8");
106
+ // Slice into its own ArrayBuffer so we can transfer without dragging
107
+ // unrelated bytes from any shared pool buffer.
108
+ const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
109
+ parentPort.postMessage({ id, bytes: ab, length: buf.byteLength }, [ab]);
110
+ } else if (op === "ping") {
111
+ parentPort.postMessage({ id });
112
+ } else {
113
+ parentPort.postMessage({ id, error: "unknown op: " + op });
114
+ }
115
+ } catch (e) {
116
+ parentPort.postMessage({ id, error: String((e && e.message) || e) });
117
+ }
118
+ });
119
+ `,l_=class{constructor(){Object.defineProperty(this,"worker",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nextId",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"pending",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"disabled",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"startPromise",{enumerable:!0,configurable:!0,writable:!0,value:null})}async ensureStarted(){if(this.disabled)return!1;if(this.worker!==null)return!0;if(this.startPromise!==null)return this.startPromise;this.startPromise=this._start();try{return await this.startPromise}finally{this.startPromise=null}}async _start(){if(!!1||null===null)return this.disabled=!0,!1;try{let t=new null(W4,{eval:!0});return t.on("message",r=>{let n=this.pending.get(r.id);n&&(this.pending.delete(r.id),r.error?n.reject(new Error(r.error)):r.bytes&&typeof r.length=="number"?n.resolve(new Uint8Array(r.bytes,0,r.length)):n.reject(new Error("worker returned malformed message")))}),t.on("error",r=>{for(let[,n]of this.pending)n.reject(r);this.pending.clear(),this.disabled=!0,this.worker=null}),t.on("exit",r=>{for(let[,n]of this.pending)n.reject(new Error(`worker exited with code ${r}`));this.pending.clear(),this.worker=null}),t.unref(),this.worker=t,!0}catch{return this.disabled=!0,!1}}async serialize(t){if(!await this.ensureStarted())return null;let n=this.nextId++;return new Promise((i,a)=>{this.pending.set(n,{resolve:i,reject:a});try{this.worker.postMessage({id:n,op:"serialize",payload:t})}catch(o){this.pending.delete(n),a(o)}})}async terminate(){this.worker&&(await this.worker.terminate(),this.worker=null);for(let[,t]of this.pending)t.reject(new Error("worker terminated"));this.pending.clear()}},c_=null;function WI(){return c_===null&&(c_=new l_),c_}var J4=64*1024,K4=2048;function JI(e,t=J4,r=K4){if(e===null||typeof e!="object")return typeof e=="string"&&e.length>=t;let n=[e],i=new Set,a=0;for(;n.length>0;){if(a++>=r)return!1;let o=n.pop();if(o==null)continue;let s=typeof o;if(s==="string"){if(o.length>=t)return!0;continue}if(s!=="object")continue;let c=o;if(i.has(c)||(i.add(c),c instanceof Date||c instanceof RegExp||c instanceof Error||c instanceof ArrayBuffer||ArrayBuffer.isView(c)))continue;if(Array.isArray(c)){for(let u=c.length-1;u>=0;u--)n.push(c[u]);continue}if(c instanceof Map){for(let[,u]of c)n.push(u);continue}if(c instanceof Set){for(let u of c)n.push(u);continue}let l=Object.keys(c);for(let u=l.length-1;u>=0;u--)n.push(c[l[u]])}return!1}function q4(e,t){let[r]=Gt(e);if(r!=="-"&&!t)throw new Error("Pulling a public prompt by owner/name is disabled by default because prompts may contain untrusted serialized LangChain objects. If you trust this prompt, set `dangerouslyPullPublicPrompt: true` to acknowledge the risk.")}function KI(e){return typeof e=="string"&&e.length>0&&!e.includes("Z")&&!e.includes("+")&&!e.includes("-",10)?e+"Z":e}function sl(e){return{...e,start_time:KI(e.start_time),end_time:KI(e.end_time)}}function qI(e,t,r){if(r)return e;let n=Bd(),i=t??zg(),a=e.extra??{},o=a.metadata;return e.extra={...a,runtime:{...n,...a?.runtime},metadata:{...i,...i.revision_id||"revision_id"in e&&e.revision_id?{revision_id:("revision_id"in e?e.revision_id:void 0)??i.revision_id}:{},...o}},e}var Y4=e=>{let t=e?.toString()??Ke("TRACING_SAMPLING_RATE");if(t===void 0)return;let r=parseFloat(t);if(r<0||r>1)throw new Error(`LANGSMITH_TRACING_SAMPLING_RATE must be between 0 and 1 if set. Got: ${r}`);return r},X4=e=>{let r=e.replace("http://","").replace("https://","").split("/")[0].split(":")[0];return r==="localhost"||r==="127.0.0.1"||r==="::1"};async function Q4(e){let t=[];for await(let r of e)t.push(r);return t}function of(e){if(e!==void 0)return e.trim().replace(/^"(.*)"$/,"$1").replace(/^'(.*)'$/,"$1")}var ez=async e=>{if(e?.status===429){let t=parseInt(e.headers.get("retry-after")??"10",10)*1e3;if(t>0)return await new Promise(r=>setTimeout(r,t)),!0}return!1};function YI(e){return typeof e=="number"?Number(e.toFixed(4)):e}var tz=24*1024*1024,QI=1024*1024*1024,rz=1e4,nz=100,u_=class{constructor(t){Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"sizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"maxSizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSizeBytes=t??QI}peek(){return this.items[0]}push(t){let r,n=new Promise(a=>{r=a}),i=HI(t.item).size;return this.sizeBytes+i>this.maxSizeBytes&&this.items.length>0?(console.warn(`AutoBatchQueue size limit (${this.maxSizeBytes} bytes) exceeded. Dropping run with id: ${t.item.id}. Current queue size: ${this.sizeBytes} bytes, attempted addition: ${i} bytes.`),r(),n):(this.items.push({action:t.action,payload:t.item,otelContext:t.otelContext,apiKey:t.apiKey,apiUrl:t.apiUrl,itemPromiseResolve:r,itemPromise:n,size:i}),this.sizeBytes+=i,n)}pop({upToSizeBytes:t,upToSize:r}){if(t<1)throw new Error("Number of bytes to pop off may not be less than 1.");let n=[],i=0;for(;i+(this.peek()?.size??0)<t&&this.items.length>0&&n.length<r;){let a=this.items.shift();a&&(n.push(a),i+=a.size,this.sizeBytes-=a.size)}if(n.length===0&&this.items.length>0){let a=this.items.shift();n.push(a),i+=a.size,this.sizeBytes-=a.size}return[n.map(a=>({action:a.action,item:a.payload,otelContext:a.otelContext,apiKey:a.apiKey,apiUrl:a.apiUrl,size:a.size})),()=>n.forEach(a=>a.itemPromiseResolve())]}},Ln=class e{get tracingMode(){return this._tracingMode}get _fetch(){let t=this.fetchImplementation||rI(this.debug);return(async(r,n)=>{let i,a=this.getProfileManagedAuthorizationHeader(n);return this.apiKey!==void 0?i={name:"x-api-key",value:`${this.apiKey}`}:this.hasExplicitAuthHeader(n,a)||(i=await this.profileAuth?.getAuthHeader(t,n?.signal)),t(r,this.applyCurrentAuthHeaders(n,i,a))})}getProfileManagedAuthorizationHeader(t){if(!t?.headers||!this.profileAuth)return;let r=new Headers(t.headers).get("Authorization");if(Gr(r))return this.profileAuth.isProfileAuthorizationHeader(r??"")?r??void 0:void 0}isProfileManagedAuthorizationHeader(t,r){return t===r||this.profileAuth?.isProfileAuthorizationHeader(t)===!0}hasExplicitAuthHeader(t,r){if(!t?.headers)return!1;let n=new Headers(t.headers);if(Gr(n.get("x-api-key")))return!0;let i=n.get("Authorization");return Gr(i)?!this.isProfileManagedAuthorizationHeader(i??"",r):!1}applyCurrentAuthHeaders(t,r,n){if(!r)return t;let i=d=>{if(this.apiKey!==void 0&&r.name==="x-api-key")return d.delete("Authorization"),d.has("x-api-key")||d.set("x-api-key",r.value),d;if(r.name==="Authorization"){if(Gr(d.get("x-api-key")))return d;let p=d.get("Authorization");return Gr(p)&&!this.isProfileManagedAuthorizationHeader(p??"",n)||d.set("Authorization",r.value),d}let f=d.get("Authorization");return Gr(f)&&!this.isProfileManagedAuthorizationHeader(f??"",n)||(Gr(f)&&d.delete("Authorization"),d.has("x-api-key")||d.set("x-api-key",r.value)),d};if(!t)return{headers:{[r.name]:r.value}};if(t.headers instanceof Headers)return{...t,headers:i(new Headers(t.headers))};if(Array.isArray(t.headers))return{...t,headers:i(new Headers(t.headers))};let a={...t.headers??{}},o=d=>Object.keys(a).find(f=>f.toLowerCase()===d),s=d=>{let f=o(d);return f?a[f]:void 0},c=Gr(s("x-api-key")),l=s("authorization"),u=Gr(l)&&!this.isProfileManagedAuthorizationHeader(l??"",n);if(this.apiKey!==void 0&&r.name==="x-api-key"){let d=o("authorization");return d&&delete a[d],c||(a["x-api-key"]=r.value),{...t,headers:a}}if(r.name==="Authorization"){if(!c&&!u){let d=o("authorization");d&&d!=="Authorization"&&delete a[d],a.Authorization=r.value}return{...t,headers:a}}if(!u){let d=o("authorization");d&&delete a[d],c||(a["x-api-key"]=r.value)}return{...t,headers:a}}_trackDrain(t){this._pendingDrains.add(t),t.finally(()=>{this._pendingDrains.delete(t)})}async _serializeBody(t,r){if(this.manualFlushMode)return Wt(t,r);if(!JI(t))return Wt(t,r);if(this._serializeWorker===void 0&&(this._serializeWorker=WI()),this._serializeWorker===null)return Wt(t,r);try{let n=await this._serializeWorker.serialize(t);return n===null?(this._serializeWorker=null,Wt(t,r)):n}catch{return Wt(t,r)}}constructor(t={}){Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"webUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"workspaceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"caller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"batchIngestCaller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timeout_ms",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tenantId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"hideInputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideOutputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideMetadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"omitTracedRuntimeInfo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracingSampleRate",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"filteredPostUuids",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"autoBatchTracing",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"autoBatchQueue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"autoBatchTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"autoBatchAggregationDelayMs",{enumerable:!0,configurable:!0,writable:!0,value:250}),Object.defineProperty(this,"batchSizeBytesLimit",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"batchSizeLimit",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fetchOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"settings",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"blockOnRootRunFinalization",{enumerable:!0,configurable:!0,writable:!0,value:Nt("LANGSMITH_TRACING_BACKGROUND")==="false"}),Object.defineProperty(this,"traceBatchConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:5}),Object.defineProperty(this,"_serverInfo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_getServerInfoPromise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"manualFlushMode",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_serializeWorker",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_pendingDrains",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"langSmithToOTELTranslator",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tracingMode",{enumerable:!0,configurable:!0,writable:!0,value:"langsmith"}),Object.defineProperty(this,"fetchImplementation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cachedLSEnvVarsForMetadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_promptCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"profileAuth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"multipartStreamingDisabled",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_multipartDisabled",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_runCompressionDisabled",{enumerable:!0,configurable:!0,writable:!0,value:Ke("DISABLE_RUN_COMPRESSION")==="true"}),Object.defineProperty(this,"failedTracesDir",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"failedTracesMaxBytes",{enumerable:!0,configurable:!0,writable:!0,value:100*1024*1024}),Object.defineProperty(this,"_customHeaders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"debug",{enumerable:!0,configurable:!0,writable:!0,value:Nt("LANGSMITH_DEBUG")==="true"});let r=e.getDefaultClientConfig();this.tracingSampleRate=Y4(t.tracingSamplingRate),this.apiUrl=of(t.apiUrl??r.apiUrl)??"",this.apiUrl.endsWith("/")&&(this.apiUrl=this.apiUrl.slice(0,-1));let n=of(t.apiKey??r.apiKey);if(this.apiKey=Gr(n)?n:void 0,this.profileAuth=this.apiKey!==void 0?void 0:r.profileAuth,this.webUrl=of(t.webUrl??r.webUrl),this.webUrl?.endsWith("/")&&(this.webUrl=this.webUrl.slice(0,-1)),this.workspaceId=of(t.workspaceId??r.workspaceId),this.timeout_ms=t.timeout_ms??9e4,this.caller=new ol({...t.callerOptions??{},maxRetries:4,debug:t.debug??this.debug}),this.traceBatchConcurrency=t.traceBatchConcurrency??this.traceBatchConcurrency,this.traceBatchConcurrency<1)throw new Error("Trace batch concurrency must be positive.");this.debug=t.debug??this.debug,this.fetchImplementation=t.fetchImplementation,this.failedTracesDir=Ke("FAILED_TRACES_DIR")||void 0;let i=Ke("FAILED_TRACES_MAX_MB");if(i){let o=parseInt(i,10);Number.isFinite(o)&&o>0&&(this.failedTracesMaxBytes=o*1024*1024)}let a=t.maxIngestMemoryBytes??QI;this.batchIngestCaller=new ol({maxRetries:4,maxConcurrency:this.traceBatchConcurrency,maxQueueSizeBytes:a,...t.callerOptions??{},onFailedResponseHook:ez,debug:t.debug??this.debug}),this.hideInputs=t.hideInputs??t.anonymizer??r.hideInputs,this.hideOutputs=t.hideOutputs??t.anonymizer??r.hideOutputs,this.hideMetadata=t.hideMetadata??r.hideMetadata,this.omitTracedRuntimeInfo=t.omitTracedRuntimeInfo??!1,this.autoBatchTracing=t.autoBatchTracing??this.autoBatchTracing,this.autoBatchQueue=new u_(a),this.blockOnRootRunFinalization=t.blockOnRootRunFinalization??this.blockOnRootRunFinalization,this.batchSizeBytesLimit=t.batchSizeBytesLimit,this.batchSizeLimit=t.batchSizeLimit,this.fetchOptions=t.fetchOptions||{},this.manualFlushMode=t.manualFlushMode??this.manualFlushMode,this._tracingMode=Vd(t.tracingMode),this._tracingMode==="otel"&&(this.langSmithToOTELTranslator=new Hd),this.cachedLSEnvVarsForMetadata=zg(),t.cache!==void 0&&t.disablePromptCache&&ao("Both 'cache' and 'disablePromptCache' were provided. The 'cache' parameter is deprecated and will be removed in a future version. Using 'cache' parameter value."),t.cache!==void 0?(ao("The 'cache' parameter is deprecated and will be removed in a future version. Use 'configureGlobalPromptCache()' to configure the global cache, or 'disablePromptCache: true' to disable caching for this client."),t.cache===!1?this._promptCache=void 0:t.cache===!0?this._promptCache=Ld:this._promptCache=t.cache):t.disablePromptCache||(this._promptCache=Ld),this._customHeaders=t.headers??{}}static getDefaultClientConfig(){let t=FI(),r=Ke("API_KEY"),n=Ke("ENDPOINT"),i=Ke("WORKSPACE_ID"),a=Gr(r),o=n??t.apiUrl??rf,s=i??t.workspaceId,c=Ke("HIDE_INPUTS")==="true",l=Ke("HIDE_OUTPUTS")==="true",u=Ke("HIDE_METADATA")==="true";return{apiUrl:o,apiKey:r,webUrl:void 0,hideInputs:c,hideOutputs:l,hideMetadata:u,workspaceId:s,oauthAccessToken:a?void 0:t.oauthAccessToken,oauthRefreshToken:a?void 0:t.oauthRefreshToken,profileAuth:a?void 0:t.profileAuth}}getHostUrl(){return this.webUrl?this.webUrl:X4(this.apiUrl)?(this.webUrl="http://localhost:3000",this.webUrl):this.apiUrl.endsWith("/api/v1")?(this.webUrl=this.apiUrl.replace("/api/v1",""),this.webUrl):this.apiUrl.includes("/api")&&!this.apiUrl.split(".",1)[0].endsWith("api")?(this.webUrl=this.apiUrl.replace("/api",""),this.webUrl):this.apiUrl.split(".",1)[0].includes("dev")?(this.webUrl="https://dev.smith.langchain.com",this.webUrl):this.apiUrl.split(".",1)[0].includes("eu")?(this.webUrl="https://eu.smith.langchain.com",this.webUrl):this.apiUrl.split(".",1)[0].includes("aws")?(this.webUrl="https://aws.smith.langchain.com",this.webUrl):this.apiUrl.split(".",1)[0].includes("apac")?(this.webUrl="https://apac.smith.langchain.com",this.webUrl):this.apiUrl.split(".",1)[0].includes("beta")?(this.webUrl="https://beta.smith.langchain.com",this.webUrl):(this.webUrl="https://smith.langchain.com",this.webUrl)}get _mergedHeaders(){let t={"User-Agent":`langsmith-js/${Fd}`,...this._customHeaders};if(this.apiKey!==void 0)t["x-api-key"]=`${this.apiKey}`;else{let r=this.profileAuth?.currentAuthHeader();r&&(t[r.name]=r.value)}return this.workspaceId&&(t["x-tenant-id"]=this.workspaceId),t}get headers(){return this._customHeaders}set headers(t){this._customHeaders=t??{}}_getPlatformEndpointPath(t){return this.apiUrl.slice(-3)!=="/v1"&&this.apiUrl.slice(-4)!=="/v1/"?`/v1/platform/${t}`:`/platform/${t}`}async processInputs(t){return this.hideInputs===!1?t:this.hideInputs===!0?{}:typeof this.hideInputs=="function"?this.hideInputs(t):t}async processOutputs(t){return this.hideOutputs===!1?t:this.hideOutputs===!0?{}:typeof this.hideOutputs=="function"?this.hideOutputs(t):t}async processMetadata(t){return this.hideMetadata===!1?t:this.hideMetadata===!0?{}:typeof this.hideMetadata=="function"?this.hideMetadata(t):t}_filterNewTokenEvents(t){return!t||t.length===0?t:t.map(r=>{if(r.name==="new_token"){let{kwargs:n,...i}=r;return i}return r})}async prepareRunCreateOrUpdateInputs(t){let r={...t};return r.inputs!==void 0&&(r.inputs=await this.processInputs(r.inputs)),r.outputs!==void 0&&(r.outputs=await this.processOutputs(r.outputs)),r.extra!=null&&"metadata"in r.extra&&(r.extra={...r.extra,metadata:await this.processMetadata(r.extra.metadata)}),r.events!==void 0&&(r.events=this._filterNewTokenEvents(r.events)),r}async _getResponse(t,r){let n=r?.toString()??"",i=`${this.apiUrl}${t}?${n}`;return await this.caller.call(async()=>{let o=await this._fetch(i,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Y(o,`fetch ${t}`),o})}async _get(t,r){return(await this._getResponse(t,r)).json()}async*_getPaginated(t,r=new URLSearchParams,n){let i=Number(r.get("offset"))||0,a=Number(r.get("limit"))||100;for(;;){r.set("offset",String(i)),r.set("limit",String(a));let o=`${this.apiUrl}${t}?${r}`,s=await this.caller.call(async()=>{let l=await this._fetch(o,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Y(l,`fetch ${t}`),l}),c=n?n(await s.json()):await s.json();if(c.length===0||(yield c,c.length<a))break;i+=c.length}}async*_getCursorPaginatedList(t,r=null,n="POST",i="runs"){let a=r?{...r}:{};for(;;){let o=JSON.stringify(a),c=await(await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}${t}`,{method:n,headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:o});return await Y(u,`fetch ${t}`),u})).json();if(!c||!c[i])break;yield c[i];let l=c.cursors;if(!l||!l.next)break;a.cursor=l.next}}_shouldSample(){return this.tracingSampleRate===void 0?!0:Math.random()<this.tracingSampleRate}_filterForSampling(t,r=!1){if(this.tracingSampleRate===void 0)return t;if(r){let n=[];for(let i of t)this.filteredPostUuids.has(i.trace_id)?i.id===i.trace_id&&this.filteredPostUuids.delete(i.trace_id):n.push(i);return n}else{let n=[];for(let i of t){let a=i.trace_id??i.id;this.filteredPostUuids.has(a)||(i.id===a?this._shouldSample()?n.push(i):this.filteredPostUuids.add(a):n.push(i))}return n}}async _getBatchSizeLimitBytes(){let t=await this._ensureServerInfo();return this.batchSizeBytesLimit??t?.batch_ingest_config?.size_limit_bytes??tz}async _getBatchSizeLimit(){let t=await this._ensureServerInfo();return this.batchSizeLimit??t?.batch_ingest_config?.size_limit??nz}async _getDatasetExamplesMultiPartSupport(){return(await this._ensureServerInfo()).instance_flags?.dataset_examples_multipart_enabled??!1}drainAutoBatchQueue({batchSizeLimitBytes:t,batchSizeLimit:r}){let n=[];for(;this.autoBatchQueue.items.length>0;){let[i,a]=this.autoBatchQueue.pop({upToSizeBytes:t,upToSize:r});if(!i.length){a();break}let o=i.reduce((l,u)=>{let d=u.apiUrl??this.apiUrl,f=u.apiKey??this.apiKey,m=u.apiKey===this.apiKey&&u.apiUrl===this.apiUrl?"default":`${d}|${f}`;return l[m]||(l[m]=[]),l[m].push(u),l},{}),s=[];for(let[l,u]of Object.entries(o)){let d=this._processBatch(u,{apiUrl:l==="default"?void 0:l.split("|")[0],apiKey:l==="default"?void 0:l.split("|")[1]});s.push(d)}let c=Promise.all(s).finally(a);n.push(c)}return Promise.all(n)}static async _writeTraceToFallbackDir(t,r,n,i,a){try{let o=typeof r=="string"?Buffer.from(r,"utf8"):Buffer.from(r),s=JSON.stringify({version:1,endpoint:i,headers:n,body_base64:o.toString("base64")}),c=`trace_${Date.now()}_${io().slice(0,8)}.json`,l=so.join(t,c);if(e._fallbackDirsCreated.has(t)||(await gI(t),e._fallbackDirsCreated.add(t)),a!==void 0&&a>0)try{let d=(await _I(t)).filter(p=>p.startsWith("trace_")&&p.endsWith(".json")),f=0;for(let p of d){let{size:m}=await yI(so.join(t,p));f+=m}if(f>=a){console.warn(`Could not write trace to fallback dir ${t} as it's already over size limit (${f} bytes >= ${a} bytes). Increase LANGSMITH_FAILED_TRACES_MAX_MB if possible.`);return}}catch{}await Dd(l,s),console.warn(`LangSmith trace upload failed; data saved to ${l} for later replay.`)}catch(o){console.error(`LangSmith tracing error: could not write trace to fallback dir ${t}:`,o)}}async _processBatch(t,r){if(!t.length)return;let n=t.reduce((i,a)=>i+(a.size??0),0);try{if(this.langSmithToOTELTranslator!==void 0)this._sendBatchToOTELTranslator(t);else{let i={runCreates:t.filter(s=>s.action==="create").map(s=>s.item),runUpdates:t.filter(s=>s.action==="update").map(s=>s.item)},a=await this._ensureServerInfo();if(!this._multipartDisabled&&(a?.batch_ingest_config?.use_multipart_endpoint??!0)){let s=!this._runCompressionDisabled&&a?.instance_flags?.gzip_body_enabled;try{await this.multipartIngestRuns(i,{...r,useGzip:s,sizeBytes:n})}catch(c){if(tf(c))this._multipartDisabled=!0,await this.batchIngestRuns(i,{...r,sizeBytes:n});else throw c}}else await this.batchIngestRuns(i,{...r,sizeBytes:n})}}catch(i){console.error("Error exporting batch:",i)}}_sendBatchToOTELTranslator(t){if(this.langSmithToOTELTranslator!==void 0){let r=new Map,n=[];for(let i of t)i.item.id&&i.otelContext&&(r.set(i.item.id,i.otelContext),i.action==="create"?n.push({operation:"post",id:i.item.id,trace_id:i.item.trace_id??i.item.id,run:i.item}):n.push({operation:"patch",id:i.item.id,trace_id:i.item.trace_id??i.item.id,run:i.item}));this.langSmithToOTELTranslator.exportBatch(n,r)}}async processRunOperation(t){clearTimeout(this.autoBatchTimeout),this.autoBatchTimeout=void 0,t.item=qI(t.item,this.cachedLSEnvVarsForMetadata,this.omitTracedRuntimeInfo);let r=this.autoBatchQueue.push(t);if(this.manualFlushMode)return r;let n=await this._getBatchSizeLimitBytes(),i=await this._getBatchSizeLimit();return(this.autoBatchQueue.sizeBytes>n||this.autoBatchQueue.items.length>i)&&this._trackDrain(this.drainAutoBatchQueue({batchSizeLimitBytes:n,batchSizeLimit:i})),this.autoBatchQueue.items.length>0&&(this.autoBatchTimeout=setTimeout(()=>{this.autoBatchTimeout=void 0,this._trackDrain(this.drainAutoBatchQueue({batchSizeLimitBytes:n,batchSizeLimit:i}))},this.autoBatchAggregationDelayMs)),r}async _getServerInfo(){let r=await(await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/info`,{method:"GET",headers:{...this._mergedHeaders,Accept:"application/json"},signal:AbortSignal.timeout(rz),...this.fetchOptions});return await Y(n,"get server info"),n})).json();return this.debug&&console.log(`
120
+ === LangSmith Server Configuration ===
121
+ `+JSON.stringify(r,null,2)+`
122
+ `),r}async _ensureServerInfo(){return this._getServerInfoPromise===void 0&&(this._getServerInfoPromise=(async()=>{if(this._serverInfo===void 0)try{this._serverInfo=await this._getServerInfo()}catch(t){console.warn(`[LANGSMITH]: Failed to fetch info on supported operations. Falling back to batch operations and default limits. Info: ${t.status??"Unspecified status code"} ${t.message}`)}return this._serverInfo??{}})()),this._getServerInfoPromise.then(t=>(this._serverInfo===void 0&&(this._getServerInfoPromise=void 0),t))}async _getSettings(){return this.settings||(this.settings=this._get("/settings")),await this.settings}async flush(){let t=await this._getBatchSizeLimitBytes(),r=await this._getBatchSizeLimit();await this.drainAutoBatchQueue({batchSizeLimitBytes:t,batchSizeLimit:r})}_cloneCurrentOTELContext(){let t=Zd(),r=kI();if(this.langSmithToOTELTranslator!==void 0){let n=t.getActiveSpan();if(n)return t.setSpan(r.active(),n)}}async createRun(t,r){if(!this._filterForSampling([t]).length)return;let n={...this._mergedHeaders,"Content-Type":"application/json"},i=t.project_name;delete t.project_name;let a=await this.prepareRunCreateOrUpdateInputs({session_name:i,...t,start_time:t.start_time??Date.now()});if(this.autoBatchTracing&&a.trace_id!==void 0&&a.dotted_order!==void 0){let c=this._cloneCurrentOTELContext();this.processRunOperation({action:"create",item:a,otelContext:c,apiKey:r?.apiKey,apiUrl:r?.apiUrl}).catch(console.error);return}let o=qI(a,this.cachedLSEnvVarsForMetadata,this.omitTracedRuntimeInfo);r?.apiKey!==void 0&&(n["x-api-key"]=r.apiKey),r?.workspaceId!==void 0&&(n["x-tenant-id"]=r.workspaceId);let s=Wt(o,`Creating run with id: ${o.id}`);await this.caller.call(async()=>{let c=await this._fetch(`${r?.apiUrl??this.apiUrl}/runs`,{method:"POST",headers:n,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await Y(c,"create run",!0),c})}async batchIngestRuns({runCreates:t,runUpdates:r},n){if(t===void 0&&r===void 0)return;let i=await Promise.all(t?.map(c=>this.prepareRunCreateOrUpdateInputs(c))??[]),a=await Promise.all(r?.map(c=>this.prepareRunCreateOrUpdateInputs(c))??[]);if(i.length>0&&a.length>0){let c=i.reduce((u,d)=>(d.id&&(u[d.id]=d),u),{}),l=[];for(let u of a)u.id!==void 0&&c[u.id]?c[u.id]={...c[u.id],...u}:l.push(u);i=Object.values(c),a=l}let o={post:i,patch:a};if(!o.post.length&&!o.patch.length)return;let s={post:[],patch:[]};for(let c of["post","patch"]){let l=c,u=o[l].reverse(),d=u.pop();for(;d!==void 0;)s[l].push(d),d=u.pop()}if(s.post.length>0||s.patch.length>0){let c=s.post.map(l=>l.id).concat(s.patch.map(l=>l.id)).join(",");await this._postBatchIngestRuns(await this._serializeBody(s,`Ingesting runs with ids: ${c}`),n)}}async _postBatchIngestRuns(t,r){let n={...this._mergedHeaders,"Content-Type":"application/json",Accept:"application/json"};r?.apiKey!==void 0&&(n["x-api-key"]=r.apiKey),await this.batchIngestCaller.callWithOptions({sizeBytes:r?.sizeBytes},async()=>{let i=await this._fetch(`${r?.apiUrl??this.apiUrl}/runs/batch`,{method:"POST",headers:n,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:t});return await Y(i,"batch create run",!0),i})}async multipartIngestRuns({runCreates:t,runUpdates:r},n){if(t===void 0&&r===void 0)return;let i={},a=[];for(let d of t??[]){let f=await this.prepareRunCreateOrUpdateInputs(d);f.id!==void 0&&f.attachments!==void 0&&(i[f.id]=f.attachments),delete f.attachments,a.push(f)}let o=[];for(let d of r??[])o.push(await this.prepareRunCreateOrUpdateInputs(d));if(a.find(d=>d.trace_id===void 0||d.dotted_order===void 0)!==void 0)throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when creating a run');if(o.find(d=>d.trace_id===void 0||d.dotted_order===void 0)!==void 0)throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when updating a run');if(a.length>0&&o.length>0){let d=a.reduce((p,m)=>(m.id&&(p[m.id]=m),p),{}),f=[];for(let p of o)p.id!==void 0&&d[p.id]?d[p.id]={...d[p.id],...p}:f.push(p);a=Object.values(d),o=f}if(a.length===0&&o.length===0)return;let l=[],u=[];for(let[d,f]of[["post",a],["patch",o]])for(let p of f){let{inputs:m,outputs:h,events:_,extra:y,error:w,serialized:x,attachments:S,...E}=p,P={inputs:m,outputs:h,events:_,extra:y,error:w,serialized:x},C=await this._serializeBody(E,`Serializing for multipart ingestion of run with id: ${E.id}`);u.push({name:`${d}.${E.id}`,payload:new Blob([C],{type:`application/json; length=${C.length}`})});for(let[b,B]of Object.entries(P)){if(B===void 0)continue;let L=await this._serializeBody(B,`Serializing ${b} for multipart ingestion of run with id: ${E.id}`);u.push({name:`${d}.${E.id}.${b}`,payload:new Blob([L],{type:`application/json; length=${L.length}`})})}if(E.id!==void 0){let b=i[E.id];if(b){delete i[E.id];for(let[B,L]of Object.entries(b)){let q,ae;if(Array.isArray(L)?[q,ae]=L:(q=L.mimeType,ae=L.data),B.includes(".")){console.warn(`Skipping attachment '${B}' for run ${E.id}: Invalid attachment name. Attachment names must not contain periods ('.'). Please rename the attachment and try again.`);continue}u.push({name:`attachment.${E.id}.${B}`,payload:new Blob([ae],{type:`${q}; length=${ae.byteLength}`})})}}}l.push(`trace=${E.trace_id},id=${E.id}`)}await this._sendMultipartRequest(u,l.join("; "),n)}async _createNodeFetchBody(t,r){let n=[];for(let o of t)n.push(new Blob([`--${r}\r
123
+ `])),n.push(new Blob([`Content-Disposition: form-data; name="${o.name}"\r
124
+ `,`Content-Type: ${o.payload.type}\r
125
+ \r
126
+ `])),n.push(o.payload),n.push(new Blob([`\r
127
+ `]));return n.push(new Blob([`--${r}--\r
128
+ `])),await new Blob(n).arrayBuffer()}async _createMultipartStream(t,r){let n=new TextEncoder;return new ReadableStream({async start(a){let o=async s=>{typeof s=="string"?a.enqueue(n.encode(s)):a.enqueue(s)};for(let s of t){await o(`--${r}\r
129
+ `),await o(`Content-Disposition: form-data; name="${s.name}"\r
130
+ `),await o(`Content-Type: ${s.payload.type}\r
131
+ \r
132
+ `);let l=s.payload.stream().getReader();try{let u;for(;!(u=await l.read()).done;)a.enqueue(u.value)}finally{l.releaseLock()}await o(`\r
133
+ `)}await o(`--${r}--\r
134
+ `),a.close()}})}async _sendMultipartRequest(t,r,n){let i="----LangSmithFormBoundary"+Math.random().toString(36).slice(2),a=()=>this._createNodeFetchBody(t,i),o=()=>this._createMultipartStream(t,i),s=async c=>this.batchIngestCaller.callWithOptions({sizeBytes:n?.sizeBytes},async()=>{let l=await c(),u={...this._mergedHeaders,"Content-Type":`multipart/form-data; boundary=${i}`};n?.apiKey!==void 0&&(u["x-api-key"]=n.apiKey);let d=l;n?.useGzip&&typeof l=="object"&&"pipeThrough"in l&&(d=l.pipeThrough(new CompressionStream("gzip")),u["Content-Encoding"]="gzip");let f=await this._fetch(`${n?.apiUrl??this.apiUrl}/runs/multipart`,{method:"POST",headers:u,body:d,duplex:"half",signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Y(f,"Failed to send multipart request",!0),f});try{let c,l=!1;tI()&&!this.multipartStreamingDisabled&&il()!=="bun"?(l=!0,c=await s(o)):c=await s(a),(!this.multipartStreamingDisabled||l)&&c.status===422&&(n?.apiUrl??this.apiUrl)!==rf&&(console.warn(`Streaming multipart upload to ${n?.apiUrl??this.apiUrl}/runs/multipart failed. This usually means the host does not support chunked uploads. Retrying with a buffered upload for operation "${r}".`),this.multipartStreamingDisabled=!0,c=await s(a))}catch(c){if(tf(c))throw c;if(console.warn(`${c.message.trim()}
135
+
136
+ Context: ${r}`),this.failedTracesDir){let l=await this._createNodeFetchBody(t,i).catch(()=>null);l&&await e._writeTraceToFallbackDir(this.failedTracesDir,l,{"Content-Type":`multipart/form-data; boundary=${i}`},"runs/multipart",this.failedTracesMaxBytes)}}}async updateRun(t,r,n){he(t),r.inputs&&(r.inputs=await this.processInputs(r.inputs)),r.outputs&&(r.outputs=await this.processOutputs(r.outputs)),r.extra!=null&&"metadata"in r.extra&&(r.extra={...r.extra,metadata:await this.processMetadata(r.extra.metadata)}),r.events&&(r.events=this._filterNewTokenEvents(r.events));let i={...r,id:t};if(!this._filterForSampling([i],!0).length)return;if(this.autoBatchTracing&&i.trace_id!==void 0&&i.dotted_order!==void 0){let s=this._cloneCurrentOTELContext();if(r.end_time!==void 0&&i.parent_run_id===void 0&&this.blockOnRootRunFinalization&&!this.manualFlushMode){await this.processRunOperation({action:"update",item:i,otelContext:s,apiKey:n?.apiKey,apiUrl:n?.apiUrl}).catch(console.error);return}else this.processRunOperation({action:"update",item:i,otelContext:s,apiKey:n?.apiKey,apiUrl:n?.apiUrl}).catch(console.error);return}let a={...this._mergedHeaders,"Content-Type":"application/json"};n?.apiKey!==void 0&&(a["x-api-key"]=n.apiKey),n?.workspaceId!==void 0&&(a["x-tenant-id"]=n.workspaceId);let o=Wt(r,`Serializing payload to update run with id: ${t}`);await this.caller.call(async()=>{let s=await this._fetch(`${n?.apiUrl??this.apiUrl}/runs/${t}`,{method:"PATCH",headers:a,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:o});return await Y(s,"update run",!0),s})}async readRun(t,{loadChildRuns:r}={loadChildRuns:!1}){he(t);let n=sl(await this._get(`/runs/${t}`));return r&&(n=await this._loadChildRuns(n)),n}async getRunUrl({runId:t,run:r,projectOpts:n}){if(r!==void 0){let i;r.session_id?i=r.session_id:n?.projectName?i=(await this.readProject({projectName:n?.projectName})).id:n?.projectId?i=n?.projectId:i=(await this.readProject({projectName:Ke("PROJECT")||"default"})).id;let a=await this._getTenantId();return`${this.getHostUrl()}/o/${a}/projects/p/${i}/r/${r.id}?poll=true`}else if(t!==void 0){let i=await this.readRun(t);if(!i.app_path)throw new Error(`Run ${t} has no app_path`);return`${this.getHostUrl()}${i.app_path}`}else throw new Error("Must provide either runId or run")}async _loadChildRuns(t){let r=await Q4(this.listRuns({isRoot:!1,projectId:t.session_id,traceId:t.trace_id})),n={},i={};r.sort((a,o)=>(a?.dotted_order??"").localeCompare(o?.dotted_order??""));for(let a of r){if(a.parent_run_id===null||a.parent_run_id===void 0)throw new Error(`Child run ${a.id} has no parent`);a.dotted_order?.startsWith(t.dotted_order??"")&&a.id!==t.id&&(a.parent_run_id in n||(n[a.parent_run_id]=[]),n[a.parent_run_id].push(a),i[a.id]=a)}t.child_runs=n[t.id]||[];for(let a in n)a!==t.id&&(i[a].child_runs=n[a]);return t}async*listRuns(t){let{projectId:r,projectName:n,parentRunId:i,traceId:a,referenceExampleId:o,startTime:s,executionOrder:c,isRoot:l,runType:u,error:d,id:f,query:p,filter:m,traceFilter:h,treeFilter:_,limit:y,select:w,order:x}=t,S=[];if(r&&(S=Array.isArray(r)?r:[r]),n){let b=Array.isArray(n)?n:[n],B=await Promise.all(b.map(L=>this.readProject({projectName:L}).then(q=>q.id)));S.push(...B)}let E=["app_path","completion_cost","completion_tokens","dotted_order","end_time","error","events","extra","feedback_stats","first_token_time","id","inputs","name","outputs","parent_run_id","parent_run_ids","prompt_cost","prompt_tokens","reference_example_id","run_type","session_id","start_time","status","tags","total_cost","total_tokens","trace_id"],P={session:S.length?S:null,run_type:u,reference_example:o,query:p,filter:m,trace_filter:h,tree_filter:_,execution_order:c,parent_run:i,start_time:s?s.toISOString():null,error:d,id:f,limit:y,trace:a,select:w||E,is_root:l,order:x};P.select.includes("child_run_ids")&&ao("Deprecated: 'child_run_ids' in the listRuns select parameter is deprecated and will be removed in a future version.");let C=0;for await(let b of this._getCursorPaginatedList("/runs/query",P)){let B=b.map(sl);if(y){if(C>=y)break;if(B.length+C>y){yield*B.slice(0,y-C);break}C+=B.length,yield*B}else yield*B}}async*listGroupRuns(t){let{projectId:r,projectName:n,groupBy:i,filter:a,startTime:o,endTime:s,limit:c,offset:l}=t,d={session_id:r||(await this.readProject({projectName:n})).id,group_by:i,filter:a,start_time:o?o.toISOString():null,end_time:s?s.toISOString():null,limit:Number(c)||100},f=Number(l)||0,p="/runs/group",m=`${this.apiUrl}${p}`;for(;;){let h={...d,offset:f},_=Object.fromEntries(Object.entries(h).filter(([P,C])=>C!==void 0)),y=JSON.stringify(_),x=await(await this.caller.call(async()=>{let P=await this._fetch(m,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:y});return await Y(P,`Failed to fetch ${p}`),P})).json(),{groups:S,total:E}=x;if(S.length===0)break;for(let P of S)yield P;if(f+=S.length,f>=E)break}}async*readThread(t){let{threadId:r,projectId:n,projectName:i,isRoot:a=!0,limit:o,filter:s,order:c="asc"}=t;if(!n&&!i)throw new Error("threadId requires projectId or projectName");let l=`eq(thread_id, ${JSON.stringify(r)})`,u=s?`and(${l}, ${s})`:l;yield*this.listRuns({projectId:n??void 0,projectName:i??void 0,isRoot:a,limit:o,filter:u,order:c})}async listThreads(t){let{projectId:r,projectName:n,limit:i,offset:a=0,filter:o,startTime:s,isRoot:c=!0}=t;if(!r&&!n)throw new Error("Either projectId or projectName must be provided");if(r&&n)throw new Error("Provide exactly one of projectId or projectName");let l=r??(await this.readProject({projectName:n})).id,u=s??new Date(Date.now()-1440*60*1e3),f={session:[l],is_root:c,limit:100,order:"desc",select:["id","name","status","start_time","end_time","thread_id","trace_id","run_type","error","tags","session_id","parent_run_id","total_tokens","total_cost","dotted_order","reference_example_id","feedback_stats","app_path","completion_cost","completion_tokens","prompt_cost","prompt_tokens","first_token_time"],start_time:u.toISOString()};o!=null&&(f.filter=o);let p=new Map;for await(let y of this._getCursorPaginatedList("/runs/query",f))for(let w of y){let x=sl(w),S=x.thread_id;if(S){let E=p.get(S)??[];E.push(x),p.set(S,E)}}let m=[];for(let[y,w]of p.entries()){w.sort((C,b)=>{let B=C,L=b,q=B.start_time??"",ae=L.start_time??"";if(q!==ae)return q.localeCompare(ae);let Se=B.dotted_order??"",Oe=L.dotted_order??"";return Se.localeCompare(Oe)});let S=[...w.map(C=>C.start_time).filter(Boolean)].sort(),E=S.length?S[0]:"",P=S.length?S[S.length-1]:"";m.push({thread_id:y,runs:w,count:w.length,filter:"",total_tokens:0,total_cost:null,min_start_time:E,max_start_time:P,latency_p50:0,latency_p99:0,feedback_stats:null,first_inputs:"",last_outputs:"",last_error:null})}m.sort((y,w)=>{let x=y.max_start_time??"";return(w.max_start_time??"").localeCompare(x)});let h=a>0?m.slice(a):m;return i!==void 0?h.slice(0,i):h}async getRunStats({id:t,trace:r,parentRun:n,runType:i,projectNames:a,projectIds:o,referenceExampleIds:s,startTime:c,endTime:l,error:u,query:d,filter:f,traceFilter:p,treeFilter:m,isRoot:h,dataSourceType:_}){let y=o||[];a&&(y=[...o||[],...await Promise.all(a.map(C=>this.readProject({projectName:C}).then(b=>b.id)))]);let x=Object.fromEntries(Object.entries({id:t,trace:r,parent_run:n,run_type:i,session:y,reference_example:s,start_time:c,end_time:l,error:u,query:d,filter:f,trace_filter:p,tree_filter:m,is_root:h,data_source_type:_}).filter(([C,b])=>b!==void 0)),S=JSON.stringify(x);return await(await this.caller.call(async()=>{let C=await this._fetch(`${this.apiUrl}/runs/stats`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:S});return await Y(C,"get run stats"),C})).json()}async shareRun(t,{shareId:r}={}){let n={run_id:t,share_token:r||io()};he(t);let i=JSON.stringify(n),o=await(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}/runs/${t}/share`,{method:"PUT",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:i});return await Y(s,"share run"),s})).json();if(o===null||!("share_token"in o))throw new Error("Invalid response from server");return`${this.getHostUrl()}/public/${o.share_token}/r`}async unshareRun(t){he(t),await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/runs/${t}/share`,{method:"DELETE",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Y(r,"unshare run",!0),r})}async readRunSharedLink(t){he(t);let n=await(await this.caller.call(async()=>{let i=await this._fetch(`${this.apiUrl}/runs/${t}/share`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Y(i,"read run shared link"),i})).json();if(!(n===null||!("share_token"in n)))return`${this.getHostUrl()}/public/${n.share_token}/r`}async listSharedRuns(t,{runIds:r}={}){let n=new URLSearchParams({share_token:t});if(r!==void 0)for(let o of r)n.append("id",o);return he(t),(await(await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/public/${t}/runs${n}`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Y(o,"list shared runs"),o})).json()).map(sl)}async readDatasetSharedSchema(t,r){if(!t&&!r)throw new Error("Either datasetId or datasetName must be given");t||(t=(await this.readDataset({datasetName:r})).id),he(t);let i=await(await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/datasets/${t}/share`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Y(a,"read dataset shared schema"),a})).json();return i.url=`${this.getHostUrl()}/public/${i.share_token}/d`,i}async shareDataset(t,r){if(!t&&!r)throw new Error("Either datasetId or datasetName must be given");t||(t=(await this.readDataset({datasetName:r})).id);let n={dataset_id:t};he(t);let i=JSON.stringify(n),o=await(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}/datasets/${t}/share`,{method:"PUT",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:i});return await Y(s,"share dataset"),s})).json();return o.url=`${this.getHostUrl()}/public/${o.share_token}/d`,o}async unshareDataset(t){he(t),await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/datasets/${t}/share`,{method:"DELETE",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Y(r,"unshare dataset",!0),r})}async readSharedDataset(t){return he(t),await(await this.caller.call(async()=>{let i=await this._fetch(`${this.apiUrl}/public/${t}/datasets`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Y(i,"read shared dataset"),i})).json()}async listSharedExamples(t,r){let n={};r?.exampleIds&&(n.id=r.exampleIds);let i=new URLSearchParams;Object.entries(n).forEach(([s,c])=>{Array.isArray(c)?c.forEach(l=>i.append(s,l)):i.append(s,c)});let a=await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}/public/${t}/examples?${i.toString()}`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Y(s,"list shared examples"),s}),o=await a.json();if(!a.ok)throw"detail"in o?new Error(`Failed to list shared examples.
137
+ Status: ${a.status}
138
+ Message: ${Array.isArray(o.detail)?o.detail.join(`
139
+ `):"Unspecified error"}`):new Error(`Failed to list shared examples: ${a.status} ${a.statusText}`);return o.map(s=>({...s,_hostUrl:this.getHostUrl()}))}async createProject({projectName:t,description:r=null,metadata:n=null,upsert:i=!1,projectExtra:a=null,referenceDatasetId:o=null}){let s=i?"?upsert=true":"",c=`${this.apiUrl}/sessions${s}`,l=a||{};n&&(l.metadata=n);let u={name:t,extra:l,description:r};o!==null&&(u.reference_dataset_id=o);let d=JSON.stringify(u);return await(await this.caller.call(async()=>{let m=await this._fetch(c,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:d});return await Y(m,"create project"),m})).json()}async updateProject(t,{name:r=null,description:n=null,metadata:i=null,projectExtra:a=null,endTime:o=null}){let s=`${this.apiUrl}/sessions/${t}`,c=a;i&&(c={...c||{},metadata:i});let l=JSON.stringify({name:r,extra:c,description:n,end_time:o?new Date(o).toISOString():null});return await(await this.caller.call(async()=>{let f=await this._fetch(s,{method:"PATCH",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:l});return await Y(f,"update project"),f})).json()}async hasProject({projectId:t,projectName:r}){let n="/sessions",i=new URLSearchParams;if(t!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");if(t!==void 0)he(t),n+=`/${t}`;else if(r!==void 0)i.append("name",r);else throw new Error("Must provide projectName or projectId");let a=await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}${n}?${i}`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Y(o,"has project"),o});try{let o=await a.json();return a.ok?Array.isArray(o)?o.length>0:!0:!1}catch{return!1}}async readProject({projectId:t,projectName:r,includeStats:n}){let i="/sessions",a=new URLSearchParams;if(t!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");if(t!==void 0)he(t),i+=`/${t}`;else if(r!==void 0)a.append("name",r);else throw new Error("Must provide projectName or projectId");n!==void 0&&a.append("include_stats",n.toString());let o=await this._get(i,a),s;if(Array.isArray(o)){if(o.length===0)throw new Error(`Project[id=${t}, name=${r}] not found`);s=o[0]}else s=o;return s}async getProjectUrl({projectId:t,projectName:r}){if(t===void 0&&r===void 0)throw new Error("Must provide either projectName or projectId");let n=await this.readProject({projectId:t,projectName:r}),i=await this._getTenantId();return`${this.getHostUrl()}/o/${i}/projects/p/${n.id}`}async getDatasetUrl({datasetId:t,datasetName:r}){if(t===void 0&&r===void 0)throw new Error("Must provide either datasetName or datasetId");let n=await this.readDataset({datasetId:t,datasetName:r}),i=await this._getTenantId();return`${this.getHostUrl()}/o/${i}/datasets/${n.id}`}async _getTenantId(){if(this._tenantId!==null)return this._tenantId;let t=new URLSearchParams({limit:"1"});for await(let r of this._getPaginated("/sessions",t))return this._tenantId=r[0].tenant_id,r[0].tenant_id;throw new Error("No projects found to resolve tenant.")}async*listProjects({projectIds:t,name:r,nameContains:n,referenceDatasetId:i,referenceDatasetName:a,includeStats:o,datasetVersion:s,referenceFree:c,metadata:l}={}){let u=new URLSearchParams;if(t!==void 0)for(let d of t)u.append("id",d);if(r!==void 0&&u.append("name",r),n!==void 0&&u.append("name_contains",n),i!==void 0)u.append("reference_dataset",i);else if(a!==void 0){let d=await this.readDataset({datasetName:a});u.append("reference_dataset",d.id)}o!==void 0&&u.append("include_stats",o.toString()),s!==void 0&&u.append("dataset_version",s),c!==void 0&&u.append("reference_free",c.toString()),l!==void 0&&u.append("metadata",JSON.stringify(l));for await(let d of this._getPaginated("/sessions",u))yield*d}async deleteProject({projectId:t,projectName:r}){let n;if(t===void 0&&r===void 0)throw new Error("Must provide projectName or projectId");if(t!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");t===void 0?n=(await this.readProject({projectName:r})).id:n=t,he(n),await this.caller.call(async()=>{let i=await this._fetch(`${this.apiUrl}/sessions/${n}`,{method:"DELETE",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Y(i,`delete session ${n} (${r})`,!0),i})}async uploadCsv({csvFile:t,fileName:r,inputKeys:n,outputKeys:i,description:a,dataType:o,name:s}){let c=`${this.apiUrl}/datasets/upload`,l=new FormData,u=new Blob([t],{type:"text/csv"});return l.append("file",u,r),n.forEach(p=>{l.append("input_keys",p)}),i.forEach(p=>{l.append("output_keys",p)}),a&&l.append("description",a),o&&l.append("data_type",o),s&&l.append("name",s),await(await this.caller.call(async()=>{let p=await this._fetch(c,{method:"POST",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:l});return await Y(p,"upload CSV"),p})).json()}async createDataset(t,{description:r,dataType:n,inputsSchema:i,outputsSchema:a,metadata:o}={}){let s={name:t,description:r,extra:{source:"sdk",...o?{metadata:o}:{}}};n&&(s.data_type=n),i&&(s.inputs_schema_definition=i),a&&(s.outputs_schema_definition=a);let c=JSON.stringify(s);return await(await this.caller.call(async()=>{let d=await this._fetch(`${this.apiUrl}/datasets`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await Y(d,"create dataset"),d})).json()}async readDataset({datasetId:t,datasetName:r}){let n="/datasets",i=new URLSearchParams({limit:"1"});if(t&&r)throw new Error("Must provide either datasetName or datasetId, not both");if(t)he(t),n+=`/${t}`;else if(r)i.append("name",r);else throw new Error("Must provide datasetName or datasetId");let a=await this._get(n,i),o;if(Array.isArray(a)){if(a.length===0)throw new Error(`Dataset[id=${t}, name=${r}] not found`);o=a[0]}else o=a;return o}async hasDataset({datasetId:t,datasetName:r}){try{return await this.readDataset({datasetId:t,datasetName:r}),!0}catch(n){if(n instanceof Error&&n.message.toLocaleLowerCase().includes("not found"))return!1;throw n}}async diffDatasetVersions({datasetId:t,datasetName:r,fromVersion:n,toVersion:i}){let a=t;if(a===void 0&&r===void 0)throw new Error("Must provide either datasetName or datasetId");if(a!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");a===void 0&&(a=(await this.readDataset({datasetName:r})).id);let o=new URLSearchParams({from_version:typeof n=="string"?n:n.toISOString(),to_version:typeof i=="string"?i:i.toISOString()});return await this._get(`/datasets/${a}/versions/diff`,o)}async readDatasetOpenaiFinetuning({datasetId:t,datasetName:r}){let n="/datasets";if(t===void 0)if(r!==void 0)t=(await this.readDataset({datasetName:r})).id;else throw new Error("Must provide either datasetName or datasetId");return(await(await this._getResponse(`${n}/${t}/openai_ft`)).text()).trim().split(`
140
+ `).map(s=>JSON.parse(s))}async*listDatasets({limit:t=100,offset:r=0,datasetIds:n,datasetName:i,datasetNameContains:a,metadata:o}={}){let s="/datasets",c=new URLSearchParams({limit:t.toString(),offset:r.toString()});if(n!==void 0)for(let l of n)c.append("id",l);i!==void 0&&c.append("name",i),a!==void 0&&c.append("name_contains",a),o!==void 0&&c.append("metadata",JSON.stringify(o));for await(let l of this._getPaginated(s,c))yield*l}async updateDataset(t){let{datasetId:r,datasetName:n,...i}=t;if(!r&&!n)throw new Error("Must provide either datasetName or datasetId");let a=r??(await this.readDataset({datasetName:n})).id;he(a);let o=JSON.stringify(i);return await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/datasets/${a}`,{method:"PATCH",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:o});return await Y(c,"update dataset"),c})).json()}async updateDatasetTag(t){let{datasetId:r,datasetName:n,asOf:i,tag:a}=t;if(!r&&!n)throw new Error("Must provide either datasetName or datasetId");let o=r??(await this.readDataset({datasetName:n})).id;he(o);let s=JSON.stringify({as_of:typeof i=="string"?i:i.toISOString(),tag:a});await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/datasets/${o}/tags`,{method:"PUT",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await Y(c,"update dataset tags",!0),c})}async deleteDataset({datasetId:t,datasetName:r}){let n="/datasets",i=t;if(t!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(r!==void 0&&(i=(await this.readDataset({datasetName:r})).id),i!==void 0)he(i),n+=`/${i}`;else throw new Error("Must provide datasetName or datasetId");await this.caller.call(async()=>{let a=await this._fetch(this.apiUrl+n,{method:"DELETE",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Y(a,`delete ${n}`,!0),a})}async createExample(t,r,n){if(XI(t)&&(r!==void 0||n!==void 0))throw new Error("Cannot provide outputs or options when using ExampleCreate object");let i=r?n?.datasetId:t.dataset_id,a=r?n?.datasetName:t.dataset_name;if(i===void 0&&a===void 0)throw new Error("Must provide either datasetName or datasetId");if(i!==void 0&&a!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");i===void 0&&(i=(await this.readDataset({datasetName:a})).id);let o=(r?n?.createdAt:t.created_at)||new Date,s;XI(t)?s=t:s={inputs:t,outputs:r,created_at:o?.toISOString(),id:n?.exampleId,metadata:n?.metadata,split:n?.split,source_run_id:n?.sourceRunId,use_source_run_io:n?.useSourceRunIO,use_source_run_attachments:n?.useSourceRunAttachments,attachments:n?.attachments};let c=await this._uploadExamplesMultipart(i,[s]);return await this.readExample(c.example_ids?.[0]??io())}async createExamples(t){if(Array.isArray(t)){if(t.length===0)return[];let w=t,x=w[0].dataset_id,S=w[0].dataset_name;if(x===void 0&&S===void 0)throw new Error("Must provide either datasetName or datasetId");if(x!==void 0&&S!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");x===void 0&&(x=(await this.readDataset({datasetName:S})).id);let E=await this._uploadExamplesMultipart(x,w);return await Promise.all(E.example_ids.map(C=>this.readExample(C)))}let{inputs:r,outputs:n,metadata:i,splits:a,sourceRunIds:o,useSourceRunIOs:s,useSourceRunAttachments:c,attachments:l,exampleIds:u,datasetId:d,datasetName:f}=t;if(r===void 0)throw new Error("Must provide inputs when using legacy parameters");let p=d,m=f;if(p===void 0&&m===void 0)throw new Error("Must provide either datasetName or datasetId");if(p!==void 0&&m!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");p===void 0&&(p=(await this.readDataset({datasetName:m})).id);let h=r.map((w,x)=>({dataset_id:p,inputs:w,outputs:n?.[x],metadata:i?.[x],split:a?.[x],id:u?.[x],attachments:l?.[x],source_run_id:o?.[x],use_source_run_io:s?.[x],use_source_run_attachments:c?.[x]})),_=await this._uploadExamplesMultipart(p,h);return await Promise.all(_.example_ids.map(w=>this.readExample(w)))}async createLLMExample(t,r,n){return this.createExample({input:t},{output:r},n)}async createChatExample(t,r,n){let i=t.map(o=>t_(o)?r_(o):o),a=t_(r)?r_(r):r;return this.createExample({input:i},{output:a},n)}async readExample(t){he(t);let r=`/examples/${t}`,n=await this._get(r),{attachment_urls:i,...a}=n,o=a;return i&&(o.attachments=Object.entries(i).reduce((s,[c,l])=>(s[c.slice(11)]={presigned_url:l.presigned_url,mime_type:l.mime_type},s),{})),o}async*listExamples({datasetId:t,datasetName:r,exampleIds:n,asOf:i,splits:a,inlineS3Urls:o,metadata:s,limit:c,offset:l,filter:u,includeAttachments:d}={}){let f;if(t!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(t!==void 0)f=t;else if(r!==void 0)f=(await this.readDataset({datasetName:r})).id;else throw new Error("Must provide a datasetName or datasetId");let p=new URLSearchParams({dataset:f}),m=i?typeof i=="string"?i:i?.toISOString():void 0;m&&p.append("as_of",m);let h=o??!0;if(p.append("inline_s3_urls",h.toString()),n!==void 0)for(let y of n)p.append("id",y);if(a!==void 0)for(let y of a)p.append("splits",y);if(s!==void 0){let y=JSON.stringify(s);p.append("metadata",y)}c!==void 0&&p.append("limit",c.toString()),l!==void 0&&p.append("offset",l.toString()),u!==void 0&&p.append("filter",u),d===!0&&["attachment_urls","outputs","metadata"].forEach(y=>p.append("select",y));let _=0;for await(let y of this._getPaginated("/examples",p)){for(let w of y){let{attachment_urls:x,...S}=w,E=S;x&&(E.attachments=Object.entries(x).reduce((P,[C,b])=>(P[C.slice(11)]={presigned_url:b.presigned_url,mime_type:b.mime_type||void 0},P),{})),yield E,_++}if(c!==void 0&&_>=c)break}}async deleteExample(t){he(t);let r=`/examples/${t}`;await this.caller.call(async()=>{let n=await this._fetch(this.apiUrl+r,{method:"DELETE",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Y(n,`delete ${r}`,!0),n})}async deleteExamples(t,r){if(t.forEach(n=>he(n)),r?.hardDelete){let n=this._getPlatformEndpointPath("datasets/examples/delete");await this.caller.call(async()=>{let i=await this._fetch(`${this.apiUrl}${n}`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},body:JSON.stringify({example_ids:t,hard_delete:!0}),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Y(i,"hard delete examples",!0),i})}else{let n=new URLSearchParams;t.forEach(i=>n.append("example_ids",i)),await this.caller.call(async()=>{let i=await this._fetch(`${this.apiUrl}/examples?${n.toString()}`,{method:"DELETE",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Y(i,"delete examples",!0),i})}}async updateExample(t,r){let n;r?n=t:n=t.id,he(n);let i;r?i={id:n,...r}:i=t;let a;return i.dataset_id!==void 0?a=i.dataset_id:a=(await this.readExample(n)).dataset_id,this._updateExamplesMultipart(a,[i])}async updateExamples(t){let r;return t[0].dataset_id===void 0?r=(await this.readExample(t[0].id)).dataset_id:r=t[0].dataset_id,this._updateExamplesMultipart(r,t)}async readDatasetVersion({datasetId:t,datasetName:r,asOf:n,tag:i}){let a;if(t?a=t:a=(await this.readDataset({datasetName:r})).id,he(a),n&&i||!n&&!i)throw new Error("Exactly one of asOf and tag must be specified.");let o=new URLSearchParams;return n!==void 0&&o.append("as_of",typeof n=="string"?n:n.toISOString()),i!==void 0&&o.append("tag",i),await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/datasets/${a}/version?${o.toString()}`,{method:"GET",headers:{...this._mergedHeaders},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Y(c,"read dataset version"),c})).json()}async listDatasetSplits({datasetId:t,datasetName:r,asOf:n}){let i;if(t===void 0&&r===void 0)throw new Error("Must provide dataset name or ID");if(t!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");t===void 0?i=(await this.readDataset({datasetName:r})).id:i=t,he(i);let a=new URLSearchParams,o=n?typeof n=="string"?n:n?.toISOString():void 0;return o&&a.append("as_of",o),await this._get(`/datasets/${i}/splits`,a)}async updateDatasetSplits({datasetId:t,datasetName:r,splitName:n,exampleIds:i,remove:a=!1}){let o;if(t===void 0&&r===void 0)throw new Error("Must provide dataset name or ID");if(t!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");t===void 0?o=(await this.readDataset({datasetName:r})).id:o=t,he(o);let s={split_name:n,examples:i.map(l=>(he(l),l)),remove:a},c=JSON.stringify(s);await this.caller.call(async()=>{let l=await this._fetch(`${this.apiUrl}/datasets/${o}/splits`,{method:"PUT",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await Y(l,"update dataset splits",!0),l})}async createFeedback(t,r,{score:n,value:i,correction:a,comment:o,sourceInfo:s,feedbackSourceType:c="api",sourceRunId:l,feedbackId:u,feedbackConfig:d,projectId:f,comparativeExperimentId:p,sessionId:m,startTime:h}){if(!t&&!f)throw new Error("One of runId or projectId must be provided");if(t&&f)throw new Error("Only one of runId or projectId can be provided");let _={type:c??"api",metadata:s??{}};l!==void 0&&_?.metadata!==void 0&&!_.metadata.__run&&(_.metadata.__run={run_id:l}),_?.metadata!==void 0&&_.metadata.__run?.run_id!==void 0&&he(_.metadata.__run.run_id);let y={id:u??gs(),run_id:t,key:r,score:YI(n),value:i,correction:a,comment:o,feedback_source:_,comparative_experiment_id:p,feedbackConfig:d,session_id:m??f,start_time:h},w=JSON.stringify(y),x=`${this.apiUrl}/feedback`;return await this.caller.call(async()=>{let S=await this._fetch(x,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:w});return await Y(S,"create feedback",!0),S}),y}async updateFeedback(t,{score:r,value:n,correction:i,comment:a}){let o={};r!=null&&(o.score=YI(r)),n!=null&&(o.value=n),i!=null&&(o.correction=i),a!=null&&(o.comment=a),he(t);let s=JSON.stringify(o);await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/feedback/${t}`,{method:"PATCH",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await Y(c,"update feedback",!0),c})}async readFeedback(t){he(t);let r=`/feedback/${t}`;return await this._get(r)}async deleteFeedback(t){he(t);let r=`/feedback/${t}`;await this.caller.call(async()=>{let n=await this._fetch(this.apiUrl+r,{method:"DELETE",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Y(n,`delete ${r}`,!0),n})}async*listFeedback({runIds:t,feedbackKeys:r,feedbackSourceTypes:n}={}){let i=new URLSearchParams;if(t)for(let a of t)he(a),i.append("run",a);if(r)for(let a of r)i.append("key",a);if(n)for(let a of n)i.append("source",a);for await(let a of this._getPaginated("/feedback",i))yield*a}async createPresignedFeedbackToken(t,r,{expiration:n,feedbackConfig:i}={}){let a={run_id:t,feedback_key:r,feedback_config:i};n?typeof n=="string"?a.expires_at=n:(n?.hours||n?.minutes||n?.days)&&(a.expires_in=n):a.expires_in={hours:3};let o=JSON.stringify(a);return await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/feedback/tokens`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:o});return await Y(c,"create presigned feedback token"),c})).json()}async createComparativeExperiment({name:t,experimentIds:r,referenceDatasetId:n,createdAt:i,description:a,metadata:o,id:s}){if(r.length===0)throw new Error("At least one experiment is required");if(n||(n=(await this.readProject({projectId:r[0]})).reference_dataset_id),!n==null)throw new Error("A reference dataset is required");let c={id:s,name:t,experiment_ids:r,reference_dataset_id:n,description:a,created_at:(i??new Date)?.toISOString(),extra:{}};o&&(c.extra.metadata=o);let l=JSON.stringify(c);return(await this.caller.call(async()=>{let d=await this._fetch(`${this.apiUrl}/datasets/comparative`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:l});return await Y(d,"create comparative experiment"),d})).json()}async*listPresignedFeedbackTokens(t){he(t);let r=new URLSearchParams({run_id:t});for await(let n of this._getPaginated("/feedback/tokens",r))yield*n}_selectEvalResults(t){let r;return"results"in t?r=t.results:Array.isArray(t)?r=t:r=[t],r}async _logEvaluationFeedback(t,r,n){let i=this._selectEvalResults(t),a=[];for(let o of i){let s=n||{};o.evaluatorInfo&&(s={...o.evaluatorInfo,...s});let c=null;o.targetRunId?c=o.targetRunId:r&&(c=r.id),a.push(await this.createFeedback(c,o.key,{score:o.score,value:o.value,comment:o.comment,correction:o.correction,sourceInfo:s,sourceRunId:o.sourceRunId,feedbackConfig:o.feedbackConfig,feedbackSourceType:"model",sessionId:r?.session_id,startTime:r?.start_time}))}return[i,a]}async logEvaluationFeedback(t,r,n){let[i]=await this._logEvaluationFeedback(t,r,n);return i}async createFeedbackConfig(t){let{feedbackKey:r,feedbackConfig:n,isLowerScoreBetter:i=!1}=t,a={feedback_key:r,feedback_config:n,is_lower_score_better:i};return(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}/feedback-configs`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:JSON.stringify(a)});return await Y(s,"create feedback config"),s})).json()}async*listFeedbackConfigs(t={}){let{feedbackKeys:r,nameContains:n,limit:i}=t,a=new URLSearchParams;r&&r.forEach(s=>{a.append("key",s)}),n&&a.append("name_contains",n),a.append("limit",(i!==void 0?Math.min(i,100):100).toString());let o=0;for await(let s of this._getPaginated("/feedback-configs",a))if(yield*s,o+=s.length,i!==void 0&&o>=i)break}async updateFeedbackConfig(t,r={}){let{feedbackConfig:n,isLowerScoreBetter:i}=r,a={feedback_key:t};return n!==void 0&&(a.feedback_config=n),i!==void 0&&(a.is_lower_score_better=i),(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}/feedback-configs`,{method:"PATCH",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:JSON.stringify(a)});return await Y(s,"update feedback config"),s})).json()}async deleteFeedbackConfig(t){let r=new URLSearchParams({feedback_key:t});await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/feedback-configs?${r}`,{method:"DELETE",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Y(n,"delete feedback config",!0),n})}async*listAnnotationQueues(t={}){let{queueIds:r,name:n,nameContains:i,limit:a}=t,o=new URLSearchParams;r&&r.forEach((c,l)=>{he(c,`queueIds[${l}]`),o.append("ids",c)}),n&&o.append("name",n),i&&o.append("name_contains",i),o.append("limit",(a!==void 0?Math.min(a,100):100).toString());let s=0;for await(let c of this._getPaginated("/annotation-queues",o))if(yield*c,s++,a!==void 0&&s>=a)break}async createAnnotationQueue(t){let{name:r,description:n,queueId:i,rubricInstructions:a,rubricItems:o}=t,s={name:r,description:n,id:i||io(),rubric_instructions:a,rubric_items:o},c=JSON.stringify(Object.fromEntries(Object.entries(s).filter(([u,d])=>d!==void 0)));return(await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/annotation-queues`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await Y(u,"create annotation queue"),u})).json()}async readAnnotationQueue(t){return(await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/annotation-queues/${he(t,"queueId")}`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Y(n,"read annotation queue"),n})).json()}async updateAnnotationQueue(t,r){let{name:n,description:i,rubricInstructions:a,rubricItems:o}=r,s={};n!==void 0&&(s.name=n),i!==void 0&&(s.description=i),a!==void 0&&(s.rubric_instructions=a),o!==void 0&&(s.rubric_items=o);let c=JSON.stringify(s);await this.caller.call(async()=>{let l=await this._fetch(`${this.apiUrl}/annotation-queues/${he(t,"queueId")}`,{method:"PATCH",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await Y(l,"update annotation queue",!0),l})}async deleteAnnotationQueue(t){await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/annotation-queues/${he(t,"queueId")}`,{method:"DELETE",headers:{...this._mergedHeaders,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Y(r,"delete annotation queue",!0),r})}async addRunsToAnnotationQueue(t,r){let n=JSON.stringify(r.map((i,a)=>he(i,`runIds[${a}]`).toString()));await this.caller.call(async()=>{let i=await this._fetch(`${this.apiUrl}/annotation-queues/${he(t,"queueId")}/runs`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await Y(i,"add runs to annotation queue",!0),i})}async getRunFromAnnotationQueue(t,r){let n=`/annotation-queues/${he(t,"queueId")}/run`,a=await(await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}${n}/${r}`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Y(o,"get run from annotation queue"),o})).json();return sl(a)}async deleteRunFromAnnotationQueue(t,r){await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/annotation-queues/${he(t,"queueId")}/runs/${he(r,"queueRunId")}`,{method:"DELETE",headers:{...this._mergedHeaders,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Y(n,"delete run from annotation queue",!0),n})}async getSizeFromAnnotationQueue(t){return(await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/annotation-queues/${he(t,"queueId")}/size`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Y(n,"get size from annotation queue"),n})).json()}async _currentTenantIsOwner(t){let r=await this._getSettings();return t=="-"||r.tenant_handle===t}async _ownerConflictError(t,r){let n=await this._getSettings();return new Error(`Cannot ${t} for another tenant.
141
+
142
+ Current tenant: ${n.tenant_handle}
143
+
144
+ Requested tenant: ${r}`)}async _getLatestCommitHash(t){let n=await(await this.caller.call(async()=>{let i=await this._fetch(`${this.apiUrl}/commits/${t}/?limit=1&offset=0`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Y(i,"get latest commit hash"),i})).json();if(n.commits.length!==0)return n.commits[0].commit_hash}async _likeOrUnlikePrompt(t,r){let[n,i,a]=Gt(t),o=JSON.stringify({like:r});return(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/likes/${n}/${i}`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:o});return await Y(c,`${r?"like":"unlike"} prompt`),c})).json()}async _getPromptUrl(t){let[r,n,i]=Gt(t);if(await this._currentTenantIsOwner(r)){let a=await this._getSettings();return i!=="latest"?`${this.getHostUrl()}/prompts/${n}/${i.substring(0,8)}?organizationId=${a.id}`:`${this.getHostUrl()}/prompts/${n}?organizationId=${a.id}`}else return i!=="latest"?`${this.getHostUrl()}/hub/${r}/${n}/${i.substring(0,8)}`:`${this.getHostUrl()}/hub/${r}/${n}`}async promptExists(t){return!!await this.getPrompt(t)}async likePrompt(t){return this._likeOrUnlikePrompt(t,!0)}async unlikePrompt(t){return this._likeOrUnlikePrompt(t,!1)}async*listCommits(t){let[r,n,i]=Gt(t);for await(let a of this._getPaginated(`/commits/${r}/${n}/`,new URLSearchParams,o=>o.commits))yield*a}async*listPrompts(t){let r=new URLSearchParams;r.append("sort_field",t?.sortField??"updated_at"),r.append("sort_direction","desc"),r.append("is_archived",(!!t?.isArchived).toString()),t?.isPublic!==void 0&&r.append("is_public",t.isPublic.toString()),t?.query&&r.append("query",t.query);for await(let n of this._getPaginated("/repos",r,i=>i.repos))yield*n}async getPrompt(t){let[r,n,i]=Gt(t),o=await(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}/repos/${r}/${n}`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return s?.status===404?null:(await Y(s,"get prompt"),s)}))?.json();return o?.repo?o.repo:null}async createPrompt(t,r){let n=await this._getSettings();if(r?.isPublic&&!n.tenant_handle)throw new Error(`Cannot create a public prompt without first
145
+
146
+ creating a LangChain Hub handle.
147
+ You can add a handle by creating a public prompt at:
148
+
149
+ https://smith.langchain.com/prompts`);let[i,a,o]=Gt(t);if(!await this._currentTenantIsOwner(i))throw await this._ownerConflictError("create a prompt",i);let s={repo_handle:a,...r?.description&&{description:r.description},...r?.readme&&{readme:r.readme},...r?.tags&&{tags:r.tags},is_public:!!r?.isPublic},c=JSON.stringify(s),l=await this.caller.call(async()=>{let d=await this._fetch(`${this.apiUrl}/repos/`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await Y(d,"create prompt"),d}),{repo:u}=await l.json();return u}async createCommit(t,r,n){if(!await this.promptExists(t))throw new Error("Prompt does not exist, you must create it first.");let[i,a,o]=Gt(t),s=n?.parentCommitHash==="latest"||!n?.parentCommitHash?await this._getLatestCommitHash(`${i}/${a}`):n?.parentCommitHash,c={manifest:JSON.parse(JSON.stringify(r)),parent_commit:s,...n?.description!==void 0&&{description:n.description}},l=JSON.stringify(c),d=await(await this.caller.call(async()=>{let f=await this._fetch(`${this.apiUrl}/commits/${i}/${a}`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:l});return await Y(f,"create commit"),f})).json();return this._getPromptUrl(`${i}/${a}${d.commit_hash?`:${d.commit_hash}`:""}`)}async updateExamplesMultipart(t,r=[]){return this._updateExamplesMultipart(t,r)}async _updateExamplesMultipart(t,r=[]){if(!await this._getDatasetExamplesMultiPartSupport())throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");let n=new FormData;for(let o of r){let s=o.id,c={...o.metadata&&{metadata:o.metadata},...o.split&&{split:o.split}},l=Wt(c,`Serializing body for example with id: ${s}`),u=new Blob([l],{type:"application/json"});if(n.append(s,u),o.inputs){let d=Wt(o.inputs,`Serializing inputs for example with id: ${s}`),f=new Blob([d],{type:"application/json"});n.append(`${s}.inputs`,f)}if(o.outputs){let d=Wt(o.outputs,`Serializing outputs whle updating example with id: ${s}`),f=new Blob([d],{type:"application/json"});n.append(`${s}.outputs`,f)}if(o.attachments)for(let[d,f]of Object.entries(o.attachments)){let p,m;Array.isArray(f)?[p,m]=f:(p=f.mimeType,m=f.data);let h=new Blob([m],{type:`${p}; length=${m.byteLength}`});n.append(`${s}.attachment.${d}`,h)}if(o.attachments_operations){let d=Wt(o.attachments_operations,`Serializing attachments while updating example with id: ${s}`),f=new Blob([d],{type:"application/json"});n.append(`${s}.attachments_operations`,f)}}let i=t??r[0]?.dataset_id;return(await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}${this._getPlatformEndpointPath(`datasets/${i}/examples`)}`,{method:"PATCH",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await Y(o,"update examples"),o})).json()}async uploadExamplesMultipart(t,r=[]){return this._uploadExamplesMultipart(t,r)}async _uploadExamplesMultipart(t,r=[]){if(!await this._getDatasetExamplesMultiPartSupport())throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");let n=new FormData;for(let a of r){let o=(a.id??io()).toString(),s={created_at:a.created_at,...a.metadata&&{metadata:a.metadata},...a.split&&{split:a.split},...a.source_run_id&&{source_run_id:a.source_run_id},...a.use_source_run_io&&{use_source_run_io:a.use_source_run_io},...a.use_source_run_attachments&&{use_source_run_attachments:a.use_source_run_attachments}},c=Wt(s,`Serializing body for uploaded example with id: ${o}`),l=new Blob([c],{type:"application/json"});if(n.append(o,l),a.inputs){let u=Wt(a.inputs,`Serializing inputs for uploaded example with id: ${o}`),d=new Blob([u],{type:"application/json"});n.append(`${o}.inputs`,d)}if(a.outputs){let u=Wt(a.outputs,`Serializing outputs for uploaded example with id: ${o}`),d=new Blob([u],{type:"application/json"});n.append(`${o}.outputs`,d)}if(a.attachments)for(let[u,d]of Object.entries(a.attachments)){let f,p;Array.isArray(d)?[f,p]=d:(f=d.mimeType,p=d.data);let m=new Blob([p],{type:`${f}; length=${p.byteLength}`});n.append(`${o}.attachment.${u}`,m)}}return(await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}${this._getPlatformEndpointPath(`datasets/${t}/examples`)}`,{method:"POST",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await Y(a,"upload examples"),a})).json()}async updatePrompt(t,r){if(!await this.promptExists(t))throw new Error("Prompt does not exist, you must create it first.");let[n,i]=Gt(t);if(!await this._currentTenantIsOwner(n))throw await this._ownerConflictError("update a prompt",n);let a={};if(r?.description!==void 0&&(a.description=r.description),r?.readme!==void 0&&(a.readme=r.readme),r?.tags!==void 0&&(a.tags=r.tags),r?.isPublic!==void 0&&(a.is_public=r.isPublic),r?.isArchived!==void 0&&(a.is_archived=r.isArchived),Object.keys(a).length===0)throw new Error("No valid update options provided");let o=JSON.stringify(a);return(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/repos/${n}/${i}`,{method:"PATCH",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:o});return await Y(c,"update prompt"),c})).json()}async deletePrompt(t){if(!await this.promptExists(t))throw new Error("Prompt does not exist, you must create it first.");let[r,n,i]=Gt(t);if(!await this._currentTenantIsOwner(r))throw await this._ownerConflictError("delete a prompt",r);return(await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/repos/${r}/${n}`,{method:"DELETE",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Y(o,"delete prompt"),o})).json()}_getPromptCacheKey(t,r){return`${t}${r?":with_model":""}`}async _fetchPromptFromApi(t,r){let[n,i,a]=Gt(t),s=await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/commits/${n}/${i}/${a}${r?.includeModel?"?include_model=true":""}`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Y(c,"pull prompt commit"),c})).json();return{owner:n,repo:i,commit_hash:s.commit_hash,manifest:s.manifest,examples:s.examples,hub_model_config:s.model_config,hub_model_provider:s.model_provider}}async pullPromptCommit(t,r){q4(t,r?.dangerouslyPullPublicPrompt);let n=this._fetchPromptFromApi.bind(this,t,r);if(!r?.skipCache&&this._promptCache){let i=this._getPromptCacheKey(t,r?.includeModel),a=this._promptCache.get(i,n);if(a)return a;let o=await n();return this._promptCache.set(i,o,n),o}return this._fetchPromptFromApi(t,r)}async _pullPrompt(t,r){let n=await this.pullPromptCommit(t,{includeModel:r?.includeModel,skipCache:r?.skipCache,dangerouslyPullPublicPrompt:r?.dangerouslyPullPublicPrompt});return JSON.stringify(n.manifest)}async pushPrompt(t,r){return await this.promptExists(t)?r&&Object.keys(r).some(i=>i!=="object")&&await this.updatePrompt(t,{description:r?.description,readme:r?.readme,tags:r?.tags,isPublic:r?.isPublic}):await this.createPrompt(t,{description:r?.description,readme:r?.readme,tags:r?.tags,isPublic:r?.isPublic}),r?.object?await this.createCommit(t,r?.object,{parentCommitHash:r?.parentCommitHash,description:r?.commitDescription}):await this._getPromptUrl(t)}async agentExists(t){let[r,n]=Gt(t);return this._repoExists(r,n)}async skillExists(t){let[r,n]=Gt(t);return this._repoExists(r,n)}async pullAgent(t,r){return await this._pullDirectory(t,"agent",r?.version)}async pullSkill(t,r){return await this._pullDirectory(t,"skill",r?.version)}async pushAgent(t,r){return this._pushDirectory(t,"agent",r)}async pushSkill(t,r){return this._pushDirectory(t,"skill",r)}async deleteAgent(t){return this._deleteDirectory(t)}async deleteSkill(t){return this._deleteDirectory(t)}async*listAgents(t){yield*this._listReposByType("agent",t)}async*listSkills(t){yield*this._listReposByType("skill",t)}async*_listReposByType(t,r){let n=new URLSearchParams;n.append("repo_type",t),n.append("is_archived",(!!r?.isArchived).toString()),r?.isPublic!==void 0&&n.append("is_public",r.isPublic.toString()),r?.query&&n.append("query",r.query);for await(let i of this._getPaginated("/repos",n,a=>a.repos))yield*i}async _pullDirectory(t,r,n){let[i,a,o]=Gt(t),s=n??(o!=="latest"?o:void 0),c=new URL(`${this.apiUrl}/v1/platform/hub/repos/${i}/${a}/directories`);return c.searchParams.set("repo_type",r),s&&c.searchParams.set("commit",s),await(await this.caller.call(async()=>{let u=await this._fetch(c.toString(),{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Y(u,"pull directory"),u})).json()}async _pushDirectory(t,r,n){if(n.parentCommit!==void 0&&(n.parentCommit.length<8||n.parentCommit.length>64))throw new Error("parent_commit must be 8-64 characters");let[i,a]=Gt(t);if(!await this._currentTenantIsOwner(i))throw await this._ownerConflictError(`push ${r}`,i);if(await this._repoExists(i,a))(n.description!==void 0||n.readme!==void 0||n.tags!==void 0||n.isPublic!==void 0)&&await this._updateRepoMetadata(i,a,n);else{let d=/^[a-z][a-z0-9-_]*$/;if(!d.test(a))throw new Error(`Invalid repo_handle ${JSON.stringify(a)}: must match ${d}`);await this._createRepo(a,r,n)}let o={files:n.files};n.parentCommit&&(o.parent_commit=n.parentCommit);let l=(await(await this.caller.call(async()=>{let d=await this._fetch(`${this.apiUrl}/v1/platform/hub/repos/${i}/${a}/directories/commits`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:JSON.stringify(o)});return await Y(d,`push ${r}`),d})).json()).commit.commit_hash,u=i;return i==="-"&&(u=(await this._getSettings()).tenant_handle||i),`${this.getHostUrl()}/hub/${u}/${a}:${l.slice(0,8)}`}async _deleteDirectory(t){let[r,n]=Gt(t);if(!await this._currentTenantIsOwner(r))throw await this._ownerConflictError("delete",r);await this.caller.call(async()=>{let i=await this._fetch(`${this.apiUrl}/v1/platform/hub/repos/${r}/${n}/directories`,{method:"DELETE",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Y(i,"delete directory"),i})}async _repoExists(t,r){try{return await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/repos/${t}/${r}`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Y(n,"check repo exists"),n}),!0}catch(n){if(tf(n))return!1;throw n}}async _createRepo(t,r,n){let i={repo_handle:t,repo_type:r,is_public:!!n.isPublic};n.description!==void 0&&(i.description=n.description),n.readme!==void 0&&(i.readme=n.readme),n.tags!==void 0&&(i.tags=n.tags);try{await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/repos/`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:JSON.stringify(i)});return await Y(a,`create ${r}`),a})}catch(a){if(DI(a))return;throw a}}async _updateRepoMetadata(t,r,n){let i={};n.description!==void 0&&(i.description=n.description),n.readme!==void 0&&(i.readme=n.readme),n.tags!==void 0&&(i.tags=n.tags),n.isPublic!==void 0&&(i.is_public=n.isPublic),Object.keys(i).length!==0&&await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/repos/${t}/${r}`,{method:"PATCH",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:JSON.stringify(i)});return await Y(a,"update repo metadata"),a})}async clonePublicDataset(t,r={}){let{sourceApiUrl:n=this.apiUrl,datasetName:i}=r,[a,o]=this.parseTokenOrUrl(t,n),s=new e({apiUrl:a,apiKey:"placeholder"}),c=await s.readSharedDataset(o),l=i||c.name;try{if(await this.hasDataset({datasetId:l})){console.log(`Dataset ${l} already exists in your tenant. Skipping.`);return}}catch{}let u=await s.listSharedExamples(o),d=await this.createDataset(l,{description:c.description,dataType:c.data_type||"kv",inputsSchema:c.inputs_schema_definition??void 0,outputsSchema:c.outputs_schema_definition??void 0});try{await this.createExamples({inputs:u.map(f=>f.inputs),outputs:u.flatMap(f=>f.outputs?[f.outputs]:[]),datasetId:d.id})}catch(f){throw console.error(`An error occurred while creating dataset ${l}. You should delete it manually.`),f}}parseTokenOrUrl(t,r,n=2,i="dataset"){try{return he(t),[r,t]}catch{}try{let o=new URL(t).pathname.split("/").filter(s=>s!=="");if(o.length>=n){let s=o[o.length-n];return[r,s]}else throw new Error(`Invalid public ${i} URL: ${t}`)}catch{throw new Error(`Invalid public ${i} URL or token: ${t}`)}}cleanup(){this._promptCache&&this._promptCache.stop()}async awaitPendingTraceBatches(){if(this.manualFlushMode)return console.warn("[WARNING]: When tracing in manual flush mode, you must call `await client.flush()` manually to submit trace batches."),Promise.resolve();for(await new Promise(t=>setTimeout(t,1));this._pendingDrains.size>0;)await Promise.all([...this._pendingDrains]);await Promise.all([...this.autoBatchQueue.items.map(({itemPromise:t})=>t),this.batchIngestCaller.queue.onIdle()]),this.langSmithToOTELTranslator!==void 0&&await EI()?.DEFAULT_LANGSMITH_SPAN_PROCESSOR?.forceFlush()}toString(){let t=[`apiUrl=${JSON.stringify(this.apiUrl)}`];return this.webUrl!==void 0&&t.push(`webUrl=${JSON.stringify(this.webUrl)}`),this.workspaceId!==void 0&&t.push(`workspaceId=${JSON.stringify(this.workspaceId)}`),`[LangSmithClient ${t.join(" ")}]`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}};Object.defineProperty(Ln,"_fallbackDirsCreated",{enumerable:!0,configurable:!0,writable:!0,value:new Set});function XI(e){return"dataset_id"in e||"dataset_name"in e}var eT=e=>e!==void 0?e:!!["TRACING_V2","TRACING"].find(r=>Ke(r)==="true");var Bn=Symbol.for("lc:context_variables");var sf=Symbol.for("langsmith:replica_trace_roots");function d_(e,t){if(Bn in e)return e[Bn][t]}function tT(e,t,r){let n=Bn in e?e[Bn]:{};n[t]=r,e[Bn]=n}var cl=36,iz="6ba7b810-9dad-11d1-80b4-00c04fd430c8";function rT(e){let r=Object.keys(e).sort().map(n=>`${n}:${e[n]??""}`).join("|");return kg(r,iz)}function az(e){return e.replace(/[-:.]/g,"")}function iT(e,t=1){let r=t.toFixed(0).slice(0,3).padStart(3,"0");return`${new Date(e).toISOString().slice(0,-1)}${r}Z`}function f_(e,t,r=1){let n=iT(e,r);return{dottedOrder:az(n)+t,microsecondPrecisionDatestring:n}}var oz=new Set(["projectName","updates","reroot"]);function sz(e){let t={};for(let r of Object.keys(e))oz.has(r)&&(t[r]=e[r]);return t}var cf=class e{constructor(t,r,n,i){Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"project_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"replicas",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.metadata=t,this.tags=r,this.project_name=n,this.replicas=i}static fromHeader(t){let r=t.split(","),n={},i=[],a,o;for(let s of r){let[c,l]=s.split("="),u=decodeURIComponent(l);c==="langsmith-metadata"?n=JSON.parse(u):c==="langsmith-tags"?i=u.split(","):c==="langsmith-project"?a=u:c==="langsmith-replicas"&&(o=JSON.parse(u).map(f=>Array.isArray(f)?f:sz(f)))}return new e(n,i,a,o)}toHeader(){let t=[];return this.metadata&&Object.keys(this.metadata).length>0&&t.push(`langsmith-metadata=${encodeURIComponent(JSON.stringify(this.metadata))}`),this.tags&&this.tags.length>0&&t.push(`langsmith-tags=${encodeURIComponent(this.tags.join(","))}`),this.project_name&&t.push(`langsmith-project=${encodeURIComponent(this.project_name)}`),t.join(",")}},pn=class e{constructor(t){if(Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"run_type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"project_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"parent_run",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"parent_run_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_runs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"start_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"end_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"extra",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"error",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"serialized",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"outputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reference_example_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"trace_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"dotted_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracingEnabled",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"attachments",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"replicas",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"distributedParentId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_serialized_start_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_awaitInputsOnPost",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),aT(t)){Object.assign(this,{...t});return}let r=e.getDefaultConfig(),{metadata:n,...i}=t,a=i.client??e.getSharedClient(),o={...n,...i?.extra?.metadata};if(i.extra={...i.extra,metadata:o},"id"in i&&i.id==null&&delete i.id,Object.assign(this,{...r,...i,client:a}),this.execution_order??=1,this.child_execution_order??=1,this.dotted_order||(this._serialized_start_time=iT(this.start_time,this.execution_order)),this.id||(this.id=jd(this._serialized_start_time??this.start_time)),this.trace_id||(this.parent_run?this.trace_id=this.parent_run.trace_id??this.id:this.trace_id=this.id),this.replicas=dz(this.replicas),!this.dotted_order){let{dottedOrder:s}=f_(this.start_time,this.id,this.execution_order);this.parent_run?this.dotted_order=this.parent_run.dotted_order+"."+s:this.dotted_order=s}}set metadata(t){this.extra={...this.extra,metadata:{...this.extra?.metadata,...t}}}get metadata(){return this.extra?.metadata}static getDefaultConfig(){let t=Date.now();return{run_type:"chain",project_name:rl(),child_runs:[],api_url:Nt("LANGCHAIN_ENDPOINT")??"http://localhost:1984",api_key:Nt("LANGCHAIN_API_KEY"),caller_options:{},start_time:t,serialized:{},inputs:{},extra:{}}}static getSharedClient(){return e.sharedClient||(e.sharedClient=new Ln),e.sharedClient}createChild(t){let r=this.child_execution_order+1,n=this.replicas?.map(f=>{let{reroot:p,...m}=f;return m}),i=t.replicas??n,a=new e({...t,parent_run:this,project_name:this.project_name,replicas:i,client:this.client,tracingEnabled:this.tracingEnabled,execution_order:r,child_execution_order:r}),o=this.extra?.metadata??{},s=a.extra?.metadata??{};Object.keys(o).length>0&&(a.extra={...a.extra,metadata:{...o,...s}}),Bn in this&&(a[Bn]=this[Bn]);let c=Symbol.for("lc:child_config"),l=t.extra?.[c]??this.extra[c];if(lz(l)){let f={...l},p=cz(f.callbacks)?f.callbacks.copy?.():void 0;p&&(Object.assign(p,{_parentRunId:a.id}),p.handlers?.find(oT)?.updateFromRunTree?.(a),f.callbacks=p),a.extra[c]=f}let u=new Set,d=this;for(;d!=null&&!u.has(d.id);)u.add(d.id),d.child_execution_order=Math.max(d.child_execution_order,r),d=d.parent_run;return this.child_runs.push(a),a}async end(t,r,n=Date.now(),i){this.outputs=this.outputs??t,this.error=this.error??r,this.end_time=this.end_time??n,i&&Object.keys(i).length>0&&(this.extra=this.extra?{...this.extra,metadata:{...this.extra.metadata,...i}}:{metadata:i})}_convertToCreate(t,r,n=!0){let i=t.extra??{};if(i?.runtime?.library===void 0&&(i.runtime||(i.runtime={}),r))for(let[s,c]of Object.entries(r))i.runtime[s]||(i.runtime[s]=c);let a=t.parent_run?.id??t.parent_run_id,o;return n?o=[]:o=t.child_runs.map(s=>this._convertToCreate(s,r,n)),{id:t.id,name:t.name,start_time:t._serialized_start_time??t.start_time,end_time:t.end_time,run_type:t.run_type,reference_example_id:t.reference_example_id,extra:i,serialized:t.serialized,error:t.error,inputs:t.inputs,outputs:t.outputs,session_name:t.project_name,child_runs:o,parent_run_id:a,trace_id:t.trace_id,dotted_order:t.dotted_order,tags:t.tags,attachments:t.attachments,events:t.events}}_sliceParentId(t,r){if(r.dotted_order){let n=r.dotted_order.split("."),i=null;for(let a=0;a<n.length;a++)if(n[a].slice(-cl)===t){i=a;break}if(i!==null){let a=n.slice(i+1);r.dotted_order=a.join("."),a.length>0?r.trace_id=a[0].slice(-cl):r.trace_id=r.id}}r.parent_run_id===t&&(r.parent_run_id=void 0)}_setReplicaTraceRoot(t,r){let n=d_(this,sf)??{};n[t]=r,tT(this,sf,n);for(let i of this.child_runs)i._setReplicaTraceRoot(t,r)}_remapForProject(t){let{projectName:r,runtimeEnv:n,excludeChildRuns:i=!0,reroot:a=!1,distributedParentId:o,apiUrl:s,apiKey:c,workspaceId:l}=t,u=this._convertToCreate(this,n,i);if(r===this.project_name)return{...u,session_name:r};if(a){if(o)this._sliceParentId(o,u);else if(u.parent_run_id=void 0,u.dotted_order){let w=u.dotted_order.split(".");w.length>0&&(u.dotted_order=w[w.length-1],u.trace_id=u.id)}let y=rT({projectName:r,apiUrl:s,apiKey:c,workspaceId:l});this._setReplicaTraceRoot(y,u.id)}let d;if(!a){let y=d_(this,sf)??{},w=rT({projectName:r,apiUrl:s,apiKey:c,workspaceId:l});if(d=y[w],d&&(u.trace_id=d,u.dotted_order)){let x=u.dotted_order.split("."),S=null;for(let E=0;E<x.length;E++)if(x[E].slice(-cl)===d){S=E;break}if(S!==null){let E=x.slice(S);u.dotted_order=E.join(".")}}}let f=u.id,p=nl(f,r),m;u.trace_id?m=nl(u.trace_id,r):m=p;let h;u.parent_run_id&&(h=nl(u.parent_run_id,r));let _;return u.dotted_order&&(_=u.dotted_order.split(".").map(x=>{let S=x.slice(-cl),E=nl(S,r);return x.slice(0,-cl)+E}).join(".")),{...u,id:p,trace_id:m,parent_run_id:h,dotted_order:_,session_name:r}}async postRun(t=!0){this._awaitInputsOnPost&&(this.inputs=await this.inputs);try{let r=Bd();if(this.replicas&&this.replicas.length>0)for(let{projectName:n,apiKey:i,apiUrl:a,workspaceId:o,reroot:s,client:c}of this.replicas){let l=this._remapForProject({projectName:n??this.project_name,runtimeEnv:r,excludeChildRuns:!0,reroot:s,distributedParentId:this.distributedParentId,apiUrl:a,apiKey:i,workspaceId:o});await(c??this.client).createRun(l,{apiKey:i,apiUrl:a,workspaceId:o})}else{let n=this._convertToCreate(this,r,t);await this.client.createRun(n)}if(!t){ao("Posting with excludeChildRuns=false is deprecated and will be removed in a future version.");for(let n of this.child_runs)await n.postRun(!1)}this.child_runs=[]}catch(r){console.error(`Error in postRun for run ${this.id}:`,r)}}async patchRun(t){if(this.replicas&&this.replicas.length>0)for(let{projectName:r,apiKey:n,apiUrl:i,workspaceId:a,updates:o,reroot:s,client:c}of this.replicas){let l=this._remapForProject({projectName:r??this.project_name,runtimeEnv:void 0,excludeChildRuns:!0,reroot:s,distributedParentId:this.distributedParentId,apiUrl:i,apiKey:n,workspaceId:a}),u={id:l.id,name:l.name,run_type:l.run_type,start_time:l.start_time,outputs:l.outputs,error:l.error,parent_run_id:l.parent_run_id,session_name:l.session_name,reference_example_id:l.reference_example_id,end_time:l.end_time,dotted_order:l.dotted_order,trace_id:l.trace_id,events:l.events,tags:l.tags,extra:l.extra,attachments:this.attachments,...o};t?.excludeInputs||(u.inputs=l.inputs),await(c??this.client).updateRun(l.id,u,{apiKey:n,apiUrl:i,workspaceId:a})}else try{let r={name:this.name,run_type:this.run_type,start_time:this._serialized_start_time??this.start_time,end_time:this.end_time,error:this.error,outputs:this.outputs,parent_run_id:this.parent_run?.id??this.parent_run_id,reference_example_id:this.reference_example_id,extra:this.extra,events:this.events,dotted_order:this.dotted_order,trace_id:this.trace_id,tags:this.tags,attachments:this.attachments,session_name:this.project_name};t?.excludeInputs||(r.inputs=this.inputs),await this.client.updateRun(this.id,r)}catch(r){console.error(`Error in patchRun for run ${this.id}`,r)}this.child_runs=[]}toJSON(){return this._convertToCreate(this,void 0,!1)}addEvent(t){this.events||(this.events=[]),typeof t=="string"?this.events.push({name:"event",time:new Date().toISOString(),message:t}):this.events.push({...t,time:t.time??new Date().toISOString()})}static fromRunnableConfig(t,r){let n=t?.callbacks,i,a,o,s=eT();if(n){let l=n?.getParentRunId?.()??"",u=n?.handlers?.find(d=>d?.name=="langchain_tracer");i=u?.getRun?.(l),a=u?.projectName,o=u?.client,s=s||!!u}return i?new e({name:i.name,id:i.id,trace_id:i.trace_id,dotted_order:i.dotted_order,client:o,tracingEnabled:s,project_name:a,tags:[...new Set((i?.tags??[]).concat(t?.tags??[]))],extra:{metadata:{...i?.extra?.metadata,...t?.metadata}}}).createChild(r):new e({...r,client:o,tracingEnabled:s,project_name:a})}static fromDottedOrder(t){return this.fromHeaders({"langsmith-trace":t})}static fromHeaders(t,r){let n="get"in t&&typeof t.get=="function"?{"langsmith-trace":t.get("langsmith-trace"),baggage:t.get("baggage")}:t,i=n["langsmith-trace"];if(!i||typeof i!="string")return;let a=i.trim(),o=a.split(".").map(u=>{let[d,f]=u.split("Z");return{strTime:d,time:Date.parse(d+"Z"),uuid:f}}),s=o[0].uuid,c={...r,name:r?.name??"parent",run_type:r?.run_type??"chain",start_time:r?.start_time??Date.now(),id:o.at(-1)?.uuid,trace_id:s,dotted_order:a};if(n.baggage&&typeof n.baggage=="string"){let u=cf.fromHeader(n.baggage);c.metadata=u.metadata,c.tags=u.tags,c.project_name=u.project_name,c.replicas=u.replicas}let l=new e(c);return l.distributedParentId=l.id,l}toHeaders(t){let r={"langsmith-trace":this.dotted_order,baggage:new cf(this.extra?.metadata,this.tags,this.project_name,this.replicas).toHeader()};if(t)for(let[n,i]of Object.entries(r))t.set(n,i);return r}};Object.defineProperty(pn,"sharedClient",{enumerable:!0,configurable:!0,writable:!0,value:null});function aT(e){return e!=null&&typeof e.createChild=="function"&&typeof e.postRun=="function"}function oT(e){return typeof e=="object"&&e!=null&&typeof e.name=="string"&&e.name==="langchain_tracer"}function nT(e){return Array.isArray(e)&&e.some(t=>oT(t))}function cz(e){return typeof e=="object"&&e!=null&&Array.isArray(e.handlers)}function lz(e){let t=e?.callbacks;return e!=null&&typeof t=="object"&&(nT(t?.handlers)||nT(t))}function uz(){let e=Nt("LANGSMITH_RUNS_ENDPOINTS");if(!e)return[];try{let t=JSON.parse(e);if(Array.isArray(t)){let r=[];for(let n of t){if(typeof n!="object"||n===null){console.warn(`Invalid item type in LANGSMITH_RUNS_ENDPOINTS: expected object, got ${typeof n}`);continue}if(typeof n.api_url!="string"){console.warn(`Invalid api_url type in LANGSMITH_RUNS_ENDPOINTS: expected string, got ${typeof n.api_url}`);continue}if(typeof n.api_key!="string"){console.warn(`Invalid api_key type in LANGSMITH_RUNS_ENDPOINTS: expected string, got ${typeof n.api_key}`);continue}r.push({apiUrl:n.api_url.replace(/\/$/,""),apiKey:n.api_key})}return r}else if(typeof t=="object"&&t!==null){fz(t);let r=[];for(let[n,i]of Object.entries(t)){let a=n.replace(/\/$/,"");if(typeof i=="string")r.push({apiUrl:a,apiKey:i});else{console.warn(`Invalid value type in LANGSMITH_RUNS_ENDPOINTS for URL ${n}: expected string, got ${typeof i}`);continue}}return r}else return console.warn(`Invalid LANGSMITH_RUNS_ENDPOINTS \u2013 must be valid JSON array of objects with api_url and api_key properties, or object mapping url->apiKey, got ${typeof t}`),[]}catch(t){if(UI(t))throw t;return console.warn("Invalid LANGSMITH_RUNS_ENDPOINTS \u2013 must be valid JSON array of objects with api_url and api_key properties, or object mapping url->apiKey"),[]}}function dz(e){return e?e.map(t=>Array.isArray(t)?{projectName:t[0],updates:t[1]}:t):uz()}function fz(e){if(Object.keys(e).length>0&&Ke("ENDPOINT"))throw new Qd}var sT=T({BaseTracer:()=>zt,isBaseTracer:()=>co}),pz=e=>{if(e)return e.events=e.events??[],e.child_runs=e.child_runs??[],e};function m_(e,t){if(e)return new pn({...e,start_time:e._serialized_start_time??e.start_time,parent_run:m_(t),child_runs:e.child_runs.map(r=>m_(r)).filter(r=>r!==void 0),extra:{...e.extra,runtime:og()},tracingEnabled:!1})}function p_(e,t){return e&&!Array.isArray(e)&&typeof e=="object"?e:{[t]:e}}function co(e){return typeof e._addRunToRunMap=="function"}var zt=class extends sr{runMap=new Map;runTreeMap=new Map;usesRunTreeMap=!1;constructor(e){super(...arguments)}copy(){return this}getRunById(e){if(e!==void 0)return this.usesRunTreeMap?pz(this.runTreeMap.get(e)):this.runMap.get(e)}stringifyError(e){return e instanceof Error?e.message+(e?.stack?`
150
+
151
+ ${e.stack}`:""):typeof e=="string"?e:`${e}`}_addChildRun(e,t){e.child_runs.push(t)}_addRunToRunMap(e){let{dottedOrder:t,microsecondPrecisionDatestring:r}=f_(new Date(e.start_time).getTime(),e.id,e.execution_order),n={...e},i=this.getRunById(n.parent_run_id);if(n.parent_run_id!==void 0?i?(this._addChildRun(i,n),i.child_execution_order=Math.max(i.child_execution_order,n.child_execution_order),n.trace_id=i.trace_id,i.dotted_order!==void 0&&(n.dotted_order=[i.dotted_order,t].join("."),n._serialized_start_time=r)):n.parent_run_id=void 0:(n.trace_id=n.id,n.dotted_order=t,n._serialized_start_time=r),this.usesRunTreeMap){let a=m_(n,i);a!==void 0&&this.runTreeMap.set(n.id,a)}else this.runMap.set(n.id,n);return n}async _endTrace(e){let t=e.parent_run_id!==void 0&&this.getRunById(e.parent_run_id);t?t.child_execution_order=Math.max(t.child_execution_order,e.child_execution_order):await this.persistRun(e),await this.onRunUpdate?.(e),this.usesRunTreeMap?this.runTreeMap.delete(e.id):this.runMap.delete(e.id)}_getExecutionOrder(e){let t=e!==void 0&&this.getRunById(e);return t?t.child_execution_order+1:1}_createRunForLLMStart(e,t,r,n,i,a,o,s){let c=this._getExecutionOrder(n),l=Date.now(),u=o?{...i,metadata:o}:i,d={id:r,name:s??e.id[e.id.length-1],parent_run_id:n,start_time:l,serialized:e,events:[{name:"start",time:new Date(l).toISOString()}],inputs:{prompts:t},execution_order:c,child_runs:[],child_execution_order:c,run_type:"llm",extra:u??{},tags:a||[]};return this._addRunToRunMap(d)}async handleLLMStart(e,t,r,n,i,a,o,s){let c=this.getRunById(r)??this._createRunForLLMStart(e,t,r,n,i,a,o,s);return await this.onRunCreate?.(c),await this.onLLMStart?.(c),c}_createRunForChatModelStart(e,t,r,n,i,a,o,s){let c=this._getExecutionOrder(n),l=Date.now(),u=o?{...i,metadata:o}:i,d={id:r,name:s??e.id[e.id.length-1],parent_run_id:n,start_time:l,serialized:e,events:[{name:"start",time:new Date(l).toISOString()}],inputs:{messages:t},execution_order:c,child_runs:[],child_execution_order:c,run_type:"llm",extra:u??{},tags:a||[]};return this._addRunToRunMap(d)}async handleChatModelStart(e,t,r,n,i,a,o,s){let c=this.getRunById(r)??this._createRunForChatModelStart(e,t,r,n,i,a,o,s);return await this.onRunCreate?.(c),await this.onLLMStart?.(c),c}async handleLLMEnd(e,t,r,n,i){let a=this.getRunById(t);if(!a||a?.run_type!=="llm")throw new Error("No LLM run to end.");return a.end_time=Date.now(),a.outputs=e,a.events.push({name:"end",time:new Date(a.end_time).toISOString()}),a.extra={...a.extra,...i},await this.onLLMEnd?.(a),await this._endTrace(a),a}async handleLLMError(e,t,r,n,i){let a=this.getRunById(t);if(!a||a?.run_type!=="llm")throw new Error("No LLM run to end.");return a.end_time=Date.now(),a.error=this.stringifyError(e),a.events.push({name:"error",time:new Date(a.end_time).toISOString()}),a.extra={...a.extra,...i},await this.onLLMError?.(a),await this._endTrace(a),a}_createRunForChainStart(e,t,r,n,i,a,o,s,c){let l=this._getExecutionOrder(n),u=Date.now(),d={id:r,name:s??e.id[e.id.length-1],parent_run_id:n,start_time:u,serialized:e,events:[{name:"start",time:new Date(u).toISOString()}],inputs:t,execution_order:l,child_execution_order:l,run_type:o??"chain",child_runs:[],extra:a?{...c,metadata:a}:{...c},tags:i||[]};return this._addRunToRunMap(d)}async handleChainStart(e,t,r,n,i,a,o,s){let c=this.getRunById(r)??this._createRunForChainStart(e,t,r,n,i,a,o,s);return await this.onRunCreate?.(c),await this.onChainStart?.(c),c}async handleChainEnd(e,t,r,n,i){let a=this.getRunById(t);if(!a)throw new Error("No chain run to end.");return a.end_time=Date.now(),a.outputs=p_(e,"output"),a.events.push({name:"end",time:new Date(a.end_time).toISOString()}),i?.inputs!==void 0&&(a.inputs=p_(i.inputs,"input")),await this.onChainEnd?.(a),await this._endTrace(a),a}async handleChainError(e,t,r,n,i){let a=this.getRunById(t);if(!a)throw new Error("No chain run to end.");return a.end_time=Date.now(),a.error=this.stringifyError(e),a.events.push({name:"error",time:new Date(a.end_time).toISOString()}),i?.inputs!==void 0&&(a.inputs=p_(i.inputs,"input")),await this.onChainError?.(a),await this._endTrace(a),a}_createRunForToolStart(e,t,r,n,i,a,o){let s=this._getExecutionOrder(n),c=Date.now(),l={id:r,name:o??e.id[e.id.length-1],parent_run_id:n,start_time:c,serialized:e,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{input:t},execution_order:s,child_execution_order:s,run_type:"tool",child_runs:[],extra:a?{metadata:a}:{},tags:i||[]};return this._addRunToRunMap(l)}async handleToolStart(e,t,r,n,i,a,o){let s=this.getRunById(r)??this._createRunForToolStart(e,t,r,n,i,a,o);return await this.onRunCreate?.(s),await this.onToolStart?.(s),s}async handleToolEnd(e,t){let r=this.getRunById(t);if(!r||r?.run_type!=="tool")throw new Error("No tool run to end");return r.end_time=Date.now(),r.outputs={output:e},r.events.push({name:"end",time:new Date(r.end_time).toISOString()}),await this.onToolEnd?.(r),await this._endTrace(r),r}async handleToolError(e,t){let r=this.getRunById(t);if(!r||r?.run_type!=="tool")throw new Error("No tool run to end");return r.end_time=Date.now(),r.error=this.stringifyError(e),r.events.push({name:"error",time:new Date(r.end_time).toISOString()}),await this.onToolError?.(r),await this._endTrace(r),r}async handleAgentAction(e,t){let r=this.getRunById(t);if(!r||r?.run_type!=="chain")return;let n=r;n.actions=n.actions||[],n.actions.push(e),n.events.push({name:"agent_action",time:new Date().toISOString(),kwargs:{action:e}}),await this.onAgentAction?.(r)}async handleAgentEnd(e,t){let r=this.getRunById(t);!r||r?.run_type!=="chain"||(r.events.push({name:"agent_end",time:new Date().toISOString(),kwargs:{action:e}}),await this.onAgentEnd?.(r))}_createRunForRetrieverStart(e,t,r,n,i,a,o){let s=this._getExecutionOrder(n),c=Date.now(),l={id:r,name:o??e.id[e.id.length-1],parent_run_id:n,start_time:c,serialized:e,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{query:t},execution_order:s,child_execution_order:s,run_type:"retriever",child_runs:[],extra:a?{metadata:a}:{},tags:i||[]};return this._addRunToRunMap(l)}async handleRetrieverStart(e,t,r,n,i,a,o){let s=this.getRunById(r)??this._createRunForRetrieverStart(e,t,r,n,i,a,o);return await this.onRunCreate?.(s),await this.onRetrieverStart?.(s),s}async handleRetrieverEnd(e,t){let r=this.getRunById(t);if(!r||r?.run_type!=="retriever")throw new Error("No retriever run to end");return r.end_time=Date.now(),r.outputs={documents:e},r.events.push({name:"end",time:new Date(r.end_time).toISOString()}),await this.onRetrieverEnd?.(r),await this._endTrace(r),r}async handleRetrieverError(e,t){let r=this.getRunById(t);if(!r||r?.run_type!=="retriever")throw new Error("No retriever run to end");return r.end_time=Date.now(),r.error=this.stringifyError(e),r.events.push({name:"error",time:new Date(r.end_time).toISOString()}),await this.onRetrieverError?.(r),await this._endTrace(r),r}async handleText(e,t){let r=this.getRunById(t);!r||r?.run_type!=="chain"||(r.events.push({name:"text",time:new Date().toISOString(),kwargs:{text:e}}),await this.onText?.(r))}async handleLLMNewToken(e,t,r,n,i,a){let o=this.getRunById(r);if(!o||o?.run_type!=="llm")throw new Error('Invalid "runId" provided to "handleLLMNewToken" callback.');return o.events.push({name:"new_token",time:new Date().toISOString(),kwargs:{token:e,idx:t,chunk:a?.chunk}}),await this.onLLMNewToken?.(o,e,{chunk:a?.chunk}),o}};var lT=T({ConsoleCallbackHandler:()=>lf}),uT={bold:{open:"\x1B[1m",close:"\x1B[22m"},color:{grey:{open:"\x1B[90m",close:"\x1B[39m"},green:{open:"\x1B[32m",close:"\x1B[39m"},cyan:{open:"\x1B[36m",close:"\x1B[39m"},red:{open:"\x1B[31m",close:"\x1B[39m"},blue:{open:"\x1B[34m",close:"\x1B[39m"}}};function lr(e,t){return`${e.open}${t}${e.close}`}function Wr(e,t){try{return JSON.stringify(e,null,2)}catch{return t}}function cT(e){return typeof e=="string"?e.trim():e==null?e:Wr(e,e.toString())}function aa(e){if(!e.end_time)return"";let t=e.end_time-e.start_time;return t<1e3?`${t}ms`:`${(t/1e3).toFixed(2)}s`}var{color:yr}=uT,lf=class extends zt{name="console_callback_handler";persistRun(e){return Promise.resolve()}getParents(e){let t=[],r=e;for(;r.parent_run_id;){let n=this.runMap.get(r.parent_run_id);if(n)t.push(n),r=n;else break}return t}getBreadcrumbs(e){let t=[...this.getParents(e).reverse(),e].map((r,n,i)=>{let a=`${r.execution_order}:${r.run_type}:${r.name}`;return n===i.length-1?lr(uT.bold,a):a}).join(" > ");return lr(yr.grey,t)}onChainStart(e){let t=this.getBreadcrumbs(e);console.log(`${lr(yr.green,"[chain/start]")} [${t}] Entering Chain run with input: ${Wr(e.inputs,"[inputs]")}`)}onChainEnd(e){let t=this.getBreadcrumbs(e);console.log(`${lr(yr.cyan,"[chain/end]")} [${t}] [${aa(e)}] Exiting Chain run with output: ${Wr(e.outputs,"[outputs]")}`)}onChainError(e){let t=this.getBreadcrumbs(e);console.log(`${lr(yr.red,"[chain/error]")} [${t}] [${aa(e)}] Chain run errored with error: ${Wr(e.error,"[error]")}`)}onLLMStart(e){let t=this.getBreadcrumbs(e),r="prompts"in e.inputs?{prompts:e.inputs.prompts.map(n=>n.trim())}:e.inputs;console.log(`${lr(yr.green,"[llm/start]")} [${t}] Entering LLM run with input: ${Wr(r,"[inputs]")}`)}onLLMEnd(e){let t=this.getBreadcrumbs(e);console.log(`${lr(yr.cyan,"[llm/end]")} [${t}] [${aa(e)}] Exiting LLM run with output: ${Wr(e.outputs,"[response]")}`)}onLLMError(e){let t=this.getBreadcrumbs(e);console.log(`${lr(yr.red,"[llm/error]")} [${t}] [${aa(e)}] LLM run errored with error: ${Wr(e.error,"[error]")}`)}onToolStart(e){let t=this.getBreadcrumbs(e);console.log(`${lr(yr.green,"[tool/start]")} [${t}] Entering Tool run with input: "${cT(e.inputs.input)}"`)}onToolEnd(e){let t=this.getBreadcrumbs(e);console.log(`${lr(yr.cyan,"[tool/end]")} [${t}] [${aa(e)}] Exiting Tool run with output: "${cT(e.outputs?.output)}"`)}onToolError(e){let t=this.getBreadcrumbs(e);console.log(`${lr(yr.red,"[tool/error]")} [${t}] [${aa(e)}] Tool run errored with error: ${Wr(e.error,"[error]")}`)}onRetrieverStart(e){let t=this.getBreadcrumbs(e);console.log(`${lr(yr.green,"[retriever/start]")} [${t}] Entering Retriever run with input: ${Wr(e.inputs,"[inputs]")}`)}onRetrieverEnd(e){let t=this.getBreadcrumbs(e);console.log(`${lr(yr.cyan,"[retriever/end]")} [${t}] [${aa(e)}] Exiting Retriever run with output: ${Wr(e.outputs,"[outputs]")}`)}onRetrieverError(e){let t=this.getBreadcrumbs(e);console.log(`${lr(yr.red,"[retriever/error]")} [${t}] [${aa(e)}] Retriever run errored with error: ${Wr(e.error,"[error]")}`)}onAgentAction(e){let t=e,r=this.getBreadcrumbs(e);console.log(`${lr(yr.blue,"[agent/action]")} [${r}] Agent selected action: ${Wr(t.actions[t.actions.length-1],"[action]")}`)}};var h_,uf=()=>(h_===void 0&&(h_=new Ln(xt("LANGCHAIN_CALLBACKS_BACKGROUND")==="false"?{blockOnRootRunFinalization:!0}:{})),h_);var __=class{getStore(){}run(t,r){return r()}},g_=Symbol.for("ls:tracing_async_local_storage"),mz=new __,y_=class{getInstance(){return globalThis[g_]??mz}initializeGlobalInstance(t){globalThis[g_]===void 0&&(globalThis[g_]=t)}},hz=new y_;function dT(e=!1){let t=hz.getInstance().getStore();if(!e&&t===void 0)throw new Error(`Could not get the current run tree.
152
+
153
+ Please make sure you are calling this method within a traceable function and that tracing is enabled.`);return t}function df(e){return typeof e=="function"&&"langsmith:traceable"in e}var pT=T({LangChainTracer:()=>oa,OVERRIDABLE_LANGSMITH_INHERITABLE_METADATA_KEYS:()=>b_}),b_=new Set(["ls_agent_type"]);function gz(e){let t;for(let r of e)for(let n of r)Ne.isInstance(n.message)&&n.message.usage_metadata!==void 0&&(t=ds(t,n.message.usage_metadata));return t}var oa=class v_ extends zt{fields;name="langchain_tracer";projectName;exampleId;client;replicas;usesRunTreeMap=!0;tracingMetadata;tracingTags=[];constructor(t={}){super(t),this.fields=t;let{exampleId:r,projectName:n,client:i,replicas:a,metadata:o,tags:s}=t;this.projectName=n??rl(),this.replicas=a,this.exampleId=r,this.client=i??uf(),this.tracingMetadata=o?{...o}:void 0,this.tracingTags=s??[];let c=v_.getTraceableRunTree();c&&this.updateFromRunTree(c)}async persistRun(t){}async onRunCreate(t){fT(this,t),t.extra?.lc_defers_inputs||await this.getRunTreeWithTracingConfig(t.id)?.postRun()}async onRunUpdate(t){fT(this,t);let r=this.getRunTreeWithTracingConfig(t.id);t.extra?.lc_defers_inputs?await r?.postRun():await r?.patchRun()}onLLMEnd(t){let r=t.outputs;if(r?.generations){let n=gz(r.generations);if(n!==void 0){t.extra=t.extra??{};let i=t.extra.metadata??{};i.usage_metadata=n,t.extra.metadata=i}}}copyWithTracingConfig({metadata:t,tags:r}){let n;if(t===void 0)n=this.tracingMetadata?{...this.tracingMetadata}:void 0;else if(this.tracingMetadata===void 0)n={...t};else{n={...this.tracingMetadata};for(let[o,s]of Object.entries(t))(!Object.prototype.hasOwnProperty.call(n,o)||b_.has(o))&&(n[o]=s)}let i=r?Array.from(new Set([...this.tracingTags,...r])):[...this.tracingTags],a=new v_({...this.fields,metadata:n,tags:i});return a.runMap=this.runMap,a.runTreeMap=this.runTreeMap,a}_getRunStoreKey(){return this.runTreeMap}getRun(t){return this.runTreeMap.get(t)}updateFromRunTree(t){this.runTreeMap.set(t.id,t);let r=t,n=new Set;for(;r.parent_run&&!(n.has(r.id)||(n.add(r.id),!r.parent_run));)r=r.parent_run;n.clear();let i=[r];for(;i.length>0;){let a=i.shift();!a||n.has(a.id)||(n.add(a.id),this.runTreeMap.set(a.id,a),a.child_runs&&i.push(...a.child_runs))}this.client=t.client??this.client,this.replicas=t.replicas??this.replicas,this.projectName=t.project_name??this.projectName,this.exampleId=t.reference_example_id??this.exampleId,this.fields={...this.fields,client:this.client,replicas:this.replicas,projectName:this.projectName,exampleId:this.exampleId}}getRunTreeWithTracingConfig(t){let r=this.runTreeMap.get(t);if(r)return new pn({...r,client:this.client,project_name:this.projectName,replicas:this.replicas,reference_example_id:this.exampleId,tracingEnabled:!0})}static getTraceableRunTree(){try{return dT(!0)}catch{return}}static[Symbol.hasInstance](t){if(typeof t!="object"||t===null)return!1;let r=t;return"name"in r&&r.name==="langchain_tracer"&&"copyWithTracingConfig"in r&&typeof r.copyWithTracingConfig=="function"&&"getRunTreeWithTracingConfig"in r&&typeof r.getRunTreeWithTracingConfig=="function"}};function fT(e,t){if(e.tracingMetadata){t.extra??={};let r=t.extra.metadata??{},n=!1;for(let[i,a]of Object.entries(e.tracingMetadata))(!Object.prototype.hasOwnProperty.call(r,i)||b_.has(i))&&r[i]!==a&&(r[i]=a,n=!0);n&&(t.extra.metadata=r)}e.tracingTags.length>0&&(t.tags=Array.from(new Set([...t.tags??[],...e.tracingTags])))}var mT=Symbol.for("ls:tracing_async_local_storage"),sa=Symbol.for("lc:context_variables"),hT=e=>{globalThis[mT]=e},ca=()=>globalThis[mT];var ff=qu(Yd(),1),lo;function _z(){return new("default"in ff.default?ff.default.default:ff.default)({autoStart:!0,concurrency:1})}function yz(){return typeof lo>"u"&&(lo=_z()),lo}async function nt(e,t){if(t===!0){let r=ca();r!==void 0?await r.run(void 0,async()=>e()):await e()}else lo=yz(),lo.add(async()=>{let r=ca();r!==void 0?await r.run(void 0,async()=>e()):await e()})}async function gT(){let e=uf();await Promise.allSettled([typeof lo<"u"?lo.onIdle():Promise.resolve(),e.awaitPendingTraceBatches()])}var _T=T({awaitAllCallbacks:()=>gT,consumeCallback:()=>nt});var yT=e=>e!==void 0?e:!!["LANGSMITH_TRACING_V2","LANGCHAIN_TRACING_V2","LANGSMITH_TRACING","LANGCHAIN_TRACING"].find(t=>xt(t)==="true");function w_(e){let t=ca();if(t!==void 0)return t.getStore()?.[sa]?.[e]}var vz=Symbol("lc:configure_hooks"),vT=()=>w_(vz)||[];var bT=T({BaseCallbackManager:()=>wT,BaseRunManager:()=>ul,CallbackManager:()=>Ye,CallbackManagerForChainRun:()=>ST,CallbackManagerForLLMRun:()=>S_,CallbackManagerForRetrieverRun:()=>xT,CallbackManagerForToolRun:()=>kT,ensureHandler:()=>_i,parseCallbackConfigArg:()=>uo});function x_(e){return e._getRunStoreKey?.()??e}function bz(e,t){return e===t?e:e.copyWithTracingConfig({metadata:t.tracingMetadata,tags:t.tracingTags})}function wz(e,t){let r=new Set(t),n=new Map,i=[],a=s=>{let c=x_(s),l=r.has(s),u=n.get(c);if(u===void 0){n.set(c,{index:i.length,tracer:s,hasInheritable:l}),i.push(s);return}l&&!u.hasInheritable?(u.tracer=s,u.hasInheritable=!0):(l||!u.hasInheritable)&&(u.tracer=bz(u.tracer,s)),i[u.index]=u.tracer};for(let s of e)s instanceof oa?a(s):i.push(s);for(let s of t)s instanceof oa&&!n.has(x_(s))&&a(s);let o=new Set;return{handlers:i,inheritableHandlers:t.flatMap(s=>{if(!(s instanceof oa))return[s];let c=x_(s);return o.has(c)?[]:(o.add(c),[n.get(c)?.tracer??s])})}}function uo(e){return e?Array.isArray(e)||"name"in e?{callbacks:e}:e:{}}var wT=class{setHandler(e){return this.setHandlers([e])}},ul=class{runId;handlers;inheritableHandlers;tags;inheritableTags;metadata;inheritableMetadata;_parentRunId;constructor(e,t,r,n,i,a,o,s){this.runId=e,this.handlers=t,this.inheritableHandlers=r,this.tags=n,this.inheritableTags=i,this.metadata=a,this.inheritableMetadata=o,this._parentRunId=s}get parentRunId(){return this._parentRunId}async handleText(e){await Promise.all(this.handlers.map(t=>nt(async()=>{try{await t.handleText?.(e,this.runId,this._parentRunId,this.tags)}catch(r){if((t.raiseError?console.error:console.warn)(`Error in handler ${t.constructor.name}, handleText: ${r}`),t.raiseError)throw r}},t.awaitHandlers)))}async handleCustomEvent(e,t,r,n,i){await Promise.all(this.handlers.map(a=>nt(async()=>{try{await a.handleCustomEvent?.(e,t,this.runId,this.tags,this.metadata)}catch(o){if((a.raiseError?console.error:console.warn)(`Error in handler ${a.constructor.name}, handleCustomEvent: ${o}`),a.raiseError)throw o}},a.awaitHandlers)))}},xT=class extends ul{getChild(e){let t=new Ye(this.runId);return t.setHandlers(this.inheritableHandlers),t.addTags(this.inheritableTags),t.addMetadata(this.inheritableMetadata),e&&t.addTags([e],!1),t}async handleRetrieverEnd(e){await Promise.all(this.handlers.map(t=>nt(async()=>{if(!t.ignoreRetriever)try{await t.handleRetrieverEnd?.(e,this.runId,this._parentRunId,this.tags)}catch(r){if((t.raiseError?console.error:console.warn)(`Error in handler ${t.constructor.name}, handleRetriever`),t.raiseError)throw r}},t.awaitHandlers)))}async handleRetrieverError(e){await Promise.all(this.handlers.map(t=>nt(async()=>{if(!t.ignoreRetriever)try{await t.handleRetrieverError?.(e,this.runId,this._parentRunId,this.tags)}catch(r){if((t.raiseError?console.error:console.warn)(`Error in handler ${t.constructor.name}, handleRetrieverError: ${r}`),t.raiseError)throw e}},t.awaitHandlers)))}},S_=class extends ul{async handleLLMNewToken(e,t,r,n,i,a){await Promise.all(this.handlers.map(o=>nt(async()=>{if(!o.ignoreLLM)try{await o.handleLLMNewToken?.(e,t??{prompt:0,completion:0},this.runId,this._parentRunId,this.tags,a)}catch(s){if((o.raiseError?console.error:console.warn)(`Error in handler ${o.constructor.name}, handleLLMNewToken: ${s}`),o.raiseError)throw s}},o.awaitHandlers)))}async handleChatModelStreamEvent(e){await Promise.all(this.handlers.map(t=>nt(async()=>{if(!t.ignoreLLM)try{await t.handleChatModelStreamEvent?.(e,this.runId,this._parentRunId,this.tags)}catch(r){if((t.raiseError?console.error:console.warn)(`Error in handler ${t.constructor.name}, handleChatModelStreamEvent: ${r}`),t.raiseError)throw r}},t.awaitHandlers)))}async handleLLMError(e,t,r,n,i){await Promise.all(this.handlers.map(a=>nt(async()=>{if(!a.ignoreLLM)try{await a.handleLLMError?.(e,this.runId,this._parentRunId,this.tags,i)}catch(o){if((a.raiseError?console.error:console.warn)(`Error in handler ${a.constructor.name}, handleLLMError: ${o}`),a.raiseError)throw o}},a.awaitHandlers)))}async handleLLMEnd(e,t,r,n,i){await Promise.all(this.handlers.map(a=>nt(async()=>{if(!a.ignoreLLM)try{await a.handleLLMEnd?.(e,this.runId,this._parentRunId,this.tags,i)}catch(o){if((a.raiseError?console.error:console.warn)(`Error in handler ${a.constructor.name}, handleLLMEnd: ${o}`),a.raiseError)throw o}},a.awaitHandlers)))}},ST=class extends ul{getChild(e){let t=new Ye(this.runId);return t.setHandlers(this.inheritableHandlers),t.addTags(this.inheritableTags),t.addMetadata(this.inheritableMetadata),e&&t.addTags([e],!1),t}async handleChainError(e,t,r,n,i){await Promise.all(this.handlers.map(a=>nt(async()=>{if(!a.ignoreChain)try{await a.handleChainError?.(e,this.runId,this._parentRunId,this.tags,i)}catch(o){if((a.raiseError?console.error:console.warn)(`Error in handler ${a.constructor.name}, handleChainError: ${o}`),a.raiseError)throw o}},a.awaitHandlers)))}async handleChainEnd(e,t,r,n,i){await Promise.all(this.handlers.map(a=>nt(async()=>{if(!a.ignoreChain)try{await a.handleChainEnd?.(e,this.runId,this._parentRunId,this.tags,i)}catch(o){if((a.raiseError?console.error:console.warn)(`Error in handler ${a.constructor.name}, handleChainEnd: ${o}`),a.raiseError)throw o}},a.awaitHandlers)))}async handleAgentAction(e){await Promise.all(this.handlers.map(t=>nt(async()=>{if(!t.ignoreAgent)try{await t.handleAgentAction?.(e,this.runId,this._parentRunId,this.tags)}catch(r){if((t.raiseError?console.error:console.warn)(`Error in handler ${t.constructor.name}, handleAgentAction: ${r}`),t.raiseError)throw r}},t.awaitHandlers)))}async handleAgentEnd(e){await Promise.all(this.handlers.map(t=>nt(async()=>{if(!t.ignoreAgent)try{await t.handleAgentEnd?.(e,this.runId,this._parentRunId,this.tags)}catch(r){if((t.raiseError?console.error:console.warn)(`Error in handler ${t.constructor.name}, handleAgentEnd: ${r}`),t.raiseError)throw r}},t.awaitHandlers)))}},kT=class extends ul{getChild(e){let t=new Ye(this.runId);return t.setHandlers(this.inheritableHandlers),t.addTags(this.inheritableTags),t.addMetadata(this.inheritableMetadata),e&&t.addTags([e],!1),t}async handleToolError(e){await Promise.all(this.handlers.map(t=>nt(async()=>{if(!t.ignoreAgent)try{await t.handleToolError?.(e,this.runId,this._parentRunId,this.tags)}catch(r){if((t.raiseError?console.error:console.warn)(`Error in handler ${t.constructor.name}, handleToolError: ${r}`),t.raiseError)throw r}},t.awaitHandlers)))}async handleToolEvent(e){await Promise.all(this.handlers.map(t=>nt(async()=>{if(!t.ignoreAgent)try{await t.handleToolEvent?.(e,this.runId,this._parentRunId,this.tags)}catch(r){if(t.raiseError)throw r}},t.awaitHandlers)))}async handleToolEnd(e){await Promise.all(this.handlers.map(t=>nt(async()=>{if(!t.ignoreAgent)try{await t.handleToolEnd?.(e,this.runId,this._parentRunId,this.tags)}catch(r){if((t.raiseError?console.error:console.warn)(`Error in handler ${t.constructor.name}, handleToolEnd: ${r}`),t.raiseError)throw r}},t.awaitHandlers)))}},Ye=class ll extends wT{handlers=[];inheritableHandlers=[];tags=[];inheritableTags=[];metadata={};inheritableMetadata={};name="callback_manager";_parentRunId;constructor(t,r){super(),this.handlers=r?.handlers??this.handlers,this.inheritableHandlers=r?.inheritableHandlers??this.inheritableHandlers,this.tags=r?.tags??this.tags,this.inheritableTags=r?.inheritableTags??this.inheritableTags,this.metadata=r?.metadata??this.metadata,this.inheritableMetadata=r?.inheritableMetadata??this.inheritableMetadata,this._parentRunId=t}getParentRunId(){return this._parentRunId}async handleLLMStart(t,r,n=void 0,i=void 0,a=void 0,o=void 0,s=void 0,c=void 0){return Promise.all(r.map(async(l,u)=>{let d=u===0&&n?n:Hr();return await Promise.all(this.handlers.map(f=>{if(!f.ignoreLLM)return co(f)&&f._createRunForLLMStart(t,[l],d,this._parentRunId,a,this.tags,this.metadata,c),nt(async()=>{try{await f.handleLLMStart?.(t,[l],d,this._parentRunId,a,this.tags,this.metadata,c)}catch(p){if((f.raiseError?console.error:console.warn)(`Error in handler ${f.constructor.name}, handleLLMStart: ${p}`),f.raiseError)throw p}},f.awaitHandlers)})),new S_(d,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChatModelStart(t,r,n=void 0,i=void 0,a=void 0,o=void 0,s=void 0,c=void 0){return Promise.all(r.map(async(l,u)=>{let d=u===0&&n?n:Hr();return await Promise.all(this.handlers.map(f=>{if(!f.ignoreLLM)return co(f)&&f._createRunForChatModelStart(t,[l],d,this._parentRunId,a,this.tags,this.metadata,c),nt(async()=>{try{if(f.handleChatModelStart)await f.handleChatModelStart?.(t,[l],d,this._parentRunId,a,this.tags,this.metadata,c);else if(f.handleLLMStart){let p=ps(l);await f.handleLLMStart?.(t,[p],d,this._parentRunId,a,this.tags,this.metadata,c)}}catch(p){if((f.raiseError?console.error:console.warn)(`Error in handler ${f.constructor.name}, handleLLMStart: ${p}`),f.raiseError)throw p}},f.awaitHandlers)})),new S_(d,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChainStart(t,r,n=Hr(),i=void 0,a=void 0,o=void 0,s=void 0,c=void 0,l=void 0){return await Promise.all(this.handlers.map(u=>{if(!u.ignoreChain)return co(u)&&u._createRunForChainStart(t,r,n,this._parentRunId,this.tags,this.metadata,i,s,l),nt(async()=>{try{await u.handleChainStart?.(t,r,n,this._parentRunId,this.tags,this.metadata,i,s,l)}catch(d){if((u.raiseError?console.error:console.warn)(`Error in handler ${u.constructor.name}, handleChainStart: ${d}`),u.raiseError)throw d}},u.awaitHandlers)})),new ST(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleToolStart(t,r,n=Hr(),i=void 0,a=void 0,o=void 0,s=void 0,c=void 0){return await Promise.all(this.handlers.map(l=>{if(!l.ignoreAgent)return co(l)&&l._createRunForToolStart(t,r,n,this._parentRunId,this.tags,this.metadata,s),nt(async()=>{try{await l.handleToolStart?.(t,r,n,this._parentRunId,this.tags,this.metadata,s,c)}catch(u){if((l.raiseError?console.error:console.warn)(`Error in handler ${l.constructor.name}, handleToolStart: ${u}`),l.raiseError)throw u}},l.awaitHandlers)})),new kT(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleRetrieverStart(t,r,n=Hr(),i=void 0,a=void 0,o=void 0,s=void 0){return await Promise.all(this.handlers.map(c=>{if(!c.ignoreRetriever)return co(c)&&c._createRunForRetrieverStart(t,r,n,this._parentRunId,this.tags,this.metadata,s),nt(async()=>{try{await c.handleRetrieverStart?.(t,r,n,this._parentRunId,this.tags,this.metadata,s)}catch(l){if((c.raiseError?console.error:console.warn)(`Error in handler ${c.constructor.name}, handleRetrieverStart: ${l}`),c.raiseError)throw l}},c.awaitHandlers)})),new xT(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleCustomEvent(t,r,n,i,a){await Promise.all(this.handlers.map(o=>nt(async()=>{if(!o.ignoreCustomEvent)try{await o.handleCustomEvent?.(t,r,n,this.tags,this.metadata)}catch(s){if((o.raiseError?console.error:console.warn)(`Error in handler ${o.constructor.name}, handleCustomEvent: ${s}`),o.raiseError)throw s}},o.awaitHandlers)))}addHandler(t,r=!0){this.handlers.push(t),r&&this.inheritableHandlers.push(t)}removeHandler(t){this.handlers=this.handlers.filter(r=>r!==t),this.inheritableHandlers=this.inheritableHandlers.filter(r=>r!==t)}setHandlers(t,r=!0){this.handlers=[],this.inheritableHandlers=[];for(let n of t)this.addHandler(n,r)}addTags(t,r=!0){this.removeTags(t),this.tags.push(...t),r&&this.inheritableTags.push(...t)}removeTags(t){this.tags=this.tags.filter(r=>!t.includes(r)),this.inheritableTags=this.inheritableTags.filter(r=>!t.includes(r))}addMetadata(t,r=!0){this.metadata={...this.metadata,...t},r&&(this.inheritableMetadata={...this.inheritableMetadata,...t})}removeMetadata(t){for(let r of Object.keys(t))delete this.metadata[r],delete this.inheritableMetadata[r]}copy(t=[],r=!0){let n=new ll(this._parentRunId);for(let i of this.handlers){let a=this.inheritableHandlers.includes(i);n.addHandler(i,a)}for(let i of this.tags){let a=this.inheritableTags.includes(i);n.addTags([i],a)}for(let i of Object.keys(this.metadata)){let a=Object.keys(this.inheritableMetadata).includes(i);n.addMetadata({[i]:this.metadata[i]},a)}for(let i of t)n.handlers.filter(a=>a.name==="console_callback_handler").some(a=>a.name===i.name)||n.addHandler(i,r);return n}static fromHandlers(t){class r extends sr{name=Hr();constructor(){super(),Object.assign(this,t)}}let n=new this;return n.addHandler(new r),n}static configure(t,r,n,i,a,o,s){return this._configureSync(t,r,n,i,a,o,s)}static _configureSync(t,r,n,i,a,o,s){let c;(t||r)&&(Array.isArray(t)||!t?(c=new ll,c.setHandlers(t?.map(_i)??[],!0)):c=t,c=c.copy(Array.isArray(r)?r.map(_i):r?.handlers,!1));let l=xt("LANGCHAIN_VERBOSE")==="true"||s?.verbose,u=oa.getTraceableRunTree(),d=u?.tracingEnabled??yT();if(u?.tracingEnabled===!1&&c){let h=c.handlers.filter(_=>_.name==="langchain_tracer");for(let _ of h)c.removeHandler(_)}let f=d||(xt("LANGCHAIN_TRACING")??!1);if(l||f){if(c||(c=new ll),l&&!c.handlers.some(h=>h.name===lf.prototype.name)){let h=new lf;c.addHandler(h,!0)}if(f&&!c.handlers.some(h=>h.name==="langchain_tracer")&&d){let h=new oa;c.addHandler(h,!0)}d&&u&&c._parentRunId===void 0&&(c._parentRunId=u.id,c.handlers.find(h=>h.name==="langchain_tracer")?.updateFromRunTree(u))}for(let{contextVar:h,inheritable:_=!0,handlerClass:y,envVar:w}of vT()){let x=w&&xt(w)==="true"&&y,S,E=h!==void 0?w_(h):void 0;E&&yg(E)?S=E:x&&(S=new y({})),S!==void 0&&(c||(c=new ll),c.handlers.some(P=>P.name===S.name)||c.addHandler(S,_))}(n||i)&&c&&(c.addTags(n??[]),c.addTags(i??[],!1)),(a||o)&&c&&(c.addMetadata(a??{}),c.addMetadata(o??{},!1));let p=s?.tracerInheritableMetadata,m=s?.tracerInheritableTags;if(c&&(p||m)){let h=new Map,_=y=>{if(!(y instanceof oa))return y;let w=h.get(y);if(w!==void 0)return w;let x=y.copyWithTracingConfig({metadata:p,tags:m});return h.set(y,x),x};c.handlers=c.handlers.map(_),c.inheritableHandlers=c.inheritableHandlers.map(_)}if(c){let h=wz(c.handlers,c.inheritableHandlers);c.handlers=h.handlers,c.inheritableHandlers=h.inheritableHandlers}return c}};function _i(e){return"name"in e?e:sr.fromMethods(e)}var k_=class{getStore(){}run(e,t){return t()}enterWith(e){}},xz=new k_,ET=Symbol.for("lc:child_config"),Sz=class{getInstance(){return ca()??xz}getRunnableConfig(){return this.getInstance().getStore()?.extra?.[ET]}runWithConfig(e,t,r){let n=Ye._configureSync(e?.callbacks,void 0,e?.tags,void 0,e?.metadata),i=this.getInstance(),a=i.getStore(),o=n?.getParentRunId(),s=n?.handlers?.find(l=>l?.name==="langchain_tracer"),c;return s&&o?c=s.getRunTreeWithTracingConfig(o):r||(c=new pn({name:"<runnable_lambda>",tracingEnabled:!1})),c&&(c.extra={...c.extra,[ET]:e}),a!==void 0&&a[sa]!==void 0&&(c===void 0&&(c={}),c[sa]=a[sa]),i.run(c,t)}initializeGlobalInstance(e){ca()===void 0&&hT(e)}},Re=new Sz;var $T=T({AsyncLocalStorageProviderSingleton:()=>Re,MockAsyncLocalStorage:()=>k_,_CONTEXT_VARIABLES_KEY:()=>sa});var kz=new Set(["api_key"]),Ez=new Set(["string","number","boolean"]);function $z(e){let t=e.configurable??{},r=e.metadata??{},n={};for(let[i,a]of Object.entries(t))!i.startsWith("__")&&!Object.prototype.hasOwnProperty.call(r,i)&&!kz.has(i)&&Ez.has(typeof a)&&(n[i]=a);return Object.keys(n).length>0?n:void 0}async function Jt(e){return Ye._configureSync(e?.callbacks,void 0,e?.tags,void 0,e?.metadata,void 0,{tracerInheritableMetadata:e?$z(e):void 0})}function $t(...e){let t={};for(let r of e.filter(n=>!!n))for(let n of Object.keys(r))if(n==="metadata")t[n]={...t[n],...r[n]};else if(n==="tags"){let i=t[n]??[];t[n]=[...new Set(i.concat(r[n]??[]))]}else if(n==="configurable")t[n]={...t[n],...r[n]};else if(n==="timeout")t.timeout===void 0?t.timeout=r.timeout:r.timeout!==void 0&&(t.timeout=Math.min(t.timeout,r.timeout));else if(n==="signal")t.signal===void 0?t.signal=r.signal:r.signal!==void 0&&("any"in AbortSignal?t.signal=AbortSignal.any([t.signal,r.signal]):t.signal=r.signal);else if(n==="callbacks"){let i=t.callbacks,a=r.callbacks;if(Array.isArray(a))if(!i)t.callbacks=a;else if(Array.isArray(i))t.callbacks=i.concat(a);else{let o=i.copy();for(let s of a)o.addHandler(_i(s),!0);t.callbacks=o}else if(a)if(!i)t.callbacks=a;else if(Array.isArray(i)){let o=a.copy();for(let s of i)o.addHandler(_i(s),!0);t.callbacks=o}else t.callbacks=new Ye(a._parentRunId,{handlers:i.handlers.concat(a.handlers),inheritableHandlers:i.inheritableHandlers.concat(a.inheritableHandlers),tags:Array.from(new Set(i.tags.concat(a.tags))),inheritableTags:Array.from(new Set(i.inheritableTags.concat(a.inheritableTags))),metadata:{...i.metadata,...a.metadata}})}else{let i=n;t[i]=r[i]??t[i]}return t}function ke(e){let t=Re.getRunnableConfig(),r={tags:[],metadata:{},recursionLimit:25,runId:void 0};if(t){let{runId:n,runName:i,...a}=t;r=Object.entries(a).reduce((o,[s,c])=>(c!==void 0&&(o[s]=c),o),r)}if(e&&(r=Object.entries(e).reduce((n,[i,a])=>(a!==void 0&&(n[i]=a),n),r)),r?.configurable&&typeof r.configurable.model=="string"&&r.metadata?.model===void 0&&(r.metadata||(r.metadata={}),r.metadata.model=r.configurable.model),r.timeout!==void 0){if(r.timeout<=0)throw new Error("Timeout must be a positive number");let n=r.timeout,i=AbortSignal.timeout(n);r.metadata||(r.metadata={}),r.metadata.timeoutMs===void 0&&(r.metadata.timeoutMs=n),r.signal!==void 0?"any"in AbortSignal&&(r.signal=AbortSignal.any([r.signal,i])):r.signal=i,delete r.timeout}return r}function $e(e={},{callbacks:t,maxConcurrency:r,recursionLimit:n,runName:i,configurable:a,runId:o}={}){let s=ke(e);return t!==void 0&&(delete s.runName,s.callbacks=t),n!==void 0&&(s.recursionLimit=n),r!==void 0&&(s.maxConcurrency=r),i!==void 0&&(s.runName=i),a!==void 0&&(s.configurable={...s.configurable,...a}),o!==void 0&&delete s.runId,s}function vr(e){if(e)return{configurable:e.configurable,recursionLimit:e.recursionLimit,callbacks:e.callbacks,tags:e.tags,metadata:e.metadata,maxConcurrency:e.maxConcurrency,timeout:e.timeout,signal:e.signal,store:e.store}}async function Rr(e,t){if(t===void 0)return e;let r;return Promise.race([e.catch(n=>{if(!t?.aborted)throw n}),new Promise((n,i)=>{r=()=>{i(la(t))},t.addEventListener("abort",r,{once:!0}),t.aborted&&i(la(t))})]).finally(()=>t.removeEventListener("abort",r))}function la(e){return e?.reason instanceof Error?e.reason:typeof e?.reason=="string"?new Error(e.reason):new Error("Aborted")}var IT=T({AsyncGeneratorWithSetup:()=>ua,IterableReadableStream:()=>gt,atee:()=>pf,concat:()=>Mr,pipeGeneratorWithSetup:()=>$_}),gt=class E_ extends ReadableStream{reader;ensureReader(){this.reader||(this.reader=this.getReader())}async next(){this.ensureReader();try{let t=await this.reader.read();return t.done?(this.reader.releaseLock(),{done:!0,value:void 0}):{done:!1,value:t.value}}catch(t){throw this.reader.releaseLock(),t}}async return(){if(this.ensureReader(),this.locked){let t=this.reader.cancel();this.reader.releaseLock(),await t}return{done:!0,value:void 0}}async throw(t){if(this.ensureReader(),this.locked){let r=this.reader.cancel();this.reader.releaseLock(),await r}throw t}[Symbol.asyncIterator](){return this}async[Symbol.asyncDispose](){await this.return()}static fromReadableStream(t){let r=t.getReader();return new E_({start(n){return i();function i(){return r.read().then(({done:a,value:o})=>{if(a){n.close();return}return n.enqueue(o),i()})}},cancel(){r.releaseLock()}})}static fromAsyncGenerator(t){return new E_({async pull(r){let{value:n,done:i}=await t.next();i&&r.close(),r.enqueue(n)},async cancel(r){await t.return(r)}})}};function pf(e,t=2){let r=Array.from({length:t},()=>[]);return r.map(async function*(i){for(;;)if(i.length===0){let a=await e.next();for(let o of r)o.push(a)}else{if(i[0].done)return;yield i.shift().value}})}function Mr(e,t){if(Array.isArray(e)&&Array.isArray(t))return e.concat(t);if(typeof e=="string"&&typeof t=="string")return e+t;if(typeof e=="number"&&typeof t=="number")return e+t;if("concat"in e&&typeof e.concat=="function")return e.concat(t);if(typeof e=="object"&&typeof t=="object"){let r={...e};for(let[n,i]of Object.entries(t))n in r&&!Array.isArray(r[n])?r[n]=Mr(r[n],i):r[n]=i;return r}else throw new Error(`Cannot concat ${typeof e} and ${typeof t}`)}var ua=class{generator;setup;config;signal;firstResult;firstResultUsed=!1;constructor(e){this.generator=e.generator,this.config=e.config,this.signal=e.signal??this.config?.signal,this.setup=new Promise((t,r)=>{Re.runWithConfig(vr(e.config),async()=>{this.firstResult=this.signal?Rr(e.generator.next(),this.signal):e.generator.next(),e.startSetup?this.firstResult.then(e.startSetup).then(t,r):this.firstResult.then(n=>t(void 0),r)},!0)})}async next(...e){return this.signal?.throwIfAborted(),this.firstResultUsed?Re.runWithConfig(vr(this.config),this.signal?async()=>Rr(this.generator.next(...e),this.signal):async()=>this.generator.next(...e),!0):(this.firstResultUsed=!0,this.firstResult)}async return(e){return this.generator.return(e)}async throw(e){return this.generator.throw(e)}[Symbol.asyncIterator](){return this}async[Symbol.asyncDispose](){await this.return()}};async function $_(e,t,r,n,...i){let a=new ua({generator:t,startSetup:r,signal:n}),o=await a.setup;return{output:e(a,o,...i),setup:o}}var Iz=Object.prototype.hasOwnProperty;function hf(e,t){return Iz.call(e,t)}function gf(e){if(Array.isArray(e)){let r=new Array(e.length);for(let n=0;n<r.length;n++)r[n]=""+n;return r}if(Object.keys)return Object.keys(e);let t=[];for(let r in e)hf(e,r)&&t.push(r);return t}function jr(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function _f(e){let t=0,r=e.length,n;for(;t<r;){if(n=e.charCodeAt(t),n>=48&&n<=57){t++;continue}return!1}return!0}function fo(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function CT(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function mf(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(let r=0,n=e.length;r<n;r++)if(mf(e[r]))return!0}else if(typeof e=="object"){let r=gf(e),n=r.length;for(var t=0;t<n;t++)if(mf(e[r[t]]))return!0}}return!1}function TT(e,t){let r=[e];for(let n in t){let i=typeof t[n]=="object"?JSON.stringify(t[n],null,2):t[n];typeof i<"u"&&r.push(`${n}: ${i}`)}return r.join(`
154
+ `)}var AT=class extends Error{name;index;operation;tree;constructor(e,t,r,n,i){super(TT(e,{name:t,index:r,operation:n,tree:i})),this.name=t,this.index=r,this.operation=n,this.tree=i,Object.setPrototypeOf(this,new.target.prototype),this.message=TT(e,{name:t,index:r,operation:n,tree:i})}};var OT=T({JsonPatchError:()=>st,_areEquals:()=>Ss,applyOperation:()=>da,applyPatch:()=>yi,applyReducer:()=>PT,deepClone:()=>Tz,getValueByPointer:()=>dl,validate:()=>I_,validator:()=>fl});var st=AT,Tz=jr,xs={add:function(e,t,r){if(t==="__proto__"||t==="constructor")throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor` prop is banned for security reasons");return e[t]=this.value,{newDocument:r}},remove:function(e,t,r){if(t==="__proto__"||t==="constructor")throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor` prop is banned for security reasons");var n=e[t];return delete e[t],{newDocument:r,removed:n}},replace:function(e,t,r){if(t==="__proto__"||t==="constructor")throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor` prop is banned for security reasons");var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:function(e,t,r){let n=dl(r,this.path);n&&(n=jr(n));let i=da(r,{op:"remove",path:this.from}).removed;return da(r,{op:"add",path:this.path,value:i}),{newDocument:r,removed:n}},copy:function(e,t,r){let n=dl(r,this.from);return da(r,{op:"add",path:this.path,value:jr(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:Ss(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},Cz={add:function(e,t,r){return _f(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:r,index:t}},remove:function(e,t,r){return{newDocument:r,removed:e.splice(t,1)[0]}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:xs.move,copy:xs.copy,test:xs.test,_get:xs._get};function dl(e,t){if(t=="")return e;var r={op:"_get",path:t};return da(e,r),r.value}function da(e,t,r=!1,n=!0,i=!0,a=0){if(r&&(typeof r=="function"?r(t,0,e,t.path):fl(t,0)),t.path===""){let o={newDocument:e};if(t.op==="add")return o.newDocument=t.value,o;if(t.op==="replace")return o.newDocument=t.value,o.removed=e,o;if(t.op==="move"||t.op==="copy")return o.newDocument=dl(e,t.from),t.op==="move"&&(o.removed=e),o;if(t.op==="test"){if(o.test=Ss(e,t.value),o.test===!1)throw new st("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return o.newDocument=e,o}else{if(t.op==="remove")return o.removed=e,o.newDocument=null,o;if(t.op==="_get")return t.value=e,o;if(r)throw new st("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",a,t,e);return o}}else{n||(e=jr(e));let o=(t.path||"").split("/"),s=e,c=1,l=o.length,u,d,f;for(typeof r=="function"?f=r:f=fl;;){if(d=o[c],d&&d.indexOf("~")!=-1&&(d=CT(d)),i&&(d=="__proto__"||d=="prototype"&&c>0&&o[c-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&u===void 0&&(s[d]===void 0?u=o.slice(0,c).join("/"):c==l-1&&(u=t.path),u!==void 0&&f(t,0,e,u)),c++,Array.isArray(s)){if(d==="-")d=s.length;else{if(r&&!_f(d))throw new st("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",a,t,e);_f(d)&&(d=~~d)}if(c>=l){if(r&&t.op==="add"&&d>s.length)throw new st("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",a,t,e);let p=Cz[t.op].call(t,s,d,e);if(p.test===!1)throw new st("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return p}}else if(c>=l){let p=xs[t.op].call(t,s,d,e);if(p.test===!1)throw new st("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return p}if(s=s[d],r&&c<l&&(!s||typeof s!="object"))throw new st("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",a,t,e)}}}function yi(e,t,r,n=!0,i=!0){if(r&&!Array.isArray(t))throw new st("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=jr(e));let a=new Array(t.length);for(let o=0,s=t.length;o<s;o++)a[o]=da(e,t[o],r,!0,i,o),e=a[o].newDocument;return a.newDocument=e,a}function PT(e,t,r){let n=da(e,t);if(n.test===!1)throw new st("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function fl(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new st("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(xs[e.op]){if(typeof e.path!="string")throw new st("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new st('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,r);if((e.op==="move"||e.op==="copy")&&typeof e.from!="string")throw new st("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&e.value===void 0)throw new st("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&mf(e.value))throw new st("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,r);if(r){if(e.op=="add"){var i=e.path.split("/").length,a=n.split("/").length;if(i!==a+1&&i!==a)throw new st("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,r)}else if(e.op==="replace"||e.op==="remove"||e.op==="_get"){if(e.path!==n)throw new st("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,r)}else if(e.op==="move"||e.op==="copy"){var o=I_([{op:"_get",path:e.from,value:void 0}],r);if(o&&o.name==="OPERATION_PATH_UNRESOLVABLE")throw new st("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new st("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function I_(e,t,r){try{if(!Array.isArray(e))throw new st("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)yi(jr(t),jr(e),r||!0);else{r=r||fl;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(i){if(i instanceof st)return i;throw i}}function Ss(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){var r=Array.isArray(e),n=Array.isArray(t),i,a,o;if(r&&n){if(a=e.length,a!=t.length)return!1;for(i=a;i--!==0;)if(!Ss(e[i],t[i]))return!1;return!0}if(r!=n)return!1;var s=Object.keys(e);if(a=s.length,a!==Object.keys(t).length)return!1;for(i=a;i--!==0;)if(!t.hasOwnProperty(s[i]))return!1;for(i=a;i--!==0;)if(o=s[i],!Ss(e[o],t[o]))return!1;return!0}return e!==e&&t!==t}function NT(e,t,r,n,i){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var a=gf(t),o=gf(e),s=!1,c=o.length-1;c>=0;c--){var l=o[c],u=e[l];if(hf(t,l)&&!(t[l]===void 0&&u!==void 0&&Array.isArray(t)===!1)){var d=t[l];typeof u=="object"&&u!=null&&typeof d=="object"&&d!=null&&Array.isArray(u)===Array.isArray(d)?NT(u,d,r,n+"/"+fo(l),i):u!==d&&(i&&r.push({op:"test",path:n+"/"+fo(l),value:jr(u)}),r.push({op:"replace",path:n+"/"+fo(l),value:jr(d)}))}else Array.isArray(e)===Array.isArray(t)?(i&&r.push({op:"test",path:n+"/"+fo(l),value:jr(u)}),r.push({op:"remove",path:n+"/"+fo(l)}),s=!0):(i&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}))}if(!(!s&&a.length==o.length))for(var c=0;c<a.length;c++){var l=a[c];!hf(e,l)&&t[l]!==void 0&&r.push({op:"add",path:n+"/"+fo(l),value:jr(t[l])})}}}function vi(e,t,r=!1){var n=[];return NT(e,t,n,"",r),n}({...OT});var jT=T({LogStreamCallbackHandler:()=>vf,RunLog:()=>yf,RunLogPatch:()=>Vn,isLogStreamHandler:()=>C_}),Vn=class{ops;constructor(e){this.ops=e.ops??[]}concat(e){let t=this.ops.concat(e.ops),r=yi({},t);return new yf({ops:t,state:r[r.length-1].newDocument})}},yf=class T_ extends Vn{state;constructor(t){super(t),this.state=t.state}concat(t){let r=this.ops.concat(t.ops),n=yi(this.state,t.ops);return new T_({ops:r,state:n[n.length-1].newDocument})}static fromRunLogPatch(t){let r=yi({},t.ops);return new T_({ops:t.ops,state:r[r.length-1].newDocument})}},C_=e=>e.name==="log_stream_tracer";async function RT(e,t){if(t==="original")throw new Error("Do not assign inputs with original schema drop the key for now. When inputs are added to streamLog they should be added with standardized schema for streaming events.");let{inputs:r}=e;if(["retriever","llm","prompt"].includes(e.run_type))return r;if(!(Object.keys(r).length===1&&r?.input===""))return r.input}async function MT(e,t){let{outputs:r}=e;return t==="original"||["retriever","llm","prompt"].includes(e.run_type)?r:r!==void 0&&Object.keys(r).length===1&&r?.output!==void 0?r.output:r}function Az(e){return e!==void 0&&e.message!==void 0}var vf=class extends zt{autoClose=!0;includeNames;includeTypes;includeTags;excludeNames;excludeTypes;excludeTags;_schemaFormat="original";rootId;keyMapByRunId={};counterMapByRunName={};transformStream;writer;receiveStream;name="log_stream_tracer";lc_prefer_streaming=!0;constructor(e){super({_awaitHandler:!0,...e}),this.autoClose=e?.autoClose??!0,this.includeNames=e?.includeNames,this.includeTypes=e?.includeTypes,this.includeTags=e?.includeTags,this.excludeNames=e?.excludeNames,this.excludeTypes=e?.excludeTypes,this.excludeTags=e?.excludeTags,this._schemaFormat=e?._schemaFormat??this._schemaFormat,this.transformStream=new TransformStream,this.writer=this.transformStream.writable.getWriter(),this.receiveStream=gt.fromReadableStream(this.transformStream.readable)}[Symbol.asyncIterator](){return this.receiveStream}async persistRun(e){}_includeRun(e){if(e.id===this.rootId)return!1;let t=e.tags??[],r=this.includeNames===void 0&&this.includeTags===void 0&&this.includeTypes===void 0;return this.includeNames!==void 0&&(r=r||this.includeNames.includes(e.name)),this.includeTypes!==void 0&&(r=r||this.includeTypes.includes(e.run_type)),this.includeTags!==void 0&&(r=r||t.find(n=>this.includeTags?.includes(n))!==void 0),this.excludeNames!==void 0&&(r=r&&!this.excludeNames.includes(e.name)),this.excludeTypes!==void 0&&(r=r&&!this.excludeTypes.includes(e.run_type)),this.excludeTags!==void 0&&(r=r&&t.every(n=>!this.excludeTags?.includes(n))),r}async*tapOutputIterable(e,t){for await(let r of t){if(e!==this.rootId){let n=this.keyMapByRunId[e];n&&await this.writer.write(new Vn({ops:[{op:"add",path:`/logs/${n}/streamed_output/-`,value:r}]}))}yield r}}async onRunCreate(e){if(this.rootId===void 0&&(this.rootId=e.id,await this.writer.write(new Vn({ops:[{op:"replace",path:"",value:{id:e.id,name:e.name,type:e.run_type,streamed_output:[],final_output:void 0,logs:{}}}]}))),!this._includeRun(e))return;this.counterMapByRunName[e.name]===void 0&&(this.counterMapByRunName[e.name]=0),this.counterMapByRunName[e.name]+=1;let t=this.counterMapByRunName[e.name];this.keyMapByRunId[e.id]=t===1?e.name:`${e.name}:${t}`;let r={id:e.id,name:e.name,type:e.run_type,tags:e.tags??[],metadata:e.extra?.metadata??{},start_time:new Date(e.start_time).toISOString(),streamed_output:[],streamed_output_str:[],final_output:void 0,end_time:void 0};this._schemaFormat==="streaming_events"&&(r.inputs=await RT(e,this._schemaFormat)),await this.writer.write(new Vn({ops:[{op:"add",path:`/logs/${this.keyMapByRunId[e.id]}`,value:r}]}))}async onRunUpdate(e){try{let t=this.keyMapByRunId[e.id];if(t===void 0)return;let r=[];this._schemaFormat==="streaming_events"&&r.push({op:"replace",path:`/logs/${t}/inputs`,value:await RT(e,this._schemaFormat)}),r.push({op:"add",path:`/logs/${t}/final_output`,value:await MT(e,this._schemaFormat)}),e.end_time!==void 0&&r.push({op:"add",path:`/logs/${t}/end_time`,value:new Date(e.end_time).toISOString()});let n=new Vn({ops:r});await this.writer.write(n)}finally{if(e.id===this.rootId){let t=new Vn({ops:[{op:"replace",path:"/final_output",value:await MT(e,this._schemaFormat)}]});await this.writer.write(t),this.autoClose&&await this.writer.close()}}}async onLLMNewToken(e,t,r){let n=this.keyMapByRunId[e.id];if(n===void 0)return;let i=e.inputs.messages!==void 0,a;i?Az(r?.chunk)?a=r?.chunk:a=new it({id:`run-${e.id}`,content:t}):a=t;let o=new Vn({ops:[{op:"add",path:`/logs/${n}/streamed_output_str/-`,value:t},{op:"add",path:`/logs/${n}/streamed_output/-`,value:a}]});await this.writer.write(o)}};var DT=T({ChatGenerationChunk:()=>fa,GenerationChunk:()=>bi,RUN_KEY:()=>po}),po="__run",bi=class zT{text;generationInfo;constructor(t){this.text=t.text,this.generationInfo=t.generationInfo}concat(t){return new zT({text:this.text+t.text,generationInfo:{...this.generationInfo,...t.generationInfo}})}},fa=class UT extends bi{message;constructor(t){super(t),this.message=t.message}concat(t){return new UT({text:this.text+t.text,generationInfo:{...this.generationInfo,...t.generationInfo},message:this.message.concat(t.message)})}};var Oz=Object.prototype.toString,Pz=e=>Oz.call(e)==="[object Error]",Nz=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]);function LT(e){if(!(e&&Pz(e)&&e.name==="TypeError"&&typeof e.message=="string"))return!1;let{message:t,stack:r}=e;return t==="Load failed"?r===void 0||"__sentry_captured__"in e:t.startsWith("error sending request for url")?!0:Nz.has(t)}function Rz(e){if(typeof e=="number"){if(e<0)throw new TypeError("Expected `retries` to be a non-negative number.");if(Number.isNaN(e))throw new TypeError("Expected `retries` to be a valid number or Infinity, got NaN.")}else if(e!==void 0)throw new TypeError("Expected `retries` to be a number or Infinity.")}function bf(e,t,{min:r=0,allowInfinity:n=!1}={}){if(t!==void 0){if(typeof t!="number"||Number.isNaN(t))throw new TypeError(`Expected \`${e}\` to be a number${n?" or Infinity":""}.`);if(!n&&!Number.isFinite(t))throw new TypeError(`Expected \`${e}\` to be a finite number.`);if(t<r)throw new TypeError(`Expected \`${e}\` to be \u2265 ${r}.`)}}var Mz=class extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,{message:e}=e):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}};function jz(e,t){let r=Math.max(1,e+1),n=t.randomize?Math.random()+1:1,i=Math.round(n*t.minTimeout*t.factor**(r-1));return i=Math.min(i,t.maxTimeout),i}function FT(e,t){return Number.isFinite(t)?t-(performance.now()-e):t}async function Dz({error:e,attemptNumber:t,retriesConsumed:r,startTime:n,options:i}){let a=e instanceof Error?e:new TypeError(`Non-error was thrown: "${e}". You should only throw errors.`);if(a instanceof Mz)throw a.originalError;let o=Number.isFinite(i.retries)?Math.max(0,i.retries-r):i.retries,s=i.maxRetryTime??Number.POSITIVE_INFINITY,c=Object.freeze({error:a,attemptNumber:t,retriesLeft:o,retriesConsumed:r});if(await i.onFailedAttempt(c),FT(n,s)<=0)throw a;let l=await i.shouldConsumeRetry(c),u=FT(n,s);if(u<=0||o<=0)throw a;if(a instanceof TypeError&&!LT(a)){if(l)throw a;return i.signal?.throwIfAborted(),!1}if(!await i.shouldRetry(c))throw a;if(!l)return i.signal?.throwIfAborted(),!1;let d=jz(r,i),f=typeof a.retryAfterMs=="number"&&a.retryAfterMs>=0?a.retryAfterMs:void 0;f!==void 0&&(d=Math.max(d,f));let p=Math.min(d,u);return p>0&&await new Promise((m,h)=>{let _=()=>{clearTimeout(y),i.signal?.removeEventListener("abort",_),h(i.signal.reason)},y=setTimeout(()=>{i.signal?.removeEventListener("abort",_),m()},p);i.unref&&y.unref?.(),i.signal?.addEventListener("abort",_,{once:!0})}),i.signal?.throwIfAborted(),!0}async function pl(e,t={}){if(t={...t},Rz(t.retries),Object.hasOwn(t,"forever"))throw new Error("The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.");t.retries??=10,t.factor??=2,t.minTimeout??=1e3,t.maxTimeout??=Number.POSITIVE_INFINITY,t.maxRetryTime??=Number.POSITIVE_INFINITY,t.randomize??=!1,t.onFailedAttempt??=()=>{},t.shouldRetry??=()=>!0,t.shouldConsumeRetry??=()=>!0,bf("factor",t.factor,{min:0,allowInfinity:!1}),bf("minTimeout",t.minTimeout,{min:0,allowInfinity:!1}),bf("maxTimeout",t.maxTimeout,{min:0,allowInfinity:!0}),bf("maxRetryTime",t.maxRetryTime,{min:0,allowInfinity:!0}),t.factor>0||(t.factor=1),t.signal?.throwIfAborted();let r=0,n=0,i=performance.now();for(;!Number.isFinite(t.retries)||n<=t.retries;){r++;try{t.signal?.throwIfAborted();let a=await e(r);return t.signal?.throwIfAborted(),a}catch(a){await Dz({error:a,attemptNumber:r,retriesConsumed:n,startTime:i,options:t})&&n++}}throw new Error("Retry attempts exhausted without throwing an error.")}var wf=qu(Yd(),1),VT=T({AsyncCaller:()=>wi,classifyRateLimitError:()=>JT,parseRetryAfterMs:()=>WT}),zz=[400,401,402,403,404,405,406,407,409,413],Uz=6e4,Lz=[/insufficient[_ -]?quota/i,/exceeded (?:your|the current|the available).+quota/i,/usage quota/i,/quota (?:has been )?exhausted/i,/billing/i,/credit balance/i,/out of credits/i,/will reset at/i],Fz=/(?:try again in|retry after)\s+(\d+(?:\.\d+)?)\s*(milliseconds?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h)\b/i;function ZT(e){return typeof e=="object"&&e!==null&&"response"in e&&typeof e.response=="object"&&e.response!==null&&"status"in e.response&&typeof e.response.status=="number"?e.response.status:void 0}function HT(e){if(!(typeof e!="object"||e===null)){if("status"in e&&typeof e.status=="number")return e.status;if("statusCode"in e&&typeof e.statusCode=="number")return e.statusCode}}function O_(e){return typeof e=="object"&&e!==null&&"message"in e&&typeof e.message=="string"?e.message:void 0}function GT(e){if(!(typeof e!="object"||e===null))return"code"in e&&typeof e.code=="string"?e.code:"error"in e&&typeof e.error=="object"&&e.error!==null&&"code"in e.error&&typeof e.error.code=="string"?e.error.code:void 0}function Bz(e){if(e?.headers)return typeof e.headers.get=="function"?e.headers.get("retry-after"):e.headers["retry-after"]??e.headers["Retry-After"];if(e?.response?.headers)return typeof e.response.headers.get=="function"?e.response.headers.get("retry-after"):e.response.headers["retry-after"]??e.response.headers["Retry-After"]}function Vz(e){if(e==null)return;let t=Fz.exec(e);if(!t)return;let r=Number(t[1]),n=t[2]?.toLowerCase();if(!(Number.isNaN(r)||!n))return n==="ms"||n.startsWith("millisecond")?r:n==="m"||n.startsWith("min")?r*6e4:n==="h"||n.startsWith("hr")||n.startsWith("hour")?r*36e5:r*1e3}function BT(e,t){if(e instanceof Error)return e;let r=new Error(t);return typeof e=="object"&&e!==null&&Object.assign(r,e),r}function A_(e,t){if(typeof e!="object"||e===null)return;let r=e;r.rateLimitType=t.action,r.rateLimitReason=t.reason,t.retryAfterMs!==void 0&&(r.retryAfterMs=t.retryAfterMs)}function WT(e){if(e==null)return;let t=e.trim();if(!t)return;let r=Number(t);if(!Number.isNaN(r)&&r>=0)return r*1e3;let n=Date.parse(t);if(!Number.isNaN(n)){let i=n-Date.now();return i>0?i:0}}function JT(e){if((ZT(e)??HT(e))!==429)return;if(GT(e)==="insufficient_quota")return{action:"stop",reason:"insufficient_quota"};let t=O_(e);if(t&&Lz.some(n=>n.test(t)))return{action:"stop",reason:"quota_message"};let r=WT(Bz(e))??Vz(t);return r!==void 0?r<=Uz?{action:"wait",retryAfterMs:r,reason:"retry_after_hint"}:{action:"capacity",retryAfterMs:r,reason:"retry_after_too_large"}:{action:"capacity",reason:"headerless_429"}}var Zz=e=>{if(typeof e!="object"||e===null)return;if(sg(e)===!1)throw e;if("message"in e&&typeof e.message=="string"&&(e.message.startsWith("Cancel")||e.message.startsWith("AbortError"))||"name"in e&&typeof e.name=="string"&&e.name==="AbortError")throw pi(e,!1);if("code"in e&&typeof e.code=="string"&&e.code==="ECONNABORTED")throw e;let t=ZT(e)??HT(e);if(t&&zz.includes(+t))throw pi(e,!1);if(GT(e)==="insufficient_quota"){let n=BT(e,O_(e)??"Insufficient quota");throw n.name="InsufficientQuotaError",A_(n,{action:"stop",reason:"insufficient_quota"}),pi(n,!1)}let r=JT(e);if(r){if(r.action==="wait"){A_(e,r),pi(e,!0);return}let n=BT(e,O_(e)??"Rate limit exceeded");throw n.name==="Error"&&(n.name=r.action==="stop"?"RateLimitQuotaExhaustedError":"RateLimitCapacityError"),A_(n,r),pi(n,r.action!=="stop")}},wi=class{maxConcurrency;maxRetries;onFailedAttempt;queue;constructor(e){this.maxConcurrency=e.maxConcurrency??1/0,this.maxRetries=e.maxRetries??6,this.onFailedAttempt=e.onFailedAttempt??Zz;let t="default"in wf.default?wf.default.default:wf.default;this.queue=new t({concurrency:this.maxConcurrency})}async call(e,...t){return this.callWithRetries(this.maxRetries,e,t)}callWithRetries(e,t,r){return this.queue.add(()=>pl(()=>t(...r).catch(n=>{throw n instanceof Error?n:new Error(n)}),{onFailedAttempt:({error:n})=>this.onFailedAttempt?.(n),retries:e,randomize:!0}),{throwOnTimeout:!0})}callWithOptions(e,t,...r){let n=e.maxRetries??this.maxRetries;if(e.signal){let i;return Promise.race([this.callWithRetries(n,t,r),new Promise((a,o)=>{i=()=>{o(la(e.signal))},e.signal?.addEventListener("abort",i,{once:!0})})]).finally(()=>{e.signal&&i&&e.signal.removeEventListener("abort",i)})}return this.callWithRetries(n,t,r)}fetch(...e){return this.call(()=>fetch(...e).then(t=>t.ok?t:Promise.reject(t)))}};var KT=T({isSerializableSchema:()=>mo,isStandardJsonSchema:()=>xf,isStandardSchema:()=>qT});function qT(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&"~standard"in e&&typeof e["~standard"]=="object"&&e["~standard"]!==null&&"validate"in e["~standard"]}function xf(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&"~standard"in e&&typeof e["~standard"]=="object"&&e["~standard"]!==null&&"jsonSchema"in e["~standard"]}function mo(e){return qT(e)&&xf(e)}var ki={};On(ki,{$ZodAny:()=>wv,$ZodArray:()=>kv,$ZodAsyncError:()=>mn,$ZodBase64:()=>dv,$ZodBase64URL:()=>fv,$ZodBigInt:()=>Bf,$ZodBigIntFormat:()=>_v,$ZodBoolean:()=>$l,$ZodCIDRv4:()=>cv,$ZodCIDRv6:()=>lv,$ZodCUID:()=>qy,$ZodCUID2:()=>Yy,$ZodCatch:()=>Bv,$ZodCheck:()=>Ze,$ZodCheckBigIntFormat:()=>$y,$ZodCheckEndsWith:()=>zy,$ZodCheckGreaterThan:()=>jf,$ZodCheckIncludes:()=>jy,$ZodCheckLengthEquals:()=>Py,$ZodCheckLessThan:()=>Mf,$ZodCheckLowerCase:()=>Ry,$ZodCheckMaxLength:()=>Ay,$ZodCheckMaxSize:()=>Iy,$ZodCheckMimeType:()=>Ly,$ZodCheckMinLength:()=>Oy,$ZodCheckMinSize:()=>Ty,$ZodCheckMultipleOf:()=>ky,$ZodCheckNumberFormat:()=>Ey,$ZodCheckOverwrite:()=>Fy,$ZodCheckProperty:()=>Uy,$ZodCheckRegex:()=>Ny,$ZodCheckSizeEquals:()=>Cy,$ZodCheckStartsWith:()=>Dy,$ZodCheckStringFormat:()=>Os,$ZodCheckUpperCase:()=>My,$ZodCodec:()=>Al,$ZodCustom:()=>qv,$ZodCustomStringFormat:()=>hv,$ZodDate:()=>Sv,$ZodDefault:()=>zv,$ZodDiscriminatedUnion:()=>Iv,$ZodE164:()=>pv,$ZodEmail:()=>Gy,$ZodEmoji:()=>Jy,$ZodEncodeError:()=>pa,$ZodEnum:()=>Pv,$ZodError:()=>bl,$ZodExactOptional:()=>jv,$ZodFile:()=>Rv,$ZodFunction:()=>Wv,$ZodGUID:()=>Zy,$ZodIPv4:()=>av,$ZodIPv6:()=>ov,$ZodISODate:()=>rv,$ZodISODateTime:()=>tv,$ZodISODuration:()=>iv,$ZodISOTime:()=>nv,$ZodIntersection:()=>Tv,$ZodJWT:()=>mv,$ZodKSUID:()=>ev,$ZodLazy:()=>Kv,$ZodLiteral:()=>Nv,$ZodMAC:()=>sv,$ZodMap:()=>Av,$ZodNaN:()=>Vv,$ZodNanoID:()=>Ky,$ZodNever:()=>Tl,$ZodNonOptional:()=>Lv,$ZodNull:()=>bv,$ZodNullable:()=>Dv,$ZodNumber:()=>Ff,$ZodNumberFormat:()=>gv,$ZodObject:()=>IC,$ZodObjectJIT:()=>Ev,$ZodOptional:()=>bo,$ZodPipe:()=>Zf,$ZodPrefault:()=>Uv,$ZodPreprocess:()=>Zv,$ZodPromise:()=>Jv,$ZodReadonly:()=>Hv,$ZodRealError:()=>wr,$ZodRecord:()=>Cv,$ZodRegistry:()=>Jf,$ZodSet:()=>Ov,$ZodString:()=>vo,$ZodStringFormat:()=>Fe,$ZodSuccess:()=>Fv,$ZodSymbol:()=>yv,$ZodTemplateLiteral:()=>Gv,$ZodTransform:()=>Mv,$ZodTuple:()=>Vf,$ZodType:()=>pe,$ZodULID:()=>Xy,$ZodURL:()=>Wy,$ZodUUID:()=>Hy,$ZodUndefined:()=>vv,$ZodUnion:()=>Cl,$ZodUnknown:()=>Il,$ZodVoid:()=>xv,$ZodXID:()=>Qy,$ZodXor:()=>$v,$brand:()=>N_,$constructor:()=>k,$input:()=>Xv,$output:()=>Yv,Doc:()=>El,JSONSchema:()=>CA,JSONSchemaGenerator:()=>kp,NEVER:()=>P_,TimePrecision:()=>rb,_any:()=>Sb,_array:()=>Tb,_base64:()=>fp,_base64url:()=>pp,_bigint:()=>gb,_boolean:()=>mb,_catch:()=>pL,_check:()=>TA,_cidrv4:()=>up,_cidrv6:()=>dp,_coercedBigint:()=>_b,_coercedBoolean:()=>hb,_coercedDate:()=>$b,_coercedNumber:()=>cb,_coercedString:()=>eb,_cuid:()=>np,_cuid2:()=>ip,_custom:()=>Ab,_date:()=>Eb,_decode:()=>$f,_decodeAsync:()=>Tf,_default:()=>uL,_discriminatedUnion:()=>X2,_e164:()=>mp,_email:()=>qf,_emoji:()=>tp,_encode:()=>Ef,_encodeAsync:()=>If,_endsWith:()=>zs,_enum:()=>iL,_file:()=>Cb,_float32:()=>ub,_float64:()=>db,_gt:()=>Hn,_gte:()=>dr,_guid:()=>Nl,_includes:()=>js,_int:()=>lb,_int32:()=>fb,_int64:()=>yb,_intersection:()=>Q2,_ipv4:()=>cp,_ipv6:()=>lp,_isoDate:()=>ib,_isoDateTime:()=>nb,_isoDuration:()=>ob,_isoTime:()=>ab,_jwt:()=>hp,_ksuid:()=>sp,_lazy:()=>_L,_length:()=>So,_literal:()=>oL,_lowercase:()=>Rs,_lt:()=>Zn,_lte:()=>zr,_mac:()=>tb,_map:()=>rL,_max:()=>zr,_maxLength:()=>xo,_maxSize:()=>ba,_mime:()=>Us,_min:()=>dr,_minLength:()=>Si,_minSize:()=>Gn,_multipleOf:()=>va,_nan:()=>Ib,_nanoid:()=>rp,_nativeEnum:()=>aL,_negative:()=>_p,_never:()=>jl,_nonnegative:()=>vp,_nonoptional:()=>dL,_nonpositive:()=>yp,_normalize:()=>Ls,_null:()=>xb,_nullable:()=>lL,_number:()=>sb,_optional:()=>cL,_overwrite:()=>hn,_parse:()=>Is,_parseAsync:()=>Ts,_pipe:()=>mL,_positive:()=>gp,_promise:()=>yL,_property:()=>bp,_readonly:()=>hL,_record:()=>tL,_refine:()=>Ob,_regex:()=>Ns,_safeDecode:()=>Af,_safeDecodeAsync:()=>Pf,_safeEncode:()=>Cf,_safeEncodeAsync:()=>Of,_safeParse:()=>Cs,_safeParseAsync:()=>As,_set:()=>nL,_size:()=>wo,_slugify:()=>Zs,_startsWith:()=>Ds,_string:()=>Qv,_stringFormat:()=>Hs,_stringbool:()=>Mb,_success:()=>fL,_superRefine:()=>Pb,_symbol:()=>bb,_templateLiteral:()=>gL,_toLowerCase:()=>Bs,_toUpperCase:()=>Vs,_transform:()=>sL,_trim:()=>Fs,_tuple:()=>eL,_uint32:()=>pb,_uint64:()=>vb,_ulid:()=>ap,_undefined:()=>wb,_union:()=>q2,_unknown:()=>Ml,_uppercase:()=>Ms,_url:()=>Rl,_uuid:()=>Yf,_uuidv4:()=>Xf,_uuidv6:()=>Qf,_uuidv7:()=>ep,_void:()=>kb,_xid:()=>op,_xor:()=>Y2,clone:()=>Xe,config:()=>ct,createStandardJSONSchemaMethod:()=>Gs,createToJSONSchemaMethod:()=>jb,decode:()=>yU,decodeAsync:()=>bU,describe:()=>Nb,encode:()=>_U,encodeAsync:()=>vU,extractDefs:()=>xa,finalize:()=>Sa,flattenError:()=>wl,formatError:()=>xl,globalConfig:()=>ho,globalRegistry:()=>De,initializeContext:()=>wa,isValidBase64:()=>uv,isValidBase64URL:()=>SC,isValidJWT:()=>kC,locales:()=>Pl,meta:()=>Rb,parse:()=>ya,parseAsync:()=>_o,prettifyError:()=>G_,process:()=>ze,regexes:()=>Dr,registry:()=>Kf,safeDecode:()=>xU,safeDecodeAsync:()=>kU,safeEncode:()=>wU,safeEncodeAsync:()=>SU,safeParse:()=>W_,safeParseAsync:()=>J_,toDotPath:()=>rC,toJSONSchema:()=>ko,treeifyError:()=>H_,util:()=>j,version:()=>By});var YT,P_=Object.freeze({status:"aborted"});function k(e,t,r){function n(s,c){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:c,constr:o,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,c);let l=o.prototype,u=Object.keys(l);for(let d=0;d<u.length;d++){let f=u[d];f in s||(s[f]=l[f].bind(s))}}let i=r?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(s){var c;let l=r?.Parent?new a:this;n(l,s),(c=l._zod).deferred??(c.deferred=[]);for(let u of l._zod.deferred)u();return l}return Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var N_=Symbol("zod_brand"),mn=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},pa=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(YT=globalThis).__zod_globalConfig??(YT.__zod_globalConfig={});var ho=globalThis.__zod_globalConfig;function ct(e){return e&&Object.assign(ho,e),ho}var j={};On(j,{BIGINT_FORMAT_RANGES:()=>V_,Class:()=>M_,NUMBER_FORMAT_RANGES:()=>B_,aborted:()=>_a,allowsEval:()=>z_,assert:()=>Kz,assertEqual:()=>Hz,assertIs:()=>Wz,assertNever:()=>Jz,assertNotEqual:()=>Gz,assignProp:()=>ha,base64ToUint8Array:()=>QT,base64urlToUint8Array:()=>fU,cached:()=>Es,captureStackTrace:()=>kf,cleanEnum:()=>dU,cleanRegex:()=>gl,clone:()=>Xe,cloneDef:()=>Yz,createTransparentProxy:()=>nU,defineLazy:()=>Ee,esc:()=>Sf,escapeRegex:()=>Jr,explicitlyAborted:()=>Z_,extend:()=>oU,finalizeIssue:()=>ur,floatSafeRemainder:()=>j_,getElementAtPath:()=>Xz,getEnumValues:()=>hl,getLengthableOrigin:()=>vl,getParsedType:()=>rU,getSizableOrigin:()=>yl,hexToUint8Array:()=>mU,isObject:()=>go,isPlainObject:()=>ga,issue:()=>$s,joinValues:()=>I,jsonStringifyReplacer:()=>ks,merge:()=>cU,mergeDefs:()=>xi,normalizeParams:()=>U,nullish:()=>ma,numKeys:()=>tU,objectClone:()=>qz,omit:()=>aU,optionalKeys:()=>F_,parsedType:()=>M,partial:()=>lU,pick:()=>iU,prefixIssues:()=>br,primitiveTypes:()=>L_,promiseAllObject:()=>Qz,propertyKeyTypes:()=>_l,randomString:()=>eU,required:()=>uU,safeExtend:()=>sU,shallowClone:()=>U_,slugify:()=>D_,stringifyPrimitive:()=>R,uint8ArrayToBase64:()=>eC,uint8ArrayToBase64url:()=>pU,uint8ArrayToHex:()=>hU,unwrapMessage:()=>ml});function Hz(e){return e}function Gz(e){return e}function Wz(e){}function Jz(e){throw new Error("Unexpected value in exhaustive check")}function Kz(e){}function hl(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,i])=>t.indexOf(+n)===-1).map(([n,i])=>i)}function I(e,t="|"){return e.map(r=>R(r)).join(t)}function ks(e,t){return typeof t=="bigint"?t.toString():t}function Es(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function ma(e){return e==null}function gl(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function j_(e,t){let r=e/t,n=Math.round(r),i=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<i?0:r-n}var XT=Symbol("evaluating");function Ee(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==XT)return n===void 0&&(n=XT,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function qz(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function ha(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function xi(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Yz(e){return xi(e._zod.def)}function Xz(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function Qz(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let i={};for(let a=0;a<t.length;a++)i[t[a]]=n[a];return i})}function eU(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function Sf(e){return JSON.stringify(e)}function D_(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var kf="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function go(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var z_=Es(()=>{if(ho.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function ga(e){if(go(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(go(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function U_(e){return ga(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function tU(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var rU=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},_l=new Set(["string","number","symbol"]),L_=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Jr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Xe(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function U(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function nU(e){let t;return new Proxy({},{get(r,n,i){return t??(t=e()),Reflect.get(t,n,i)},set(r,n,i,a){return t??(t=e()),Reflect.set(t,n,i,a)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,i){return t??(t=e()),Reflect.defineProperty(t,n,i)}})}function R(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function F_(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var B_={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},V_={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function iU(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let a=xi(e._zod.def,{get shape(){let o={};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(o[s]=r.shape[s])}return ha(this,"shape",o),o},checks:[]});return Xe(e,a)}function aU(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let a=xi(e._zod.def,{get shape(){let o={...e._zod.def.shape};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete o[s]}return ha(this,"shape",o),o},checks:[]});return Xe(e,a)}function oU(e,t){if(!ga(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let a=e._zod.def.shape;for(let o in t)if(Object.getOwnPropertyDescriptor(a,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let i=xi(e._zod.def,{get shape(){let a={...e._zod.def.shape,...t};return ha(this,"shape",a),a}});return Xe(e,i)}function sU(e,t){if(!ga(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=xi(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ha(this,"shape",n),n}});return Xe(e,r)}function cU(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=xi(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return ha(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Xe(e,r)}function lU(e,t,r){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let o=xi(t._zod.def,{get shape(){let s=t._zod.def.shape,c={...s};if(r)for(let l in r){if(!(l in s))throw new Error(`Unrecognized key: "${l}"`);r[l]&&(c[l]=e?new e({type:"optional",innerType:s[l]}):s[l])}else for(let l in s)c[l]=e?new e({type:"optional",innerType:s[l]}):s[l];return ha(this,"shape",c),c},checks:[]});return Xe(t,o)}function uU(e,t,r){let n=xi(t._zod.def,{get shape(){let i=t._zod.def.shape,a={...i};if(r)for(let o in r){if(!(o in a))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(a[o]=new e({type:"nonoptional",innerType:i[o]}))}else for(let o in i)a[o]=new e({type:"nonoptional",innerType:i[o]});return ha(this,"shape",a),a}});return Xe(t,n)}function _a(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Z_(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function br(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function ml(e){return typeof e=="string"?e:e?.message}function ur(e,t,r){let n=e.message?e.message:ml(e.inst?._zod.def?.error?.(e))??ml(t?.error?.(e))??ml(r.customError?.(e))??ml(r.localeError?.(e))??"Invalid input",{inst:i,continue:a,input:o,...s}=e;return s.path??(s.path=[]),s.message=n,t?.reportInput&&(s.input=o),s}function yl(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function vl(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function M(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function $s(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function dU(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function QT(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function eC(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function fU(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return QT(t+r)}function pU(e){return eC(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function mU(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function hU(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var M_=class{constructor(...t){}};var tC=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ks,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},bl=k("$ZodError",tC),wr=k("$ZodError",tC,{Parent:Error});function wl(e,t=r=>r.message){let r={},n=[];for(let i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}}function xl(e,t=r=>r.message){let r={_errors:[]},n=(i,a=[])=>{for(let o of i.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(s=>n({issues:s},[...a,...o.path]));else if(o.code==="invalid_key")n({issues:o.issues},[...a,...o.path]);else if(o.code==="invalid_element")n({issues:o.issues},[...a,...o.path]);else{let s=[...a,...o.path];if(s.length===0)r._errors.push(t(o));else{let c=r,l=0;for(;l<s.length;){let u=s[l];l===s.length-1?(c[u]=c[u]||{_errors:[]},c[u]._errors.push(t(o))):c[u]=c[u]||{_errors:[]},c=c[u],l++}}}};return n(e),r}function H_(e,t=r=>r.message){let r={errors:[]},n=(i,a=[])=>{var o,s;for(let c of i.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(l=>n({issues:l},[...a,...c.path]));else if(c.code==="invalid_key")n({issues:c.issues},[...a,...c.path]);else if(c.code==="invalid_element")n({issues:c.issues},[...a,...c.path]);else{let l=[...a,...c.path];if(l.length===0){r.errors.push(t(c));continue}let u=r,d=0;for(;d<l.length;){let f=l[d],p=d===l.length-1;typeof f=="string"?(u.properties??(u.properties={}),(o=u.properties)[f]??(o[f]={errors:[]}),u=u.properties[f]):(u.items??(u.items=[]),(s=u.items)[f]??(s[f]={errors:[]}),u=u.items[f]),p&&u.errors.push(t(c)),d++}}};return n(e),r}function rC(e){let t=[],r=e.map(n=>typeof n=="object"?n.key:n);for(let n of r)typeof n=="number"?t.push(`[${n}]`):typeof n=="symbol"?t.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?t.push(`[${JSON.stringify(n)}]`):(t.length&&t.push("."),t.push(n));return t.join("")}function G_(e){let t=[],r=[...e.issues].sort((n,i)=>(n.path??[]).length-(i.path??[]).length);for(let n of r)t.push(`\u2716 ${n.message}`),n.path?.length&&t.push(` \u2192 at ${rC(n.path)}`);return t.join(`
155
+ `)}var Is=e=>(t,r,n,i)=>{let a=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},a);if(o instanceof Promise)throw new mn;if(o.issues.length){let s=new(i?.Err??e)(o.issues.map(c=>ur(c,a,ct())));throw kf(s,i?.callee),s}return o.value},ya=Is(wr),Ts=e=>async(t,r,n,i)=>{let a=n?{...n,async:!0}:{async:!0},o=t._zod.run({value:r,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let s=new(i?.Err??e)(o.issues.map(c=>ur(c,a,ct())));throw kf(s,i?.callee),s}return o.value},_o=Ts(wr),Cs=e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new mn;return a.issues.length?{success:!1,error:new(e??bl)(a.issues.map(o=>ur(o,i,ct())))}:{success:!0,data:a.value}},W_=Cs(wr),As=e=>async(t,r,n)=>{let i=n?{...n,async:!0}:{async:!0},a=t._zod.run({value:r,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(o=>ur(o,i,ct())))}:{success:!0,data:a.value}},J_=As(wr),Ef=e=>(t,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return Is(e)(t,r,i)},_U=Ef(wr),$f=e=>(t,r,n)=>Is(e)(t,r,n),yU=$f(wr),If=e=>async(t,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return Ts(e)(t,r,i)},vU=If(wr),Tf=e=>async(t,r,n)=>Ts(e)(t,r,n),bU=Tf(wr),Cf=e=>(t,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return Cs(e)(t,r,i)},wU=Cf(wr),Af=e=>(t,r,n)=>Cs(e)(t,r,n),xU=Af(wr),Of=e=>async(t,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return As(e)(t,r,i)},SU=Of(wr),Pf=e=>async(t,r,n)=>As(e)(t,r,n),kU=Pf(wr);var Dr={};On(Dr,{base64:()=>uy,base64url:()=>Nf,bigint:()=>_y,boolean:()=>vy,browserEmail:()=>PU,cidrv4:()=>cy,cidrv6:()=>ly,cuid:()=>K_,cuid2:()=>q_,date:()=>py,datetime:()=>hy,domain:()=>MU,duration:()=>ty,e164:()=>fy,email:()=>ny,emoji:()=>iy,extendedDuration:()=>EU,guid:()=>ry,hex:()=>jU,hostname:()=>RU,html5Email:()=>CU,httpProtocol:()=>dy,idnEmail:()=>OU,integer:()=>yy,ipv4:()=>ay,ipv6:()=>oy,ksuid:()=>Q_,lowercase:()=>xy,mac:()=>sy,md5_base64:()=>zU,md5_base64url:()=>UU,md5_hex:()=>DU,nanoid:()=>ey,null:()=>by,number:()=>Rf,rfc5322Email:()=>AU,sha1_base64:()=>FU,sha1_base64url:()=>BU,sha1_hex:()=>LU,sha256_base64:()=>ZU,sha256_base64url:()=>HU,sha256_hex:()=>VU,sha384_base64:()=>WU,sha384_base64url:()=>JU,sha384_hex:()=>GU,sha512_base64:()=>qU,sha512_base64url:()=>YU,sha512_hex:()=>KU,string:()=>gy,time:()=>my,ulid:()=>Y_,undefined:()=>wy,unicodeEmail:()=>nC,uppercase:()=>Sy,uuid:()=>yo,uuid4:()=>$U,uuid6:()=>IU,uuid7:()=>TU,xid:()=>X_});var K_=/^[cC][0-9a-z]{6,}$/,q_=/^[0-9a-z]+$/,Y_=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,X_=/^[0-9a-vA-V]{20}$/,Q_=/^[A-Za-z0-9]{27}$/,ey=/^[a-zA-Z0-9_-]{21}$/,ty=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,EU=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ry=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,yo=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,$U=yo(4),IU=yo(6),TU=yo(7),ny=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,CU=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,AU=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,nC=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,OU=nC,PU=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,NU="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function iy(){return new RegExp(NU,"u")}var ay=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,oy=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,sy=e=>{let t=Jr(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},cy=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,ly=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,uy=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Nf=/^[A-Za-z0-9_-]*$/,RU=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,MU=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,dy=/^https?$/,fy=/^\+[1-9]\d{6,14}$/,iC="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",py=new RegExp(`^${iC}$`);function aC(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function my(e){return new RegExp(`^${aC(e)}$`)}function hy(e){let t=aC({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${iC}T(?:${n})$`)}var gy=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},_y=/^-?\d+n?$/,yy=/^-?\d+$/,Rf=/^-?\d+(?:\.\d+)?$/,vy=/^(?:true|false)$/i,by=/^null$/i;var wy=/^undefined$/i;var xy=/^[^A-Z]*$/,Sy=/^[^a-z]*$/,jU=/^[0-9a-fA-F]*$/;function Sl(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function kl(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var DU=/^[0-9a-fA-F]{32}$/,zU=Sl(22,"=="),UU=kl(22),LU=/^[0-9a-fA-F]{40}$/,FU=Sl(27,"="),BU=kl(27),VU=/^[0-9a-fA-F]{64}$/,ZU=Sl(43,"="),HU=kl(43),GU=/^[0-9a-fA-F]{96}$/,WU=Sl(64,""),JU=kl(64),KU=/^[0-9a-fA-F]{128}$/,qU=Sl(86,"=="),YU=kl(86);var Ze=k("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),sC={number:"number",bigint:"bigint",object:"date"},Mf=k("$ZodCheckLessThan",(e,t)=>{Ze.init(e,t);let r=sC[typeof t.value];e._zod.onattach.push(n=>{let i=n._zod.bag,a=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<a&&(t.inclusive?i.maximum=t.value:i.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),jf=k("$ZodCheckGreaterThan",(e,t)=>{Ze.init(e,t);let r=sC[typeof t.value];e._zod.onattach.push(n=>{let i=n._zod.bag,a=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>a&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ky=k("$ZodCheckMultipleOf",(e,t)=>{Ze.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):j_(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Ey=k("$ZodCheckNumberFormat",(e,t)=>{Ze.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[i,a]=B_[t.format];e._zod.onattach.push(o=>{let s=o._zod.bag;s.format=t.format,s.minimum=i,s.maximum=a,r&&(s.pattern=yy)}),e._zod.check=o=>{let s=o.value;if(r){if(!Number.isInteger(s)){o.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:"number",input:s,code:"too_big",maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),$y=k("$ZodCheckBigIntFormat",(e,t)=>{Ze.init(e,t);let[r,n]=V_[t.format];e._zod.onattach.push(i=>{let a=i._zod.bag;a.format=t.format,a.minimum=r,a.maximum=n}),e._zod.check=i=>{let a=i.value;a<r&&i.issues.push({origin:"bigint",input:a,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),a>n&&i.issues.push({origin:"bigint",input:a,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),Iy=k("$ZodCheckMaxSize",(e,t)=>{var r;Ze.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!ma(i)&&i.size!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let i=n.value;i.size<=t.maximum||n.issues.push({origin:yl(i),code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Ty=k("$ZodCheckMinSize",(e,t)=>{var r;Ze.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!ma(i)&&i.size!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let i=n.value;i.size>=t.minimum||n.issues.push({origin:yl(i),code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Cy=k("$ZodCheckSizeEquals",(e,t)=>{var r;Ze.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!ma(i)&&i.size!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=t.size,i.maximum=t.size,i.size=t.size}),e._zod.check=n=>{let i=n.value,a=i.size;if(a===t.size)return;let o=a>t.size;n.issues.push({origin:yl(i),...o?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ay=k("$ZodCheckMaxLength",(e,t)=>{var r;Ze.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!ma(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let i=n.value;if(i.length<=t.maximum)return;let o=vl(i);n.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Oy=k("$ZodCheckMinLength",(e,t)=>{var r;Ze.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!ma(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let i=n.value;if(i.length>=t.minimum)return;let o=vl(i);n.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Py=k("$ZodCheckLengthEquals",(e,t)=>{var r;Ze.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!ma(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=n=>{let i=n.value,a=i.length;if(a===t.length)return;let o=vl(i),s=a>t.length;n.issues.push({origin:o,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Os=k("$ZodCheckStringFormat",(e,t)=>{var r,n;Ze.init(e,t),e._zod.onattach.push(i=>{let a=i._zod.bag;a.format=t.format,t.pattern&&(a.patterns??(a.patterns=new Set),a.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Ny=k("$ZodCheckRegex",(e,t)=>{Os.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Ry=k("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=xy),Os.init(e,t)}),My=k("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Sy),Os.init(e,t)}),jy=k("$ZodCheckIncludes",(e,t)=>{Ze.init(e,t);let r=Jr(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(i=>{let a=i._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(n)}),e._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),Dy=k("$ZodCheckStartsWith",(e,t)=>{Ze.init(e,t);let r=new RegExp(`^${Jr(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),zy=k("$ZodCheckEndsWith",(e,t)=>{Ze.init(e,t);let r=new RegExp(`.*${Jr(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function oC(e,t,r){e.issues.length&&t.issues.push(...br(r,e.issues))}var Uy=k("$ZodCheckProperty",(e,t)=>{Ze.init(e,t),e._zod.check=r=>{let n=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(i=>oC(i,r,t.property));oC(n,r,t.property)}}),Ly=k("$ZodCheckMimeType",(e,t)=>{Ze.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(n=>{n._zod.bag.mime=t.mime}),e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),Fy=k("$ZodCheckOverwrite",(e,t)=>{Ze.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var El=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
156
+ `).filter(o=>o),i=Math.min(...n.map(o=>o.length-o.trimStart().length)),a=n.map(o=>o.slice(i)).map(o=>" ".repeat(this.indent*2)+o);for(let o of a)this.content.push(o)}compile(){let t=Function,r=this?.args,i=[...(this?.content??[""]).map(a=>` ${a}`)];return new t(...r,i.join(`
157
+ `))}};var By={major:4,minor:4,patch:3};var pe=k("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=By;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let i of n)for(let a of i._zod.onattach)a(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(o,s,c)=>{let l=_a(o),u;for(let d of s){if(d._zod.def.when){if(Z_(o)||!d._zod.def.when(o))continue}else if(l)continue;let f=o.issues.length,p=d._zod.check(o);if(p instanceof Promise&&c?.async===!1)throw new mn;if(u||p instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await p,o.issues.length!==f&&(l||(l=_a(o,f)))});else{if(o.issues.length===f)continue;l||(l=_a(o,f))}}return u?u.then(()=>o):o},a=(o,s,c)=>{if(_a(o))return o.aborted=!0,o;let l=i(s,n,c);if(l instanceof Promise){if(c.async===!1)throw new mn;return l.then(u=>e._zod.parse(u,c))}return e._zod.parse(l,c)};e._zod.run=(o,s)=>{if(s.skipChecks)return e._zod.parse(o,s);if(s.direction==="backward"){let l=e._zod.parse({value:o.value,issues:[]},{...s,skipChecks:!0});return l instanceof Promise?l.then(u=>a(u,o,s)):a(l,o,s)}let c=e._zod.parse(o,s);if(c instanceof Promise){if(s.async===!1)throw new mn;return c.then(l=>i(l,n,s))}return i(c,n,s)}}Ee(e,"~standard",()=>({validate:i=>{try{let a=W_(e,i);return a.success?{value:a.data}:{issues:a.error?.issues}}catch{return J_(e,i).then(o=>o.success?{value:o.data}:{issues:o.error?.issues})}},vendor:"zod",version:1}))}),vo=k("$ZodString",(e,t)=>{pe.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??gy(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Fe=k("$ZodStringFormat",(e,t)=>{Os.init(e,t),vo.init(e,t)}),Zy=k("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ry),Fe.init(e,t)}),Hy=k("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=yo(n))}else t.pattern??(t.pattern=yo());Fe.init(e,t)}),Gy=k("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ny),Fe.init(e,t)}),Wy=k("$ZodURL",(e,t)=>{Fe.init(e,t),e._zod.check=r=>{try{let n=r.value.trim();if(!t.normalize&&t.protocol?.source===dy.source&&!/^https?:\/\//i.test(n)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}let i=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=i.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Jy=k("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=iy()),Fe.init(e,t)}),Ky=k("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=ey),Fe.init(e,t)}),qy=k("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=K_),Fe.init(e,t)}),Yy=k("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=q_),Fe.init(e,t)}),Xy=k("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Y_),Fe.init(e,t)}),Qy=k("$ZodXID",(e,t)=>{t.pattern??(t.pattern=X_),Fe.init(e,t)}),ev=k("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Q_),Fe.init(e,t)}),tv=k("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=hy(t)),Fe.init(e,t)}),rv=k("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=py),Fe.init(e,t)}),nv=k("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=my(t)),Fe.init(e,t)}),iv=k("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ty),Fe.init(e,t)}),av=k("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=ay),Fe.init(e,t),e._zod.bag.format="ipv4"}),ov=k("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=oy),Fe.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),sv=k("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=sy(t.delimiter)),Fe.init(e,t),e._zod.bag.format="mac"}),cv=k("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=cy),Fe.init(e,t)}),lv=k("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ly),Fe.init(e,t),e._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[i,a]=n;if(!a)throw new Error;let o=Number(a);if(`${o}`!==a)throw new Error;if(o<0||o>128)throw new Error;new URL(`http://[${i}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function uv(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var dv=k("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=uy),Fe.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{uv(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function SC(e){if(!Nf.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return uv(r)}var fv=k("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Nf),Fe.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{SC(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),pv=k("$ZodE164",(e,t)=>{t.pattern??(t.pattern=fy),Fe.init(e,t)});function kC(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let i=JSON.parse(atob(n));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}}var mv=k("$ZodJWT",(e,t)=>{Fe.init(e,t),e._zod.check=r=>{kC(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),hv=k("$ZodCustomStringFormat",(e,t)=>{Fe.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),Ff=k("$ZodNumber",(e,t)=>{pe.init(e,t),e._zod.pattern=e._zod.bag.pattern??Rf,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let a=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...a?{received:a}:{}}),r}}),gv=k("$ZodNumberFormat",(e,t)=>{Ey.init(e,t),Ff.init(e,t)}),$l=k("$ZodBoolean",(e,t)=>{pe.init(e,t),e._zod.pattern=vy,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),Bf=k("$ZodBigInt",(e,t)=>{pe.init(e,t),e._zod.pattern=_y,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),_v=k("$ZodBigIntFormat",(e,t)=>{$y.init(e,t),Bf.init(e,t)}),yv=k("$ZodSymbol",(e,t)=>{pe.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;return typeof i=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:i,inst:e}),r}}),vv=k("$ZodUndefined",(e,t)=>{pe.init(e,t),e._zod.pattern=wy,e._zod.values=new Set([void 0]),e._zod.parse=(r,n)=>{let i=r.value;return typeof i>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:i,inst:e}),r}}),bv=k("$ZodNull",(e,t)=>{pe.init(e,t),e._zod.pattern=by,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let i=r.value;return i===null||r.issues.push({expected:"null",code:"invalid_type",input:i,inst:e}),r}}),wv=k("$ZodAny",(e,t)=>{pe.init(e,t),e._zod.parse=r=>r}),Il=k("$ZodUnknown",(e,t)=>{pe.init(e,t),e._zod.parse=r=>r}),Tl=k("$ZodNever",(e,t)=>{pe.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),xv=k("$ZodVoid",(e,t)=>{pe.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;return typeof i>"u"||r.issues.push({expected:"void",code:"invalid_type",input:i,inst:e}),r}}),Sv=k("$ZodDate",(e,t)=>{pe.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let i=r.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...a?{received:"Invalid Date"}:{},inst:e}),r}});function lC(e,t,r){e.issues.length&&t.issues.push(...br(r,e.issues)),t.value[r]=e.value}var kv=k("$ZodArray",(e,t)=>{pe.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let a=[];for(let o=0;o<i.length;o++){let s=i[o],c=t.element._zod.run({value:s,issues:[]},n);c instanceof Promise?a.push(c.then(l=>lC(l,r,o))):lC(c,r,o)}return a.length?Promise.all(a).then(()=>r):r}});function Lf(e,t,r,n,i,a){let o=r in n;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...br(r,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?o&&(t.value[r]=void 0):t.value[r]=e.value}function EC(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=F_(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function $C(e,t,r,n,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin==="optional",d=c.optout==="optional";for(let f in t){if(f==="__proto__"||s.has(f))continue;if(l==="never"){o.push(f);continue}let p=c.run({value:t[f],issues:[]},n);p instanceof Promise?e.push(p.then(m=>Lf(m,r,f,t,u,d))):Lf(p,r,f,t,u,d)}return o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>r):r}var IC=k("$ZodObject",(e,t)=>{if(pe.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...s};return Object.defineProperty(t,"shape",{value:c}),c}})}let n=Es(()=>EC(t));Ee(e._zod,"propValues",()=>{let s=t.shape,c={};for(let l in s){let u=s[l]._zod;if(u.values){c[l]??(c[l]=new Set);for(let d of u.values)c[l].add(d)}}return c});let i=go,a=t.catchall,o;e._zod.parse=(s,c)=>{o??(o=n.value);let l=s.value;if(!i(l))return s.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),s;s.value={};let u=[],d=o.shape;for(let f of o.keys){let p=d[f],m=p._zod.optin==="optional",h=p._zod.optout==="optional",_=p._zod.run({value:l[f],issues:[]},c);_ instanceof Promise?u.push(_.then(y=>Lf(y,s,f,l,m,h))):Lf(_,s,f,l,m,h)}return a?$C(u,l,s,c,n.value,e):u.length?Promise.all(u).then(()=>s):s}}),Ev=k("$ZodObjectJIT",(e,t)=>{IC.init(e,t);let r=e._zod.parse,n=Es(()=>EC(t)),i=f=>{let p=new El(["shape","payload","ctx"]),m=n.value,h=x=>{let S=Sf(x);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};p.write("const input = payload.value;");let _=Object.create(null),y=0;for(let x of m.keys)_[x]=`key_${y++}`;p.write("const newResult = {};");for(let x of m.keys){let S=_[x],E=Sf(x),P=f[x],C=P?._zod?.optin==="optional",b=P?._zod?.optout==="optional";p.write(`const ${S} = ${h(x)};`),C&&b?p.write(`
158
+ if (${S}.issues.length) {
159
+ if (${E} in input) {
160
+ payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
161
+ ...iss,
162
+ path: iss.path ? [${E}, ...iss.path] : [${E}]
163
+ })));
164
+ }
165
+ }
166
+
167
+ if (${S}.value === undefined) {
168
+ if (${E} in input) {
169
+ newResult[${E}] = undefined;
170
+ }
171
+ } else {
172
+ newResult[${E}] = ${S}.value;
173
+ }
174
+
175
+ `):C?p.write(`
176
+ if (${S}.issues.length) {
177
+ payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
178
+ ...iss,
179
+ path: iss.path ? [${E}, ...iss.path] : [${E}]
180
+ })));
181
+ }
182
+
183
+ if (${S}.value === undefined) {
184
+ if (${E} in input) {
185
+ newResult[${E}] = undefined;
186
+ }
187
+ } else {
188
+ newResult[${E}] = ${S}.value;
189
+ }
190
+
191
+ `):p.write(`
192
+ const ${S}_present = ${E} in input;
193
+ if (${S}.issues.length) {
194
+ payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
195
+ ...iss,
196
+ path: iss.path ? [${E}, ...iss.path] : [${E}]
197
+ })));
198
+ }
199
+ if (!${S}_present && !${S}.issues.length) {
200
+ payload.issues.push({
201
+ code: "invalid_type",
202
+ expected: "nonoptional",
203
+ input: undefined,
204
+ path: [${E}]
205
+ });
206
+ }
207
+
208
+ if (${S}_present) {
209
+ if (${S}.value === undefined) {
210
+ newResult[${E}] = undefined;
211
+ } else {
212
+ newResult[${E}] = ${S}.value;
213
+ }
214
+ }
215
+
216
+ `)}p.write("payload.value = newResult;"),p.write("return payload;");let w=p.compile();return(x,S)=>w(f,x,S)},a,o=go,s=!ho.jitless,l=s&&z_.value,u=t.catchall,d;e._zod.parse=(f,p)=>{d??(d=n.value);let m=f.value;return o(m)?s&&l&&p?.async===!1&&p.jitless!==!0?(a||(a=i(t.shape)),f=a(f,p),u?$C([],m,f,p,d,e):f):r(f,p):(f.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),f)}});function uC(e,t,r,n){for(let a of e)if(a.issues.length===0)return t.value=a.value,t;let i=e.filter(a=>!_a(a));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(a=>a.issues.map(o=>ur(o,n,ct())))}),t)}var Cl=k("$ZodUnion",(e,t)=>{pe.init(e,t),Ee(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),Ee(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),Ee(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),Ee(e._zod,"pattern",()=>{if(t.options.every(n=>n._zod.pattern)){let n=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${n.map(i=>gl(i.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,i)=>{if(r)return r(n,i);let a=!1,o=[];for(let s of t.options){let c=s._zod.run({value:n.value,issues:[]},i);if(c instanceof Promise)o.push(c),a=!0;else{if(c.issues.length===0)return c;o.push(c)}}return a?Promise.all(o).then(s=>uC(s,n,e,i)):uC(o,n,e,i)}});function dC(e,t,r,n){let i=e.filter(a=>a.issues.length===0);return i.length===1?(t.value=i[0].value,t):(i.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(a=>a.issues.map(o=>ur(o,n,ct())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t)}var $v=k("$ZodXor",(e,t)=>{Cl.init(e,t),t.inclusive=!1;let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,i)=>{if(r)return r(n,i);let a=!1,o=[];for(let s of t.options){let c=s._zod.run({value:n.value,issues:[]},i);c instanceof Promise?(o.push(c),a=!0):o.push(c)}return a?Promise.all(o).then(s=>dC(s,n,e,i)):dC(o,n,e,i)}}),Iv=k("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Cl.init(e,t);let r=e._zod.parse;Ee(e._zod,"propValues",()=>{let i={};for(let a of t.options){let o=a._zod.propValues;if(!o||Object.keys(o).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let[s,c]of Object.entries(o)){i[s]||(i[s]=new Set);for(let l of c)i[s].add(l)}}return i});let n=Es(()=>{let i=t.options,a=new Map;for(let o of i){let s=o._zod.propValues?.[t.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(let c of s){if(a.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);a.set(c,o)}}return a});e._zod.parse=(i,a)=>{let o=i.value;if(!go(o))return i.issues.push({code:"invalid_type",expected:"object",input:o,inst:e}),i;let s=n.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction==="backward"?r(i,a):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),Tv=k("$ZodIntersection",(e,t)=>{pe.init(e,t),e._zod.parse=(r,n)=>{let i=r.value,a=t.left._zod.run({value:i,issues:[]},n),o=t.right._zod.run({value:i,issues:[]},n);return a instanceof Promise||o instanceof Promise?Promise.all([a,o]).then(([c,l])=>fC(r,c,l)):fC(r,a,o)}});function Vy(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ga(e)&&ga(t)){let r=Object.keys(t),n=Object.keys(e).filter(a=>r.indexOf(a)!==-1),i={...e,...t};for(let a of n){let o=Vy(e[a],t[a]);if(!o.valid)return{valid:!1,mergeErrorPath:[a,...o.mergeErrorPath]};i[a]=o.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let i=e[n],a=t[n],o=Vy(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[n,...o.mergeErrorPath]};r.push(o.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function fC(e,t,r){let n=new Map,i;for(let s of t.issues)if(s.code==="unrecognized_keys"){i??(i=s);for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).l=!0}else e.issues.push(s);for(let s of r.issues)if(s.code==="unrecognized_keys")for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).r=!0;else e.issues.push(s);let a=[...n].filter(([,s])=>s.l&&s.r).map(([s])=>s);if(a.length&&i&&e.issues.push({...i,keys:a}),_a(e))return e;let o=Vy(t.value,r.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Vf=k("$ZodTuple",(e,t)=>{pe.init(e,t);let r=t.items;e._zod.parse=(n,i)=>{let a=n.value;if(!Array.isArray(a))return n.issues.push({input:a,inst:e,expected:"tuple",code:"invalid_type"}),n;n.value=[];let o=[],s=pC(r,"optin"),c=pC(r,"optout");if(!t.rest){if(a.length<s)return n.issues.push({code:"too_small",minimum:s,inclusive:!0,input:a,inst:e,origin:"array"}),n;a.length>r.length&&n.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:a,inst:e,origin:"array"})}let l=new Array(r.length);for(let u=0;u<r.length;u++){let d=r[u]._zod.run({value:a[u],issues:[]},i);d instanceof Promise?o.push(d.then(f=>{l[u]=f})):l[u]=d}if(t.rest){let u=r.length-1,d=a.slice(r.length);for(let f of d){u++;let p=t.rest._zod.run({value:f,issues:[]},i);p instanceof Promise?o.push(p.then(m=>mC(m,n,u))):mC(p,n,u)}}return o.length?Promise.all(o).then(()=>hC(l,n,r,a,c)):hC(l,n,r,a,c)}});function pC(e,t){for(let r=e.length-1;r>=0;r--)if(e[r]._zod[t]!=="optional")return r+1;return 0}function mC(e,t,r){e.issues.length&&t.issues.push(...br(r,e.issues)),t.value[r]=e.value}function hC(e,t,r,n,i){for(let a=0;a<r.length;a++){let o=e[a],s=a<n.length;if(o.issues.length){if(!s&&a>=i){t.value.length=a;break}t.issues.push(...br(a,o.issues))}t.value[a]=o.value}for(let a=t.value.length-1;a>=n.length&&(r[a]._zod.optout==="optional"&&t.value[a]===void 0);a--)t.value.length=a;return t}var Cv=k("$ZodRecord",(e,t)=>{pe.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!ga(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let a=[],o=t.keyType._zod.values;if(o){r.value={};let s=new Set;for(let l of o)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){s.add(typeof l=="number"?l.toString():l);let u=t.keyType._zod.run({value:l,issues:[]},n);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(u.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(p=>ur(p,n,ct())),input:l,path:[l],inst:e});continue}let d=u.value,f=t.valueType._zod.run({value:i[l],issues:[]},n);f instanceof Promise?a.push(f.then(p=>{p.issues.length&&r.issues.push(...br(l,p.issues)),r.value[d]=p.value})):(f.issues.length&&r.issues.push(...br(l,f.issues)),r.value[d]=f.value)}let c;for(let l in i)s.has(l)||(c=c??[],c.push(l));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c})}else{r.value={};for(let s of Reflect.ownKeys(i)){if(s==="__proto__"||!Object.prototype.propertyIsEnumerable.call(i,s))continue;let c=t.keyType._zod.run({value:s,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof s=="string"&&Rf.test(s)&&c.issues.length){let d=t.keyType._zod.run({value:Number(s),issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(c=d)}if(c.issues.length){t.mode==="loose"?r.value[s]=i[s]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>ur(d,n,ct())),input:s,path:[s],inst:e});continue}let u=t.valueType._zod.run({value:i[s],issues:[]},n);u instanceof Promise?a.push(u.then(d=>{d.issues.length&&r.issues.push(...br(s,d.issues)),r.value[c.value]=d.value})):(u.issues.length&&r.issues.push(...br(s,u.issues)),r.value[c.value]=u.value)}}return a.length?Promise.all(a).then(()=>r):r}}),Av=k("$ZodMap",(e,t)=>{pe.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!(i instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),r;let a=[];r.value=new Map;for(let[o,s]of i){let c=t.keyType._zod.run({value:o,issues:[]},n),l=t.valueType._zod.run({value:s,issues:[]},n);c instanceof Promise||l instanceof Promise?a.push(Promise.all([c,l]).then(([u,d])=>{gC(u,d,r,o,i,e,n)})):gC(c,l,r,o,i,e,n)}return a.length?Promise.all(a).then(()=>r):r}});function gC(e,t,r,n,i,a,o){e.issues.length&&(_l.has(typeof n)?r.issues.push(...br(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:i,inst:a,issues:e.issues.map(s=>ur(s,o,ct()))})),t.issues.length&&(_l.has(typeof n)?r.issues.push(...br(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:i,inst:a,key:n,issues:t.issues.map(s=>ur(s,o,ct()))})),r.value.set(e.value,t.value)}var Ov=k("$ZodSet",(e,t)=>{pe.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!(i instanceof Set))return r.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),r;let a=[];r.value=new Set;for(let o of i){let s=t.valueType._zod.run({value:o,issues:[]},n);s instanceof Promise?a.push(s.then(c=>_C(c,r))):_C(s,r)}return a.length?Promise.all(a).then(()=>r):r}});function _C(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var Pv=k("$ZodEnum",(e,t)=>{pe.init(e,t);let r=hl(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(i=>_l.has(typeof i)).map(i=>typeof i=="string"?Jr(i):i.toString()).join("|")})$`),e._zod.parse=(i,a)=>{let o=i.value;return n.has(o)||i.issues.push({code:"invalid_value",values:r,input:o,inst:e}),i}}),Nv=k("$ZodLiteral",(e,t)=>{if(pe.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?Jr(n):n?Jr(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,i)=>{let a=n.value;return r.has(a)||n.issues.push({code:"invalid_value",values:t.values,input:a,inst:e}),n}}),Rv=k("$ZodFile",(e,t)=>{pe.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;return i instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:i,inst:e}),r}}),Mv=k("$ZodTransform",(e,t)=>{pe.init(e,t),e._zod.optin="optional",e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new pa(e.constructor.name);let i=t.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(o=>(r.value=o,r.fallback=!0,r));if(i instanceof Promise)throw new mn;return r.value=i,r.fallback=!0,r}});function yC(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var bo=k("$ZodOptional",(e,t)=>{pe.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ee(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ee(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${gl(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let i=r.value,a=t.innerType._zod.run(r,n);return a instanceof Promise?a.then(o=>yC(o,i)):yC(a,i)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),jv=k("$ZodExactOptional",(e,t)=>{bo.init(e,t),Ee(e._zod,"values",()=>t.innerType._zod.values),Ee(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Dv=k("$ZodNullable",(e,t)=>{pe.init(e,t),Ee(e._zod,"optin",()=>t.innerType._zod.optin),Ee(e._zod,"optout",()=>t.innerType._zod.optout),Ee(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${gl(r.source)}|null)$`):void 0}),Ee(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),zv=k("$ZodDefault",(e,t)=>{pe.init(e,t),e._zod.optin="optional",Ee(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(a=>vC(a,t)):vC(i,t)}});function vC(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Uv=k("$ZodPrefault",(e,t)=>{pe.init(e,t),e._zod.optin="optional",Ee(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),Lv=k("$ZodNonOptional",(e,t)=>{pe.init(e,t),Ee(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(a=>bC(a,e)):bC(i,e)}});function bC(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var Fv=k("$ZodSuccess",(e,t)=>{pe.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new pa("ZodSuccess");let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(a=>(r.value=a.issues.length===0,r)):(r.value=i.issues.length===0,r)}}),Bv=k("$ZodCatch",(e,t)=>{pe.init(e,t),e._zod.optin="optional",Ee(e._zod,"optout",()=>t.innerType._zod.optout),Ee(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(a=>(r.value=a.value,a.issues.length&&(r.value=t.catchValue({...r,error:{issues:a.issues.map(o=>ur(o,n,ct()))},input:r.value}),r.issues=[],r.fallback=!0),r)):(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(a=>ur(a,n,ct()))},input:r.value}),r.issues=[],r.fallback=!0),r)}}),Vv=k("$ZodNaN",(e,t)=>{pe.init(e,t),e._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),Zf=k("$ZodPipe",(e,t)=>{pe.init(e,t),Ee(e._zod,"values",()=>t.in._zod.values),Ee(e._zod,"optin",()=>t.in._zod.optin),Ee(e._zod,"optout",()=>t.out._zod.optout),Ee(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let a=t.out._zod.run(r,n);return a instanceof Promise?a.then(o=>Df(o,t.in,n)):Df(a,t.in,n)}let i=t.in._zod.run(r,n);return i instanceof Promise?i.then(a=>Df(a,t.out,n)):Df(i,t.out,n)}});function Df(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}var Al=k("$ZodCodec",(e,t)=>{pe.init(e,t),Ee(e._zod,"values",()=>t.in._zod.values),Ee(e._zod,"optin",()=>t.in._zod.optin),Ee(e._zod,"optout",()=>t.out._zod.optout),Ee(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let a=t.in._zod.run(r,n);return a instanceof Promise?a.then(o=>zf(o,t,n)):zf(a,t,n)}else{let a=t.out._zod.run(r,n);return a instanceof Promise?a.then(o=>zf(o,t,n)):zf(a,t,n)}}});function zf(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let i=t.transform(e.value,e);return i instanceof Promise?i.then(a=>Uf(e,a,t.out,r)):Uf(e,i,t.out,r)}else{let i=t.reverseTransform(e.value,e);return i instanceof Promise?i.then(a=>Uf(e,a,t.in,r)):Uf(e,i,t.in,r)}}function Uf(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}var Zv=k("$ZodPreprocess",(e,t)=>{Zf.init(e,t)}),Hv=k("$ZodReadonly",(e,t)=>{pe.init(e,t),Ee(e._zod,"propValues",()=>t.innerType._zod.propValues),Ee(e._zod,"values",()=>t.innerType._zod.values),Ee(e._zod,"optin",()=>t.innerType?._zod?.optin),Ee(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(wC):wC(i)}});function wC(e){return e.value=Object.freeze(e.value),e}var Gv=k("$ZodTemplateLiteral",(e,t)=>{pe.init(e,t);let r=[];for(let n of t.parts)if(typeof n=="object"&&n!==null){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);let i=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!i)throw new Error(`Invalid template literal part: ${n._zod.traits}`);let a=i.startsWith("^")?1:0,o=i.endsWith("$")?i.length-1:i.length;r.push(i.slice(a,o))}else if(n===null||L_.has(typeof n))r.push(Jr(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(n,i)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:e,expected:"string",code:"invalid_type"}),n):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),n)}),Wv=k("$ZodFunction",(e,t)=>(pe.init(e,t),e._def=t,e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...n){let i=e._def.input?ya(e._def.input,n):n,a=Reflect.apply(r,this,i);return e._def.output?ya(e._def.output,a):a}},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...n){let i=e._def.input?await _o(e._def.input,n):n,a=await Reflect.apply(r,this,i);return e._def.output?await _o(e._def.output,a):a}},e._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{let n=e.constructor;return Array.isArray(r[0])?new n({type:"function",input:new Vf({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new n({type:"function",input:r[0],output:e._def.output})},e.output=r=>{let n=e.constructor;return new n({type:"function",input:e._def.input,output:r})},e)),Jv=k("$ZodPromise",(e,t)=>{pe.init(e,t),e._zod.parse=(r,n)=>Promise.resolve(r.value).then(i=>t.innerType._zod.run({value:i,issues:[]},n))}),Kv=k("$ZodLazy",(e,t)=>{pe.init(e,t),Ee(e._zod,"innerType",()=>{let r=t;return r._cachedInner||(r._cachedInner=t.getter()),r._cachedInner}),Ee(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),Ee(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),Ee(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),Ee(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),qv=k("$ZodCustom",(e,t)=>{Ze.init(e,t),pe.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,i=t.fn(n);if(i instanceof Promise)return i.then(a=>xC(a,r,n,e));xC(i,r,n,e)}});function xC(e,t,r,n){if(!e){let i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),t.issues.push($s(i))}}var Pl={};On(Pl,{ar:()=>TC,az:()=>CC,be:()=>OC,bg:()=>PC,ca:()=>NC,cs:()=>RC,da:()=>MC,de:()=>jC,el:()=>DC,en:()=>Hf,eo:()=>zC,es:()=>UC,fa:()=>LC,fi:()=>FC,fr:()=>BC,frCA:()=>VC,he:()=>ZC,hr:()=>HC,hu:()=>GC,hy:()=>JC,id:()=>KC,is:()=>qC,it:()=>YC,ja:()=>XC,ka:()=>QC,kh:()=>eA,km:()=>Gf,ko:()=>tA,lt:()=>nA,mk:()=>iA,ms:()=>aA,nl:()=>oA,no:()=>sA,ota:()=>cA,pl:()=>uA,ps:()=>lA,pt:()=>dA,ro:()=>fA,ru:()=>mA,sl:()=>hA,sv:()=>gA,ta:()=>_A,th:()=>yA,tr:()=>vA,ua:()=>bA,uk:()=>Wf,ur:()=>wA,uz:()=>xA,vi:()=>SA,yo:()=>$A,zhCN:()=>kA,zhTW:()=>EA});var QU=()=>{let e={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function t(i){return e[i]??null}let r={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 instanceof ${i.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${s}`:`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${a}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${s}`}case"invalid_value":return i.values.length===1?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${R(i.values[0])}`:`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${i.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${a} ${i.maximum.toString()} ${o.unit??"\u0639\u0646\u0635\u0631"}`:`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${i.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${a} ${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${i.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${a} ${i.minimum.toString()} ${o.unit}`:`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${i.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${a} ${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${i.prefix}"`:a.format==="ends_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${a.suffix}"`:a.format==="includes"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${a.includes}"`:a.format==="regex"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${a.pattern}`:`${r[a.format]??i.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${i.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${i.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${i.keys.length>1?"\u0629":""}: ${I(i.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${i.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${i.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}};function TC(){return{localeError:QU()}}var e2=()=>{let e={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n instanceof ${i.expected}, daxil olan ${s}`:`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${a}, daxil olan ${s}`}case"invalid_value":return i.values.length===1?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${R(i.values[0])}`:`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${i.origin??"d\u0259y\u0259r"} ${a}${i.maximum.toString()} ${o.unit??"element"}`:`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${i.origin??"d\u0259y\u0259r"} ${a}${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${i.origin} ${a}${i.minimum.toString()} ${o.unit}`:`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${i.origin} ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`Yanl\u0131\u015F m\u0259tn: "${a.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`:a.format==="ends_with"?`Yanl\u0131\u015F m\u0259tn: "${a.suffix}" il\u0259 bitm\u0259lidir`:a.format==="includes"?`Yanl\u0131\u015F m\u0259tn: "${a.includes}" daxil olmal\u0131d\u0131r`:a.format==="regex"?`Yanl\u0131\u015F m\u0259tn: ${a.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`:`Yanl\u0131\u015F ${r[a.format]??i.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${i.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${i.keys.length>1?"lar":""}: ${I(i.keys,", ")}`;case"invalid_key":return`${i.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${i.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}};function CC(){return{localeError:e2()}}function AC(e,t,r,n){let i=Math.abs(e),a=i%10,o=i%100;return o>=11&&o<=19?n:a===1?t:a>=2&&a<=4?r:n}var t2=()=>{let e={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function t(i){return e[i]??null}let r={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"},n={nan:"NaN",number:"\u043B\u0456\u043A",array:"\u043C\u0430\u0441\u0456\u045E"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F instanceof ${i.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${s}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${a}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${s}`}case"invalid_value":return i.values.length===1?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${R(i.values[0])}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);if(o){let s=Number(i.maximum),c=AC(s,o.unit.one,o.unit.few,o.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${i.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${o.verb} ${a}${i.maximum.toString()} ${c}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${i.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${a}${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);if(o){let s=Number(i.minimum),c=AC(s,o.unit.one,o.unit.few,o.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${i.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${o.verb} ${a}${i.minimum.toString()} ${c}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${i.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${a.prefix}"`:a.format==="ends_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${a.suffix}"`:a.format==="includes"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${a.includes}"`:a.format==="regex"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${a.pattern}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${r[a.format]??i.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${i.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${i.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${I(i.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${i.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${i.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}};function OC(){return{localeError:t2()}}var r2=()=>{let e={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},file:{unit:"\u0431\u0430\u0439\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"}};function t(i){return e[i]??null}let r={regex:"\u0432\u0445\u043E\u0434",email:"\u0438\u043C\u0435\u0439\u043B \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0436\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u043F\u0440\u043E\u0434\u044A\u043B\u0436\u0438\u0442\u0435\u043B\u043D\u043E\u0441\u0442",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"base64-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",base64url:"base64url-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",json_string:"JSON \u043D\u0438\u0437",e164:"E.164 \u043D\u043E\u043C\u0435\u0440",jwt:"JWT",template_literal:"\u0432\u0445\u043E\u0434"},n={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D instanceof ${i.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${s}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${a}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${s}`}case"invalid_value":return i.values.length===1?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${R(i.values[0])}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u043E\u043F\u0446\u0438\u044F: \u043E\u0447\u0430\u043A\u0432\u0430\u043D\u043E \u0435\u0434\u043D\u043E \u043E\u0442 ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${i.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${a}${i.maximum.toString()} ${o.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430"}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${i.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0431\u044A\u0434\u0435 ${a}${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${i.origin} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${a}${i.minimum.toString()} ${o.unit}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${i.origin} \u0434\u0430 \u0431\u044A\u0434\u0435 ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;if(a.format==="starts_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u0432\u0430 \u0441 "${a.prefix}"`;if(a.format==="ends_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u0432\u044A\u0440\u0448\u0432\u0430 \u0441 "${a.suffix}"`;if(a.format==="includes")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0432\u043A\u043B\u044E\u0447\u0432\u0430 "${a.includes}"`;if(a.format==="regex")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0441\u044A\u0432\u043F\u0430\u0434\u0430 \u0441 ${a.pattern}`;let o="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D";return a.format==="emoji"&&(o="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),a.format==="datetime"&&(o="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),a.format==="date"&&(o="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),a.format==="time"&&(o="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),a.format==="duration"&&(o="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),`${o} ${r[a.format]??i.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E \u0447\u0438\u0441\u043B\u043E: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0431\u044A\u0434\u0435 \u043A\u0440\u0430\u0442\u043D\u043E \u043D\u0430 ${i.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0437\u043F\u043E\u0437\u043D\u0430\u0442${i.keys.length>1?"\u0438":""} \u043A\u043B\u044E\u0447${i.keys.length>1?"\u043E\u0432\u0435":""}: ${I(i.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043A\u043B\u044E\u0447 \u0432 ${i.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434";case"invalid_element":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442 \u0432 ${i.origin}`;default:return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434"}}};function PC(){return{localeError:r2()}}var n2=()=>{let e={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function t(i){return e[i]??null}let r={regex:"entrada",email:"adre\xE7a electr\xF2nica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`Tipus inv\xE0lid: s'esperava instanceof ${i.expected}, s'ha rebut ${s}`:`Tipus inv\xE0lid: s'esperava ${a}, s'ha rebut ${s}`}case"invalid_value":return i.values.length===1?`Valor inv\xE0lid: s'esperava ${R(i.values[0])}`:`Opci\xF3 inv\xE0lida: s'esperava una de ${I(i.values," o ")}`;case"too_big":{let a=i.inclusive?"com a m\xE0xim":"menys de",o=t(i.origin);return o?`Massa gran: s'esperava que ${i.origin??"el valor"} contingu\xE9s ${a} ${i.maximum.toString()} ${o.unit??"elements"}`:`Massa gran: s'esperava que ${i.origin??"el valor"} fos ${a} ${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?"com a m\xEDnim":"m\xE9s de",o=t(i.origin);return o?`Massa petit: s'esperava que ${i.origin} contingu\xE9s ${a} ${i.minimum.toString()} ${o.unit}`:`Massa petit: s'esperava que ${i.origin} fos ${a} ${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`Format inv\xE0lid: ha de comen\xE7ar amb "${a.prefix}"`:a.format==="ends_with"?`Format inv\xE0lid: ha d'acabar amb "${a.suffix}"`:a.format==="includes"?`Format inv\xE0lid: ha d'incloure "${a.includes}"`:a.format==="regex"?`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${a.pattern}`:`Format inv\xE0lid per a ${r[a.format]??i.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${i.divisor}`;case"unrecognized_keys":return`Clau${i.keys.length>1?"s":""} no reconeguda${i.keys.length>1?"s":""}: ${I(i.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${i.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${i.origin}`;default:return"Entrada inv\xE0lida"}}};function NC(){return{localeError:n2()}}var i2=()=>{let e={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"}};function t(i){return e[i]??null}let r={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",jwt:"JWT",template_literal:"vstup"},n={nan:"NaN",number:"\u010D\xEDslo",string:"\u0159et\u011Bzec",function:"funkce",array:"pole"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no instanceof ${i.expected}, obdr\u017Eeno ${s}`:`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${a}, obdr\u017Eeno ${s}`}case"invalid_value":return i.values.length===1?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${R(i.values[0])}`:`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${i.origin??"hodnota"} mus\xED m\xEDt ${a}${i.maximum.toString()} ${o.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${i.origin??"hodnota"} mus\xED b\xFDt ${a}${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${i.origin??"hodnota"} mus\xED m\xEDt ${a}${i.minimum.toString()} ${o.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${i.origin??"hodnota"} mus\xED b\xFDt ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${a.prefix}"`:a.format==="ends_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${a.suffix}"`:a.format==="includes"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${a.includes}"`:a.format==="regex"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${a.pattern}`:`Neplatn\xFD form\xE1t ${r[a.format]??i.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${i.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${I(i.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${i.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${i.origin}`;default:return"Neplatn\xFD vstup"}}};function RC(){return{localeError:i2()}}var a2=()=>{let e={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}};function t(i){return e[i]??null}let r={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkesl\xE6t",date:"ISO-dato",time:"ISO-klokkesl\xE6t",duration:"ISO-varighed",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},n={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"s\xE6t",file:"fil"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`Ugyldigt input: forventede instanceof ${i.expected}, fik ${s}`:`Ugyldigt input: forventede ${a}, fik ${s}`}case"invalid_value":return i.values.length===1?`Ugyldig v\xE6rdi: forventede ${R(i.values[0])}`:`Ugyldigt valg: forventede en af f\xF8lgende ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin),s=n[i.origin]??i.origin;return o?`For stor: forventede ${s??"value"} ${o.verb} ${a} ${i.maximum.toString()} ${o.unit??"elementer"}`:`For stor: forventede ${s??"value"} havde ${a} ${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin),s=n[i.origin]??i.origin;return o?`For lille: forventede ${s} ${o.verb} ${a} ${i.minimum.toString()} ${o.unit}`:`For lille: forventede ${s} havde ${a} ${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`Ugyldig streng: skal starte med "${a.prefix}"`:a.format==="ends_with"?`Ugyldig streng: skal ende med "${a.suffix}"`:a.format==="includes"?`Ugyldig streng: skal indeholde "${a.includes}"`:a.format==="regex"?`Ugyldig streng: skal matche m\xF8nsteret ${a.pattern}`:`Ugyldig ${r[a.format]??i.format}`}case"not_multiple_of":return`Ugyldigt tal: skal v\xE6re deleligt med ${i.divisor}`;case"unrecognized_keys":return`${i.keys.length>1?"Ukendte n\xF8gler":"Ukendt n\xF8gle"}: ${I(i.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8gle i ${i.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig v\xE6rdi i ${i.origin}`;default:return"Ugyldigt input"}}};function MC(){return{localeError:a2()}}var o2=()=>{let e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function t(i){return e[i]??null}let r={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"},n={nan:"NaN",number:"Zahl",array:"Array"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`Ung\xFCltige Eingabe: erwartet instanceof ${i.expected}, erhalten ${s}`:`Ung\xFCltige Eingabe: erwartet ${a}, erhalten ${s}`}case"invalid_value":return i.values.length===1?`Ung\xFCltige Eingabe: erwartet ${R(i.values[0])}`:`Ung\xFCltige Option: erwartet eine von ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`Zu gro\xDF: erwartet, dass ${i.origin??"Wert"} ${a}${i.maximum.toString()} ${o.unit??"Elemente"} hat`:`Zu gro\xDF: erwartet, dass ${i.origin??"Wert"} ${a}${i.maximum.toString()} ist`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`Zu klein: erwartet, dass ${i.origin} ${a}${i.minimum.toString()} ${o.unit} hat`:`Zu klein: erwartet, dass ${i.origin} ${a}${i.minimum.toString()} ist`}case"invalid_format":{let a=i;return a.format==="starts_with"?`Ung\xFCltiger String: muss mit "${a.prefix}" beginnen`:a.format==="ends_with"?`Ung\xFCltiger String: muss mit "${a.suffix}" enden`:a.format==="includes"?`Ung\xFCltiger String: muss "${a.includes}" enthalten`:a.format==="regex"?`Ung\xFCltiger String: muss dem Muster ${a.pattern} entsprechen`:`Ung\xFCltig: ${r[a.format]??i.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${i.divisor} sein`;case"unrecognized_keys":return`${i.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${I(i.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${i.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${i.origin}`;default:return"Ung\xFCltige Eingabe"}}};function jC(){return{localeError:o2()}}var s2=()=>{let e={string:{unit:"\u03C7\u03B1\u03C1\u03B1\u03BA\u03C4\u03AE\u03C1\u03B5\u03C2",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},file:{unit:"bytes",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},array:{unit:"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},set:{unit:"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},map:{unit:"\u03BA\u03B1\u03C4\u03B1\u03C7\u03C9\u03C1\u03AE\u03C3\u03B5\u03B9\u03C2",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"}};function t(i){return e[i]??null}let r={regex:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2",email:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1 \u03BA\u03B1\u03B9 \u03CE\u03C1\u03B1",date:"ISO \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1",time:"ISO \u03CE\u03C1\u03B1",duration:"ISO \u03B4\u03B9\u03AC\u03C1\u03BA\u03B5\u03B9\u03B1",ipv4:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv4",ipv6:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv6",mac:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 MAC",cidrv4:"\u03B5\u03CD\u03C1\u03BF\u03C2 IPv4",cidrv6:"\u03B5\u03CD\u03C1\u03BF\u03C2 IPv6",base64:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64",base64url:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64url",json_string:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC JSON",e164:"\u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 E.164",jwt:"JWT",template_literal:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return typeof i.expected=="string"&&/^[A-Z]/.test(i.expected)?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD instanceof ${i.expected}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${s}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${a}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${s}`}case"invalid_value":return i.values.length===1?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${R(i.values[0])}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03C0\u03B9\u03BB\u03BF\u03B3\u03AE: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD \u03AD\u03BD\u03B1 \u03B1\u03C0\u03CC ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${i.origin??"\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${a}${i.maximum.toString()} ${o.unit??"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1"}`:`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${i.origin??"\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${a}${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${i.origin} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${a}${i.minimum.toString()} ${o.unit}`:`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${i.origin} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03BE\u03B5\u03BA\u03B9\u03BD\u03AC \u03BC\u03B5 "${a.prefix}"`:a.format==="ends_with"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B5\u03BB\u03B5\u03B9\u03CE\u03BD\u03B5\u03B9 \u03BC\u03B5 "${a.suffix}"`:a.format==="includes"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C0\u03B5\u03C1\u03B9\u03AD\u03C7\u03B5\u03B9 "${a.includes}"`:a.format==="regex"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B1\u03B9\u03C1\u03B9\u03AC\u03B6\u03B5\u03B9 \u03BC\u03B5 \u03C4\u03BF \u03BC\u03BF\u03C4\u03AF\u03B2\u03BF ${a.pattern}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF: ${r[a.format]??i.format}`}case"not_multiple_of":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF\u03C2 \u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 \u03C0\u03BF\u03BB\u03BB\u03B1\u03C0\u03BB\u03AC\u03C3\u03B9\u03BF \u03C4\u03BF\u03C5 ${i.divisor}`;case"unrecognized_keys":return`\u0386\u03B3\u03BD\u03C9\u03C3\u03C4${i.keys.length>1?"\u03B1":"\u03BF"} \u03BA\u03BB\u03B5\u03B9\u03B4${i.keys.length>1?"\u03B9\u03AC":"\u03AF"}: ${I(i.keys,", ")}`;case"invalid_key":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF \u03BA\u03BB\u03B5\u03B9\u03B4\u03AF \u03C3\u03C4\u03BF ${i.origin}`;case"invalid_union":return"\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2";case"invalid_element":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C4\u03B9\u03BC\u03AE \u03C3\u03C4\u03BF ${i.origin}`;default:return"\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"}}};function DC(){return{localeError:s2()}}var c2=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return`Invalid input: expected ${a}, received ${s}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${R(i.values[0])}`:`Invalid option: expected one of ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`Too big: expected ${i.origin??"value"} to have ${a}${i.maximum.toString()} ${o.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${a}${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`Too small: expected ${i.origin} to have ${a}${i.minimum.toString()} ${o.unit}`:`Too small: expected ${i.origin} to be ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`Invalid string: must start with "${a.prefix}"`:a.format==="ends_with"?`Invalid string: must end with "${a.suffix}"`:a.format==="includes"?`Invalid string: must include "${a.includes}"`:a.format==="regex"?`Invalid string: must match pattern ${a.pattern}`:`Invalid ${r[a.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${I(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return i.options&&Array.isArray(i.options)&&i.options.length>0?`Invalid discriminator value. Expected ${i.options.map(o=>`'${o}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function Hf(){return{localeError:c2()}}var l2=()=>{let e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function t(i){return e[i]??null}let r={regex:"enigo",email:"retadreso",url:"URL",emoji:"emo\u011Dio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-da\u016Dro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"},n={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`Nevalida enigo: atendi\u011Dis instanceof ${i.expected}, ricevi\u011Dis ${s}`:`Nevalida enigo: atendi\u011Dis ${a}, ricevi\u011Dis ${s}`}case"invalid_value":return i.values.length===1?`Nevalida enigo: atendi\u011Dis ${R(i.values[0])}`:`Nevalida opcio: atendi\u011Dis unu el ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`Tro granda: atendi\u011Dis ke ${i.origin??"valoro"} havu ${a}${i.maximum.toString()} ${o.unit??"elementojn"}`:`Tro granda: atendi\u011Dis ke ${i.origin??"valoro"} havu ${a}${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`Tro malgranda: atendi\u011Dis ke ${i.origin} havu ${a}${i.minimum.toString()} ${o.unit}`:`Tro malgranda: atendi\u011Dis ke ${i.origin} estu ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`Nevalida karaktraro: devas komenci\u011Di per "${a.prefix}"`:a.format==="ends_with"?`Nevalida karaktraro: devas fini\u011Di per "${a.suffix}"`:a.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${a.includes}"`:a.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${a.pattern}`:`Nevalida ${r[a.format]??i.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${i.divisor}`;case"unrecognized_keys":return`Nekonata${i.keys.length>1?"j":""} \u015Dlosilo${i.keys.length>1?"j":""}: ${I(i.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${i.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${i.origin}`;default:return"Nevalida enigo"}}};function zC(){return{localeError:l2()}}var u2=()=>{let e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function t(i){return e[i]??null}let r={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},n={nan:"NaN",string:"texto",number:"n\xFAmero",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"n\xFAmero grande",symbol:"s\xEDmbolo",undefined:"indefinido",null:"nulo",function:"funci\xF3n",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeraci\xF3n",union:"uni\xF3n",literal:"literal",promise:"promesa",void:"vac\xEDo",never:"nunca",unknown:"desconocido",any:"cualquiera"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`Entrada inv\xE1lida: se esperaba instanceof ${i.expected}, recibido ${s}`:`Entrada inv\xE1lida: se esperaba ${a}, recibido ${s}`}case"invalid_value":return i.values.length===1?`Entrada inv\xE1lida: se esperaba ${R(i.values[0])}`:`Opci\xF3n inv\xE1lida: se esperaba una de ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin),s=n[i.origin]??i.origin;return o?`Demasiado grande: se esperaba que ${s??"valor"} tuviera ${a}${i.maximum.toString()} ${o.unit??"elementos"}`:`Demasiado grande: se esperaba que ${s??"valor"} fuera ${a}${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin),s=n[i.origin]??i.origin;return o?`Demasiado peque\xF1o: se esperaba que ${s} tuviera ${a}${i.minimum.toString()} ${o.unit}`:`Demasiado peque\xF1o: se esperaba que ${s} fuera ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`Cadena inv\xE1lida: debe comenzar con "${a.prefix}"`:a.format==="ends_with"?`Cadena inv\xE1lida: debe terminar en "${a.suffix}"`:a.format==="includes"?`Cadena inv\xE1lida: debe incluir "${a.includes}"`:a.format==="regex"?`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${a.pattern}`:`Inv\xE1lido ${r[a.format]??i.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${i.divisor}`;case"unrecognized_keys":return`Llave${i.keys.length>1?"s":""} desconocida${i.keys.length>1?"s":""}: ${I(i.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${n[i.origin]??i.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${n[i.origin]??i.origin}`;default:return"Entrada inv\xE1lida"}}};function UC(){return{localeError:u2()}}var d2=()=>{let e={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function t(i){return e[i]??null}let r={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"},n={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0622\u0631\u0627\u06CC\u0647"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A instanceof ${i.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${s} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`:`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${a} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${s} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`}case"invalid_value":return i.values.length===1?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${R(i.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`:`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${I(i.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${i.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${a}${i.maximum.toString()} ${o.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${i.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${a}${i.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${i.origin} \u0628\u0627\u06CC\u062F ${a}${i.minimum.toString()} ${o.unit} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${i.origin} \u0628\u0627\u06CC\u062F ${a}${i.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let a=i;return a.format==="starts_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${a.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`:a.format==="ends_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${a.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`:a.format==="includes"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${a.includes}" \u0628\u0627\u0634\u062F`:a.format==="regex"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${a.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`:`${r[a.format]??i.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${i.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${i.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${I(i.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${i.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${i.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}};function LC(){return{localeError:d2()}}var f2=()=>{let e={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function t(i){return e[i]??null}let r={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`Virheellinen tyyppi: odotettiin instanceof ${i.expected}, oli ${s}`:`Virheellinen tyyppi: odotettiin ${a}, oli ${s}`}case"invalid_value":return i.values.length===1?`Virheellinen sy\xF6te: t\xE4ytyy olla ${R(i.values[0])}`:`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`Liian suuri: ${o.subject} t\xE4ytyy olla ${a}${i.maximum.toString()} ${o.unit}`.trim():`Liian suuri: arvon t\xE4ytyy olla ${a}${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`Liian pieni: ${o.subject} t\xE4ytyy olla ${a}${i.minimum.toString()} ${o.unit}`.trim():`Liian pieni: arvon t\xE4ytyy olla ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${a.prefix}"`:a.format==="ends_with"?`Virheellinen sy\xF6te: t\xE4ytyy loppua "${a.suffix}"`:a.format==="includes"?`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${a.includes}"`:a.format==="regex"?`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${a.pattern}`:`Virheellinen ${r[a.format]??i.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${i.divisor} monikerta`;case"unrecognized_keys":return`${i.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${I(i.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}}};function FC(){return{localeError:f2()}}var p2=()=>{let e={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function t(i){return e[i]??null}let r={regex:"entr\xE9e",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},n={string:"cha\xEEne",number:"nombre",int:"entier",boolean:"bool\xE9en",bigint:"grand entier",symbol:"symbole",undefined:"ind\xE9fini",null:"null",never:"jamais",void:"vide",date:"date",array:"tableau",object:"objet",tuple:"tuple",record:"enregistrement",map:"carte",set:"ensemble",file:"fichier",nonoptional:"non-optionnel",nan:"NaN",function:"fonction"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`Entr\xE9e invalide : instanceof ${i.expected} attendu, ${s} re\xE7u`:`Entr\xE9e invalide : ${a} attendu, ${s} re\xE7u`}case"invalid_value":return i.values.length===1?`Entr\xE9e invalide : ${R(i.values[0])} attendu`:`Option invalide : une valeur parmi ${I(i.values,"|")} attendue`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`Trop grand : ${n[i.origin]??"valeur"} doit ${o.verb} ${a}${i.maximum.toString()} ${o.unit??"\xE9l\xE9ment(s)"}`:`Trop grand : ${n[i.origin]??"valeur"} doit \xEAtre ${a}${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`Trop petit : ${n[i.origin]??"valeur"} doit ${o.verb} ${a}${i.minimum.toString()} ${o.unit}`:`Trop petit : ${n[i.origin]??"valeur"} doit \xEAtre ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${a.prefix}"`:a.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${a.suffix}"`:a.format==="includes"?`Cha\xEEne invalide : doit inclure "${a.includes}"`:a.format==="regex"?`Cha\xEEne invalide : doit correspondre au mod\xE8le ${a.pattern}`:`${r[a.format]??i.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${i.divisor}`;case"unrecognized_keys":return`Cl\xE9${i.keys.length>1?"s":""} non reconnue${i.keys.length>1?"s":""} : ${I(i.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${i.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${i.origin}`;default:return"Entr\xE9e invalide"}}};function BC(){return{localeError:p2()}}var m2=()=>{let e={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function t(i){return e[i]??null}let r={regex:"entr\xE9e",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`Entr\xE9e invalide : attendu instanceof ${i.expected}, re\xE7u ${s}`:`Entr\xE9e invalide : attendu ${a}, re\xE7u ${s}`}case"invalid_value":return i.values.length===1?`Entr\xE9e invalide : attendu ${R(i.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"\u2264":"<",o=t(i.origin);return o?`Trop grand : attendu que ${i.origin??"la valeur"} ait ${a}${i.maximum.toString()} ${o.unit}`:`Trop grand : attendu que ${i.origin??"la valeur"} soit ${a}${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?"\u2265":">",o=t(i.origin);return o?`Trop petit : attendu que ${i.origin} ait ${a}${i.minimum.toString()} ${o.unit}`:`Trop petit : attendu que ${i.origin} soit ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${a.prefix}"`:a.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${a.suffix}"`:a.format==="includes"?`Cha\xEEne invalide : doit inclure "${a.includes}"`:a.format==="regex"?`Cha\xEEne invalide : doit correspondre au motif ${a.pattern}`:`${r[a.format]??i.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${i.divisor}`;case"unrecognized_keys":return`Cl\xE9${i.keys.length>1?"s":""} non reconnue${i.keys.length>1?"s":""} : ${I(i.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${i.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${i.origin}`;default:return"Entr\xE9e invalide"}}};function VC(){return{localeError:m2()}}var h2=()=>{let e={string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA",gender:"f"},number:{label:"\u05DE\u05E1\u05E4\u05E8",gender:"m"},boolean:{label:"\u05E2\u05E8\u05DA \u05D1\u05D5\u05DC\u05D9\u05D0\u05E0\u05D9",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA",gender:"m"},array:{label:"\u05DE\u05E2\u05E8\u05DA",gender:"m"},object:{label:"\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8",gender:"m"},null:{label:"\u05E2\u05E8\u05DA \u05E8\u05D9\u05E7 (null)",gender:"m"},undefined:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05DE\u05D5\u05D2\u05D3\u05E8 (undefined)",gender:"m"},symbol:{label:"\u05E1\u05D9\u05DE\u05D1\u05D5\u05DC (Symbol)",gender:"m"},function:{label:"\u05E4\u05D5\u05E0\u05E7\u05E6\u05D9\u05D4",gender:"f"},map:{label:"\u05DE\u05E4\u05D4 (Map)",gender:"f"},set:{label:"\u05E7\u05D1\u05D5\u05E6\u05D4 (Set)",gender:"f"},file:{label:"\u05E7\u05D5\u05D1\u05E5",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05D9\u05D3\u05D5\u05E2",gender:"m"},value:{label:"\u05E2\u05E8\u05DA",gender:"m"}},t={string:{unit:"\u05EA\u05D5\u05D5\u05D9\u05DD",shortLabel:"\u05E7\u05E6\u05E8",longLabel:"\u05D0\u05E8\u05D5\u05DA"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},number:{unit:"",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"}},r=l=>l?e[l]:void 0,n=l=>{let u=r(l);return u?u.label:l??e.unknown.label},i=l=>`\u05D4${n(l)}`,a=l=>(r(l)?.gender??"m")==="f"?"\u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05D9\u05D5\u05EA":"\u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA",o=l=>l?t[l]??null:null,s={regex:{label:"\u05E7\u05DC\u05D8",gender:"m"},email:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",gender:"f"},url:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",gender:"f"},emoji:{label:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",gender:"m"},time:{label:"\u05D6\u05DE\u05DF ISO",gender:"m"},duration:{label:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",gender:"m"},ipv4:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",gender:"f"},ipv6:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",gender:"f"},cidrv4:{label:"\u05D8\u05D5\u05D5\u05D7 IPv4",gender:"m"},cidrv6:{label:"\u05D8\u05D5\u05D5\u05D7 IPv6",gender:"m"},base64:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",gender:"f"},base64url:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",gender:"f"},json_string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",gender:"f"},e164:{label:"\u05DE\u05E1\u05E4\u05E8 E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},includes:{label:"\u05E7\u05DC\u05D8",gender:"m"},lowercase:{label:"\u05E7\u05DC\u05D8",gender:"m"},starts_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},uppercase:{label:"\u05E7\u05DC\u05D8",gender:"m"}},c={nan:"NaN"};return l=>{switch(l.code){case"invalid_type":{let u=l.expected,d=c[u??""]??n(u),f=M(l.input),p=c[f]??e[f]?.label??f;return/^[A-Z]/.test(l.expected)?`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA instanceof ${l.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${p}`:`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${d}, \u05D4\u05EA\u05E7\u05D1\u05DC ${p}`}case"invalid_value":{if(l.values.length===1)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05E2\u05E8\u05DA \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA ${R(l.values[0])}`;let u=l.values.map(p=>R(p));if(l.values.length===2)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${u[0]} \u05D0\u05D5 ${u[1]}`;let d=u[u.length-1];return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${u.slice(0,-1).join(", ")} \u05D0\u05D5 ${d}`}case"too_big":{let u=o(l.origin),d=i(l.origin??"value");if(l.origin==="string")return`${u?.longLabel??"\u05D0\u05E8\u05D5\u05DA"} \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${l.maximum.toString()} ${u?.unit??""} ${l.inclusive?"\u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA":"\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8"}`.trim();if(l.origin==="number"){let m=l.inclusive?`\u05E7\u05D8\u05DF \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${l.maximum}`:`\u05E7\u05D8\u05DF \u05DE-${l.maximum}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${m}`}if(l.origin==="array"||l.origin==="set"){let m=l.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA",h=l.inclusive?`${l.maximum} ${u?.unit??""} \u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA`:`\u05E4\u05D7\u05D5\u05EA \u05DE-${l.maximum} ${u?.unit??""}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${d} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`.trim()}let f=l.inclusive?"<=":"<",p=a(l.origin??"value");return u?.unit?`${u.longLabel} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${l.maximum.toString()} ${u.unit}`:`${u?.longLabel??"\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${l.maximum.toString()}`}case"too_small":{let u=o(l.origin),d=i(l.origin??"value");if(l.origin==="string")return`${u?.shortLabel??"\u05E7\u05E6\u05E8"} \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${l.minimum.toString()} ${u?.unit??""} ${l.inclusive?"\u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8":"\u05DC\u05E4\u05D7\u05D5\u05EA"}`.trim();if(l.origin==="number"){let m=l.inclusive?`\u05D2\u05D3\u05D5\u05DC \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${l.minimum}`:`\u05D2\u05D3\u05D5\u05DC \u05DE-${l.minimum}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${m}`}if(l.origin==="array"||l.origin==="set"){let m=l.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA";if(l.minimum===1&&l.inclusive){let _=(l.origin==="set","\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3");return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${_}`}let h=l.inclusive?`${l.minimum} ${u?.unit??""} \u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8`:`\u05D9\u05D5\u05EA\u05E8 \u05DE-${l.minimum} ${u?.unit??""}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`.trim()}let f=l.inclusive?">=":">",p=a(l.origin??"value");return u?.unit?`${u.shortLabel} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${l.minimum.toString()} ${u.unit}`:`${u?.shortLabel??"\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${l.minimum.toString()}`}case"invalid_format":{let u=l;if(u.format==="starts_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1 "${u.prefix}"`;if(u.format==="ends_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${u.suffix}"`;if(u.format==="includes")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${u.includes}"`;if(u.format==="regex")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${u.pattern}`;let d=s[u.format],f=d?.label??u.format,m=(d?.gender??"m")==="f"?"\u05EA\u05E7\u05D9\u05E0\u05D4":"\u05EA\u05E7\u05D9\u05DF";return`${f} \u05DC\u05D0 ${m}`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${l.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${l.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${l.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${I(l.keys,", ")}`;case"invalid_key":return"\u05E9\u05D3\u05D4 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8";case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${i(l.origin??"array")}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}};function ZC(){return{localeError:h2()}}var g2=()=>{let e={string:{unit:"znakova",verb:"imati"},file:{unit:"bajtova",verb:"imati"},array:{unit:"stavki",verb:"imati"},set:{unit:"stavki",verb:"imati"}};function t(i){return e[i]??null}let r={regex:"unos",email:"email adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum i vrijeme",date:"ISO datum",time:"ISO vrijeme",duration:"ISO trajanje",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"IPv4 raspon",cidrv6:"IPv6 raspon",base64:"base64 kodirani tekst",base64url:"base64url kodirani tekst",json_string:"JSON tekst",e164:"E.164 broj",jwt:"JWT",template_literal:"unos"},n={nan:"NaN",string:"tekst",number:"broj",boolean:"boolean",array:"niz",object:"objekt",set:"skup",file:"datoteka",date:"datum",bigint:"bigint",symbol:"simbol",undefined:"undefined",null:"null",function:"funkcija",map:"mapa"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`Neispravan unos: o\u010Dekuje se instanceof ${i.expected}, a primljeno je ${s}`:`Neispravan unos: o\u010Dekuje se ${a}, a primljeno je ${s}`}case"invalid_value":return i.values.length===1?`Neispravna vrijednost: o\u010Dekivano ${R(i.values[0])}`:`Neispravna opcija: o\u010Dekivano jedno od ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin),s=n[i.origin]??i.origin;return o?`Preveliko: o\u010Dekivano da ${s??"vrijednost"} ima ${a}${i.maximum.toString()} ${o.unit??"elemenata"}`:`Preveliko: o\u010Dekivano da ${s??"vrijednost"} bude ${a}${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin),s=n[i.origin]??i.origin;return o?`Premalo: o\u010Dekivano da ${s} ima ${a}${i.minimum.toString()} ${o.unit}`:`Premalo: o\u010Dekivano da ${s} bude ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`Neispravan tekst: mora zapo\u010Dinjati s "${a.prefix}"`:a.format==="ends_with"?`Neispravan tekst: mora zavr\u0161avati s "${a.suffix}"`:a.format==="includes"?`Neispravan tekst: mora sadr\u017Eavati "${a.includes}"`:a.format==="regex"?`Neispravan tekst: mora odgovarati uzorku ${a.pattern}`:`Neispravna ${r[a.format]??i.format}`}case"not_multiple_of":return`Neispravan broj: mora biti vi\u0161ekratnik od ${i.divisor}`;case"unrecognized_keys":return`Neprepoznat${i.keys.length>1?"i klju\u010Devi":" klju\u010D"}: ${I(i.keys,", ")}`;case"invalid_key":return`Neispravan klju\u010D u ${n[i.origin]??i.origin}`;case"invalid_union":return"Neispravan unos";case"invalid_element":return`Neispravna vrijednost u ${n[i.origin]??i.origin}`;default:return"Neispravan unos"}}};function HC(){return{localeError:g2()}}var _2=()=>{let e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function t(i){return e[i]??null}let r={regex:"bemenet",email:"email c\xEDm",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",jwt:"JWT",template_literal:"bemenet"},n={nan:"NaN",number:"sz\xE1m",array:"t\xF6mb"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k instanceof ${i.expected}, a kapott \xE9rt\xE9k ${s}`:`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${a}, a kapott \xE9rt\xE9k ${s}`}case"invalid_value":return i.values.length===1?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${R(i.values[0])}`:`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`T\xFAl nagy: ${i.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${a}${i.maximum.toString()} ${o.unit??"elem"}`:`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${i.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${a}${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${i.origin} m\xE9rete t\xFAl kicsi ${a}${i.minimum.toString()} ${o.unit}`:`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${i.origin} t\xFAl kicsi ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`\xC9rv\xE9nytelen string: "${a.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`:a.format==="ends_with"?`\xC9rv\xE9nytelen string: "${a.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`:a.format==="includes"?`\xC9rv\xE9nytelen string: "${a.includes}" \xE9rt\xE9ket kell tartalmaznia`:a.format==="regex"?`\xC9rv\xE9nytelen string: ${a.pattern} mint\xE1nak kell megfelelnie`:`\xC9rv\xE9nytelen ${r[a.format]??i.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${i.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${i.keys.length>1?"s":""}: ${I(i.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${i.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${i.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}};function GC(){return{localeError:_2()}}function WC(e,t,r){return Math.abs(e)===1?t:r}function Ps(e){if(!e)return"";let t=["\u0561","\u0565","\u0568","\u056B","\u0578","\u0578\u0582","\u0585"],r=e[e.length-1];return e+(t.includes(r)?"\u0576":"\u0568")}var y2=()=>{let e={string:{unit:{one:"\u0576\u0577\u0561\u0576",many:"\u0576\u0577\u0561\u0576\u0576\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},file:{unit:{one:"\u0562\u0561\u0575\u0569",many:"\u0562\u0561\u0575\u0569\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},array:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},set:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"}};function t(i){return e[i]??null}let r={regex:"\u0574\u0578\u0582\u057F\u0584",email:"\u0567\u056C. \u0570\u0561\u057D\u0581\u0565",url:"URL",emoji:"\u0567\u0574\u0578\u057B\u056B",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E \u0587 \u056A\u0561\u0574",date:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E",time:"ISO \u056A\u0561\u0574",duration:"ISO \u057F\u0587\u0578\u0572\u0578\u0582\u0569\u0575\u0578\u0582\u0576",ipv4:"IPv4 \u0570\u0561\u057D\u0581\u0565",ipv6:"IPv6 \u0570\u0561\u057D\u0581\u0565",cidrv4:"IPv4 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",cidrv6:"IPv6 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",base64:"base64 \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",base64url:"base64url \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",json_string:"JSON \u057F\u0578\u0572",e164:"E.164 \u0570\u0561\u0574\u0561\u0580",jwt:"JWT",template_literal:"\u0574\u0578\u0582\u057F\u0584"},n={nan:"NaN",number:"\u0569\u056B\u057E",array:"\u0566\u0561\u0576\u0563\u057E\u0561\u056E"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 instanceof ${i.expected}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${s}`:`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${a}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${s}`}case"invalid_value":return i.values.length===1?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${R(i.values[1])}`:`\u054D\u056D\u0561\u056C \u057F\u0561\u0580\u0562\u0565\u0580\u0561\u056F\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 \u0570\u0565\u057F\u0587\u0575\u0561\u056C\u0576\u0565\u0580\u056B\u0581 \u0574\u0565\u056F\u0568\u055D ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);if(o){let s=Number(i.maximum),c=WC(s,o.unit.one,o.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${Ps(i.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${a}${i.maximum.toString()} ${c}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${Ps(i.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056C\u056B\u0576\u056B ${a}${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);if(o){let s=Number(i.minimum),c=WC(s,o.unit.one,o.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${Ps(i.origin)} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${a}${i.minimum.toString()} ${c}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${Ps(i.origin)} \u056C\u056B\u0576\u056B ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057D\u056F\u057D\u057E\u056B "${a.prefix}"-\u0578\u057E`:a.format==="ends_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0561\u057E\u0561\u0580\u057F\u057E\u056B "${a.suffix}"-\u0578\u057E`:a.format==="includes"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057A\u0561\u0580\u0578\u0582\u0576\u0561\u056F\u056B "${a.includes}"`:a.format==="regex"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0570\u0561\u0574\u0561\u057A\u0561\u057F\u0561\u057D\u056D\u0561\u0576\u056B ${a.pattern} \u0571\u0587\u0561\u0579\u0561\u0583\u056B\u0576`:`\u054D\u056D\u0561\u056C ${r[a.format]??i.format}`}case"not_multiple_of":return`\u054D\u056D\u0561\u056C \u0569\u056B\u057E\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0562\u0561\u0566\u0574\u0561\u057A\u0561\u057F\u056B\u056F \u056C\u056B\u0576\u056B ${i.divisor}-\u056B`;case"unrecognized_keys":return`\u0549\u0573\u0561\u0576\u0561\u0579\u057E\u0561\u056E \u0562\u0561\u0576\u0561\u056C\u056B${i.keys.length>1?"\u0576\u0565\u0580":""}. ${I(i.keys,", ")}`;case"invalid_key":return`\u054D\u056D\u0561\u056C \u0562\u0561\u0576\u0561\u056C\u056B ${Ps(i.origin)}-\u0578\u0582\u0574`;case"invalid_union":return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574";case"invalid_element":return`\u054D\u056D\u0561\u056C \u0561\u0580\u056A\u0565\u0584 ${Ps(i.origin)}-\u0578\u0582\u0574`;default:return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574"}}};function JC(){return{localeError:y2()}}var v2=()=>{let e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function t(i){return e[i]??null}let r={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`Input tidak valid: diharapkan instanceof ${i.expected}, diterima ${s}`:`Input tidak valid: diharapkan ${a}, diterima ${s}`}case"invalid_value":return i.values.length===1?`Input tidak valid: diharapkan ${R(i.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`Terlalu besar: diharapkan ${i.origin??"value"} memiliki ${a}${i.maximum.toString()} ${o.unit??"elemen"}`:`Terlalu besar: diharapkan ${i.origin??"value"} menjadi ${a}${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`Terlalu kecil: diharapkan ${i.origin} memiliki ${a}${i.minimum.toString()} ${o.unit}`:`Terlalu kecil: diharapkan ${i.origin} menjadi ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`String tidak valid: harus dimulai dengan "${a.prefix}"`:a.format==="ends_with"?`String tidak valid: harus berakhir dengan "${a.suffix}"`:a.format==="includes"?`String tidak valid: harus menyertakan "${a.includes}"`:a.format==="regex"?`String tidak valid: harus sesuai pola ${a.pattern}`:`${r[a.format]??i.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${i.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${i.keys.length>1?"s":""}: ${I(i.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${i.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${i.origin}`;default:return"Input tidak valid"}}};function KC(){return{localeError:v2()}}var b2=()=>{let e={string:{unit:"stafi",verb:"a\xF0 hafa"},file:{unit:"b\xE6ti",verb:"a\xF0 hafa"},array:{unit:"hluti",verb:"a\xF0 hafa"},set:{unit:"hluti",verb:"a\xF0 hafa"}};function t(i){return e[i]??null}let r={regex:"gildi",email:"netfang",url:"vefsl\xF3\xF0",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og t\xEDmi",date:"ISO dagsetning",time:"ISO t\xEDmi",duration:"ISO t\xEDmalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 t\xF6lugildi",jwt:"JWT",template_literal:"gildi"},n={nan:"NaN",number:"n\xFAmer",array:"fylki"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`Rangt gildi: \xDE\xFA sl\xF3st inn ${s} \xFEar sem \xE1 a\xF0 vera instanceof ${i.expected}`:`Rangt gildi: \xDE\xFA sl\xF3st inn ${s} \xFEar sem \xE1 a\xF0 vera ${a}`}case"invalid_value":return i.values.length===1?`Rangt gildi: gert r\xE1\xF0 fyrir ${R(i.values[0])}`:`\xD3gilt val: m\xE1 vera eitt af eftirfarandi ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${i.origin??"gildi"} hafi ${a}${i.maximum.toString()} ${o.unit??"hluti"}`:`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${i.origin??"gildi"} s\xE9 ${a}${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${i.origin} hafi ${a}${i.minimum.toString()} ${o.unit}`:`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${i.origin} s\xE9 ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 byrja \xE1 "${a.prefix}"`:a.format==="ends_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 enda \xE1 "${a.suffix}"`:a.format==="includes"?`\xD3gildur strengur: ver\xF0ur a\xF0 innihalda "${a.includes}"`:a.format==="regex"?`\xD3gildur strengur: ver\xF0ur a\xF0 fylgja mynstri ${a.pattern}`:`Rangt ${r[a.format]??i.format}`}case"not_multiple_of":return`R\xF6ng tala: ver\xF0ur a\xF0 vera margfeldi af ${i.divisor}`;case"unrecognized_keys":return`\xD3\xFEekkt ${i.keys.length>1?"ir lyklar":"ur lykill"}: ${I(i.keys,", ")}`;case"invalid_key":return`Rangur lykill \xED ${i.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi \xED ${i.origin}`;default:return"Rangt gildi"}}};function qC(){return{localeError:b2()}}var w2=()=>{let e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function t(i){return e[i]??null}let r={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"},n={nan:"NaN",number:"numero",array:"vettore"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`Input non valido: atteso instanceof ${i.expected}, ricevuto ${s}`:`Input non valido: atteso ${a}, ricevuto ${s}`}case"invalid_value":return i.values.length===1?`Input non valido: atteso ${R(i.values[0])}`:`Opzione non valida: atteso uno tra ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`Troppo grande: ${i.origin??"valore"} deve avere ${a}${i.maximum.toString()} ${o.unit??"elementi"}`:`Troppo grande: ${i.origin??"valore"} deve essere ${a}${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`Troppo piccolo: ${i.origin} deve avere ${a}${i.minimum.toString()} ${o.unit}`:`Troppo piccolo: ${i.origin} deve essere ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`Stringa non valida: deve iniziare con "${a.prefix}"`:a.format==="ends_with"?`Stringa non valida: deve terminare con "${a.suffix}"`:a.format==="includes"?`Stringa non valida: deve includere "${a.includes}"`:a.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${a.pattern}`:`Input non valido: ${r[a.format]??i.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${i.divisor}`;case"unrecognized_keys":return`Chiav${i.keys.length>1?"i":"e"} non riconosciut${i.keys.length>1?"e":"a"}: ${I(i.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${i.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${i.origin}`;default:return"Input non valido"}}};function YC(){return{localeError:w2()}}var x2=()=>{let e={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function t(i){return e[i]??null}let r={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",jwt:"JWT",template_literal:"\u5165\u529B\u5024"},n={nan:"NaN",number:"\u6570\u5024",array:"\u914D\u5217"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u7121\u52B9\u306A\u5165\u529B: instanceof ${i.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${s}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u5165\u529B: ${a}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${s}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`}case"invalid_value":return i.values.length===1?`\u7121\u52B9\u306A\u5165\u529B: ${R(i.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u9078\u629E: ${I(i.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let a=i.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",o=t(i.origin);return o?`\u5927\u304D\u3059\u304E\u308B\u5024: ${i.origin??"\u5024"}\u306F${i.maximum.toString()}${o.unit??"\u8981\u7D20"}${a}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5927\u304D\u3059\u304E\u308B\u5024: ${i.origin??"\u5024"}\u306F${i.maximum.toString()}${a}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let a=i.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",o=t(i.origin);return o?`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${i.origin}\u306F${i.minimum.toString()}${o.unit}${a}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${i.origin}\u306F${i.minimum.toString()}${a}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let a=i;return a.format==="starts_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${a.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:a.format==="ends_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${a.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:a.format==="includes"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${a.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:a.format==="regex"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${a.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u7121\u52B9\u306A${r[a.format]??i.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${i.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${i.keys.length>1?"\u7FA4":""}: ${I(i.keys,"\u3001")}`;case"invalid_key":return`${i.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${i.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}};function XC(){return{localeError:x2()}}var S2=()=>{let e={string:{unit:"\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},file:{unit:"\u10D1\u10D0\u10D8\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},array:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},set:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"}};function t(i){return e[i]??null}let r={regex:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0",email:"\u10D4\u10DA-\u10E4\u10DD\u10E1\u10E2\u10D8\u10E1 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",url:"URL",emoji:"\u10D4\u10DB\u10DD\u10EF\u10D8",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8-\u10D3\u10E0\u10DD",date:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8",time:"\u10D3\u10E0\u10DD",duration:"\u10EE\u10D0\u10DC\u10D2\u10E0\u10EB\u10DA\u10D8\u10D5\u10DD\u10D1\u10D0",ipv4:"IPv4 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",ipv6:"IPv6 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",cidrv4:"IPv4 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",cidrv6:"IPv6 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",base64:"base64-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",base64url:"base64url-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",json_string:"JSON \u10D5\u10D4\u10DA\u10D8",e164:"E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",jwt:"JWT",template_literal:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"},n={nan:"NaN",number:"\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8",string:"\u10D5\u10D4\u10DA\u10D8",boolean:"\u10D1\u10E3\u10DA\u10D4\u10D0\u10DC\u10D8",function:"\u10E4\u10E3\u10DC\u10E5\u10EA\u10D8\u10D0",array:"\u10DB\u10D0\u10E1\u10D8\u10D5\u10D8"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 instanceof ${i.expected}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${s}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${a}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${s}`}case"invalid_value":return i.values.length===1?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${R(i.values[0])}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D0\u10E0\u10D8\u10D0\u10DC\u10E2\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8\u10D0 \u10D4\u10E0\u10D7-\u10D4\u10E0\u10D7\u10D8 ${I(i.values,"|")}-\u10D3\u10D0\u10DC`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${i.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} ${o.verb} ${a}${i.maximum.toString()} ${o.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${i.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} \u10D8\u10E7\u10DD\u10E1 ${a}${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${i.origin} ${o.verb} ${a}${i.minimum.toString()} ${o.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${i.origin} \u10D8\u10E7\u10DD\u10E1 ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10EC\u10E7\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${a.prefix}"-\u10D8\u10D7`:a.format==="ends_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10DB\u10D7\u10D0\u10D5\u10E0\u10D3\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${a.suffix}"-\u10D8\u10D7`:a.format==="includes"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1 "${a.includes}"-\u10E1`:a.format==="regex"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D4\u10E1\u10D0\u10D1\u10D0\u10DB\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 \u10E8\u10D0\u10D1\u10DA\u10DD\u10DC\u10E1 ${a.pattern}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 ${r[a.format]??i.format}`}case"not_multiple_of":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E0\u10D8\u10EA\u10EE\u10D5\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10E7\u10DD\u10E1 ${i.divisor}-\u10D8\u10E1 \u10EF\u10D4\u10E0\u10D0\u10D3\u10D8`;case"unrecognized_keys":return`\u10E3\u10EA\u10DC\u10DD\u10D1\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1${i.keys.length>1?"\u10D4\u10D1\u10D8":"\u10D8"}: ${I(i.keys,", ")}`;case"invalid_key":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1\u10D8 ${i.origin}-\u10E8\u10D8`;case"invalid_union":return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0";case"invalid_element":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0 ${i.origin}-\u10E8\u10D8`;default:return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"}}};function QC(){return{localeError:S2()}}var k2=()=>{let e={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function t(i){return e[i]??null}let r={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"},n={nan:"NaN",number:"\u179B\u17C1\u1781",array:"\u17A2\u17B6\u179A\u17C1 (Array)",null:"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A instanceof ${i.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${s}`:`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${a} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${s}`}case"invalid_value":return i.values.length===1?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${R(i.values[0])}`:`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${i.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${a} ${i.maximum.toString()} ${o.unit??"\u1792\u17B6\u178F\u17BB"}`:`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${i.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${a} ${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${i.origin} ${a} ${i.minimum.toString()} ${o.unit}`:`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${i.origin} ${a} ${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${a.prefix}"`:a.format==="ends_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${a.suffix}"`:a.format==="includes"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${a.includes}"`:a.format==="regex"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${a.pattern}`:`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${r[a.format]??i.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${i.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${I(i.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${i.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${i.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}};function Gf(){return{localeError:k2()}}function eA(){return Gf()}var E2=()=>{let e={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",jwt:"JWT",template_literal:"\uC785\uB825"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 instanceof ${i.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${s}\uC785\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${a}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${s}\uC785\uB2C8\uB2E4`}case"invalid_value":return i.values.length===1?`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${R(i.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC635\uC158: ${I(i.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let a=i.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",o=a==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",s=t(i.origin),c=s?.unit??"\uC694\uC18C";return s?`${i.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${i.maximum.toString()}${c} ${a}${o}`:`${i.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${i.maximum.toString()} ${a}${o}`}case"too_small":{let a=i.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",o=a==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",s=t(i.origin),c=s?.unit??"\uC694\uC18C";return s?`${i.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${i.minimum.toString()}${c} ${a}${o}`:`${i.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${i.minimum.toString()} ${a}${o}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${a.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`:a.format==="ends_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${a.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`:a.format==="includes"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${a.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`:a.format==="regex"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${a.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C ${r[a.format]??i.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${i.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${I(i.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${i.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${i.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}};function tA(){return{localeError:E2()}}var Ol=e=>e.charAt(0).toUpperCase()+e.slice(1);function rA(e){let t=Math.abs(e),r=t%10,n=t%100;return n>=11&&n<=19||r===0?"many":r===1?"one":"few"}var $2=()=>{let e={string:{unit:{one:"simbolis",few:"simboliai",many:"simboli\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne ilgesn\u0117 kaip",notInclusive:"turi b\u016Bti trumpesn\u0117 kaip"},bigger:{inclusive:"turi b\u016Bti ne trumpesn\u0117 kaip",notInclusive:"turi b\u016Bti ilgesn\u0117 kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"bait\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne didesnis kaip",notInclusive:"turi b\u016Bti ma\u017Eesnis kaip"},bigger:{inclusive:"turi b\u016Bti ne ma\u017Eesnis kaip",notInclusive:"turi b\u016Bti didesnis kaip"}}},array:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}},set:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}}};function t(i,a,o,s){let c=e[i]??null;return c===null?c:{unit:c.unit[a],verb:c.verb[s][o?"inclusive":"notInclusive"]}}let r={regex:"\u012Fvestis",email:"el. pa\u0161to adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukm\u0117",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 u\u017Ekoduota eilut\u0117",base64url:"base64url u\u017Ekoduota eilut\u0117",json_string:"JSON eilut\u0117",e164:"E.164 numeris",jwt:"JWT",template_literal:"\u012Fvestis"},n={nan:"NaN",number:"skai\u010Dius",bigint:"sveikasis skai\u010Dius",string:"eilut\u0117",boolean:"login\u0117 reik\u0161m\u0117",undefined:"neapibr\u0117\u017Eta reik\u0161m\u0117",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulin\u0117 reik\u0161m\u0117"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`Gautas tipas ${s}, o tik\u0117tasi - instanceof ${i.expected}`:`Gautas tipas ${s}, o tik\u0117tasi - ${a}`}case"invalid_value":return i.values.length===1?`Privalo b\u016Bti ${R(i.values[0])}`:`Privalo b\u016Bti vienas i\u0161 ${I(i.values,"|")} pasirinkim\u0173`;case"too_big":{let a=n[i.origin]??i.origin,o=t(i.origin,rA(Number(i.maximum)),i.inclusive??!1,"smaller");if(o?.verb)return`${Ol(a??i.origin??"reik\u0161m\u0117")} ${o.verb} ${i.maximum.toString()} ${o.unit??"element\u0173"}`;let s=i.inclusive?"ne didesnis kaip":"ma\u017Eesnis kaip";return`${Ol(a??i.origin??"reik\u0161m\u0117")} turi b\u016Bti ${s} ${i.maximum.toString()} ${o?.unit}`}case"too_small":{let a=n[i.origin]??i.origin,o=t(i.origin,rA(Number(i.minimum)),i.inclusive??!1,"bigger");if(o?.verb)return`${Ol(a??i.origin??"reik\u0161m\u0117")} ${o.verb} ${i.minimum.toString()} ${o.unit??"element\u0173"}`;let s=i.inclusive?"ne ma\u017Eesnis kaip":"didesnis kaip";return`${Ol(a??i.origin??"reik\u0161m\u0117")} turi b\u016Bti ${s} ${i.minimum.toString()} ${o?.unit}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`Eilut\u0117 privalo prasid\u0117ti "${a.prefix}"`:a.format==="ends_with"?`Eilut\u0117 privalo pasibaigti "${a.suffix}"`:a.format==="includes"?`Eilut\u0117 privalo \u012Ftraukti "${a.includes}"`:a.format==="regex"?`Eilut\u0117 privalo atitikti ${a.pattern}`:`Neteisingas ${r[a.format]??i.format}`}case"not_multiple_of":return`Skai\u010Dius privalo b\u016Bti ${i.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpa\u017Eint${i.keys.length>1?"i":"as"} rakt${i.keys.length>1?"ai":"as"}: ${I(i.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga \u012Fvestis";case"invalid_element":{let a=n[i.origin]??i.origin;return`${Ol(a??i.origin??"reik\u0161m\u0117")} turi klaiding\u0105 \u012Fvest\u012F`}default:return"Klaidinga \u012Fvestis"}}};function nA(){return{localeError:$2()}}var I2=()=>{let e={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function t(i){return e[i]??null}let r={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"},n={nan:"NaN",number:"\u0431\u0440\u043E\u0458",array:"\u043D\u0438\u0437\u0430"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 instanceof ${i.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${s}`:`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${a}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${s}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${R(i.values[0])}`:`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${i.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${a}${i.maximum.toString()} ${o.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${i.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${a}${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${i.origin} \u0434\u0430 \u0438\u043C\u0430 ${a}${i.minimum.toString()} ${o.unit}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${i.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${a.prefix}"`:a.format==="ends_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${a.suffix}"`:a.format==="includes"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${a.includes}"`:a.format==="regex"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${a.pattern}`:`Invalid ${r[a.format]??i.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${i.divisor}`;case"unrecognized_keys":return`${i.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${I(i.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${i.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${i.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}};function iA(){return{localeError:I2()}}var T2=()=>{let e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function t(i){return e[i]??null}let r={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"},n={nan:"NaN",number:"nombor"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`Input tidak sah: dijangka instanceof ${i.expected}, diterima ${s}`:`Input tidak sah: dijangka ${a}, diterima ${s}`}case"invalid_value":return i.values.length===1?`Input tidak sah: dijangka ${R(i.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`Terlalu besar: dijangka ${i.origin??"nilai"} ${o.verb} ${a}${i.maximum.toString()} ${o.unit??"elemen"}`:`Terlalu besar: dijangka ${i.origin??"nilai"} adalah ${a}${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`Terlalu kecil: dijangka ${i.origin} ${o.verb} ${a}${i.minimum.toString()} ${o.unit}`:`Terlalu kecil: dijangka ${i.origin} adalah ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`String tidak sah: mesti bermula dengan "${a.prefix}"`:a.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${a.suffix}"`:a.format==="includes"?`String tidak sah: mesti mengandungi "${a.includes}"`:a.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${a.pattern}`:`${r[a.format]??i.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${i.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${I(i.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${i.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${i.origin}`;default:return"Input tidak sah"}}};function aA(){return{localeError:T2()}}var C2=()=>{let e={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}};function t(i){return e[i]??null}let r={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"},n={nan:"NaN",number:"getal"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`Ongeldige invoer: verwacht instanceof ${i.expected}, ontving ${s}`:`Ongeldige invoer: verwacht ${a}, ontving ${s}`}case"invalid_value":return i.values.length===1?`Ongeldige invoer: verwacht ${R(i.values[0])}`:`Ongeldige optie: verwacht \xE9\xE9n van ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin),s=i.origin==="date"?"laat":i.origin==="string"?"lang":"groot";return o?`Te ${s}: verwacht dat ${i.origin??"waarde"} ${a}${i.maximum.toString()} ${o.unit??"elementen"} ${o.verb}`:`Te ${s}: verwacht dat ${i.origin??"waarde"} ${a}${i.maximum.toString()} is`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin),s=i.origin==="date"?"vroeg":i.origin==="string"?"kort":"klein";return o?`Te ${s}: verwacht dat ${i.origin} ${a}${i.minimum.toString()} ${o.unit} ${o.verb}`:`Te ${s}: verwacht dat ${i.origin} ${a}${i.minimum.toString()} is`}case"invalid_format":{let a=i;return a.format==="starts_with"?`Ongeldige tekst: moet met "${a.prefix}" beginnen`:a.format==="ends_with"?`Ongeldige tekst: moet op "${a.suffix}" eindigen`:a.format==="includes"?`Ongeldige tekst: moet "${a.includes}" bevatten`:a.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${a.pattern}`:`Ongeldig: ${r[a.format]??i.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${i.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${i.keys.length>1?"s":""}: ${I(i.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${i.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${i.origin}`;default:return"Ongeldige invoer"}}};function oA(){return{localeError:C2()}}var A2=()=>{let e={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"}};function t(i){return e[i]??null}let r={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},n={nan:"NaN",number:"tall",array:"liste"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`Ugyldig input: forventet instanceof ${i.expected}, fikk ${s}`:`Ugyldig input: forventet ${a}, fikk ${s}`}case"invalid_value":return i.values.length===1?`Ugyldig verdi: forventet ${R(i.values[0])}`:`Ugyldig valg: forventet en av ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`For stor(t): forventet ${i.origin??"value"} til \xE5 ha ${a}${i.maximum.toString()} ${o.unit??"elementer"}`:`For stor(t): forventet ${i.origin??"value"} til \xE5 ha ${a}${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`For lite(n): forventet ${i.origin} til \xE5 ha ${a}${i.minimum.toString()} ${o.unit}`:`For lite(n): forventet ${i.origin} til \xE5 ha ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`Ugyldig streng: m\xE5 starte med "${a.prefix}"`:a.format==="ends_with"?`Ugyldig streng: m\xE5 ende med "${a.suffix}"`:a.format==="includes"?`Ugyldig streng: m\xE5 inneholde "${a.includes}"`:a.format==="regex"?`Ugyldig streng: m\xE5 matche m\xF8nsteret ${a.pattern}`:`Ugyldig ${r[a.format]??i.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${i.divisor}`;case"unrecognized_keys":return`${i.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${I(i.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${i.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${i.origin}`;default:return"Ugyldig input"}}};function sA(){return{localeError:A2()}}var O2=()=>{let e={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function t(i){return e[i]??null}let r={regex:"giren",email:"epostag\xE2h",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"},n={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`F\xE2sit giren: umulan instanceof ${i.expected}, al\u0131nan ${s}`:`F\xE2sit giren: umulan ${a}, al\u0131nan ${s}`}case"invalid_value":return i.values.length===1?`F\xE2sit giren: umulan ${R(i.values[0])}`:`F\xE2sit tercih: m\xFBteberler ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`Fazla b\xFCy\xFCk: ${i.origin??"value"}, ${a}${i.maximum.toString()} ${o.unit??"elements"} sahip olmal\u0131yd\u0131.`:`Fazla b\xFCy\xFCk: ${i.origin??"value"}, ${a}${i.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`Fazla k\xFC\xE7\xFCk: ${i.origin}, ${a}${i.minimum.toString()} ${o.unit} sahip olmal\u0131yd\u0131.`:`Fazla k\xFC\xE7\xFCk: ${i.origin}, ${a}${i.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let a=i;return a.format==="starts_with"?`F\xE2sit metin: "${a.prefix}" ile ba\u015Flamal\u0131.`:a.format==="ends_with"?`F\xE2sit metin: "${a.suffix}" ile bitmeli.`:a.format==="includes"?`F\xE2sit metin: "${a.includes}" ihtiv\xE2 etmeli.`:a.format==="regex"?`F\xE2sit metin: ${a.pattern} nak\u015F\u0131na uymal\u0131.`:`F\xE2sit ${r[a.format]??i.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${i.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${i.keys.length>1?"s":""}: ${I(i.keys,", ")}`;case"invalid_key":return`${i.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${i.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}};function cA(){return{localeError:O2()}}var P2=()=>{let e={string:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},file:{unit:"\u0628\u0627\u06CC\u067C\u0633",verb:"\u0648\u0644\u0631\u064A"},array:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},set:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"}};function t(i){return e[i]??null}let r={regex:"\u0648\u0631\u0648\u062F\u064A",email:"\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",url:"\u06CC\u0648 \u0622\u0631 \u0627\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",date:"\u0646\u06D0\u067C\u0647",time:"\u0648\u062E\u062A",duration:"\u0645\u0648\u062F\u0647",ipv4:"\u062F IPv4 \u067E\u062A\u0647",ipv6:"\u062F IPv6 \u067E\u062A\u0647",cidrv4:"\u062F IPv4 \u0633\u0627\u062D\u0647",cidrv6:"\u062F IPv6 \u0633\u0627\u062D\u0647",base64:"base64-encoded \u0645\u062A\u0646",base64url:"base64url-encoded \u0645\u062A\u0646",json_string:"JSON \u0645\u062A\u0646",e164:"\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"},n={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0627\u0631\u06D0"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F instanceof ${i.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${s} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`:`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${a} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${s} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`}case"invalid_value":return i.values.length===1?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${R(i.values[0])} \u0648\u0627\u06CC`:`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${I(i.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${i.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${a}${i.maximum.toString()} ${o.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${i.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${a}${i.maximum.toString()} \u0648\u064A`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${i.origin} \u0628\u0627\u06CC\u062F ${a}${i.minimum.toString()} ${o.unit} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${i.origin} \u0628\u0627\u06CC\u062F ${a}${i.minimum.toString()} \u0648\u064A`}case"invalid_format":{let a=i;return a.format==="starts_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${a.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`:a.format==="ends_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${a.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`:a.format==="includes"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${a.includes}" \u0648\u0644\u0631\u064A`:a.format==="regex"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${a.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`:`${r[a.format]??i.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${i.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${i.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${I(i.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${i.origin} \u06A9\u06D0`;case"invalid_union":return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A";case"invalid_element":return`\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${i.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}};function lA(){return{localeError:P2()}}var N2=()=>{let e={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"}};function t(i){return e[i]??null}let r={regex:"wyra\u017Cenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wej\u015Bcie"},n={nan:"NaN",number:"liczba",array:"tablica"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano instanceof ${i.expected}, otrzymano ${s}`:`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${a}, otrzymano ${s}`}case"invalid_value":return i.values.length===1?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${R(i.values[0])}`:`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${i.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${a}${i.maximum.toString()} ${o.unit??"element\xF3w"}`:`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${i.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${a}${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${i.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${a}${i.minimum.toString()} ${o.unit??"element\xF3w"}`:`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${i.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${a.prefix}"`:a.format==="ends_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${a.suffix}"`:a.format==="includes"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${a.includes}"`:a.format==="regex"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${a.pattern}`:`Nieprawid\u0142ow(y/a/e) ${r[a.format]??i.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${i.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${i.keys.length>1?"s":""}: ${I(i.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${i.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${i.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}};function uA(){return{localeError:N2()}}var R2=()=>{let e={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function t(i){return e[i]??null}let r={regex:"padr\xE3o",email:"endere\xE7o de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"dura\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},n={nan:"NaN",number:"n\xFAmero",null:"nulo"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`Tipo inv\xE1lido: esperado instanceof ${i.expected}, recebido ${s}`:`Tipo inv\xE1lido: esperado ${a}, recebido ${s}`}case"invalid_value":return i.values.length===1?`Entrada inv\xE1lida: esperado ${R(i.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperada uma das ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`Muito grande: esperado que ${i.origin??"valor"} tivesse ${a}${i.maximum.toString()} ${o.unit??"elementos"}`:`Muito grande: esperado que ${i.origin??"valor"} fosse ${a}${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`Muito pequeno: esperado que ${i.origin} tivesse ${a}${i.minimum.toString()} ${o.unit}`:`Muito pequeno: esperado que ${i.origin} fosse ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`Texto inv\xE1lido: deve come\xE7ar com "${a.prefix}"`:a.format==="ends_with"?`Texto inv\xE1lido: deve terminar com "${a.suffix}"`:a.format==="includes"?`Texto inv\xE1lido: deve incluir "${a.includes}"`:a.format==="regex"?`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${a.pattern}`:`${r[a.format]??i.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${i.divisor}`;case"unrecognized_keys":return`Chave${i.keys.length>1?"s":""} desconhecida${i.keys.length>1?"s":""}: ${I(i.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${i.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${i.origin}`;default:return"Campo inv\xE1lido"}}};function dA(){return{localeError:R2()}}var M2=()=>{let e={string:{unit:"caractere",verb:"s\u0103 aib\u0103"},file:{unit:"octe\u021Bi",verb:"s\u0103 aib\u0103"},array:{unit:"elemente",verb:"s\u0103 aib\u0103"},set:{unit:"elemente",verb:"s\u0103 aib\u0103"},map:{unit:"intr\u0103ri",verb:"s\u0103 aib\u0103"}};function t(i){return e[i]??null}let r={regex:"intrare",email:"adres\u0103 de email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"dat\u0103 \u0219i or\u0103 ISO",date:"dat\u0103 ISO",time:"or\u0103 ISO",duration:"durat\u0103 ISO",ipv4:"adres\u0103 IPv4",ipv6:"adres\u0103 IPv6",mac:"adres\u0103 MAC",cidrv4:"interval IPv4",cidrv6:"interval IPv6",base64:"\u0219ir codat base64",base64url:"\u0219ir codat base64url",json_string:"\u0219ir JSON",e164:"num\u0103r E.164",jwt:"JWT",template_literal:"intrare"},n={nan:"NaN",string:"\u0219ir",number:"num\u0103r",boolean:"boolean",function:"func\u021Bie",array:"matrice",object:"obiect",undefined:"nedefinit",symbol:"simbol",bigint:"num\u0103r mare",void:"void",never:"never",map:"hart\u0103",set:"set"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return`Intrare invalid\u0103: a\u0219teptat ${a}, primit ${s}`}case"invalid_value":return i.values.length===1?`Intrare invalid\u0103: a\u0219teptat ${R(i.values[0])}`:`Op\u021Biune invalid\u0103: a\u0219teptat una dintre ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`Prea mare: a\u0219teptat ca ${i.origin??"valoarea"} ${o.verb} ${a}${i.maximum.toString()} ${o.unit??"elemente"}`:`Prea mare: a\u0219teptat ca ${i.origin??"valoarea"} s\u0103 fie ${a}${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`Prea mic: a\u0219teptat ca ${i.origin} ${o.verb} ${a}${i.minimum.toString()} ${o.unit}`:`Prea mic: a\u0219teptat ca ${i.origin} s\u0103 fie ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`\u0218ir invalid: trebuie s\u0103 \xEEnceap\u0103 cu "${a.prefix}"`:a.format==="ends_with"?`\u0218ir invalid: trebuie s\u0103 se termine cu "${a.suffix}"`:a.format==="includes"?`\u0218ir invalid: trebuie s\u0103 includ\u0103 "${a.includes}"`:a.format==="regex"?`\u0218ir invalid: trebuie s\u0103 se potriveasc\u0103 cu modelul ${a.pattern}`:`Format invalid: ${r[a.format]??i.format}`}case"not_multiple_of":return`Num\u0103r invalid: trebuie s\u0103 fie multiplu de ${i.divisor}`;case"unrecognized_keys":return`Chei nerecunoscute: ${I(i.keys,", ")}`;case"invalid_key":return`Cheie invalid\u0103 \xEEn ${i.origin}`;case"invalid_union":return"Intrare invalid\u0103";case"invalid_element":return`Valoare invalid\u0103 \xEEn ${i.origin}`;default:return"Intrare invalid\u0103"}}};function fA(){return{localeError:M2()}}function pA(e,t,r,n){let i=Math.abs(e),a=i%10,o=i%100;return o>=11&&o<=19?n:a===1?t:a>=2&&a<=4?r:n}var j2=()=>{let e={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function t(i){return e[i]??null}let r={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"},n={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0441\u0438\u0432"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C instanceof ${i.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${s}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${a}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${s}`}case"invalid_value":return i.values.length===1?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${R(i.values[0])}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);if(o){let s=Number(i.maximum),c=pA(s,o.unit.one,o.unit.few,o.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${i.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${a}${i.maximum.toString()} ${c}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${i.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${a}${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);if(o){let s=Number(i.minimum),c=pA(s,o.unit.one,o.unit.few,o.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${i.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${a}${i.minimum.toString()} ${c}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${i.origin} \u0431\u0443\u0434\u0435\u0442 ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${a.prefix}"`:a.format==="ends_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${a.suffix}"`:a.format==="includes"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${a.includes}"`:a.format==="regex"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${a.pattern}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${r[a.format]??i.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${i.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${i.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${i.keys.length>1?"\u0438":""}: ${I(i.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${i.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${i.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}};function mA(){return{localeError:j2()}}var D2=()=>{let e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function t(i){return e[i]??null}let r={regex:"vnos",email:"e-po\u0161tni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",jwt:"JWT",template_literal:"vnos"},n={nan:"NaN",number:"\u0161tevilo",array:"tabela"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`Neveljaven vnos: pri\u010Dakovano instanceof ${i.expected}, prejeto ${s}`:`Neveljaven vnos: pri\u010Dakovano ${a}, prejeto ${s}`}case"invalid_value":return i.values.length===1?`Neveljaven vnos: pri\u010Dakovano ${R(i.values[0])}`:`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`Preveliko: pri\u010Dakovano, da bo ${i.origin??"vrednost"} imelo ${a}${i.maximum.toString()} ${o.unit??"elementov"}`:`Preveliko: pri\u010Dakovano, da bo ${i.origin??"vrednost"} ${a}${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`Premajhno: pri\u010Dakovano, da bo ${i.origin} imelo ${a}${i.minimum.toString()} ${o.unit}`:`Premajhno: pri\u010Dakovano, da bo ${i.origin} ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`Neveljaven niz: mora se za\u010Deti z "${a.prefix}"`:a.format==="ends_with"?`Neveljaven niz: mora se kon\u010Dati z "${a.suffix}"`:a.format==="includes"?`Neveljaven niz: mora vsebovati "${a.includes}"`:a.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${a.pattern}`:`Neveljaven ${r[a.format]??i.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${i.divisor}`;case"unrecognized_keys":return`Neprepoznan${i.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${I(i.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${i.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${i.origin}`;default:return"Neveljaven vnos"}}};function hA(){return{localeError:D2()}}var z2=()=>{let e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"}};function t(i){return e[i]??null}let r={regex:"regulj\xE4rt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},n={nan:"NaN",number:"antal",array:"lista"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`Ogiltig inmatning: f\xF6rv\xE4ntat instanceof ${i.expected}, fick ${s}`:`Ogiltig inmatning: f\xF6rv\xE4ntat ${a}, fick ${s}`}case"invalid_value":return i.values.length===1?`Ogiltig inmatning: f\xF6rv\xE4ntat ${R(i.values[0])}`:`Ogiltigt val: f\xF6rv\xE4ntade en av ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`F\xF6r stor(t): f\xF6rv\xE4ntade ${i.origin??"v\xE4rdet"} att ha ${a}${i.maximum.toString()} ${o.unit??"element"}`:`F\xF6r stor(t): f\xF6rv\xE4ntat ${i.origin??"v\xE4rdet"} att ha ${a}${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`F\xF6r lite(t): f\xF6rv\xE4ntade ${i.origin??"v\xE4rdet"} att ha ${a}${i.minimum.toString()} ${o.unit}`:`F\xF6r lite(t): f\xF6rv\xE4ntade ${i.origin??"v\xE4rdet"} att ha ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${a.prefix}"`:a.format==="ends_with"?`Ogiltig str\xE4ng: m\xE5ste sluta med "${a.suffix}"`:a.format==="includes"?`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${a.includes}"`:a.format==="regex"?`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${a.pattern}"`:`Ogiltig(t) ${r[a.format]??i.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${i.divisor}`;case"unrecognized_keys":return`${i.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${I(i.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${i.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${i.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}};function gA(){return{localeError:z2()}}var U2=()=>{let e={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function t(i){return e[i]??null}let r={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",jwt:"JWT",template_literal:"input"},n={nan:"NaN",number:"\u0B8E\u0BA3\u0BCD",array:"\u0B85\u0BA3\u0BBF",null:"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 instanceof ${i.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${s}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${a}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${s}`}case"invalid_value":return i.values.length===1?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${R(i.values[0])}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${I(i.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${i.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${a}${i.maximum.toString()} ${o.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${i.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${a}${i.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${i.origin} ${a}${i.minimum.toString()} ${o.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${i.origin} ${a}${i.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let a=i;return a.format==="starts_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${a.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:a.format==="ends_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${a.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:a.format==="includes"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${a.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:a.format==="regex"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${a.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${r[a.format]??i.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${i.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${i.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${I(i.keys,", ")}`;case"invalid_key":return`${i.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${i.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}};function _A(){return{localeError:U2()}}var L2=()=>{let e={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function t(i){return e[i]??null}let r={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"},n={nan:"NaN",number:"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02",array:"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)",null:"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 instanceof ${i.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${s}`:`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${a} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${s}`}case"invalid_value":return i.values.length===1?`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${R(i.values[0])}`:`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",o=t(i.origin);return o?`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${i.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${a} ${i.maximum.toString()} ${o.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`:`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${i.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${a} ${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",o=t(i.origin);return o?`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${i.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${a} ${i.minimum.toString()} ${o.unit}`:`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${i.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${a} ${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${a.prefix}"`:a.format==="ends_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${a.suffix}"`:a.format==="includes"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${a.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`:a.format==="regex"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${a.pattern}`:`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${r[a.format]??i.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${i.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${I(i.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${i.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${i.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}};function yA(){return{localeError:L2()}}var F2=()=>{let e={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function t(i){return e[i]??null}let r={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"\u015Eablon dizesi"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`Ge\xE7ersiz de\u011Fer: beklenen instanceof ${i.expected}, al\u0131nan ${s}`:`Ge\xE7ersiz de\u011Fer: beklenen ${a}, al\u0131nan ${s}`}case"invalid_value":return i.values.length===1?`Ge\xE7ersiz de\u011Fer: beklenen ${R(i.values[0])}`:`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`\xC7ok b\xFCy\xFCk: beklenen ${i.origin??"de\u011Fer"} ${a}${i.maximum.toString()} ${o.unit??"\xF6\u011Fe"}`:`\xC7ok b\xFCy\xFCk: beklenen ${i.origin??"de\u011Fer"} ${a}${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`\xC7ok k\xFC\xE7\xFCk: beklenen ${i.origin} ${a}${i.minimum.toString()} ${o.unit}`:`\xC7ok k\xFC\xE7\xFCk: beklenen ${i.origin} ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`Ge\xE7ersiz metin: "${a.prefix}" ile ba\u015Flamal\u0131`:a.format==="ends_with"?`Ge\xE7ersiz metin: "${a.suffix}" ile bitmeli`:a.format==="includes"?`Ge\xE7ersiz metin: "${a.includes}" i\xE7ermeli`:a.format==="regex"?`Ge\xE7ersiz metin: ${a.pattern} desenine uymal\u0131`:`Ge\xE7ersiz ${r[a.format]??i.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${i.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${i.keys.length>1?"lar":""}: ${I(i.keys,", ")}`;case"invalid_key":return`${i.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${i.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}};function vA(){return{localeError:F2()}}var B2=()=>{let e={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function t(i){return e[i]??null}let r={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"},n={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F instanceof ${i.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${s}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${a}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${s}`}case"invalid_value":return i.values.length===1?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${R(i.values[0])}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${i.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${o.verb} ${a}${i.maximum.toString()} ${o.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${i.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${a}${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${i.origin} ${o.verb} ${a}${i.minimum.toString()} ${o.unit}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${i.origin} \u0431\u0443\u0434\u0435 ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${a.prefix}"`:a.format==="ends_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${a.suffix}"`:a.format==="includes"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${a.includes}"`:a.format==="regex"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${a.pattern}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${r[a.format]??i.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${i.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${i.keys.length>1?"\u0456":""}: ${I(i.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${i.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${i.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}};function Wf(){return{localeError:B2()}}function bA(){return Wf()}var V2=()=>{let e={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function t(i){return e[i]??null}let r={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"},n={nan:"NaN",number:"\u0646\u0645\u0628\u0631",array:"\u0622\u0631\u06D2",null:"\u0646\u0644"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: instanceof ${i.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${s} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`:`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${a} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${s} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`}case"invalid_value":return i.values.length===1?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${R(i.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`:`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${I(i.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`\u0628\u06C1\u062A \u0628\u0691\u0627: ${i.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${a}${i.maximum.toString()} ${o.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0628\u0691\u0627: ${i.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${a}${i.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${i.origin} \u06A9\u06D2 ${a}${i.minimum.toString()} ${o.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${i.origin} \u06A9\u0627 ${a}${i.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let a=i;return a.format==="starts_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${a.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:a.format==="ends_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${a.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:a.format==="includes"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${a.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:a.format==="regex"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${a.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:`\u063A\u0644\u0637 ${r[a.format]??i.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${i.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${i.keys.length>1?"\u0632":""}: ${I(i.keys,"\u060C ")}`;case"invalid_key":return`${i.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${i.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}};function wA(){return{localeError:V2()}}var Z2=()=>{let e={string:{unit:"belgi",verb:"bo\u2018lishi kerak"},file:{unit:"bayt",verb:"bo\u2018lishi kerak"},array:{unit:"element",verb:"bo\u2018lishi kerak"},set:{unit:"element",verb:"bo\u2018lishi kerak"},map:{unit:"yozuv",verb:"bo\u2018lishi kerak"}};function t(i){return e[i]??null}let r={regex:"kirish",email:"elektron pochta manzili",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",jwt:"JWT",template_literal:"kirish"},n={nan:"NaN",number:"raqam",array:"massiv"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`Noto\u2018g\u2018ri kirish: kutilgan instanceof ${i.expected}, qabul qilingan ${s}`:`Noto\u2018g\u2018ri kirish: kutilgan ${a}, qabul qilingan ${s}`}case"invalid_value":return i.values.length===1?`Noto\u2018g\u2018ri kirish: kutilgan ${R(i.values[0])}`:`Noto\u2018g\u2018ri variant: quyidagilardan biri kutilgan ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`Juda katta: kutilgan ${i.origin??"qiymat"} ${a}${i.maximum.toString()} ${o.unit} ${o.verb}`:`Juda katta: kutilgan ${i.origin??"qiymat"} ${a}${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`Juda kichik: kutilgan ${i.origin} ${a}${i.minimum.toString()} ${o.unit} ${o.verb}`:`Juda kichik: kutilgan ${i.origin} ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`Noto\u2018g\u2018ri satr: "${a.prefix}" bilan boshlanishi kerak`:a.format==="ends_with"?`Noto\u2018g\u2018ri satr: "${a.suffix}" bilan tugashi kerak`:a.format==="includes"?`Noto\u2018g\u2018ri satr: "${a.includes}" ni o\u2018z ichiga olishi kerak`:a.format==="regex"?`Noto\u2018g\u2018ri satr: ${a.pattern} shabloniga mos kelishi kerak`:`Noto\u2018g\u2018ri ${r[a.format]??i.format}`}case"not_multiple_of":return`Noto\u2018g\u2018ri raqam: ${i.divisor} ning karralisi bo\u2018lishi kerak`;case"unrecognized_keys":return`Noma\u2019lum kalit${i.keys.length>1?"lar":""}: ${I(i.keys,", ")}`;case"invalid_key":return`${i.origin} dagi kalit noto\u2018g\u2018ri`;case"invalid_union":return"Noto\u2018g\u2018ri kirish";case"invalid_element":return`${i.origin} da noto\u2018g\u2018ri qiymat`;default:return"Noto\u2018g\u2018ri kirish"}}};function xA(){return{localeError:Z2()}}var H2=()=>{let e={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function t(i){return e[i]??null}let r={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"},n={nan:"NaN",number:"s\u1ED1",array:"m\u1EA3ng"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i instanceof ${i.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${s}`:`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${a}, nh\u1EADn \u0111\u01B0\u1EE3c ${s}`}case"invalid_value":return i.values.length===1?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${R(i.values[0])}`:`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${i.origin??"gi\xE1 tr\u1ECB"} ${o.verb} ${a}${i.maximum.toString()} ${o.unit??"ph\u1EA7n t\u1EED"}`:`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${i.origin??"gi\xE1 tr\u1ECB"} ${a}${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${i.origin} ${o.verb} ${a}${i.minimum.toString()} ${o.unit}`:`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${i.origin} ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${a.prefix}"`:a.format==="ends_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${a.suffix}"`:a.format==="includes"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${a.includes}"`:a.format==="regex"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${a.pattern}`:`${r[a.format]??i.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${i.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${I(i.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${i.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${i.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}};function SA(){return{localeError:H2()}}var G2=()=>{let e={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"}};function t(i){return e[i]??null}let r={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",jwt:"JWT",template_literal:"\u8F93\u5165"},n={nan:"NaN",number:"\u6570\u5B57",array:"\u6570\u7EC4",null:"\u7A7A\u503C(null)"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B instanceof ${i.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${s}`:`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${a}\uFF0C\u5B9E\u9645\u63A5\u6536 ${s}`}case"invalid_value":return i.values.length===1?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${R(i.values[0])}`:`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${i.origin??"\u503C"} ${a}${i.maximum.toString()} ${o.unit??"\u4E2A\u5143\u7D20"}`:`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${i.origin??"\u503C"} ${a}${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${i.origin} ${a}${i.minimum.toString()} ${o.unit}`:`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${i.origin} ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${a.prefix}" \u5F00\u5934`:a.format==="ends_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${a.suffix}" \u7ED3\u5C3E`:a.format==="includes"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${a.includes}"`:a.format==="regex"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${a.pattern}`:`\u65E0\u6548${r[a.format]??i.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${i.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${I(i.keys,", ")}`;case"invalid_key":return`${i.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${i.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}};function kA(){return{localeError:G2()}}var W2=()=>{let e={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function t(i){return e[i]??null}let r={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",jwt:"JWT",template_literal:"\u8F38\u5165"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA instanceof ${i.expected}\uFF0C\u4F46\u6536\u5230 ${s}`:`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${a}\uFF0C\u4F46\u6536\u5230 ${s}`}case"invalid_value":return i.values.length===1?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${R(i.values[0])}`:`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${i.origin??"\u503C"} \u61C9\u70BA ${a}${i.maximum.toString()} ${o.unit??"\u500B\u5143\u7D20"}`:`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${i.origin??"\u503C"} \u61C9\u70BA ${a}${i.maximum.toString()}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${i.origin} \u61C9\u70BA ${a}${i.minimum.toString()} ${o.unit}`:`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${i.origin} \u61C9\u70BA ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${a.prefix}" \u958B\u982D`:a.format==="ends_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${a.suffix}" \u7D50\u5C3E`:a.format==="includes"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${a.includes}"`:a.format==="regex"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${a.pattern}`:`\u7121\u6548\u7684 ${r[a.format]??i.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${i.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${i.keys.length>1?"\u5011":""}\uFF1A${I(i.keys,"\u3001")}`;case"invalid_key":return`${i.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${i.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}};function EA(){return{localeError:W2()}}var J2=()=>{let e={string:{unit:"\xE0mi",verb:"n\xED"},file:{unit:"bytes",verb:"n\xED"},array:{unit:"nkan",verb:"n\xED"},set:{unit:"nkan",verb:"n\xED"}};function t(i){return e[i]??null}let r={regex:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9",email:"\xE0d\xEDr\u1EB9\u0301s\xEC \xECm\u1EB9\u0301l\xEC",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\xE0k\xF3k\xF2 ISO",date:"\u1ECDj\u1ECD\u0301 ISO",time:"\xE0k\xF3k\xF2 ISO",duration:"\xE0k\xF3k\xF2 t\xF3 p\xE9 ISO",ipv4:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv4",ipv6:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv6",cidrv4:"\xE0gb\xE8gb\xE8 IPv4",cidrv6:"\xE0gb\xE8gb\xE8 IPv6",base64:"\u1ECD\u0300r\u1ECD\u0300 t\xED a k\u1ECD\u0301 n\xED base64",base64url:"\u1ECD\u0300r\u1ECD\u0300 base64url",json_string:"\u1ECD\u0300r\u1ECD\u0300 JSON",e164:"n\u1ECD\u0301mb\xE0 E.164",jwt:"JWT",template_literal:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9"},n={nan:"NaN",number:"n\u1ECD\u0301mb\xE0",array:"akop\u1ECD"};return i=>{switch(i.code){case"invalid_type":{let a=n[i.expected]??i.expected,o=M(i.input),s=n[o]??o;return/^[A-Z]/.test(i.expected)?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi instanceof ${i.expected}, \xE0m\u1ECD\u0300 a r\xED ${s}`:`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${a}, \xE0m\u1ECD\u0300 a r\xED ${s}`}case"invalid_value":return i.values.length===1?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${R(i.values[0])}`:`\xC0\u1E63\xE0y\xE0n a\u1E63\xEC\u1E63e: yan \u1ECD\u0300kan l\xE1ra ${I(i.values,"|")}`;case"too_big":{let a=i.inclusive?"<=":"<",o=t(i.origin);return o?`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${i.origin??"iye"} ${o.verb} ${a}${i.maximum} ${o.unit}`:`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 ${a}${i.maximum}`}case"too_small":{let a=i.inclusive?">=":">",o=t(i.origin);return o?`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${i.origin} ${o.verb} ${a}${i.minimum} ${o.unit}`:`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 ${a}${i.minimum}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\u1EB9\u0300r\u1EB9\u0300 p\u1EB9\u0300l\xFA "${a.prefix}"`:a.format==="ends_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 par\xED p\u1EB9\u0300l\xFA "${a.suffix}"`:a.format==="includes"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 n\xED "${a.includes}"`:a.format==="regex"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\xE1 \xE0p\u1EB9\u1EB9r\u1EB9 mu ${a.pattern}`:`A\u1E63\xEC\u1E63e: ${r[a.format]??i.format}`}case"not_multiple_of":return`N\u1ECD\u0301mb\xE0 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 j\u1EB9\u0301 \xE8y\xE0 p\xEDp\xEDn ti ${i.divisor}`;case"unrecognized_keys":return`B\u1ECDt\xECn\xEC \xE0\xECm\u1ECD\u0300: ${I(i.keys,", ")}`;case"invalid_key":return`B\u1ECDt\xECn\xEC a\u1E63\xEC\u1E63e n\xEDn\xFA ${i.origin}`;case"invalid_union":return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e";case"invalid_element":return`Iye a\u1E63\xEC\u1E63e n\xEDn\xFA ${i.origin}`;default:return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e"}}};function $A(){return{localeError:J2()}}var IA,Yv=Symbol("ZodOutput"),Xv=Symbol("ZodInput"),Jf=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let i={...n,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Kf(){return new Jf}(IA=globalThis).__zod_globalRegistry??(IA.__zod_globalRegistry=Kf());var De=globalThis.__zod_globalRegistry;function Qv(e,t){return new e({type:"string",...U(t)})}function eb(e,t){return new e({type:"string",coerce:!0,...U(t)})}function qf(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...U(t)})}function Nl(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...U(t)})}function Yf(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...U(t)})}function Xf(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...U(t)})}function Qf(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...U(t)})}function ep(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...U(t)})}function Rl(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...U(t)})}function tp(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...U(t)})}function rp(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...U(t)})}function np(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...U(t)})}function ip(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...U(t)})}function ap(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...U(t)})}function op(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...U(t)})}function sp(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...U(t)})}function cp(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...U(t)})}function lp(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...U(t)})}function tb(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...U(t)})}function up(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...U(t)})}function dp(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...U(t)})}function fp(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...U(t)})}function pp(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...U(t)})}function mp(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...U(t)})}function hp(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...U(t)})}var rb={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function nb(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...U(t)})}function ib(e,t){return new e({type:"string",format:"date",check:"string_format",...U(t)})}function ab(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...U(t)})}function ob(e,t){return new e({type:"string",format:"duration",check:"string_format",...U(t)})}function sb(e,t){return new e({type:"number",checks:[],...U(t)})}function cb(e,t){return new e({type:"number",coerce:!0,checks:[],...U(t)})}function lb(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...U(t)})}function ub(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...U(t)})}function db(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...U(t)})}function fb(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...U(t)})}function pb(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...U(t)})}function mb(e,t){return new e({type:"boolean",...U(t)})}function hb(e,t){return new e({type:"boolean",coerce:!0,...U(t)})}function gb(e,t){return new e({type:"bigint",...U(t)})}function _b(e,t){return new e({type:"bigint",coerce:!0,...U(t)})}function yb(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...U(t)})}function vb(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...U(t)})}function bb(e,t){return new e({type:"symbol",...U(t)})}function wb(e,t){return new e({type:"undefined",...U(t)})}function xb(e,t){return new e({type:"null",...U(t)})}function Sb(e){return new e({type:"any"})}function Ml(e){return new e({type:"unknown"})}function jl(e,t){return new e({type:"never",...U(t)})}function kb(e,t){return new e({type:"void",...U(t)})}function Eb(e,t){return new e({type:"date",...U(t)})}function $b(e,t){return new e({type:"date",coerce:!0,...U(t)})}function Ib(e,t){return new e({type:"nan",...U(t)})}function Zn(e,t){return new Mf({check:"less_than",...U(t),value:e,inclusive:!1})}function zr(e,t){return new Mf({check:"less_than",...U(t),value:e,inclusive:!0})}function Hn(e,t){return new jf({check:"greater_than",...U(t),value:e,inclusive:!1})}function dr(e,t){return new jf({check:"greater_than",...U(t),value:e,inclusive:!0})}function gp(e){return Hn(0,e)}function _p(e){return Zn(0,e)}function yp(e){return zr(0,e)}function vp(e){return dr(0,e)}function va(e,t){return new ky({check:"multiple_of",...U(t),value:e})}function ba(e,t){return new Iy({check:"max_size",...U(t),maximum:e})}function Gn(e,t){return new Ty({check:"min_size",...U(t),minimum:e})}function wo(e,t){return new Cy({check:"size_equals",...U(t),size:e})}function xo(e,t){return new Ay({check:"max_length",...U(t),maximum:e})}function Si(e,t){return new Oy({check:"min_length",...U(t),minimum:e})}function So(e,t){return new Py({check:"length_equals",...U(t),length:e})}function Ns(e,t){return new Ny({check:"string_format",format:"regex",...U(t),pattern:e})}function Rs(e){return new Ry({check:"string_format",format:"lowercase",...U(e)})}function Ms(e){return new My({check:"string_format",format:"uppercase",...U(e)})}function js(e,t){return new jy({check:"string_format",format:"includes",...U(t),includes:e})}function Ds(e,t){return new Dy({check:"string_format",format:"starts_with",...U(t),prefix:e})}function zs(e,t){return new zy({check:"string_format",format:"ends_with",...U(t),suffix:e})}function bp(e,t,r){return new Uy({check:"property",property:e,schema:t,...U(r)})}function Us(e,t){return new Ly({check:"mime_type",mime:e,...U(t)})}function hn(e){return new Fy({check:"overwrite",tx:e})}function Ls(e){return hn(t=>t.normalize(e))}function Fs(){return hn(e=>e.trim())}function Bs(){return hn(e=>e.toLowerCase())}function Vs(){return hn(e=>e.toUpperCase())}function Zs(){return hn(e=>D_(e))}function Tb(e,t,r){return new e({type:"array",element:t,...U(r)})}function q2(e,t,r){return new e({type:"union",options:t,...U(r)})}function Y2(e,t,r){return new e({type:"union",options:t,inclusive:!1,...U(r)})}function X2(e,t,r,n){return new e({type:"union",options:r,discriminator:t,...U(n)})}function Q2(e,t,r){return new e({type:"intersection",left:t,right:r})}function eL(e,t,r,n){let i=r instanceof pe,a=i?n:r,o=i?r:null;return new e({type:"tuple",items:t,rest:o,...U(a)})}function tL(e,t,r,n){return new e({type:"record",keyType:t,valueType:r,...U(n)})}function rL(e,t,r,n){return new e({type:"map",keyType:t,valueType:r,...U(n)})}function nL(e,t,r){return new e({type:"set",valueType:t,...U(r)})}function iL(e,t,r){let n=Array.isArray(t)?Object.fromEntries(t.map(i=>[i,i])):t;return new e({type:"enum",entries:n,...U(r)})}function aL(e,t,r){return new e({type:"enum",entries:t,...U(r)})}function oL(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],...U(r)})}function Cb(e,t){return new e({type:"file",...U(t)})}function sL(e,t){return new e({type:"transform",transform:t})}function cL(e,t){return new e({type:"optional",innerType:t})}function lL(e,t){return new e({type:"nullable",innerType:t})}function uL(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r=="function"?r():U_(r)}})}function dL(e,t,r){return new e({type:"nonoptional",innerType:t,...U(r)})}function fL(e,t){return new e({type:"success",innerType:t})}function pL(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r=="function"?r:()=>r})}function mL(e,t,r){return new e({type:"pipe",in:t,out:r})}function hL(e,t){return new e({type:"readonly",innerType:t})}function gL(e,t,r){return new e({type:"template_literal",parts:t,...U(r)})}function _L(e,t){return new e({type:"lazy",getter:t})}function yL(e,t){return new e({type:"promise",innerType:t})}function Ab(e,t,r){let n=U(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function Ob(e,t,r){return new e({type:"custom",check:"custom",fn:t,...U(r)})}function Pb(e,t){let r=TA(n=>(n.addIssue=i=>{if(typeof i=="string")n.issues.push($s(i,n.value,r._zod.def));else{let a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=n.value),a.inst??(a.inst=r),a.continue??(a.continue=!r._zod.def.abort),n.issues.push($s(a))}},e(n.value,n)),t);return r}function TA(e,t){let r=new Ze({check:"custom",...U(t)});return r._zod.check=e,r}function Nb(e){let t=new Ze({check:"describe"});return t._zod.onattach=[r=>{let n=De.get(r)??{};De.add(r,{...n,description:e})}],t._zod.check=()=>{},t}function Rb(e){let t=new Ze({check:"meta"});return t._zod.onattach=[r=>{let n=De.get(r)??{};De.add(r,{...n,...e})}],t._zod.check=()=>{},t}function Mb(e,t){let r=U(t),n=r.truthy??["true","1","yes","on","y","enabled"],i=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(p=>typeof p=="string"?p.toLowerCase():p),i=i.map(p=>typeof p=="string"?p.toLowerCase():p));let a=new Set(n),o=new Set(i),s=e.Codec??Al,c=e.Boolean??$l,l=e.String??vo,u=new l({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),f=new s({type:"pipe",in:u,out:d,transform:((p,m)=>{let h=p;return r.case!=="sensitive"&&(h=h.toLowerCase()),a.has(h)?!0:o.has(h)?!1:(m.issues.push({code:"invalid_value",expected:"stringbool",values:[...a,...o],input:m.value,inst:f,continue:!1}),{})}),reverseTransform:((p,m)=>p===!0?n[0]||"true":i[0]||"false"),error:r.error});return f}function Hs(e,t,r,n={}){let i=U(n),a={...U(n),check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:s=>r.test(s),...i};return r instanceof RegExp&&(a.pattern=r),new e(a)}function wa(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??De,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function ze(e,t,r={path:[],schemaPath:[]}){var n;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,r.schemaPath.includes(e)&&(a.cycle=r.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let u={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,u);else{let f=o.schema,p=t.processors[i.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);p(e,t,f,u)}let d=e._zod.parent;d&&(o.ref||(o.ref=d),ze(d,t,u),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io==="input"&&fr(e)&&(delete o.schema.examples,delete o.schema.default),t.io==="input"&&"_prefault"in o.schema&&((n=o.schema).default??(n.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function xa(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let o of e.seen.entries()){let s=e.metadataRegistry.get(o[0])?.id;if(s){let c=n.get(s);if(c&&c!==o[0])throw new Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(s,o[0])}}let i=o=>{let s=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(o[0])?.id,f=e.external.uri??(m=>m);if(d)return{ref:f(d)};let p=o[1].defId??o[1].schema.id??`schema${e.counter++}`;return o[1].defId=p,{defId:p,ref:`${f("__shared")}#/${s}/${p}`}}if(o[1]===r)return{ref:"#"};let l=`#/${s}/`,u=o[1].schema.id??`__schema${e.counter++}`;return{defId:u,ref:l+u}},a=o=>{if(o[1].schema.$ref)return;let s=o[1],{ref:c,defId:l}=i(o);s.def={...s.schema},l&&(s.defId=l);let u=s.schema;for(let d in u)delete u[d];u.$ref=c};if(e.cycles==="throw")for(let o of e.seen.entries()){let s=o[1];if(s.cycle)throw new Error(`Cycle detected: #/${s.cycle?.join("/")}/<root>
217
+
218
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let o of e.seen.entries()){let s=o[1];if(t===o[0]){a(o);continue}if(e.external){let l=e.external.registry.get(o[0])?.id;if(t!==o[0]&&l){a(o);continue}}if(e.metadataRegistry.get(o[0])?.id){a(o);continue}if(s.cycle){a(o);continue}if(s.count>1&&e.reused==="ref"){a(o);continue}}}function Sa(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=s=>{let c=e.seen.get(s);if(c.ref===null)return;let l=c.def??c.schema,u={...l},d=c.ref;if(c.ref=null,d){n(d);let p=e.seen.get(d),m=p.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(m)):Object.assign(l,m),Object.assign(l,u),s._zod.parent===d)for(let _ in l)_==="$ref"||_==="allOf"||_ in u||delete l[_];if(m.$ref&&p.def)for(let _ in l)_==="$ref"||_==="allOf"||_ in p.def&&JSON.stringify(l[_])===JSON.stringify(p.def[_])&&delete l[_]}let f=s._zod.parent;if(f&&f!==d){n(f);let p=e.seen.get(f);if(p?.schema.$ref&&(l.$ref=p.schema.$ref,p.def))for(let m in l)m==="$ref"||m==="allOf"||m in p.def&&JSON.stringify(l[m])===JSON.stringify(p.def[m])&&delete l[m]}e.override({zodSchema:s,jsonSchema:l,path:c.path??[]})};for(let s of[...e.seen.entries()].reverse())n(s[0]);let i={};if(e.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let s=e.external.registry.get(t)?.id;if(!s)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(s)}Object.assign(i,r.def??r.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let s of e.seen.entries()){let c=s[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,o[c.defId]=c.def)}e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?i.$defs=o:i.definitions=o);try{let s=JSON.parse(JSON.stringify(i));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:Gs(t,"input",e.processors),output:Gs(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch{throw new Error("Error converting schema to JSON.")}}function fr(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return fr(n.element,r);if(n.type==="set")return fr(n.valueType,r);if(n.type==="lazy")return fr(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return fr(n.innerType,r);if(n.type==="intersection")return fr(n.left,r)||fr(n.right,r);if(n.type==="record"||n.type==="map")return fr(n.keyType,r)||fr(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:fr(n.in,r)||fr(n.out,r);if(n.type==="object"){for(let i in n.shape)if(fr(n.shape[i],r))return!0;return!1}if(n.type==="union"){for(let i of n.options)if(fr(i,r))return!0;return!1}if(n.type==="tuple"){for(let i of n.items)if(fr(i,r))return!0;return!!(n.rest&&fr(n.rest,r))}return!1}var jb=(e,t={})=>r=>{let n=wa({...r,processors:t});return ze(e,n),xa(n,e),Sa(n,e)},Gs=(e,t,r={})=>n=>{let{libraryOptions:i,target:a}=n??{},o=wa({...i??{},target:a,io:t,processors:r});return ze(e,o),xa(o,e),Sa(o,e)};var vL={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Db=(e,t,r,n)=>{let i=r;i.type="string";let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a=="number"&&(i.minLength=a),typeof o=="number"&&(i.maxLength=o),s&&(i.format=vL[s]??s,i.format===""&&delete i.format,s==="time"&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let u=[...c];u.length===1?i.pattern=u[0].source:u.length>1&&(i.allOf=[...u.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},zb=(e,t,r,n)=>{let i=r,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s=="string"&&s.includes("int")?i.type="integer":i.type="number";let d=typeof u=="number"&&u>=(a??Number.NEGATIVE_INFINITY),f=typeof l=="number"&&l<=(o??Number.POSITIVE_INFINITY),p=t.target==="draft-04"||t.target==="openapi-3.0";d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a=="number"&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o=="number"&&(i.maximum=o),typeof c=="number"&&(i.multipleOf=c)},Ub=(e,t,r,n)=>{r.type="boolean"},Lb=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Fb=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},Bb=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Vb=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},Zb=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},Hb=(e,t,r,n)=>{r.not={}},Gb=(e,t,r,n)=>{},Wb=(e,t,r,n)=>{},Jb=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},Kb=(e,t,r,n)=>{let i=e._zod.def,a=hl(i.entries);a.every(o=>typeof o=="number")&&(r.type="number"),a.every(o=>typeof o=="string")&&(r.type="string"),r.enum=a},qb=(e,t,r,n)=>{let i=e._zod.def,a=[];for(let o of i.values)if(o===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof o=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");a.push(Number(o))}else a.push(o);if(a.length!==0)if(a.length===1){let o=a[0];r.type=o===null?"null":typeof o,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[o]:r.const=o}else a.every(o=>typeof o=="number")&&(r.type="number"),a.every(o=>typeof o=="string")&&(r.type="string"),a.every(o=>typeof o=="boolean")&&(r.type="boolean"),a.every(o=>o===null)&&(r.type="null"),r.enum=a},Yb=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},Xb=(e,t,r,n)=>{let i=r,a=e._zod.pattern;if(!a)throw new Error("Pattern not found in template literal");i.type="string",i.pattern=a.source},Qb=(e,t,r,n)=>{let i=r,a={type:"string",format:"binary",contentEncoding:"binary"},{minimum:o,maximum:s,mime:c}=e._zod.bag;o!==void 0&&(a.minLength=o),s!==void 0&&(a.maxLength=s),c?c.length===1?(a.contentMediaType=c[0],Object.assign(i,a)):(Object.assign(i,a),i.anyOf=c.map(l=>({contentMediaType:l}))):Object.assign(i,a)},ew=(e,t,r,n)=>{r.type="boolean"},tw=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},rw=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},nw=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},iw=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},aw=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},ow=(e,t,r,n)=>{let i=r,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o=="number"&&(i.minItems=o),typeof s=="number"&&(i.maxItems=s),i.type="array",i.items=ze(a.element,t,{...n,path:[...n.path,"items"]})},sw=(e,t,r,n)=>{let i=r,a=e._zod.def;i.type="object",i.properties={};let o=a.shape;for(let l in o)i.properties[l]=ze(o[l],t,{...n,path:[...n.path,"properties",l]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(l=>{let u=a.shape[l]._zod;return t.io==="input"?u.optin===void 0:u.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type==="never"?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=ze(a.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},xp=(e,t,r,n)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((s,c)=>ze(s,t,{...n,path:[...n.path,a?"oneOf":"anyOf",c]}));a?r.oneOf=o:r.anyOf=o},cw=(e,t,r,n)=>{let i=e._zod.def,a=ze(i.left,t,{...n,path:[...n.path,"allOf",0]}),o=ze(i.right,t,{...n,path:[...n.path,"allOf",1]}),s=l=>"allOf"in l&&Object.keys(l).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];r.allOf=c},lw=(e,t,r,n)=>{let i=r,a=e._zod.def;i.type="array";let o=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=a.items.map((f,p)=>ze(f,t,{...n,path:[...n.path,o,p]})),l=a.rest?ze(a.rest,t,{...n,path:[...n.path,s,...t.target==="openapi-3.0"?[a.items.length]:[]]}):null;t.target==="draft-2020-12"?(i.prefixItems=c,l&&(i.items=l)):t.target==="openapi-3.0"?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u=="number"&&(i.minItems=u),typeof d=="number"&&(i.maxItems=d)},uw=(e,t,r,n)=>{let i=r,a=e._zod.def;i.type="object";let o=a.keyType,c=o._zod.bag?.patterns;if(a.mode==="loose"&&c&&c.size>0){let u=ze(a.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});i.patternProperties={};for(let d of c)i.patternProperties[d.source]=u}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(i.propertyNames=ze(a.keyType,t,{...n,path:[...n.path,"propertyNames"]})),i.additionalProperties=ze(a.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let l=o._zod.values;if(l){let u=[...l].filter(d=>typeof d=="string"||typeof d=="number");u.length>0&&(i.required=u)}},dw=(e,t,r,n)=>{let i=e._zod.def,a=ze(i.innerType,t,n),o=t.seen.get(e);t.target==="openapi-3.0"?(o.ref=i.innerType,r.nullable=!0):r.anyOf=[a,{type:"null"}]},fw=(e,t,r,n)=>{let i=e._zod.def;ze(i.innerType,t,n);let a=t.seen.get(e);a.ref=i.innerType},pw=(e,t,r,n)=>{let i=e._zod.def;ze(i.innerType,t,n);let a=t.seen.get(e);a.ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))},mw=(e,t,r,n)=>{let i=e._zod.def;ze(i.innerType,t,n);let a=t.seen.get(e);a.ref=i.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},hw=(e,t,r,n)=>{let i=e._zod.def;ze(i.innerType,t,n);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=o},gw=(e,t,r,n)=>{let i=e._zod.def,a=i.in._zod.traits.has("$ZodTransform"),o=t.io==="input"?a?i.out:i.in:i.out;ze(o,t,n);let s=t.seen.get(e);s.ref=o},_w=(e,t,r,n)=>{let i=e._zod.def;ze(i.innerType,t,n);let a=t.seen.get(e);a.ref=i.innerType,r.readOnly=!0},yw=(e,t,r,n)=>{let i=e._zod.def;ze(i.innerType,t,n);let a=t.seen.get(e);a.ref=i.innerType},Sp=(e,t,r,n)=>{let i=e._zod.def;ze(i.innerType,t,n);let a=t.seen.get(e);a.ref=i.innerType},vw=(e,t,r,n)=>{let i=e._zod.innerType;ze(i,t,n);let a=t.seen.get(e);a.ref=i},wp={string:Db,number:zb,boolean:Ub,bigint:Lb,symbol:Fb,null:Bb,undefined:Vb,void:Zb,never:Hb,any:Gb,unknown:Wb,date:Jb,enum:Kb,literal:qb,nan:Yb,template_literal:Xb,file:Qb,success:ew,custom:tw,function:rw,transform:nw,map:iw,set:aw,array:ow,object:sw,union:xp,intersection:cw,tuple:lw,record:uw,nullable:dw,nonoptional:fw,default:pw,prefault:mw,catch:hw,pipe:gw,readonly:_w,promise:yw,optional:Sp,lazy:vw};function ko(e,t){if("_idmap"in e){let n=e,i=wa({...t,processors:wp}),a={};for(let c of n._idmap.entries()){let[l,u]=c;ze(u,i)}let o={},s={registry:n,uri:t?.uri,defs:a};i.external=s;for(let c of n._idmap.entries()){let[l,u]=c;xa(i,u),o[l]=Sa(i,u)}if(Object.keys(a).length>0){let c=i.target==="draft-2020-12"?"$defs":"definitions";o.__shared={[c]:a}}return{schemas:o}}let r=wa({...t,processors:wp});return ze(e,r),xa(r,e),Sa(r,e)}var kp=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let r=t?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=wa({processors:wp,target:r,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,r={path:[],schemaPath:[]}){return ze(t,this.ctx,r)}emit(t,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),xa(this.ctx,t);let n=Sa(this.ctx,t),{"~standard":i,...a}=n;return a}};var CA={};function Ge(e){if(typeof e!="object"||e===null)return!1;let t=e;if(!("_zod"in t))return!1;let r=t._zod;return typeof r=="object"&&r!==null&&"def"in r}function lt(e){if(typeof e!="object"||e===null)return!1;let t=e;if(!("_def"in t)||"_zod"in t)return!1;let r=t._def;return typeof r=="object"&&r!=null&&"typeName"in r}function AA(e){return Ge(e)&&console.warn("[WARNING] Attempting to use Zod 4 schema in a context where Zod 3 schema is expected. This may cause unexpected behavior."),lt(e)}function xr(e){return!e||typeof e!="object"||Array.isArray(e)?!1:!!(Ge(e)||lt(e))}function bw(e){return typeof e=="object"&&e!==null&&"_def"in e&&typeof e._def=="object"&&e._def!==null&&"typeName"in e._def&&e._def.typeName==="ZodLiteral"}function ww(e){return Ge(e)?typeof e=="object"&&e!==null&&"_zod"in e&&typeof e._zod=="object"&&e._zod!==null&&"def"in e._zod&&typeof e._zod.def=="object"&&e._zod.def!==null&&"type"in e._zod.def&&e._zod.def.type==="literal":!1}function OA(e){return!!(bw(e)||ww(e))}async function $p(e,t){if(Ge(e))try{return{success:!0,data:await _o(e,t)}}catch(r){return{success:!1,error:r}}if(lt(e))return await e.safeParseAsync(t);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}async function ka(e,t){if(Ge(e))return await _o(e,t);if(lt(e))return await e.parseAsync(t);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function PA(e,t){if(Ge(e))try{return{success:!0,data:ya(e,t)}}catch(r){return{success:!1,error:r}}if(lt(e))return e.safeParse(t);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function Ea(e,t){if(Ge(e))return ya(e,t);if(lt(e))return e.parse(t);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function $i(e){if(Ge(e))return De.get(e)?.description;if(lt(e)||"description"in e&&typeof e.description=="string")return e.description}function NA(e){if(!xr(e))return!1;if(lt(e)){let t=e._def;if(t.typeName==="ZodObject"){let r=e;return!r.shape||Object.keys(r.shape).length===0}if(t.typeName==="ZodRecord")return!0}if(Ge(e)){let t=e._zod.def;if(t.type==="object"){let r=e;return!r.shape||Object.keys(r.shape).length===0}if(t.type==="record")return!0}return typeof e=="object"&&e!==null&&!("shape"in e)}function Js(e){return xr(e)?lt(e)?e._def.typeName==="ZodString":Ge(e)?e._zod.def.type==="string":!1:!1}function Dl(e){return typeof e=="object"&&e!==null&&"_def"in e&&typeof e._def=="object"&&e._def!==null&&"typeName"in e._def&&e._def.typeName==="ZodObject"}function Kr(e){return Ge(e)?typeof e=="object"&&e!==null&&"_zod"in e&&typeof e._zod=="object"&&e._zod!==null&&"def"in e._zod&&typeof e._zod.def=="object"&&e._zod.def!==null&&"type"in e._zod.def&&e._zod.def.type==="object":!1}function zl(e){return Ge(e)?typeof e=="object"&&e!==null&&"_zod"in e&&typeof e._zod=="object"&&e._zod!==null&&"def"in e._zod&&typeof e._zod.def=="object"&&e._zod.def!==null&&"type"in e._zod.def&&e._zod.def.type==="array":!1}function xw(e){return Ge(e)?typeof e=="object"&&e!==null&&"_zod"in e&&typeof e._zod=="object"&&e._zod!==null&&"def"in e._zod&&typeof e._zod.def=="object"&&e._zod.def!==null&&"type"in e._zod.def&&e._zod.def.type==="optional":!1}function Sw(e){return Ge(e)?typeof e=="object"&&e!==null&&"_zod"in e&&typeof e._zod=="object"&&e._zod!==null&&"def"in e._zod&&typeof e._zod.def=="object"&&e._zod.def!==null&&"type"in e._zod.def&&e._zod.def.type==="nullable":!1}function Kt(e){return!!(Dl(e)||Kr(e))}function Ei(e){if(lt(e))return e.shape;if(Ge(e))return e._zod.def.shape;throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Ip(e,t){if(lt(e))return e.extend(t);if(Ge(e))return j.extend(e,t);throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function $a(e){if(lt(e))return e.partial();if(Ge(e))return j.partial(bo,e,void 0);throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Ws(e,t=!1){if(Dl(e))return e.strict();if(Kr(e)){let r=e._zod.def.shape;if(t)for(let[a,o]of Object.entries(e._zod.def.shape)){if(Kr(o))r[a]=Ws(o,t);else if(zl(o)){let c=o._zod.def.element;Kr(c)&&(c=Ws(c,t)),r[a]=Xe(o,{...o._zod.def,element:c})}else r[a]=o;let s=De.get(o);s&&De.add(r[a],s)}let n=Xe(e,{...e._zod.def,shape:r,catchall:jl(Tl)}),i=De.get(e);return i&&De.add(n,i),n}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Ep(e,t=!1){if(Dl(e))return e.passthrough();if(Kr(e)){let r=e._zod.def.shape;if(t)for(let[a,o]of Object.entries(e._zod.def.shape)){if(Kr(o))r[a]=Ep(o,t);else if(zl(o)){let c=o._zod.def.element;Kr(c)&&(c=Ep(c,t)),r[a]=Xe(o,{...o._zod.def,element:c})}else r[a]=o;let s=De.get(o);s&&De.add(r[a],s)}let n=Xe(e,{...e._zod.def,shape:r,catchall:Ml(Il)}),i=De.get(e);return i&&De.add(n,i),n}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Tp(e){if(lt(e))try{let t=e.parse(void 0);return()=>t}catch{return}if(Ge(e))try{let t=ya(e,void 0);return()=>t}catch{return}}function wL(e){return lt(e)&&"typeName"in e._def&&e._def.typeName==="ZodEffects"}function xL(e){return Ge(e)&&e._zod.def.type==="pipe"}function Eo(e,t,r){let n=r.get(e);if(n!==void 0)return n;if(lt(e))return wL(e)?Eo(e._def.schema,t,r):e;if(Ge(e)){let i=e;if(xL(e)&&(i=Eo(e._zod.def.in,t,r)),t){if(Kr(i)){let o={};for(let[s,c]of Object.entries(i._zod.def.shape))o[s]=Eo(c,t,r);i=Xe(i,{...i._zod.def,shape:o})}else if(zl(i)){let o=Eo(i._zod.def.element,t,r);i=Xe(i,{...i._zod.def,element:o})}else if(xw(i)){let o=Eo(i._zod.def.innerType,t,r);i=Xe(i,{...i._zod.def,innerType:o})}else if(Sw(i)){let o=Eo(i._zod.def.innerType,t,r);i=Xe(i,{...i._zod.def,innerType:o})}}let a=De.get(e);return a&&De.add(i,a),r.set(e,i),i}throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function Cp(e,t=!1){return Eo(e,t,new WeakMap)}function RA(e,t){if(lt(e)){let r=Ei(e),n={};for(let[i,a]of Object.entries(r))t(i,a)?n[i]=a.optional():n[i]=a;return e.extend(n)}if(Ge(e)){let r=Ei(e),n={...e._zod.def.shape};for(let[o,s]of Object.entries(r))t(o,s)&&(n[o]=new bo({type:"optional",innerType:s}));let i=Xe(e,{...e._zod.def,shape:n}),a=De.get(e);return a&&De.add(i,a),i}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Ap(e){return e instanceof Error&&(e.constructor.name==="ZodError"||e.constructor.name==="$ZodError")}var Ew=Symbol("Let zodToJsonSchema decide on which parser to use"),kw={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},$w=e=>typeof e=="string"?{...kw,name:e}:{...kw,...e};var Iw=e=>{let t=$w(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([n,i])=>[i._def,{def:i._def,path:[...t.basePath,t.definitionPath,n],jsonSchema:void 0}]))}};var Ul=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")};function Qe(e){if(e.target!=="openAi")return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy==="relative"?Ul(t,e.currentPath):t.join("/")}}function Op(e,t,r,n){n?.errorMessages&&r&&(e.errorMessage={...e.errorMessage,[t]:r})}function Me(e,t,r,n,i){e[t]=r,Op(e,t,n,i)}var Rt={};On(Rt,{BRAND:()=>JL,DIRTY:()=>$o,EMPTY_PATH:()=>$L,INVALID:()=>ce,NEVER:()=>P6,OK:()=>qt,ParseStatus:()=>Ut,Schema:()=>we,ZodAny:()=>Ca,ZodArray:()=>Ai,ZodBigInt:()=>To,ZodBoolean:()=>Co,ZodBranded:()=>Fl,ZodCatch:()=>Lo,ZodDate:()=>Ao,ZodDefault:()=>Uo,ZodDiscriminatedUnion:()=>Rp,ZodEffects:()=>Xr,ZodEnum:()=>Do,ZodError:()=>Sr,ZodFirstPartyTypeKind:()=>z,ZodFunction:()=>jp,ZodIntersection:()=>Ro,ZodIssueCode:()=>D,ZodLazy:()=>Mo,ZodLiteral:()=>jo,ZodMap:()=>ec,ZodNaN:()=>rc,ZodNativeEnum:()=>zo,ZodNever:()=>gn,ZodNull:()=>Po,ZodNullable:()=>Kn,ZodNumber:()=>Io,ZodObject:()=>kr,ZodOptional:()=>qr,ZodParsedType:()=>K,ZodPipeline:()=>Bl,ZodPromise:()=>Aa,ZodReadonly:()=>Fo,ZodRecord:()=>Mp,ZodSchema:()=>we,ZodSet:()=>tc,ZodString:()=>Ta,ZodSymbol:()=>Xs,ZodTransformer:()=>Xr,ZodTuple:()=>Jn,ZodType:()=>we,ZodUndefined:()=>Oo,ZodUnion:()=>No,ZodUnknown:()=>Ci,ZodVoid:()=>Qs,addIssueToContext:()=>Z,any:()=>n6,array:()=>s6,bigint:()=>XL,boolean:()=>HA,coerce:()=>O6,custom:()=>BA,date:()=>QL,datetimeRegex:()=>LA,defaultErrorMap:()=>Ii,discriminatedUnion:()=>d6,effect:()=>S6,enum:()=>b6,function:()=>_6,getErrorMap:()=>Ks,getParsedType:()=>Wn,instanceof:()=>qL,intersection:()=>f6,isAborted:()=>Pp,isAsync:()=>qs,isDirty:()=>Np,isValid:()=>Ia,late:()=>KL,lazy:()=>y6,literal:()=>v6,makeIssue:()=>Ll,map:()=>h6,nan:()=>YL,nativeEnum:()=>w6,never:()=>a6,null:()=>r6,nullable:()=>E6,number:()=>ZA,object:()=>c6,objectUtil:()=>Tw,oboolean:()=>A6,onumber:()=>C6,optional:()=>k6,ostring:()=>T6,pipeline:()=>I6,preprocess:()=>$6,promise:()=>x6,quotelessJson:()=>SL,record:()=>m6,set:()=>g6,setErrorMap:()=>EL,strictObject:()=>l6,string:()=>VA,symbol:()=>e6,transformer:()=>S6,tuple:()=>p6,undefined:()=>t6,union:()=>u6,unknown:()=>i6,util:()=>Ae,void:()=>o6});var Ae;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function r(i){throw new Error}e.assertNever=r,e.arrayToEnum=i=>{let a={};for(let o of i)a[o]=o;return a},e.getValidEnumValues=i=>{let a=e.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),o={};for(let s of a)o[s]=i[s];return e.objectValues(o)},e.objectValues=i=>e.objectKeys(i).map(function(a){return i[a]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let a=[];for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&a.push(o);return a},e.find=(i,a)=>{for(let o of i)if(a(o))return o},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,a=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}e.joinValues=n,e.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(Ae||(Ae={}));var Tw;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Tw||(Tw={}));var K=Ae.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Wn=e=>{switch(typeof e){case"undefined":return K.undefined;case"string":return K.string;case"number":return Number.isNaN(e)?K.nan:K.number;case"boolean":return K.boolean;case"function":return K.function;case"bigint":return K.bigint;case"symbol":return K.symbol;case"object":return Array.isArray(e)?K.array:e===null?K.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?K.promise:typeof Map<"u"&&e instanceof Map?K.map:typeof Set<"u"&&e instanceof Set?K.set:typeof Date<"u"&&e instanceof Date?K.date:K.object;default:return K.unknown}};var D=Ae.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),SL=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),Sr=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(a){return a.message},n={_errors:[]},i=a=>{for(let o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let s=n,c=0;for(;c<o.path.length;){let l=o.path[c];c===o.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(r(o))):s[l]=s[l]||{_errors:[]},s=s[l],c++}}};return i(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ae.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r=Object.create(null),n=[];for(let i of this.issues)if(i.path.length>0){let a=i.path[0];r[a]=r[a]||[],r[a].push(t(i))}else n.push(t(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Sr.create=e=>new Sr(e);var kL=(e,t)=>{let r;switch(e.code){case D.invalid_type:e.received===K.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case D.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Ae.jsonStringifyReplacer)}`;break;case D.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ae.joinValues(e.keys,", ")}`;break;case D.invalid_union:r="Invalid input";break;case D.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ae.joinValues(e.options)}`;break;case D.invalid_enum_value:r=`Invalid enum value. Expected ${Ae.joinValues(e.options)}, received '${e.received}'`;break;case D.invalid_arguments:r="Invalid function arguments";break;case D.invalid_return_type:r="Invalid function return type";break;case D.invalid_date:r="Invalid date";break;case D.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Ae.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case D.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case D.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case D.custom:r="Invalid input";break;case D.invalid_intersection_types:r="Intersection results could not be merged";break;case D.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case D.not_finite:r="Number must be finite";break;default:r=t.defaultError,Ae.assertNever(e)}return{message:r}},Ii=kL;var MA=Ii;function EL(e){MA=e}function Ks(){return MA}var Ll=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,a=[...r,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s="",c=n.filter(l=>!!l).slice().reverse();for(let l of c)s=l(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}},$L=[];function Z(e,t){let r=Ks(),n=Ll({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Ii?void 0:Ii].filter(i=>!!i)});e.common.issues.push(n)}var Ut=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let i of r){if(i.status==="aborted")return ce;i.status==="dirty"&&t.dirty(),n.push(i.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let i of r){let a=await i.key,o=await i.value;n.push({key:a,value:o})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let i of r){let{key:a,value:o}=i;if(a.status==="aborted"||o.status==="aborted")return ce;a.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(n[a.value]=o.value)}return{status:t.value,value:n}}},ce=Object.freeze({status:"aborted"}),$o=e=>({status:"dirty",value:e}),qt=e=>({status:"valid",value:e}),Pp=e=>e.status==="aborted",Np=e=>e.status==="dirty",Ia=e=>e.status==="valid",qs=e=>typeof Promise<"u"&&e instanceof Promise;var re;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(re||(re={}));var Yr=class{constructor(t,r,n,i){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},jA=(e,t)=>{if(Ia(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Sr(e.common.issues);return this._error=r,this._error}}};function ge(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(o,s)=>{let{message:c}=e;return o.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??n??s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:c??r??s.defaultError}},description:i}}var we=class{get description(){return this._def.description}_getType(t){return Wn(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Wn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Ut,ctx:{common:t.parent.common,data:t.data,parsedType:Wn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(qs(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Wn(t)},i=this._parseSync({data:t,path:n.path,parent:n});return jA(n,i)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Wn(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Ia(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>Ia(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Wn(t)},i=this._parse({data:t,path:n.path,parent:n}),a=await(qs(i)?i:Promise.resolve(i));return jA(n,a)}refine(t,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,a)=>{let o=t(i),s=()=>a.addIssue({code:D.custom,...n(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(s(),!1)):o?!0:(s(),!1)})}refinement(t,r){return this._refinement((n,i)=>t(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(t){return new Xr({schema:this,typeName:z.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return qr.create(this,this._def)}nullable(){return Kn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ai.create(this)}promise(){return Aa.create(this,this._def)}or(t){return No.create([this,t],this._def)}and(t){return Ro.create(this,t,this._def)}transform(t){return new Xr({...ge(this._def),schema:this,typeName:z.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Uo({...ge(this._def),innerType:this,defaultValue:r,typeName:z.ZodDefault})}brand(){return new Fl({typeName:z.ZodBranded,type:this,...ge(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Lo({...ge(this._def),innerType:this,catchValue:r,typeName:z.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Bl.create(this,t)}readonly(){return Fo.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},IL=/^c[^\s-]{8,}$/i,TL=/^[0-9a-z]+$/,CL=/^[0-9A-HJKMNP-TV-Z]{26}$/i,AL=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,OL=/^[a-z0-9_-]{21}$/i,PL=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,NL=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,RL=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ML="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Cw,jL=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,DL=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,zL=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,UL=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,LL=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,FL=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,zA="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",BL=new RegExp(`^${zA}$`);function UA(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function VL(e){return new RegExp(`^${UA(e)}$`)}function LA(e){let t=`${zA}T${UA(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function ZL(e,t){return!!((t==="v4"||!t)&&jL.test(e)||(t==="v6"||!t)&&zL.test(e))}function HL(e,t){if(!PL.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function GL(e,t){return!!((t==="v4"||!t)&&DL.test(e)||(t==="v6"||!t)&&UL.test(e))}var Ta=class e extends we{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==K.string){let a=this._getOrReturnCtx(t);return Z(a,{code:D.invalid_type,expected:K.string,received:a.parsedType}),ce}let n=new Ut,i;for(let a of this._def.checks)if(a.kind==="min")t.data.length<a.value&&(i=this._getOrReturnCtx(t,i),Z(i,{code:D.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")t.data.length>a.value&&(i=this._getOrReturnCtx(t,i),Z(i,{code:D.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let o=t.data.length>a.value,s=t.data.length<a.value;(o||s)&&(i=this._getOrReturnCtx(t,i),o?Z(i,{code:D.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&Z(i,{code:D.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")RL.test(t.data)||(i=this._getOrReturnCtx(t,i),Z(i,{validation:"email",code:D.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Cw||(Cw=new RegExp(ML,"u")),Cw.test(t.data)||(i=this._getOrReturnCtx(t,i),Z(i,{validation:"emoji",code:D.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")AL.test(t.data)||(i=this._getOrReturnCtx(t,i),Z(i,{validation:"uuid",code:D.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")OL.test(t.data)||(i=this._getOrReturnCtx(t,i),Z(i,{validation:"nanoid",code:D.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")IL.test(t.data)||(i=this._getOrReturnCtx(t,i),Z(i,{validation:"cuid",code:D.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")TL.test(t.data)||(i=this._getOrReturnCtx(t,i),Z(i,{validation:"cuid2",code:D.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")CL.test(t.data)||(i=this._getOrReturnCtx(t,i),Z(i,{validation:"ulid",code:D.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),Z(i,{validation:"url",code:D.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),Z(i,{validation:"regex",code:D.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?t.data=t.data.trim():a.kind==="includes"?t.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(t,i),Z(i,{code:D.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?t.data=t.data.toLowerCase():a.kind==="toUpperCase"?t.data=t.data.toUpperCase():a.kind==="startsWith"?t.data.startsWith(a.value)||(i=this._getOrReturnCtx(t,i),Z(i,{code:D.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?t.data.endsWith(a.value)||(i=this._getOrReturnCtx(t,i),Z(i,{code:D.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?LA(a).test(t.data)||(i=this._getOrReturnCtx(t,i),Z(i,{code:D.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?BL.test(t.data)||(i=this._getOrReturnCtx(t,i),Z(i,{code:D.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?VL(a).test(t.data)||(i=this._getOrReturnCtx(t,i),Z(i,{code:D.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?NL.test(t.data)||(i=this._getOrReturnCtx(t,i),Z(i,{validation:"duration",code:D.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?ZL(t.data,a.version)||(i=this._getOrReturnCtx(t,i),Z(i,{validation:"ip",code:D.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?HL(t.data,a.alg)||(i=this._getOrReturnCtx(t,i),Z(i,{validation:"jwt",code:D.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?GL(t.data,a.version)||(i=this._getOrReturnCtx(t,i),Z(i,{validation:"cidr",code:D.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?LL.test(t.data)||(i=this._getOrReturnCtx(t,i),Z(i,{validation:"base64",code:D.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?FL.test(t.data)||(i=this._getOrReturnCtx(t,i),Z(i,{validation:"base64url",code:D.invalid_string,message:a.message}),n.dirty()):Ae.assertNever(a);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(i=>t.test(i),{validation:r,code:D.invalid_string,...re.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...re.errToObj(t)})}url(t){return this._addCheck({kind:"url",...re.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...re.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...re.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...re.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...re.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...re.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...re.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...re.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...re.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...re.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...re.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...re.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...re.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...re.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...re.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...re.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...re.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...re.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...re.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...re.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...re.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...re.errToObj(r)})}nonempty(t){return this.min(1,re.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Ta.create=e=>new Ta({checks:[],typeName:z.ZodString,coerce:e?.coerce??!1,...ge(e)});function WL(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n,a=Number.parseInt(e.toFixed(i).replace(".","")),o=Number.parseInt(t.toFixed(i).replace(".",""));return a%o/10**i}var Io=class e extends we{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==K.number){let a=this._getOrReturnCtx(t);return Z(a,{code:D.invalid_type,expected:K.number,received:a.parsedType}),ce}let n,i=new Ut;for(let a of this._def.checks)a.kind==="int"?Ae.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),Z(n,{code:D.invalid_type,expected:"integer",received:"float",message:a.message}),i.dirty()):a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),Z(n,{code:D.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),Z(n,{code:D.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?WL(t.data,a.value)!==0&&(n=this._getOrReturnCtx(t,n),Z(n,{code:D.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),Z(n,{code:D.not_finite,message:a.message}),i.dirty()):Ae.assertNever(a);return{status:i.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,re.toString(r))}gt(t,r){return this.setLimit("min",t,!1,re.toString(r))}lte(t,r){return this.setLimit("max",t,!0,re.toString(r))}lt(t,r){return this.setLimit("max",t,!1,re.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:re.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:re.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:re.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:re.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:re.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:re.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:re.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:re.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:re.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:re.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Ae.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};Io.create=e=>new Io({checks:[],typeName:z.ZodNumber,coerce:e?.coerce||!1,...ge(e)});var To=class e extends we{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==K.bigint)return this._getInvalidInput(t);let n,i=new Ut;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),Z(n,{code:D.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),Z(n,{code:D.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="multipleOf"?t.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),Z(n,{code:D.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):Ae.assertNever(a);return{status:i.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return Z(r,{code:D.invalid_type,expected:K.bigint,received:r.parsedType}),ce}gte(t,r){return this.setLimit("min",t,!0,re.toString(r))}gt(t,r){return this.setLimit("min",t,!1,re.toString(r))}lte(t,r){return this.setLimit("max",t,!0,re.toString(r))}lt(t,r){return this.setLimit("max",t,!1,re.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:re.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:re.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:re.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:re.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:re.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:re.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};To.create=e=>new To({checks:[],typeName:z.ZodBigInt,coerce:e?.coerce??!1,...ge(e)});var Co=class extends we{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==K.boolean){let n=this._getOrReturnCtx(t);return Z(n,{code:D.invalid_type,expected:K.boolean,received:n.parsedType}),ce}return qt(t.data)}};Co.create=e=>new Co({typeName:z.ZodBoolean,coerce:e?.coerce||!1,...ge(e)});var Ao=class e extends we{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==K.date){let a=this._getOrReturnCtx(t);return Z(a,{code:D.invalid_type,expected:K.date,received:a.parsedType}),ce}if(Number.isNaN(t.data.getTime())){let a=this._getOrReturnCtx(t);return Z(a,{code:D.invalid_date}),ce}let n=new Ut,i;for(let a of this._def.checks)a.kind==="min"?t.data.getTime()<a.value&&(i=this._getOrReturnCtx(t,i),Z(i,{code:D.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?t.data.getTime()>a.value&&(i=this._getOrReturnCtx(t,i),Z(i,{code:D.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):Ae.assertNever(a);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:re.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:re.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};Ao.create=e=>new Ao({checks:[],coerce:e?.coerce||!1,typeName:z.ZodDate,...ge(e)});var Xs=class extends we{_parse(t){if(this._getType(t)!==K.symbol){let n=this._getOrReturnCtx(t);return Z(n,{code:D.invalid_type,expected:K.symbol,received:n.parsedType}),ce}return qt(t.data)}};Xs.create=e=>new Xs({typeName:z.ZodSymbol,...ge(e)});var Oo=class extends we{_parse(t){if(this._getType(t)!==K.undefined){let n=this._getOrReturnCtx(t);return Z(n,{code:D.invalid_type,expected:K.undefined,received:n.parsedType}),ce}return qt(t.data)}};Oo.create=e=>new Oo({typeName:z.ZodUndefined,...ge(e)});var Po=class extends we{_parse(t){if(this._getType(t)!==K.null){let n=this._getOrReturnCtx(t);return Z(n,{code:D.invalid_type,expected:K.null,received:n.parsedType}),ce}return qt(t.data)}};Po.create=e=>new Po({typeName:z.ZodNull,...ge(e)});var Ca=class extends we{constructor(){super(...arguments),this._any=!0}_parse(t){return qt(t.data)}};Ca.create=e=>new Ca({typeName:z.ZodAny,...ge(e)});var Ci=class extends we{constructor(){super(...arguments),this._unknown=!0}_parse(t){return qt(t.data)}};Ci.create=e=>new Ci({typeName:z.ZodUnknown,...ge(e)});var gn=class extends we{_parse(t){let r=this._getOrReturnCtx(t);return Z(r,{code:D.invalid_type,expected:K.never,received:r.parsedType}),ce}};gn.create=e=>new gn({typeName:z.ZodNever,...ge(e)});var Qs=class extends we{_parse(t){if(this._getType(t)!==K.undefined){let n=this._getOrReturnCtx(t);return Z(n,{code:D.invalid_type,expected:K.void,received:n.parsedType}),ce}return qt(t.data)}};Qs.create=e=>new Qs({typeName:z.ZodVoid,...ge(e)});var Ai=class e extends we{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),i=this._def;if(r.parsedType!==K.array)return Z(r,{code:D.invalid_type,expected:K.array,received:r.parsedType}),ce;if(i.exactLength!==null){let o=r.data.length>i.exactLength.value,s=r.data.length<i.exactLength.value;(o||s)&&(Z(r,{code:o?D.too_big:D.too_small,minimum:s?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(Z(r,{code:D.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(Z(r,{code:D.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((o,s)=>i.type._parseAsync(new Yr(r,o,r.path,s)))).then(o=>Ut.mergeArray(n,o));let a=[...r.data].map((o,s)=>i.type._parseSync(new Yr(r,o,r.path,s)));return Ut.mergeArray(n,a)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:re.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:re.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:re.toString(r)}})}nonempty(t){return this.min(1,t)}};Ai.create=(e,t)=>new Ai({type:e,minLength:null,maxLength:null,exactLength:null,typeName:z.ZodArray,...ge(t)});function Ys(e){if(e instanceof kr){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=qr.create(Ys(n))}return new kr({...e._def,shape:()=>t})}else return e instanceof Ai?new Ai({...e._def,type:Ys(e.element)}):e instanceof qr?qr.create(Ys(e.unwrap())):e instanceof Kn?Kn.create(Ys(e.unwrap())):e instanceof Jn?Jn.create(e.items.map(t=>Ys(t))):e}var kr=class e extends we{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=Ae.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==K.object){let l=this._getOrReturnCtx(t);return Z(l,{code:D.invalid_type,expected:K.object,received:l.parsedType}),ce}let{status:n,ctx:i}=this._processInputParams(t),{shape:a,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof gn&&this._def.unknownKeys==="strip"))for(let l in i.data)o.includes(l)||s.push(l);let c=[];for(let l of o){let u=a[l],d=i.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Yr(i,d,i.path,l)),alwaysSet:l in i.data})}if(this._def.catchall instanceof gn){let l=this._def.unknownKeys;if(l==="passthrough")for(let u of s)c.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(l==="strict")s.length>0&&(Z(i,{code:D.unrecognized_keys,keys:s}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let u of s){let d=i.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Yr(i,d,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let l=[];for(let u of c){let d=await u.key,f=await u.value;l.push({key:d,value:f,alwaysSet:u.alwaysSet})}return l}).then(l=>Ut.mergeObjectSync(n,l)):Ut.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return re.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:re.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:z.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of Ae.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of Ae.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return Ys(this)}partial(t){let r={};for(let n of Ae.objectKeys(this.shape)){let i=this.shape[n];t&&!t[n]?r[n]=i:r[n]=i.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of Ae.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof qr;)a=a._def.innerType;r[n]=a}return new e({...this._def,shape:()=>r})}keyof(){return FA(Ae.objectKeys(this.shape))}};kr.create=(e,t)=>new kr({shape:()=>e,unknownKeys:"strip",catchall:gn.create(),typeName:z.ZodObject,...ge(t)});kr.strictCreate=(e,t)=>new kr({shape:()=>e,unknownKeys:"strict",catchall:gn.create(),typeName:z.ZodObject,...ge(t)});kr.lazycreate=(e,t)=>new kr({shape:e,unknownKeys:"strip",catchall:gn.create(),typeName:z.ZodObject,...ge(t)});var No=class extends we{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function i(a){for(let s of a)if(s.result.status==="valid")return s.result;for(let s of a)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let o=a.map(s=>new Sr(s.ctx.common.issues));return Z(r,{code:D.invalid_union,unionErrors:o}),ce}if(r.common.async)return Promise.all(n.map(async a=>{let o={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(i);{let a,o=[];for(let c of n){let l={...r,common:{...r.common,issues:[]},parent:null},u=c._parseSync({data:r.data,path:r.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!a&&(a={result:u,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(c=>new Sr(c));return Z(r,{code:D.invalid_union,unionErrors:s}),ce}}get options(){return this._def.options}};No.create=(e,t)=>new No({options:e,typeName:z.ZodUnion,...ge(t)});var Ti=e=>e instanceof Mo?Ti(e.schema):e instanceof Xr?Ti(e.innerType()):e instanceof jo?[e.value]:e instanceof Do?e.options:e instanceof zo?Ae.objectValues(e.enum):e instanceof Uo?Ti(e._def.innerType):e instanceof Oo?[void 0]:e instanceof Po?[null]:e instanceof qr?[void 0,...Ti(e.unwrap())]:e instanceof Kn?[null,...Ti(e.unwrap())]:e instanceof Fl||e instanceof Fo?Ti(e.unwrap()):e instanceof Lo?Ti(e._def.innerType):[],Rp=class e extends we{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==K.object)return Z(r,{code:D.invalid_type,expected:K.object,received:r.parsedType}),ce;let n=this.discriminator,i=r.data[n],a=this.optionsMap.get(i);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(Z(r,{code:D.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ce)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let i=new Map;for(let a of r){let o=Ti(a.shape[t]);if(!o.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of o){if(i.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);i.set(s,a)}}return new e({typeName:z.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,...ge(n)})}};function Aw(e,t){let r=Wn(e),n=Wn(t);if(e===t)return{valid:!0,data:e};if(r===K.object&&n===K.object){let i=Ae.objectKeys(t),a=Ae.objectKeys(e).filter(s=>i.indexOf(s)!==-1),o={...e,...t};for(let s of a){let c=Aw(e[s],t[s]);if(!c.valid)return{valid:!1};o[s]=c.data}return{valid:!0,data:o}}else if(r===K.array&&n===K.array){if(e.length!==t.length)return{valid:!1};let i=[];for(let a=0;a<e.length;a++){let o=e[a],s=t[a],c=Aw(o,s);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===K.date&&n===K.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Ro=class extends we{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=(a,o)=>{if(Pp(a)||Pp(o))return ce;let s=Aw(a.value,o.value);return s.valid?((Np(a)||Np(o))&&r.dirty(),{status:r.value,value:s.data}):(Z(n,{code:D.invalid_intersection_types}),ce)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,o])=>i(a,o)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Ro.create=(e,t,r)=>new Ro({left:e,right:t,typeName:z.ZodIntersection,...ge(r)});var Jn=class e extends we{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==K.array)return Z(n,{code:D.invalid_type,expected:K.array,received:n.parsedType}),ce;if(n.data.length<this._def.items.length)return Z(n,{code:D.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ce;!this._def.rest&&n.data.length>this._def.items.length&&(Z(n,{code:D.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...n.data].map((o,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new Yr(n,o,n.path,s)):null}).filter(o=>!!o);return n.common.async?Promise.all(a).then(o=>Ut.mergeArray(r,o)):Ut.mergeArray(r,a)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Jn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Jn({items:e,typeName:z.ZodTuple,rest:null,...ge(t)})};var Mp=class e extends we{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==K.object)return Z(n,{code:D.invalid_type,expected:K.object,received:n.parsedType}),ce;let i=[],a=this._def.keyType,o=this._def.valueType;for(let s in n.data)i.push({key:a._parse(new Yr(n,s,n.path,s)),value:o._parse(new Yr(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Ut.mergeObjectAsync(r,i):Ut.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof we?new e({keyType:t,valueType:r,typeName:z.ZodRecord,...ge(n)}):new e({keyType:Ta.create(),valueType:t,typeName:z.ZodRecord,...ge(r)})}},ec=class extends we{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==K.map)return Z(n,{code:D.invalid_type,expected:K.map,received:n.parsedType}),ce;let i=this._def.keyType,a=this._def.valueType,o=[...n.data.entries()].map(([s,c],l)=>({key:i._parse(new Yr(n,s,n.path,[l,"key"])),value:a._parse(new Yr(n,c,n.path,[l,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of o){let l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return ce;(l.status==="dirty"||u.status==="dirty")&&r.dirty(),s.set(l.value,u.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let c of o){let l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return ce;(l.status==="dirty"||u.status==="dirty")&&r.dirty(),s.set(l.value,u.value)}return{status:r.value,value:s}}}};ec.create=(e,t,r)=>new ec({valueType:t,keyType:e,typeName:z.ZodMap,...ge(r)});var tc=class e extends we{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==K.set)return Z(n,{code:D.invalid_type,expected:K.set,received:n.parsedType}),ce;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(Z(n,{code:D.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(Z(n,{code:D.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let a=this._def.valueType;function o(c){let l=new Set;for(let u of c){if(u.status==="aborted")return ce;u.status==="dirty"&&r.dirty(),l.add(u.value)}return{status:r.value,value:l}}let s=[...n.data.values()].map((c,l)=>a._parse(new Yr(n,c,n.path,l)));return n.common.async?Promise.all(s).then(c=>o(c)):o(s)}min(t,r){return new e({...this._def,minSize:{value:t,message:re.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:re.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};tc.create=(e,t)=>new tc({valueType:e,minSize:null,maxSize:null,typeName:z.ZodSet,...ge(t)});var jp=class e extends we{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==K.function)return Z(r,{code:D.invalid_type,expected:K.function,received:r.parsedType}),ce;function n(s,c){return Ll({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ks(),Ii].filter(l=>!!l),issueData:{code:D.invalid_arguments,argumentsError:c}})}function i(s,c){return Ll({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ks(),Ii].filter(l=>!!l),issueData:{code:D.invalid_return_type,returnTypeError:c}})}let a={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof Aa){let s=this;return qt(async function(...c){let l=new Sr([]),u=await s._def.args.parseAsync(c,a).catch(p=>{throw l.addIssue(n(c,p)),l}),d=await Reflect.apply(o,this,u);return await s._def.returns._def.type.parseAsync(d,a).catch(p=>{throw l.addIssue(i(d,p)),l})})}else{let s=this;return qt(function(...c){let l=s._def.args.safeParse(c,a);if(!l.success)throw new Sr([n(c,l.error)]);let u=Reflect.apply(o,this,l.data),d=s._def.returns.safeParse(u,a);if(!d.success)throw new Sr([i(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Jn.create(t).rest(Ci.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||Jn.create([]).rest(Ci.create()),returns:r||Ci.create(),typeName:z.ZodFunction,...ge(n)})}},Mo=class extends we{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Mo.create=(e,t)=>new Mo({getter:e,typeName:z.ZodLazy,...ge(t)});var jo=class extends we{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return Z(r,{received:r.data,code:D.invalid_literal,expected:this._def.value}),ce}return{status:"valid",value:t.data}}get value(){return this._def.value}};jo.create=(e,t)=>new jo({value:e,typeName:z.ZodLiteral,...ge(t)});function FA(e,t){return new Do({values:e,typeName:z.ZodEnum,...ge(t)})}var Do=class e extends we{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return Z(r,{expected:Ae.joinValues(n),received:r.parsedType,code:D.invalid_type}),ce}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return Z(r,{received:r.data,code:D.invalid_enum_value,options:n}),ce}return qt(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};Do.create=FA;var zo=class extends we{_parse(t){let r=Ae.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==K.string&&n.parsedType!==K.number){let i=Ae.objectValues(r);return Z(n,{expected:Ae.joinValues(i),received:n.parsedType,code:D.invalid_type}),ce}if(this._cache||(this._cache=new Set(Ae.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let i=Ae.objectValues(r);return Z(n,{received:n.data,code:D.invalid_enum_value,options:i}),ce}return qt(t.data)}get enum(){return this._def.values}};zo.create=(e,t)=>new zo({values:e,typeName:z.ZodNativeEnum,...ge(t)});var Aa=class extends we{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==K.promise&&r.common.async===!1)return Z(r,{code:D.invalid_type,expected:K.promise,received:r.parsedType}),ce;let n=r.parsedType===K.promise?r.data:Promise.resolve(r.data);return qt(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Aa.create=(e,t)=>new Aa({type:e,typeName:z.ZodPromise,...ge(t)});var Xr=class extends we{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===z.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=this._def.effect||null,a={addIssue:o=>{Z(n,o),o.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){let o=i.transform(n.data,a);if(n.common.async)return Promise.resolve(o).then(async s=>{if(r.value==="aborted")return ce;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?ce:c.status==="dirty"?$o(c.value):r.value==="dirty"?$o(c.value):c});{if(r.value==="aborted")return ce;let s=this._def.schema._parseSync({data:o,path:n.path,parent:n});return s.status==="aborted"?ce:s.status==="dirty"?$o(s.value):r.value==="dirty"?$o(s.value):s}}if(i.type==="refinement"){let o=s=>{let c=i.refinement(s,a);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?ce:(s.status==="dirty"&&r.dirty(),o(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?ce:(s.status==="dirty"&&r.dirty(),o(s.value).then(()=>({status:r.value,value:s.value}))))}if(i.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Ia(o))return ce;let s=i.transform(o.value,a);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>Ia(o)?Promise.resolve(i.transform(o.value,a)).then(s=>({status:r.value,value:s})):ce);Ae.assertNever(i)}};Xr.create=(e,t,r)=>new Xr({schema:e,typeName:z.ZodEffects,effect:t,...ge(r)});Xr.createWithPreprocess=(e,t,r)=>new Xr({schema:t,effect:{type:"preprocess",transform:e},typeName:z.ZodEffects,...ge(r)});var qr=class extends we{_parse(t){return this._getType(t)===K.undefined?qt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};qr.create=(e,t)=>new qr({innerType:e,typeName:z.ZodOptional,...ge(t)});var Kn=class extends we{_parse(t){return this._getType(t)===K.null?qt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Kn.create=(e,t)=>new Kn({innerType:e,typeName:z.ZodNullable,...ge(t)});var Uo=class extends we{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===K.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Uo.create=(e,t)=>new Uo({innerType:e,typeName:z.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ge(t)});var Lo=class extends we{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return qs(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Sr(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Sr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Lo.create=(e,t)=>new Lo({innerType:e,typeName:z.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ge(t)});var rc=class extends we{_parse(t){if(this._getType(t)!==K.nan){let n=this._getOrReturnCtx(t);return Z(n,{code:D.invalid_type,expected:K.nan,received:n.parsedType}),ce}return{status:"valid",value:t.data}}};rc.create=e=>new rc({typeName:z.ZodNaN,...ge(e)});var JL=Symbol("zod_brand"),Fl=class extends we{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Bl=class e extends we{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?ce:a.status==="dirty"?(r.dirty(),$o(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?ce:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:z.ZodPipeline})}},Fo=class extends we{_parse(t){let r=this._def.innerType._parse(t),n=i=>(Ia(i)&&(i.value=Object.freeze(i.value)),i);return qs(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};Fo.create=(e,t)=>new Fo({innerType:e,typeName:z.ZodReadonly,...ge(t)});function DA(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function BA(e,t={},r){return e?Ca.create().superRefine((n,i)=>{let a=e(n);if(a instanceof Promise)return a.then(o=>{if(!o){let s=DA(t,n),c=s.fatal??r??!0;i.addIssue({code:"custom",...s,fatal:c})}});if(!a){let o=DA(t,n),s=o.fatal??r??!0;i.addIssue({code:"custom",...o,fatal:s})}}):Ca.create()}var KL={object:kr.lazycreate},z;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(z||(z={}));var qL=(e,t={message:`Input not instance of ${e.name}`})=>BA(r=>r instanceof e,t),VA=Ta.create,ZA=Io.create,YL=rc.create,XL=To.create,HA=Co.create,QL=Ao.create,e6=Xs.create,t6=Oo.create,r6=Po.create,n6=Ca.create,i6=Ci.create,a6=gn.create,o6=Qs.create,s6=Ai.create,c6=kr.create,l6=kr.strictCreate,u6=No.create,d6=Rp.create,f6=Ro.create,p6=Jn.create,m6=Mp.create,h6=ec.create,g6=tc.create,_6=jp.create,y6=Mo.create,v6=jo.create,b6=Do.create,w6=zo.create,x6=Aa.create,S6=Xr.create,k6=qr.create,E6=Kn.create,$6=Xr.createWithPreprocess,I6=Bl.create,T6=()=>VA().optional(),C6=()=>ZA().optional(),A6=()=>HA().optional(),O6={string:(e=>Ta.create({...e,coerce:!0})),number:(e=>Io.create({...e,coerce:!0})),boolean:(e=>Co.create({...e,coerce:!0})),bigint:(e=>To.create({...e,coerce:!0})),date:(e=>Ao.create({...e,coerce:!0}))};var P6=ce;function Ow(e,t){let r={type:"array"};return e.type?._def&&e.type?._def?.typeName!==z.ZodAny&&(r.items=le(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&Me(r,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&Me(r,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(Me(r,"minItems",e.exactLength.value,e.exactLength.message,t),Me(r,"maxItems",e.exactLength.value,e.exactLength.message,t)),r}function Pw(e,t){let r={type:"integer",format:"int64"};if(!e.checks)return r;for(let n of e.checks)switch(n.kind){case"min":t.target==="jsonSchema7"?n.inclusive?Me(r,"minimum",n.value,n.message,t):Me(r,"exclusiveMinimum",n.value,n.message,t):(n.inclusive||(r.exclusiveMinimum=!0),Me(r,"minimum",n.value,n.message,t));break;case"max":t.target==="jsonSchema7"?n.inclusive?Me(r,"maximum",n.value,n.message,t):Me(r,"exclusiveMaximum",n.value,n.message,t):(n.inclusive||(r.exclusiveMaximum=!0),Me(r,"maximum",n.value,n.message,t));break;case"multipleOf":Me(r,"multipleOf",n.value,n.message,t);break}return r}function Nw(){return{type:"boolean"}}function Vl(e,t){return le(e.type._def,t)}var Rw=(e,t)=>le(e.innerType._def,t);function Dp(e,t,r){let n=r??t.dateStrategy;if(Array.isArray(n))return{anyOf:n.map(i=>Dp(e,t,i))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return N6(e,t)}}var N6=(e,t)=>{let r={type:"integer",format:"unix-time"};if(t.target==="openApi3")return r;for(let n of e.checks)switch(n.kind){case"min":Me(r,"minimum",n.value,n.message,t);break;case"max":Me(r,"maximum",n.value,n.message,t);break}return r};function Mw(e,t){return{...le(e.innerType._def,t),default:e.defaultValue()}}function jw(e,t){return t.effectStrategy==="input"?le(e.schema._def,t):Qe(t)}function Dw(e){return{type:"string",enum:Array.from(e.values)}}var R6=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function zw(e,t){let r=[le(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),le(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(a=>!!a),n=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,i=[];return r.forEach(a=>{if(R6(a))i.push(...a.allOf),a.unevaluatedProperties===void 0&&(n=void 0);else{let o=a;if("additionalProperties"in a&&a.additionalProperties===!1){let{additionalProperties:s,...c}=a;o=c}else n=void 0;i.push(o)}}),i.length?{allOf:i,...n}:void 0}function Uw(e,t){let r=typeof e.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(e.value)?"array":"object"}:t.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[e.value]}:{type:r==="bigint"?"integer":r,const:e.value}}var Lw,Qr={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Lw===void 0&&(Lw=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Lw),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Zl(e,t){let r={type:"string"};if(e.checks)for(let n of e.checks)switch(n.kind){case"min":Me(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,t);break;case"max":Me(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,t);break;case"email":switch(t.emailStrategy){case"format:email":_n(r,"email",n.message,t);break;case"format:idn-email":_n(r,"idn-email",n.message,t);break;case"pattern:zod":pr(r,Qr.email,n.message,t);break}break;case"url":_n(r,"uri",n.message,t);break;case"uuid":_n(r,"uuid",n.message,t);break;case"regex":pr(r,n.regex,n.message,t);break;case"cuid":pr(r,Qr.cuid,n.message,t);break;case"cuid2":pr(r,Qr.cuid2,n.message,t);break;case"startsWith":pr(r,RegExp(`^${Fw(n.value,t)}`),n.message,t);break;case"endsWith":pr(r,RegExp(`${Fw(n.value,t)}$`),n.message,t);break;case"datetime":_n(r,"date-time",n.message,t);break;case"date":_n(r,"date",n.message,t);break;case"time":_n(r,"time",n.message,t);break;case"duration":_n(r,"duration",n.message,t);break;case"length":Me(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,t),Me(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,t);break;case"includes":pr(r,RegExp(Fw(n.value,t)),n.message,t);break;case"ip":n.version!=="v6"&&_n(r,"ipv4",n.message,t),n.version!=="v4"&&_n(r,"ipv6",n.message,t);break;case"base64url":pr(r,Qr.base64url,n.message,t);break;case"jwt":pr(r,Qr.jwt,n.message,t);break;case"cidr":n.version!=="v6"&&pr(r,Qr.ipv4Cidr,n.message,t),n.version!=="v4"&&pr(r,Qr.ipv6Cidr,n.message,t);break;case"emoji":pr(r,Qr.emoji(),n.message,t);break;case"ulid":pr(r,Qr.ulid,n.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":_n(r,"binary",n.message,t);break;case"contentEncoding:base64":Me(r,"contentEncoding","base64",n.message,t);break;case"pattern:zod":pr(r,Qr.base64,n.message,t);break}break;case"nanoid":pr(r,Qr.nanoid,n.message,t);break;case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function Fw(e,t){return t.patternStrategy==="escape"?j6(e):e}var M6=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function j6(e){let t="";for(let r=0;r<e.length;r++)M6.has(e[r])||(t+="\\"),t+=e[r];return t}function _n(e,t,r,n){e.format||e.anyOf?.some(i=>i.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&n.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.anyOf.push({format:t,...r&&n.errorMessages&&{errorMessage:{format:r}}})):Me(e,"format",t,r,n)}function pr(e,t,r,n){e.pattern||e.allOf?.some(i=>i.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&n.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.allOf.push({pattern:GA(t,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):Me(e,"pattern",GA(t,n),r,n)}function GA(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},n=r.i?e.source.toLowerCase():e.source,i="",a=!1,o=!1,s=!1;for(let c=0;c<n.length;c++){if(a){i+=n[c],a=!1;continue}if(r.i){if(o){if(n[c].match(/[a-z]/)){s?(i+=n[c],i+=`${n[c-2]}-${n[c]}`.toUpperCase(),s=!1):n[c+1]==="-"&&n[c+2]?.match(/[a-z]/)?(i+=n[c],s=!0):i+=`${n[c]}${n[c].toUpperCase()}`;continue}}else if(n[c].match(/[a-z]/)){i+=`[${n[c]}${n[c].toUpperCase()}]`;continue}}if(r.m){if(n[c]==="^"){i+=`(^|(?<=[\r
219
+ ]))`;continue}else if(n[c]==="$"){i+=`($|(?=[\r
220
+ ]))`;continue}}if(r.s&&n[c]==="."){i+=o?`${n[c]}\r
221
+ `:`[${n[c]}\r
222
+ ]`;continue}i+=n[c],n[c]==="\\"?a=!0:o&&n[c]==="]"?o=!1:!o&&n[c]==="["&&(o=!0)}try{new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return i}function Hl(e,t){if(t.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),t.target==="openApi3"&&e.keyType?._def.typeName===z.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,i)=>({...n,[i]:le(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",i]})??Qe(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let r={type:"object",additionalProperties:le(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if(t.target==="openApi3")return r;if(e.keyType?._def.typeName===z.ZodString&&e.keyType._def.checks?.length){let{type:n,...i}=Zl(e.keyType._def,t);return{...r,propertyNames:i}}else{if(e.keyType?._def.typeName===z.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===z.ZodBranded&&e.keyType._def.type._def.typeName===z.ZodString&&e.keyType._def.type._def.checks?.length){let{type:n,...i}=Vl(e.keyType._def,t);return{...r,propertyNames:i}}}return r}function Bw(e,t){return t.mapStrategy==="record"?Hl(e,t):{type:"array",maxItems:125,items:{type:"array",items:[le(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Qe(t),le(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Qe(t)],minItems:2,maxItems:2}}}function Vw(e){let t=e.values,r=Object.keys(e.values).filter(i=>typeof t[t[i]]!="number").map(i=>t[i]),n=Array.from(new Set(r.map(i=>typeof i)));return{type:n.length===1?n[0]==="string"?"string":"number":["string","number"],enum:r}}function Zw(e){return e.target==="openAi"?void 0:{not:Qe({...e,currentPath:[...e.currentPath,"not"]})}}function Hw(e){return e.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var nc={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Gw(e,t){if(t.target==="openApi3")return WA(e,t);let r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every(n=>n._def.typeName in nc&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((i,a)=>{let o=nc[a._def.typeName];return o&&!i.includes(o)?[...i,o]:i},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((i,a)=>{let o=typeof a._def.value;switch(o){case"string":case"number":case"boolean":return[...i,o];case"bigint":return[...i,"integer"];case"object":return a._def.value===null?[...i,"null"]:i;default:return i}},[]);if(n.length===r.length){let i=n.filter((a,o,s)=>s.indexOf(a)===o);return{type:i.length>1?i:i[0],enum:r.reduce((a,o)=>a.includes(o._def.value)?a:[...a,o._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,i)=>[...n,...i._def.values.filter(a=>!n.includes(a))],[])};return WA(e,t)}var WA=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((n,i)=>le(n._def,{...t,currentPath:[...t.currentPath,"anyOf",`${i}`]})).filter(n=>!!n&&(!t.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function Ww(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return t.target==="openApi3"?{type:nc[e.innerType._def.typeName],nullable:!0}:{type:[nc[e.innerType._def.typeName],"null"]};if(t.target==="openApi3"){let n=le(e.innerType._def,{...t,currentPath:[...t.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=le(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function Jw(e,t){let r={type:"number"};if(!e.checks)return r;for(let n of e.checks)switch(n.kind){case"int":r.type="integer",Op(r,"type",n.message,t);break;case"min":t.target==="jsonSchema7"?n.inclusive?Me(r,"minimum",n.value,n.message,t):Me(r,"exclusiveMinimum",n.value,n.message,t):(n.inclusive||(r.exclusiveMinimum=!0),Me(r,"minimum",n.value,n.message,t));break;case"max":t.target==="jsonSchema7"?n.inclusive?Me(r,"maximum",n.value,n.message,t):Me(r,"exclusiveMaximum",n.value,n.message,t):(n.inclusive||(r.exclusiveMaximum=!0),Me(r,"maximum",n.value,n.message,t));break;case"multipleOf":Me(r,"multipleOf",n.value,n.message,t);break}return r}function Kw(e,t){let r=t.target==="openAi",n={type:"object",properties:{}},i=[],a=e.shape();for(let s in a){let c=a[s];if(c===void 0||c._def===void 0)continue;let l=z6(c);l&&r&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),l=!1);let u=le(c._def,{...t,currentPath:[...t.currentPath,"properties",s],propertyPath:[...t.currentPath,"properties",s]});u!==void 0&&(n.properties[s]=u,l||i.push(s))}i.length&&(n.required=i);let o=D6(e,t);return o!==void 0&&(n.additionalProperties=o),n}function D6(e,t){if(e.catchall._def.typeName!=="ZodNever")return le(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function z6(e){try{return e.isOptional()}catch{return!0}}var qw=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return le(e.innerType._def,t);let r=le(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Qe(t)},r]}:Qe(t)};var Yw=(e,t)=>{if(t.pipeStrategy==="input")return le(e.in._def,t);if(t.pipeStrategy==="output")return le(e.out._def,t);let r=le(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[r,le(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]})].filter(n=>n!==void 0)}};function Xw(e,t){return le(e.type._def,t)}function Qw(e,t){let r={type:"array",uniqueItems:!0,items:le(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&Me(r,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&Me(r,"maxItems",e.maxSize.value,e.maxSize.message,t),r}function ex(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((r,n)=>le(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:le(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,n)=>le(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function tx(e){return{not:Qe(e)}}function rx(e){return Qe(e)}var nx=(e,t)=>le(e.innerType._def,t);var ix=(e,t,r)=>{switch(t){case z.ZodString:return Zl(e,r);case z.ZodNumber:return Jw(e,r);case z.ZodObject:return Kw(e,r);case z.ZodBigInt:return Pw(e,r);case z.ZodBoolean:return Nw();case z.ZodDate:return Dp(e,r);case z.ZodUndefined:return tx(r);case z.ZodNull:return Hw(r);case z.ZodArray:return Ow(e,r);case z.ZodUnion:case z.ZodDiscriminatedUnion:return Gw(e,r);case z.ZodIntersection:return zw(e,r);case z.ZodTuple:return ex(e,r);case z.ZodRecord:return Hl(e,r);case z.ZodLiteral:return Uw(e,r);case z.ZodEnum:return Dw(e);case z.ZodNativeEnum:return Vw(e);case z.ZodNullable:return Ww(e,r);case z.ZodOptional:return qw(e,r);case z.ZodMap:return Bw(e,r);case z.ZodSet:return Qw(e,r);case z.ZodLazy:return()=>e.getter()._def;case z.ZodPromise:return Xw(e,r);case z.ZodNaN:case z.ZodNever:return Zw(r);case z.ZodEffects:return jw(e,r);case z.ZodAny:return Qe(r);case z.ZodUnknown:return rx(r);case z.ZodDefault:return Mw(e,r);case z.ZodBranded:return Vl(e,r);case z.ZodReadonly:return nx(e,r);case z.ZodCatch:return Rw(e,r);case z.ZodPipeline:return Yw(e,r);case z.ZodFunction:case z.ZodVoid:case z.ZodSymbol:return;default:return(n=>{})(t)}};function le(e,t,r=!1){let n=t.seen.get(e);if(t.override){let s=t.override?.(e,t,n,r);if(s!==Ew)return s}if(n&&!r){let s=U6(n,t);if(s!==void 0)return s}let i={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,i);let a=ix(e,e.typeName,t),o=typeof a=="function"?le(a(),t):a;if(o&&L6(e,t,o),t.postProcess){let s=t.postProcess(o,e,t);return i.jsonSchema=o,s}return i.jsonSchema=o,o}var U6=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Ul(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((r,n)=>t.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Qe(t)):t.$refStrategy==="seen"?Qe(t):void 0}},L6=(e,t,r)=>(e.description&&(r.description=e.description,t.markdownDescription&&(r.markdownDescription=e.description)),r);var ax=(e,t)=>{let r=Iw(t),n=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((c,[l,u])=>({...c,[l]:le(u._def,{...r,currentPath:[...r.basePath,r.definitionPath,l]},!0)??Qe(r)}),{}):void 0,i=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,a=le(e._def,i===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,i]},!1)??Qe(r),o=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;o!==void 0&&(a.title=o),r.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[r.openAiAnyTypeName]||(n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));let s=i===void 0?n?{...a,[r.definitionPath]:n}:a:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,i].join("/"),[r.definitionPath]:{...n,[i]:a}};return r.target==="jsonSchema7"?s.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(s.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in s||"oneOf"in s||"allOf"in s||"type"in s&&Array.isArray(s.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),s};function qn(e,t){let r=typeof e;if(r!==typeof t)return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let n=e.length;if(n!==t.length)return!1;for(let i=0;i<n;i++)if(!qn(e[i],t[i]))return!1;return!0}if(r==="object"){if(!e||!t)return e===t;let n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(let o of n)if(!qn(e[o],t[o]))return!1;return!0}return e===t}function Ur(e){return encodeURI(F6(e))}function F6(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var B6={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},V6={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},Z6={id:!0,$id:!0,$ref:!0,$schema:!0,$anchor:!0,$vocabulary:!0,$comment:!0,default:!0,enum:!0,const:!0,required:!0,type:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0},H6=typeof self<"u"&&self.location&&self.location.origin!=="null"?new URL(self.location.origin+self.location.pathname+location.search):new URL("https://github.com/cfworker");function yn(e,t=Object.create(null),r=H6,n=""){if(e&&typeof e=="object"&&!Array.isArray(e)){let a=e.$id||e.id;if(a){let o=new URL(a,r.href);o.hash.length>1?t[o.href]=e:(o.hash="",n===""?r=o:yn(e,t,r))}}else if(e!==!0&&e!==!1)return t;let i=r.href+(n?"#"+n:"");if(t[i]!==void 0)throw new Error(`Duplicate schema URI "${i}".`);if(t[i]=e,e===!0||e===!1)return t;if(e.__absolute_uri__===void 0&&Object.defineProperty(e,"__absolute_uri__",{enumerable:!1,value:i}),e.$ref&&e.__absolute_ref__===void 0){let a=new URL(e.$ref,r.href);a.hash=a.hash,Object.defineProperty(e,"__absolute_ref__",{enumerable:!1,value:a.href})}if(e.$recursiveRef&&e.__absolute_recursive_ref__===void 0){let a=new URL(e.$recursiveRef,r.href);a.hash=a.hash,Object.defineProperty(e,"__absolute_recursive_ref__",{enumerable:!1,value:a.href})}if(e.$anchor){let a=new URL("#"+e.$anchor,r.href);t[a.href]=e}for(let a in e){if(Z6[a])continue;let o=`${n}/${Ur(a)}`,s=e[a];if(Array.isArray(s)){if(B6[a]){let c=s.length;for(let l=0;l<c;l++)yn(s[l],t,r,`${o}/${l}`)}}else if(V6[a])for(let c in s)yn(s[c],t,r,`${o}/${Ur(c)}`);else yn(s,t,r,o)}return t}var G6=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,W6=[0,31,28,31,30,31,30,31,31,30,31,30,31],J6=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,K6=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,q6=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,Y6=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,X6=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,Q6=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,eF=/^(?:\/(?:[^~/]|~0|~1)*)*$/,tF=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,rF=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,nF=e=>{if(e[0]==='"')return!1;let[t,r,...n]=e.split("@");return!t||!r||n.length!==0||t.length>64||r.length>253||t[0]==="."||t.endsWith(".")||t.includes("..")||!/^[a-z0-9.-]+$/i.test(r)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(t)?!1:r.split(".").every(i=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(i))},iF=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,aF=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,oF=e=>e.length>1&&e.length<80&&(/^P\d+([.,]\d+)?W$/.test(e)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(e)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(e));function Yn(e){return e.test.bind(e)}var ox={date:JA,time:KA.bind(void 0,!1),"date-time":lF,duration:oF,uri:fF,"uri-reference":Yn(q6),"uri-template":Yn(Y6),url:Yn(X6),email:nF,hostname:Yn(K6),ipv4:Yn(iF),ipv6:Yn(aF),regex:mF,uuid:Yn(Q6),"json-pointer":Yn(eF),"json-pointer-uri-fragment":Yn(tF),"relative-json-pointer":Yn(rF)};function sF(e){return e%4===0&&(e%100!==0||e%400===0)}function JA(e){let t=e.match(G6);if(!t)return!1;let r=+t[1],n=+t[2],i=+t[3];return n>=1&&n<=12&&i>=1&&i<=(n==2&&sF(r)?29:W6[n])}function KA(e,t){let r=t.match(J6);if(!r)return!1;let n=+r[1],i=+r[2],a=+r[3],o=!!r[5];return(n<=23&&i<=59&&a<=59||n==23&&i==59&&a==60)&&(!e||o)}var cF=/t|\s/i;function lF(e){let t=e.split(cF);return t.length==2&&JA(t[0])&&KA(!0,t[1])}var uF=/\/|:/,dF=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function fF(e){return uF.test(e)&&dF.test(e)}var pF=/[^\\]\\Z/;function mF(e){if(pF.test(e))return!1;try{return new RegExp(e,"u"),!0}catch{return!1}}var qA;(function(e){e[e.Flag=1]="Flag",e[e.Basic=2]="Basic",e[e.Detailed=4]="Detailed"})(qA||(qA={}));function YA(e){let t=0,r=e.length,n=0,i;for(;n<r;)t++,i=e.charCodeAt(n++),i>=55296&&i<=56319&&n<r&&(i=e.charCodeAt(n),(i&64512)==56320&&n++);return t}function We(e,t,r="2019-09",n=yn(t),i=!0,a=null,o="#",s="#",c=Object.create(null)){if(t===!0)return{valid:!0,errors:[]};if(t===!1)return{valid:!1,errors:[{instanceLocation:o,keyword:"false",keywordLocation:o,error:"False boolean schema."}]};let l=typeof e,u;switch(l){case"boolean":case"number":case"string":u=l;break;case"object":e===null?u="null":Array.isArray(e)?u="array":u="object";break;default:throw new Error(`Instances of "${l}" type are not supported.`)}let{$ref:d,$recursiveRef:f,$recursiveAnchor:p,type:m,const:h,enum:_,required:y,not:w,anyOf:x,allOf:S,oneOf:E,if:P,then:C,else:b,format:B,properties:L,patternProperties:q,additionalProperties:ae,unevaluatedProperties:Se,minProperties:Oe,maxProperties:mt,propertyNames:ye,dependentRequired:V,dependentSchemas:X,dependencies:ne,prefixItems:ie,items:Te,additionalItems:Tr,unevaluatedItems:Vi,contains:Zi,minContains:sn,maxContains:v,minItems:g,maxItems:O,uniqueItems:$,minimum:Ce,maximum:Ue,exclusiveMinimum:bt,exclusiveMaximum:dt,multipleOf:Ft,minLength:Br,maxLength:ft,pattern:An,__absolute_ref__:es,__absolute_recursive_ref__:Ku}=t,J=[];if(p===!0&&a===null&&(a=t),f==="#"){let ue=a===null?n[Ku]:a,oe=`${s}/$recursiveRef`,me=We(e,a===null?t:a,r,n,i,ue,o,oe,c);me.valid||J.push({instanceLocation:o,keyword:"$recursiveRef",keywordLocation:oe,error:"A subschema had errors."},...me.errors)}if(d!==void 0){let oe=n[es||d];if(oe===void 0){let W=`Unresolved $ref "${d}".`;throw es&&es!==d&&(W+=` Absolute URI "${es}".`),W+=`
223
+ Known schemas:
224
+ - ${Object.keys(n).join(`
225
+ - `)}`,new Error(W)}let me=`${s}/$ref`,Q=We(e,oe,r,n,i,a,o,me,c);if(Q.valid||J.push({instanceLocation:o,keyword:"$ref",keywordLocation:me,error:"A subschema had errors."},...Q.errors),r==="4"||r==="7")return{valid:J.length===0,errors:J}}if(Array.isArray(m)){let ue=m.length,oe=!1;for(let me=0;me<ue;me++)if(u===m[me]||m[me]==="integer"&&u==="number"&&e%1===0&&e===e){oe=!0;break}oe||J.push({instanceLocation:o,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${u}" is invalid. Expected "${m.join('", "')}".`})}else m==="integer"?(u!=="number"||e%1||e!==e)&&J.push({instanceLocation:o,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${u}" is invalid. Expected "${m}".`}):m!==void 0&&u!==m&&J.push({instanceLocation:o,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${u}" is invalid. Expected "${m}".`});if(h!==void 0&&(u==="object"||u==="array"?qn(e,h)||J.push({instanceLocation:o,keyword:"const",keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(h)}.`}):e!==h&&J.push({instanceLocation:o,keyword:"const",keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(h)}.`})),_!==void 0&&(u==="object"||u==="array"?_.some(ue=>qn(e,ue))||J.push({instanceLocation:o,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(_)}.`}):_.some(ue=>e===ue)||J.push({instanceLocation:o,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(_)}.`})),w!==void 0){let ue=`${s}/not`;We(e,w,r,n,i,a,o,ue).valid&&J.push({instanceLocation:o,keyword:"not",keywordLocation:ue,error:'Instance matched "not" schema.'})}let Ba=[];if(x!==void 0){let ue=`${s}/anyOf`,oe=J.length,me=!1;for(let Q=0;Q<x.length;Q++){let W=x[Q],fe=Object.create(c),de=We(e,W,r,n,i,p===!0?a:null,o,`${ue}/${Q}`,fe);J.push(...de.errors),me=me||de.valid,de.valid&&Ba.push(fe)}me?J.length=oe:J.splice(oe,0,{instanceLocation:o,keyword:"anyOf",keywordLocation:ue,error:"Instance does not match any subschemas."})}if(S!==void 0){let ue=`${s}/allOf`,oe=J.length,me=!0;for(let Q=0;Q<S.length;Q++){let W=S[Q],fe=Object.create(c),de=We(e,W,r,n,i,p===!0?a:null,o,`${ue}/${Q}`,fe);J.push(...de.errors),me=me&&de.valid,de.valid&&Ba.push(fe)}me?J.length=oe:J.splice(oe,0,{instanceLocation:o,keyword:"allOf",keywordLocation:ue,error:"Instance does not match every subschema."})}if(E!==void 0){let ue=`${s}/oneOf`,oe=J.length,me=E.filter((Q,W)=>{let fe=Object.create(c),de=We(e,Q,r,n,i,p===!0?a:null,o,`${ue}/${W}`,fe);return J.push(...de.errors),de.valid&&Ba.push(fe),de.valid}).length;me===1?J.length=oe:J.splice(oe,0,{instanceLocation:o,keyword:"oneOf",keywordLocation:ue,error:`Instance does not match exactly one subschema (${me} matches).`})}if((u==="object"||u==="array")&&Object.assign(c,...Ba),P!==void 0){let ue=`${s}/if`;if(We(e,P,r,n,i,a,o,ue,c).valid){if(C!==void 0){let me=We(e,C,r,n,i,a,o,`${s}/then`,c);me.valid||J.push({instanceLocation:o,keyword:"if",keywordLocation:ue,error:'Instance does not match "then" schema.'},...me.errors)}}else if(b!==void 0){let me=We(e,b,r,n,i,a,o,`${s}/else`,c);me.valid||J.push({instanceLocation:o,keyword:"if",keywordLocation:ue,error:'Instance does not match "else" schema.'},...me.errors)}}if(u==="object"){if(y!==void 0)for(let Q of y)Q in e||J.push({instanceLocation:o,keyword:"required",keywordLocation:`${s}/required`,error:`Instance does not have required property "${Q}".`});let ue=Object.keys(e);if(Oe!==void 0&&ue.length<Oe&&J.push({instanceLocation:o,keyword:"minProperties",keywordLocation:`${s}/minProperties`,error:`Instance does not have at least ${Oe} properties.`}),mt!==void 0&&ue.length>mt&&J.push({instanceLocation:o,keyword:"maxProperties",keywordLocation:`${s}/maxProperties`,error:`Instance does not have at least ${mt} properties.`}),ye!==void 0){let Q=`${s}/propertyNames`;for(let W in e){let fe=`${o}/${Ur(W)}`,de=We(W,ye,r,n,i,a,fe,Q);de.valid||J.push({instanceLocation:o,keyword:"propertyNames",keywordLocation:Q,error:`Property name "${W}" does not match schema.`},...de.errors)}}if(V!==void 0){let Q=`${s}/dependantRequired`;for(let W in V)if(W in e){let fe=V[W];for(let de of fe)de in e||J.push({instanceLocation:o,keyword:"dependentRequired",keywordLocation:Q,error:`Instance has "${W}" but does not have "${de}".`})}}if(X!==void 0)for(let Q in X){let W=`${s}/dependentSchemas`;if(Q in e){let fe=We(e,X[Q],r,n,i,a,o,`${W}/${Ur(Q)}`,c);fe.valid||J.push({instanceLocation:o,keyword:"dependentSchemas",keywordLocation:W,error:`Instance has "${Q}" but does not match dependant schema.`},...fe.errors)}}if(ne!==void 0){let Q=`${s}/dependencies`;for(let W in ne)if(W in e){let fe=ne[W];if(Array.isArray(fe))for(let de of fe)de in e||J.push({instanceLocation:o,keyword:"dependencies",keywordLocation:Q,error:`Instance has "${W}" but does not have "${de}".`});else{let de=We(e,fe,r,n,i,a,o,`${Q}/${Ur(W)}`);de.valid||J.push({instanceLocation:o,keyword:"dependencies",keywordLocation:Q,error:`Instance has "${W}" but does not match dependant schema.`},...de.errors)}}}let oe=Object.create(null),me=!1;if(L!==void 0){let Q=`${s}/properties`;for(let W in L){if(!(W in e))continue;let fe=`${o}/${Ur(W)}`,de=We(e[W],L[W],r,n,i,a,fe,`${Q}/${Ur(W)}`);if(de.valid)c[W]=oe[W]=!0;else if(me=i,J.push({instanceLocation:o,keyword:"properties",keywordLocation:Q,error:`Property "${W}" does not match schema.`},...de.errors),me)break}}if(!me&&q!==void 0){let Q=`${s}/patternProperties`;for(let W in q){let fe=new RegExp(W,"u"),de=q[W];for(let gr in e){if(!fe.test(gr))continue;let kk=`${o}/${Ur(gr)}`,Ek=We(e[gr],de,r,n,i,a,kk,`${Q}/${Ur(W)}`);Ek.valid?c[gr]=oe[gr]=!0:(me=i,J.push({instanceLocation:o,keyword:"patternProperties",keywordLocation:Q,error:`Property "${gr}" matches pattern "${W}" but does not match associated schema.`},...Ek.errors))}}}if(!me&&ae!==void 0){let Q=`${s}/additionalProperties`;for(let W in e){if(oe[W])continue;let fe=`${o}/${Ur(W)}`,de=We(e[W],ae,r,n,i,a,fe,Q);de.valid?c[W]=!0:(me=i,J.push({instanceLocation:o,keyword:"additionalProperties",keywordLocation:Q,error:`Property "${W}" does not match additional properties schema.`},...de.errors))}}else if(!me&&Se!==void 0){let Q=`${s}/unevaluatedProperties`;for(let W in e)if(!c[W]){let fe=`${o}/${Ur(W)}`,de=We(e[W],Se,r,n,i,a,fe,Q);de.valid?c[W]=!0:J.push({instanceLocation:o,keyword:"unevaluatedProperties",keywordLocation:Q,error:`Property "${W}" does not match unevaluated properties schema.`},...de.errors)}}}else if(u==="array"){O!==void 0&&e.length>O&&J.push({instanceLocation:o,keyword:"maxItems",keywordLocation:`${s}/maxItems`,error:`Array has too many items (${e.length} > ${O}).`}),g!==void 0&&e.length<g&&J.push({instanceLocation:o,keyword:"minItems",keywordLocation:`${s}/minItems`,error:`Array has too few items (${e.length} < ${g}).`});let ue=e.length,oe=0,me=!1;if(ie!==void 0){let Q=`${s}/prefixItems`,W=Math.min(ie.length,ue);for(;oe<W;oe++){let fe=We(e[oe],ie[oe],r,n,i,a,`${o}/${oe}`,`${Q}/${oe}`);if(c[oe]=!0,!fe.valid&&(me=i,J.push({instanceLocation:o,keyword:"prefixItems",keywordLocation:Q,error:"Items did not match schema."},...fe.errors),me))break}}if(Te!==void 0){let Q=`${s}/items`;if(Array.isArray(Te)){let W=Math.min(Te.length,ue);for(;oe<W;oe++){let fe=We(e[oe],Te[oe],r,n,i,a,`${o}/${oe}`,`${Q}/${oe}`);if(c[oe]=!0,!fe.valid&&(me=i,J.push({instanceLocation:o,keyword:"items",keywordLocation:Q,error:"Items did not match schema."},...fe.errors),me))break}}else for(;oe<ue;oe++){let W=We(e[oe],Te,r,n,i,a,`${o}/${oe}`,Q);if(c[oe]=!0,!W.valid&&(me=i,J.push({instanceLocation:o,keyword:"items",keywordLocation:Q,error:"Items did not match schema."},...W.errors),me))break}if(!me&&Tr!==void 0){let W=`${s}/additionalItems`;for(;oe<ue;oe++){let fe=We(e[oe],Tr,r,n,i,a,`${o}/${oe}`,W);c[oe]=!0,fe.valid||(me=i,J.push({instanceLocation:o,keyword:"additionalItems",keywordLocation:W,error:"Items did not match additional items schema."},...fe.errors))}}}if(Zi!==void 0)if(ue===0&&sn===void 0)J.push({instanceLocation:o,keyword:"contains",keywordLocation:`${s}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(sn!==void 0&&ue<sn)J.push({instanceLocation:o,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array has less items (${ue}) than minContains (${sn}).`});else{let Q=`${s}/contains`,W=J.length,fe=0;for(let de=0;de<ue;de++){let gr=We(e[de],Zi,r,n,i,a,`${o}/${de}`,Q);gr.valid?(c[de]=!0,fe++):J.push(...gr.errors)}fe>=(sn||0)&&(J.length=W),sn===void 0&&v===void 0&&fe===0?J.splice(W,0,{instanceLocation:o,keyword:"contains",keywordLocation:Q,error:"Array does not contain item matching schema."}):sn!==void 0&&fe<sn?J.push({instanceLocation:o,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array must contain at least ${sn} items matching schema. Only ${fe} items were found.`}):v!==void 0&&fe>v&&J.push({instanceLocation:o,keyword:"maxContains",keywordLocation:`${s}/maxContains`,error:`Array may contain at most ${v} items matching schema. ${fe} items were found.`})}if(!me&&Vi!==void 0){let Q=`${s}/unevaluatedItems`;for(oe;oe<ue;oe++){if(c[oe])continue;let W=We(e[oe],Vi,r,n,i,a,`${o}/${oe}`,Q);c[oe]=!0,W.valid||J.push({instanceLocation:o,keyword:"unevaluatedItems",keywordLocation:Q,error:"Items did not match unevaluated items schema."},...W.errors)}}if($)for(let Q=0;Q<ue;Q++){let W=e[Q],fe=typeof W=="object"&&W!==null;for(let de=0;de<ue;de++){if(Q===de)continue;let gr=e[de];(W===gr||fe&&(typeof gr=="object"&&gr!==null)&&qn(W,gr))&&(J.push({instanceLocation:o,keyword:"uniqueItems",keywordLocation:`${s}/uniqueItems`,error:`Duplicate items at indexes ${Q} and ${de}.`}),Q=Number.MAX_SAFE_INTEGER,de=Number.MAX_SAFE_INTEGER)}}}else if(u==="number"){if(r==="4"?(Ce!==void 0&&(bt===!0&&e<=Ce||e<Ce)&&J.push({instanceLocation:o,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${e} is less than ${bt?"or equal to ":""} ${Ce}.`}),Ue!==void 0&&(dt===!0&&e>=Ue||e>Ue)&&J.push({instanceLocation:o,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${e} is greater than ${dt?"or equal to ":""} ${Ue}.`})):(Ce!==void 0&&e<Ce&&J.push({instanceLocation:o,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${e} is less than ${Ce}.`}),Ue!==void 0&&e>Ue&&J.push({instanceLocation:o,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${e} is greater than ${Ue}.`}),bt!==void 0&&e<=bt&&J.push({instanceLocation:o,keyword:"exclusiveMinimum",keywordLocation:`${s}/exclusiveMinimum`,error:`${e} is less than ${bt}.`}),dt!==void 0&&e>=dt&&J.push({instanceLocation:o,keyword:"exclusiveMaximum",keywordLocation:`${s}/exclusiveMaximum`,error:`${e} is greater than or equal to ${dt}.`})),Ft!==void 0){let ue=e%Ft;Math.abs(0-ue)>=11920929e-14&&Math.abs(Ft-ue)>=11920929e-14&&J.push({instanceLocation:o,keyword:"multipleOf",keywordLocation:`${s}/multipleOf`,error:`${e} is not a multiple of ${Ft}.`})}}else if(u==="string"){let ue=Br===void 0&&ft===void 0?0:YA(e);Br!==void 0&&ue<Br&&J.push({instanceLocation:o,keyword:"minLength",keywordLocation:`${s}/minLength`,error:`String is too short (${ue} < ${Br}).`}),ft!==void 0&&ue>ft&&J.push({instanceLocation:o,keyword:"maxLength",keywordLocation:`${s}/maxLength`,error:`String is too long (${ue} > ${ft}).`}),An!==void 0&&!new RegExp(An,"u").test(e)&&J.push({instanceLocation:o,keyword:"pattern",keywordLocation:`${s}/pattern`,error:"String does not match pattern."}),B!==void 0&&ox[B]&&!ox[B](e)&&J.push({instanceLocation:o,keyword:"format",keywordLocation:`${s}/format`,error:`String does not match format "${B}".`})}return{valid:J.length===0,errors:J}}var zp=class{schema;draft;shortCircuit;lookup;constructor(t,r="2019-09",n=!0){this.schema=t,this.draft=r,this.shortCircuit=n,this.lookup=yn(t)}validate(t){return We(t,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(t,r){r&&(t={...t,$id:r}),yn(t,this.lookup)}};var QA=T({Validator:()=>zp,deepCompareStrict:()=>qn,toJsonSchema:()=>It,validatesOnlyStrings:()=>ic}),XA=new WeakMap;function It(e,t){let r=!t&&e!=null&&typeof e=="object";if(r){let i=XA.get(e);if(i)return i}let n;if(xf(e)&&!Ge(e))n=e["~standard"].jsonSchema.input({target:"draft-07"});else if(Ge(e)){let i=Cp(e,!0);Kr(i)?n=ko(Ws(i,!0),t):n=ko(e,t)}else lt(e)?n=ax(e):n=e;return r&&n!=null&&typeof n=="object"&&XA.set(e,n),n}function ic(e){if(!e||typeof e!="object"||Object.keys(e).length===0||Array.isArray(e))return!1;if("type"in e)return typeof e.type=="string"?e.type==="string":Array.isArray(e.type)?e.type.every(t=>t==="string"):!1;if("enum"in e)return Array.isArray(e.enum)&&e.enum.length>0&&e.enum.every(t=>typeof t=="string");if("const"in e)return typeof e.const=="string";if("allOf"in e&&Array.isArray(e.allOf))return e.allOf.some(t=>ic(t));if("anyOf"in e&&Array.isArray(e.anyOf)||"oneOf"in e&&Array.isArray(e.oneOf)){let t="anyOf"in e?e.anyOf:e.oneOf;return t.length>0&&t.every(r=>ic(r))}if("not"in e)return!1;if("$ref"in e&&typeof e.$ref=="string"){let t=e.$ref,r=yn(e);return r[t]?ic(r[t]):!1}return!1}function Gl(e){return e?e.lc_runnable:!1}var eO=class{includeNames;includeTypes;includeTags;excludeNames;excludeTypes;excludeTags;constructor(e){this.includeNames=e.includeNames,this.includeTypes=e.includeTypes,this.includeTags=e.includeTags,this.excludeNames=e.excludeNames,this.excludeTypes=e.excludeTypes,this.excludeTags=e.excludeTags}includeEvent(e,t){let r=this.includeNames===void 0&&this.includeTypes===void 0&&this.includeTags===void 0,n=e.tags??[];return this.includeNames!==void 0&&(r=r||this.includeNames.includes(e.name)),this.includeTypes!==void 0&&(r=r||this.includeTypes.includes(t)),this.includeTags!==void 0&&(r=r||n.some(i=>this.includeTags?.includes(i))),this.excludeNames!==void 0&&(r=r&&!this.excludeNames.includes(e.name)),this.excludeTypes!==void 0&&(r=r&&!this.excludeTypes.includes(t)),this.excludeTags!==void 0&&(r=r&&n.every(i=>!this.excludeTags?.includes(i))),r}},tO=e=>btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");function sx(e){return e.replace(/[^a-zA-Z-_0-9]/g,"_")}var hF=["*","_","`"];function gF(e){let t="";for(let[r,n]of Object.entries(e))t+=` classDef ${r} ${n};
226
+ `;return t}function rO(e,t,r){let{firstNode:n,lastNode:i,nodeColors:a,withStyles:o=!0,curveStyle:s="linear",wrapLabelNWords:c=9}=r??{},l=o?`%%{init: {'flowchart': {'curve': '${s}'}}}%%
227
+ graph TD;
228
+ `:`graph TD;
229
+ `;if(o){let m="default",h={[m]:"{0}({1})"};n!==void 0&&(h[n]="{0}([{1}]):::first"),i!==void 0&&(h[i]="{0}([{1}]):::last");for(let[_,y]of Object.entries(e)){let w=y.name.split(":").pop()??"",x=hF.some(E=>w.startsWith(E)&&w.endsWith(E))?`<p>${w}</p>`:w;Object.keys(y.metadata??{}).length&&(x+=`<hr/><small><em>${Object.entries(y.metadata??{}).map(([E,P])=>`${E} = ${P}`).join(`
230
+ `)}</em></small>`);let S=(h[_]??h[m]).replace("{0}",sx(_)).replace("{1}",x);l+=` ${S}
231
+ `}}let u={};for(let m of t){let h=m.source.split(":"),_=m.target.split(":"),y=h.filter((w,x)=>w===_[x]).join(":");u[y]||(u[y]=[]),u[y].push(m)}let d=new Set;function f(m){return[...m].sort((h,_)=>h.split(":").length-_.split(":").length)}function p(m,h){let _=m.length===1&&m[0].source===m[0].target;if(h&&!_){let w=h.split(":").pop();if(d.has(h))throw new Error(`Found duplicate subgraph '${w}' at '${h} -- this likely means that you're reusing a subgraph node with the same name. Please adjust your graph to have subgraph nodes with unique names.`);d.add(h),l+=` subgraph ${w}
232
+ `}let y=f(Object.keys(u).filter(w=>w.startsWith(`${h}:`)&&w!==h&&w.split(":").length===h.split(":").length+1));for(let w of y)p(u[w],w);for(let w of m){let{source:x,target:S,data:E,conditional:P}=w,C="";if(E!==void 0){let b=E,B=b.split(" ");B.length>c&&(b=Array.from({length:Math.ceil(B.length/c)},(L,q)=>B.slice(q*c,(q+1)*c).join(" ")).join("&nbsp;<br>&nbsp;")),C=P?` -. &nbsp;${b}&nbsp; .-> `:` -- &nbsp;${b}&nbsp; --> `}else C=P?" -.-> ":" --> ";l+=` ${sx(x)}${C}${sx(S)};
233
+ `}h&&!_&&(l+=` end
234
+ `)}p(u[""]??[],"");for(let m in u)!m.includes(":")&&m!==""&&p(u[m],m);return o&&(l+=gF(a??{})),l}async function nO(e,t){let r=t?.backgroundColor??"white",n=t?.imageType??"png",i=tO(e);r!==void 0&&(/^#(?:[0-9a-fA-F]{3}){1,2}$/.test(r)||(r=`!${r}`));let a=`https://mermaid.ink/img/${i}?bgColor=${r}&type=${n}`,o=await fetch(a);if(!o.ok)throw new Error(["Failed to render the graph using the Mermaid.INK API.",`Status code: ${o.status}`,`Status text: ${o.statusText}`].join(`
235
+ `));return await o.blob()}var oO=T({Graph:()=>Bo});function _F(e,t){if(e!==void 0&&!di(e))return e;if(Gl(t))try{let r=t.getName();return r=r.startsWith("Runnable")?r.slice(8):r,r}catch{return t.getName()}else return t.name??"UnknownSchema"}function yF(e){return Gl(e.data)?{type:"runnable",data:{id:e.data.lc_id,name:e.data.getName()}}:{type:"schema",data:{...It(e.data.schema),title:e.data.name}}}var Bo=class sO{nodes={};edges=[];constructor(t){this.nodes=t?.nodes??this.nodes,this.edges=t?.edges??this.edges}toJSON(){let t={};return Object.values(this.nodes).forEach((r,n)=>{t[r.id]=di(r.id)?n:r.id}),{nodes:Object.values(this.nodes).map(r=>({id:t[r.id],...yF(r)})),edges:this.edges.map(r=>{let n={source:t[r.source],target:t[r.target]};return typeof r.data<"u"&&(n.data=r.data),typeof r.conditional<"u"&&(n.conditional=r.conditional),n})}}addNode(t,r,n){if(r!==void 0&&this.nodes[r]!==void 0)throw new Error(`Node with id ${r} already exists`);let i=r??ea(),a={id:i,data:t,name:_F(r,t),metadata:n};return this.nodes[i]=a,a}removeNode(t){delete this.nodes[t.id],this.edges=this.edges.filter(r=>r.source!==t.id&&r.target!==t.id)}addEdge(t,r,n,i){if(this.nodes[t.id]===void 0)throw new Error(`Source node ${t.id} not in graph`);if(this.nodes[r.id]===void 0)throw new Error(`Target node ${r.id} not in graph`);let a={source:t.id,target:r.id,data:n,conditional:i};return this.edges.push(a),a}firstNode(){return iO(this)}lastNode(){return aO(this)}extend(t,r=""){let n=r;Object.values(t.nodes).map(c=>c.id).every(di)&&(n="");let i=c=>n?`${n}:${c}`:c;Object.entries(t.nodes).forEach(([c,l])=>{this.nodes[i(c)]={...l,id:i(c)}});let a=t.edges.map(c=>({...c,source:i(c.source),target:i(c.target)}));this.edges=[...this.edges,...a];let o=t.firstNode(),s=t.lastNode();return[o?{id:i(o.id),data:o.data}:void 0,s?{id:i(s.id),data:s.data}:void 0]}trimFirstNode(){let t=this.firstNode();t&&iO(this,[t.id])&&this.removeNode(t)}trimLastNode(){let t=this.lastNode();t&&aO(this,[t.id])&&this.removeNode(t)}reid(){let t=Object.fromEntries(Object.values(this.nodes).map(i=>[i.id,i.name])),r=new Map;Object.values(t).forEach(i=>{r.set(i,(r.get(i)||0)+1)});let n=i=>{let a=t[i];return di(i)&&r.get(a)===1?a:i};return new sO({nodes:Object.fromEntries(Object.entries(this.nodes).map(([i,a])=>[n(i),{...a,id:n(i)}])),edges:this.edges.map(i=>({...i,source:n(i.source),target:n(i.target)}))})}drawMermaid(t){let{withStyles:r,curveStyle:n,nodeColors:i={default:"fill:#f2f0ff,line-height:1.2",first:"fill-opacity:0",last:"fill:#bfb6fc"},wrapLabelNWords:a}=t??{},o=this.reid(),s=o.firstNode(),c=o.lastNode();return rO(o.nodes,o.edges,{firstNode:s?.id,lastNode:c?.id,withStyles:r,curveStyle:n,nodeColors:i,wrapLabelNWords:a})}async drawMermaidPng(t){return nO(this.drawMermaid(t),{backgroundColor:t?.backgroundColor})}};function iO(e,t=[]){let r=new Set(e.edges.filter(i=>!t.includes(i.source)).map(i=>i.target)),n=[];for(let i of Object.values(e.nodes))!t.includes(i.id)&&!r.has(i.id)&&n.push(i);return n.length===1?n[0]:void 0}function aO(e,t=[]){let r=new Set(e.edges.filter(i=>!t.includes(i.target)).map(i=>i.source)),n=[];for(let i of Object.values(e.nodes))!t.includes(i.id)&&!r.has(i.id)&&n.push(i);return n.length===1?n[0]:void 0}function Up({name:e,serialized:t}){return e!==void 0?e:t?.name!==void 0?t.name:t?.id!==void 0&&Array.isArray(t?.id)?t.id[t.id.length-1]:"Unnamed"}var cO=e=>e.name==="event_stream_tracer",lO=class extends zt{autoClose=!0;includeNames;includeTypes;includeTags;excludeNames;excludeTypes;excludeTags;runInfoMap=new Map;tappedPromises=new Map;transformStream;writer;receiveStream;readableStreamClosed=!1;name="event_stream_tracer";lc_prefer_streaming=!0;constructor(e){super({_awaitHandler:!0,...e}),this.autoClose=e?.autoClose??!0,this.includeNames=e?.includeNames,this.includeTypes=e?.includeTypes,this.includeTags=e?.includeTags,this.excludeNames=e?.excludeNames,this.excludeTypes=e?.excludeTypes,this.excludeTags=e?.excludeTags,this.transformStream=new TransformStream({flush:()=>{this.readableStreamClosed=!0}}),this.writer=this.transformStream.writable.getWriter(),this.receiveStream=gt.fromReadableStream(this.transformStream.readable)}[Symbol.asyncIterator](){return this.receiveStream}async persistRun(e){}_includeRun(e){let t=e.tags??[],r=this.includeNames===void 0&&this.includeTags===void 0&&this.includeTypes===void 0;return this.includeNames!==void 0&&(r=r||this.includeNames.includes(e.name)),this.includeTypes!==void 0&&(r=r||this.includeTypes.includes(e.runType)),this.includeTags!==void 0&&(r=r||t.find(n=>this.includeTags?.includes(n))!==void 0),this.excludeNames!==void 0&&(r=r&&!this.excludeNames.includes(e.name)),this.excludeTypes!==void 0&&(r=r&&!this.excludeTypes.includes(e.runType)),this.excludeTags!==void 0&&(r=r&&t.every(n=>!this.excludeTags?.includes(n))),r}async*tapOutputIterable(e,t){let r=await t.next();if(r.done)return;let n=this.runInfoMap.get(e);if(n===void 0){yield r.value;return}function i(o,s){return o==="llm"&&typeof s=="string"?new bi({text:s}):s}let a=this.tappedPromises.get(e);if(a===void 0){let o;a=new Promise(s=>{o=s}),this.tappedPromises.set(e,a);try{let s={event:`on_${n.runType}_stream`,run_id:e,name:n.name,tags:n.tags,metadata:n.metadata,data:{}};await this.send({...s,data:{chunk:i(n.runType,r.value)}},n),yield r.value;for await(let c of t)n.runType!=="tool"&&n.runType!=="retriever"&&await this.send({...s,data:{chunk:i(n.runType,c)}},n),yield c}finally{o?.()}}else{yield r.value;for await(let o of t)yield o}}async send(e,t){this.readableStreamClosed||this._includeRun(t)&&await this.writer.write(e)}async sendEndEvent(e,t){let r=this.tappedPromises.get(e.run_id);r!==void 0?r.then(()=>{this.send(e,t)}):await this.send(e,t)}async onLLMStart(e){let t=Up(e),r=e.inputs.messages!==void 0?"chat_model":"llm",n={tags:e.tags??[],metadata:e.extra?.metadata??{},name:t,runType:r,inputs:e.inputs};this.runInfoMap.set(e.id,n);let i=`on_${r}_start`;await this.send({event:i,data:{input:e.inputs},name:t,tags:e.tags??[],run_id:e.id,metadata:e.extra?.metadata??{}},n)}async onLLMNewToken(e,t,r){let n=this.runInfoMap.get(e.id),i,a;if(n===void 0)throw new Error(`onLLMNewToken: Run ID ${e.id} not found in run map.`);if(this.runInfoMap.size!==1){if(n.runType==="chat_model")a="on_chat_model_stream",r?.chunk===void 0?i=new it({content:t,id:`run-${e.id}`}):i=r.chunk.message;else if(n.runType==="llm")a="on_llm_stream",r?.chunk===void 0?i=new bi({text:t}):i=r.chunk;else throw new Error(`Unexpected run type ${n.runType}`);await this.send({event:a,data:{chunk:i},run_id:e.id,name:n.name,tags:n.tags,metadata:n.metadata},n)}}async onLLMEnd(e){let t=this.runInfoMap.get(e.id);this.runInfoMap.delete(e.id);let r;if(t===void 0)throw new Error(`onLLMEnd: Run ID ${e.id} not found in run map.`);let n=e.outputs?.generations,i;if(t.runType==="chat_model"){for(let a of n??[]){if(i!==void 0)break;i=a[0]?.message}r="on_chat_model_end"}else if(t.runType==="llm")i={generations:n?.map(a=>a.map(o=>({text:o.text,generationInfo:o.generationInfo}))),llmOutput:e.outputs?.llmOutput??{}},r="on_llm_end";else throw new Error(`onLLMEnd: Unexpected run type: ${t.runType}`);await this.sendEndEvent({event:r,data:{output:i,input:t.inputs},run_id:e.id,name:t.name,tags:t.tags,metadata:t.metadata},t)}async onChainStart(e){let t=Up(e),r=e.run_type??"chain",n={tags:e.tags??[],metadata:e.extra?.metadata??{},name:t,runType:e.run_type},i={};e.inputs.input===""&&Object.keys(e.inputs).length===1?(i={},n.inputs={}):e.inputs.input!==void 0?(i.input=e.inputs.input,n.inputs=e.inputs.input):(i.input=e.inputs,n.inputs=e.inputs),this.runInfoMap.set(e.id,n),await this.send({event:`on_${r}_start`,data:i,name:t,tags:e.tags??[],run_id:e.id,metadata:e.extra?.metadata??{}},n)}async onChainEnd(e){let t=this.runInfoMap.get(e.id);if(this.runInfoMap.delete(e.id),t===void 0)throw new Error(`onChainEnd: Run ID ${e.id} not found in run map.`);let r=`on_${e.run_type}_end`,n=e.inputs??t.inputs??{},i={output:e.outputs?.output??e.outputs,input:n};n.input&&Object.keys(n).length===1&&(i.input=n.input,t.inputs=n.input),await this.sendEndEvent({event:r,data:i,run_id:e.id,name:t.name,tags:t.tags,metadata:t.metadata??{}},t)}async onToolStart(e){let t=Up(e),r={tags:e.tags??[],metadata:e.extra?.metadata??{},name:t,runType:"tool",inputs:e.inputs??{}};this.runInfoMap.set(e.id,r),await this.send({event:"on_tool_start",data:{input:e.inputs??{}},name:t,run_id:e.id,tags:e.tags??[],metadata:e.extra?.metadata??{}},r)}async onToolEnd(e){let t=this.runInfoMap.get(e.id);if(this.runInfoMap.delete(e.id),t===void 0)throw new Error(`onToolEnd: Run ID ${e.id} not found in run map.`);if(t.inputs===void 0)throw new Error(`onToolEnd: Run ID ${e.id} is a tool call, and is expected to have traced inputs.`);let r=e.outputs?.output===void 0?e.outputs:e.outputs.output;await this.sendEndEvent({event:"on_tool_end",data:{output:r,input:t.inputs},run_id:e.id,name:t.name,tags:t.tags,metadata:t.metadata},t)}async onToolError(e){let t=this.runInfoMap.get(e.id);if(this.runInfoMap.delete(e.id),t===void 0)throw new Error(`onToolEnd: Run ID ${e.id} not found in run map.`);if(t.inputs===void 0)throw new Error(`onToolEnd: Run ID ${e.id} is a tool call, and is expected to have traced inputs.`);await this.sendEndEvent({event:"on_tool_error",data:{input:t.inputs,error:e.error},run_id:e.id,name:t.name,tags:t.tags,metadata:t.metadata},t)}async onRetrieverStart(e){let t=Up(e),r={tags:e.tags??[],metadata:e.extra?.metadata??{},name:t,runType:"retriever",inputs:{query:e.inputs.query}};this.runInfoMap.set(e.id,r),await this.send({event:"on_retriever_start",data:{input:{query:e.inputs.query}},name:t,tags:e.tags??[],run_id:e.id,metadata:e.extra?.metadata??{}},r)}async onRetrieverEnd(e){let t=this.runInfoMap.get(e.id);if(this.runInfoMap.delete(e.id),t===void 0)throw new Error(`onRetrieverEnd: Run ID ${e.id} not found in run map.`);await this.sendEndEvent({event:"on_retriever_end",data:{output:e.outputs?.documents??e.outputs,input:t.inputs},run_id:e.id,name:t.name,tags:t.tags,metadata:t.metadata},t)}async handleCustomEvent(e,t,r){let n=this.runInfoMap.get(r);if(n===void 0)throw new Error(`handleCustomEvent: Run ID ${r} not found in run map.`);await this.send({event:"on_custom_event",run_id:r,name:e,tags:n.tags,metadata:n.metadata,data:t},n)}async finish(){let e=[...this.tappedPromises.values()];Promise.all(e).finally(()=>{this.writer.close()})}};var cx=class extends zt{name="RootListenersTracer";rootId;config;argOnStart;argOnEnd;argOnError;constructor({config:e,onStart:t,onEnd:r,onError:n}){super({_awaitHandler:!0}),this.config=e,this.argOnStart=t,this.argOnEnd=r,this.argOnError=n}persistRun(e){return Promise.resolve()}async onRunCreate(e){this.rootId||(this.rootId=e.id,this.argOnStart&&await this.argOnStart(e,this.config))}async onRunUpdate(e){e.id===this.rootId&&(e.error?this.argOnError&&await this.argOnError(e,this.config):this.argOnEnd&&await this.argOnEnd(e,this.config))}};function uO(e){let t=new TextEncoder,r=new ReadableStream({async start(n){for await(let i of e)n.enqueue(t.encode(`event: data
236
+ data: ${JSON.stringify(i)}
237
+
238
+ `));n.enqueue(t.encode(`event: end
239
+
240
+ `)),n.close()}});return gt.fromReadableStream(r)}function lx(e){return typeof e=="object"&&e!==null&&typeof e[Symbol.iterator]=="function"&&typeof e.next=="function"}var dO=e=>e!=null&&typeof e=="object"&&"next"in e&&typeof e.next=="function";function Lp(e){return typeof e=="object"&&e!==null&&typeof e[Symbol.asyncIterator]=="function"}function ux(e){return e!=null&&typeof e=="object"&&typeof e.next=="function"}async function fO(e,t){try{let r=await e.next();for(;!r.done;)await t?.(r.value),r=await e.next();return r.value}finally{await e.return?.(void 0)}}function*dx(e,t){for(;;){let{value:r,done:n}=Re.runWithConfig(vr(e),t.next.bind(t),!0);if(n)break;yield r}}async function*Fp(e,t){let r=t[Symbol.asyncIterator]();for(;;){let{value:n,done:i}=await Re.runWithConfig(vr(e),r.next.bind(t),!0);if(i)break;yield n}}function _t(e,t){return e&&!Array.isArray(e)&&!(e instanceof Date)&&typeof e=="object"?e:{[t]:e}}var se=class extends pt{lc_runnable=!0;name;getName(e){let t=this.name??this.constructor.lc_name()??this.constructor.name;return e?`${t}${e}`:t}withRetry(e){return new Vp({bound:this,kwargs:{},config:{},maxAttemptNumber:e?.stopAfterAttempt,...e})}withConfig(e){return new en({bound:this,config:e,kwargs:{}})}withFallbacks(e){let t=Array.isArray(e)?e:e.fallbacks;return new fx({runnable:this,fallbacks:t})}_getOptionsList(e,t=0){if(Array.isArray(e)&&e.length!==t)throw new Error(`Passed "options" must be an array with the same length as the inputs, but got ${e.length} options for ${t} inputs`);if(Array.isArray(e))return e.map(ke);if(t>1&&!Array.isArray(e)&&e.runId){console.warn("Provided runId will be used only for the first element of the batch.");let r=Object.fromEntries(Object.entries(e).filter(([n])=>n!=="runId"));return Array.from({length:t},(n,i)=>ke(i===0?e:r))}return Array.from({length:t},()=>ke(e))}async batch(e,t,r){let n=this._getOptionsList(t??{},e.length),i=new wi({maxConcurrency:n[0]?.maxConcurrency??r?.maxConcurrency,onFailedAttempt:o=>{throw o}}),a=e.map((o,s)=>i.call(async()=>{try{return await this.invoke(o,n[s])}catch(c){if(r?.returnExceptions)return c;throw c}}));return Promise.all(a)}async*_streamIterator(e,t){yield this.invoke(e,t)}async stream(e,t){let r=ke(t),n=new ua({generator:this._streamIterator(e,r),config:r});return await n.setup,gt.fromAsyncGenerator(n)}_separateRunnableConfigFromCallOptions(e){let t;e===void 0?t=ke(e):t=ke({callbacks:e.callbacks,tags:e.tags,metadata:e.metadata,runName:e.runName,configurable:e.configurable,recursionLimit:e.recursionLimit,maxConcurrency:e.maxConcurrency,runId:e.runId,timeout:e.timeout,signal:e.signal});let r={...e};return delete r.callbacks,delete r.tags,delete r.metadata,delete r.runName,delete r.configurable,delete r.recursionLimit,delete r.maxConcurrency,delete r.runId,delete r.timeout,delete r.signal,[t,r]}async _callWithConfig(e,t,r){let n=ke(r),i=await(await Jt(n))?.handleChainStart(this.toJSON(),_t(t,"input"),n.runId,n?.runType,void 0,void 0,n?.runName??this.getName());delete n.runId;let a;try{a=await Rr(e.call(this,t,n,i),n.signal)}catch(o){throw await i?.handleChainError(o),o}return await i?.handleChainEnd(_t(a,"output")),a}async _batchWithConfig(e,t,r,n){let i=this._getOptionsList(r??{},t.length),a=await Promise.all(i.map(Jt)),o=await Promise.all(a.map(async(c,l)=>{let u=await c?.handleChainStart(this.toJSON(),_t(t[l],"input"),i[l].runId,i[l].runType,void 0,void 0,i[l].runName??this.getName());return delete i[l].runId,u})),s;try{s=await Rr(e.call(this,t,i,o,n),i?.[0]?.signal)}catch(c){throw await Promise.all(o.map(l=>l?.handleChainError(c))),c}return await Promise.all(o.map(c=>c?.handleChainEnd(_t(s,"output")))),s}_concatOutputChunks(e,t){return Mr(e,t)}async*_transformStreamWithConfig(e,t,r){let n,i=!0,a,o=!0,s=ke(r),c=await Jt(s),l=this;async function*u(){for await(let f of e){if(i)if(n===void 0)n=f;else try{n=l._concatOutputChunks(n,f)}catch{n=void 0,i=!1}yield f}}let d;try{let f=await $_(t.bind(this),u(),async()=>c?.handleChainStart(this.toJSON(),{input:""},s.runId,s.runType,void 0,void 0,s.runName??this.getName(),void 0,{lc_defers_inputs:!0}),s.signal,s);delete s.runId,d=f.setup;let p=d?.handlers.find(cO),m=f.output;p!==void 0&&d!==void 0&&(m=p.tapOutputIterable(d.runId,m));let h=d?.handlers.find(C_);h!==void 0&&d!==void 0&&(m=h.tapOutputIterable(d.runId,m));for await(let _ of m)if(yield _,o)if(a===void 0)a=_;else try{a=this._concatOutputChunks(a,_)}catch{a=void 0,o=!1}}catch(f){throw await d?.handleChainError(f,void 0,void 0,void 0,{inputs:_t(n,"input")}),f}await d?.handleChainEnd(a??{},void 0,void 0,void 0,{inputs:_t(n,"input")})}getGraph(e){let t=new Bo,r=t.addNode({name:`${this.getName()}Input`,schema:Rt.any()}),n=t.addNode(this),i=t.addNode({name:`${this.getName()}Output`,schema:Rt.any()});return t.addEdge(r,n),t.addEdge(n,i),t}pipe(e){return new Lr({first:this,last:at(e)})}pick(e){return this.pipe(new px(e))}assign(e){return this.pipe(new Jl(new Oa({steps:e})))}async*transform(e,t){let r;for await(let n of e)r===void 0?r=n:r=this._concatOutputChunks(r,n);yield*this._streamIterator(r,ke(t))}async*streamLog(e,t,r){let n=new vf({...r,autoClose:!1,_schemaFormat:"original"}),i=ke(t);yield*this._streamLog(e,n,i)}async*_streamLog(e,t,r){let{callbacks:n}=r;if(n===void 0)r.callbacks=[t];else if(Array.isArray(n))r.callbacks=n.concat([t]);else{let s=n.copy();s.addHandler(t,!0),r.callbacks=s}let i=this.stream(e,r);async function a(){try{let s=await i;for await(let c of s){let l=new Vn({ops:[{op:"add",path:"/streamed_output/-",value:c}]});await t.writer.write(l)}}finally{await t.writer.close()}}let o=a();try{for await(let s of t)yield s}finally{await o}}streamEvents(e,t,r){let n;if(t.version==="v1")n=this._streamEventsV1(e,t,r);else if(t.version==="v2")n=this._streamEventsV2(e,t,r);else throw new Error('Only versions "v1" and "v2" of the schema are currently supported.');return t.encoding==="text/event-stream"?uO(n):gt.fromAsyncGenerator(n)}async*_streamEventsV2(e,t,r){let n=new lO({...r,autoClose:!1}),i=ke(t),a=i.runId??Hr();i.runId=a;let o=i.callbacks;if(o===void 0)i.callbacks=[n];else if(Array.isArray(o))i.callbacks=o.concat(n);else{let p=o.copy();p.addHandler(n,!0),i.callbacks=p}let s=new AbortController,c=this;async function l(){let p;try{if(i.signal)if("any"in AbortSignal)p=AbortSignal.any([s.signal,i.signal]);else{let _=new AbortController;i.signal.addEventListener("abort",()=>_.abort(),{once:!0}),s.signal.addEventListener("abort",()=>_.abort(),{once:!0}),p=_.signal}else p=s.signal;let m=await c.stream(e,{...i,signal:p}),h=n.tapOutputIterable(a,m);for await(let _ of h)if(s.signal.aborted)break}finally{await n.finish()}}let u=l(),d=!1,f;try{for await(let p of n){if(!d){p.data.input=e,d=!0,f=p.run_id,yield p;continue}p.run_id===f&&p.event.endsWith("_end")&&p.data?.input&&delete p.data.input,yield p}}finally{s.abort(),await u}}async*_streamEventsV1(e,t,r){let n,i=!1,a=ke(t),o=a.tags??[],s=a.metadata??{},c=a.runName??this.getName(),l=new vf({...r,autoClose:!1,_schemaFormat:"streaming_events"}),u=new eO({...r}),d=this._streamLog(e,l,a);for await(let p of d){if(n?n=n.concat(p):n=yf.fromRunLogPatch(p),n.state===void 0)throw new Error('Internal error: "streamEvents" state is missing. Please open a bug report.');if(!i){i=!0;let y={...n.state},w={run_id:y.id,event:`on_${y.type}_start`,name:c,tags:o,metadata:s,data:{input:e}};u.includeEvent(w,y.type)&&(yield w)}let m=p.ops.filter(y=>y.path.startsWith("/logs/")).map(y=>y.path.split("/")[2]),h=[...new Set(m)];for(let y of h){let w,x={},S=n.state.logs[y];if(S.end_time===void 0?S.streamed_output.length>0?w="stream":w="start":w="end",w==="start")S.inputs!==void 0&&(x.input=S.inputs);else if(w==="end")S.inputs!==void 0&&(x.input=S.inputs),x.output=S.final_output;else if(w==="stream"){let E=S.streamed_output.length;if(E!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${E} instead. Encountered in: "${S.name}"`);x={chunk:S.streamed_output[0]},S.streamed_output=[]}yield{event:`on_${S.type}_${w}`,name:S.name,run_id:S.id,tags:S.tags,metadata:S.metadata,data:x}}let{state:_}=n;if(_.streamed_output.length>0){let y=_.streamed_output.length;if(y!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${y} instead. Encountered in: "${_.name}"`);let w={chunk:_.streamed_output[0]};_.streamed_output=[];let x={event:`on_${_.type}_stream`,run_id:_.id,tags:o,metadata:s,name:c,data:w};u.includeEvent(x,_.type)&&(yield x)}}let f=n?.state;if(f!==void 0){let p={event:`on_${f.type}_end`,name:c,run_id:f.id,tags:o,metadata:s,data:{output:f.final_output}};u.includeEvent(p,f.type)&&(yield p)}}static isRunnable(e){return Gl(e)}withListeners({onStart:e,onEnd:t,onError:r}){return new en({bound:this,config:{},configFactories:[n=>({callbacks:[new cx({config:n,onStart:e,onEnd:t,onError:r})]})]})}asTool(e){return wF(this,e)}},en=class pO extends se{static lc_name(){return"RunnableBinding"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;bound;config;kwargs;configFactories;constructor(t){super(t),this.bound=t.bound,this.kwargs=t.kwargs,this.config=t.config,this.configFactories=t.configFactories}getName(t){return this.bound.getName(t)}async _mergeConfig(...t){let r=$t(this.config,...t);return $t(r,...this.configFactories?await Promise.all(this.configFactories.map(async n=>await n(r))):[])}withConfig(t){return new this.constructor({bound:this.bound,kwargs:this.kwargs,config:{...this.config,...t}})}withRetry(t){return new Vp({bound:this.bound,kwargs:this.kwargs,config:this.config,maxAttemptNumber:t?.stopAfterAttempt,...t})}async invoke(t,r){return this.bound.invoke(t,await this._mergeConfig(r,this.kwargs))}async batch(t,r,n){let i=Array.isArray(r)?await Promise.all(r.map(async a=>this._mergeConfig(ke(a),this.kwargs))):await this._mergeConfig(ke(r),this.kwargs);return this.bound.batch(t,i,n)}_concatOutputChunks(t,r){return this.bound._concatOutputChunks(t,r)}async*_streamIterator(t,r){yield*this.bound._streamIterator(t,await this._mergeConfig(ke(r),this.kwargs))}async stream(t,r){return this.bound.stream(t,await this._mergeConfig(ke(r),this.kwargs))}async*transform(t,r){yield*this.bound.transform(t,await this._mergeConfig(ke(r),this.kwargs))}streamEvents(t,r,n){let i=this,a=async function*(){yield*i.bound.streamEvents(t,{...await i._mergeConfig(ke(r),i.kwargs),version:r.version},n)};return gt.fromAsyncGenerator(a())}static isRunnableBinding(t){return t.bound&&se.isRunnable(t.bound)}withListeners({onStart:t,onEnd:r,onError:n}){return new pO({bound:this.bound,kwargs:this.kwargs,config:this.config,configFactories:[i=>({callbacks:[new cx({config:i,onStart:t,onEnd:r,onError:n})]})]})}},mO=class hO extends se{static lc_name(){return"RunnableEach"}lc_serializable=!0;lc_namespace=["langchain_core","runnables"];bound;constructor(t){super(t),this.bound=t.bound}async invoke(t,r){return this._callWithConfig(this._invoke.bind(this),t,r)}async _invoke(t,r,n){return this.bound.batch(t,$e(r,{callbacks:n?.getChild()}))}withListeners({onStart:t,onEnd:r,onError:n}){return new hO({bound:this.bound.withListeners({onStart:t,onEnd:r,onError:n})})}},Vp=class extends en{static lc_name(){return"RunnableRetry"}lc_namespace=["langchain_core","runnables"];maxAttemptNumber=3;onFailedAttempt=()=>{};constructor(e){super(e),this.maxAttemptNumber=e.maxAttemptNumber??this.maxAttemptNumber,this.onFailedAttempt=e.onFailedAttempt??this.onFailedAttempt}_patchConfigForRetry(e,t,r){let n=e>1?`retry:attempt:${e}`:void 0;return $e(t,{callbacks:r?.getChild(n)})}async _invoke(e,t,r){return pl(n=>super.invoke(e,this._patchConfigForRetry(n,t,r)),{onFailedAttempt:({error:n})=>this.onFailedAttempt(n,e),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}async invoke(e,t){return this._callWithConfig(this._invoke.bind(this),e,t)}async _batch(e,t,r,n){let i={};try{await pl(async a=>{let o=e.map((d,f)=>f).filter(d=>i[d.toString()]===void 0||i[d.toString()]instanceof Error),s=o.map(d=>e[d]),c=o.map(d=>this._patchConfigForRetry(a,t?.[d],r?.[d])),l=await super.batch(s,c,{...n,returnExceptions:!0}),u;for(let d=0;d<l.length;d+=1){let f=l[d],p=o[d];f instanceof Error&&u===void 0&&(u=f,u.input=s[d]),i[p.toString()]=f}if(u)throw u;return l},{onFailedAttempt:({error:a})=>this.onFailedAttempt(a,a.input),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}catch(a){if(n?.returnExceptions!==!0)throw a}return Object.keys(i).sort((a,o)=>parseInt(a,10)-parseInt(o,10)).map(a=>i[parseInt(a,10)])}async batch(e,t,r){return this._batchWithConfig(this._batch.bind(this),e,t,r)}},Lr=class Wl extends se{static lc_name(){return"RunnableSequence"}first;middle=[];last;omitSequenceTags=!1;lc_serializable=!0;lc_namespace=["langchain_core","runnables"];constructor(t){super(t),this.first=t.first,this.middle=t.middle??this.middle,this.last=t.last,this.name=t.name,this.omitSequenceTags=t.omitSequenceTags??this.omitSequenceTags}get steps(){return[this.first,...this.middle,this.last]}async invoke(t,r){let n=ke(r),i=await(await Jt(n))?.handleChainStart(this.toJSON(),_t(t,"input"),n.runId,void 0,void 0,void 0,n?.runName);delete n.runId;let a=t,o;try{let s=[this.first,...this.middle];for(let c=0;c<s.length;c+=1)a=await Rr(s[c].invoke(a,$e(n,{callbacks:i?.getChild(this.omitSequenceTags?void 0:`seq:step:${c+1}`)})),n.signal);if(n.signal?.aborted)throw la(n.signal);o=await this.last.invoke(a,$e(n,{callbacks:i?.getChild(this.omitSequenceTags?void 0:`seq:step:${this.steps.length}`)}))}catch(s){throw await i?.handleChainError(s),s}return await i?.handleChainEnd(_t(o,"output")),o}async batch(t,r,n){let i=this._getOptionsList(r??{},t.length),a=await Promise.all(i.map(Jt)),o=await Promise.all(a.map(async(c,l)=>{let u=await c?.handleChainStart(this.toJSON(),_t(t[l],"input"),i[l].runId,void 0,void 0,void 0,i[l].runName);return delete i[l].runId,u})),s=t;try{for(let c=0;c<this.steps.length;c+=1)s=await Rr(this.steps[c].batch(s,o.map((l,u)=>{let d=l?.getChild(this.omitSequenceTags?void 0:`seq:step:${c+1}`);return $e(i[u],{callbacks:d})}),n),i[0]?.signal)}catch(c){throw await Promise.all(o.map(l=>l?.handleChainError(c))),c}return await Promise.all(o.map(c=>c?.handleChainEnd(_t(s,"output")))),s}_concatOutputChunks(t,r){return this.last._concatOutputChunks(t,r)}async*_streamIterator(t,r){let n=await Jt(r),{runId:i,...a}=r??{},o=await n?.handleChainStart(this.toJSON(),_t(t,"input"),i,void 0,void 0,void 0,a?.runName),s=[this.first,...this.middle,this.last],c=!0,l;async function*u(){yield t}try{let d=s[0].transform(u(),$e(a,{callbacks:o?.getChild(this.omitSequenceTags?void 0:"seq:step:1")}));for(let f=1;f<s.length;f+=1)d=await s[f].transform(d,$e(a,{callbacks:o?.getChild(this.omitSequenceTags?void 0:`seq:step:${f+1}`)}));for await(let f of d)if(r?.signal?.throwIfAborted(),yield f,c)if(l===void 0)l=f;else try{l=this._concatOutputChunks(l,f)}catch{l=void 0,c=!1}}catch(d){throw await o?.handleChainError(d),d}await o?.handleChainEnd(_t(l,"output"))}getGraph(t){let r=new Bo,n=null;return this.steps.forEach((i,a)=>{let o=i.getGraph(t);a!==0&&o.trimFirstNode(),a!==this.steps.length-1&&o.trimLastNode(),r.extend(o);let s=o.firstNode();if(!s)throw new Error(`Runnable ${i} has no first node`);n&&r.addEdge(n,s),n=o.lastNode()}),r}pipe(t){return Wl.isRunnableSequence(t)?new Wl({first:this.first,middle:this.middle.concat([this.last,t.first,...t.middle]),last:t.last,name:this.name??t.name}):new Wl({first:this.first,middle:[...this.middle,this.last],last:at(t),name:this.name})}static isRunnableSequence(t){return Array.isArray(t.middle)&&se.isRunnable(t)}static from([t,...r],n){let i={};return typeof n=="string"?i.name=n:n!==void 0&&(i=n),new Wl({...i,first:at(t),middle:r.slice(0,-1).map(at),last:at(r[r.length-1])})}},Oa=class gO extends se{static lc_name(){return"RunnableMap"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;steps;getStepsKeys(){return Object.keys(this.steps)}constructor(t){super(t),this.steps={};for(let[r,n]of Object.entries(t.steps))this.steps[r]=at(n)}static from(t){return new gO({steps:t})}async invoke(t,r){let n=ke(r),i=await(await Jt(n))?.handleChainStart(this.toJSON(),{input:t},n.runId,void 0,void 0,void 0,n?.runName);delete n.runId;let a={};try{let o=Object.entries(this.steps).map(async([s,c])=>{a[s]=await c.invoke(t,$e(n,{callbacks:i?.getChild(`map:key:${s}`)}))});await Rr(Promise.all(o),n.signal)}catch(o){throw await i?.handleChainError(o),o}return await i?.handleChainEnd(a),a}async*_transform(t,r,n){let i={...this.steps},a=pf(t,Object.keys(i).length),o=new Map(Object.entries(i).map(([s,c],l)=>{let u=c.transform(a[l],$e(n,{callbacks:r?.getChild(`map:key:${s}`)}));return[s,u.next().then(d=>({key:s,gen:u,result:d}))]}));for(;o.size;){let{key:s,result:c,gen:l}=await Rr(Promise.race(o.values()),n?.signal);o.delete(s),c.done||(yield{[s]:c.value},o.set(s,l.next().then(u=>({key:s,gen:l,result:u}))))}}transform(t,r){return this._transformStreamWithConfig(t,this._transform.bind(this),r)}async stream(t,r){async function*n(){yield t}let i=ke(r),a=new ua({generator:this.transform(n(),i),config:i});return await a.setup,gt.fromAsyncGenerator(a)}},vF=class _O extends se{lc_serializable=!1;lc_namespace=["langchain_core","runnables"];func;constructor(t){if(super(t),!df(t.func))throw new Error("RunnableTraceable requires a function that is wrapped in traceable higher-order function");this.func=t.func}async invoke(t,r){let[n]=this._getOptionsList(r??{},1),i=await Jt(n);return Rr(this.func($e(n,{callbacks:i}),t),n?.signal)}async*_streamIterator(t,r){let[n]=this._getOptionsList(r??{},1),i=await this.invoke(t,r);if(Lp(i)){for await(let a of i)n?.signal?.throwIfAborted(),yield a;return}if(dO(i)){for(;;){n?.signal?.throwIfAborted();let a=i.next();if(a.done)break;yield a.value}return}yield i}static from(t){return new _O({func:t})}};function bF(e){if(df(e))throw new Error("RunnableLambda requires a function that is not wrapped in traceable higher-order function. This shouldn't happen.")}var Yt=class yO extends se{static lc_name(){return"RunnableLambda"}lc_namespace=["langchain_core","runnables"];func;constructor(t){if(df(t.func))return vF.from(t.func);super(t),bF(t.func),this.func=t.func}static from(t){return new yO({func:t})}async _invoke(t,r,n){return new Promise((i,a)=>{let o=$e(r,{callbacks:n?.getChild(),recursionLimit:(r?.recursionLimit??25)-1});Re.runWithConfig(vr(o),async()=>{try{let s=await this.func(t,{...o});if(s&&se.isRunnable(s)){if(r?.recursionLimit===0)throw new Error("Recursion limit reached.");s=await s.invoke(t,{...o,recursionLimit:(o.recursionLimit??25)-1})}else if(Lp(s)){let c;for await(let l of Fp(o,s))if(r?.signal?.throwIfAborted(),c===void 0)c=l;else try{c=this._concatOutputChunks(c,l)}catch{c=l}s=c}else if(lx(s)){let c;for(let l of dx(o,s))if(r?.signal?.throwIfAborted(),c===void 0)c=l;else try{c=this._concatOutputChunks(c,l)}catch{c=l}s=c}i(s)}catch(s){a(s)}})})}async invoke(t,r){return this._callWithConfig(this._invoke.bind(this),t,r)}async*_transform(t,r,n){let i;for await(let s of t)if(i===void 0)i=s;else try{i=this._concatOutputChunks(i,s)}catch{i=s}let a=$e(n,{callbacks:r?.getChild(),recursionLimit:(n?.recursionLimit??25)-1}),o=await new Promise((s,c)=>{Re.runWithConfig(vr(a),async()=>{try{s(await this.func(i,{...a,config:a}))}catch(l){c(l)}})});if(o&&se.isRunnable(o)){if(n?.recursionLimit===0)throw new Error("Recursion limit reached.");let s=await o.stream(i,a);for await(let c of s)yield c}else if(Lp(o))for await(let s of Fp(a,o))n?.signal?.throwIfAborted(),yield s;else if(lx(o))for(let s of dx(a,o))n?.signal?.throwIfAborted(),yield s;else yield o}transform(t,r){return this._transformStreamWithConfig(t,this._transform.bind(this),r)}async stream(t,r){async function*n(){yield t}let i=ke(r),a=new ua({generator:this.transform(n(),i),config:i});return await a.setup,gt.fromAsyncGenerator(a)}},vO=class extends Oa{},fx=class extends se{static lc_name(){return"RunnableWithFallbacks"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;runnable;fallbacks;constructor(e){super(e),this.runnable=e.runnable,this.fallbacks=e.fallbacks}*runnables(){yield this.runnable;for(let e of this.fallbacks)yield e}async invoke(e,t){let r=ke(t),n=await Jt(r),{runId:i,...a}=r,o=await n?.handleChainStart(this.toJSON(),_t(e,"input"),i,void 0,void 0,void 0,a?.runName),s=$e(a,{callbacks:o?.getChild()});return await Re.runWithConfig(s,async()=>{let c;for(let l of this.runnables()){r?.signal?.throwIfAborted();try{let u=await l.invoke(e,s);return await o?.handleChainEnd(_t(u,"output")),u}catch(u){c===void 0&&(c=u)}}throw c===void 0?new Error("No error stored at end of fallback."):(await o?.handleChainError(c),c)})}async*_streamIterator(e,t){let r=ke(t),n=await Jt(r),{runId:i,...a}=r,o=await n?.handleChainStart(this.toJSON(),_t(e,"input"),i,void 0,void 0,void 0,a?.runName),s,c;for(let u of this.runnables()){r?.signal?.throwIfAborted();let d=$e(a,{callbacks:o?.getChild()});try{c=Fp(d,await u.stream(e,d));break}catch(f){s===void 0&&(s=f)}}if(c===void 0){let u=s??new Error("No error stored at end of fallback.");throw await o?.handleChainError(u),u}let l;try{for await(let u of c){yield u;try{l=l===void 0?l:this._concatOutputChunks(l,u)}catch{l=void 0}}}catch(u){throw await o?.handleChainError(u),u}await o?.handleChainEnd(_t(l,"output"))}async batch(e,t,r){if(r?.returnExceptions)throw new Error("Not implemented.");let n=this._getOptionsList(t??{},e.length),i=await Promise.all(n.map(s=>Jt(s))),a=await Promise.all(i.map(async(s,c)=>{let l=await s?.handleChainStart(this.toJSON(),_t(e[c],"input"),n[c].runId,void 0,void 0,void 0,n[c].runName);return delete n[c].runId,l})),o;for(let s of this.runnables()){n[0].signal?.throwIfAborted();try{let c=await s.batch(e,a.map((l,u)=>$e(n[u],{callbacks:l?.getChild()})),r);return await Promise.all(a.map((l,u)=>l?.handleChainEnd(_t(c[u],"output")))),c}catch(c){o===void 0&&(o=c)}}throw o?(await Promise.all(a.map(s=>s?.handleChainError(o))),o):new Error("No error stored at end of fallbacks.")}};function at(e){if(typeof e=="function")return new Yt({func:e});if(se.isRunnable(e))return e;if(!Array.isArray(e)&&typeof e=="object"){let t={};for(let[r,n]of Object.entries(e))t[r]=at(n);return new Oa({steps:t})}else throw new Error(`Expected a Runnable, function or object.
241
+ Instead got an unsupported type.`)}var Jl=class extends se{static lc_name(){return"RunnableAssign"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;mapper;constructor(e){e instanceof Oa&&(e={mapper:e}),super(e),this.mapper=e.mapper}async invoke(e,t){let r=await this.mapper.invoke(e,t);return{...e,...r}}async*_transform(e,t,r){let n=this.mapper.getStepsKeys(),[i,a]=pf(e),o=this.mapper.transform(a,$e(r,{callbacks:t?.getChild()})),s=o.next();for await(let c of i){if(typeof c!="object"||Array.isArray(c))throw new Error(`RunnableAssign can only be used with objects as input, got ${typeof c}`);let l=Object.fromEntries(Object.entries(c).filter(([u])=>!n.includes(u)));Object.keys(l).length>0&&(yield l)}yield(await s).value;for await(let c of o)yield c}transform(e,t){return this._transformStreamWithConfig(e,this._transform.bind(this),t)}async stream(e,t){async function*r(){yield e}let n=ke(t),i=new ua({generator:this.transform(r(),n),config:n});return await i.setup,gt.fromAsyncGenerator(i)}},px=class extends se{static lc_name(){return"RunnablePick"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;keys;constructor(e){(typeof e=="string"||Array.isArray(e))&&(e={keys:e}),super(e),this.keys=e.keys}async _pick(e){if(typeof this.keys=="string")return e[this.keys];{let t=this.keys.map(r=>[r,e[r]]).filter(r=>r[1]!==void 0);return t.length===0?void 0:Object.fromEntries(t)}}async invoke(e,t){return this._callWithConfig(this._pick.bind(this),e,t)}async*_transform(e){for await(let t of e){let r=await this._pick(t);r!==void 0&&(yield r)}}transform(e,t){return this._transformStreamWithConfig(e,this._transform.bind(this),t)}async stream(e,t){async function*r(){yield e}let n=ke(t),i=new ua({generator:this.transform(r(),n),config:n});return await i.setup,gt.fromAsyncGenerator(i)}},Bp=class extends en{name;description;schema;constructor(e){let t=Lr.from([Yt.from(async r=>{let n;if(ra(r))try{n=await ka(this.schema,r.args)}catch{throw new us("Received tool input did not match expected schema",JSON.stringify(r.args))}else n=r;return n}).withConfig({runName:`${e.name}:parse_input`}),e.bound]).withConfig({runName:e.name});super({bound:t,config:e.config??{}}),this.name=e.name,this.description=e.description,this.schema=e.schema}static lc_name(){return"RunnableToolLike"}};function wF(e,t){let r=t.name??e.getName(),n=t.description??$i(t.schema);return Js(t.schema)?new Bp({name:r,description:n,schema:Rt.object({input:Rt.string()}).transform(i=>i.input),bound:e}):new Bp({name:r,description:n,schema:t.schema,bound:e})}var Zp=(e,t)=>{let r=[...new Set(t?.map(i=>{if(typeof i=="string")return i;let a=new i({});if(!("getType"in a)||typeof a.getType!="function")throw new Error("Invalid type provided.");return a.getType()}))],n=e.getType();return r.some(i=>i===n)};function kO(e,t){return Array.isArray(e)?bO(e,t):Yt.from(r=>bO(r,e))}function bO(e,t={}){let{includeNames:r,excludeNames:n,includeTypes:i,excludeTypes:a,includeIds:o,excludeIds:s}=t,c=[];for(let l of e)if(!(n&&l.name&&n.includes(l.name))){{if(a&&Zp(l,a))continue;if(s&&l.id&&s.includes(l.id))continue}i||o||r?(r&&l.name&&r.some(u=>u===l.name)||i&&Zp(l,i)||o&&l.id&&o.some(u=>u===l.id))&&c.push(l):c.push(l)}return c}function EO(e){return Array.isArray(e)?wO(e):Yt.from(wO)}function wO(e){if(!e.length)return[];let t=[];for(let r of e){let n=r,i=t.pop();if(!i)t.push(n);else if(n.getType()==="tool"||n.getType()!==i.getType())t.push(i,n);else{let a=no(i),o=no(n),s=a.concat(o);typeof a.content=="string"&&typeof o.content=="string"&&(s.content=`${a.content}
242
+ ${o.content}`),t.push(SF(s))}}return t}function $O(e,t){if(Array.isArray(e)){let r=e;if(!t)throw new Error("Options parameter is required when providing messages.");return xO(r,t)}else{let r=e;return Yt.from(n=>xO(n,r)).withConfig({runName:"trim_messages"})}}async function xO(e,t){let{maxTokens:r,tokenCounter:n,strategy:i="last",allowPartial:a=!1,endOn:o,startOn:s,includeSystem:c=!1,textSplitter:l}=t;if(s&&i==="first")throw new Error("`startOn` should only be specified if `strategy` is 'last'.");if(c&&i==="first")throw new Error("`includeSystem` should only be specified if `strategy` is 'last'.");let u;"getNumTokens"in n?u=async f=>(await Promise.all(f.map(p=>n.getNumTokens(p.content)))).reduce((p,m)=>p+m,0):u=async f=>n(f);let d=hx;if(l&&("splitText"in l?d=l.splitText.bind(l):d=async f=>l(f)),i==="first")return IO(e,{maxTokens:r,tokenCounter:u,textSplitter:d,partialStrategy:a?"first":void 0,endOn:o});if(i==="last")return xF(e,{maxTokens:r,tokenCounter:u,textSplitter:d,allowPartial:a,includeSystem:c,startOn:s,endOn:o});throw new Error(`Unrecognized strategy: '${i}'. Must be one of 'first' or 'last'.`)}async function IO(e,t){let{maxTokens:r,tokenCounter:n,textSplitter:i,partialStrategy:a,endOn:o}=t,s=[...e],c=0;for(let l=0;l<s.length;l+=1)if(await n(l>0?s.slice(0,-l):s)<=r){c=s.length-l;break}if(c<s.length&&a){let l=!1;if(Array.isArray(s[c].content)){let u=s[c];if(typeof u.content=="string")throw new Error("Expected content to be an array.");let d=u.content.length,f=a==="last"?[...u.content].reverse():u.content;for(let p=1;p<=d;p+=1){let m=a==="first"?f.slice(0,p):f.slice(-p),h=Object.fromEntries(Object.entries(u).filter(([w])=>w!=="type"&&!w.startsWith("lc_"))),_=mx(u.getType(),{...h,content:m}),y=[...s.slice(0,c),_];if(await n(y)<=r)s=y,c+=1,l=!0;else break}l&&a==="last"&&(u.content=[...f].reverse())}if(!l){let u=s[c],d;if(Array.isArray(u.content)&&u.content.some(f=>typeof f=="string"||f.type==="text")?d=u.content.find(f=>f.type==="text"&&f.text)?.text:typeof u.content=="string"&&(d=u.content),d){let f=await i(d),p=f.length;a==="last"&&f.reverse();for(let m=0;m<p-1;m+=1)if(f.pop(),u.content=f.join(""),await n([...s.slice(0,c),u])<=r){a==="last"&&(u.content=[...f].reverse().join("")),s=[...s.slice(0,c),u],c+=1;break}}}}if(o){let l=Array.isArray(o)?o:[o];for(;c>0&&!Zp(s[c-1],l);)c-=1}return s.slice(0,c)}async function xF(e,t){let{allowPartial:r=!1,includeSystem:n=!1,endOn:i,startOn:a,...o}=t,s=e.map(u=>{let d=Object.fromEntries(Object.entries(u).filter(([f])=>f!=="type"&&!f.startsWith("lc_")));return mx(u.getType(),d,mi(u))});if(i){let u=Array.isArray(i)?i:[i];for(;s.length>0&&!Zp(s[s.length-1],u);)s=s.slice(0,-1)}let c=n&&s[0]?.getType()==="system",l=c?s.slice(0,1).concat(s.slice(1).reverse()):s.reverse();return l=await IO(l,{...o,partialStrategy:r?"last":void 0,endOn:a}),c?[l[0],...l.slice(1).reverse()]:l.reverse()}var SO={human:{message:ot,messageChunk:ro},ai:{message:Ne,messageChunk:it},system:{message:or,messageChunk:hi},developer:{message:or,messageChunk:hi},tool:{message:kt,messageChunk:ls},function:{message:eo,messageChunk:to},generic:{message:fn,messageChunk:Qa},remove:{message:Nr,messageChunk:Nr}};function mx(e,t,r){let n,i;switch(e){case"human":r?n=new ro(t):i=new ot(t);break;case"ai":if(r){let a={...t};"tool_calls"in a&&(a={...a,tool_call_chunks:a.tool_calls?.map(o=>({...o,type:"tool_call_chunk",index:void 0,args:JSON.stringify(o.args)}))}),n=new it(a)}else i=new Ne(t);break;case"system":r?n=new hi(t):i=new or(t);break;case"developer":r?n=new hi({...t,additional_kwargs:{...t.additional_kwargs,__openai_role__:"developer"}}):i=new or({...t,additional_kwargs:{...t.additional_kwargs,__openai_role__:"developer"}});break;case"tool":if("tool_call_id"in t)r?n=new ls(t):i=new kt(t);else throw new Error("Can not convert ToolMessage to ToolMessageChunk if 'tool_call_id' field is not defined.");break;case"function":if(r)n=new to(t);else{if(!t.name)throw new Error("FunctionMessage must have a 'name' field");i=new eo(t)}break;case"generic":if("role"in t)r?n=new Qa(t):i=new fn(t);else throw new Error("Can not convert ChatMessage to ChatMessageChunk if 'role' field is not defined.");break;default:throw new Error(`Unrecognized message type ${e}`)}if(r&&n)return n;if(i)return i;throw new Error(`Unrecognized message type ${e}`)}function SF(e){let t=e.getType(),r,n=Object.fromEntries(Object.entries(e).filter(([i])=>!["type","tool_call_chunks"].includes(i)&&!i.startsWith("lc_")));if(t in SO&&(r=mx(t,n)),!r)throw new Error(`Unrecognized message chunk class ${t}. Supported classes are ${Object.keys(SO)}`);return r}function hx(e){let t=e.split(`
243
+ `);return Promise.resolve([...t.slice(0,-1).map(r=>`${r}
244
+ `),t[t.length-1]])}var TO=["tool_call","tool_call_chunk","invalid_tool_call","server_tool_call","server_tool_call_chunk","server_tool_call_result"];var CO=["image","video","audio","text-plain","file"];var AO=["text","reasoning",...TO,...CO];var OO=T({AIMessage:()=>Ne,AIMessageChunk:()=>it,BaseMessage:()=>Pe,BaseMessageChunk:()=>Pt,ChatMessage:()=>fn,ChatMessageChunk:()=>Qa,DEFAULT_MERGE_IGNORE_KEYS:()=>dg,FunctionMessage:()=>eo,FunctionMessageChunk:()=>to,HumanMessage:()=>ot,HumanMessageChunk:()=>ro,KNOWN_BLOCK_TYPES:()=>AO,RemoveMessage:()=>Nr,SystemMessage:()=>or,SystemMessageChunk:()=>hi,ToolMessage:()=>kt,ToolMessageChunk:()=>ls,_isMessageFieldWithRole:()=>$d,_mergeDicts:()=>tt,_mergeLists:()=>ta,_mergeObj:()=>Ed,_mergeStatus:()=>kd,coerceMessageLikeToMessage:()=>Et,collapseToolCallChunks:()=>Td,convertToChunk:()=>no,convertToOpenAIImageBlock:()=>bd,convertToProviderContentBlock:()=>wE,defaultTextSplitter:()=>hx,defaultToolCallParser:()=>qc,filterMessages:()=>kO,getBufferString:()=>ps,iife:()=>h$,isAIMessage:()=>fs,isAIMessageChunk:()=>Xc,isBase64ContentBlock:()=>cs,isBaseMessage:()=>rt,isBaseMessageChunk:()=>mi,isChatMessage:()=>s$,isChatMessageChunk:()=>c$,isDataContentBlock:()=>Dn,isDirectToolOutput:()=>Kc,isFunctionMessage:()=>l$,isFunctionMessageChunk:()=>u$,isHumanMessage:()=>d$,isHumanMessageChunk:()=>f$,isIDContentBlock:()=>vd,isMessage:()=>Sd,isOpenAIToolCallArray:()=>jE,isPlainTextContentBlock:()=>vE,isSystemMessage:()=>p$,isSystemMessageChunk:()=>m$,isToolMessage:()=>Yc,isToolMessageChunk:()=>fg,isURLContentBlock:()=>ss,mapChatMessagesToStoredMessages:()=>_$,mapStoredMessageToChatMessage:()=>Qc,mapStoredMessagesToChatMessages:()=>g$,mergeContent:()=>Zt,mergeMessageRuns:()=>EO,mergeResponseMetadata:()=>Id,mergeUsageMetadata:()=>ds,parseBase64DataUrl:()=>Jc,parseMimeType:()=>bE,trimMessages:()=>$O});var PO=T({BaseChatMessageHistory:()=>gx,BaseListChatMessageHistory:()=>Hp,InMemoryChatMessageHistory:()=>kF}),gx=class extends pt{async addMessages(e){for(let t of e)await this.addMessage(t)}},Hp=class extends pt{addUserMessage(e){return this.addMessage(new ot(e))}addAIMessage(e){return this.addMessage(new Ne(e))}async addMessages(e){for(let t of e)await this.addMessage(t)}clear(){throw new Error("Not implemented.")}},kF=class extends Hp{lc_namespace=["langchain","stores","message","in_memory"];messages=[];constructor(e){super(...arguments),this.messages=e??[]}async getMessages(){return this.messages}async addMessage(e){this.messages.push(e)}async clear(){this.messages=[]}};var Fr=class{pageContent;metadata;id;constructor(e){this.pageContent=e.pageContent!==void 0?e.pageContent.toString():"",this.metadata=e.metadata??{},this.id=e.id}};var _x=class extends se{lc_namespace=["langchain_core","documents","transformers"];invoke(e,t){return this.transformDocuments(e)}},NO=class extends _x{async transformDocuments(e){let t=[];for(let r of e){let n=await this._transformDocument(r);t.push(n)}return t}};var RO=T({BaseDocumentTransformer:()=>_x,Document:()=>Fr,MappingDocumentTransformer:()=>NO});var MO=T({BaseDocumentLoader:()=>yx}),yx=class{};var jO=T({LangSmithLoader:()=>EF}),EF=class extends yx{datasetId;datasetName;exampleIds;asOf;splits;inlineS3Urls;offset;limit;metadata;filter;contentKey;formatContent;client;constructor(e){if(super(),e.client&&e.clientConfig)throw new Error("client and clientConfig cannot both be provided.");this.client=e.client??new Ln(e?.clientConfig),this.contentKey=e.contentKey?e.contentKey.split("."):[],this.formatContent=e.formatContent??$F,this.datasetId=e.datasetId,this.datasetName=e.datasetName,this.exampleIds=e.exampleIds,this.asOf=e.asOf,this.splits=e.splits,this.inlineS3Urls=e.inlineS3Urls,this.offset=e.offset,this.limit=e.limit,this.metadata=e.metadata,this.filter=e.filter}async load(){let e=[];for await(let t of this.client.listExamples({datasetId:this.datasetId,datasetName:this.datasetName,exampleIds:this.exampleIds,asOf:this.asOf,splits:this.splits,inlineS3Urls:this.inlineS3Urls,offset:this.offset,limit:this.limit,metadata:this.metadata,filter:this.filter})){let r=t.inputs;for(let a of this.contentKey)r=r[a];let n=this.formatContent(r),i=t;["created_at","modified_at"].forEach(a=>{a in i&&typeof i[a]=="object"&&(i[a]=i[a].toString())}),e.push({pageContent:n,metadata:i})}return e}};function $F(e){if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}var DO=T({Embeddings:()=>Gp}),Gp=class{caller;constructor(e){this.caller=new wi(e??{})}};var ac=class extends pt{lc_namespace=["langchain_core","example_selectors","base"]};var vx=class{async getPromptAsync(e,t){return this.getPrompt(e).partial(t?.partialVariables??{})}},zO=class extends vx{defaultPrompt;conditionals;constructor(e,t=[]){super(),this.defaultPrompt=e,this.conditionals=t}getPrompt(e){for(let[t,r]of this.conditionals)if(t(e))return r;return this.defaultPrompt}};function UO(e){return e._modelType()==="base_llm"}function LO(e){return e._modelType()==="base_chat_model"}function FO(e){return e.split(/\n| /).length}var BO=class VO extends ac{examples=[];examplePrompt;getTextLength=FO;maxLength=2048;exampleTextLengths=[];constructor(t){super(t),this.examplePrompt=t.examplePrompt,this.maxLength=t.maxLength??2048,this.getTextLength=t.getTextLength??FO}async addExample(t){this.examples.push(t);let r=await this.examplePrompt.format(t);this.exampleTextLengths.push(this.getTextLength(r))}async calculateExampleTextLengths(t,r){if(t.length>0)return t;let{examples:n,examplePrompt:i}=r;return(await Promise.all(n.map(a=>i.format(a)))).map(a=>this.getTextLength(a))}async selectExamples(t){let r=Object.values(t).join(" "),n=this.maxLength-this.getTextLength(r),i=0,a=[];for(;n>0&&i<this.examples.length;){let o=n-this.exampleTextLengths[i];if(o<0)break;a.push(this.examples[i]),n=o,i+=1}return a}static async fromExamples(t,r){let n=new VO(r);return await Promise.all(t.map(i=>n.addExample(i))),n}};function bx(e){return Object.keys(e).sort().map(t=>e[t])}var ZO=class HO extends ac{vectorStoreRetriever;exampleKeys;inputKeys;constructor(t){if(super(t),this.exampleKeys=t.exampleKeys,this.inputKeys=t.inputKeys,t.vectorStore!==void 0)this.vectorStoreRetriever=t.vectorStore.asRetriever({k:t.k??4,filter:t.filter});else if(t.vectorStoreRetriever)this.vectorStoreRetriever=t.vectorStoreRetriever;else throw new Error('You must specify one of "vectorStore" and "vectorStoreRetriever".')}async addExample(t){let r=bx((this.inputKeys??Object.keys(t)).reduce((n,i)=>({...n,[i]:t[i]}),{})).join(" ");await this.vectorStoreRetriever.addDocuments([new Fr({pageContent:r,metadata:t})])}async selectExamples(t){let r=bx((this.inputKeys??Object.keys(t)).reduce((i,a)=>({...i,[a]:t[a]}),{})).join(" "),n=(await this.vectorStoreRetriever.invoke(r)).map(i=>i.metadata);return this.exampleKeys?n.map(i=>this.exampleKeys.reduce((a,o)=>({...a,[o]:i[o]}),{})):n}static async fromExamples(t,r,n,i={}){let a=i.inputKeys??null,o=t.map(c=>bx(a?a.reduce((l,u)=>({...l,[u]:c[u]}),{}):c).join(" ")),s=await n.fromTexts(o,t,r,i);return new HO({vectorStore:s,k:i.k??4,exampleKeys:i.exampleKeys,inputKeys:i.inputKeys})}};var GO=T({BaseExampleSelector:()=>ac,BasePromptSelector:()=>vx,ConditionalPromptSelector:()=>zO,LengthBasedExampleSelector:()=>BO,SemanticSimilarityExampleSelector:()=>ZO,isChatModel:()=>LO,isLLM:()=>UO});var Kl="10f90ea3-90a4-4962-bf75-83a0f3c1c62a",WO=class extends pt{lc_namespace=["langchain","recordmanagers"]};var wx=class{uid;hash_;contentHash;metadataHash;pageContent;metadata;keyEncoder=os;constructor(e){this.uid=e.uid,this.pageContent=e.pageContent,this.metadata=e.metadata}makeDefaultKeyEncoder(e){this.keyEncoder=e}calculateHashes(){let e=["hash_","content_hash","metadata_hash"];for(let r of e)if(r in this.metadata)throw new Error(`Metadata cannot contain key ${r} as it is reserved for internal use. Restricted keys: [${e.join(", ")}]`);let t=this._hashStringToUUID(this.pageContent);try{let r=this._hashNestedDictToUUID(this.metadata);this.contentHash=t,this.metadataHash=r}catch(r){throw new Error(`Failed to hash metadata: ${r}. Please use a dict that can be serialized using json.`)}this.hash_=this._hashStringToUUID(this.contentHash+this.metadataHash),this.uid||(this.uid=this.hash_)}toDocument(){return new Fr({pageContent:this.pageContent,metadata:this.metadata})}static fromDocument(e,t){let r=new this({pageContent:e.pageContent,metadata:e.metadata,uid:t||e.uid});return r.calculateHashes(),r}_hashStringToUUID(e){return rs(this.keyEncoder(e),Kl)}_hashNestedDictToUUID(e){let t=JSON.stringify(e,Object.keys(e).sort());return rs(this.keyEncoder(t),Kl)}};function xx(e,t){let r=[],n=[];return t.forEach(i=>{n.push(i),n.length>=e&&(r.push(n),n=[])}),n.length>0&&r.push(n),r}function Sx(e){let t=new Set,r=[];for(let n of e){if(!n.hash_)throw new Error("Hashed document does not have a hash");t.has(n.hash_)||(t.add(n.hash_),r.push(n))}return r}function kx(e){if(e===null)return t=>null;if(typeof e=="string")return t=>t.metadata[e];if(typeof e=="function")return e;throw new Error(`sourceIdKey should be null, a string or a function, got ${typeof e}`)}var Ex=e=>"load"in e&&typeof e.load=="function"&&"loadAndSplit"in e&&typeof e.loadAndSplit=="function";async function JO(e){let{docsSource:t,recordManager:r,vectorStore:n,options:i}=e,{batchSize:a=100,cleanup:o,sourceIdKey:s,cleanupBatchSize:c=1e3,forceUpdate:l=!1}=i??{};if(o==="incremental"&&!s)throw new Error("sourceIdKey is required when cleanup mode is incremental. Please provide through 'options.sourceIdKey'.");let u=Ex(t)?await t.load():t,d=kx(s??null),f=await r.getTime(),p=0,m=0,h=0,_=0,y=xx(a??100,u);for(let w of y){let x=Sx(w.map(L=>wx.fromDocument(L))),S=x.map(L=>d(L));o==="incremental"&&x.forEach((L,q)=>{if(S[q]===null)throw new Error("sourceIdKey must be provided when cleanup is incremental")});let E=await r.exists(x.map(L=>L.uid)),P=[],C=[],b=[],B=new Set;if(x.forEach((L,q)=>{if(E[q])if(l)B.add(L.uid);else{b.push(L.uid);return}P.push(L.uid),C.push(L.toDocument())}),b.length>0&&(await r.update(b,{timeAtLeast:f}),_+=b.length),C.length>0&&(await n.addDocuments(C,{ids:P}),p+=C.length-B.size,h+=B.size),await r.update(x.map(L=>L.uid),{timeAtLeast:f,groupIds:S}),o==="incremental"){S.forEach(q=>{if(!q)throw new Error("Source id cannot be null")});let L=await r.listKeys({before:f,groupIds:S});L.length>0&&(await n.delete({ids:L}),await r.deleteKeys(L),m+=L.length)}}if(o==="full"){let w=await r.listKeys({before:f,limit:c});for(;w.length>0;)await n.delete({ids:w}),await r.deleteKeys(w),m+=w.length,w=await r.listKeys({before:f,limit:c})}return{numAdded:p,numDeleted:m,numUpdated:h,numSkipped:_}}var KO=T({RecordManager:()=>WO,UUIDV5_NAMESPACE:()=>Kl,_HashedDocument:()=>wx,_batch:()=>xx,_deduplicateInOrder:()=>Sx,_getSourceIdAssigner:()=>kx,_isBaseDocumentLoader:()=>Ex,index:()=>JO});var qO=T({BasePromptValue:()=>Wp,ChatPromptValue:()=>Yl,ImagePromptValue:()=>$x,StringPromptValue:()=>ql}),Wp=class extends pt{},ql=class extends Wp{static lc_name(){return"StringPromptValue"}lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;value;constructor(e){super({value:e}),this.value=e}toString(){return this.value}toChatMessages(){return[new ot(this.value)]}},Yl=class extends Wp{lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;static lc_name(){return"ChatPromptValue"}messages;constructor(e){Array.isArray(e)&&(e={messages:e}),super(e),this.messages=e.messages}toString(){return ps(this.messages)}toChatMessages(){return this.messages}},$x=class extends Wp{lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;static lc_name(){return"ImagePromptValue"}imageUrl;value;constructor(e){"imageUrl"in e||(e={imageUrl:e}),super(e),this.imageUrl=e.imageUrl}toString(){return this.imageUrl.url}toChatMessages(){return[new ot({content:[{type:"image_url",image_url:{detail:this.imageUrl.detail,url:this.imageUrl.url}}]})]}};var eP=qu(QO(),1),RF=Object.defineProperty,MF=(e,t,r)=>t in e?RF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,jF=(e,t,r)=>(MF(e,typeof t!="symbol"?t+"":t,r),r);function DF(e,t){let r=Array.from({length:e.length},(n,i)=>({start:i,end:i+1}));for(;r.length>1;){let n=null;for(let i=0;i<r.length-1;i++){let a=e.slice(r[i].start,r[i+1].end),o=t.get(a.join(","));o!=null&&(n==null||o<n[0])&&(n=[o,i])}if(n!=null){let i=n[1];r[i]={start:r[i].start,end:r[i+1].end},r.splice(i+1,1)}else break}return r}function zF(e,t){return e.length===1?[t.get(e.join(","))]:DF(e,t).map(r=>t.get(e.slice(r.start,r.end).join(","))).filter(r=>r!=null)}function UF(e){return e.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}var Tx=class{specialTokens;inverseSpecialTokens;patStr;textEncoder=new TextEncoder;textDecoder=new TextDecoder("utf-8");rankMap=new Map;textMap=new Map;constructor(e,t){this.patStr=e.pat_str;let r=e.bpe_ranks.split(`
245
+ `).filter(Boolean).reduce((n,i)=>{let[a,o,...s]=i.split(" "),c=Number.parseInt(o,10);return s.forEach((l,u)=>n[l]=c+u),n},{});for(let[n,i]of Object.entries(r)){let a=eP.default.toByteArray(n);this.rankMap.set(a.join(","),i),this.textMap.set(i,a)}this.specialTokens={...e.special_tokens,...t},this.inverseSpecialTokens=Object.entries(this.specialTokens).reduce((n,[i,a])=>(n[a]=this.textEncoder.encode(i),n),{})}encode(e,t=[],r="all"){let n=new RegExp(this.patStr,"ug"),i=Tx.specialTokenRegex(Object.keys(this.specialTokens)),a=[],o=new Set(t==="all"?Object.keys(this.specialTokens):t),s=new Set(r==="all"?Object.keys(this.specialTokens).filter(l=>!o.has(l)):r);if(s.size>0){let l=Tx.specialTokenRegex([...s]),u=e.match(l);if(u!=null)throw new Error(`The text contains a special token that is not allowed: ${u[0]}`)}let c=0;for(;;){let l=null,u=c;for(;i.lastIndex=u,l=i.exec(e),!(l==null||o.has(l[0]));)u=l.index+1;let d=l?.index??e.length;for(let p of e.substring(c,d).matchAll(n)){let m=this.textEncoder.encode(p[0]),h=this.rankMap.get(m.join(","));if(h!=null){a.push(h);continue}a.push(...zF(m,this.rankMap))}if(l==null)break;let f=this.specialTokens[l[0]];a.push(f),c=l.index+l[0].length}return a}decode(e){let t=[],r=0;for(let a=0;a<e.length;++a){let o=e[a],s=this.textMap.get(o)??this.inverseSpecialTokens[o];s!=null&&(t.push(s),r+=s.length)}let n=new Uint8Array(r),i=0;for(let a of t)n.set(a,i),i+=a.length;return this.textDecoder.decode(n)}},Kp=Tx;jF(Kp,"specialTokenRegex",e=>new RegExp(e.map(t=>UF(t)).join("|"),"g"));function Cx(e){switch(e){case"gpt2":return"gpt2";case"code-cushman-001":case"code-cushman-002":case"code-davinci-001":case"code-davinci-002":case"cushman-codex":case"davinci-codex":case"davinci-002":case"text-davinci-002":case"text-davinci-003":return"p50k_base";case"code-davinci-edit-001":case"text-davinci-edit-001":return"p50k_edit";case"ada":case"babbage":case"babbage-002":case"code-search-ada-code-001":case"code-search-babbage-code-001":case"curie":case"davinci":case"text-ada-001":case"text-babbage-001":case"text-curie-001":case"text-davinci-001":case"text-search-ada-doc-001":case"text-search-babbage-doc-001":case"text-search-curie-doc-001":case"text-search-davinci-doc-001":case"text-similarity-ada-001":case"text-similarity-babbage-001":case"text-similarity-curie-001":case"text-similarity-davinci-001":return"r50k_base";case"gpt-3.5-turbo-instruct-0914":case"gpt-3.5-turbo-instruct":case"gpt-3.5-turbo-16k-0613":case"gpt-3.5-turbo-16k":case"gpt-3.5-turbo-0613":case"gpt-3.5-turbo-0301":case"gpt-3.5-turbo":case"gpt-4-32k-0613":case"gpt-4-32k-0314":case"gpt-4-32k":case"gpt-4-0613":case"gpt-4-0314":case"gpt-4":case"gpt-3.5-turbo-1106":case"gpt-35-turbo":case"gpt-4-1106-preview":case"gpt-4-vision-preview":case"gpt-3.5-turbo-0125":case"gpt-4-turbo":case"gpt-4-turbo-2024-04-09":case"gpt-4-turbo-preview":case"gpt-4-0125-preview":case"text-embedding-ada-002":case"text-embedding-3-small":case"text-embedding-3-large":return"cl100k_base";case"gpt-4o":case"gpt-4o-2024-05-13":case"gpt-4o-2024-08-06":case"gpt-4o-2024-11-20":case"gpt-4o-mini-2024-07-18":case"gpt-4o-mini":case"gpt-4o-search-preview":case"gpt-4o-search-preview-2025-03-11":case"gpt-4o-mini-search-preview":case"gpt-4o-mini-search-preview-2025-03-11":case"gpt-4o-audio-preview":case"gpt-4o-audio-preview-2024-12-17":case"gpt-4o-audio-preview-2024-10-01":case"gpt-4o-mini-audio-preview":case"gpt-4o-mini-audio-preview-2024-12-17":case"o1":case"o1-2024-12-17":case"o1-mini":case"o1-mini-2024-09-12":case"o1-preview":case"o1-preview-2024-09-12":case"o1-pro":case"o1-pro-2025-03-19":case"o3":case"o3-2025-04-16":case"o3-mini":case"o3-mini-2025-01-31":case"o4-mini":case"o4-mini-2025-04-16":case"chatgpt-4o-latest":case"gpt-4o-realtime":case"gpt-4o-realtime-preview-2024-10-01":case"gpt-4o-realtime-preview-2024-12-17":case"gpt-4o-mini-realtime-preview":case"gpt-4o-mini-realtime-preview-2024-12-17":case"gpt-4.1":case"gpt-4.1-2025-04-14":case"gpt-4.1-mini":case"gpt-4.1-mini-2025-04-14":case"gpt-4.1-nano":case"gpt-4.1-nano-2025-04-14":case"gpt-4.5-preview":case"gpt-4.5-preview-2025-02-27":case"gpt-5":case"gpt-5-2025-08-07":case"gpt-5-nano":case"gpt-5-nano-2025-08-07":case"gpt-5-mini":case"gpt-5-mini-2025-08-07":case"gpt-5-chat-latest":return"o200k_base";default:throw new Error("Unknown model")}}var tP=T({encodingForModel:()=>Yp,getEncoding:()=>rP}),qp={},LF=new wi({});async function rP(e){return e in qp||(qp[e]=LF.fetch(`https://tiktoken.pages.dev/js/${e}.json`).then(t=>t.json()).then(t=>new Kp(t)).catch(t=>{throw delete qp[e],t})),await qp[e]}async function Yp(e){return rP(Cx(e))}var nP=T({BaseLangChain:()=>Qp,BaseLanguageModel:()=>Xl,calculateMaxTokens:()=>VF,getEmbeddingContextSize:()=>FF,getModelContextSize:()=>iP,getModelNameForTiktoken:()=>Xp,isOpenAITool:()=>BF}),Xp=e=>e.startsWith("gpt-5")?"gpt-5":e.startsWith("gpt-3.5-turbo-16k")?"gpt-3.5-turbo-16k":e.startsWith("gpt-3.5-turbo-")?"gpt-3.5-turbo":e.startsWith("gpt-4-32k")?"gpt-4-32k":e.startsWith("gpt-4-")?"gpt-4":e.startsWith("gpt-4o")?"gpt-4o":e,FF=e=>e==="text-embedding-ada-002"?8191:2046,iP=e=>{switch(Xp(e)){case"gpt-5":case"gpt-5-turbo":case"gpt-5-turbo-preview":return 4e5;case"gpt-4o":case"gpt-4o-mini":case"gpt-4o-2024-05-13":case"gpt-4o-2024-08-06":return 128e3;case"gpt-4-turbo":case"gpt-4-turbo-preview":case"gpt-4-turbo-2024-04-09":case"gpt-4-0125-preview":case"gpt-4-1106-preview":return 128e3;case"gpt-4-32k":case"gpt-4-32k-0314":case"gpt-4-32k-0613":return 32768;case"gpt-4":case"gpt-4-0314":case"gpt-4-0613":return 8192;case"gpt-3.5-turbo-16k":case"gpt-3.5-turbo-16k-0613":return 16384;case"gpt-3.5-turbo":case"gpt-3.5-turbo-0301":case"gpt-3.5-turbo-0613":case"gpt-3.5-turbo-1106":case"gpt-3.5-turbo-0125":return 4096;case"text-davinci-003":case"text-davinci-002":return 4097;case"text-davinci-001":return 2049;case"text-curie-001":case"text-babbage-001":case"text-ada-001":return 2048;case"code-davinci-002":case"code-davinci-001":return 8e3;case"code-cushman-001":return 2048;case"claude-3-5-sonnet-20241022":case"claude-3-5-sonnet-20240620":case"claude-3-opus-20240229":case"claude-3-sonnet-20240229":case"claude-3-haiku-20240307":case"claude-2.1":return 2e5;case"claude-2.0":case"claude-instant-1.2":return 1e5;case"gemini-1.5-pro":case"gemini-1.5-pro-latest":case"gemini-1.5-flash":case"gemini-1.5-flash-latest":return 1e6;case"gemini-pro":case"gemini-pro-vision":return 32768;default:return 4097}};function BF(e){return typeof e!="object"||!e?!1:!!("type"in e&&e.type==="function"&&"function"in e&&typeof e.function=="object"&&e.function&&"name"in e.function&&"parameters"in e.function)}var VF=async({prompt:e,modelName:t})=>{let r;try{r=(await Yp(Xp(t))).encode(e).length}catch{console.warn("Failed to calculate number of tokens, falling back to approximate count"),r=Math.ceil(e.length/4)}return iP(t)-r},ZF=()=>!1,Qp=class extends se{verbose;callbacks;tags;metadata;get lc_attributes(){return{callbacks:void 0,verbose:void 0}}constructor(e){super(e),this.verbose=e.verbose??ZF(),this.callbacks=e.callbacks,this.tags=e.tags??[],this.metadata=e.metadata??{},this._addVersion("@langchain/core","1.2.8")}_addVersion(e,t){let r=this.metadata?.versions;this.metadata={...this.metadata,versions:{...typeof r=="object"&&r!==null?r:{},[e]:t}}}},Xl=class extends Qp{get callKeys(){return["stop","timeout","signal","tags","metadata","callbacks"]}caller;cache;constructor({callbacks:e,callbackManager:t,...r}){let{cache:n,...i}=r;super({callbacks:e??t,...i}),typeof n=="object"?this.cache=n:n?this.cache=gg.global():this.cache=void 0,this.caller=new wi(r??{})}_encoding;async getNumTokens(e){let t;typeof e=="string"?t=e:t=e.map(n=>typeof n=="string"?n:n.type==="text"&&"text"in n?n.text:"").join("");let r=Math.ceil(t.length/4);if(!this._encoding)try{this._encoding=await Yp("modelName"in this?Xp(this.modelName):"gpt2")}catch(n){console.warn("Failed to calculate number of tokens, falling back to approximate count",n)}if(this._encoding)try{r=this._encoding.encode(t).length}catch(n){console.warn("Failed to calculate number of tokens, falling back to approximate count",n)}return r}static _convertInputToPromptValue(e){return typeof e=="string"?new ql(e):Array.isArray(e)?new Yl(e.map(Et)):e}_identifyingParams(){return{}}_getSerializedCacheKeyParametersForCall({config:e,...t}){let r={...this._identifyingParams(),...t,_type:this._llmType(),_model:this._modelType()};return Object.entries(r).filter(([n,i])=>i!==void 0).map(([n,i])=>`${n}:${JSON.stringify(i)}`).sort().join(",")}serialize(){return{...this._identifyingParams(),_type:this._llmType(),_model:this._modelType()}}static async deserialize(e){throw new Error("Use .toJSON() instead")}get profile(){return{}}_filterInvocationParamsForTracing(e){let{tools:t,functions:r,messages:n,response_format:i,...a}=e;return a}};var Oi=class extends se{static lc_name(){return"RunnablePassthrough"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;func;constructor(e){super(e),e&&(this.func=e.func)}async invoke(e,t){let r=ke(t);return this.func&&await this.func(e,r),this._callWithConfig(n=>Promise.resolve(n),e,r)}async*transform(e,t){let r=ke(t),n,i=!0;for await(let a of this._transformStreamWithConfig(e,o=>o,r))if(yield a,i)if(n===void 0)n=a;else try{n=Mr(n,a)}catch{n=void 0,i=!1}this.func&&n!==void 0&&await this.func(n,r)}static assign(e){return new Jl(new Oa({steps:e}))}};var aP=class extends se{static lc_name(){return"RouterRunnable"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;runnables;constructor(e){super(e),this.runnables=e.runnables}async invoke(e,t){let{key:r,input:n}=e,i=this.runnables[r];if(i===void 0)throw new Error(`No runnable associated with key "${r}".`);return i.invoke(n,ke(t))}async batch(e,t,r){let n=e.map(u=>u.key),i=e.map(u=>u.input);if(n.find(u=>this.runnables[u]===void 0)!==void 0)throw new Error("One or more keys do not have a corresponding runnable.");let a=n.map(u=>this.runnables[u]),o=this._getOptionsList(t??{},e.length),s=o[0]?.maxConcurrency??r?.maxConcurrency,c=s&&s>0?s:e.length,l=[];for(let u=0;u<i.length;u+=c){let d=i.slice(u,u+c).map((p,m)=>a[m].invoke(p,o[m])),f=await Promise.all(d);l.push(f)}return l.flat()}async stream(e,t){let{key:r,input:n}=e,i=this.runnables[r];if(i===void 0)throw new Error(`No runnable associated with key "${r}".`);return i.stream(n,t)}};var oP=class extends se{static lc_name(){return"RunnableBranch"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;default;branches;constructor(e){super(e),this.branches=e.branches,this.default=e.default}static from(e){if(e.length<1)throw new Error("RunnableBranch requires at least one branch");let t=e.slice(0,-1).map(([n,i])=>[at(n),at(i)]),r=at(e[e.length-1]);return new this({branches:t,default:r})}async _invoke(e,t,r){let n;for(let i=0;i<this.branches.length;i+=1){let[a,o]=this.branches[i];if(await a.invoke(e,$e(t,{callbacks:r?.getChild(`condition:${i+1}`)}))){n=await o.invoke(e,$e(t,{callbacks:r?.getChild(`branch:${i+1}`)}));break}}return n||(n=await this.default.invoke(e,$e(t,{callbacks:r?.getChild("branch:default")}))),n}async invoke(e,t={}){return this._callWithConfig(this._invoke,e,t)}async*_streamIterator(e,t){let r=await(await Jt(t))?.handleChainStart(this.toJSON(),_t(e,"input"),t?.runId,void 0,void 0,void 0,t?.runName),n,i=!0,a;try{for(let o=0;o<this.branches.length;o+=1){let[s,c]=this.branches[o];if(await s.invoke(e,$e(t,{callbacks:r?.getChild(`condition:${o+1}`)}))){a=await c.stream(e,$e(t,{callbacks:r?.getChild(`branch:${o+1}`)}));for await(let l of a)if(yield l,i)if(n===void 0)n=l;else try{n=Mr(n,l)}catch{n=void 0,i=!1}break}}if(a===void 0){a=await this.default.stream(e,$e(t,{callbacks:r?.getChild("branch:default")}));for await(let o of a)if(yield o,i)if(n===void 0)n=o;else try{n=Mr(n,o)}catch{n=void 0,i=!1}}}catch(o){throw await r?.handleChainError(o),o}await r?.handleChainEnd(n??{})}};var sP=class extends en{runnable;inputMessagesKey;outputMessagesKey;historyMessagesKey;getMessageHistory;constructor(e){let t=Yt.from((a,o)=>this._enterHistory(a,o??{})).withConfig({runName:"loadHistory"}),r=e.historyMessagesKey??e.inputMessagesKey;r&&(t=Oi.assign({[r]:t}).withConfig({runName:"insertHistory"}));let n=t.pipe(e.runnable.withListeners({onEnd:(a,o)=>this._exitHistory(a,o??{})})).withConfig({runName:"RunnableWithMessageHistory"}),i=e.config??{};super({...e,config:i,bound:n}),this.runnable=e.runnable,this.getMessageHistory=e.getMessageHistory,this.inputMessagesKey=e.inputMessagesKey,this.outputMessagesKey=e.outputMessagesKey,this.historyMessagesKey=e.historyMessagesKey}_getInputMessages(e){let t;if(typeof e=="object"&&!Array.isArray(e)&&!rt(e)){let r;this.inputMessagesKey?r=this.inputMessagesKey:Object.keys(e).length===1?r=Object.keys(e)[0]:r="input",Array.isArray(e[r])&&Array.isArray(e[r][0])?t=e[r][0]:t=e[r]}else t=e;if(typeof t=="string")return[new ot(t)];if(Array.isArray(t))return t;if(rt(t))return[t];throw new Error(`Expected a string, BaseMessage, or array of BaseMessages.
246
+ Got ${JSON.stringify(t,null,2)}`)}_getOutputMessages(e){let t;if(!Array.isArray(e)&&!rt(e)&&typeof e!="string"){let r;this.outputMessagesKey!==void 0?r=this.outputMessagesKey:Object.keys(e).length===1?r=Object.keys(e)[0]:r="output",e.generations!==void 0?t=e.generations[0][0].message:t=e[r]}else t=e;if(typeof t=="string")return[new Ne(t)];if(Array.isArray(t))return t;if(rt(t))return[t];throw new Error(`Expected a string, BaseMessage, or array of BaseMessages. Received: ${JSON.stringify(t,null,2)}`)}async _enterHistory(e,t){let r=await(t?.configurable?.messageHistory).getMessages();return this.historyMessagesKey===void 0?r.concat(this._getInputMessages(e)):r}async _exitHistory(e,t){let r=t.configurable?.messageHistory,n;Array.isArray(e.inputs)&&Array.isArray(e.inputs[0])?n=e.inputs[0]:n=e.inputs;let i=this._getInputMessages(n);if(this.historyMessagesKey===void 0){let s=await r.getMessages();i=i.slice(s.length)}let a=e.outputs;if(!a)throw new Error(`Output values from 'Run' undefined. Run: ${JSON.stringify(e,null,2)}`);let o=this._getOutputMessages(a);await r.addMessages([...i,...o])}async _mergeConfig(...e){let t=await super._mergeConfig(...e);if(!t.configurable||!t.configurable.sessionId){let n={[this.inputMessagesKey??"input"]:"foo"};throw new Error(`sessionId is required. Pass it in as part of the config argument to .invoke() or .stream()
247
+ eg. chain.invoke(${JSON.stringify(n)}, ${JSON.stringify({configurable:{sessionId:"123"}})})`)}let{sessionId:r}=t.configurable;return t.configurable.messageHistory=await this.getMessageHistory(r),t}};var cP=T({RouterRunnable:()=>aP,Runnable:()=>se,RunnableAssign:()=>Jl,RunnableBinding:()=>en,RunnableBranch:()=>oP,RunnableEach:()=>mO,RunnableLambda:()=>Yt,RunnableMap:()=>Oa,RunnableParallel:()=>vO,RunnablePassthrough:()=>Oi,RunnablePick:()=>px,RunnableRetry:()=>Vp,RunnableSequence:()=>Lr,RunnableToolLike:()=>Bp,RunnableWithFallbacks:()=>fx,RunnableWithMessageHistory:()=>sP,_coerceToRunnable:()=>at,ensureConfig:()=>ke,getCallbackManagerForConfig:()=>Jt,mergeConfigs:()=>$t,patchConfig:()=>$e,pickRunnableConfigKeys:()=>vr,raceWithSignal:()=>Rr});var lP=T({applyPatch:()=>yi,compare:()=>vi});var oc=class extends se{parseResultWithPrompt(e,t,r){return this.parseResult(e,r)}_baseMessageToString(e){return typeof e.content=="string"?e.content:this._baseMessageContentToString(e.content)}_baseMessageContentToString(e){return JSON.stringify(e)}async invoke(e,t){return typeof e=="string"?this._callWithConfig(async(r,n)=>this.parseResult([{text:r}],n?.callbacks),e,{...t,runType:"parser"}):this._callWithConfig(async(r,n)=>this.parseResult([{message:r,text:this._baseMessageToString(r)}],n?.callbacks),e,{...t,runType:"parser"})}},vn=class extends oc{parseResult(e,t){return this.parse(e[0].text,t)}async parseWithPrompt(e,t,r){return this.parse(e,r)}_type(){throw new Error("_type not implemented")}},Xt=class extends Error{llmOutput;observation;sendToLLM;constructor(e,t,r,n=!1){if(super(e),this.llmOutput=t,this.observation=r,this.sendToLLM=n,n&&(r===void 0||t===void 0))throw new Error("Arguments 'observation' & 'llmOutput' are required if 'sendToLlm' is true");fi(this,"OUTPUT_PARSING_FAILURE")}};var Pi=class extends vn{async*_transform(e){for await(let t of e)typeof t=="string"?yield this.parseResult([{text:t}]):yield this.parseResult([{message:t,text:this._baseMessageToString(t)}])}async*transform(e,t){yield*this._transformStreamWithConfig(e,this._transform.bind(this),{...t,runType:"parser"})}},Qn=class extends Pi{diff=!1;constructor(e){super(e),this.diff=e?.diff??this.diff}async*_transform(e){let t,r;for await(let n of e){if(typeof n!="string"&&typeof n.content!="string")throw new Error("Cannot handle non-string output.");let i;if(mi(n)){if(typeof n.content!="string")throw new Error("Cannot handle non-string message output.");i=new fa({message:n,text:n.content})}else if(rt(n)){if(typeof n.content!="string")throw new Error("Cannot handle non-string message output.");i=new fa({message:no(n),text:n.content})}else i=new bi({text:n});r===void 0?r=i:r=r.concat(i);let a=await this.parsePartialResult([r]);a!=null&&!qn(a,t)&&(this.diff?yield this._diff(t,a):yield a,t=a)}}getFormatInstructions(){return""}};var uP=class extends Pi{static lc_name(){return"BytesOutputParser"}lc_namespace=["langchain_core","output_parsers","bytes"];lc_serializable=!0;textEncoder=new TextEncoder;parse(e){return Promise.resolve(this.textEncoder.encode(e))}getFormatInstructions(){return""}};var sc=class extends Pi{re;async*_transform(e){let t="";for await(let r of e)if(typeof r=="string"?t+=r:t+=r.content,this.re){let n=[...t.matchAll(this.re)];if(n.length>1){let i=0;for(let a of n.slice(0,-1))yield[a[1]],i+=(a.index??0)+a[0].length;t=t.slice(i)}}else{let n=await this.parse(t);if(n.length>1){for(let i of n.slice(0,-1))yield[i];t=n[n.length-1]}}for(let r of await this.parse(t))yield[r]}},dP=class extends sc{static lc_name(){return"CommaSeparatedListOutputParser"}lc_namespace=["langchain_core","output_parsers","list"];lc_serializable=!0;async parse(e){try{return e.trim().split(",").map(t=>t.trim())}catch{throw new Xt(`Could not parse output: ${e}`,e)}}getFormatInstructions(){return"Your response should be a list of comma separated values, eg: `foo, bar, baz`"}},fP=class extends sc{lc_namespace=["langchain_core","output_parsers","list"];length;separator;constructor({length:e,separator:t}){super(...arguments),this.length=e,this.separator=t||","}async parse(e){try{let t=e.trim().split(this.separator).map(r=>r.trim());if(this.length!==void 0&&t.length!==this.length)throw new Xt(`Incorrect number of items. Expected ${this.length}, got ${t.length}.`);return t}catch(t){throw Object.getPrototypeOf(t)===Xt.prototype?t:new Xt(`Could not parse output: ${e}`)}}getFormatInstructions(){return`Your response should be a list of ${this.length===void 0?"":`${this.length} `}items separated by "${this.separator}" (eg: \`foo${this.separator} bar${this.separator} baz\`)`}},pP=class extends sc{static lc_name(){return"NumberedListOutputParser"}lc_namespace=["langchain_core","output_parsers","list"];lc_serializable=!0;getFormatInstructions(){return`Your response should be a numbered list with each item on a new line. For example:
248
+
249
+ 1. foo
250
+
251
+ 2. bar
252
+
253
+ 3. baz`}re=/\d+\.\s([^\n]+)/g;async parse(e){return[...e.matchAll(this.re)??[]].map(t=>t[1])}},mP=class extends sc{static lc_name(){return"NumberedListOutputParser"}lc_namespace=["langchain_core","output_parsers","list"];lc_serializable=!0;getFormatInstructions(){return`Your response should be a numbered list with each item on a new line. For example:
254
+
255
+ 1. foo
256
+
257
+ 2. bar
258
+
259
+ 3. baz`}re=/^\s*[-*]\s([^\n]+)$/gm;async parse(e){return[...e.matchAll(this.re)??[]].map(t=>t[1])}};var hP=class extends Pi{static lc_name(){return"StrOutputParser"}lc_namespace=["langchain_core","output_parsers","string"];lc_serializable=!0;parse(e){return Promise.resolve(e)}getFormatInstructions(){return""}_textContentToString(e){return e.text}_imageUrlContentToString(e){throw new Error('Cannot coerce a multimodal "image_url" message part into a string.')}_messageContentToString(e){switch(e.type){case"text":case"text_delta":if("text"in e)return this._textContentToString(e);break;case"image_url":if("image_url"in e)return this._imageUrlContentToString(e);break;case"reasoning":case"thinking":case"redacted_thinking":return"";default:throw new Error(`Cannot coerce "${e.type}" message part into a string.`)}throw new Error(`Invalid content type: ${e.type}`)}_baseMessageContentToString(e){return e.reduce((t,r)=>t+this._messageContentToString(r),"")}};var em=class extends Qn{static lc_name(){return"JsonOutputParser"}lc_namespace=["langchain_core","output_parsers"];lc_serializable=!0;_concatOutputChunks(e,t){return this.diff?super._concatOutputChunks(e,t):t}_diff(e,t){if(t)return e?vi(e,t):[{op:"replace",path:"",value:t}]}async parsePartialResult(e){return Xa(e[0].text)}async parse(e){return Xa(e,JSON.parse)}getFormatInstructions(){return""}_baseMessageToString(e){return e.text}};var tm=class extends vn{static lc_name(){return"StandardSchemaOutputParser"}lc_namespace=["langchain","output_parsers","standard_schema"];schema;constructor(e){super(),this.schema=e}static fromSerializableSchema(e){return new this(e)}async parse(e){try{let t=Xa(e,JSON.parse),r=await this.schema["~standard"].validate(t);if(r.issues)throw new Error(`Validation failed: ${JSON.stringify(r.issues)}`);return r.value}catch(t){throw new Xt(`Failed to parse. Text: "${e}". Error: ${t}`,e)}}_baseMessageToString(e){return e.text}getFormatInstructions(){return""}};var Ql=class extends vn{schema;static lc_name(){return"StructuredOutputParser"}lc_namespace=["langchain","output_parsers","structured"];toJSON(){return this.toJSONNotImplemented()}constructor(e){super(e),this.schema=e}static fromZodSchema(e){return new this(e)}static fromNamesAndDescriptions(e){let t=Rt.object(Object.fromEntries(Object.entries(e).map(([r,n])=>[r,Rt.string().describe(n)])));return new this(t)}getFormatInstructions(){return`You must format your output as a JSON value that adheres to a given "JSON Schema" instance.
260
+
261
+ "JSON Schema" is a declarative language that allows you to annotate and validate JSON documents.
262
+
263
+ For example, the example "JSON Schema" instance {{"properties": {{"foo": {{"description": "a list of test words", "type": "array", "items": {{"type": "string"}}}}}}, "required": ["foo"]}}
264
+ would match an object with one required property, "foo". The "type" property specifies "foo" must be an "array", and the "description" property semantically describes it as "a list of test words". The items within "foo" must be strings.
265
+ Thus, the object {{"foo": ["bar", "baz"]}} is a well-formatted instance of this example "JSON Schema". The object {{"properties": {{"foo": ["bar", "baz"]}}}} is not well-formatted.
266
+
267
+ Your output will be parsed and type-checked according to the provided schema instance, so make sure all fields in your output match the schema exactly and there are no trailing commas!
268
+
269
+ Here is the JSON Schema instance your output must adhere to. Include the enclosing markdown codeblock:
270
+ \`\`\`json
271
+ ${JSON.stringify(It(this.schema))}
272
+ \`\`\`
273
+ `}async parse(e){try{let t=e.trim(),r=(t.match(/^```(?:json)?\s*([\s\S]*?)```/)?.[1]||t.match(/```json\s*([\s\S]*?)```/)?.[1]||t).replace(/"([^"\\]*(\\.[^"\\]*)*)"/g,(n,i)=>`"${i.replace(/\n/g,"\\n")}"`).replace(/\n/g,"");return await ka(this.schema,JSON.parse(r))}catch(t){throw new Xt(`Failed to parse. Text: "${e}". Error: ${t}`,e)}}_baseMessageToString(e){return e.text}},Ax=class extends Ql{static lc_name(){return"JsonMarkdownStructuredOutputParser"}getFormatInstructions(e){let t=e?.interpolationDepth??1;if(t<1)throw new Error("f string interpolation depth must be at least 1");return`Return a markdown code snippet with a JSON object formatted to look like:
274
+ \`\`\`json
275
+ ${this._schemaToInstruction(It(this.schema)).replaceAll("{","{".repeat(t)).replaceAll("}","}".repeat(t))}
276
+ \`\`\``}_schemaToInstruction(e,t=2){let r=e;if("type"in r){let n=!1,i;if(Array.isArray(r.type)){let s=r.type.findIndex(c=>c==="null");s!==-1&&(n=!0,r.type.splice(s,1)),i=r.type.join(" | ")}else i=r.type;if(r.type==="object"&&r.properties){let s=r.description?` // ${r.description}`:"";return`{
277
+ ${Object.entries(r.properties).map(([c,l])=>{let u=r.required?.includes(c)?"":" (optional)";return`${" ".repeat(t)}"${c}": ${this._schemaToInstruction(l,t+2)}${u}`}).join(`
278
+ `)}
279
+ ${" ".repeat(t-2)}}${s}`}if(r.type==="array"&&r.items){let s=r.description?` // ${r.description}`:"";return`array[
280
+ ${" ".repeat(t)}${this._schemaToInstruction(r.items,t+2)}
281
+ ${" ".repeat(t-2)}] ${s}`}let a=n?" (nullable)":"",o=r.description?` // ${r.description}`:"";return`${i}${o}${a}`}if("anyOf"in r)return r.anyOf.map(n=>this._schemaToInstruction(n,t)).join(`
282
+ ${" ".repeat(t-2)}`);throw new Error("unsupported schema type")}static fromZodSchema(e){return new this(e)}static fromNamesAndDescriptions(e){let t=Rt.object(Object.fromEntries(Object.entries(e).map(([r,n])=>[r,Rt.string().describe(n)])));return new this(t)}},gP=class extends vn{structuredInputParser;constructor({inputSchema:e}){super(...arguments),this.structuredInputParser=new Ax(e)}async parse(e){let t;try{t=await this.structuredInputParser.parse(e)}catch(r){throw new Xt(`Failed to parse. Text: "${e}". Error: ${r}`,e)}return this.outputProcessor(t)}getFormatInstructions(){return this.structuredInputParser.getFormatInstructions()}};var HF=function(){let e={};e.parser=function(v,g){return new r(v,g)},e.SAXParser=r,e.SAXStream=l,e.createStream=c,e.MAX_BUFFER_LENGTH=65536;let t=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];e.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function r(v,g){if(!(this instanceof r))return new r(v,g);var O=this;i(O),O.q=O.c="",O.bufferCheckPosition=e.MAX_BUFFER_LENGTH,O.opt=g||{},O.opt.lowercase=O.opt.lowercase||O.opt.lowercasetags,O.looseCase=O.opt.lowercase?"toLowerCase":"toUpperCase",O.tags=[],O.closed=O.closedRoot=O.sawRoot=!1,O.tag=O.error=null,O.strict=!!v,O.noscript=!!(v||O.opt.noscript),O.state=b.BEGIN,O.strictEntities=O.opt.strictEntities,O.ENTITIES=O.strictEntities?Object.create(e.XML_ENTITIES):Object.create(e.ENTITIES),O.attribList=[],O.opt.xmlns&&(O.ns=Object.create(m)),O.trackPosition=O.opt.position!==!1,O.trackPosition&&(O.position=O.line=O.column=0),L(O,"onready")}Object.create||(Object.create=function(v){function g(){}return g.prototype=v,new g}),Object.keys||(Object.keys=function(v){var g=[];for(var O in v)v.hasOwnProperty(O)&&g.push(O);return g});function n(v){for(var g=Math.max(e.MAX_BUFFER_LENGTH,10),O=0,$=0,Ce=t.length;$<Ce;$++){var Ue=v[t[$]].length;if(Ue>g)switch(t[$]){case"textNode":ae(v);break;case"cdata":q(v,"oncdata",v.cdata),v.cdata="";break;case"script":q(v,"onscript",v.script),v.script="";break;default:Oe(v,"Max buffer length exceeded: "+t[$])}O=Math.max(O,Ue)}v.bufferCheckPosition=e.MAX_BUFFER_LENGTH-O+v.position}function i(v){for(var g=0,O=t.length;g<O;g++)v[t[g]]=""}function a(v){ae(v),v.cdata!==""&&(q(v,"oncdata",v.cdata),v.cdata=""),v.script!==""&&(q(v,"onscript",v.script),v.script="")}r.prototype={end:function(){mt(this)},write:sn,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){a(this)}};var o=ReadableStream;o||(o=function(){});var s=e.EVENTS.filter(function(v){return v!=="error"&&v!=="end"});function c(v,g){return new l(v,g)}function l(v,g){if(!(this instanceof l))return new l(v,g);o.apply(this),this._parser=new r(v,g),this.writable=!0,this.readable=!0;var O=this;this._parser.onend=function(){O.emit("end")},this._parser.onerror=function($){O.emit("error",$),O._parser.error=null},this._decoder=null,s.forEach(function($){Object.defineProperty(O,"on"+$,{get:function(){return O._parser["on"+$]},set:function(Ce){if(!Ce)return O.removeAllListeners($),O._parser["on"+$]=Ce,Ce;O.on($,Ce)},enumerable:!0,configurable:!1})})}l.prototype=Object.create(o.prototype,{constructor:{value:l}}),l.prototype.write=function(v){return this._parser.write(v.toString()),this.emit("data",v),!0},l.prototype.end=function(v){return v&&v.length&&this.write(v),this._parser.end(),!0},l.prototype.on=function(v,g){var O=this;return!O._parser["on"+v]&&s.indexOf(v)!==-1&&(O._parser["on"+v]=function(){var $=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);$.splice(0,0,v),O.emit.apply(O,$)}),o.prototype.on.call(O,v,g)};var u="[CDATA[",d="DOCTYPE",f="http://www.w3.org/XML/1998/namespace",p="http://www.w3.org/2000/xmlns/",m={xml:f,xmlns:p},h=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,_=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,y=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,w=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function x(v){return v===" "||v===`
283
+ `||v==="\r"||v===" "}function S(v){return v==='"'||v==="'"}function E(v){return v===">"||x(v)}function P(v,g){return v.test(g)}function C(v,g){return!P(v,g)}var b=0;e.STATE={BEGIN:b++,BEGIN_WHITESPACE:b++,TEXT:b++,TEXT_ENTITY:b++,OPEN_WAKA:b++,SGML_DECL:b++,SGML_DECL_QUOTED:b++,DOCTYPE:b++,DOCTYPE_QUOTED:b++,DOCTYPE_DTD:b++,DOCTYPE_DTD_QUOTED:b++,COMMENT_STARTING:b++,COMMENT:b++,COMMENT_ENDING:b++,COMMENT_ENDED:b++,CDATA:b++,CDATA_ENDING:b++,CDATA_ENDING_2:b++,PROC_INST:b++,PROC_INST_BODY:b++,PROC_INST_ENDING:b++,OPEN_TAG:b++,OPEN_TAG_SLASH:b++,ATTRIB:b++,ATTRIB_NAME:b++,ATTRIB_NAME_SAW_WHITE:b++,ATTRIB_VALUE:b++,ATTRIB_VALUE_QUOTED:b++,ATTRIB_VALUE_CLOSED:b++,ATTRIB_VALUE_UNQUOTED:b++,ATTRIB_VALUE_ENTITY_Q:b++,ATTRIB_VALUE_ENTITY_U:b++,CLOSE_TAG:b++,CLOSE_TAG_SAW_WHITE:b++,SCRIPT:b++,SCRIPT_ENDING:b++},e.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},e.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(e.ENTITIES).forEach(function(v){var g=e.ENTITIES[v],O=typeof g=="number"?String.fromCharCode(g):g;e.ENTITIES[v]=O});for(var B in e.STATE)e.STATE[e.STATE[B]]=B;b=e.STATE;function L(v,g,O){v[g]&&v[g](O)}function q(v,g,O){v.textNode&&ae(v),L(v,g,O)}function ae(v){v.textNode=Se(v.opt,v.textNode),v.textNode&&L(v,"ontext",v.textNode),v.textNode=""}function Se(v,g){return v.trim&&(g=g.trim()),v.normalize&&(g=g.replace(/\s+/g," ")),g}function Oe(v,g){return ae(v),v.trackPosition&&(g+=`
284
+ Line: `+v.line+`
285
+ Column: `+v.column+`
286
+ Char: `+v.c),g=new Error(g),v.error=g,L(v,"onerror",g),v}function mt(v){return v.sawRoot&&!v.closedRoot&&ye(v,"Unclosed root tag"),v.state!==b.BEGIN&&v.state!==b.BEGIN_WHITESPACE&&v.state!==b.TEXT&&Oe(v,"Unexpected end"),ae(v),v.c="",v.closed=!0,L(v,"onend"),r.call(v,v.strict,v.opt),v}function ye(v,g){if(typeof v!="object"||!(v instanceof r))throw new Error("bad call to strictFail");v.strict&&Oe(v,g)}function V(v){v.strict||(v.tagName=v.tagName[v.looseCase]());var g=v.tags[v.tags.length-1]||v,O=v.tag={name:v.tagName,attributes:{}};v.opt.xmlns&&(O.ns=g.ns),v.attribList.length=0,q(v,"onopentagstart",O)}function X(v,g){var O=v.indexOf(":")<0?["",v]:v.split(":"),$=O[0],Ce=O[1];return g&&v==="xmlns"&&($="xmlns",Ce=""),{prefix:$,local:Ce}}function ne(v){if(v.strict||(v.attribName=v.attribName[v.looseCase]()),v.attribList.indexOf(v.attribName)!==-1||v.tag.attributes.hasOwnProperty(v.attribName)){v.attribName=v.attribValue="";return}if(v.opt.xmlns){var g=X(v.attribName,!0),O=g.prefix,$=g.local;if(O==="xmlns")if($==="xml"&&v.attribValue!==f)ye(v,"xml: prefix must be bound to "+f+`
287
+ Actual: `+v.attribValue);else if($==="xmlns"&&v.attribValue!==p)ye(v,"xmlns: prefix must be bound to "+p+`
288
+ Actual: `+v.attribValue);else{var Ce=v.tag,Ue=v.tags[v.tags.length-1]||v;Ce.ns===Ue.ns&&(Ce.ns=Object.create(Ue.ns)),Ce.ns[$]=v.attribValue}v.attribList.push([v.attribName,v.attribValue])}else v.tag.attributes[v.attribName]=v.attribValue,q(v,"onattribute",{name:v.attribName,value:v.attribValue});v.attribName=v.attribValue=""}function ie(v,g){if(v.opt.xmlns){var O=v.tag,$=X(v.tagName);O.prefix=$.prefix,O.local=$.local,O.uri=O.ns[$.prefix]||"",O.prefix&&!O.uri&&(ye(v,"Unbound namespace prefix: "+JSON.stringify(v.tagName)),O.uri=$.prefix);var Ce=v.tags[v.tags.length-1]||v;O.ns&&Ce.ns!==O.ns&&Object.keys(O.ns).forEach(function(Ba){q(v,"onopennamespace",{prefix:Ba,uri:O.ns[Ba]})});for(var Ue=0,bt=v.attribList.length;Ue<bt;Ue++){var dt=v.attribList[Ue],Ft=dt[0],Br=dt[1],ft=X(Ft,!0),An=ft.prefix,es=ft.local,Ku=An===""?"":O.ns[An]||"",J={name:Ft,value:Br,prefix:An,local:es,uri:Ku};An&&An!=="xmlns"&&!Ku&&(ye(v,"Unbound namespace prefix: "+JSON.stringify(An)),J.uri=An),v.tag.attributes[Ft]=J,q(v,"onattribute",J)}v.attribList.length=0}v.tag.isSelfClosing=!!g,v.sawRoot=!0,v.tags.push(v.tag),q(v,"onopentag",v.tag),g||(!v.noscript&&v.tagName.toLowerCase()==="script"?v.state=b.SCRIPT:v.state=b.TEXT,v.tag=null,v.tagName=""),v.attribName=v.attribValue="",v.attribList.length=0}function Te(v){if(!v.tagName){ye(v,"Weird empty close tag."),v.textNode+="</>",v.state=b.TEXT;return}if(v.script){if(v.tagName!=="script"){v.script+="</"+v.tagName+">",v.tagName="",v.state=b.SCRIPT;return}q(v,"onscript",v.script),v.script=""}var g=v.tags.length,O=v.tagName;v.strict||(O=O[v.looseCase]());for(var $=O;g--&&v.tags[g].name!==$;)ye(v,"Unexpected close tag");if(g<0){ye(v,"Unmatched closing tag: "+v.tagName),v.textNode+="</"+v.tagName+">",v.state=b.TEXT;return}v.tagName=O;for(var Ce=v.tags.length;Ce-- >g;){var Ue=v.tag=v.tags.pop();v.tagName=v.tag.name,q(v,"onclosetag",v.tagName);var bt={};for(var dt in Ue.ns)bt[dt]=Ue.ns[dt];var Ft=v.tags[v.tags.length-1]||v;v.opt.xmlns&&Ue.ns!==Ft.ns&&Object.keys(Ue.ns).forEach(function(Br){var ft=Ue.ns[Br];q(v,"onclosenamespace",{prefix:Br,uri:ft})})}g===0&&(v.closedRoot=!0),v.tagName=v.attribValue=v.attribName="",v.attribList.length=0,v.state=b.TEXT}function Tr(v){var g=v.entity,O=g.toLowerCase(),$,Ce="";return v.ENTITIES[g]?v.ENTITIES[g]:v.ENTITIES[O]?v.ENTITIES[O]:(g=O,g.charAt(0)==="#"&&(g.charAt(1)==="x"?(g=g.slice(2),$=parseInt(g,16),Ce=$.toString(16)):(g=g.slice(1),$=parseInt(g,10),Ce=$.toString(10))),g=g.replace(/^0+/,""),isNaN($)||Ce.toLowerCase()!==g?(ye(v,"Invalid character entity"),"&"+v.entity+";"):String.fromCodePoint($))}function Vi(v,g){g==="<"?(v.state=b.OPEN_WAKA,v.startTagPosition=v.position):x(g)||(ye(v,"Non-whitespace before first tag."),v.textNode=g,v.state=b.TEXT)}function Zi(v,g){var O="";return g<v.length&&(O=v.charAt(g)),O}function sn(v){var g=this;if(this.error)throw this.error;if(g.closed)return Oe(g,"Cannot write after close. Assign an onready handler.");if(v===null)return mt(g);typeof v=="object"&&(v=v.toString());for(var O=0,$="";$=Zi(v,O++),g.c=$,!!$;)switch(g.trackPosition&&(g.position++,$===`
289
+ `?(g.line++,g.column=0):g.column++),g.state){case b.BEGIN:if(g.state=b.BEGIN_WHITESPACE,$==="\uFEFF")continue;Vi(g,$);continue;case b.BEGIN_WHITESPACE:Vi(g,$);continue;case b.TEXT:if(g.sawRoot&&!g.closedRoot){for(var Ce=O-1;$&&$!=="<"&&$!=="&";)$=Zi(v,O++),$&&g.trackPosition&&(g.position++,$===`
290
+ `?(g.line++,g.column=0):g.column++);g.textNode+=v.substring(Ce,O-1)}$==="<"&&!(g.sawRoot&&g.closedRoot&&!g.strict)?(g.state=b.OPEN_WAKA,g.startTagPosition=g.position):(!x($)&&(!g.sawRoot||g.closedRoot)&&ye(g,"Text data outside of root node."),$==="&"?g.state=b.TEXT_ENTITY:g.textNode+=$);continue;case b.SCRIPT:$==="<"?g.state=b.SCRIPT_ENDING:g.script+=$;continue;case b.SCRIPT_ENDING:$==="/"?g.state=b.CLOSE_TAG:(g.script+="<"+$,g.state=b.SCRIPT);continue;case b.OPEN_WAKA:if($==="!")g.state=b.SGML_DECL,g.sgmlDecl="";else if(!x($))if(P(h,$))g.state=b.OPEN_TAG,g.tagName=$;else if($==="/")g.state=b.CLOSE_TAG,g.tagName="";else if($==="?")g.state=b.PROC_INST,g.procInstName=g.procInstBody="";else{if(ye(g,"Unencoded <"),g.startTagPosition+1<g.position){var Ue=g.position-g.startTagPosition;$=new Array(Ue).join(" ")+$}g.textNode+="<"+$,g.state=b.TEXT}continue;case b.SGML_DECL:(g.sgmlDecl+$).toUpperCase()===u?(q(g,"onopencdata"),g.state=b.CDATA,g.sgmlDecl="",g.cdata=""):g.sgmlDecl+$==="--"?(g.state=b.COMMENT,g.comment="",g.sgmlDecl=""):(g.sgmlDecl+$).toUpperCase()===d?(g.state=b.DOCTYPE,(g.doctype||g.sawRoot)&&ye(g,"Inappropriately located doctype declaration"),g.doctype="",g.sgmlDecl=""):$===">"?(q(g,"onsgmldeclaration",g.sgmlDecl),g.sgmlDecl="",g.state=b.TEXT):(S($)&&(g.state=b.SGML_DECL_QUOTED),g.sgmlDecl+=$);continue;case b.SGML_DECL_QUOTED:$===g.q&&(g.state=b.SGML_DECL,g.q=""),g.sgmlDecl+=$;continue;case b.DOCTYPE:$===">"?(g.state=b.TEXT,q(g,"ondoctype",g.doctype),g.doctype=!0):(g.doctype+=$,$==="["?g.state=b.DOCTYPE_DTD:S($)&&(g.state=b.DOCTYPE_QUOTED,g.q=$));continue;case b.DOCTYPE_QUOTED:g.doctype+=$,$===g.q&&(g.q="",g.state=b.DOCTYPE);continue;case b.DOCTYPE_DTD:g.doctype+=$,$==="]"?g.state=b.DOCTYPE:S($)&&(g.state=b.DOCTYPE_DTD_QUOTED,g.q=$);continue;case b.DOCTYPE_DTD_QUOTED:g.doctype+=$,$===g.q&&(g.state=b.DOCTYPE_DTD,g.q="");continue;case b.COMMENT:$==="-"?g.state=b.COMMENT_ENDING:g.comment+=$;continue;case b.COMMENT_ENDING:$==="-"?(g.state=b.COMMENT_ENDED,g.comment=Se(g.opt,g.comment),g.comment&&q(g,"oncomment",g.comment),g.comment=""):(g.comment+="-"+$,g.state=b.COMMENT);continue;case b.COMMENT_ENDED:$!==">"?(ye(g,"Malformed comment"),g.comment+="--"+$,g.state=b.COMMENT):g.state=b.TEXT;continue;case b.CDATA:$==="]"?g.state=b.CDATA_ENDING:g.cdata+=$;continue;case b.CDATA_ENDING:$==="]"?g.state=b.CDATA_ENDING_2:(g.cdata+="]"+$,g.state=b.CDATA);continue;case b.CDATA_ENDING_2:$===">"?(g.cdata&&q(g,"oncdata",g.cdata),q(g,"onclosecdata"),g.cdata="",g.state=b.TEXT):$==="]"?g.cdata+="]":(g.cdata+="]]"+$,g.state=b.CDATA);continue;case b.PROC_INST:$==="?"?g.state=b.PROC_INST_ENDING:x($)?g.state=b.PROC_INST_BODY:g.procInstName+=$;continue;case b.PROC_INST_BODY:if(!g.procInstBody&&x($))continue;$==="?"?g.state=b.PROC_INST_ENDING:g.procInstBody+=$;continue;case b.PROC_INST_ENDING:$===">"?(q(g,"onprocessinginstruction",{name:g.procInstName,body:g.procInstBody}),g.procInstName=g.procInstBody="",g.state=b.TEXT):(g.procInstBody+="?"+$,g.state=b.PROC_INST_BODY);continue;case b.OPEN_TAG:P(_,$)?g.tagName+=$:(V(g),$===">"?ie(g):$==="/"?g.state=b.OPEN_TAG_SLASH:(x($)||ye(g,"Invalid character in tag name"),g.state=b.ATTRIB));continue;case b.OPEN_TAG_SLASH:$===">"?(ie(g,!0),Te(g)):(ye(g,"Forward-slash in opening tag not followed by >"),g.state=b.ATTRIB);continue;case b.ATTRIB:if(x($))continue;$===">"?ie(g):$==="/"?g.state=b.OPEN_TAG_SLASH:P(h,$)?(g.attribName=$,g.attribValue="",g.state=b.ATTRIB_NAME):ye(g,"Invalid attribute name");continue;case b.ATTRIB_NAME:$==="="?g.state=b.ATTRIB_VALUE:$===">"?(ye(g,"Attribute without value"),g.attribValue=g.attribName,ne(g),ie(g)):x($)?g.state=b.ATTRIB_NAME_SAW_WHITE:P(_,$)?g.attribName+=$:ye(g,"Invalid attribute name");continue;case b.ATTRIB_NAME_SAW_WHITE:if($==="=")g.state=b.ATTRIB_VALUE;else{if(x($))continue;ye(g,"Attribute without value"),g.tag.attributes[g.attribName]="",g.attribValue="",q(g,"onattribute",{name:g.attribName,value:""}),g.attribName="",$===">"?ie(g):P(h,$)?(g.attribName=$,g.state=b.ATTRIB_NAME):(ye(g,"Invalid attribute name"),g.state=b.ATTRIB)}continue;case b.ATTRIB_VALUE:if(x($))continue;S($)?(g.q=$,g.state=b.ATTRIB_VALUE_QUOTED):(ye(g,"Unquoted attribute value"),g.state=b.ATTRIB_VALUE_UNQUOTED,g.attribValue=$);continue;case b.ATTRIB_VALUE_QUOTED:if($!==g.q){$==="&"?g.state=b.ATTRIB_VALUE_ENTITY_Q:g.attribValue+=$;continue}ne(g),g.q="",g.state=b.ATTRIB_VALUE_CLOSED;continue;case b.ATTRIB_VALUE_CLOSED:x($)?g.state=b.ATTRIB:$===">"?ie(g):$==="/"?g.state=b.OPEN_TAG_SLASH:P(h,$)?(ye(g,"No whitespace between attributes"),g.attribName=$,g.attribValue="",g.state=b.ATTRIB_NAME):ye(g,"Invalid attribute name");continue;case b.ATTRIB_VALUE_UNQUOTED:if(!E($)){$==="&"?g.state=b.ATTRIB_VALUE_ENTITY_U:g.attribValue+=$;continue}ne(g),$===">"?ie(g):g.state=b.ATTRIB;continue;case b.CLOSE_TAG:if(g.tagName)$===">"?Te(g):P(_,$)?g.tagName+=$:g.script?(g.script+="</"+g.tagName,g.tagName="",g.state=b.SCRIPT):(x($)||ye(g,"Invalid tagname in closing tag"),g.state=b.CLOSE_TAG_SAW_WHITE);else{if(x($))continue;C(h,$)?g.script?(g.script+="</"+$,g.state=b.SCRIPT):ye(g,"Invalid tagname in closing tag."):g.tagName=$}continue;case b.CLOSE_TAG_SAW_WHITE:if(x($))continue;$===">"?Te(g):ye(g,"Invalid characters in closing tag");continue;case b.TEXT_ENTITY:case b.ATTRIB_VALUE_ENTITY_Q:case b.ATTRIB_VALUE_ENTITY_U:var bt,dt;switch(g.state){case b.TEXT_ENTITY:bt=b.TEXT,dt="textNode";break;case b.ATTRIB_VALUE_ENTITY_Q:bt=b.ATTRIB_VALUE_QUOTED,dt="attribValue";break;case b.ATTRIB_VALUE_ENTITY_U:bt=b.ATTRIB_VALUE_UNQUOTED,dt="attribValue";break}if($===";")if(g.opt.unparsedEntities){var Ft=Tr(g);g.entity="",g.state=bt,g.write(Ft)}else g[dt]+=Tr(g),g.entity="",g.state=bt;else P(g.entity.length?w:y,$)?g.entity+=$:(ye(g,"Invalid character in entity name"),g[dt]+="&"+g.entity+$,g.entity="",g.state=bt);continue;default:throw new Error(g,"Unknown state: "+g.state)}return g.position>=g.bufferCheckPosition&&n(g),g}return String.fromCodePoint||(function(){var v=String.fromCharCode,g=Math.floor,O=function(){var $=16384,Ce=[],Ue,bt,dt=-1,Ft=arguments.length;if(!Ft)return"";for(var Br="";++dt<Ft;){var ft=Number(arguments[dt]);if(!isFinite(ft)||ft<0||ft>1114111||g(ft)!==ft)throw RangeError("Invalid code point: "+ft);ft<=65535?Ce.push(ft):(ft-=65536,Ue=(ft>>10)+55296,bt=ft%1024+56320,Ce.push(Ue,bt)),(dt+1===Ft||Ce.length>$)&&(Br+=v.apply(null,Ce),Ce.length=0)}return Br};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:O,configurable:!0,writable:!0}):String.fromCodePoint=O})(),e},_P=HF();var rm=`The output should be formatted as a XML file.
291
+ 1. Output should conform to the tags below.
292
+ 2. If tags are not given, make them on your own.
293
+ 3. Remember to always open and close all the tags.
294
+
295
+ As an example, for the tags ["foo", "bar", "baz"]:
296
+ 1. String "<foo>
297
+ <bar>
298
+ <baz></baz>
299
+ </bar>
300
+ </foo>" is a well-formatted instance of the schema.
301
+ 2. String "<foo>
302
+ <bar>
303
+ </foo>" is a badly-formatted instance.
304
+ 3. String "<foo>
305
+ <tag>
306
+ </tag>
307
+ </foo>" is a badly-formatted instance.
308
+
309
+ Here are the output tags:
310
+ \`\`\`
311
+ {tags}
312
+ \`\`\``,yP=class extends Qn{tags;constructor(e){super(e),this.tags=e?.tags}static lc_name(){return"XMLOutputParser"}lc_namespace=["langchain_core","output_parsers"];lc_serializable=!0;_diff(e,t){if(t)return e?vi(e,t):[{op:"replace",path:"",value:t}]}async parsePartialResult(e){return nm(e[0].text)}async parse(e){return nm(e)}getFormatInstructions(){return this.tags&&this.tags.length>0?rm.replace("{tags}",this.tags?.join(", ")??""):rm}},GF=e=>e.split(`
313
+ `).map(t=>t.replace(/^\s+/,"")).join(`
314
+ `).trim(),vP=e=>{if(Object.keys(e).length===0)return{};let t={};return e.children.length>0?(t[e.name]=e.children.map(vP),t):(t[e.name]=e.text??void 0,t)};function nm(e){let t=GF(e),r=_P.parser(!0),n={},i=[];r.onopentag=s=>{let c={name:s.name,attributes:s.attributes,children:[],text:"",isSelfClosing:s.isSelfClosing};i.length>0?i[i.length-1].children.push(c):n=c,s.isSelfClosing||i.push(c)},r.onclosetag=()=>{if(i.length>0){let s=i.pop();i.length===0&&s&&(n=s)}},r.ontext=s=>{if(i.length>0){let c=i[i.length-1];c.text+=s}},r.onattribute=s=>{if(i.length>0){let c=i[i.length-1];c.attributes[s.name]=s.value}};let a=/```(xml)?(.*)```/s.exec(t),o=a?a[2]:t;return r.write(o).close(),n&&n.name==="?xml"&&(n=n.children[0]),vP(n)}var bP=T({AsymmetricStructuredOutputParser:()=>gP,BaseCumulativeTransformOutputParser:()=>Qn,BaseLLMOutputParser:()=>oc,BaseOutputParser:()=>vn,BaseTransformOutputParser:()=>Pi,BytesOutputParser:()=>uP,CommaSeparatedListOutputParser:()=>dP,CustomListOutputParser:()=>fP,JsonMarkdownStructuredOutputParser:()=>Ax,JsonOutputParser:()=>em,ListOutputParser:()=>sc,MarkdownListOutputParser:()=>mP,NumberedListOutputParser:()=>pP,OutputParserException:()=>Xt,StandardSchemaOutputParser:()=>tm,StringOutputParser:()=>hP,StructuredOutputParser:()=>Ql,XMLOutputParser:()=>yP,XML_FORMAT_INSTRUCTIONS:()=>rm,parseJsonMarkdown:()=>Xa,parsePartialJson:()=>dn,parseXMLMarkdown:()=>nm});var wP=T({extendInteropZodObject:()=>Ip,getInteropZodDefaultGetter:()=>Tp,getInteropZodObjectShape:()=>Ei,getSchemaDescription:()=>$i,interopParse:()=>Ea,interopParseAsync:()=>ka,interopSafeParse:()=>PA,interopSafeParseAsync:()=>$p,interopZodObjectMakeFieldsOptional:()=>RA,interopZodObjectPartial:()=>$a,interopZodObjectPassthrough:()=>Ep,interopZodObjectStrict:()=>Ws,interopZodTransformInputSchema:()=>Cp,isInteropZodError:()=>Ap,isInteropZodLiteral:()=>OA,isInteropZodObject:()=>Kt,isInteropZodSchema:()=>xr,isShapelessZodSchema:()=>NA,isSimpleStringZodSchema:()=>Js,isZodArrayV4:()=>zl,isZodLiteralV3:()=>bw,isZodLiteralV4:()=>ww,isZodNullableV4:()=>Sw,isZodObjectV3:()=>Dl,isZodObjectV4:()=>Kr,isZodOptionalV4:()=>xw,isZodSchema:()=>AA,isZodSchemaV3:()=>lt,isZodSchemaV4:()=>Ge});function Ox(e,t){if(e.function===void 0)return;let r;if(t?.partial)try{r=dn(e.function.arguments??"{}")}catch{return}else try{r=JSON.parse(e.function.arguments)}catch(i){throw new Xt([`Function "${e.function.name}" arguments:`,"",e.function.arguments,"","are not valid JSON.",`Error: ${i.message}`].join(`
315
+ `))}let n={name:e.function.name,args:r,type:"tool_call"};return t?.returnId&&(n.id=e.id),n}function xP(e){if(e.id===void 0)throw new Error('All OpenAI tool calls must have an "id" field.');return{id:e.id,type:"function",function:{name:e.name,arguments:JSON.stringify(e.args)}}}function SP(e,t){return{name:e.function?.name,args:e.function?.arguments,id:e.id,error:t,type:"invalid_tool_call"}}var Px=class extends Qn{static lc_name(){return"JsonOutputToolsParser"}returnId=!1;lc_namespace=["langchain","output_parsers","openai_tools"];lc_serializable=!0;constructor(e){super(e),this.returnId=e?.returnId??this.returnId}_diff(){throw new Error("Not supported.")}async parse(){throw new Error("Not implemented.")}async parseResult(e){return await this.parsePartialResult(e,!1)}async parsePartialResult(e,t=!0){let r=e[0].message,n;if(fs(r)&&r.tool_calls?.length?n=r.tool_calls.map(a=>{let{id:o,...s}=a;return this.returnId?{id:o,...s}:s}):r.additional_kwargs.tool_calls!==void 0&&(n=JSON.parse(JSON.stringify(r.additional_kwargs.tool_calls)).map(a=>Ox(a,{returnId:this.returnId,partial:t}))),!n)return[];let i=[];for(let a of n)if(a!==void 0){let o={type:a.name,args:a.args,id:a.id};i.push(o)}return i}},im=class extends Px{static lc_name(){return"JsonOutputKeyToolsParser"}lc_namespace=["langchain","output_parsers","openai_tools"];lc_serializable=!0;returnId=!1;keyName;returnSingle=!1;zodSchema;serializableSchema;constructor(e){super(e),this.keyName=e.keyName,this.returnSingle=e.returnSingle??this.returnSingle,"zodSchema"in e&&(this.zodSchema=e.zodSchema),"serializableSchema"in e&&(this.serializableSchema=e.serializableSchema)}async _validateResult(e){if(this.serializableSchema!==void 0){let r=await this.serializableSchema["~standard"].validate(e);if(r.issues)throw new Xt(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(r.issues)}`,JSON.stringify(e,null,2));return r.value}if(this.zodSchema===void 0)return e;let t=await $p(this.zodSchema,e);if(t.success)return t.data;throw new Xt(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(t.error?.issues)}`,JSON.stringify(e,null,2))}async parsePartialResult(e){let t=(await super.parsePartialResult(e)).filter(n=>n.type===this.keyName),r=t;if(t.length)return this.returnId||(r=t.map(n=>n.args)),this.returnSingle?r[0]:r}async parseResult(e){let t=(await super.parsePartialResult(e,!1)).filter(n=>n.type===this.keyName),r=t;if(t.length)return this.returnId||(r=t.map(n=>n.args)),this.returnSingle?this._validateResult(r[0]):await Promise.all(r.map(n=>this._validateResult(n)))}};var kP=T({assembleStructuredOutputPipeline:()=>Nx,createContentParser:()=>WF,createFunctionCallingParser:()=>JF});function WF(e){return xr(e)?Ql.fromZodSchema(e):mo(e)?tm.fromSerializableSchema(e):new em}function JF(e,t,r){let n=r??im;return xr(e)?new n({returnSingle:!0,keyName:t,zodSchema:e}):mo(e)?new n({returnSingle:!0,keyName:t,serializableSchema:e}):new n({returnSingle:!0,keyName:t})}function Nx(e,t,r,n){if(!r){let c=e.pipe(t);return n?c.withConfig({runName:n}):c}let i=Oi.assign({parsed:(c,l)=>t.invoke(c.raw,l)}),a=Oi.assign({parsed:()=>null}),o=i.withFallbacks({fallbacks:[a]}),s=Lr.from([{raw:e},o]);return n?s.withConfig({runName:n}):s}var $P=T({ChatModelStream:()=>Pa,ReasoningContentStream:()=>CP,TextContentStream:()=>IP,ToolCallsStream:()=>TP,UsageMetadataStream:()=>AP}),KF=class{events=[];finished=!1;waiters=[];error=null;push(e){this.events.push(e);let t=this.waiters.splice(0);for(let r of t)r()}finish(){this.finished=!0;let e=this.waiters.splice(0);for(let t of e)t()}setError(e){this.error=e,this.finished=!0;let t=this.waiters.splice(0);for(let r of t)r()}async*iterate(){if(this.finished){if(this.error)throw this.error;yield*this.events;return}let e=0;for(;;){for(;e<this.events.length;)yield this.events[e],e++;if(this.finished){if(this.error)throw this.error;return}await new Promise(t=>{if(e<this.events.length||this.finished){t();return}this.waiters.push(t)})}}};function qF(e,t){switch(t.type){case"text-delta":return e.type==="text"?{...e,text:(e.text??"")+t.text}:e;case"reasoning-delta":return e.type==="thinking"?{...e,thinking:(e.thinking??"")+t.reasoning}:e.type==="reasoning"?{...e,reasoning:(e.reasoning??"")+t.reasoning}:e;case"data-delta":return{...e,data:(e.data??"")+t.data};case"block-delta":return{...e,...t.fields};default:throw new Error(`Unknown delta type: ${JSON.stringify(t)}`)}}function eu(e){if(e.event!=="content-block-delta")return;if("delta"in e&&e.delta)return e.delta;let t=e.content;if(t==null||typeof t!="object")return;let r=t;if(r.type==="text"&&typeof r.text=="string")return{type:"text-delta",text:r.text};if(r.type==="reasoning"&&typeof r.reasoning=="string")return{type:"reasoning-delta",reasoning:r.reasoning};if(r.type==="thinking"&&typeof r.thinking=="string")return{type:"reasoning-delta",reasoning:r.thinking};if(typeof r.data=="string")return{type:"data-delta",data:r.data,encoding:"base64"};if(typeof r.type=="string")return{type:"block-delta",fields:{...r,type:r.type}}}function EP(e){if(e==null||typeof e!="object")return;let t=e;if(t.type==="reasoning"&&typeof t.reasoning=="string")return t.reasoning;if(t.type==="thinking"&&typeof t.thinking=="string")return t.thinking}function am(e){if(e==null||typeof e!="object")return!1;let t=e.type;return t==="reasoning"||t==="thinking"}function cc(e){if(e)return{...e,input_tokens:e.input_tokens??0,output_tokens:e.output_tokens??0,total_tokens:e.total_tokens??0}}function YF(e){if(e!=null&&typeof e=="object"&&!Array.isArray(e))return e;if(typeof e!="string"||e.length===0)return{};try{let t=JSON.parse(e);return t!=null&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function XF(e){let t=e;if(e.type==="tool_call"||e.type!=="tool_call_chunk"&&e.type!=="tool_use"&&e.type!=="input_json_delta")return e;let r=typeof t.name=="string"?t.name:void 0;if(r==null)return e;let n=t.args??t.input;return{...t,type:"tool_call",name:r,args:YF(n)}}var IP=class{_buffer;constructor(e){this._buffer=e}get full(){let e=this._buffer;return{async*[Symbol.asyncIterator](){let t="";for await(let r of e.iterate()){let n=eu(r);n?.type==="text-delta"&&(t+=n.text,yield t)}}}}[Symbol.asyncIterator](){let e=this._buffer;async function*t(){for await(let r of e.iterate()){let n=eu(r);n?.type==="text-delta"&&(yield n.text)}}return t()}then(e,t){return(async()=>{let r="";for await(let n of this)r+=n;return r})().then(e,t)}},TP=class{_buffer;constructor(e){this._buffer=e}get full(){let e=this._buffer;return{async*[Symbol.asyncIterator](){let t=[];for await(let r of e.iterate())r.event==="content-block-finish"&&r.content.type==="tool_call"&&(t.push(r.content),yield[...t])}}}[Symbol.asyncIterator](){let e=this._buffer;async function*t(){for await(let r of e.iterate())r.event==="content-block-finish"&&r.content.type==="tool_call"&&(yield r.content)}return t()}then(e,t){return(async()=>{let r=[];for await(let n of this)r.push(n);return r})().then(e,t)}},CP=class{_buffer;constructor(e){this._buffer=e}get full(){let e=this._buffer;return{async*[Symbol.asyncIterator](){let t="",r=!1;for await(let n of e.iterate())if(n.event==="content-block-start"){if(!am(n.content)){if(r)return;continue}r=!0;let i=EP(n.content);if(i==null||i.length===0)continue;t+=i,yield t}else if(n.event==="content-block-delta"){let i=eu(n);if(i?.type!=="reasoning-delta")continue;r=!0;let a=i.reasoning;if(a==null||a.length===0)continue;t+=a,yield t}else{if(n.event==="content-block-finish"&&am(n.content))return;if(n.event==="message-finish")return}}}}[Symbol.asyncIterator](){let e=this._buffer;async function*t(){let r=!1;for await(let n of e.iterate())if(n.event==="content-block-start"){if(!am(n.content)){if(r)return;continue}r=!0;let i=EP(n.content);i!=null&&i.length>0&&(yield i)}else if(n.event==="content-block-delta"){let i=eu(n);if(i?.type!=="reasoning-delta")continue;r=!0;let a=i.reasoning;a!=null&&a.length>0&&(yield a)}else{if(n.event==="content-block-finish"&&am(n.content))return;if(n.event==="message-finish")return}}return t()}then(e,t){return(async()=>{let r="";for await(let n of this)r+=n;return r})().then(e,t)}},AP=class{_buffer;constructor(e){this._buffer=e}[Symbol.asyncIterator](){let e=this._buffer;async function*t(){for await(let r of e.iterate())if(r.event==="usage"){let n=cc(r.usage);n&&(yield n)}else if(r.event==="message-start"&&r.usage){let n=cc(r.usage);n&&(yield n)}else if(r.event==="message-finish"&&r.usage){let n=cc(r.usage);n&&(yield n)}}return t()}then(e,t){return(async()=>{let r;for await(let n of this)r=n;return r})().then(e,t)}},Pa=class{_buffer;constructor(e){this._buffer=new KF,this._consume(e)}async _consume(e){try{for await(let t of e)this._buffer.push(t);this._buffer.finish()}catch(t){this._buffer.setError(t instanceof Error?t:new Error(String(t)))}}[Symbol.asyncIterator](){return this._buffer.iterate()}get text(){return new IP(this._buffer)}get toolCalls(){return new TP(this._buffer)}get reasoning(){return new CP(this._buffer)}get usage(){return new AP(this._buffer)}get output(){return this._assembleMessage()}then(e,t){return this._assembleMessage().then(e,t)}async _assembleMessage(){let e=[],t,r,n={},i;for await(let o of this._buffer.iterate())switch(o.event){case"message-start":t=o.id??t,o.usage&&(r=cc(o.usage));break;case"content-block-start":e[o.index]=o.content;break;case"content-block-delta":{let s=e[o.index],c=eu(o);s&&c&&(e[o.index]=qF(s,c));break}case"content-block-finish":e[o.index]=o.content;break;case"usage":r=cc(o.usage);break;case"message-finish":i=o.reason,o.usage&&(r=cc(o.usage)),o.responseMetadata&&(n={...n,...o.responseMetadata});break;default:break}let a=e.filter(o=>o!=null).map(XF);return new Ne({id:t,content:a,usage_metadata:r,response_metadata:{...n,...i?{finish_reason:i}:{},output_version:"v1"}})}};var PP=T({convertChunksToEvents:()=>Rx,finalizeContentBlock:()=>om}),QF={wav:"audio/wav",mp3:"audio/mpeg",flac:"audio/flac",opus:"audio/opus",aac:"audio/aac",pcm16:"audio/pcm"},eB={png:"image/png",jpeg:"image/jpeg",jpg:"image/jpeg",webp:"image/webp",gif:"image/gif"};function OP(e){let t=0;for(let r of e.keys())r>=t&&(t=r+1);return t}function NP(e){let t=e.additional_kwargs;return t!=null&&typeof t=="object"?t:{}}function tB(e){let t=NP(e).tool_outputs;if(!Array.isArray(t))return[];let r=[];for(let n of t){if(n==null||typeof n!="object")continue;let i=n;if(i.type!=="image_generation_call")continue;let a=typeof i.result=="string"?i.result:void 0,o=typeof i.url=="string"?i.url:void 0;if(a==null&&o==null)continue;let s=typeof i.output_format=="string"?i.output_format.toLowerCase():void 0,c=(s!=null?eB[s]:void 0)??"image/png";r.push({type:"image",...typeof i.id=="string"?{id:i.id}:{},...o!=null?{url:o}:{},...a!=null?{data:a}:{},mimeType:c})}return r}function rB(e){let t=NP(e).audio;if(t==null||typeof t!="object")return;let r=t,n=typeof r.data=="string"?r.data:void 0,i=typeof r.url=="string"?r.url:void 0,a=typeof r.transcript=="string"?r.transcript:void 0;if(n==null&&i==null&&a==null)return;let o=typeof r.mime_type=="string"?r.mime_type:typeof r.mimeType=="string"?r.mimeType:void 0,s=typeof r.format=="string"?r.format.toLowerCase():void 0,c=o??(s!=null?QF[s]:void 0)??(n!=null?"audio/wav":"audio/pcm");return{...typeof r.id=="string"?{id:r.id}:{},...n!=null?{data:n}:{},...i!=null?{url:i}:{},...a!=null?{transcript:a}:{},mimeType:c}}async function*Rx(e,t){let r=new Map,n=!1,i,a,o=new Set;for await(let s of e){t?.signal?.throwIfAborted();let c=s.message,l=!1;if(!n){n=!0;let f={event:"message-start",id:c.id??void 0};it.isInstance(c)&&c.usage_metadata&&(f.usage=c.usage_metadata,i={...c.usage_metadata},l=!0),yield f}let u=c.content;if(typeof u=="string"){if(u!==""){if(!r.has(0)){let m={type:"text",text:""};r.set(0,{type:"text",accumulated:m}),yield{event:"content-block-start",index:0,content:m}}let p=r.get(0);p.accumulated={...p.accumulated,text:(p.accumulated.text??"")+u},yield{event:"content-block-delta",index:0,delta:{type:"text-delta",text:u}}}}else if(Array.isArray(u))for(let f of u){let p=typeof f.index=="number"?f.index:r.size;if(!r.has(p))r.set(p,{type:f.type,accumulated:{...f}}),yield{event:"content-block-start",index:p,content:{...f}};else{let m=r.get(p),h=iB(f);m.accumulated=nB(m.accumulated,h),yield{event:"content-block-delta",index:p,delta:h}}}if(it.isInstance(c)&&c.tool_call_chunks&&c.tool_call_chunks.length>0)for(let f of c.tool_call_chunks){let p=typeof f.index=="number"?f.index:r.size;if(!r.has(p)){let h={type:"tool_call_chunk",id:f.id,name:f.name,args:"",index:p};r.set(p,{type:"tool_call_chunk",accumulated:h}),yield{event:"content-block-start",index:p,content:h}}let m=r.get(p).accumulated;f.id!=null&&(m.id=f.id),f.name!=null&&(m.name=f.name),m.args=(m.args??"")+(f.args??""),yield{event:"content-block-delta",index:p,delta:{type:"block-delta",fields:{type:"tool_call_chunk",..."id"in m&&m.id!=null?{id:m.id}:{},..."name"in m&&m.name!=null?{name:m.name}:{},args:m.args}}}}let d=rB(c);if(d!=null){if(a==null){let p=OP(r);a={index:p,id:d.id,mimeType:d.mimeType,transcript:""};let m={type:"audio",...d.id!=null?{id:d.id}:{},...d.url!=null?{url:d.url}:{},data:"",mimeType:d.mimeType};r.set(p,{type:"audio",accumulated:m}),yield{event:"content-block-start",index:p,content:m}}let f=r.get(a.index);if(f!=null){let p=f.accumulated;d.id!=null&&a.id==null&&(a.id=d.id,p.id=d.id),d.transcript!=null&&(a.transcript+=d.transcript,p.transcript=a.transcript,yield{event:"content-block-delta",index:a.index,delta:{type:"block-delta",fields:{type:"audio",transcript:a.transcript}}}),d.data!=null&&d.data.length>0&&(p.data=(p.data??"")+d.data,yield{event:"content-block-delta",index:a.index,delta:{type:"data-delta",data:d.data,encoding:"base64"}})}}for(let f of tB(c)){let p=f,m=p.id??p.url??(p.data!=null?`${p.data.length}:${p.data.slice(0,32)}`:void 0);if(m!=null&&o.has(m))continue;m!=null&&o.add(m);let h=OP(r);r.set(h,{type:"image",accumulated:f}),yield{event:"content-block-start",index:h,content:f}}if(!l&&it.isInstance(c)&&c.usage_metadata){let f=c.usage_metadata;i?i={input_tokens:i.input_tokens+f.input_tokens,output_tokens:i.output_tokens+f.output_tokens,total_tokens:i.total_tokens+f.total_tokens}:i={...f},yield{event:"usage",usage:{...i}}}}for(let[s,c]of r)yield{event:"content-block-finish",index:s,content:om(c.accumulated)};yield{event:"message-finish",reason:"stop",...i?{usage:i}:{}}}function nB(e,t){switch(t.type){case"text-delta":return e.type==="text"?{...e,text:(e.text??"")+t.text}:e;case"reasoning-delta":return e.type==="thinking"?{...e,thinking:(e.thinking??"")+t.reasoning}:e.type==="reasoning"?{...e,reasoning:(e.reasoning??"")+t.reasoning}:e;case"data-delta":return{...e,data:(e.data??"")+t.data};case"block-delta":return{...e,...t.fields};default:throw new Error(`Unknown delta type: ${JSON.stringify(t)}`)}}function iB(e){if(e.type==="text")return{type:"text-delta",text:e.text};if(e.type==="reasoning")return{type:"reasoning-delta",reasoning:e.reasoning};if(e.type==="thinking"&&typeof e.thinking=="string")return{type:"reasoning-delta",reasoning:e.thinking};if(typeof e.data=="string")return{type:"data-delta",data:e.data,encoding:"base64"};if(typeof e.type=="string")return{type:"block-delta",fields:{...e}};throw new Error(`Unsupported content block delta: ${JSON.stringify(e)}`)}function om(e){if(e.type==="tool_call_chunk"){let t=e,r;try{r=JSON.parse(t.args??"{}")}catch{return{type:"invalid_tool_call",id:t.id,name:t.name,args:t.args,error:"Failed to parse tool call arguments as JSON"}}return{type:"tool_call",id:t.id,name:t.name,args:r}}return e}var RP=e=>e();function tu(e){let t=e.constructor;return new t({...e,content:e.contentBlocks,response_metadata:{...e.response_metadata,output_version:"v1"}})}var MP=T({BaseChatModel:()=>Na,SimpleChatModel:()=>aB});function Mx(e){let t=[];for(let r of e){let n=r;if(Array.isArray(r.content))for(let i=0;i<r.content.length;i++){let a=r.content[i];(ss(a)||cs(a))&&n===r&&(n=new r.constructor({...n,content:[...r.content.slice(0,i),bd(a),...r.content.slice(i+1)]}))}t.push(n)}return t}var Na=class ei extends Xl{lc_namespace=["langchain","chat_models",this._llmType()];disableStreaming=!1;outputVersion;get callKeys(){return[...super.callKeys,"outputVersion"]}constructor(t){super(t),this.outputVersion=RP(()=>{let r=t.outputVersion??xt("LC_OUTPUT_VERSION");return r&&["v0","v1"].includes(r)?r:"v0"})}_separateRunnableConfigFromCallOptionsCompat(t){let[r,n]=super._separateRunnableConfigFromCallOptions(t);return n.signal=r.signal,[r,n]}async invoke(t,r){let n=ei._convertInputToPromptValue(t);return(await this.generatePrompt([n],r,r?.callbacks)).generations[0][0].message}async*_streamResponseChunks(t,r,n){throw new Error("Not implemented.")}async*_streamChatModelEvents(t,r,n){yield*Rx(this._streamResponseChunks(t,r,n),{signal:r.signal})}streamEvents(t,r,n){if(r?.version==="v1"||r?.version==="v2")return super.streamEvents(t,r,n);let i=ei._convertInputToPromptValue(t).toChatMessages(),[,a]=this._separateRunnableConfigFromCallOptionsCompat(r);return new Pa(this._streamChatModelEvents(i,a))}streamV2(t,r){return this.streamEvents(t,r)}async*_streamIterator(t,r){if(this._streamResponseChunks===ei.prototype._streamResponseChunks||this.disableStreaming)yield this.invoke(t,r);else{let n=ei._convertInputToPromptValue(t).toChatMessages(),[i,a]=this._separateRunnableConfigFromCallOptionsCompat(r),o={...i.metadata,...this.getLsParamsWithDefaults(a)},s=this._getInvocationParamsForTracing(a),c=await Ye.configure(i.callbacks,this.callbacks,i.tags,this.tags,o,this.metadata,{verbose:this.verbose,tracerInheritableMetadata:this._filterInvocationParamsForTracing(s)}),l={options:this._getCallOptionsForTracing(a,s),invocation_params:s,batch_size:1},u=a.outputVersion??this.outputVersion,d=await c?.handleChatModelStart(this.toJSON(),[Mx(n)],i.runId,void 0,l,void 0,void 0,i.runName),f,p;try{for await(let m of this._streamResponseChunks(n,a,d?.[0])){if(a.signal?.throwIfAborted(),m.message.id==null){let h=d?.at(0)?.runId;h!=null&&m.message._updateId(`run-${h}`)}m.message.response_metadata={...m.generationInfo,...m.message.response_metadata},u==="v1"?yield tu(m.message):yield m.message,f?f=f.concat(m):f=m,Xc(m.message)&&m.message.usage_metadata!==void 0&&(p={tokenUsage:{promptTokens:m.message.usage_metadata.input_tokens,completionTokens:m.message.usage_metadata.output_tokens,totalTokens:m.message.usage_metadata.total_tokens}})}a.signal?.throwIfAborted()}catch(m){throw await Promise.all((d??[]).map(h=>h?.handleLLMError(m))),m}await Promise.all((d??[]).map(m=>m?.handleLLMEnd({generations:[[f]],llmOutput:p})))}}getLsParams(t){let r=this.getName().startsWith("Chat")?this.getName().replace("Chat",""):this.getName();return{ls_model_type:"chat",ls_stop:t.stop,ls_provider:r}}getLsParamsWithDefaults(t){return{...this.getLsParams(t),ls_integration:"langchain_chat_model"}}async _generateUncached(t,r,n,i){let a=t.map(p=>p.map(Et)),o;if(i!==void 0&&i.length===a.length)o=i;else{let p={...n.metadata,...this.getLsParamsWithDefaults(r)},m=this._getInvocationParamsForTracing(r),h=await Ye.configure(n.callbacks,this.callbacks,n.tags,this.tags,p,this.metadata,{verbose:this.verbose,tracerInheritableMetadata:this._filterInvocationParamsForTracing(m)}),_={options:this._getCallOptionsForTracing(r,m),invocation_params:m,batch_size:1};o=await h?.handleChatModelStart(this.toJSON(),a.map(Mx),n.runId,void 0,_,void 0,void 0,n.runName)}let s=r.outputVersion??this.outputVersion,c=[],l=[],u=!!o?.[0].handlers.find(_g),d=!!o?.[0].handlers.find(el);if(u&&!this.disableStreaming&&a.length===1&&(this._streamChatModelEvents!==ei.prototype._streamChatModelEvents||this._streamResponseChunks!==ei.prototype._streamResponseChunks))try{let p=!1,m=o?.[0],h=this._streamChatModelEvents(a[0],r),_=await new Pa({async*[Symbol.asyncIterator](){for await(let x of h){r.signal?.throwIfAborted(),p=!0;let S=x.event==="message-start"&&x.id==null&&m?.runId!=null?{...x,id:`run-${m.runId}`}:x;await m?.handleChatModelStreamEvent(S),yield S}}});if(r.signal?.throwIfAborted(),!p)throw new Error("Received empty response from chat model call.");if(_.id==null){let x=o?.at(0)?.runId;x!=null&&_._updateId(`run-${x}`)}let y={text:_.text,message:_};c.push([y]);let w=_.usage_metadata!==void 0?{tokenUsage:{promptTokens:_.usage_metadata.input_tokens,completionTokens:_.usage_metadata.output_tokens,totalTokens:_.usage_metadata.total_tokens}}:void 0;await o?.[0].handleLLMEnd({generations:c,llmOutput:w})}catch(p){throw await o?.[0].handleLLMError(p),p}else if(d&&!this.disableStreaming&&a.length===1&&this._streamResponseChunks!==ei.prototype._streamResponseChunks)try{let p=await this._streamResponseChunks(a[0],r,o?.[0]),m,h;for await(let _ of p){if(r.signal?.aborted){let y=m?.message;throw new yd("Model invocation was aborted.",y)}if(_.message.id==null){let y=o?.at(0)?.runId;y!=null&&_.message._updateId(`run-${y}`)}m===void 0?m=_:m=Mr(m,_),Xc(_.message)&&_.message.usage_metadata!==void 0&&(h={tokenUsage:{promptTokens:_.message.usage_metadata.input_tokens,completionTokens:_.message.usage_metadata.output_tokens,totalTokens:_.message.usage_metadata.total_tokens}})}if(r.signal?.aborted){let _=m?.message;throw new yd("Model invocation was aborted.",_)}if(m===void 0)throw new Error("Received empty response from chat model call.");s==="v1"&&(m.message=tu(m.message)),c.push([m]),await o?.[0].handleLLMEnd({generations:c,llmOutput:h})}catch(p){throw await o?.[0].handleLLMError(p),p}else{let p=await Promise.allSettled(a.map(async(m,h)=>{let _=await this._generate(m,{...r,promptIndex:h},o?.[h]);if(s==="v1")for(let y of _.generations)y.message=tu(y.message);return _}));await Promise.all(p.map(async(m,h)=>{if(m.status==="fulfilled"){let _=m.value;for(let y of _.generations){if(y.message.id==null){let w=o?.at(0)?.runId;w!=null&&y.message._updateId(`run-${w}`)}y.message.response_metadata={...y.generationInfo,...y.message.response_metadata}}return _.generations.length===1&&(_.generations[0].message.response_metadata={..._.llmOutput,..._.generations[0].message.response_metadata}),c[h]=_.generations,l[h]=_.llmOutput,o?.[h]?.handleLLMEnd({generations:[_.generations],llmOutput:_.llmOutput})}else return await o?.[h]?.handleLLMError(m.reason),Promise.reject(m.reason)}))}let f={generations:c,llmOutput:l.length?this._combineLLMOutput?.(...l):void 0};return Object.defineProperty(f,po,{value:o?{runIds:o?.map(p=>p.runId)}:void 0,configurable:!0}),f}async _generateCached({messages:t,cache:r,llmStringKey:n,parsedOptions:i,handledOptions:a}){let o=t.map(y=>y.map(Et)),s={...a.metadata,...this.getLsParamsWithDefaults(i)},c=this._getInvocationParamsForTracing(i),l=await Ye.configure(a.callbacks,this.callbacks,a.tags,this.tags,s,this.metadata,{verbose:this.verbose,tracerInheritableMetadata:this._filterInvocationParamsForTracing(c)}),u={options:this._getCallOptionsForTracing(i,c),invocation_params:c,batch_size:1},d=await l?.handleChatModelStart(this.toJSON(),o.map(Mx),a.runId,void 0,u,void 0,void 0,a.runName),f=[],p=(await Promise.allSettled(o.map(async(y,w)=>{let x=ei._convertInputToPromptValue(y).toString(),S=await r.lookup(x,n);return S==null&&f.push(w),S}))).map((y,w)=>({result:y,runManager:d?.[w]})).filter(({result:y})=>y.status==="fulfilled"&&y.value!=null||y.status==="rejected"),m=i.outputVersion??this.outputVersion,h=[];await Promise.all(p.map(async({result:y,runManager:w},x)=>{if(y.status==="fulfilled"){let S=y.value;return h[x]=S.map(E=>("message"in E&&rt(E.message)&&fs(E.message)&&(E.message.usage_metadata={input_tokens:0,output_tokens:0,total_tokens:0},m==="v1"&&(E.message=tu(E.message))),E.generationInfo={...E.generationInfo,tokenUsage:{}},E)),S.length&&await w?.handleLLMNewToken(S[0].text),w?.handleLLMEnd({generations:[S]},void 0,void 0,void 0,{cached:!0})}else return await w?.handleLLMError(y.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(y.reason)}));let _={generations:h,missingPromptIndices:f,startedRunManagers:d};return Object.defineProperty(_,po,{value:d?{runIds:d?.map(y=>y.runId)}:void 0,configurable:!0}),_}async generate(t,r,n){let i;Array.isArray(r)?i={stop:r}:i=r;let a=t.map(m=>m.map(Et)),[o,s]=this._separateRunnableConfigFromCallOptionsCompat(i);if(o.callbacks=o.callbacks??n,!this.cache)return this._generateUncached(a,s,o);let{cache:c}=this,l=this._getSerializedCacheKeyParametersForCall(s),{generations:u,missingPromptIndices:d,startedRunManagers:f}=await this._generateCached({messages:a,cache:c,llmStringKey:l,parsedOptions:s,handledOptions:o}),p={};if(d.length>0){let m=await this._generateUncached(d.map(h=>a[h]),s,o,f!==void 0?d.map(h=>f?.[h]):void 0);await Promise.all(m.generations.map(async(h,_)=>{let y=d[_];u[y]=h;let w=ei._convertInputToPromptValue(a[y]).toString();return c.update(w,l,h)})),p=m.llmOutput??{}}return{generations:u,llmOutput:p}}_getInvocationParamsForTracing(t){return this.invocationParams(t)}_getCallOptionsForTracing(t,r){return t}invocationParams(t){return{}}_modelType(){return"base_chat_model"}async generatePrompt(t,r,n){let i=t.map(a=>a.toChatMessages());return this.generate(i,r,n)}withStructuredOutput(t,r){if(typeof this.bindTools!="function")throw new Error('Chat model must implement ".bindTools()" to use withStructuredOutput.');if(r?.strict)throw new Error('"strict" mode is not supported for this model by default.');let n=t,i=r?.name,a=$i(n)??"A function available to call.",o=r?.method,s=r?.includeRaw;if(o==="jsonMode")throw new Error('Base withStructuredOutput implementation only supports "functionCalling" as a method.');let c=i??"extract";!xr(n)&&!mo(n)&&"name"in n&&(c=n.name);let l=xr(n)||mo(n)?It(n):n,u=[{type:"function",function:{name:c,description:a,parameters:l}}];return Nx(this.bindTools(u),Yt.from(d=>{if(!it.isInstance(d))throw new Error("Input is not an AIMessageChunk.");if(!d.tool_calls||d.tool_calls.length===0)throw new Error("No tool calls found in the response.");let f=d.tool_calls.find(p=>p.name===c);if(!f)throw new Error(`No tool call found with name ${c}.`);return f.args}),s,s?"StructuredOutputRunnable":"StructuredOutput")}},aB=class extends Na{async _generate(e,t,r){let n=new Ne(await this._call(e,t,r));if(typeof n.content!="string")throw new Error("Cannot generate with a simple chat model when output is not a string.");return{generations:[{text:n.content,message:n}]}}};var jP=T({convertOpenAICompletionsStream:()=>oB});async function*oB(e,t={}){let r=t.streamUsage??!0,n=t.provider??"openai",i=t.mapChunk,a=new Map,o=new Map,s=0,c=!1,l,u,d,f=!1,p=(m,h)=>{let _=o.get(m);if(_!==void 0)return{index:_,isNew:!1};let y=s++;return o.set(m,y),a.set(y,{...h}),{index:y,isNew:!0}};for await(let m of e){i&&(m=i(m)),c||(c=!0,yield{event:"message-start",id:m.id}),!f&&(m.model||m.service_tier)&&(f=!0,yield{event:"provider",provider:n,name:"stream_metadata",payload:{model:m.model,service_tier:m.service_tier}}),m.usage&&r&&(l=uB(m.usage),yield{event:"usage",usage:l});let h=m.x_groq?.usage;h&&r&&(l=cB(h),yield{event:"usage",usage:l});let _=m.choices?.[0];if(!_)continue;_.finish_reason!=null&&(u=lB(_.finish_reason),d=dB(m,_));let{delta:y}=_;if(!y)continue;let w=sB(y);if(w){let{index:x,isNew:S}=p("reasoning",{type:"reasoning",reasoning:""});S&&(yield{event:"content-block-start",index:x,content:{type:"reasoning",reasoning:""}});let E=a.get(x);E.reasoning=(E.reasoning??"")+w,yield{event:"content-block-delta",index:x,delta:{type:"reasoning-delta",reasoning:w}}}if(y.content){let{index:x,isNew:S}=p("text",{type:"text",text:""});S&&(yield{event:"content-block-start",index:x,content:{type:"text",text:""}});let E=a.get(x);E.text=(E.text??"")+y.content,yield{event:"content-block-delta",index:x,delta:{type:"text-delta",text:y.content}}}if(Array.isArray(y.tool_calls))for(let x of y.tool_calls){let S=x.index??0,{index:E,isNew:P}=p(`tool:${S}`,{type:"tool_call_chunk",id:x.id,name:x.function?.name,args:"",index:S});P&&(yield{event:"content-block-start",index:E,content:{type:"tool_call_chunk",id:x.id,name:x.function?.name,args:"",index:S}});let C=a.get(E);x.id!=null&&(C.id=x.id),x.function?.name!=null&&(C.name=x.function.name);let b=x.function?.arguments??"";C.args=(C.args??"")+b,yield{event:"content-block-delta",index:E,delta:{type:"block-delta",fields:{type:"tool_call_chunk",...C.id!=null?{id:C.id}:{},...C.name!=null?{name:C.name}:{},args:C.args}}}}if(y.audio){let{index:x,isNew:S}=p("audio",{type:"audio",id:y.audio.id,data:"",mimeType:"audio/pcm",transcript:y.audio.transcript??""});S&&(yield{event:"content-block-start",index:x,content:{type:"audio",id:y.audio.id,data:"",mimeType:"audio/pcm",transcript:y.audio.transcript??""}});let E=a.get(x);y.audio.transcript&&(E.transcript=(E.transcript??"")+y.audio.transcript,yield{event:"content-block-delta",index:x,delta:{type:"block-delta",fields:{type:"audio",transcript:E.transcript}}}),y.audio.data&&(E.data=(E.data??"")+y.audio.data,yield{event:"content-block-delta",index:x,delta:{type:"data-delta",data:y.audio.data,encoding:"base64"}})}y.function_call&&(yield{event:"provider",provider:n,name:"function_call",payload:y.function_call}),_.logprobs&&(yield{event:"provider",provider:n,name:"logprobs",payload:_.logprobs})}for(let[m,h]of a)yield{event:"content-block-finish",index:m,content:om(h)};yield{event:"message-finish",reason:u,...l?{usage:l}:{},...d?{responseMetadata:d}:{}}}function sB(e){let t=e.reasoning_content??e.reasoning;return typeof t=="string"&&t.length>0?t:void 0}function cB(e){return{input_tokens:e.prompt_tokens??0,output_tokens:e.completion_tokens??0,total_tokens:e.total_tokens??0}}function lB(e){switch(e){case"stop":return"stop";case"length":case"max_tokens":return"length";case"tool_calls":case"function_call":return"tool_use";case"content_filter":return"content_filter";default:return"stop"}}function uB(e){let t={...e.prompt_tokens_details?.audio_tokens!=null&&{audio:e.prompt_tokens_details.audio_tokens},...e.prompt_tokens_details?.cached_tokens!=null&&{cache_read:e.prompt_tokens_details.cached_tokens}},r={...e.completion_tokens_details?.audio_tokens!=null&&{audio:e.completion_tokens_details.audio_tokens},...e.completion_tokens_details?.reasoning_tokens!=null&&{reasoning:e.completion_tokens_details.reasoning_tokens}};return{input_tokens:e.prompt_tokens??0,output_tokens:e.completion_tokens??0,total_tokens:e.total_tokens??0,...Object.keys(t).length>0&&{input_token_details:t},...Object.keys(r).length>0&&{output_token_details:r}}}function dB(e,t){return{model_provider:"openai",model_name:e.model,system_fingerprint:e.system_fingerprint,service_tier:e.service_tier,finish_reason:t.finish_reason,...e.usage?{usage:e.usage}:{}}}var DP=T({});var zP=T({BaseLLM:()=>UP,LLM:()=>sm}),UP=class ru extends Xl{lc_namespace=["langchain","llms",this._llmType()];async invoke(t,r){let n=ru._convertInputToPromptValue(t);return(await this.generatePrompt([n],r,r?.callbacks)).generations[0][0].text}async*_streamResponseChunks(t,r,n){throw new Error("Not implemented.")}_separateRunnableConfigFromCallOptionsCompat(t){let[r,n]=super._separateRunnableConfigFromCallOptions(t);return n.signal=r.signal,[r,n]}async*_streamIterator(t,r){if(this._streamResponseChunks===ru.prototype._streamResponseChunks)yield this.invoke(t,r);else{let n=ru._convertInputToPromptValue(t),[i,a]=this._separateRunnableConfigFromCallOptionsCompat(r),o=this.invocationParams(a),s=await Ye.configure(i.callbacks,this.callbacks,i.tags,this.tags,i.metadata,this.metadata,{verbose:this.verbose,tracerInheritableMetadata:this._filterInvocationParamsForTracing(o)}),c={options:a,invocation_params:o,batch_size:1},l=await s?.handleLLMStart(this.toJSON(),[n.toString()],i.runId,void 0,c,void 0,void 0,i.runName),u=new bi({text:""});try{for await(let d of this._streamResponseChunks(n.toString(),a,l?.[0]))u?u=u.concat(d):u=d,typeof d.text=="string"&&(yield d.text)}catch(d){throw await Promise.all((l??[]).map(f=>f?.handleLLMError(d))),d}await Promise.all((l??[]).map(d=>d?.handleLLMEnd({generations:[[u]]})))}}async generatePrompt(t,r,n){let i=t.map(a=>a.toString());return this.generate(i,r,n)}invocationParams(t){return{}}_flattenLLMResult(t){let r=[];for(let n=0;n<t.generations.length;n+=1){let i=t.generations[n];if(n===0)r.push({generations:[i],llmOutput:t.llmOutput});else{let a=t.llmOutput?{...t.llmOutput,tokenUsage:{}}:void 0;r.push({generations:[i],llmOutput:a})}}return r}async _generateUncached(t,r,n,i){let a;if(i!==void 0&&i.length===t.length)a=i;else{let l=this.invocationParams(r),u=await Ye.configure(n.callbacks,this.callbacks,n.tags,this.tags,n.metadata,this.metadata,{verbose:this.verbose,tracerInheritableMetadata:this._filterInvocationParamsForTracing(l)}),d={options:r,invocation_params:l,batch_size:t.length};a=await u?.handleLLMStart(this.toJSON(),t,n.runId,void 0,d,void 0,void 0,n?.runName)}let o=!!a?.[0].handlers.find(el),s;if(o&&t.length===1&&this._streamResponseChunks!==ru.prototype._streamResponseChunks)try{let l=await this._streamResponseChunks(t[0],r,a?.[0]),u;for await(let d of l)u===void 0?u=d:u=Mr(u,d);if(u===void 0)throw new Error("Received empty response from chat model call.");s={generations:[[u]],llmOutput:{}},await a?.[0].handleLLMEnd(s)}catch(l){throw await a?.[0].handleLLMError(l),l}else{try{s=await this._generate(t,r,a?.[0])}catch(u){throw await Promise.all((a??[]).map(d=>d?.handleLLMError(u))),u}let l=this._flattenLLMResult(s);await Promise.all((a??[]).map((u,d)=>u?.handleLLMEnd(l[d])))}let c=a?.map(l=>l.runId)||void 0;return Object.defineProperty(s,po,{value:c?{runIds:c}:void 0,configurable:!0}),s}async _generateCached({prompts:t,cache:r,llmStringKey:n,parsedOptions:i,handledOptions:a,runId:o}){let s=this.invocationParams(i),c=await Ye.configure(a.callbacks,this.callbacks,a.tags,this.tags,a.metadata,this.metadata,{verbose:this.verbose,tracerInheritableMetadata:this._filterInvocationParamsForTracing(s)}),l={options:i,invocation_params:s,batch_size:t.length},u=await c?.handleLLMStart(this.toJSON(),t,o,void 0,l,void 0,void 0,a?.runName),d=[],f=(await Promise.allSettled(t.map(async(h,_)=>{let y=await r.lookup(h,n);return y==null&&d.push(_),y}))).map((h,_)=>({result:h,runManager:u?.[_]})).filter(({result:h})=>h.status==="fulfilled"&&h.value!=null||h.status==="rejected"),p=[];await Promise.all(f.map(async({result:h,runManager:_},y)=>{if(h.status==="fulfilled"){let w=h.value;return p[y]=w.map(x=>(x.generationInfo={...x.generationInfo,tokenUsage:{}},x)),w.length&&await _?.handleLLMNewToken(w[0].text),_?.handleLLMEnd({generations:[w]},void 0,void 0,void 0,{cached:!0})}else return await _?.handleLLMError(h.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(h.reason)}));let m={generations:p,missingPromptIndices:d,startedRunManagers:u};return Object.defineProperty(m,po,{value:u?{runIds:u?.map(h=>h.runId)}:void 0,configurable:!0}),m}async generate(t,r,n){if(!Array.isArray(t))throw new Error("Argument 'prompts' is expected to be a string[]");let i;Array.isArray(r)?i={stop:r}:i=r;let[a,o]=this._separateRunnableConfigFromCallOptionsCompat(i);if(a.callbacks=a.callbacks??n,!this.cache)return this._generateUncached(t,o,a);let{cache:s}=this,c=this._getSerializedCacheKeyParametersForCall(o),{generations:l,missingPromptIndices:u,startedRunManagers:d}=await this._generateCached({prompts:t,cache:s,llmStringKey:c,parsedOptions:o,handledOptions:a,runId:a.runId}),f={};if(u.length>0){let p=await this._generateUncached(u.map(m=>t[m]),o,a,d!==void 0?u.map(m=>d?.[m]):void 0);await Promise.all(p.generations.map(async(m,h)=>{let _=u[h];return l[_]=m,s.update(t[_],c,m)})),f=p.llmOutput??{}}return{generations:l,llmOutput:f}}_identifyingParams(){return{}}_modelType(){return"base_llm"}},sm=class extends UP{async _generate(e,t,r){return{generations:await Promise.all(e.map((n,i)=>this._call(n,{...t,promptIndex:i},r).then(a=>[{text:a}])))}}};var LP=T({});var FP=T({BaseMemory:()=>fB,getInputValue:()=>pB,getOutputValue:()=>mB,getPromptInputKey:()=>hB}),fB=class{},BP=(e,t)=>{if(t!==void 0)return e[t];let r=Object.keys(e);if(r.length===1)return e[r[0]]},pB=(e,t)=>{let r=BP(e,t);if(!r){let n=Object.keys(e);throw new Error(`input values have ${n.length} keys, you must specify an input key or pass only 1 key as input`)}return r},mB=(e,t)=>{let r=BP(e,t);if(!r&&r!==""){let n=Object.keys(e);throw new Error(`output values have ${n.length} keys, you must specify an output key or pass only 1 key as output`)}return r};function hB(e,t){let r=Object.keys(e).filter(n=>!t.includes(n)&&n!=="stop");if(r.length!==1)throw new Error(`One input key expected, but got ${r.length}`);return r[0]}var jx=class extends oc{static lc_name(){return"OutputFunctionsParser"}lc_namespace=["langchain","output_parsers","openai_functions"];lc_serializable=!0;argsOnly=!0;constructor(e){super(),this.argsOnly=e?.argsOnly??this.argsOnly}async parseResult(e){if("message"in e[0]){let t=e[0].message.additional_kwargs.function_call;if(!t)throw new Error(`No function_call in message ${JSON.stringify(e)}`);if(!t.arguments)throw new Error(`No arguments in function_call ${JSON.stringify(e)}`);return this.argsOnly?t.arguments:JSON.stringify(t)}else throw new Error(`No message in generations ${JSON.stringify(e)}`)}},Dx=class extends Qn{static lc_name(){return"JsonOutputFunctionsParser"}lc_namespace=["langchain","output_parsers","openai_functions"];lc_serializable=!0;outputParser;argsOnly=!0;constructor(e){super(e),this.argsOnly=e?.argsOnly??this.argsOnly,this.outputParser=new jx(e)}_diff(e,t){if(t)return vi(e??{},t)}async parsePartialResult(e){let t=e[0];if(!t.message)return;let{message:r}=t,n=r.additional_kwargs.function_call;if(n)return this.argsOnly?dn(n.arguments):{...n,arguments:dn(n.arguments)}}async parseResult(e){let t=await this.outputParser.parseResult(e);if(!t)throw new Error(`No result from "OutputFunctionsParser" ${JSON.stringify(e)}`);return this.parse(t)}async parse(e){let t=JSON.parse(e);return this.argsOnly||(t.arguments=JSON.parse(t.arguments)),t}getFormatInstructions(){return""}},VP=class extends oc{static lc_name(){return"JsonKeyOutputFunctionsParser"}lc_namespace=["langchain","output_parsers","openai_functions"];lc_serializable=!0;outputParser=new Dx;attrName;get lc_aliases(){return{attrName:"key_name"}}constructor(e){super(e),this.attrName=e.attrName}async parseResult(e){return(await this.outputParser.parseResult(e))[this.attrName]}};var ZP=T({JsonKeyOutputFunctionsParser:()=>VP,JsonOutputFunctionsParser:()=>Dx,OutputFunctionsParser:()=>jx});var HP=T({JsonOutputKeyToolsParser:()=>im,JsonOutputToolsParser:()=>Px,convertLangChainToolCallToOpenAI:()=>xP,makeInvalidToolCall:()=>SP,parseToolCall:()=>Ox});var ti=class extends se{lc_serializable=!0;lc_namespace=["langchain_core","prompts",this._getPromptType()];get lc_attributes(){return{partialVariables:void 0}}inputVariables;outputParser;partialVariables;metadata;tags;constructor(e){super(e);let{inputVariables:t}=e;if(t.includes("stop"))throw new Error("Cannot have an input variable named 'stop', as it is used internally, please rename.");Object.assign(this,e)}async mergePartialAndUserVariables(e){let t=this.partialVariables??{},r={};for(let[n,i]of Object.entries(t))typeof i=="string"?r[n]=i:r[n]=await i();return{...r,...e}}async invoke(e,t){let r={...this.metadata,...t?.metadata},n=[...this.tags??[],...t?.tags??[]];return this._callWithConfig(i=>this.formatPromptValue(i),e,{...t,tags:n,metadata:r,runType:"prompt"})}};var Ni=class extends ti{async formatPromptValue(e){return new ql(await this.format(e))}};var gB=Object.prototype.toString,uc=Array.isArray||function(t){return gB.call(t)==="[object Array]"};function Ux(e){return typeof e=="function"}function _B(e){return uc(e)?"array":typeof e}function zx(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function GP(e,t){return e!=null&&typeof e=="object"&&t in e}function yB(e,t){return e!=null&&typeof e!="object"&&e.hasOwnProperty&&e.hasOwnProperty(t)}var vB=RegExp.prototype.test;function bB(e,t){return vB.call(e,t)}var wB=/\S/;function xB(e){return!bB(wB,e)}var SB={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function kB(e){return String(e).replace(/[&<>"'`=\/]/g,function(r){return SB[r]})}var EB=/\s*/,$B=/\s+/,WP=/\s*=/,IB=/\s*\}/,TB=/#|\^|\/|>|\{|&|=|!/;function CB(e,t){if(!e)return[];var r=!1,n=[],i=[],a=[],o=!1,s=!1,c="",l=0;function u(){if(o&&!s)for(;a.length;)delete i[a.pop()];else a=[];o=!1,s=!1}var d,f,p;function m(b){if(typeof b=="string"&&(b=b.split($B,2)),!uc(b)||b.length!==2)throw new Error("Invalid tags: "+b);d=new RegExp(zx(b[0])+"\\s*"),f=new RegExp("\\s*"+zx(b[1])),p=new RegExp("\\s*"+zx("}"+b[1]))}m(t||rn.tags);for(var h=new iu(e),_,y,w,x,S,E;!h.eos();){if(_=h.pos,w=h.scanUntil(d),w)for(var P=0,C=w.length;P<C;++P)x=w.charAt(P),xB(x)?(a.push(i.length),c+=x):(s=!0,r=!0,c+=" "),i.push(["text",x,_,_+1]),_+=1,x===`
316
+ `&&(u(),c="",l=0,r=!1);if(!h.scan(d))break;if(o=!0,y=h.scan(TB)||"name",h.scan(EB),y==="="?(w=h.scanUntil(WP),h.scan(WP),h.scanUntil(f)):y==="{"?(w=h.scanUntil(p),h.scan(IB),h.scanUntil(f),y="&"):w=h.scanUntil(f),!h.scan(f))throw new Error("Unclosed tag at "+h.pos);if(y==">"?S=[y,w,_,h.pos,c,l,r]:S=[y,w,_,h.pos],l++,i.push(S),y==="#"||y==="^")n.push(S);else if(y==="/"){if(E=n.pop(),!E)throw new Error('Unopened section "'+w+'" at '+_);if(E[1]!==w)throw new Error('Unclosed section "'+E[1]+'" at '+_)}else y==="name"||y==="{"||y==="&"?s=!0:y==="="&&m(w)}if(u(),E=n.pop(),E)throw new Error('Unclosed section "'+E[1]+'" at '+h.pos);return OB(AB(i))}function AB(e){for(var t=[],r,n,i=0,a=e.length;i<a;++i)r=e[i],r&&(r[0]==="text"&&n&&n[0]==="text"?(n[1]+=r[1],n[3]=r[3]):(t.push(r),n=r));return t}function OB(e){for(var t=[],r=t,n=[],i,a,o=0,s=e.length;o<s;++o)switch(i=e[o],i[0]){case"#":case"^":r.push(i),n.push(i),r=i[4]=[];break;case"/":a=n.pop(),a[5]=i[2],r=n.length>0?n[n.length-1][4]:t;break;default:r.push(i)}return t}function iu(e){this.string=e,this.tail=e,this.pos=0}iu.prototype.eos=function(){return this.tail===""};iu.prototype.scan=function(t){var r=this.tail.match(t);if(!r||r.index!==0)return"";var n=r[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n};iu.prototype.scanUntil=function(t){var r=this.tail.search(t),n;switch(r){case-1:n=this.tail,this.tail="";break;case 0:n="";break;default:n=this.tail.substring(0,r),this.tail=this.tail.substring(r)}return this.pos+=n.length,n};function lc(e,t){this.view=e,this.cache={".":this.view},this.parent=t}lc.prototype.push=function(t){return new lc(t,this)};lc.prototype.lookup=function(t){var r=this.cache,n;if(r.hasOwnProperty(t))n=r[t];else{for(var i=this,a,o,s,c=!1;i;){if(t.indexOf(".")>0)for(a=i.view,o=t.split("."),s=0;a!=null&&s<o.length;)s===o.length-1&&(c=GP(a,o[s])||yB(a,o[s])),a=a[o[s++]];else a=i.view[t],c=GP(i.view,t);if(c){n=a;break}i=i.parent}r[t]=n}return Ux(n)&&(n=n.call(this.view)),n};function mr(){this.templateCache={_cache:{},set:function(t,r){this._cache[t]=r},get:function(t){return this._cache[t]},clear:function(){this._cache={}}}}mr.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};mr.prototype.parse=function(t,r){var n=this.templateCache,i=t+":"+(r||rn.tags).join(":"),a=typeof n<"u",o=a?n.get(i):void 0;return o==null&&(o=CB(t,r),a&&n.set(i,o)),o};mr.prototype.render=function(t,r,n,i){var a=this.getConfigTags(i),o=this.parse(t,a),s=r instanceof lc?r:new lc(r,void 0);return this.renderTokens(o,s,n,t,i)};mr.prototype.renderTokens=function(t,r,n,i,a){for(var o="",s,c,l,u=0,d=t.length;u<d;++u)l=void 0,s=t[u],c=s[0],c==="#"?l=this.renderSection(s,r,n,i,a):c==="^"?l=this.renderInverted(s,r,n,i,a):c===">"?l=this.renderPartial(s,r,n,a):c==="&"?l=this.unescapedValue(s,r):c==="name"?l=this.escapedValue(s,r,a):c==="text"&&(l=this.rawValue(s)),l!==void 0&&(o+=l);return o};mr.prototype.renderSection=function(t,r,n,i,a){var o=this,s="",c=r.lookup(t[1]);function l(f){return o.render(f,r,n,a)}if(c){if(uc(c))for(var u=0,d=c.length;u<d;++u)s+=this.renderTokens(t[4],r.push(c[u]),n,i,a);else if(typeof c=="object"||typeof c=="string"||typeof c=="number")s+=this.renderTokens(t[4],r.push(c),n,i,a);else if(Ux(c)){if(typeof i!="string")throw new Error("Cannot use higher-order sections without the original template");c=c.call(r.view,i.slice(t[3],t[5]),l),c!=null&&(s+=c)}else s+=this.renderTokens(t[4],r,n,i,a);return s}};mr.prototype.renderInverted=function(t,r,n,i,a){var o=r.lookup(t[1]);if(!o||uc(o)&&o.length===0)return this.renderTokens(t[4],r,n,i,a)};mr.prototype.indentPartial=function(t,r,n){for(var i=r.replace(/[^ \t]/g,""),a=t.split(`
317
+ `),o=0;o<a.length;o++)a[o].length&&(o>0||!n)&&(a[o]=i+a[o]);return a.join(`
318
+ `)};mr.prototype.renderPartial=function(t,r,n,i){if(n){var a=this.getConfigTags(i),o=Ux(n)?n(t[1]):n[t[1]];if(o!=null){var s=t[6],c=t[5],l=t[4],u=o;c==0&&l&&(u=this.indentPartial(o,l,s));var d=this.parse(u,a);return this.renderTokens(d,r,n,u,i)}}};mr.prototype.unescapedValue=function(t,r){var n=r.lookup(t[1]);if(n!=null)return n};mr.prototype.escapedValue=function(t,r,n){var i=this.getConfigEscape(n)||rn.escape,a=r.lookup(t[1]);if(a!=null)return typeof a=="number"&&i===rn.escape?String(a):i(a)};mr.prototype.rawValue=function(t){return t[1]};mr.prototype.getConfigTags=function(t){return uc(t)?t:t&&typeof t=="object"?t.tags:void 0};mr.prototype.getConfigEscape=function(t){if(t&&typeof t=="object"&&!uc(t))return t.escape};var rn={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(e){nu.templateCache=e},get templateCache(){return nu.templateCache}},nu=new mr;rn.clearCache=function(){return nu.clearCache()};rn.parse=function(t,r){return nu.parse(t,r)};rn.render=function(t,r,n,i){if(typeof t!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+_B(t)+'" was given as the first argument for mustache#render(template, view, partials)');return nu.render(t,r,n,i)};rn.escape=kB;rn.Scanner=iu;rn.Context=lc;rn.Writer=mr;var Lx=rn;var PB={escape:e=>e},Zo=e=>{let t=e.split(""),r=[],n=(a,o)=>{for(let s=o;s<t.length;s+=1)if(a.includes(t[s]))return s;return-1},i=0;for(;i<t.length;)if(t[i]==="{"&&i+1<t.length&&t[i+1]==="{")r.push({type:"literal",text:"{"}),i+=2;else if(t[i]==="}"&&i+1<t.length&&t[i+1]==="}")r.push({type:"literal",text:"}"}),i+=2;else if(t[i]==="{"){let a=n("}",i);if(a<0)throw new Error("Unclosed '{' in template.");r.push({type:"variable",name:t.slice(i+1,a).join("")}),i=a+1}else{if(t[i]==="}")throw new Error("Single '}' in template.");{let a=n("{}",i),o=(a<0?t.slice(i):t.slice(i,a)).join("");r.push({type:"literal",text:o}),i=a<0?t.length:a}}return r},JP=(e,t=[])=>{let r=[];for(let n of e)if(n[0]==="name"){let i=n[1].includes(".")?n[1].split(".")[0]:n[1];r.push({type:"variable",name:i})}else if(["#","&","^",">"].includes(n[0])){if(r.push({type:"variable",name:n[1]}),n[0]==="#"&&n.length>4&&Array.isArray(n[4])){let i=[...t,n[1]],a=JP(n[4],i);r.push(...a)}}else r.push({type:"literal",text:n[1]});return r},dc=e=>{let t=Lx.parse(e);return JP(t)},Fx=(e,t)=>Zo(e).reduce((r,n)=>{if(n.type==="variable"){if(n.name in t)return r+(typeof t[n.name]=="string"?t[n.name]:JSON.stringify(t[n.name]));throw new Error(`(f-string) Missing value for input ${n.name}`)}return r+n.text},""),Bx=(e,t)=>Lx.render(e,t,void 0,PB),au={"f-string":Fx,mustache:Bx},Vx={"f-string":Zo,mustache:dc},Qt=(e,t,r)=>{try{return au[t](e,r)}catch(n){throw fi(n,"INVALID_PROMPT_INPUT")}},Ho=(e,t)=>Vx[t](e),Ri=(e,t,r)=>{if(!(t in au)){let n=Object.keys(au);throw new Error(`Invalid template format. Got \`${t}\`;
319
+ should be one of ${n}`)}try{let n=Object.fromEntries(r.map(i=>[i,"foo"]));Array.isArray(e)?e.forEach(i=>{if(i.type==="text"&&"text"in i&&typeof i.text=="string")Qt(i.text,t,n);else if(i.type==="image_url"){if(typeof i.image_url=="string")Qt(i.image_url,t,n);else if(typeof i.image_url=="object"&&i.image_url!==null&&"url"in i.image_url&&typeof i.image_url.url=="string"){let a=i.image_url.url;Qt(a,t,n)}}else throw new Error(`Invalid message template received. ${JSON.stringify(i,null,2)}`)}):Qt(e,t,n)}catch(n){throw new Error(`Invalid prompt schema: ${n.message}`)}};var bn=class ou extends Ni{static lc_name(){return"PromptTemplate"}template;templateFormat="f-string";validateTemplate=!0;additionalContentFields;constructor(t){if(super(t),t.templateFormat==="mustache"&&t.validateTemplate===void 0&&(this.validateTemplate=!1),Object.assign(this,t),this.validateTemplate){if(this.templateFormat==="mustache")throw new Error("Mustache templates cannot be validated.");let r=this.inputVariables;this.partialVariables&&(r=r.concat(Object.keys(this.partialVariables))),Ri(this.template,this.templateFormat,r)}}_getPromptType(){return"prompt"}async format(t){let r=await this.mergePartialAndUserVariables(t);return Qt(this.template,this.templateFormat,r)}static fromExamples(t,r,n,i=`
320
+
321
+ `,a=""){let o=[a,...t,r].join(i);return new ou({inputVariables:n,template:o})}static fromTemplate(t,r){let{templateFormat:n="f-string",...i}=r??{},a=new Set;return Ho(t,n).forEach(o=>{o.type==="variable"&&a.add(o.name)}),new ou({inputVariables:[...a],templateFormat:n,template:t,...i})}async partial(t){let r=this.inputVariables.filter(a=>!(a in t)),n={...this.partialVariables??{},...t},i={...this,inputVariables:r,partialVariables:n};return new ou(i)}serialize(){if(this.outputParser!==void 0)throw new Error("Cannot serialize a prompt template with an output parser");return{_type:this._getPromptType(),input_variables:this.inputVariables,template:this.template,template_format:this.templateFormat}}static async deserialize(t){if(!t.template)throw new Error("Prompt template must have a template");return new ou({inputVariables:t.input_variables,template:t.template,templateFormat:t.template_format})}};var fc=class KP extends ti{static lc_name(){return"ImagePromptTemplate"}lc_namespace=["langchain_core","prompts","image"];template;templateFormat="f-string";validateTemplate=!0;additionalContentFields;constructor(t){if(super(t),this.template=t.template,this.templateFormat=t.templateFormat??this.templateFormat,this.validateTemplate=t.validateTemplate??this.validateTemplate,this.additionalContentFields=t.additionalContentFields,this.validateTemplate){let r=this.inputVariables;this.partialVariables&&(r=r.concat(Object.keys(this.partialVariables))),Ri([{type:"image_url",image_url:this.template}],this.templateFormat,r)}}_getPromptType(){return"prompt"}async partial(t){let r=this.inputVariables.filter(a=>!(a in t)),n={...this.partialVariables??{},...t},i={...this,inputVariables:r,partialVariables:n};return new KP(i)}async format(t){let r={};for(let[o,s]of Object.entries(this.template))typeof s=="string"?r[o]=Qt(s,this.templateFormat,t):r[o]=s;let n=t.url||r.url,i=t.detail||r.detail;if(!n)throw new Error("Must provide either an image URL.");if(typeof n!="string")throw new Error("url must be a string.");let a={url:n};return i&&(a.detail=i),a}async formatPromptValue(t){return new $x(await this.format(t))}};var su=class extends se{lc_namespace=["langchain_core","prompts","dict"];lc_serializable=!0;template;templateFormat;inputVariables;static lc_name(){return"DictPromptTemplate"}constructor(e){let t=e.templateFormat??"f-string",r=Zx(e.template,t);super({inputVariables:r,...e}),this.template=e.template,this.templateFormat=t,this.inputVariables=r}async format(e){return Hx(this.template,e,this.templateFormat)}async invoke(e){return await this._callWithConfig(this.format.bind(this),e,{runType:"prompt"})}};function Zx(e,t){let r=[];for(let n of Object.values(e))if(typeof n=="string")Ho(n,t).forEach(i=>{i.type==="variable"&&r.push(i.name)});else if(Array.isArray(n))for(let i of n)typeof i=="string"?Ho(i,t).forEach(a=>{a.type==="variable"&&r.push(a.name)}):typeof i=="object"&&r.push(...Zx(i,t));else typeof n=="object"&&n!==null&&r.push(...Zx(n,t));return Array.from(new Set(r))}function Hx(e,t,r){let n={};for(let[i,a]of Object.entries(e))if(typeof a=="string")n[i]=Qt(a,r,t);else if(Array.isArray(a)){let o=[];for(let s of a)typeof s=="string"?o.push(Qt(s,r,t)):typeof s=="object"&&o.push(Hx(s,t,r));n[i]=o}else typeof a=="object"&&a!==null?n[i]=Hx(a,t,r):n[i]=a;return n}var cu=class extends se{lc_namespace=["langchain_core","prompts","chat"];lc_serializable=!0;async invoke(e,t){return this._callWithConfig(r=>this.formatMessages(r),e,{...t,runType:"prompt"})}},lm=class extends cu{static lc_name(){return"MessagesPlaceholder"}variableName;optional;constructor(e){typeof e=="string"&&(e={variableName:e}),super(e),this.variableName=e.variableName,this.optional=e.optional??!1}get inputVariables(){return[this.variableName]}async formatMessages(e){let t=e[this.variableName];if(this.optional&&!t)return[];if(!t){let n=new Error(`Field "${this.variableName}" in prompt uses a MessagesPlaceholder, which expects an array of BaseMessages as an input value. Received: undefined`);throw n.name="InputFormatError",n}let r;try{Array.isArray(t)?r=t.map(Et):r=[Et(t)]}catch(n){let i=typeof t=="string"?t:JSON.stringify(t,null,2),a=new Error([`Field "${this.variableName}" in prompt uses a MessagesPlaceholder, which expects an array of BaseMessages or coerceable values as input.`,`Received value: ${i}`,`Additional message: ${n.message}`].join(`
322
+
323
+ `));throw a.name="InputFormatError",a.lc_error_code=n.lc_error_code,a}return r}},Gx=class extends cu{prompt;constructor(e){"prompt"in e||(e={prompt:e}),super(e),this.prompt=e.prompt}get inputVariables(){return this.prompt.inputVariables}async formatMessages(e){return[await this.format(e)]}},lu=class extends ti{constructor(e){super(e)}async format(e){return(await this.formatPromptValue(e)).toString()}async formatPromptValue(e){return new Yl(await this.formatMessages(e))}},Wx=class extends Gx{static lc_name(){return"ChatMessagePromptTemplate"}role;constructor(e,t){"prompt"in e||(e={prompt:e,role:t}),super(e),this.role=e.role}async format(e){return new fn(await this.prompt.format(e),this.role)}static fromTemplate(e,t,r){return new this(bn.fromTemplate(e,{templateFormat:r?.templateFormat}),t)}};function NB(e){return e===null||typeof e!="object"||Array.isArray(e)?!1:Object.keys(e).length===1&&"text"in e&&typeof e.text=="string"}function RB(e){return e===null||typeof e!="object"||Array.isArray(e)?!1:"image_url"in e&&(typeof e.image_url=="string"||typeof e.image_url=="object"&&e.image_url!==null&&"url"in e.image_url&&typeof e.image_url.url=="string")}var Jx=class extends cu{lc_namespace=["langchain_core","prompts","chat"];lc_serializable=!0;inputVariables=[];additionalOptions={};prompt;messageClass;static _messageClass(){throw new Error("Can not invoke _messageClass from inside _StringImageMessagePromptTemplate")}chatMessageClass;constructor(e,t){if("prompt"in e||(e={prompt:e}),super(e),this.prompt=e.prompt,Array.isArray(this.prompt)){let r=[];this.prompt.forEach(n=>{"inputVariables"in n&&(r=r.concat(n.inputVariables))}),this.inputVariables=r}else this.inputVariables=this.prompt.inputVariables;this.additionalOptions=t??this.additionalOptions}createMessage(e){let t=this.constructor;if(t._messageClass())return new(t._messageClass())({content:e});if(t.chatMessageClass){let r=t.chatMessageClass();return new r({content:e,role:this.getRoleFromMessageClass(r.lc_name())})}else throw new Error("No message class defined")}getRoleFromMessageClass(e){switch(e){case"HumanMessage":return"human";case"AIMessage":return"ai";case"SystemMessage":return"system";case"ChatMessage":return"chat";default:throw new Error("Invalid message class name")}}static fromTemplate(e,t){if(typeof e=="string")return new this(bn.fromTemplate(e,t));let r=[];for(let n of e)if(typeof n=="string")r.push(bn.fromTemplate(n,t));else if(n!==null)if(NB(n)){let i="";typeof n.text=="string"&&(i=n.text??"");let a={...t,additionalContentFields:n};r.push(bn.fromTemplate(i,a))}else if(RB(n)){let i=n.image_url??"",a,o=[];if(typeof i=="string"){let s;t?.templateFormat==="mustache"?s=dc(i):s=Zo(i);let c=s.flatMap(l=>l.type==="variable"?[l.name]:[]);if((c?.length??0)>0){if(c.length>1)throw new Error(`Only one format variable allowed per image template.
324
+ Got: ${c}
325
+ From: ${i}`);o=[c[0]]}else o=[];i={url:i},a=new fc({template:i,inputVariables:o,templateFormat:t?.templateFormat,additionalContentFields:n})}else if(typeof i=="object"){if("url"in i){let s;t?.templateFormat==="mustache"?s=dc(i.url):s=Zo(i.url),o=s.flatMap(c=>c.type==="variable"?[c.name]:[])}else o=[];a=new fc({template:i,inputVariables:o,templateFormat:t?.templateFormat,additionalContentFields:n})}else throw new Error("Invalid image template");r.push(a)}else typeof n=="object"&&r.push(new su({template:n,templateFormat:t?.templateFormat}));return new this({prompt:r,additionalOptions:t})}async format(e){if(this.prompt instanceof Ni){let t=await this.prompt.format(e);return this.createMessage(t)}else{let t=[];for(let r of this.prompt){let n={};if(!("inputVariables"in r))throw new Error(`Prompt ${r} does not have inputVariables defined.`);for(let i of r.inputVariables)n||(n={[i]:e[i]}),n={...n,[i]:e[i]};if(r instanceof Ni){let i=await r.format(n),a;"additionalContentFields"in r&&(a=r.additionalContentFields),i!==""&&t.push({...a,type:"text",text:i})}else if(r instanceof fc){let i=await r.format(n),a;"additionalContentFields"in r&&(a=r.additionalContentFields),t.push({...a,type:"image_url",image_url:i})}else if(r instanceof su){let i=await r.format(n),a;"additionalContentFields"in r&&(a=r.additionalContentFields),t.push({...a,...i})}}return this.createMessage(t)}}async formatMessages(e){return[await this.format(e)]}},um=class extends Jx{static _messageClass(){return ot}static lc_name(){return"HumanMessagePromptTemplate"}},Kx=class extends Jx{static _messageClass(){return Ne}static lc_name(){return"AIMessagePromptTemplate"}},qx=class extends Jx{static _messageClass(){return or}static lc_name(){return"SystemMessagePromptTemplate"}};function MB(e){return typeof e.formatMessages=="function"}function jB(e,t){if(MB(e)||rt(e))return e;if(Array.isArray(e)&&e[0]==="placeholder"){let i=e[1];if(t?.templateFormat==="mustache"&&typeof i=="string"&&i.slice(0,2)==="{{"&&i.slice(-2)==="}}")return new lm({variableName:i.slice(2,-2),optional:!0});if(typeof i=="string"&&i[0]==="{"&&i[i.length-1]==="}")return new lm({variableName:i.slice(1,-1),optional:!0});throw new Error(`Invalid placeholder template for format ${t?.templateFormat??'"f-string"'}: "${e[1]}". Expected a variable name surrounded by ${t?.templateFormat==="mustache"?"double":"single"} curly braces.`)}let r=Et(e),n;if(typeof r.content=="string"?n=r.content:n=r.content.map(i=>"text"in i?{...i,text:i.text}:"image_url"in i?{...i,image_url:i.image_url}:i),r._getType()==="human")return um.fromTemplate(n,t);if(r._getType()==="ai")return Kx.fromTemplate(n,t);if(r._getType()==="system")return qx.fromTemplate(n,t);if(fn.isInstance(r))return Wx.fromTemplate(r.content,r.role,t);throw new Error(`Could not coerce message prompt template from input. Received message type: "${r._getType()}".`)}function DB(e){return e.constructor.lc_name()==="MessagesPlaceholder"}var pc=class cm extends lu{static lc_name(){return"ChatPromptTemplate"}get lc_aliases(){return{promptMessages:"messages"}}promptMessages;validateTemplate=!0;templateFormat="f-string";constructor(t){if(super(t),t.templateFormat==="mustache"&&t.validateTemplate===void 0&&(this.validateTemplate=!1),Object.assign(this,t),this.validateTemplate){let r=new Set;for(let s of this.promptMessages)if(!(s instanceof Pe))for(let c of s.inputVariables)r.add(c);let n=this.inputVariables,i=new Set(this.partialVariables?n.concat(Object.keys(this.partialVariables)):n),a=new Set([...i].filter(s=>!r.has(s)));if(a.size>0)throw new Error(`Input variables \`${[...a]}\` are not used in any of the prompt messages.`);let o=new Set([...r].filter(s=>!i.has(s)));if(o.size>0)throw new Error(`Input variables \`${[...o]}\` are used in prompt messages but not in the prompt template.`)}}_getPromptType(){return"chat"}async _parseImagePrompts(t,r){return typeof t.content=="string"||(t.content=await Promise.all(t.content.map(async n=>{if(n.type!=="image_url")return n;let i="";typeof n.image_url=="string"?i=n.image_url:typeof n.image_url=="object"&&n.image_url!==null&&"url"in n.image_url&&typeof n.image_url.url=="string"&&(i=n.image_url.url);let a=await bn.fromTemplate(i,{templateFormat:this.templateFormat}).format(r);return typeof n.image_url=="object"&&n.image_url!==null&&"url"in n.image_url?n.image_url.url=a:n.image_url=a,n}))),t}async formatMessages(t){let r=await this.mergePartialAndUserVariables(t),n=[];for(let i of this.promptMessages)if(i instanceof Pe)n.push(await this._parseImagePrompts(i,r));else{let a;this.templateFormat==="mustache"?a={...r}:a=i.inputVariables.reduce((s,c)=>{if(!(c in r)&&!(DB(i)&&i.optional))throw fi(new Error(`Missing value for input variable \`${c.toString()}\``),"INVALID_PROMPT_INPUT");return s[c]=r[c],s},{});let o=await i.formatMessages(a);n=n.concat(o)}return n}async partial(t){let r=this.inputVariables.filter(a=>!(a in t)),n={...this.partialVariables??{},...t},i={...this,inputVariables:r,partialVariables:n};return new cm(i)}static fromTemplate(t,r){let n=new um({prompt:bn.fromTemplate(t,r)});return this.fromMessages([n])}static fromMessages(t,r){let n=t.reduce((o,s)=>o.concat(s instanceof cm?s.promptMessages:[jB(s,r)]),[]),i=t.reduce((o,s)=>s instanceof cm?Object.assign(o,s.partialVariables):o,Object.create(null)),a=new Set;for(let o of n)if(!(o instanceof Pe))for(let s of o.inputVariables)s in i||a.add(s);return new this({...r,inputVariables:[...a],promptMessages:n,partialVariables:i,templateFormat:r?.templateFormat})}};var qP=class Yx extends Ni{lc_serializable=!1;examples;exampleSelector;examplePrompt;suffix="";exampleSeparator=`
326
+
327
+ `;prefix="";templateFormat="f-string";validateTemplate=!0;constructor(t){if(super(t),Object.assign(this,t),this.examples!==void 0&&this.exampleSelector!==void 0)throw new Error("Only one of 'examples' and 'example_selector' should be provided");if(this.examples===void 0&&this.exampleSelector===void 0)throw new Error("One of 'examples' and 'example_selector' should be provided");if(this.validateTemplate){let r=this.inputVariables;this.partialVariables&&(r=r.concat(Object.keys(this.partialVariables))),Ri(this.prefix+this.suffix,this.templateFormat,r)}}_getPromptType(){return"few_shot"}static lc_name(){return"FewShotPromptTemplate"}async getExamples(t){if(this.examples!==void 0)return this.examples;if(this.exampleSelector!==void 0)return this.exampleSelector.selectExamples(t);throw new Error("One of 'examples' and 'example_selector' should be provided")}async partial(t){let r=this.inputVariables.filter(a=>!(a in t)),n={...this.partialVariables??{},...t},i={...this,inputVariables:r,partialVariables:n};return new Yx(i)}async format(t){let r=await this.mergePartialAndUserVariables(t),n=await this.getExamples(r),i=await Promise.all(n.map(a=>this.examplePrompt.format(a)));return Qt([this.prefix,...i,this.suffix].join(this.exampleSeparator),this.templateFormat,r)}serialize(){if(this.exampleSelector||!this.examples)throw new Error("Serializing an example selector is not currently supported");if(this.outputParser!==void 0)throw new Error("Serializing an output parser is not currently supported");return{_type:this._getPromptType(),input_variables:this.inputVariables,example_prompt:this.examplePrompt.serialize(),example_separator:this.exampleSeparator,suffix:this.suffix,prefix:this.prefix,template_format:this.templateFormat,examples:this.examples}}static async deserialize(t){let{example_prompt:r}=t;if(!r)throw new Error("Missing example prompt");let n=await bn.deserialize(r),i;if(Array.isArray(t.examples))i=t.examples;else throw new Error("Invalid examples format. Only list or string are supported.");return new Yx({inputVariables:t.input_variables,examplePrompt:n,examples:i,exampleSeparator:t.example_separator,prefix:t.prefix,suffix:t.suffix,templateFormat:t.template_format})}},YP=class XP extends lu{lc_serializable=!0;examples;exampleSelector;examplePrompt;suffix="";exampleSeparator=`
328
+
329
+ `;prefix="";templateFormat="f-string";validateTemplate=!0;_getPromptType(){return"few_shot_chat"}static lc_name(){return"FewShotChatMessagePromptTemplate"}constructor(t){if(super(t),this.examples=t.examples,this.examplePrompt=t.examplePrompt,this.exampleSeparator=t.exampleSeparator??`
330
+
331
+ `,this.exampleSelector=t.exampleSelector,this.prefix=t.prefix??"",this.suffix=t.suffix??"",this.templateFormat=t.templateFormat??"f-string",this.validateTemplate=t.validateTemplate??!0,this.examples!==void 0&&this.exampleSelector!==void 0)throw new Error("Only one of 'examples' and 'example_selector' should be provided");if(this.examples===void 0&&this.exampleSelector===void 0)throw new Error("One of 'examples' and 'example_selector' should be provided");if(this.validateTemplate){let r=this.inputVariables;this.partialVariables&&(r=r.concat(Object.keys(this.partialVariables))),Ri(this.prefix+this.suffix,this.templateFormat,r)}}async getExamples(t){if(this.examples!==void 0)return this.examples;if(this.exampleSelector!==void 0)return this.exampleSelector.selectExamples(t);throw new Error("One of 'examples' and 'example_selector' should be provided")}async formatMessages(t){let r=await this.mergePartialAndUserVariables(t),n=await this.getExamples(r);n=n.map(a=>{let o={};return this.examplePrompt.inputVariables.forEach(s=>{o[s]=a[s]}),o});let i=[];for(let a of n){let o=await this.examplePrompt.formatMessages(a);i.push(...o)}return i}async format(t){let r=await this.mergePartialAndUserVariables(t),n=await this.getExamples(r),i=(await Promise.all(n.map(a=>this.examplePrompt.formatMessages(a)))).flat().map(a=>a.content);return Qt([this.prefix,...i,this.suffix].join(this.exampleSeparator),this.templateFormat,r)}async partial(t){let r=this.inputVariables.filter(a=>!(a in t)),n={...this.partialVariables??{},...t},i={...this,inputVariables:r,partialVariables:n};return new XP(i)}};var QP=class dm extends ti{static lc_name(){return"PipelinePromptTemplate"}pipelinePrompts;finalPrompt;constructor(t){super({...t,inputVariables:[]}),this.pipelinePrompts=t.pipelinePrompts,this.finalPrompt=t.finalPrompt,this.inputVariables=this.computeInputValues()}computeInputValues(){let t=this.pipelinePrompts.map(n=>n.name),r=this.pipelinePrompts.map(n=>n.prompt.inputVariables.filter(i=>!t.includes(i))).flat();return[...new Set(r)]}static extractRequiredInputValues(t,r){return r.reduce((n,i)=>(n[i]=t[i],n),{})}async formatPipelinePrompts(t){let r=await this.mergePartialAndUserVariables(t);for(let{name:n,prompt:i}of this.pipelinePrompts){let a=dm.extractRequiredInputValues(r,i.inputVariables);i instanceof pc?r[n]=await i.formatMessages(a):r[n]=await i.format(a)}return dm.extractRequiredInputValues(r,this.finalPrompt.inputVariables)}async formatPromptValue(t){return this.finalPrompt.formatPromptValue(await this.formatPipelinePrompts(t))}async format(t){return this.finalPrompt.format(await this.formatPipelinePrompts(t))}async partial(t){let r={...this};return r.inputVariables=this.inputVariables.filter(n=>!(n in t)),r.partialVariables={...this.partialVariables??{},...t},new dm(r)}serialize(){throw new Error("Not implemented.")}_getPromptType(){return"pipeline"}};function eN(e){return typeof e=="object"&&e!=null&&"withStructuredOutput"in e&&typeof e.withStructuredOutput=="function"}function zB(e){return typeof e=="object"&&e!=null&&"lc_id"in e&&Array.isArray(e.lc_id)&&e.lc_id.join("/")==="langchain_core/runnables/RunnableBinding"}var tN=class rN extends pc{schema;method;lc_namespace=["langchain_core","prompts","structured"];get lc_aliases(){return{...super.lc_aliases,schema:"schema_"}}constructor(t){super(t),this.schema=t.schema,this.method=t.method}pipe(t){if(eN(t))return super.pipe(t.withStructuredOutput(this.schema));if(zB(t)&&eN(t.bound))return super.pipe(new en({bound:t.bound.withStructuredOutput(this.schema,...this.method?[{method:this.method}]:[]),kwargs:t.kwargs??{},config:t.config,configFactories:t.configFactories}));throw new Error('Structured prompts need to be piped to a language model that supports the "withStructuredOutput()" method.')}static fromMessagesAndSchema(t,r,n){return rN.fromMessages(t,{schema:r,method:n})}};var nN=T({AIMessagePromptTemplate:()=>Kx,BaseChatPromptTemplate:()=>lu,BaseMessagePromptTemplate:()=>cu,BaseMessageStringPromptTemplate:()=>Gx,BasePromptTemplate:()=>ti,BaseStringPromptTemplate:()=>Ni,ChatMessagePromptTemplate:()=>Wx,ChatPromptTemplate:()=>pc,DEFAULT_FORMATTER_MAPPING:()=>au,DEFAULT_PARSER_MAPPING:()=>Vx,DictPromptTemplate:()=>su,FewShotChatMessagePromptTemplate:()=>YP,FewShotPromptTemplate:()=>qP,HumanMessagePromptTemplate:()=>um,ImagePromptTemplate:()=>fc,MessagesPlaceholder:()=>lm,PipelinePromptTemplate:()=>QP,PromptTemplate:()=>bn,StructuredPrompt:()=>tN,SystemMessagePromptTemplate:()=>qx,checkValidTemplate:()=>Ri,interpolateFString:()=>Fx,interpolateMustache:()=>Bx,parseFString:()=>Zo,parseMustache:()=>dc,parseTemplate:()=>Ho,renderTemplate:()=>Qt});var iN=T({BaseDocumentCompressor:()=>UB}),UB=class{static isBaseDocumentCompressor(e){return e?.compressDocuments!==void 0}};var aN=T({BaseRetriever:()=>uu}),uu=class extends se{callbacks;tags;metadata;verbose;constructor(e){super(e),this.callbacks=e?.callbacks,this.tags=e?.tags??[],this.metadata=e?.metadata??{},this.verbose=e?.verbose??!1}_getRelevantDocuments(e,t){throw new Error("Not implemented!")}async invoke(e,t){let r=ke(uo(t)),n=await(await Ye.configure(r.callbacks,this.callbacks,r.tags,this.tags,r.metadata,this.metadata,{verbose:this.verbose}))?.handleRetrieverStart(this.toJSON(),e,r.runId,void 0,void 0,void 0,r.runName);try{let i=await this._getRelevantDocuments(e,n);return await n?.handleRetrieverEnd(i),i}catch(i){throw await n?.handleRetrieverError(i),i}}};var oN=T({BaseStore:()=>sN,InMemoryStore:()=>LB}),sN=class extends pt{},LB=class extends sN{lc_namespace=["langchain","storage"];store={};async mget(e){return e.map(t=>this.store[t])}async mset(e){for(let[t,r]of e)this.store[t]=r}async mdelete(e){for(let t of e)delete this.store[t]}async*yieldKeys(e){let t=Object.keys(this.store);for(let r of t)(e===void 0||r.startsWith(e))&&(yield r)}};var wn={and:"and",or:"or",not:"not"},Ie={eq:"eq",ne:"ne",lt:"lt",gt:"gt",lte:"lte",gte:"gte"},fm=class{},pm=class{accept(e){if(this.exprName==="Operation")return e.visitOperation(this);if(this.exprName==="Comparison")return e.visitComparison(this);if(this.exprName==="StructuredQuery")return e.visitStructuredQuery(this);throw new Error("Unknown Expression type")}},mm=class extends pm{},cN=class extends mm{comparator;attribute;value;exprName="Comparison";constructor(e,t,r){super(),this.comparator=e,this.attribute=t,this.value=r}},lN=class extends mm{operator;args;exprName="Operation";constructor(e,t){super(),this.operator=e,this.args=t}},uN=class extends pm{query;filter;exprName="StructuredQuery";constructor(e,t){super(),this.query=e,this.filter=t}};function Xx(e){return e&&typeof e=="object"&&!Array.isArray(e)}function Er(e){return e?typeof e=="string"&&e.length>0||typeof e=="function"?!1:Xx(e)&&Object.keys(e).length===0:!0}function Qx(e){if(typeof e=="number")return e%1===0;if(typeof e=="string"){let t=parseInt(e,10);return!Number.isNaN(t)&&t%1===0&&t.toString()===e}return!1}function e0(e){if(typeof e=="number")return e%1!==0;if(typeof e=="string"){let t=parseFloat(e);return!Number.isNaN(t)&&t%1!==0&&t.toString()===e}return!1}function t0(e){return typeof e=="string"&&(Number.isNaN(parseFloat(e))||parseFloat(e).toString()!==e)}function r0(e){return typeof e=="boolean"}function mc(e){let t;if(t0(e))t=e;else if(Qx(e))t=parseInt(e,10);else if(e0(e))t=parseFloat(e);else if(r0(e))t=!!e;else throw new Error("Unsupported value type");return t}var du=class extends fm{},dN=class extends du{allowedOperators;allowedComparators;constructor(e){super(),this.allowedOperators=e?.allowedOperators??[wn.and,wn.or],this.allowedComparators=e?.allowedComparators??[Ie.eq,Ie.ne,Ie.gt,Ie.gte,Ie.lt,Ie.lte]}formatFunction(e){if(e in Ie){if(this.allowedComparators.length>0&&this.allowedComparators.indexOf(e)===-1)throw new Error(`Comparator ${e} not allowed. Allowed comparators: ${this.allowedComparators.join(", ")}`)}else if(e in wn){if(this.allowedOperators.length>0&&this.allowedOperators.indexOf(e)===-1)throw new Error(`Operator ${e} not allowed. Allowed operators: ${this.allowedOperators.join(", ")}`)}else throw new Error("Unknown comparator or operator");return`$${e}`}visitOperation(e){let t=e.args?.map(r=>r.accept(this));return{[this.formatFunction(e.operator)]:t}}visitComparison(e){return{[e.attribute]:{[this.formatFunction(e.comparator)]:mc(e.value)}}}visitStructuredQuery(e){let t={};return e.filter&&(t={filter:e.filter.accept(this)}),t}mergeFilters(e,t,r="and",n=!1){if(!(Er(e)&&Er(t))){if(Er(e)||r==="replace")return Er(t)?void 0:t;if(Er(t))return n?e:r==="and"?void 0:e;if(r==="and")return{$and:[e,t]};if(r==="or")return{$or:[e,t]};throw new Error("Unknown merge type")}}};var fN=class extends du{allowedOperators=[wn.and,wn.or];allowedComparators=[Ie.eq,Ie.ne,Ie.gt,Ie.gte,Ie.lt,Ie.lte];formatFunction(){throw new Error("Not implemented")}getAllowedComparatorsForType(e){switch(e){case"string":return[Ie.eq,Ie.ne,Ie.gt,Ie.gte,Ie.lt,Ie.lte];case"number":return[Ie.eq,Ie.ne,Ie.gt,Ie.gte,Ie.lt,Ie.lte];case"boolean":return[Ie.eq,Ie.ne];default:throw new Error(`Unsupported data type: ${e}`)}}getComparatorFunction(e){switch(e){case Ie.eq:return(t,r)=>t===r;case Ie.ne:return(t,r)=>t!==r;case Ie.gt:return(t,r)=>t>r;case Ie.gte:return(t,r)=>t>=r;case Ie.lt:return(t,r)=>t<r;case Ie.lte:return(t,r)=>t<=r;default:throw new Error("Unknown comparator")}}getOperatorFunction(e){switch(e){case wn.and:return(t,r)=>t&&r;case wn.or:return(t,r)=>t||r;default:throw new Error("Unknown operator")}}visitOperation(e){let{operator:t,args:r}=e;if(this.allowedOperators.includes(t)){let n=this.getOperatorFunction(t);return i=>r?r.reduce((a,o)=>{let s=o.accept(this);if(typeof s=="function")return n(a,s(i));throw new Error("Filter is not a function")},!0):!0}else throw new Error("Operator not allowed")}visitComparison(e){let{comparator:t,attribute:r,value:n}=e,i=[Ie.ne];if(this.allowedComparators.includes(t)){if(!this.getAllowedComparatorsForType(typeof n).includes(t))throw new Error(`'${t}' comparator not allowed to be used with ${typeof n}`);let a=this.getComparatorFunction(t);return o=>{let s=o.metadata[r];return s===void 0?!!i.includes(t):a(s,mc(n))}}else throw new Error("Comparator not allowed")}visitStructuredQuery(e){if(!e.filter)return{};let t=e.filter?.accept(this);if(typeof t!="function")throw new Error("Structured query filter is not a function");return{filter:t}}mergeFilters(e,t,r="and"){if(!(Er(e)&&Er(t))){if(Er(e)||r==="replace")return Er(t)?void 0:t;if(Er(t))return r==="and"?void 0:e;if(r==="and")return n=>e(n)&&t(n);if(r==="or")return n=>e(n)||t(n);throw new Error("Unknown merge type")}}};var pN=T({BaseTranslator:()=>du,BasicTranslator:()=>dN,Comparators:()=>Ie,Comparison:()=>cN,Expression:()=>pm,FilterDirective:()=>mm,FunctionalTranslator:()=>fN,Operation:()=>lN,Operators:()=>wn,StructuredQuery:()=>uN,Visitor:()=>fm,castValue:()=>mc,isBoolean:()=>r0,isFilterEmpty:()=>Er,isFloat:()=>e0,isInt:()=>Qx,isObject:()=>Xx,isString:()=>t0});function fu(e){if(e==null||typeof e!="object")return!1;let t=e;return typeof t.text<"u"&&typeof t.toolCalls<"u"&&typeof t.reasoning<"u"&&typeof t.usage<"u"&&typeof t.output<"u"&&typeof t[Symbol.asyncIterator]=="function"}function mN(e,t,r){return e==null?!1:Object.entries(t).every(([n,i])=>r(e[n],i))}function hN(e,t,r){return e==null?!1:mN(e,t,r)}function gN(e){return e.content.find(t=>t.type==="text")?.text}function FB(e,t,r){if(t.id!==void 0&&e.id!==t.id||t.text!==void 0&&gN(e)!==t.text)return!1;if(t.toolCalls!==void 0){let n=e.tool_calls??[];if(n.length!==t.toolCalls.length)return!1;for(let i=0;i<t.toolCalls.length;i++){let a=n[i],o=t.toolCalls[i];if(a?.name!==o.name||!r(a.args,o.args))return!1}}return!(t.usage!==void 0&&!hN(e.usage_metadata,t.usage,r)||t.responseMetadata!==void 0&&!mN(e.response_metadata,t.responseMetadata,r))}function pu(e,t,r){return{pass:!1,message:()=>`${r.matcherHint(t)}
332
+
333
+ Expected: ChatModelStream (return value of model.streamEvents("Hello"))
334
+ Received: ${r.printReceived(e)}`,actual:e,expected:"ChatModelStream"}}function mu(e,t){return t?!e:e}async function BB(e,t){let{isNot:r,utils:n}=this,i="toHaveStreamText";if(!fu(e))return pu(e,i,n);let a=await e.text;return{pass:mu(a===t,r),message:()=>`${n.matcherHint(i,void 0,void 0,{isNot:r})}
335
+
336
+ Expected stream text: ${r?"not ":""}${n.printExpected(t)}
337
+ Received stream text: ${n.printReceived(a)}`,actual:a,expected:t}}async function VB(e,t){let{isNot:r,utils:n}=this,i="toHaveStreamReasoning";if(!fu(e))return pu(e,i,n);let a=await e.reasoning;return{pass:mu(a===t,r),message:()=>`${n.matcherHint(i,void 0,void 0,{isNot:r})}
338
+
339
+ Expected stream reasoning: ${r?"not ":""}${n.printExpected(t)}
340
+ Received stream reasoning: ${n.printReceived(a)}`,actual:a,expected:t}}async function ZB(e,t){let{isNot:r,utils:n}=this,i="toHaveStreamToolCalls";if(!fu(e))return pu(e,i,n);let a=await e.toolCalls,o=a.length===t.length&&t.every((s,c)=>{let l=a[c];return l?.name===s.name&&this.equals(l.args,s.args)});return o=mu(o,r),{pass:o,message:()=>`${n.matcherHint(i,void 0,void 0,{isNot:r})}
341
+
342
+ Expected stream tool calls: ${n.printExpected(t)}
343
+ Received stream tool calls: ${n.printReceived(a.map(s=>({name:s.name,args:s.args})))}`,actual:a.map(s=>({name:s.name,args:s.args})),expected:t}}async function HB(e,t){let{isNot:r,utils:n}=this,i="toHaveStreamUsage";if(!fu(e))return pu(e,i,n);let a=await e.usage;return{pass:mu(hN(a,t,this.equals),r),message:()=>`${n.matcherHint(i,void 0,void 0,{isNot:r})}
344
+
345
+ Expected stream usage: ${n.printExpected(t)}
346
+ Received stream usage: ${n.printReceived(a)}`,actual:a,expected:t}}async function GB(e,t){let{isNot:r,utils:n}=this,i="toHaveStreamOutput";if(!fu(e))return pu(e,i,n);let a=await e.output;return{pass:mu(FB(a,t,this.equals),r),message:()=>`${n.matcherHint(i,void 0,void 0,{isNot:r})}
347
+
348
+ Expected stream output: ${n.printExpected(t)}
349
+ Received stream output: ${n.printReceived({id:a.id,text:gN(a),tool_calls:a.tool_calls?.map(o=>({name:o.name,args:o.args})),usage_metadata:a.usage_metadata,response_metadata:a.response_metadata})}`,actual:a,expected:t}}var hc={toHaveStreamText:BB,toHaveStreamReasoning:VB,toHaveStreamToolCalls:ZB,toHaveStreamUsage:HB,toHaveStreamOutput:GB};function hu(e){return Pe.isInstance(e)?e.constructor.name||e.type:typeof e}function hm(e,t){return function(r,n){let{isNot:i,utils:a}=this;if(!t(r))return{pass:!1,message:()=>`${a.matcherHint(`toBe${e}`,void 0,void 0)}
350
+
351
+ Expected: ${i?"not ":""}${e}
352
+ Received: ${hu(r)}`,actual:hu(r),expected:e};if(n===void 0)return{pass:!0,message:()=>`${a.matcherHint(`toBe${e}`,void 0,void 0)}
353
+
354
+ Expected: not ${e}
355
+ Received: ${e}`};let o=r;return typeof n=="string"?{pass:o.content===n,message:()=>`${a.matcherHint(`toBe${e}`,void 0,void 0)}
356
+
357
+ Expected: ${e} with content ${a.printExpected(n)}
358
+ Received: ${e} with content ${a.printReceived(o.content)}`,actual:o.content,expected:n}:{pass:Object.entries(n).every(([s,c])=>this.equals(o[s],c)),message:()=>{let s={};for(let c of Object.keys(n))s[c]=o[c];return`${a.matcherHint(`toBe${e}`,void 0,void 0)}
359
+
360
+ Expected: ${e} matching ${a.printExpected(n)}
361
+ Received: ${e} with ${a.printReceived(s)}`},actual:(()=>{let s={};for(let c of Object.keys(n))s[c]=o[c];return s})(),expected:n}}}var n0=hm("HumanMessage",ot.isInstance),i0=hm("AIMessage",Ne.isInstance),a0=hm("SystemMessage",or.isInstance),o0=hm("ToolMessage",kt.isInstance);function s0(e,t){let{isNot:r,utils:n}=this;if(!Ne.isInstance(e))return{pass:!1,message:()=>`${n.matcherHint("toHaveToolCalls")}
362
+
363
+ Expected: AIMessage
364
+ Received: ${hu(e)}`};let i=e.tool_calls??[];if(i.length!==t.length)return{pass:!1,message:()=>`${n.matcherHint("toHaveToolCalls")}
365
+
366
+ Expected ${r?"not ":""}${t.length} tool call(s), received ${i.length}`,actual:i.length,expected:t.length};let a=t.filter(o=>!i.some(s=>Object.entries(o).every(([c,l])=>this.equals(s[c],l))));return a.length>0?{pass:!1,message:()=>`${n.matcherHint("toHaveToolCalls")}
367
+
368
+ Could not find matching tool call(s) for:
369
+ ${n.printExpected(a)}
370
+ Received tool calls: ${n.printReceived(i.map(o=>({name:o.name,id:o.id,args:o.args})))}`,actual:i.map(o=>({name:o.name,id:o.id,args:o.args})),expected:t}:{pass:!0,message:()=>`${n.matcherHint("toHaveToolCalls")}
371
+
372
+ Expected AIMessage not to have matching tool calls`}}function c0(e,t){let{isNot:r,utils:n}=this;if(!Ne.isInstance(e))return{pass:!1,message:()=>`${n.matcherHint("toHaveToolCallCount")}
373
+
374
+ Expected: AIMessage
375
+ Received: ${hu(e)}`};let i=e.tool_calls?.length??0;return{pass:i===t,message:()=>`${n.matcherHint("toHaveToolCallCount")}
376
+
377
+ Expected ${r?"not ":""}${t} tool call(s)
378
+ Received: ${i}`,actual:i,expected:t}}function l0(e,t){let{isNot:r,utils:n}=this;if(!Ne.isInstance(e))return{pass:!1,message:()=>`${n.matcherHint("toContainToolCall")}
379
+
380
+ Expected: AIMessage
381
+ Received: ${hu(e)}`};let i=e.tool_calls??[];return{pass:i.some(a=>Object.entries(t).every(([o,s])=>this.equals(a[o],s))),message:()=>`${n.matcherHint("toContainToolCall")}
382
+
383
+ Expected AIMessage ${r?"not ":""}to contain a tool call matching ${n.printExpected(t)}
384
+ Received tool calls: ${n.printReceived(i.map(a=>({name:a.name,id:a.id})))}`,actual:i.map(a=>({name:a.name,id:a.id})),expected:t}}function u0(e,t){let{isNot:r,utils:n}=this;if(!Array.isArray(e))return{pass:!1,message:()=>`${n.matcherHint("toHaveToolMessages")}
385
+
386
+ Expected an array of messages
387
+ Received: ${typeof e}`};let i=e.filter(kt.isInstance);if(i.length!==t.length)return{pass:!1,message:()=>`${n.matcherHint("toHaveToolMessages")}
388
+
389
+ Expected ${r?"not ":""}${t.length} tool message(s), found ${i.length}`,actual:i.length,expected:t.length};for(let a=0;a<t.length;a++)if(!Object.entries(t[a]).every(([o,s])=>this.equals(i[a][o],s)))return{pass:!1,message:()=>{let o={};for(let s of Object.keys(t[a]))o[s]=i[a][s];return`${n.matcherHint("toHaveToolMessages")}
390
+
391
+ Tool message at index ${a} did not match:
392
+ Expected: ${n.printExpected(t[a])}
393
+ Received: ${n.printReceived(o)}`},actual:i[a],expected:t[a]};return{pass:!0,message:()=>`${n.matcherHint("toHaveToolMessages")}
394
+
395
+ Expected messages not to contain matching tool messages`}}function d0(e,t){let{isNot:r,utils:n}=this,i=e?.__interrupt__;if(!(Array.isArray(i)&&i.length>0))return{pass:!1,message:()=>`${n.matcherHint("toHaveBeenInterrupted")}
396
+
397
+ Expected result ${r?"not ":""}to have been interrupted
398
+ Received __interrupt__: ${n.printReceived(i)}`};if(t===void 0)return{pass:!0,message:()=>`${n.matcherHint("toHaveBeenInterrupted")}
399
+
400
+ Expected result not to have been interrupted
401
+ Received ${i.length} interrupt(s)`};let a=i[0]?.value;return{pass:this.equals(a,t),message:()=>`${n.matcherHint("toHaveBeenInterrupted")}
402
+
403
+ Expected interrupt value: ${n.printExpected(t)}
404
+ Received interrupt value: ${n.printReceived(a)}`,actual:a,expected:t}}function f0(e,t){let{isNot:r,utils:n}=this,i=e?.structuredResponse;return i===void 0?{pass:!1,message:()=>`${n.matcherHint("toHaveStructuredResponse")}
405
+
406
+ Expected result ${r?"not ":""}to have a structured response
407
+ Received structuredResponse: undefined`}:t===void 0?{pass:!0,message:()=>`${n.matcherHint("toHaveStructuredResponse")}
408
+
409
+ Expected result not to have a structured response`}:{pass:Object.entries(t).every(([a,o])=>this.equals(i[a],o)),message:()=>`${n.matcherHint("toHaveStructuredResponse")}
410
+
411
+ Expected structured response: ${n.printExpected(t)}
412
+ Received structured response: ${n.printReceived(i)}`,actual:i,expected:t}}var _N={toBeHumanMessage:n0,toBeAIMessage:i0,toBeSystemMessage:a0,toBeToolMessage:o0,toHaveToolCalls:s0,toHaveToolCallCount:c0,toContainToolCall:l0,toHaveToolMessages:u0,toHaveBeenInterrupted:d0,toHaveStructuredResponse:f0,...hc};function WB(e){return e.map(t=>t.text).filter(Boolean).join("-")}var yN=0;function JB(){return yN+=1,`fake_tc_${yN}`}var p0=class vN extends Na{queue=[];_alwaysThrowError;_structuredResponseValue;_tools=[];_state={callIndex:0,calls:[]};get calls(){return this._state.calls}get callCount(){return this._state.calls.length}constructor(){super({})}_llmType(){return"fake-model-builder"}_combineLLMOutput(){return[]}respond(t){return typeof t=="function"?this.queue.push({kind:"factory",factory:t}):Pe.isInstance(t)?this.queue.push({kind:"message",message:t}):this.queue.push({kind:"error",error:t}),this}respondWithTools(t){return this.queue.push({kind:"toolCalls",toolCalls:t.map(r=>({name:r.name,args:r.args,id:r.id??JB(),type:"tool_call"}))}),this}alwaysThrow(t){return this._alwaysThrowError=t,this}structuredResponse(t){return this._structuredResponseValue=t,this}bindTools(t){let r=[...this._tools,...t],n=new vN;return n.queue=this.queue,n._alwaysThrowError=this._alwaysThrowError,n._structuredResponseValue=this._structuredResponseValue,n._tools=r,n._state=this._state,n.withConfig({})}withStructuredOutput(t,r){let{_structuredResponseValue:n}=this;return Yt.from(async()=>n)}async _generate(t,r,n){this._state.calls.push({messages:[...t],options:r});let i=this._state.callIndex;if(this._state.callIndex+=1,this._alwaysThrowError)throw this._alwaysThrowError;let a=this.queue[i];if(!a)throw new Error(`FakeModel: no response queued for invocation ${i} (${this.queue.length} total queued).`);if(a.kind==="error")throw a.error;if(a.kind==="factory"){let s=a.factory(t);if(!Pe.isInstance(s))throw s;return{generations:[{text:"",message:s}]}}if(a.kind==="message")return{generations:[{text:"",message:a.message}]};let o=WB(t);return{generations:[{text:o,message:new Ne({content:o,id:i.toString(),tool_calls:a.toolCalls.length>0?a.toolCalls.map(s=>({...s,type:"tool_call"})):void 0})}],llmOutput:{}}}};function bN(){return new p0}function gm(e){return{async*[Symbol.asyncIterator](){for(let t of e)yield t}}}function _m(e="test-model"){let t=gu(e),r=t[t.length-1];return t[t.length-1]={...r,usage:{prompt_tokens:10,completion_tokens:2,total_tokens:12}},t}function gu(e="test-model"){return[{id:"chatcmpl-text",model:e,choices:[{index:0,delta:{role:"assistant",content:"Hello"},finish_reason:null}]},{id:"chatcmpl-text",model:e,choices:[{index:0,delta:{content:" world"},finish_reason:null}]},{id:"chatcmpl-text",model:e,choices:[{index:0,delta:{},finish_reason:"stop"}]}]}function ym(e="test-model"){return[{id:"chatcmpl-reason",model:e,choices:[{index:0,delta:{role:"assistant",reasoning_content:"Let me reason..."},finish_reason:null}]},{id:"chatcmpl-reason",model:e,choices:[{index:0,delta:{content:"Answer."},finish_reason:null}]},{id:"chatcmpl-reason",model:e,choices:[{index:0,delta:{},finish_reason:"stop"}]}]}function vm(e="test-model"){return[{id:"chatcmpl-tools",model:e,choices:[{index:0,delta:{role:"assistant",content:"Let me search."},finish_reason:null}]},{id:"chatcmpl-tools",model:e,choices:[{index:0,delta:{tool_calls:[{index:0,id:"call_abc",type:"function",function:{name:"web_search",arguments:'{"query"'}}]},finish_reason:null}]},{id:"chatcmpl-tools",model:e,choices:[{index:0,delta:{tool_calls:[{index:0,function:{arguments:':"weather"}'}}]},finish_reason:null}]},{id:"chatcmpl-tools",model:e,choices:[{index:0,delta:{},finish_reason:"tool_calls"}]}]}function bm(e){let t=new TextEncoder;return new Response(new ReadableStream({start(r){for(let n of e)r.enqueue(t.encode(`data: ${JSON.stringify(n)}
413
+
414
+ `));r.close()}}),{status:200,headers:{"Content-Type":"text/event-stream"}})}var wN=T({FakeBuiltModel:()=>p0,asAsyncIterable:()=>gm,fakeModel:()=>bN,langchainMatchers:()=>_N,openAIReasoningTextChunks:()=>ym,openAITextOnlyChunks:()=>gu,openAITextOnlyChunksWithUsage:()=>_m,openAIToolCallChunks:()=>vm,sseResponseFromOpenAIChunks:()=>bm,streamMatchers:()=>hc,toBeAIMessage:()=>i0,toBeHumanMessage:()=>n0,toBeSystemMessage:()=>a0,toBeToolMessage:()=>o0,toContainToolCall:()=>l0,toHaveBeenInterrupted:()=>d0,toHaveStructuredResponse:()=>f0,toHaveToolCallCount:()=>c0,toHaveToolCalls:()=>s0,toHaveToolMessages:()=>u0});function _u(e){return e!==void 0&&Array.isArray(e.lc_namespace)}function yu(e){return e!==void 0&&se.isRunnable(e)&&"lc_name"in e.constructor&&typeof e.constructor.lc_name=="function"&&e.constructor.lc_name()==="RunnableToolLike"}function vu(e){return!!e&&typeof e=="object"&&"name"in e&&"schema"in e&&(xr(e.schema)||e.schema!=null&&typeof e.schema=="object"&&"type"in e.schema&&typeof e.schema.type=="string"&&["null","boolean","object","array","number","string"].includes(e.schema.type))}function bu(e){return vu(e)||yu(e)||_u(e)}var nn={};On(nn,{$brand:()=>N_,$input:()=>Xv,$output:()=>Yv,NEVER:()=>P_,TimePrecision:()=>rb,ZodAny:()=>D0,ZodArray:()=>F0,ZodBase64:()=>Fm,ZodBase64URL:()=>Bm,ZodBigInt:()=>Sc,ZodBigIntFormat:()=>Hm,ZodBoolean:()=>xc,ZodCIDRv4:()=>Um,ZodCIDRv6:()=>Lm,ZodCUID:()=>Pm,ZodCUID2:()=>Nm,ZodCatch:()=>lS,ZodCodec:()=>Nu,ZodCustom:()=>Ru,ZodCustomStringFormat:()=>bc,ZodDate:()=>Tu,ZodDefault:()=>nS,ZodDiscriminatedUnion:()=>V0,ZodE164:()=>Vm,ZodEmail:()=>Cm,ZodEmoji:()=>Am,ZodEnum:()=>yc,ZodError:()=>KB,ZodExactOptional:()=>eS,ZodFile:()=>X0,ZodFirstPartyTypeKind:()=>xS,ZodFunction:()=>vS,ZodGUID:()=>Su,ZodIPv4:()=>Dm,ZodIPv6:()=>zm,ZodISODate:()=>Sm,ZodISODateTime:()=>xm,ZodISODuration:()=>Em,ZodISOTime:()=>km,ZodIntersection:()=>Z0,ZodIssueCode:()=>YB,ZodJWT:()=>Zm,ZodKSUID:()=>jm,ZodLazy:()=>gS,ZodLiteral:()=>Y0,ZodMAC:()=>A0,ZodMap:()=>K0,ZodNaN:()=>dS,ZodNanoID:()=>Om,ZodNever:()=>U0,ZodNonOptional:()=>Ym,ZodNull:()=>M0,ZodNullable:()=>rS,ZodNumber:()=>wc,ZodNumberFormat:()=>Wo,ZodObject:()=>Au,ZodOptional:()=>qm,ZodPipe:()=>Pu,ZodPrefault:()=>aS,ZodPreprocess:()=>fS,ZodPromise:()=>yS,ZodReadonly:()=>pS,ZodRealError:()=>$r,ZodRecord:()=>_c,ZodSet:()=>q0,ZodString:()=>vc,ZodStringFormat:()=>Be,ZodSuccess:()=>cS,ZodSymbol:()=>N0,ZodTemplateLiteral:()=>hS,ZodTransform:()=>Q0,ZodTuple:()=>G0,ZodType:()=>_e,ZodULID:()=>Rm,ZodURL:()=>Iu,ZodUUID:()=>ri,ZodUndefined:()=>R0,ZodUnion:()=>Ou,ZodUnknown:()=>z0,ZodVoid:()=>L0,ZodXID:()=>Mm,ZodXor:()=>B0,_ZodString:()=>Tm,_default:()=>iS,_function:()=>A1,any:()=>s1,array:()=>Cu,base64:()=>ZN,base64url:()=>HN,bigint:()=>r1,boolean:()=>P0,catch:()=>uS,check:()=>O1,cidrv4:()=>BN,cidrv6:()=>VN,clone:()=>Xe,codec:()=>$1,coerce:()=>SS,config:()=>ct,core:()=>ki,cuid:()=>RN,cuid2:()=>MN,custom:()=>P1,date:()=>l1,decode:()=>S0,decodeAsync:()=>E0,describe:()=>N1,discriminatedUnion:()=>h1,e164:()=>GN,email:()=>kN,emoji:()=>PN,encode:()=>x0,encodeAsync:()=>k0,endsWith:()=>zs,enum:()=>Jm,exactOptional:()=>tS,file:()=>x1,flattenError:()=>wl,float32:()=>XN,float64:()=>QN,formatError:()=>xl,fromJSONSchema:()=>L1,function:()=>A1,getErrorMap:()=>QB,globalRegistry:()=>De,gt:()=>Hn,gte:()=>dr,guid:()=>EN,hash:()=>YN,hex:()=>qN,hostname:()=>KN,httpUrl:()=>ON,includes:()=>js,instanceof:()=>M1,int:()=>$m,int32:()=>e1,int64:()=>n1,intersection:()=>H0,invertCodec:()=>I1,ipv4:()=>UN,ipv6:()=>FN,iso:()=>gc,json:()=>D1,jwt:()=>WN,keyof:()=>u1,ksuid:()=>zN,lazy:()=>_S,length:()=>So,literal:()=>w1,locales:()=>Pl,looseObject:()=>p1,looseRecord:()=>_1,lowercase:()=>Rs,lt:()=>Zn,lte:()=>zr,mac:()=>LN,map:()=>y1,maxLength:()=>xo,maxSize:()=>ba,meta:()=>R1,mime:()=>Us,minLength:()=>Si,minSize:()=>Gn,multipleOf:()=>va,nan:()=>E1,nanoid:()=>NN,nativeEnum:()=>b1,negative:()=>_p,never:()=>Gm,nonnegative:()=>vp,nonoptional:()=>sS,nonpositive:()=>yp,normalize:()=>Ls,null:()=>j0,nullable:()=>Eu,nullish:()=>S1,number:()=>O0,object:()=>d1,optional:()=>ku,overwrite:()=>hn,parse:()=>y0,parseAsync:()=>v0,partialRecord:()=>g1,pipe:()=>Im,positive:()=>gp,prefault:()=>oS,preprocess:()=>z1,prettifyError:()=>G_,promise:()=>C1,property:()=>bp,readonly:()=>mS,record:()=>J0,refine:()=>bS,regex:()=>Ns,regexes:()=>Dr,registry:()=>Kf,safeDecode:()=>I0,safeDecodeAsync:()=>C0,safeEncode:()=>$0,safeEncodeAsync:()=>T0,safeParse:()=>b0,safeParseAsync:()=>w0,set:()=>v1,setErrorMap:()=>XB,size:()=>wo,slugify:()=>Zs,startsWith:()=>Ds,strictObject:()=>f1,string:()=>xu,stringFormat:()=>JN,stringbool:()=>j1,success:()=>k1,superRefine:()=>wS,symbol:()=>a1,templateLiteral:()=>T1,toJSONSchema:()=>ko,toLowerCase:()=>Bs,toUpperCase:()=>Vs,transform:()=>Km,treeifyError:()=>H_,trim:()=>Fs,tuple:()=>W0,uint32:()=>t1,uint64:()=>i1,ulid:()=>jN,undefined:()=>o1,union:()=>Wm,unknown:()=>Go,uppercase:()=>Ms,url:()=>AN,util:()=>j,uuid:()=>$N,uuidv4:()=>IN,uuidv6:()=>TN,uuidv7:()=>CN,void:()=>c1,xid:()=>DN,xor:()=>m1});var wu={};On(wu,{ZodAny:()=>D0,ZodArray:()=>F0,ZodBase64:()=>Fm,ZodBase64URL:()=>Bm,ZodBigInt:()=>Sc,ZodBigIntFormat:()=>Hm,ZodBoolean:()=>xc,ZodCIDRv4:()=>Um,ZodCIDRv6:()=>Lm,ZodCUID:()=>Pm,ZodCUID2:()=>Nm,ZodCatch:()=>lS,ZodCodec:()=>Nu,ZodCustom:()=>Ru,ZodCustomStringFormat:()=>bc,ZodDate:()=>Tu,ZodDefault:()=>nS,ZodDiscriminatedUnion:()=>V0,ZodE164:()=>Vm,ZodEmail:()=>Cm,ZodEmoji:()=>Am,ZodEnum:()=>yc,ZodExactOptional:()=>eS,ZodFile:()=>X0,ZodFunction:()=>vS,ZodGUID:()=>Su,ZodIPv4:()=>Dm,ZodIPv6:()=>zm,ZodIntersection:()=>Z0,ZodJWT:()=>Zm,ZodKSUID:()=>jm,ZodLazy:()=>gS,ZodLiteral:()=>Y0,ZodMAC:()=>A0,ZodMap:()=>K0,ZodNaN:()=>dS,ZodNanoID:()=>Om,ZodNever:()=>U0,ZodNonOptional:()=>Ym,ZodNull:()=>M0,ZodNullable:()=>rS,ZodNumber:()=>wc,ZodNumberFormat:()=>Wo,ZodObject:()=>Au,ZodOptional:()=>qm,ZodPipe:()=>Pu,ZodPrefault:()=>aS,ZodPreprocess:()=>fS,ZodPromise:()=>yS,ZodReadonly:()=>pS,ZodRecord:()=>_c,ZodSet:()=>q0,ZodString:()=>vc,ZodStringFormat:()=>Be,ZodSuccess:()=>cS,ZodSymbol:()=>N0,ZodTemplateLiteral:()=>hS,ZodTransform:()=>Q0,ZodTuple:()=>G0,ZodType:()=>_e,ZodULID:()=>Rm,ZodURL:()=>Iu,ZodUUID:()=>ri,ZodUndefined:()=>R0,ZodUnion:()=>Ou,ZodUnknown:()=>z0,ZodVoid:()=>L0,ZodXID:()=>Mm,ZodXor:()=>B0,_ZodString:()=>Tm,_default:()=>iS,_function:()=>A1,any:()=>s1,array:()=>Cu,base64:()=>ZN,base64url:()=>HN,bigint:()=>r1,boolean:()=>P0,catch:()=>uS,check:()=>O1,cidrv4:()=>BN,cidrv6:()=>VN,codec:()=>$1,cuid:()=>RN,cuid2:()=>MN,custom:()=>P1,date:()=>l1,describe:()=>N1,discriminatedUnion:()=>h1,e164:()=>GN,email:()=>kN,emoji:()=>PN,enum:()=>Jm,exactOptional:()=>tS,file:()=>x1,float32:()=>XN,float64:()=>QN,function:()=>A1,guid:()=>EN,hash:()=>YN,hex:()=>qN,hostname:()=>KN,httpUrl:()=>ON,instanceof:()=>M1,int:()=>$m,int32:()=>e1,int64:()=>n1,intersection:()=>H0,invertCodec:()=>I1,ipv4:()=>UN,ipv6:()=>FN,json:()=>D1,jwt:()=>WN,keyof:()=>u1,ksuid:()=>zN,lazy:()=>_S,literal:()=>w1,looseObject:()=>p1,looseRecord:()=>_1,mac:()=>LN,map:()=>y1,meta:()=>R1,nan:()=>E1,nanoid:()=>NN,nativeEnum:()=>b1,never:()=>Gm,nonoptional:()=>sS,null:()=>j0,nullable:()=>Eu,nullish:()=>S1,number:()=>O0,object:()=>d1,optional:()=>ku,partialRecord:()=>g1,pipe:()=>Im,prefault:()=>oS,preprocess:()=>z1,promise:()=>C1,readonly:()=>mS,record:()=>J0,refine:()=>bS,set:()=>v1,strictObject:()=>f1,string:()=>xu,stringFormat:()=>JN,stringbool:()=>j1,success:()=>k1,superRefine:()=>wS,symbol:()=>a1,templateLiteral:()=>T1,transform:()=>Km,tuple:()=>W0,uint32:()=>t1,uint64:()=>i1,ulid:()=>jN,undefined:()=>o1,union:()=>Wm,unknown:()=>Go,url:()=>AN,uuid:()=>$N,uuidv4:()=>IN,uuidv6:()=>TN,uuidv7:()=>CN,void:()=>c1,xid:()=>DN,xor:()=>m1});var wm={};On(wm,{endsWith:()=>zs,gt:()=>Hn,gte:()=>dr,includes:()=>js,length:()=>So,lowercase:()=>Rs,lt:()=>Zn,lte:()=>zr,maxLength:()=>xo,maxSize:()=>ba,mime:()=>Us,minLength:()=>Si,minSize:()=>Gn,multipleOf:()=>va,negative:()=>_p,nonnegative:()=>vp,nonpositive:()=>yp,normalize:()=>Ls,overwrite:()=>hn,positive:()=>gp,property:()=>bp,regex:()=>Ns,size:()=>wo,slugify:()=>Zs,startsWith:()=>Ds,toLowerCase:()=>Bs,toUpperCase:()=>Vs,trim:()=>Fs,uppercase:()=>Ms});var gc={};On(gc,{ZodISODate:()=>Sm,ZodISODateTime:()=>xm,ZodISODuration:()=>Em,ZodISOTime:()=>km,date:()=>h0,datetime:()=>m0,duration:()=>_0,time:()=>g0});var xm=k("ZodISODateTime",(e,t)=>{tv.init(e,t),Be.init(e,t)});function m0(e){return nb(xm,e)}var Sm=k("ZodISODate",(e,t)=>{rv.init(e,t),Be.init(e,t)});function h0(e){return ib(Sm,e)}var km=k("ZodISOTime",(e,t)=>{nv.init(e,t),Be.init(e,t)});function g0(e){return ab(km,e)}var Em=k("ZodISODuration",(e,t)=>{iv.init(e,t),Be.init(e,t)});function _0(e){return ob(Em,e)}var xN=(e,t)=>{bl.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>xl(e,r)},flatten:{value:r=>wl(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,ks,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,ks,2)}},isEmpty:{get(){return e.issues.length===0}}})},KB=k("ZodError",xN),$r=k("ZodError",xN,{Parent:Error});var y0=Is($r),v0=Ts($r),b0=Cs($r),w0=As($r),x0=Ef($r),S0=$f($r),k0=If($r),E0=Tf($r),$0=Cf($r),I0=Af($r),T0=Of($r),C0=Pf($r);var SN=new WeakMap;function $u(e,t,r){let n=Object.getPrototypeOf(e),i=SN.get(n);if(i||(i=new Set,SN.set(n,i)),!i.has(t)){i.add(t);for(let a in r){let o=r[a];Object.defineProperty(n,a,{configurable:!0,enumerable:!1,get(){let s=o.bind(this);return Object.defineProperty(this,a,{configurable:!0,writable:!0,enumerable:!0,value:s}),s},set(s){Object.defineProperty(this,a,{configurable:!0,writable:!0,enumerable:!0,value:s})}})}}}var _e=k("ZodType",(e,t)=>(pe.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Gs(e,"input"),output:Gs(e,"output")}}),e.toJSONSchema=jb(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,n)=>y0(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>b0(e,r,n),e.parseAsync=async(r,n)=>v0(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>w0(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>x0(e,r,n),e.decode=(r,n)=>S0(e,r,n),e.encodeAsync=async(r,n)=>k0(e,r,n),e.decodeAsync=async(r,n)=>E0(e,r,n),e.safeEncode=(r,n)=>$0(e,r,n),e.safeDecode=(r,n)=>I0(e,r,n),e.safeEncodeAsync=async(r,n)=>T0(e,r,n),e.safeDecodeAsync=async(r,n)=>C0(e,r,n),$u(e,"ZodType",{check(...r){let n=this.def;return this.clone(j.mergeDefs(n,{checks:[...n.checks??[],...r.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,n){return Xe(this,r,n)},brand(){return this},register(r,n){return r.add(this,n),this},refine(r,n){return this.check(bS(r,n))},superRefine(r,n){return this.check(wS(r,n))},overwrite(r){return this.check(hn(r))},optional(){return ku(this)},exactOptional(){return tS(this)},nullable(){return Eu(this)},nullish(){return ku(Eu(this))},nonoptional(r){return sS(this,r)},array(){return Cu(this)},or(r){return Wm([this,r])},and(r){return H0(this,r)},transform(r){return Im(this,Km(r))},default(r){return iS(this,r)},prefault(r){return oS(this,r)},catch(r){return uS(this,r)},pipe(r){return Im(this,r)},readonly(){return mS(this)},describe(r){let n=this.clone();return De.add(n,{description:r}),n},meta(...r){if(r.length===0)return De.get(this);let n=this.clone();return De.add(n,r[0]),n},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return De.get(e)?.description},configurable:!0}),e)),Tm=k("_ZodString",(e,t)=>{vo.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,i,a)=>Db(e,n,i,a);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,$u(e,"_ZodString",{regex(...n){return this.check(Ns(...n))},includes(...n){return this.check(js(...n))},startsWith(...n){return this.check(Ds(...n))},endsWith(...n){return this.check(zs(...n))},min(...n){return this.check(Si(...n))},max(...n){return this.check(xo(...n))},length(...n){return this.check(So(...n))},nonempty(...n){return this.check(Si(1,...n))},lowercase(n){return this.check(Rs(n))},uppercase(n){return this.check(Ms(n))},trim(){return this.check(Fs())},normalize(...n){return this.check(Ls(...n))},toLowerCase(){return this.check(Bs())},toUpperCase(){return this.check(Vs())},slugify(){return this.check(Zs())}})}),vc=k("ZodString",(e,t)=>{vo.init(e,t),Tm.init(e,t),e.email=r=>e.check(qf(Cm,r)),e.url=r=>e.check(Rl(Iu,r)),e.jwt=r=>e.check(hp(Zm,r)),e.emoji=r=>e.check(tp(Am,r)),e.guid=r=>e.check(Nl(Su,r)),e.uuid=r=>e.check(Yf(ri,r)),e.uuidv4=r=>e.check(Xf(ri,r)),e.uuidv6=r=>e.check(Qf(ri,r)),e.uuidv7=r=>e.check(ep(ri,r)),e.nanoid=r=>e.check(rp(Om,r)),e.guid=r=>e.check(Nl(Su,r)),e.cuid=r=>e.check(np(Pm,r)),e.cuid2=r=>e.check(ip(Nm,r)),e.ulid=r=>e.check(ap(Rm,r)),e.base64=r=>e.check(fp(Fm,r)),e.base64url=r=>e.check(pp(Bm,r)),e.xid=r=>e.check(op(Mm,r)),e.ksuid=r=>e.check(sp(jm,r)),e.ipv4=r=>e.check(cp(Dm,r)),e.ipv6=r=>e.check(lp(zm,r)),e.cidrv4=r=>e.check(up(Um,r)),e.cidrv6=r=>e.check(dp(Lm,r)),e.e164=r=>e.check(mp(Vm,r)),e.datetime=r=>e.check(m0(r)),e.date=r=>e.check(h0(r)),e.time=r=>e.check(g0(r)),e.duration=r=>e.check(_0(r))});function xu(e){return Qv(vc,e)}var Be=k("ZodStringFormat",(e,t)=>{Fe.init(e,t),Tm.init(e,t)}),Cm=k("ZodEmail",(e,t)=>{Gy.init(e,t),Be.init(e,t)});function kN(e){return qf(Cm,e)}var Su=k("ZodGUID",(e,t)=>{Zy.init(e,t),Be.init(e,t)});function EN(e){return Nl(Su,e)}var ri=k("ZodUUID",(e,t)=>{Hy.init(e,t),Be.init(e,t)});function $N(e){return Yf(ri,e)}function IN(e){return Xf(ri,e)}function TN(e){return Qf(ri,e)}function CN(e){return ep(ri,e)}var Iu=k("ZodURL",(e,t)=>{Wy.init(e,t),Be.init(e,t)});function AN(e){return Rl(Iu,e)}function ON(e){return Rl(Iu,{protocol:Dr.httpProtocol,hostname:Dr.domain,...j.normalizeParams(e)})}var Am=k("ZodEmoji",(e,t)=>{Jy.init(e,t),Be.init(e,t)});function PN(e){return tp(Am,e)}var Om=k("ZodNanoID",(e,t)=>{Ky.init(e,t),Be.init(e,t)});function NN(e){return rp(Om,e)}var Pm=k("ZodCUID",(e,t)=>{qy.init(e,t),Be.init(e,t)});function RN(e){return np(Pm,e)}var Nm=k("ZodCUID2",(e,t)=>{Yy.init(e,t),Be.init(e,t)});function MN(e){return ip(Nm,e)}var Rm=k("ZodULID",(e,t)=>{Xy.init(e,t),Be.init(e,t)});function jN(e){return ap(Rm,e)}var Mm=k("ZodXID",(e,t)=>{Qy.init(e,t),Be.init(e,t)});function DN(e){return op(Mm,e)}var jm=k("ZodKSUID",(e,t)=>{ev.init(e,t),Be.init(e,t)});function zN(e){return sp(jm,e)}var Dm=k("ZodIPv4",(e,t)=>{av.init(e,t),Be.init(e,t)});function UN(e){return cp(Dm,e)}var A0=k("ZodMAC",(e,t)=>{sv.init(e,t),Be.init(e,t)});function LN(e){return tb(A0,e)}var zm=k("ZodIPv6",(e,t)=>{ov.init(e,t),Be.init(e,t)});function FN(e){return lp(zm,e)}var Um=k("ZodCIDRv4",(e,t)=>{cv.init(e,t),Be.init(e,t)});function BN(e){return up(Um,e)}var Lm=k("ZodCIDRv6",(e,t)=>{lv.init(e,t),Be.init(e,t)});function VN(e){return dp(Lm,e)}var Fm=k("ZodBase64",(e,t)=>{dv.init(e,t),Be.init(e,t)});function ZN(e){return fp(Fm,e)}var Bm=k("ZodBase64URL",(e,t)=>{fv.init(e,t),Be.init(e,t)});function HN(e){return pp(Bm,e)}var Vm=k("ZodE164",(e,t)=>{pv.init(e,t),Be.init(e,t)});function GN(e){return mp(Vm,e)}var Zm=k("ZodJWT",(e,t)=>{mv.init(e,t),Be.init(e,t)});function WN(e){return hp(Zm,e)}var bc=k("ZodCustomStringFormat",(e,t)=>{hv.init(e,t),Be.init(e,t)});function JN(e,t,r={}){return Hs(bc,e,t,r)}function KN(e){return Hs(bc,"hostname",Dr.hostname,e)}function qN(e){return Hs(bc,"hex",Dr.hex,e)}function YN(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,i=Dr[n];if(!i)throw new Error(`Unrecognized hash format: ${n}`);return Hs(bc,n,i,t)}var wc=k("ZodNumber",(e,t)=>{Ff.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,i,a)=>zb(e,n,i,a),$u(e,"ZodNumber",{gt(n,i){return this.check(Hn(n,i))},gte(n,i){return this.check(dr(n,i))},min(n,i){return this.check(dr(n,i))},lt(n,i){return this.check(Zn(n,i))},lte(n,i){return this.check(zr(n,i))},max(n,i){return this.check(zr(n,i))},int(n){return this.check($m(n))},safe(n){return this.check($m(n))},positive(n){return this.check(Hn(0,n))},nonnegative(n){return this.check(dr(0,n))},negative(n){return this.check(Zn(0,n))},nonpositive(n){return this.check(zr(0,n))},multipleOf(n,i){return this.check(va(n,i))},step(n,i){return this.check(va(n,i))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function O0(e){return sb(wc,e)}var Wo=k("ZodNumberFormat",(e,t)=>{gv.init(e,t),wc.init(e,t)});function $m(e){return lb(Wo,e)}function XN(e){return ub(Wo,e)}function QN(e){return db(Wo,e)}function e1(e){return fb(Wo,e)}function t1(e){return pb(Wo,e)}var xc=k("ZodBoolean",(e,t)=>{$l.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Ub(e,r,n,i)});function P0(e){return mb(xc,e)}var Sc=k("ZodBigInt",(e,t)=>{Bf.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,i,a)=>Lb(e,n,i,a),e.gte=(n,i)=>e.check(dr(n,i)),e.min=(n,i)=>e.check(dr(n,i)),e.gt=(n,i)=>e.check(Hn(n,i)),e.gte=(n,i)=>e.check(dr(n,i)),e.min=(n,i)=>e.check(dr(n,i)),e.lt=(n,i)=>e.check(Zn(n,i)),e.lte=(n,i)=>e.check(zr(n,i)),e.max=(n,i)=>e.check(zr(n,i)),e.positive=n=>e.check(Hn(BigInt(0),n)),e.negative=n=>e.check(Zn(BigInt(0),n)),e.nonpositive=n=>e.check(zr(BigInt(0),n)),e.nonnegative=n=>e.check(dr(BigInt(0),n)),e.multipleOf=(n,i)=>e.check(va(n,i));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function r1(e){return gb(Sc,e)}var Hm=k("ZodBigIntFormat",(e,t)=>{_v.init(e,t),Sc.init(e,t)});function n1(e){return yb(Hm,e)}function i1(e){return vb(Hm,e)}var N0=k("ZodSymbol",(e,t)=>{yv.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Fb(e,r,n,i)});function a1(e){return bb(N0,e)}var R0=k("ZodUndefined",(e,t)=>{vv.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Vb(e,r,n,i)});function o1(e){return wb(R0,e)}var M0=k("ZodNull",(e,t)=>{bv.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Bb(e,r,n,i)});function j0(e){return xb(M0,e)}var D0=k("ZodAny",(e,t)=>{wv.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Gb(e,r,n,i)});function s1(){return Sb(D0)}var z0=k("ZodUnknown",(e,t)=>{Il.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Wb(e,r,n,i)});function Go(){return Ml(z0)}var U0=k("ZodNever",(e,t)=>{Tl.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Hb(e,r,n,i)});function Gm(e){return jl(U0,e)}var L0=k("ZodVoid",(e,t)=>{xv.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Zb(e,r,n,i)});function c1(e){return kb(L0,e)}var Tu=k("ZodDate",(e,t)=>{Sv.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,i,a)=>Jb(e,n,i,a),e.min=(n,i)=>e.check(dr(n,i)),e.max=(n,i)=>e.check(zr(n,i));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function l1(e){return Eb(Tu,e)}var F0=k("ZodArray",(e,t)=>{kv.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>ow(e,r,n,i),e.element=t.element,$u(e,"ZodArray",{min(r,n){return this.check(Si(r,n))},nonempty(r){return this.check(Si(1,r))},max(r,n){return this.check(xo(r,n))},length(r,n){return this.check(So(r,n))},unwrap(){return this.element}})});function Cu(e,t){return Tb(F0,e,t)}function u1(e){let t=e._zod.def.shape;return Jm(Object.keys(t))}var Au=k("ZodObject",(e,t)=>{Ev.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>sw(e,r,n,i),j.defineLazy(e,"shape",()=>t.shape),$u(e,"ZodObject",{keyof(){return Jm(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:Go()})},loose(){return this.clone({...this._zod.def,catchall:Go()})},strict(){return this.clone({...this._zod.def,catchall:Gm()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return j.extend(this,r)},safeExtend(r){return j.safeExtend(this,r)},merge(r){return j.merge(this,r)},pick(r){return j.pick(this,r)},omit(r){return j.omit(this,r)},partial(...r){return j.partial(qm,this,r[0])},required(...r){return j.required(Ym,this,r[0])}})});function d1(e,t){let r={type:"object",shape:e??{},...j.normalizeParams(t)};return new Au(r)}function f1(e,t){return new Au({type:"object",shape:e,catchall:Gm(),...j.normalizeParams(t)})}function p1(e,t){return new Au({type:"object",shape:e,catchall:Go(),...j.normalizeParams(t)})}var Ou=k("ZodUnion",(e,t)=>{Cl.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>xp(e,r,n,i),e.options=t.options});function Wm(e,t){return new Ou({type:"union",options:e,...j.normalizeParams(t)})}var B0=k("ZodXor",(e,t)=>{Ou.init(e,t),$v.init(e,t),e._zod.processJSONSchema=(r,n,i)=>xp(e,r,n,i),e.options=t.options});function m1(e,t){return new B0({type:"union",options:e,inclusive:!1,...j.normalizeParams(t)})}var V0=k("ZodDiscriminatedUnion",(e,t)=>{Ou.init(e,t),Iv.init(e,t)});function h1(e,t,r){return new V0({type:"union",options:t,discriminator:e,...j.normalizeParams(r)})}var Z0=k("ZodIntersection",(e,t)=>{Tv.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>cw(e,r,n,i)});function H0(e,t){return new Z0({type:"intersection",left:e,right:t})}var G0=k("ZodTuple",(e,t)=>{Vf.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>lw(e,r,n,i),e.rest=r=>e.clone({...e._zod.def,rest:r})});function W0(e,t,r){let n=t instanceof pe,i=n?r:t,a=n?t:null;return new G0({type:"tuple",items:e,rest:a,...j.normalizeParams(i)})}var _c=k("ZodRecord",(e,t)=>{Cv.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>uw(e,r,n,i),e.keyType=t.keyType,e.valueType=t.valueType});function J0(e,t,r){return!t||!t._zod?new _c({type:"record",keyType:xu(),valueType:e,...j.normalizeParams(t)}):new _c({type:"record",keyType:e,valueType:t,...j.normalizeParams(r)})}function g1(e,t,r){let n=Xe(e);return n._zod.values=void 0,new _c({type:"record",keyType:n,valueType:t,...j.normalizeParams(r)})}function _1(e,t,r){return new _c({type:"record",keyType:e,valueType:t,mode:"loose",...j.normalizeParams(r)})}var K0=k("ZodMap",(e,t)=>{Av.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>iw(e,r,n,i),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(Gn(...r)),e.nonempty=r=>e.check(Gn(1,r)),e.max=(...r)=>e.check(ba(...r)),e.size=(...r)=>e.check(wo(...r))});function y1(e,t,r){return new K0({type:"map",keyType:e,valueType:t,...j.normalizeParams(r)})}var q0=k("ZodSet",(e,t)=>{Ov.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>aw(e,r,n,i),e.min=(...r)=>e.check(Gn(...r)),e.nonempty=r=>e.check(Gn(1,r)),e.max=(...r)=>e.check(ba(...r)),e.size=(...r)=>e.check(wo(...r))});function v1(e,t){return new q0({type:"set",valueType:e,...j.normalizeParams(t)})}var yc=k("ZodEnum",(e,t)=>{Pv.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,i,a)=>Kb(e,n,i,a),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,i)=>{let a={};for(let o of n)if(r.has(o))a[o]=t.entries[o];else throw new Error(`Key ${o} not found in enum`);return new yc({...t,checks:[],...j.normalizeParams(i),entries:a})},e.exclude=(n,i)=>{let a={...t.entries};for(let o of n)if(r.has(o))delete a[o];else throw new Error(`Key ${o} not found in enum`);return new yc({...t,checks:[],...j.normalizeParams(i),entries:a})}});function Jm(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new yc({type:"enum",entries:r,...j.normalizeParams(t)})}function b1(e,t){return new yc({type:"enum",entries:e,...j.normalizeParams(t)})}var Y0=k("ZodLiteral",(e,t)=>{Nv.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>qb(e,r,n,i),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function w1(e,t){return new Y0({type:"literal",values:Array.isArray(e)?e:[e],...j.normalizeParams(t)})}var X0=k("ZodFile",(e,t)=>{Rv.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Qb(e,r,n,i),e.min=(r,n)=>e.check(Gn(r,n)),e.max=(r,n)=>e.check(ba(r,n)),e.mime=(r,n)=>e.check(Us(Array.isArray(r)?r:[r],n))});function x1(e){return Cb(X0,e)}var Q0=k("ZodTransform",(e,t)=>{Mv.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>nw(e,r,n,i),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new pa(e.constructor.name);r.addIssue=a=>{if(typeof a=="string")r.issues.push(j.issue(a,r.value,t));else{let o=a;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=e),r.issues.push(j.issue(o))}};let i=t.transform(r.value,r);return i instanceof Promise?i.then(a=>(r.value=a,r.fallback=!0,r)):(r.value=i,r.fallback=!0,r)}});function Km(e){return new Q0({type:"transform",transform:e})}var qm=k("ZodOptional",(e,t)=>{bo.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Sp(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function ku(e){return new qm({type:"optional",innerType:e})}var eS=k("ZodExactOptional",(e,t)=>{jv.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Sp(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function tS(e){return new eS({type:"optional",innerType:e})}var rS=k("ZodNullable",(e,t)=>{Dv.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>dw(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function Eu(e){return new rS({type:"nullable",innerType:e})}function S1(e){return ku(Eu(e))}var nS=k("ZodDefault",(e,t)=>{zv.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>pw(e,r,n,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function iS(e,t){return new nS({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():j.shallowClone(t)}})}var aS=k("ZodPrefault",(e,t)=>{Uv.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>mw(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function oS(e,t){return new aS({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():j.shallowClone(t)}})}var Ym=k("ZodNonOptional",(e,t)=>{Lv.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>fw(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function sS(e,t){return new Ym({type:"nonoptional",innerType:e,...j.normalizeParams(t)})}var cS=k("ZodSuccess",(e,t)=>{Fv.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>ew(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function k1(e){return new cS({type:"success",innerType:e})}var lS=k("ZodCatch",(e,t)=>{Bv.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>hw(e,r,n,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function uS(e,t){return new lS({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var dS=k("ZodNaN",(e,t)=>{Vv.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Yb(e,r,n,i)});function E1(e){return Ib(dS,e)}var Pu=k("ZodPipe",(e,t)=>{Zf.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>gw(e,r,n,i),e.in=t.in,e.out=t.out});function Im(e,t){return new Pu({type:"pipe",in:e,out:t})}var Nu=k("ZodCodec",(e,t)=>{Pu.init(e,t),Al.init(e,t)});function $1(e,t,r){return new Nu({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function I1(e){let t=e._zod.def;return new Nu({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var fS=k("ZodPreprocess",(e,t)=>{Pu.init(e,t),Zv.init(e,t)}),pS=k("ZodReadonly",(e,t)=>{Hv.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>_w(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function mS(e){return new pS({type:"readonly",innerType:e})}var hS=k("ZodTemplateLiteral",(e,t)=>{Gv.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Xb(e,r,n,i)});function T1(e,t){return new hS({type:"template_literal",parts:e,...j.normalizeParams(t)})}var gS=k("ZodLazy",(e,t)=>{Kv.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>vw(e,r,n,i),e.unwrap=()=>e._zod.def.getter()});function _S(e){return new gS({type:"lazy",getter:e})}var yS=k("ZodPromise",(e,t)=>{Jv.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>yw(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function C1(e){return new yS({type:"promise",innerType:e})}var vS=k("ZodFunction",(e,t)=>{Wv.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>rw(e,r,n,i)});function A1(e){return new vS({type:"function",input:Array.isArray(e?.input)?W0(e?.input):e?.input??Cu(Go()),output:e?.output??Go()})}var Ru=k("ZodCustom",(e,t)=>{qv.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,n,i)=>tw(e,r,n,i)});function O1(e){let t=new Ze({check:"custom"});return t._zod.check=e,t}function P1(e,t){return Ab(Ru,e??(()=>!0),t)}function bS(e,t={}){return Ob(Ru,e,t)}function wS(e,t){return Pb(e,t)}var N1=Nb,R1=Rb;function M1(e,t={}){let r=new Ru({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...j.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}var j1=(...e)=>Mb({Codec:Nu,Boolean:xc,String:vc},...e);function D1(e){let t=_S(()=>Wm([xu(e),O0(),P0(),j0(),Cu(t),J0(xu(),t)]));return t}function z1(e,t){return new fS({type:"pipe",in:Km(e),out:t})}var YB={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function XB(e){ct({customError:e})}function QB(){return ct().customError}var xS;xS||(xS={});var G={...wu,...wm,iso:gc},eV=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function tV(e,t){let r=e.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function rV(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(r.length===0)return t.rootSchema;let n=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===n){let i=r[1];if(!i||!t.defs[i])throw new Error(`Reference not found: ${e}`);return t.defs[i]}throw new Error(`Reference not found: ${e}`)}function U1(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return G.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let i=e.$ref;if(t.refs.has(i))return t.refs.get(i);if(t.processing.has(i))return G.lazy(()=>{if(!t.refs.has(i))throw new Error(`Circular reference not resolved: ${i}`);return t.refs.get(i)});t.processing.add(i);let a=rV(i,t),o=er(a,t);return t.refs.set(i,o),t.processing.delete(i),o}if(e.enum!==void 0){let i=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&i.length===1&&i[0]===null)return G.null();if(i.length===0)return G.never();if(i.length===1)return G.literal(i[0]);if(i.every(o=>typeof o=="string"))return G.enum(i);let a=i.map(o=>G.literal(o));return a.length<2?a[0]:G.union([a[0],a[1],...a.slice(2)])}if(e.const!==void 0)return G.literal(e.const);let r=e.type;if(Array.isArray(r)){let i=r.map(a=>{let o={...e,type:a};return U1(o,t)});return i.length===0?G.never():i.length===1?i[0]:G.union(i)}if(!r)return G.any();let n;switch(r){case"string":{let i=G.string();if(e.format){let a=e.format;a==="email"?i=i.check(G.email()):a==="uri"||a==="uri-reference"?i=i.check(G.url()):a==="uuid"||a==="guid"?i=i.check(G.uuid()):a==="date-time"?i=i.check(G.iso.datetime()):a==="date"?i=i.check(G.iso.date()):a==="time"?i=i.check(G.iso.time()):a==="duration"?i=i.check(G.iso.duration()):a==="ipv4"?i=i.check(G.ipv4()):a==="ipv6"?i=i.check(G.ipv6()):a==="mac"?i=i.check(G.mac()):a==="cidr"?i=i.check(G.cidrv4()):a==="cidr-v6"?i=i.check(G.cidrv6()):a==="base64"?i=i.check(G.base64()):a==="base64url"?i=i.check(G.base64url()):a==="e164"?i=i.check(G.e164()):a==="jwt"?i=i.check(G.jwt()):a==="emoji"?i=i.check(G.emoji()):a==="nanoid"?i=i.check(G.nanoid()):a==="cuid"?i=i.check(G.cuid()):a==="cuid2"?i=i.check(G.cuid2()):a==="ulid"?i=i.check(G.ulid()):a==="xid"?i=i.check(G.xid()):a==="ksuid"&&(i=i.check(G.ksuid()))}typeof e.minLength=="number"&&(i=i.min(e.minLength)),typeof e.maxLength=="number"&&(i=i.max(e.maxLength)),e.pattern&&(i=i.regex(new RegExp(e.pattern))),n=i;break}case"number":case"integer":{let i=r==="integer"?G.number().int():G.number();typeof e.minimum=="number"&&(i=i.min(e.minimum)),typeof e.maximum=="number"&&(i=i.max(e.maximum)),typeof e.exclusiveMinimum=="number"?i=i.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(i=i.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?i=i.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(i=i.lt(e.maximum)),typeof e.multipleOf=="number"&&(i=i.multipleOf(e.multipleOf)),n=i;break}case"boolean":{n=G.boolean();break}case"null":{n=G.null();break}case"object":{let i={},a=e.properties||{},o=new Set(e.required||[]);for(let[c,l]of Object.entries(a)){let u=er(l,t);i[c]=o.has(c)?u:u.optional()}if(e.propertyNames){let c=er(e.propertyNames,t),l=e.additionalProperties&&typeof e.additionalProperties=="object"?er(e.additionalProperties,t):G.any();if(Object.keys(i).length===0){n=G.record(c,l);break}let u=G.object(i).passthrough(),d=G.looseRecord(c,l);n=G.intersection(u,d);break}if(e.patternProperties){let c=e.patternProperties,l=Object.keys(c),u=[];for(let f of l){let p=er(c[f],t),m=G.string().regex(new RegExp(f));u.push(G.looseRecord(m,p))}let d=[];if(Object.keys(i).length>0&&d.push(G.object(i).passthrough()),d.push(...u),d.length===0)n=G.object({}).passthrough();else if(d.length===1)n=d[0];else{let f=G.intersection(d[0],d[1]);for(let p=2;p<d.length;p++)f=G.intersection(f,d[p]);n=f}break}let s=G.object(i);e.additionalProperties===!1?n=s.strict():typeof e.additionalProperties=="object"?n=s.catchall(er(e.additionalProperties,t)):n=s.passthrough();break}case"array":{let i=e.prefixItems,a=e.items;if(i&&Array.isArray(i)){let o=i.map(c=>er(c,t)),s=a&&typeof a=="object"&&!Array.isArray(a)?er(a,t):void 0;s?n=G.tuple(o).rest(s):n=G.tuple(o),typeof e.minItems=="number"&&(n=n.check(G.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(G.maxLength(e.maxItems)))}else if(Array.isArray(a)){let o=a.map(c=>er(c,t)),s=e.additionalItems&&typeof e.additionalItems=="object"?er(e.additionalItems,t):void 0;s?n=G.tuple(o).rest(s):n=G.tuple(o),typeof e.minItems=="number"&&(n=n.check(G.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(G.maxLength(e.maxItems)))}else if(a!==void 0){let o=er(a,t),s=G.array(o);typeof e.minItems=="number"&&(s=s.min(e.minItems)),typeof e.maxItems=="number"&&(s=s.max(e.maxItems)),n=s}else n=G.array(G.any());break}default:throw new Error(`Unsupported type: ${r}`)}return n}function er(e,t){if(typeof e=="boolean")return e?G.any():G.never();let r=U1(e,t),n=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let s=e.anyOf.map(l=>er(l,t)),c=G.union(s);r=n?G.intersection(r,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){let s=e.oneOf.map(l=>er(l,t)),c=G.xor(s);r=n?G.intersection(r,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=n?r:G.any();else{let s=n?r:er(e.allOf[0],t),c=n?0:1;for(let l=c;l<e.allOf.length;l++)s=G.intersection(s,er(e.allOf[l],t));r=s}e.nullable===!0&&t.version==="openapi-3.0"&&(r=G.nullable(r)),e.readOnly===!0&&(r=G.readonly(r)),e.default!==void 0&&(r=r.default(e.default));let i={},a=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let s of a)s in e&&(i[s]=e[s]);let o=["contentEncoding","contentMediaType","contentSchema"];for(let s of o)s in e&&(i[s]=e[s]);for(let s of Object.keys(e))eV.has(s)||(i[s]=e[s]);return Object.keys(i).length>0&&t.registry.add(r,i),e.description&&(r=r.describe(e.description)),r}function L1(e,t){if(typeof e=="boolean")return e?G.any():G.never();let r;try{r=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let n=tV(r,t?.defaultTarget),i=r.$defs||r.definitions||{},a={version:n,defs:i,refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??De};return er(r,a)}var SS={};On(SS,{bigint:()=>oV,boolean:()=>aV,date:()=>sV,number:()=>iV,string:()=>nV});function nV(e){return eb(vc,e)}function iV(e){return cb(wc,e)}function aV(e){return hb(xc,e)}function oV(e){return _b(Sc,e)}function sV(e){return $b(Tu,e)}ct(Hf());var F1=T({BaseToolkit:()=>cV,DynamicStructuredTool:()=>Z1,DynamicTool:()=>V1,StructuredTool:()=>Mu,Tool:()=>B1,ToolInputParsingException:()=>us,isLangChainTool:()=>bu,isRunnableToolLike:()=>yu,isStructuredTool:()=>_u,isStructuredToolParams:()=>vu,tool:()=>lV}),Mu=class extends Qp{extras;returnDirect=!1;verboseParsingErrors=!1;get lc_namespace(){return["langchain","tools"]}responseFormat="content";defaultConfig;constructor(e){super(e??{}),this.verboseParsingErrors=e?.verboseParsingErrors??this.verboseParsingErrors,this.responseFormat=e?.responseFormat??this.responseFormat,this.defaultConfig=e?.defaultConfig??this.defaultConfig,this.metadata=e?.metadata??this.metadata,this.extras=e?.extras??this.extras}async invoke(e,t){let r,n=ke($t(this.defaultConfig,t));return ra(e)?(r=e.args,n={...n,toolCall:e}):r=e,this.call(r,n)}async call(e,t,r){let n=ra(e)?e.args:e,i;if(xr(this.schema))try{i=await ka(this.schema,n)}catch(p){let m="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(m=`${m}
415
+ Details: ${p.message}`),Ap(p)&&(m=`${m}
416
+
417
+ ${nn.prettifyError(p)}`),new us(m,JSON.stringify(e))}else{let p=We(n,this.schema);if(!p.valid){let m="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(m=`${m}
418
+ Details: ${p.errors.map(h=>`${h.keywordLocation}: ${h.error}`).join(`
419
+ `)}`),new us(m,JSON.stringify(e))}i=n}let a=uo(t),o=Ye.configure(a.callbacks,this.callbacks,a.tags||r,this.tags,a.metadata,this.metadata,{verbose:this.verbose}),s;ra(e)&&(s=e.id),!s&&UE(a)&&(s=a.toolCall.id);let c=await o?.handleToolStart(this.toJSON(),typeof e=="string"?e:JSON.stringify(e),a.runId,void 0,void 0,void 0,a.runName,s);delete a.runId;let l;try{let p=await this._call(i,c,a);l=ux(p)?await fO(p,async m=>{try{await c?.handleToolEvent(m)}catch(h){await c?.handleToolError(h)}}):p}catch(p){throw await c?.handleToolError(p),p}let u,d;if(this.responseFormat==="content_and_artifact")if(Array.isArray(l)&&l.length===2)[u,d]=l;else throw new Error(`Tool response format is "content_and_artifact" but the output was not a two-tuple.
420
+ Result: ${JSON.stringify(l)}`);else u=l;let f=dV({content:u,artifact:d,toolCallId:s,name:this.name,metadata:this.metadata});return await c?.handleToolEnd(f),f}},B1=class extends Mu{schema=Rt.object({input:Rt.string().optional()}).transform(e=>e.input);constructor(e){super(e)}call(e,t){let r=typeof e=="string"||e==null?{input:e}:e;return super.call(r,t)}},V1=class extends B1{static lc_name(){return"DynamicTool"}name;description;func;constructor(e){super(e),this.name=e.name,this.description=e.description,this.func=e.func,this.returnDirect=e.returnDirect??this.returnDirect}async call(e,t){let r=uo(t);return r.runName===void 0&&(r.runName=this.name),super.call(e,r)}_call(e,t,r){return this.func(e,t,r)}},Z1=class extends Mu{static lc_name(){return"DynamicStructuredTool"}description;func;schema;constructor(e){super(e),this.name=e.name,this.description=e.description,this.func=e.func,this.returnDirect=e.returnDirect??this.returnDirect,this.schema=e.schema}async call(e,t,r){let n=uo(t);return n.runName===void 0&&(n.runName=this.name),super.call(e,n,r)}_call(e,t,r){return this.func(e,t,r)}},cV=class{getTools(){return this.tools}};function lV(e,t){let r=Js(t.schema),n=ic(t.schema);if(!t.schema||r||n)return new V1({...t,description:t.description??t.schema?.description??`${t.name} tool`,func:async(o,s,c)=>new Promise((l,u)=>{let d=$e(c,{callbacks:s?.getChild()});Re.runWithConfig(vr(d),async()=>{try{l(e(o,d))}catch(f){u(f)}})})});let i=t.schema,a=t.description??t.schema.description??`${t.name} tool`;return new Z1({...t,description:a,schema:i,func:async(o,s,c)=>new Promise((l,u)=>{let d,f=()=>{c?.signal&&d&&c.signal.removeEventListener("abort",d)};c?.signal&&(d=()=>{f(),u(la(c.signal))},c.signal.addEventListener("abort",d,{once:!0}));let p=$e(c,{callbacks:s?.getChild()});Re.runWithConfig(vr(p),async()=>{try{let m=await e(o,p);if(ux(m)){l(m);return}if(c?.signal?.aborted){f();return}f(),l(m)}catch(m){f(),u(m)}})})})}function uV(e){return typeof e=="object"&&e!==null&&"type"in e}function dV(e){let{content:t,artifact:r,toolCallId:n,metadata:i}=e;return n&&!Kc(t)?typeof t=="string"||Array.isArray(t)&&t.every(uV)?new kt({status:"success",content:t,artifact:r,tool_call_id:n,name:e.name,metadata:i}):new kt({status:"success",content:fV(t),artifact:r,tool_call_id:n,name:e.name,metadata:i}):t}function fV(e){try{return JSON.stringify(e)??""}catch{return`${e}`}}var H1=T({RunCollectorCallbackHandler:()=>pV}),pV=class extends zt{name="run_collector";exampleId;tracedRuns;constructor({exampleId:e}={}){super({_awaitHandler:!0}),this.exampleId=e,this.tracedRuns=[]}async persistRun(e){let t={...e};t.reference_example_id=this.exampleId,this.tracedRuns.push(t)}};var G1=T({});var W1=T({chunkArray:()=>mV}),mV=(e,t)=>e.reduce((r,n,i)=>{let a=Math.floor(i/t);return r[a]=(r[a]||[]).concat([n]),r},[]);var J1=T({context:()=>hV});function hV(e,...t){let r=e.raw,n="";for(let i=0;i<r.length;i++){let a=r[i].replace(/\\\n[ \t]*/g,"").replace(/\\`/g,"`").replace(/\\\$/g,"$").replace(/\\\{/g,"{");if(n+=a,i<t.length){let o=gV(t[i],n);n+=typeof o=="string"?o:JSON.stringify(o)}}return n=_V(n),n=n.trim(),n=n.replace(/\\n/g,`
421
+ `),n}function gV(e,t){if(typeof e!="string"||!e.includes(`
422
+ `))return e;let r=t.slice(t.lastIndexOf(`
423
+ `)+1).match(/^(\s+)/);if(r){let n=r[1];return e.replace(/\n/g,`
424
+ ${n}`)}return e}function _V(e){let t=e.split(`
425
+ `),r=null;for(let n of t){let i=n.match(/^(\s+)\S+/);if(i){let a=i[1].length;r===null?r=a:r=Math.min(r,a)}}return r===null?e:t.map(n=>n[0]===" "||n[0]===" "?n.slice(r):n).join(`
426
+ `)}var K1=T({EventStreamContentType:()=>yV,convertEventStreamToIterableReadableDataStream:()=>bV,getBytes:()=>q1,getLines:()=>Y1,getMessages:()=>X1}),yV="text/event-stream";async function q1(e,t){if(e instanceof ReadableStream){let r=e.getReader();for(;;){let n=await r.read();if(n.done){t(new Uint8Array,!0);break}t(n.value)}}else try{for await(let r of e)t(new Uint8Array(r));t(new Uint8Array,!0)}catch(r){throw new Error(["Parsing event source stream failed.","Ensure your implementation of fetch returns a web or Node readable stream.",`Error: ${r.message}`].join(`
427
+ `))}}function Y1(e){let t,r,n,i=!1;return function(o,s){if(s){e(o,0,!0);return}t===void 0?(t=o,r=0,n=-1):t=vV(t,o);let c=t.length,l=0;for(;r<c;){i&&(t[r]===10&&(l=++r),i=!1);let u=-1;for(;r<c&&u===-1;++r)switch(t[r]){case 58:n===-1&&(n=r-l);break;case 13:i=!0;case 10:u=r;break}if(u===-1)break;e(t.subarray(l,u),n),l=r,n=-1}l===c?t=void 0:l!==0&&(t=t.subarray(l),r-=l)}}function X1(e,t,r){let n=kS(),i=new TextDecoder;return function(o,s,c){if(c){wV(n)||(e?.(n),n=kS());return}if(o.length===0)e?.(n),n=kS();else if(s>0){let l=i.decode(o.subarray(0,s)),u=s+(o[s+1]===32?2:1),d=i.decode(o.subarray(u));switch(l){case"data":n.data=n.data?n.data+`
428
+ `+d:d;break;case"event":n.event=d;break;case"id":t?.(n.id=d);break;case"retry":{let f=parseInt(d,10);Number.isNaN(f)||r?.(n.retry=f);break}}}}}function vV(e,t){let r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function kS(){return{data:"",event:"",id:"",retry:void 0}}function bV(e,t){let r=new ReadableStream({async start(n){let i=X1(o=>{if(o.event==="error")throw new Error(o.data??"Unspecified event streaming error.");o.event==="metadata"?t?.(o):o.data&&n.enqueue(o.data)});await q1(e,Y1((o,s,c)=>{i(o,s,c),c&&n.close()}))}});return gt.fromReadableStream(r)}function wV(e){return e.data===""&&e.event===""&&e.id===""&&e.retry===void 0}var Q1=T({});var eR=T({convertToOpenAIFunction:()=>tR,convertToOpenAITool:()=>xV,isLangChainTool:()=>bu,isRunnableToolLike:()=>yu,isStructuredTool:()=>_u,isStructuredToolParams:()=>vu});function tR(e,t){let r=typeof t=="number"?void 0:t;return{name:e.name,description:e.description,parameters:It(e.schema),...r?.strict!==void 0?{strict:r.strict}:{}}}function xV(e,t){let r=typeof t=="number"?void 0:t,n;return bu(e)?n={type:"function",function:tR(e)}:n=e,r?.strict!==void 0&&(n.function.strict=r.strict),n}var rR=T({DEFAULT_LANGSMITH_GATEWAY:()=>nR,resolveLangSmithGatewayConfig:()=>CV}),SV="LANGSMITH_GATEWAY",kV="LANGSMITH_GATEWAY_API_KEY",EV="LANGSMITH_API_KEY",nR="https://gateway.smith.langchain.com",$V=["true","1","yes"],IV=["false","0","no"];function TV(e){let t=xt(SV);if(!(!t||IV.includes(t.toLowerCase())))return`${$V.includes(t.toLowerCase())?nR:t.replace(/\/+$/,"")}/${e}`}function CV({baseURL:e,providerPath:t}){if(e!==void 0)return{baseURL:e};let r=TV(t);return r===void 0?{}:{baseURL:r,apiKey:xt(kV)||xt(EV)}}function Xm(e,t){let r=0,n=0,i=0;for(let a=0;a<e.length;a++)r+=e[a]*t[a],n+=e[a]*e[a],i+=t[a]*t[a];return r/(Math.sqrt(n)*Math.sqrt(i))}function iR(e,t){let r=0;for(let n=0;n<e.length;n++)r+=e[n]*t[n];return r}function AV(e,t){let r=0;for(let n=0;n<e.length;n++)r+=(e[n]-t[n])*(e[n]-t[n]);return r}function aR(e,t){return Math.sqrt(AV(e,t))}var oR=T({cosineSimilarity:()=>ES,euclideanDistance:()=>NV,innerProduct:()=>PV,matrixFunc:()=>Qm,maximalMarginalRelevance:()=>RV,normalize:()=>OV});function Qm(e,t,r){if(e.length===0||e[0].length===0||t.length===0||t[0].length===0)return[[]];if(e[0].length!==t[0].length)throw new Error(`Number of columns in X and Y must be the same. X has shape ${[e.length,e[0].length]} and Y has shape ${[t.length,t[0].length]}.`);return e.map(n=>t.map(i=>r(n,i)).map(i=>Number.isNaN(i)?0:i))}function OV(e,t=!1){let r=MV(e);return e.map(n=>n.map(i=>t?1-i/r:i/r))}function ES(e,t){return Qm(e,t,Xm)}function PV(e,t){return Qm(e,t,iR)}function NV(e,t){return Qm(e,t,aR)}function RV(e,t,r=.5,n=4){if(Math.min(n,t.length)<=0)return[];let i=ES(Array.isArray(e[0])?e:[e],t)[0],a=sR(i).maxIndex,o=[t[a]],s=[a];for(;s.length<Math.min(n,t.length);){let c=-1/0,l=-1,u=ES(t,o);i.forEach((d,f)=>{if(s.includes(f))return;let p=Math.max(...u[f]),m=r*d-(1-r)*p;m>c&&(c=m,l=f)}),o.push(t[l]),s.push(l)}return s}function sR(e){if(e.length===0)return{maxIndex:-1,maxValue:NaN};let t=e[0],r=0;for(let n=1;n<e.length;n+=1)e[n]>t&&(r=n,t=e[n]);return{maxIndex:r,maxValue:t}}function MV(e){return e.reduce((t,r)=>Math.max(t,sR(r).maxValue),0)}var cR=T({isCloudMetadata:()=>$S,isLocalhost:()=>IS,isPrivateIp:()=>pR,isSafeUrl:()=>VV,isSameOrigin:()=>ZV,validateSafeUrl:()=>mR}),jV=["10.0.0.0/8","172.16.0.0/12","192.168.0.0/16","127.0.0.0/8","169.254.0.0/16","0.0.0.0/8","::1/128","fc00::/7","fe80::/10","ff00::/8"],DV=["169.254.169.254","169.254.170.2","100.100.100.200"],zV=["metadata.google.internal","metadata","instance-data"],UV=["localhost","localhost.localdomain"],LV=/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/;function lR(e){return LV.test(e)}function eh(e){return fR(e)!==null}function uR(e){return lR(e)||eh(e)}function dR(e){if(lR(e))return e.split(".").map(t=>parseInt(t,10));if(eh(e)){let t=fR(e);if(!t)return null;let r=t.split(":"),n=[];for(let i of r)n.push(parseInt(i,16));return n}return null}function fR(e){if(!e||typeof e!="string"||!e.includes(":")||!/^[0-9a-fA-F:]+$/.test(e))return null;let t=e;if(t.includes("::")){let n=t.split("::");if(n.length>2)return null;let[i,a]=n,o=i?i.split(":"):[],s=a?a.split(":"):[],c=8-(o.length+s.length);if(c<0)return null;let l=Array(c).fill("0");t=[...o,...l,...s].filter(u=>u!=="").join(":")}let r=t.split(":");if(r.length!==8)return null;for(let n of r)if(n.length===0||n.length>4||!/^[0-9a-fA-F]+$/.test(n))return null;return r.map(n=>n.padStart(4,"0").toLowerCase()).join(":")}function FV(e){let[t,r]=e.split("/");if(!t||!r)return null;let n=dR(t);if(!n)return null;let i=parseInt(r,10);if(isNaN(i))return null;let a=eh(t);return a&&i>128||!a&&i>32?null:{addr:n,prefixLen:i,isIpv6:a}}function BV(e,t){let r=dR(e);if(!r)return!1;let n=FV(t);if(!n)return!1;let i=eh(e);if(i!==n.isIpv6)return!1;let{addr:a,prefixLen:o}=n;if(i)for(let s=0;s<Math.ceil(o/16);s++){let c=65535<<16-Math.min(16,o-s*16)&65535;if((r[s]&c)!==(a[s]&c))return!1}else for(let s=0;s<Math.ceil(o/8);s++){let c=255<<8-Math.min(8,o-s*8)&255;if((r[s]&c)!==(a[s]&c))return!1}return!0}function pR(e){if(!uR(e))return!1;for(let t of jV)if(BV(e,t))return!0;return!1}function $S(e,t){if(DV.includes(t||""))return!0;let r=e.toLowerCase();return!!zV.includes(r)}function IS(e,t){if(t&&(t==="127.0.0.1"||t==="::1"||t==="0.0.0.0"||t.startsWith("127.")))return!0;let r=e.toLowerCase();return!!UV.includes(r)}function mR(e,t){let r=t?.allowPrivate??!1,n=t?.allowHttp??!1;try{let i;try{i=new URL(e)}catch{throw new Error(`Invalid URL: ${e}`)}let a=i.hostname;if(!a)throw new Error("URL missing hostname.");if($S(a))throw new Error(`URL points to cloud metadata endpoint: ${a}`);if(IS(a)){if(!r)throw new Error(`URL points to localhost: ${a}`);return e}let o=i.protocol;if(o!=="http:"&&o!=="https:")throw new Error(`Invalid URL scheme: ${o}. Only http and https are allowed.`);if(o==="http:"&&!n)throw new Error("HTTP scheme not allowed. Use HTTPS or set allowHttp: true.");if(uR(a)){let s=a;if(IS(a,s)){if(!r)throw new Error(`URL points to localhost: ${a}`);return e}if($S(a,s))throw new Error(`URL resolves to cloud metadata IP: ${s} (${a})`);if(pR(s)&&!r)throw new Error(`URL resolves to private IP: ${s} (${a}). Set allowPrivate: true to allow.`);return e}return e}catch(i){throw i&&typeof i=="object"&&"message"in i?i:new Error(`URL validation failed: ${i}`)}}function VV(e,t){try{return mR(e,t),!0}catch{return!1}}function ZV(e,t){try{return new URL(e).origin===new URL(t).origin}catch{return!1}}var hR=T({SaveableVectorStore:()=>HV,VectorStore:()=>rh,VectorStoreRetriever:()=>th}),th=class extends uu{static lc_name(){return"VectorStoreRetriever"}get lc_namespace(){return["langchain_core","vectorstores"]}vectorStore;k=4;searchType="similarity";searchKwargs;filter;_vectorstoreType(){return this.vectorStore._vectorstoreType()}constructor(e){super(e),this.vectorStore=e.vectorStore,this.k=e.k??this.k,this.searchType=e.searchType??this.searchType,this.filter=e.filter,e.searchType==="mmr"&&(this.searchKwargs=e.searchKwargs)}async _getRelevantDocuments(e,t){if(this.searchType==="mmr"){if(typeof this.vectorStore.maxMarginalRelevanceSearch!="function")throw new Error(`The vector store backing this retriever, ${this._vectorstoreType()} does not support max marginal relevance search.`);return this.vectorStore.maxMarginalRelevanceSearch(e,{k:this.k,filter:this.filter,...this.searchKwargs},t?.getChild("vectorstore"))}return this.vectorStore.similaritySearch(e,this.k,this.filter,t?.getChild("vectorstore"))}async addDocuments(e,t){return this.vectorStore.addDocuments(e,t)}},rh=class extends pt{lc_namespace=["langchain","vectorstores",this._vectorstoreType()];embeddings;constructor(e,t){super(t),this.embeddings=e}async delete(e){throw new Error("Not implemented.")}async similaritySearch(e,t=4,r=void 0,n=void 0){return(await this.similaritySearchVectorWithScore(await this.embeddings.embedQuery(e),t,r)).map(i=>i[0])}async similaritySearchWithScore(e,t=4,r=void 0,n=void 0){return this.similaritySearchVectorWithScore(await this.embeddings.embedQuery(e),t,r)}static fromTexts(e,t,r,n){throw new Error("the Langchain vectorstore implementation you are using forgot to override this, please report a bug")}static fromDocuments(e,t,r){throw new Error("the Langchain vectorstore implementation you are using forgot to override this, please report a bug")}asRetriever(e,t,r,n,i,a){if(typeof e=="number")return new th({vectorStore:this,k:e,filter:t,tags:[...n??[],this._vectorstoreType()],metadata:i,verbose:a,callbacks:r});{let o={vectorStore:this,k:e?.k,filter:e?.filter,tags:[...e?.tags??[],this._vectorstoreType()],metadata:e?.metadata,verbose:e?.verbose,callbacks:e?.callbacks,searchType:e?.searchType};return e?.searchType==="mmr"?new th({...o,searchKwargs:e.searchKwargs}):new th({...o})}}},HV=class extends rh{static load(e,t){throw new Error("Not implemented")}};var gR=class extends Na{_combineLLMOutput(){return[]}_llmType(){return"fake"}async _generate(e,t,r){if(t?.stop?.length)return{generations:[{message:new Ne(t.stop[0]),text:t.stop[0]}]};let n=e.map(i=>typeof i.content=="string"?i.content:JSON.stringify(i.content,null,2)).join(`
429
+ `);return await r?.handleLLMNewToken(n),{generations:[{message:new Ne(n),text:n}],llmOutput:{}}}},_R=class yR extends Na{sleep=50;responses=[];chunks=[];toolStyle="openai";thrownErrorString;tools=[];constructor({sleep:t=50,responses:r=[],chunks:n=[],toolStyle:i="openai",thrownErrorString:a,...o}){super(o),this.sleep=t,this.responses=r,this.chunks=n,this.toolStyle=i,this.thrownErrorString=a}_llmType(){return"fake"}bindTools(t){let r=[...this.tools,...t],n=r.map(o=>{switch(this.toolStyle){case"openai":return{type:"function",function:{name:o.name,description:o.description,parameters:It(o.schema)}};case"anthropic":return{name:o.name,description:o.description,input_schema:It(o.schema)};case"bedrock":return{toolSpec:{name:o.name,description:o.description,inputSchema:It(o.schema)}};case"google":return{name:o.name,description:o.description,parameters:It(o.schema)};default:throw new Error(`Unsupported tool style: ${this.toolStyle}`)}}),i=this.toolStyle==="google"?[{functionDeclarations:n}]:n,a=new yR({sleep:this.sleep,responses:this.responses,chunks:this.chunks,toolStyle:this.toolStyle,thrownErrorString:this.thrownErrorString});return a.tools=r,a.withConfig({tools:i})}async _generate(t,r,n){if(this.thrownErrorString)throw new Error(this.thrownErrorString);return{generations:[{text:"",message:new Ne({content:this.responses?.[0]?.content??t[0].content??"",tool_calls:this.chunks?.[0]?.tool_calls})}]}}async*_streamResponseChunks(t,r,n){if(this.thrownErrorString)throw new Error(this.thrownErrorString);if(this.chunks?.length){for(let o of this.chunks){let s=new fa({message:new it({content:o.content,tool_calls:o.tool_calls,additional_kwargs:o.additional_kwargs??{}}),text:o.content?.toString()??""});if(r.signal?.aborted)break;yield s,await n?.handleLLMNewToken(o.content,void 0,void 0,void 0,void 0,{chunk:s})}return}let i=this.responses?.[0]??new Ne(typeof t[0].content=="string"?t[0].content:""),a=typeof i.content=="string"?i.content:"";for(let o of a){await new Promise(c=>setTimeout(c,this.sleep));let s=new fa({message:new it({content:o}),text:o});if(r.signal?.aborted)break;yield s,await n?.handleLLMNewToken(o,void 0,void 0,void 0,void 0,{chunk:s})}}},vR=class bR extends Na{static lc_name(){return"FakeListChatModel"}lc_serializable=!0;responses;i=0;sleep;emitCustomEvent=!1;generationInfo;tools=[];toolStyle="openai";constructor(t){super(t);let{responses:r,sleep:n,emitCustomEvent:i,generationInfo:a}=t;this.responses=r,this.sleep=n,this.emitCustomEvent=i??this.emitCustomEvent,this.generationInfo=a}_combineLLMOutput(){return[]}_llmType(){return"fake-list"}async _generate(t,r,n){if(await this._sleepIfRequested(),r?.thrownErrorString)throw new Error(r.thrownErrorString);if(this.emitCustomEvent&&await n?.handleCustomEvent("some_test_event",{someval:!0}),r?.stop?.length)return{generations:[this._formatGeneration(r.stop[0])]};{let i=this._currentResponse();return this._incrementResponse(),{generations:[this._formatGeneration(i)],llmOutput:{}}}}_formatGeneration(t){return{message:new Ne(t),text:t}}async*_streamResponseChunks(t,r,n){let i=this._currentResponse();this._incrementResponse(),this.emitCustomEvent&&await n?.handleCustomEvent("some_test_event",{someval:!0});let a=[...i];for(let o=0;o<a.length;o++){let s=a[o],c=o===a.length-1;if(await this._sleepIfRequested(),r?.thrownErrorString)throw new Error(r.thrownErrorString);let l=this._createResponseChunk(s,c?this.generationInfo:void 0);if(r.signal?.aborted)break;yield l,n?.handleLLMNewToken(s)}}async _sleepIfRequested(){this.sleep!==void 0&&await this._sleep()}async _sleep(){return new Promise(t=>{setTimeout(()=>t(),this.sleep)})}_createResponseChunk(t,r){return new fa({message:new it({content:t}),text:t,generationInfo:r})}_currentResponse(){return this.responses[this.i]}_incrementResponse(){this.i<this.responses.length-1?this.i+=1:this.i=0}bindTools(t){let r=[...this.tools,...t],n=r.map(o=>{switch(this.toolStyle){case"openai":return{type:"function",function:{name:o.name,description:o.description,parameters:It(o.schema)}};case"anthropic":return{name:o.name,description:o.description,input_schema:It(o.schema)};case"bedrock":return{toolSpec:{name:o.name,description:o.description,inputSchema:It(o.schema)}};case"google":return{name:o.name,description:o.description,parameters:It(o.schema)};default:throw new Error(`Unsupported tool style: ${this.toolStyle}`)}}),i=this.toolStyle==="google"?[{functionDeclarations:n}]:n,a=new bR({responses:this.responses,sleep:this.sleep,emitCustomEvent:this.emitCustomEvent,generationInfo:this.generationInfo});return a.tools=r,a.toolStyle=this.toolStyle,a.i=this.i,a.withConfig({tools:i})}withStructuredOutput(t,r){return Yt.from(async n=>{let i=await this.invoke(n);if(i.tool_calls?.[0]?.args)return i.tool_calls[0].args;if(typeof i.content=="string")return JSON.parse(i.content);throw new Error("No structured output found")})}};var wR=class extends Gp{vectorSize;constructor(e){super(e??{}),this.vectorSize=e?.vectorSize??4}async embedDocuments(e){return Promise.all(e.map(t=>this.embedQuery(t)))}async embedQuery(e){let t=e;t=t.toLowerCase().replaceAll(/[^a-z ]/g,"");let r=t.length%this.vectorSize,n=r===0?0:this.vectorSize-r,i=t.length+n;t=t.padEnd(i," ");let a=t.length/this.vectorSize,o=[];for(let s=0;s<t.length;s+=a)o.push(t.slice(s,s+a));return o.map(s=>{let c=0;for(let l=0;l<s.length;l+=1)c+=s===" "?0:s.charCodeAt(l);return c%26/26})}},xR=class extends Gp{constructor(e){super(e??{})}embedDocuments(e){return Promise.resolve(e.map(()=>[.1,.2,.3,.4]))}embedQuery(e){return Promise.resolve([.1,.2,.3,.4])}};var SR=class extends sm{response;thrownErrorString;constructor(e){super(e),this.response=e.response,this.thrownErrorString=e.thrownErrorString}_llmType(){return"fake"}async _call(e,t,r){if(this.thrownErrorString)throw new Error(this.thrownErrorString);let n=this.response??e;return await r?.handleLLMNewToken(n),n}},kR=class extends sm{sleep=50;responses;thrownErrorString;constructor(e){super(e),this.sleep=e.sleep??this.sleep,this.responses=e.responses,this.thrownErrorString=e.thrownErrorString}_llmType(){return"fake"}async _call(e){if(this.thrownErrorString)throw new Error(this.thrownErrorString);let t=this.responses?.[0];return this.responses=this.responses?.slice(1),t??e}async*_streamResponseChunks(e,t,r){if(this.thrownErrorString)throw new Error(this.thrownErrorString);let n=this.responses?.[0];this.responses=this.responses?.slice(1);for(let i of n??e)await new Promise(a=>setTimeout(a,this.sleep)),yield{text:i,generationInfo:{}},await r?.handleLLMNewToken(i)}};var ER=class extends gx{lc_namespace=["langchain_core","message","fake"];messages=[];constructor(){super()}async getMessages(){return this.messages}async addMessage(e){this.messages.push(e)}async addUserMessage(e){this.messages.push(new ot(e))}async addAIMessage(e){this.messages.push(new Ne(e))}async clear(){this.messages=[]}},$R=class extends Hp{lc_namespace=["langchain_core","message","fake"];messages=[];constructor(){super()}async addMessage(e){this.messages.push(e)}async getMessages(){return this.messages}},IR=class extends zt{name="fake_tracer";runs=[];constructor(){super()}persistRun(e){return this.runs.push(e),Promise.resolve()}};var TR=class extends vn{lc_namespace=["tests","fake"];getFormatInstructions(){return""}async parse(e){return e.split(",").map(t=>t.trim())}};var CR=class extends uu{lc_namespace=["test","fake"];output=[new Fr({pageContent:"foo"}),new Fr({pageContent:"bar"})];constructor(e){super(),this.output=e?.output??this.output}async _getRelevantDocuments(e){return this.output}};var AR=class extends se{lc_namespace=["tests","fake"];returnOptions;constructor(e){super(e),this.returnOptions=e.returnOptions}async invoke(e,t){return this.returnOptions?t??{}:{input:e}}};var OR=class extends Mu{name;description;schema;constructor(e){super(e),this.name=e.name,this.description=e.description,this.schema=e.schema}async _call(e,t){return JSON.stringify(e)}};var PR=class extends zt{runPromiseResolver;runPromise;name="single_run_extractor";constructor(){super(),this.runPromise=new Promise(e=>{this.runPromiseResolver=e})}async persistRun(e){this.runPromiseResolver(e)}async extract(){return this.runPromise}};var NR=class RR extends rh{memoryVectors=[];similarity;_vectorstoreType(){return"memory"}constructor(t,{similarity:r,...n}={}){super(t,n),this.similarity=r??Xm}async addDocuments(t){let r=t.map(({pageContent:n})=>n);return this.addVectors(await this.embeddings.embedDocuments(r),t)}async addVectors(t,r){let n=t.map((i,a)=>({content:r[a].pageContent,embedding:i,metadata:r[a].metadata}));this.memoryVectors=this.memoryVectors.concat(n)}async similaritySearchVectorWithScore(t,r,n){let i=o=>n?n(new Fr({metadata:o.metadata,pageContent:o.content})):!0,a=this.memoryVectors.filter(i);return a.map((o,s)=>({similarity:this.similarity(t,o.embedding),index:s})).sort((o,s)=>o.similarity>s.similarity?-1:0).slice(0,r).map(o=>[new Fr({metadata:a[o.index].metadata,pageContent:a[o.index].content}),o.similarity])}static async fromTexts(t,r,n,i){let a=[];for(let o=0;o<t.length;o+=1){let s=Array.isArray(r)?r[o]:r,c=new Fr({pageContent:t[o],metadata:s});a.push(c)}return RR.fromDocuments(a,n,i)}static async fromDocuments(t,r,n){let i=new this(r,n);return await i.addDocuments(t),i}static async fromExistingIndex(t,r){return new this(t,r)}};var MR=T({FakeChatMessageHistory:()=>ER,FakeChatModel:()=>gR,FakeEmbeddings:()=>xR,FakeLLM:()=>SR,FakeListChatMessageHistory:()=>$R,FakeListChatModel:()=>vR,FakeRetriever:()=>CR,FakeRunnable:()=>AR,FakeSplitIntoListParser:()=>TR,FakeStreamingChatModel:()=>_R,FakeStreamingLLM:()=>kR,FakeTool:()=>OR,FakeTracer:()=>IR,FakeVectorStore:()=>NR,SingleRunExtractor:()=>PR,SyntheticEmbeddings:()=>wR,asAsyncIterable:()=>gm,openAIReasoningTextChunks:()=>ym,openAITextOnlyChunks:()=>gu,openAITextOnlyChunksWithUsage:()=>_m,openAIToolCallChunks:()=>vm,sseResponseFromOpenAIChunks:()=>bm,streamMatchers:()=>hc});var jR=T({agents:()=>fE,caches:()=>y$,callbacks__base:()=>x$,callbacks__manager:()=>bT,callbacks__promises:()=>_T,chat_history:()=>PO,document_loaders__base:()=>MO,document_loaders__langsmith:()=>jO,documents:()=>RO,embeddings:()=>DO,errors:()=>gE,example_selectors:()=>GO,index:()=>dE,indexing:()=>KO,language_models__base:()=>nP,language_models__chat_models:()=>MP,language_models__compat:()=>PP,language_models__event:()=>DP,language_models__llms:()=>zP,language_models__openai_completions_stream:()=>jP,language_models__profile:()=>LP,language_models__stream:()=>$P,language_models__structured_output:()=>kP,load__serializable:()=>rE,memory:()=>FP,messages:()=>OO,messages__tool:()=>zE,output_parsers:()=>bP,output_parsers__openai_functions:()=>ZP,output_parsers__openai_tools:()=>HP,outputs:()=>DT,prompt_values:()=>qO,prompts:()=>nN,retrievers:()=>aN,retrievers__document_compressors:()=>iN,runnables:()=>cP,runnables__graph:()=>oO,singletons:()=>$T,stores:()=>oN,structured_query:()=>pN,testing:()=>wN,tools:()=>F1,tracers__base:()=>sT,tracers__console:()=>lT,tracers__log_stream:()=>jT,tracers__run_collector:()=>H1,tracers__tracer_langchain:()=>pT,types__stream:()=>G1,utils__async_caller:()=>VT,utils__chunk_array:()=>W1,utils__context:()=>J1,utils__env:()=>iE,utils__event_source_parse:()=>K1,utils__format:()=>Q1,utils__function_calling:()=>eR,utils__gateway:()=>rR,utils__hash:()=>pE,utils__json_patch:()=>lP,utils__json_schema:()=>QA,utils__math:()=>oR,utils__ssrf:()=>cR,utils__standard_schema:()=>KT,utils__stream:()=>IT,utils__testing:()=>MR,utils__tiktoken:()=>tP,utils__types:()=>wP,utils__uuid:()=>Jk,vectorstores:()=>hR});var GV=50;function WV(e){let t={};for(let r=e;r&&r.prototype;r=Object.getPrototypeOf(r))Object.assign(t,Reflect.get(r.prototype,"lc_aliases"));return Object.entries(t).reduce((r,[n,i])=>(r[i]=n,r),{})}async function nh(e){let{optionalImportsMap:t,optionalImportEntrypoints:r,importMap:n,secretsMap:i,secretsFromEnv:a,path:o,depth:s,maxDepth:c}=this,l=o.join(".");if(s>c)throw new Error(`Maximum recursion depth (${c}) exceeded during deserialization. This may indicate a malicious payload or you may need to increase maxDepth.`);if(typeof e!="object"||e==null)return e;if(Array.isArray(e))return Promise.all(e.map((f,p)=>nh.call({...this,path:[...o,`${p}`],depth:s+1},f)));let u=e;if(ig(u))return md(u);if("lc"in u&&"type"in u&&"id"in u&&u.lc===1&&u.type==="secret"){let[f]=u.id;if(f in i)return i[f];if(a){let p=xt(f);if(p)return p}throw new Error(`Missing secret "${f}" at ${l}`)}if("lc"in u&&"type"in u&&"id"in u&&u.lc===1&&u.type==="not_implemented"){let f=JSON.stringify(u);throw new Error(`Trying to load an object that doesn't implement serialization: ${l} -> ${f}`)}if("lc"in u&&"type"in u&&"id"in u&&"kwargs"in u&&u.lc===1&&u.type==="constructor"){let f=u,p=JSON.stringify(f),[m,...h]=f.id.slice().reverse(),_=h.reverse(),y={langchain_core:jR,langchain:n},w=null,x=[_.join("/")];_[0]==="langchain_community"&&x.push(["langchain",..._.slice(1)].join("/"));let S=x.find(C=>C in t);if(uE.concat(r).includes(_.join("/"))||S)if(S!==void 0)w=await t[S];else throw new Error(`Missing key "${_.join("/")}" for ${l} in load(optionalImportsMap={})`);else{let C;if(_[0]==="langchain"||_[0]==="langchain_core")C=y[_[0]],_.shift();else throw new Error(`Invalid namespace: ${l} -> ${p}`);if(_.length===0)throw new Error(`Invalid namespace: ${l} -> ${p}`);let b;do{if(b=_.join("__"),b in C)break;_.pop()}while(_.length>0);b in C&&(w=C[b])}if(typeof w!="object"||w===null)throw new Error(`Invalid namespace: ${l} -> ${p}`);let E=w[m]??Object.values(w).find(C=>typeof C=="function"&&as(C)===m);if(typeof E!="function")throw new Error(`Invalid identifer: ${l} -> ${p}`);let P=new E(fd(await nh.call({...this,path:[...o,"kwargs"],depth:s+1},f.kwargs),Qk,WV(E)));return Object.defineProperty(P.constructor,"name",{value:m}),P}let d={};for(let[f,p]of Object.entries(u))d[f]=await nh.call({...this,path:[...o,f],depth:s+1},p);return d}async function DR(e,t){let r=JSON.parse(e),n={optionalImportsMap:t?.optionalImportsMap??{},optionalImportEntrypoints:t?.optionalImportEntrypoints??[],secretsMap:t?.secretsMap??{},secretsFromEnv:t?.secretsFromEnv??!1,importMap:t?.importMap??{},path:["$"],depth:0,maxDepth:t?.maxDepth??GV};return nh.call(n,r)}function JV(e){return e!==null&&e.lc===1&&e.type==="constructor"&&Array.isArray(e.id)}async function TS(e){if(e&&typeof e=="object"){if(Array.isArray(e))return await Promise.all(e.map(t=>TS(t)));{let t={};for(let[r,n]of Object.entries(e))t[r]=await TS(n);if(t.lc===2&&t.type==="undefined")return;if(t.lc===2&&t.type==="delta_snapshot")return new ns(t.value);if(t.lc===2&&t.type==="constructor"&&Array.isArray(t.id))try{let r=t.id[t.id.length-1],n;switch(r){case"Set":n=Set;break;case"Map":n=Map;break;case"RegExp":n=RegExp;break;case"Error":n=Error;break;case"Uint8Array":n=Uint8Array;break;default:return t}return t.method?n[t.method](...t.args||[]):new n(...t.args||[])}catch{return t}else if(JV(t))return DR(JSON.stringify(t));return t}}return e}function ih(e,t,r,n){return{lc:2,type:"constructor",id:[e.name],method:t??null,args:r??[],kwargs:n??{}}}function KV(e){return e===void 0?{lc:2,type:"undefined"}:e instanceof ns?{lc:2,type:"delta_snapshot",value:e.value}:e instanceof Set||e instanceof Map?ih(e.constructor,void 0,[Array.from(e)]):e instanceof RegExp?ih(RegExp,void 0,[e.source,e.flags]):e instanceof Error?ih(e.constructor,void 0,[e.message]):e?.lg_name==="Send"?{node:e.node,args:e.args,...e.timeout!==void 0?{timeout:e.timeout}:{}}:e instanceof Uint8Array?ih(Uint8Array,"from",[Array.from(e)]):e}var ah=class{_dumps(e){return new TextEncoder().encode(qk(e,(t,r)=>KV(r)))}async dumpsTyped(e){return e instanceof Uint8Array?["bytes",e]:["json",this._dumps(e)]}async _loads(e){return TS(JSON.parse(e))}async loadsTyped(e,t){if(e==="bytes")return typeof t=="string"?new TextEncoder().encode(t):t;if(e==="json")return this._loads(typeof t=="string"?t:new TextDecoder().decode(t));throw new Error(`Unknown serialization type: ${e}`)}};function CS(e){if(typeof e!="object"||e===null)return e;let t=Array.isArray(e)?[]:{};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=CS(e[r]));return t}function Jo(){return{v:4,id:Gc(0),ts:new Date().toISOString(),channel_values:{},channel_versions:{},versions_seen:{}}}function xn(e){return{v:e.v,id:e.id,ts:e.ts,channel_values:{...e.channel_values??{}},channel_versions:{...e.channel_versions??{}},versions_seen:CS(e.versions_seen??{})}}var oh=class{serde=new ah;constructor(e){this.serde=e||this.serde}toJSON(){return`[${this.constructor.name}]`}async get(e){let t=await this.getTuple(e);return t?t.checkpoint:void 0}async getDeltaChannelHistory(e){let{config:t,channels:r}=e;if(r.length===0)return{};let n={},i={},a=new Set(r);for(let c of r)n[c]=[];let o=(await this.getTuple(t))?.parentConfig;for(;o!=null&&a.size>0;){let c=await this.getTuple(o);if(c===void 0)break;if(c.pendingWrites&&c.pendingWrites.length>0){let l={};for(let u of c.pendingWrites){let d=u[1];a.has(d)&&(l[d]??=[]).push(u)}for(let u of Object.keys(l)){let d=l[u];d.sort((f,p)=>f[0]<p[0]?-1:f[0]>p[0]?1:0);for(let f=d.length-1;f>=0;f-=1)n[u].push(d[f])}}for(let l of Array.from(a))Object.prototype.hasOwnProperty.call(c.checkpoint.channel_values,l)&&(i[l]=c.checkpoint.channel_values[l],a.delete(l));o=c.parentConfig}let s={};for(let c of r){let l={writes:n[c].slice().reverse()};Object.prototype.hasOwnProperty.call(i,c)&&(l.seed=i[c]),s[c]=l}return s}getNextVersion(e){if(typeof e=="string")throw new Error("Please override this method to use string versions.");return e!==void 0&&typeof e=="number"?e+1:1}};function sh(e,t){return typeof e=="number"&&typeof t=="number"?Math.sign(e-t):String(e).localeCompare(String(t))}function ju(...e){return e.reduce((t,r,n)=>n===0?r:sh(t,r)>=0?t:r)}var Du={[Xh]:-1,[Ya]:-2,[Qh]:-3,[eg]:-4},AS=new Set(["thread_id","checkpoint_id","checkpoint_ns","checkpoint_map","langgraph_step","langgraph_node","langgraph_triggers","langgraph_path","langgraph_checkpoint_ns"]);function ch(e){return e.configurable?.checkpoint_id||e.configurable?.thread_ts||""}var qV=new Set(["__proto__","constructor","prototype"]);function Lt(e,t,r={}){let{allowEmpty:n=!1}=r;if(typeof t!="string"){let i=t===null?"null":t===void 0?"undefined":Array.isArray(t)?"array":typeof t;throw new Error(`Invalid configurable value for key "${e}": expected a string identifier (got ${i}). This guard protects MemorySaver from prototype pollution.`)}if(!n&&t==="")throw new Error(`Invalid configurable value for key "${e}": empty string is not permitted as an in-memory storage key.`);if(qV.has(t))throw new Error(`Invalid configurable value for key "${e}": value "${t}" is reserved (would mutate Object.prototype). This guard protects MemorySaver from prototype pollution.`)}function kc(e,t,r){return JSON.stringify([e,t,r])}function YV(e){let[t,r,n]=JSON.parse(e);return{threadId:t,checkpointNamespace:r,checkpointId:n}}var zR=class extends oh{storage=Object.create(null);writes=Object.create(null);constructor(e){super(e)}async _migratePendingSends(e,t,r,n){let i=e,a=kc(t,r,n),o=await Promise.all(Object.values(this.writes[a]??{}).filter(([s,c])=>c===Wc).map(async([s,c,l])=>await this.serde.loadsTyped("json",l)));i.channel_values??={},i.channel_values[Wc]=o,i.channel_versions??={},i.channel_versions[Wc]=Object.keys(i.channel_versions).length>0?ju(...Object.values(i.channel_versions)):this.getNextVersion(void 0)}async getTuple(e){let t=e.configurable?.thread_id,r=e.configurable?.checkpoint_ns??"",n=ch(e);if(t!==void 0&&Lt("thread_id",t),Lt("checkpoint_ns",r,{allowEmpty:!0}),n&&Lt("checkpoint_id",n),n){let i=this.storage[t]?.[r]?.[n];if(i!==void 0){let[a,o,s]=i,c=kc(t,r,n),l=await this.serde.loadsTyped("json",a);l.v<4&&s!==void 0&&await this._migratePendingSends(l,t,r,s);let u=await Promise.all(Object.values(this.writes[c]||{}).map(async([f,p,m])=>[f,p,await this.serde.loadsTyped("json",m)])),d={config:e,checkpoint:l,metadata:await this.serde.loadsTyped("json",o),pendingWrites:u};return s!==void 0&&(d.parentConfig={configurable:{thread_id:t,checkpoint_ns:r,checkpoint_id:s}}),d}}else{let i=this.storage[t]?.[r];if(i!==void 0){n=Object.keys(i).sort((f,p)=>p.localeCompare(f))[0];let[a,o,s]=i[n],c=kc(t,r,n),l=await this.serde.loadsTyped("json",a);l.v<4&&s!==void 0&&await this._migratePendingSends(l,t,r,s);let u=await Promise.all(Object.values(this.writes[c]||{}).map(async([f,p,m])=>[f,p,await this.serde.loadsTyped("json",m)])),d={config:{configurable:{thread_id:t,checkpoint_id:n,checkpoint_ns:r}},checkpoint:l,metadata:await this.serde.loadsTyped("json",o),pendingWrites:u};return s!==void 0&&(d.parentConfig={configurable:{thread_id:t,checkpoint_ns:r,checkpoint_id:s}}),d}}}async*list(e,t){let{before:r,limit:n,filter:i}=t??{};e.configurable?.thread_id!==void 0&&Lt("thread_id",e.configurable.thread_id),e.configurable?.checkpoint_ns!==void 0&&Lt("checkpoint_ns",e.configurable.checkpoint_ns,{allowEmpty:!0}),e.configurable?.checkpoint_id&&Lt("checkpoint_id",e.configurable.checkpoint_id),r?.configurable?.checkpoint_id&&Lt("checkpoint_id",r.configurable.checkpoint_id);let a=e.configurable?.thread_id?[e.configurable?.thread_id]:Object.keys(this.storage),o=e.configurable?.checkpoint_ns,s=e.configurable?.checkpoint_id;for(let c of a)for(let l of Object.keys(this.storage[c]??{})){if(o!==void 0&&l!==o)continue;let u=this.storage[c]?.[l]??{},d=Object.entries(u).sort((f,p)=>p[0].localeCompare(f[0]));for(let[f,[p,m,h]]of d){if(s&&f!==s||r&&r.configurable?.checkpoint_id&&f>=r.configurable.checkpoint_id)continue;let _=await this.serde.loadsTyped("json",m);if(i&&!Object.entries(i).every(([P,C])=>_[P]===C))continue;if(n!==void 0){if(n<=0)break;n-=1}let y=kc(c,l,f),w=Object.values(this.writes[y]||{}),x=await Promise.all(w.map(async([P,C,b])=>[P,C,await this.serde.loadsTyped("json",b)])),S=await this.serde.loadsTyped("json",p);S.v<4&&h!==void 0&&await this._migratePendingSends(S,c,l,h);let E={config:{configurable:{thread_id:c,checkpoint_ns:l,checkpoint_id:f}},checkpoint:S,metadata:_,pendingWrites:x};h!==void 0&&(E.parentConfig={configurable:{thread_id:c,checkpoint_ns:l,checkpoint_id:h}}),yield E}}}async put(e,t,r){let n=xn(t),i=e.configurable?.thread_id,a=e.configurable?.checkpoint_ns??"";if(i===void 0)throw new Error('Failed to put checkpoint. The passed RunnableConfig is missing a required "thread_id" field in its "configurable" property. When using a checkpointer, you must pass a "thread_id" so the checkpointer knows which conversation thread to persist state for. Example: graph.stream(input, { configurable: { thread_id: "my-thread-id" } })');Lt("thread_id",i),Lt("checkpoint_ns",a,{allowEmpty:!0}),Lt("checkpoint_id",t.id),this.storage[i]||(this.storage[i]=Object.create(null)),this.storage[i][a]||(this.storage[i][a]=Object.create(null));let[[,o],[,s]]=await Promise.all([this.serde.dumpsTyped(n),this.serde.dumpsTyped(r)]);return this.storage[i][a][t.id]=[o,s,e.configurable?.checkpoint_id],{configurable:{thread_id:i,checkpoint_ns:a,checkpoint_id:t.id}}}async putWrites(e,t,r){let n=e.configurable?.thread_id,i=e.configurable?.checkpoint_ns,a=e.configurable?.checkpoint_id;if(n===void 0)throw new Error('Failed to put writes. The passed RunnableConfig is missing a required "thread_id" field in its "configurable" property. When using a checkpointer, you must pass a "thread_id" so the checkpointer knows which conversation thread to persist state for. Example: graph.stream(input, { configurable: { thread_id: "my-thread-id" } })');if(a===void 0)throw new Error('Failed to put writes. The passed RunnableConfig is missing a required "checkpoint_id" field in its "configurable" property.');Lt("thread_id",n),Lt("checkpoint_ns",i,{allowEmpty:!0}),Lt("checkpoint_id",a),Lt("task_id",r);let o=kc(n,i,a),s=this.writes[o];this.writes[o]===void 0&&(this.writes[o]=Object.create(null)),await Promise.all(t.map(async([c,l],u)=>{let[,d]=await this.serde.dumpsTyped(l),f=[r,Du[c]||u],p=`${f[0]},${f[1]}`;f[1]>=0&&s&&p in s||(this.writes[o][p]=[r,c,d])}))}async deleteThread(e){Lt("thread_id",e),delete this.storage[e];for(let t of Object.keys(this.writes))YV(t).threadId===e&&delete this.writes[t]}async getDeltaChannelHistory(e){let{config:t,channels:r}=e;if(r.length===0)return{};let n=t.configurable?.thread_id,i=t.configurable?.checkpoint_ns??"",a=ch(t);n!==void 0&&Lt("thread_id",n),Lt("checkpoint_ns",i,{allowEmpty:!0});let o=this.storage[n]?.[i]??{},s=[],c=(a?o[a]:void 0)?.[2];for(;c!==void 0;){let p=o[c];if(p===void 0)break;s.push(c),c=p[2]}let l={},u={},d=new Set(r);for(let p of r)l[p]=[];for(let p of s){if(d.size===0)break;let m=o[p],h=m!==void 0?await this.serde.loadsTyped("json",m[0]):void 0,_={},y=new Set;if(h!==void 0)for(let S of d)Object.prototype.hasOwnProperty.call(h.channel_values,S)&&h.channel_values[S]!==void 0&&(_[S]=h.channel_values[S],y.add(S));let w=kc(n,i,p),x=Object.entries(this.writes[w]??{});x.sort(([S],[E])=>{let[P,C]=S.split(","),[b,B]=E.split(",");return P!==b?P<b?1:-1:Number(B)-Number(C)});for(let[,[S,E,P]]of x)d.has(E)&&l[E].push([S,E,await this.serde.loadsTyped("json",P)]);for(let S of y)u[S]=_[S],d.delete(S)}let f={};for(let p of r){let m={writes:l[p].slice().reverse()};Object.prototype.hasOwnProperty.call(u,p)&&(m.seed=u[p]),f[p]=m}return f}};var Ec=class extends Error{constructor(e){super(e),this.name="InvalidNamespaceError"}};function XV(e){if(e.length===0)throw new Ec("Namespace cannot be empty.");for(let t of e){if(typeof t!="string")throw new Ec(`Invalid namespace label '${t}' found in ${e}. Namespace labels must be strings, but got ${typeof t}.`);if(t.includes("."))throw new Ec(`Invalid namespace label '${t}' found in ${e}. Namespace labels cannot contain periods ('.').`);if(t==="")throw new Ec(`Namespace labels cannot be empty strings. Got ${t} in ${e}`)}if(e[0]==="langgraph")throw new Ec(`Root label for namespace cannot be "langgraph". Got: ${e}`)}var $c=class{async get(e,t){return(await this.batch([{namespace:e,key:t}]))[0]}async search(e,t={}){let{filter:r,limit:n=10,offset:i=0,query:a}=t;return(await this.batch([{namespacePrefix:e,filter:r,limit:n,offset:i,query:a}]))[0]}async put(e,t,r,n){XV(e),await this.batch([{namespace:e,key:t,value:r,index:n}])}async delete(e,t){await this.batch([{namespace:e,key:t,value:null}])}async listNamespaces(e={}){let{prefix:t,suffix:r,maxDepth:n,limit:i=100,offset:a=0}=e,o=[];return t&&o.push({matchType:"prefix",path:t}),r&&o.push({matchType:"suffix",path:r}),(await this.batch([{matchConditions:o.length?o:void 0,maxDepth:n,limit:i,offset:a}]))[0]}start(){}stop(){}};var QV=e=>"lg_name"in e&&e.lg_name==="AsyncBatchedStore"?e.store:e,lh=class extends $c{lg_name="AsyncBatchedStore";store;queue=new Map;nextKey=0;running=!1;processingTask=null;constructor(e){super(),this.store=QV(e)}get isRunning(){return this.running}async batch(e){throw new Error("The `batch` method is not implemented on `AsyncBatchedStore`.\n Instead, it calls the `batch` method on the wrapped store.\n If you are seeing this error, something is wrong.")}async get(e,t){return this.enqueueOperation({namespace:e,key:t})}async search(e,t){let{filter:r,limit:n=10,offset:i=0,query:a}=t||{};return this.enqueueOperation({namespacePrefix:e,filter:r,limit:n,offset:i,query:a})}async put(e,t,r){return this.enqueueOperation({namespace:e,key:t,value:r})}async delete(e,t){return this.enqueueOperation({namespace:e,key:t,value:null})}start(){this.running||(this.running=!0,this.processingTask=this.processBatchQueue())}async stop(){this.running=!1,this.processingTask&&await this.processingTask}enqueueOperation(e){return new Promise((t,r)=>{let n=this.nextKey;this.nextKey+=1,this.queue.set(n,{operation:e,resolve:t,reject:r})})}async processBatchQueue(){for(;this.running;){if(await new Promise(t=>{setTimeout(t,0)}),this.queue.size===0)continue;let e=new Map(this.queue);this.queue.clear();try{let t=Array.from(e.values()).map(({operation:n})=>n),r=await this.store.batch(t);e.forEach(({resolve:n},i)=>{n(r[Array.from(e.keys()).indexOf(i)])})}catch(t){e.forEach(({reject:r})=>{r(t)})}}}toJSON(){return{queue:this.queue,nextKey:this.nextKey,running:this.running,store:"[LangGraphStore]"}}};function zu(e){if(!e)return[];let t=[],r=[],n=0;for(;n<e.length;){let i=e[n];if(i==="["){r.length&&(t.push(r.join("")),r=[]);let a=1,o=["["];for(n+=1;n<e.length&&a>0;)e[n]==="["?a+=1:e[n]==="]"&&(a-=1),o.push(e[n]),n+=1;t.push(o.join(""));continue}else if(i==="{"){r.length&&(t.push(r.join("")),r=[]);let a=1,o=["{"];for(n+=1;n<e.length&&a>0;)e[n]==="{"?a+=1:e[n]==="}"&&(a-=1),o.push(e[n]),n+=1;t.push(o.join(""));continue}else i==="."?r.length&&(t.push(r.join("")),r=[]):r.push(i);n+=1}return r.length&&t.push(r.join("")),t}function e9(e){return typeof e=="object"&&e!==null&&Object.keys(e).every(t=>t==="$eq"||t==="$ne"||t==="$gt"||t==="$gte"||t==="$lt"||t==="$lte"||t==="$in"||t==="$nin")}function UR(e,t){return e9(t)?Object.keys(t).filter(r=>r.startsWith("$")).every(r=>{let n=t[r];switch(r){case"$eq":return e===n;case"$ne":return e!==n;case"$gt":return Number(e)>Number(n);case"$gte":return Number(e)>=Number(n);case"$lt":return Number(e)<Number(n);case"$lte":return Number(e)<=Number(n);case"$in":return Array.isArray(n)?n.includes(e):!1;case"$nin":return Array.isArray(n)?!n.includes(e):!0;default:return!1}}):e===t}function LR(e,t){if(!t||t==="$")return[JSON.stringify(e,null,2)];let r=Array.isArray(t)?t:zu(t);function n(i,a,o){if(o>=a.length)return typeof i=="string"||typeof i=="number"||typeof i=="boolean"?[String(i)]:i==null?[]:Array.isArray(i)||typeof i=="object"?[JSON.stringify(i,null,2)]:[];let s=a[o],c=[];if(o===0&&s==="$"&&c.push(JSON.stringify(i,null,2)),s.startsWith("[")&&s.endsWith("]")){if(!Array.isArray(i))return[];let l=s.slice(1,-1);if(l==="*")for(let u of i)c.push(...n(u,a,o+1));else try{let u=parseInt(l,10);u<0&&(u=i.length+u),u>=0&&u<i.length&&c.push(...n(i[u],a,o+1))}catch{return[]}}else if(s.startsWith("{")&&s.endsWith("}")){if(typeof i!="object"||i===null)return[];let l=s.slice(1,-1).split(",").map(u=>u.trim());for(let u of l){let d=zu(u);if(d.length){let f=i;for(let p of d)if(f&&typeof f=="object"&&p in f)f=f[p];else{f=void 0;break}f!==void 0&&(typeof f=="string"||typeof f=="number"||typeof f=="boolean"?c.push(String(f)):(Array.isArray(f)||typeof f=="object")&&c.push(JSON.stringify(f,null,2)))}}}else if(s==="*"){if(Array.isArray(i))for(let l of i)c.push(...n(l,a,o+1));else if(typeof i=="object"&&i!==null)for(let l of Object.values(i))c.push(...n(l,a,o+1))}else typeof i=="object"&&i!==null&&s in i&&c.push(...n(i[s],a,o+1));return c}return n(e,r,0)}var FR=class extends $c{data=new Map;vectors=new Map;_indexConfig;constructor(e){super(),e?.index&&(this._indexConfig={...e.index,__tokenizedFields:(e.index.fields??["$"]).map(t=>[t,t==="$"?[t]:zu(t)])})}async batch(e){let t=[],r=new Map,n=new Map;for(let i=0;i<e.length;i+=1){let a=e[i];if("key"in a&&"namespace"in a&&!("value"in a))t.push(this.getOperation(a));else if("namespacePrefix"in a){let o=this.filterItems(a);n.set(i,[a,o]),t.push(null)}else if("value"in a){let o=`${a.namespace.join(":")}:${a.key}`;r.set(o,a),t.push(null)}else"matchConditions"in a&&t.push(this.listNamespacesOperation(a))}if(n.size>0)if(this._indexConfig?.embeddings){let i=new Set;for(let[s]of n.values())s.query&&i.add(s.query);let a=i.size>0?await Promise.all(Array.from(i).map(s=>this._indexConfig.embeddings.embedQuery(s))):[],o=Object.fromEntries(Array.from(i).map((s,c)=>[s,a[c]]));for(let[s,[c,l]]of n.entries())if(c.query&&o[c.query]){let u=o[c.query];t[s]=this.scoreResults(l,u,c.offset??0,c.limit??10)}else t[s]=this.paginateResults(l.map(u=>({...u,score:void 0})),c.offset??0,c.limit??10)}else for(let[i,[a,o]]of n.entries())t[i]=this.paginateResults(o.map(s=>({...s,score:void 0})),a.offset??0,a.limit??10);if(r.size>0&&this._indexConfig?.embeddings){let i=this.extractTexts(Array.from(r.values()));if(Object.keys(i).length>0){let a=await this._indexConfig.embeddings.embedDocuments(Object.keys(i));this.insertVectors(i,a)}}for(let i of r.values())this.putOperation(i);return t}getOperation(e){let t=e.namespace.join(":");return this.data.get(t)?.get(e.key)??null}putOperation(e){let t=e.namespace.join(":");this.data.has(t)||this.data.set(t,new Map);let r=this.data.get(t);if(e.value===null)r.delete(e.key);else{let n=new Date;if(r.has(e.key)){let i=r.get(e.key);i.value=e.value,i.updatedAt=n}else r.set(e.key,{value:e.value,key:e.key,namespace:e.namespace,createdAt:n,updatedAt:n})}}listNamespacesOperation(e){let t=Array.from(this.data.keys()).map(r=>r.split(":"));return e.matchConditions&&e.matchConditions.length>0&&(t=t.filter(r=>e.matchConditions.every(n=>this.doesMatch(n,r)))),e.maxDepth!==void 0&&(t=Array.from(new Set(t.map(r=>r.slice(0,e.maxDepth).join(":")))).map(r=>r.split(":"))),t.sort((r,n)=>r.join(":").localeCompare(n.join(":"))),t.slice(e.offset??0,(e.offset??0)+(e.limit??t.length))}doesMatch(e,t){let{matchType:r,path:n}=e;if(r==="prefix")return n.length>t.length?!1:n.every((i,a)=>{let o=t[a];return i==="*"||o===i});if(r==="suffix")return n.length>t.length?!1:n.every((i,a)=>{let o=t[t.length-n.length+a];return i==="*"||o===i});throw new Error(`Unsupported match type: ${r}`)}filterItems(e){let t=[];for(let[n,i]of this.data.entries())n.startsWith(e.namespacePrefix.join(":"))&&t.push(...i.values());let r=t;return e.filter&&(r=t.filter(n=>Object.entries(e.filter).every(([i,a])=>UR(n.value[i],a)))),r}scoreResults(e,t,r=0,n=10){let i=[],a=[],o=[];for(let u of e){let d=this.getVectors(u);if(d.length)for(let f of d)i.push(u),a.push(f);else o.push(u)}let s=this.cosineSimilarity(t,a).map((u,d)=>[u,i[d]]).sort((u,d)=>d[0]-u[0]),c=new Set,l=[];for(let[u,d]of s){let f=`${d.namespace.join(":")}:${d.key}`;if(c.has(f))continue;let p=c.size;if(p>=r+n)break;if(p<r){c.add(f);continue}c.add(f),l.push([u,d])}if(o.length&&l.length<n)for(let u of o.slice(0,n-l.length)){let d=`${u.namespace.join(":")}:${u.key}`;c.has(d)||(c.add(d),l.push([void 0,u]))}return l.map(([u,d])=>({...d,score:u}))}paginateResults(e,t,r){return e.slice(t,t+r)}extractTexts(e){if(!e.length||!this._indexConfig)return{};let t={};for(let r of e)if(r.value!==null&&r.index!==!1){let n=r.index===null||r.index===void 0?this._indexConfig.__tokenizedFields??[]:r.index.map(i=>[i,zu(i)]);for(let[i,a]of n){let o=LR(r.value,a);o.length&&(o.length>1?o.forEach((s,c)=>{t[s]||(t[s]=[]),t[s].push([r.namespace,r.key,`${i}.${c}`])}):(t[o[0]]||(t[o[0]]=[]),t[o[0]].push([r.namespace,r.key,i])))}}return t}insertVectors(e,t){for(let[r,n]of Object.entries(e)){let i=t.shift();if(!i)throw new Error(`No embedding found for text: ${r}`);for(let[a,o,s]of n){let c=a.join(":");this.vectors.has(c)||this.vectors.set(c,new Map);let l=this.vectors.get(c);l.has(o)||l.set(o,new Map),l.get(o).set(s,i)}}}getVectors(e){let t=e.namespace.join(":"),r=e.key;if(!this.vectors.has(t))return[];let n=this.vectors.get(t);if(!n.has(r))return[];let i=n.get(r),a=Array.from(i.values());return a.length?a:[]}cosineSimilarity(e,t){if(!t.length)return[];let r=t.map(a=>a.reduce((o,s,c)=>o+s*e[c],0)),n=Math.sqrt(e.reduce((a,o)=>a+o*o,0)),i=t.map(a=>Math.sqrt(a.reduce((o,s)=>o+s*s,0)));return r.map((a,o)=>{let s=i[o];return n&&s?a/(n*s):0})}get indexConfig(){return this._indexConfig}};var uh=class{serde=new ah;constructor(e){this.serde=e||this.serde}};var t9=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function an(e){return e!=null&&e.lc_graph_name==="DeltaChannel"}function PS(e){return e!=null&&e.lg_is_channel===!0}var yt=class{ValueType;UpdateType;lg_is_channel=!0;consume(){return!1}finish(){return!1}isAvailable(){try{return this.get(),!0}catch(e){if(e.name===je.unminifiable_name)return!1;throw e}}equals(e){return this===e}},OS=Symbol.for("LG_IS_ONLY_BASE_CHANNEL");function Ic(e){if(e[OS]===!0)return e;let t={};for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;let n=e[r];PS(n)&&(t[r]=n)}return Object.assign(t,{[OS]:!0}),t}function dh(e,t){let r=Ic(e),n={};for(let i in r){if(!Object.prototype.hasOwnProperty.call(r,i))continue;let a=t.channel_values[i];n[i]=r[i].fromCheckpoint(a)}return Object.assign(n,{[OS]:!0}),n}function NS(e,t){if(!t9.test(t))throw new TypeError(`Invalid task id for exit delta: ${t}`);let r=t.toLowerCase().split("-");return`${String(e).padStart(8,"0")}-${r[1]}-${r[2]}-${r[3]}-${r[4]}`}function fh(e,t){let r=new Set,n=Ik();for(let i in e){if(!Object.prototype.hasOwnProperty.call(e,i))continue;let a=e[i];if(!an(a)||!a.isAvailable())continue;let[o,s]=t[i]??[0,0];(o>=a.snapshotFrequency||s>=n)&&r.add(i)}return r}function Sn(e,t,r,n){let i=n?.channelsToSnapshot??new Set,{updatedChannels:a,getNextVersion:o}=n??{},s,c=e.channel_versions;if(t===void 0)s=e.channel_values;else{s={},c={...e.channel_versions};for(let l in t){if(!Object.prototype.hasOwnProperty.call(t,l))continue;let u=t[l];if(i.has(l)){o!==void 0&&(a===void 0||!a.has(l))&&(c[l]=o(c[l])),s[l]=new ns(u.get());continue}if(!an(u))try{s[l]=u.checkpoint()}catch(d){if(d.name!==je.unminifiable_name)throw d}}}return{v:4,id:n?.id??Gc(r),ts:new Date().toISOString(),channel_values:s,channel_versions:c,versions_seen:e.versions_seen}}async function Tc(e,t,r){let n=dh(e,t),{saver:i,config:a}=r??{},o=Ic(e),s=[];for(let l in o)Object.prototype.hasOwnProperty.call(o,l)&&an(o[l])&&!Object.prototype.hasOwnProperty.call(t.channel_values,l)&&s.push(l);if(s.length===0||i===void 0||a===void 0)return n;let c=await i.getDeltaChannelHistory({config:a,channels:s});for(let l of s){let u=c[l];if(u===void 0)continue;let d=o[l].fromCheckpoint(u.seed);d.replayWrites(u.writes),n[l]=d}return n}var r9=e=>e!=null&&e.lc_graph_name==="BinaryOperatorAggregate",Mi=class BR extends yt{lc_graph_name="BinaryOperatorAggregate";value;operator;initialValueFactory;constructor(t,r){super(),this.operator=t,this.initialValueFactory=r,this.value=r?.()}fromCheckpoint(t){let r=new BR(this.operator,this.initialValueFactory);return typeof t<"u"&&(r.value=t),r}update(t){let r=t;if(!r.length)return!1;if(this.value===void 0){let i=r[0],[a,o]=cn(i);a?this.value=o:this.value=i,r=r.slice(1)}let n=!1;for(let i of r)if(Wa(i)){if(n)throw new ve("Can receive only one Overwrite value per step.");let[,a]=cn(i);this.value=a,n=!0;continue}else!n&&this.value!==void 0&&(this.value=this.operator(this.value,i));return!0}get(){if(this.value===void 0)throw new je;return this.value}checkpoint(){if(this.value===void 0)throw new je;return this.value}isAvailable(){return this.value!==void 0}equals(t){return this===t?!0:r9(t)?this.operator===t.operator:!1}};var kn=class VR extends yt{lc_graph_name="LastValue";value=[];constructor(t){super(),this.initialValueFactory=t,t&&(this.value=[t()])}fromCheckpoint(t){let r=new VR(this.initialValueFactory);return typeof t<"u"&&(r.value=[t]),r}update(t){if(t.length===0)return!1;if(t.length!==1)throw new ve("LastValue can only receive one value per step.",{lc_error_code:"INVALID_CONCURRENT_GRAPH_UPDATE"});return this.value=[t[t.length-1]],!0}get(){if(this.value.length===0)throw new je;return this.value[0]}checkpoint(){if(this.value.length===0)throw new je;return this.value[0]}isAvailable(){return this.value.length!==0}},RS=class ZR extends yt{lc_graph_name="LastValueAfterFinish";value=[];finished=!1;fromCheckpoint(t){let r=new ZR;if(typeof t<"u"){let[n,i]=t;r.value=[n],r.finished=i}return r}update(t){return t.length===0?!1:(this.finished=!1,this.value=[t[t.length-1]],!0)}get(){if(this.value.length===0||!this.finished)throw new je;return this.value[0]}checkpoint(){if(this.value.length!==0)return[this.value[0],this.finished]}consume(){return this.finished?(this.finished=!1,this.value=[],!0):!1}finish(){return!this.finished&&this.value.length>0?(this.finished=!0,!0):!1}isAvailable(){return this.value.length!==0&&this.finished}};var ph=class{lc_graph_name="AnnotationRoot";spec;constructor(e){this.spec=e}static isInstance(e){return typeof e=="object"&&e!==null&&"lc_graph_name"in e&&e.lc_graph_name==="AnnotationRoot"}},Uu=function(e){return e?mh(e):new kn};Uu.Root=e=>new ph(e);function mh(e){return typeof e=="object"&&e&&"reducer"in e&&e.reducer?new Mi(e.reducer,e.default):typeof e=="object"&&e&&"value"in e&&e.value?new Mi(e.value,e.default):new kn}var n9=["tags","metadata","callbacks","configurable"],i9=["tags","metadata","callbacks","runName","maxConcurrency","recursionLimit","configurable","runId","outputKeys","streamMode","store","writer","interrupt","context","interruptBefore","interruptAfter","checkpointDuring","durability","signal","heartbeat","executionInfo","serverInfo","control"],a9=25,o9=new Set(["thread_id","checkpoint_id","checkpoint_ns","task_id","run_id","assistant_id","graph_id"]);function s9(e,t){if(!e)return t;let r=t??{};for(let n of o9){if(n in r)continue;let i=e[n];i!==void 0&&(r[n]=i)}return r}function HR(e){if(e==null||e.length===0)return;let t=e.filter(r=>!r.startsWith("seq:step"));return t.length>0?t:void 0}function c9(e,t){if(t===void 0)return e;if(e===void 0)return Array.isArray(t)?[...t]:t.copy();if(Array.isArray(t)){if(Array.isArray(e))return e.concat(t);let r=e.copy();for(let n of t)r.addHandler(_i(n),!0);return r}if(Array.isArray(e)){let r=t.copy();for(let n of e)r.addHandler(_i(n),!0);return r}return new Ye(t._parentRunId,{handlers:e.handlers.concat(t.handlers),inheritableHandlers:e.inheritableHandlers.concat(t.inheritableHandlers),tags:Array.from(new Set(e.tags.concat(t.tags))),inheritableTags:Array.from(new Set(e.inheritableTags.concat(t.inheritableTags))),metadata:{...e.metadata,...t.metadata},inheritableMetadata:{...e.inheritableMetadata,...t.inheritableMetadata}})}function l9(e){let t;for(let a=e.length-1;a>=0;a-=1)if(e[a]!==void 0){t=e[a];break}let r=t?.configurable?.thread_id!==void 0,n=e.some(a=>a?.configurable?.[tr]!==void 0),i=Re.getRunnableConfig()?.configurable?.[tr]!==void 0;return r&&!n&&!i}function Cc(...e){let t={tags:[],metadata:{},callbacks:void 0,recursionLimit:a9,configurable:{}},r=l9(e),n=Re.getRunnableConfig();if(n!==void 0){for(let[i,a]of Object.entries(n))if(a!==void 0){if(i==="configurable"&&r)continue;if(n9.includes(i)){let o;Array.isArray(a)?o=[...a]:typeof a=="object"?i==="callbacks"&&"copy"in a&&typeof a.copy=="function"?o=a.copy():o={...a}:o=a,t[i]=o}else t[i]=a}}for(let i of e)if(i!==void 0)for(let[a,o]of Object.entries(i))o===void 0||!i9.includes(a)||(a==="configurable"?t.configurable={...t.configurable,...o}:a==="metadata"?t.metadata={...t.metadata,...o}:a==="tags"?t.tags=[...t.tags??[],...o]:a==="callbacks"?t.callbacks=c9(t.callbacks,o):t[a]=o);return t.metadata=s9(t.configurable,t.metadata)??{},t}function u9(e){let t=e??Re.getRunnableConfig();if(t===void 0)throw new Error(["Config not retrievable. This is likely because you are running in an environment without support for AsyncLocalStorage.","If you're running `getStore` in such environment, pass the `config` from the node function directly."].join(`
430
+ `));return t?.store}function d9(e){let t=e??Re.getRunnableConfig();if(t===void 0)throw new Error(["Config not retrievable. This is likely because you are running in an environment without support for AsyncLocalStorage.","If you're running `getWriter` in such environment, pass the `config` from the node function directly."].join(`
431
+ `));return t?.writer||t?.configurable?.writer}function hh(){return Re.getRunnableConfig()}function f9(e){let t=e??Re.getRunnableConfig();if(t===void 0)throw new Error(["Config not retrievable. This is likely because you are running in an environment without support for AsyncLocalStorage.","If you're running `getCurrentTaskInput` in such environment, pass the `config` from the node function directly."].join(`
432
+ `));if(t.configurable?.__pregel_scratchpad?.currentTaskInput===void 0)throw new Error("BUG: internal scratchpad not initialized.");return t.configurable[rr].currentTaskInput}function gh(e){return e.split("|").filter(t=>!t.match(/^\d+$/)).map(t=>t.split(":")[0]).join("|")}function GR(e){let t=e.split("|");for(;t.length>1&&t[t.length-1].match(/^\d+$/);)t.pop();return t.slice(0,-1).join("|")}var MS=class{#e=void 0;requestDrain(e="shutdown"){this.#e=e}get drainRequested(){return this.#e!==void 0}get drainReason(){return this.#e}};var jS=["values","updates","messages","tools","custom","tasks"];function Ac(e){if(e==null||typeof e!="object")return!1;let t=e;return typeof t.id=="string"&&("source"in t||typeof t.step=="number")&&!("values"in t)&&!("config"in t)}function p9(e){if(!Array.isArray(e)||e.length!==2)return{data:e};let[t,r]=e;if(r==null||typeof r!="object")return{data:e};let n=r,i=typeof n.langgraph_node=="string"?n.langgraph_node:void 0,a=typeof n.run_id=="string"?n.run_id:void 0;return{data:a!=null&&t!=null&&typeof t=="object"?{...t,run_id:a}:t,node:i}}function DS({namespace:e,mode:t,payload:r,seq:n}){let i=Date.now(),a={type:"event"};switch(t){case"messages":{let{data:o,node:s}=p9(r);return[{...a,seq:n,method:"messages",params:{namespace:e,timestamp:i,...s?{node:s}:{},data:o}}]}case"tools":return[{...a,seq:n,method:"tools",params:{namespace:e,timestamp:i,data:m9(r)}}];case"checkpoints":return Ac(r)?[{...a,seq:n,method:"checkpoints",params:{namespace:e,timestamp:i,data:r}}]:[];case"values":return[{...a,seq:n,method:"values",params:{namespace:e,timestamp:i,data:r}}];case"updates":{let o=h9(r);return[{...a,seq:n,method:"updates",params:{namespace:e,timestamp:i,...typeof o.node=="string"?{node:o.node}:{},data:o}}]}case"custom":{let o=typeof r=="object"&&r!==null&&!Array.isArray(r)&&"name"in r?r:{payload:r};return[{...a,seq:n,method:"custom",params:{namespace:e,timestamp:i,data:o}}]}case"tasks":return[{...a,seq:n,method:"tasks",params:{namespace:e,timestamp:i,data:r}}];default:return[]}}function m9(e){if(typeof e!="object"||e===null)return{event:"tool-error",tool_call_id:"",message:"Unexpected tools payload shape"};let t=e,r=String(t.toolCallId??"");switch(t.event){case"on_tool_start":return{event:"tool-started",tool_call_id:r,tool_name:String(t.name??"unknown"),input:t.input};case"on_tool_event":return{event:"tool-output-delta",tool_call_id:r,delta:typeof t.data=="string"?t.data:JSON.stringify(t.data??"")};case"on_tool_end":return{event:"tool-finished",tool_call_id:r,output:t.output};case"on_tool_error":{let n=t.error;return{event:"tool-error",tool_call_id:r,message:typeof n=="object"&&n!==null&&"message"in n&&typeof n.message=="string"?n.message:String(n??"unknown error")}}default:return{event:"tool-error",tool_call_id:"",message:`Unknown tool event: ${String(t.event)}`}}}function h9(e){if(typeof e!="object"||e===null)return{values:{}};let t=Object.entries(e);if(t.length===0)return{values:{}};let[r,n]=t[0];return{node:r,values:typeof n=="object"&&n!==null?n:{value:n}}}var zS=Symbol.for("langgraph.stream_channel"),on=class US{[zS]=!0;channelName;#e=[];#t=[];#n=!1;#a;#i;constructor(t){this.channelName=t}static local(){return new US}static remote(t){return new US(t)}static isInstance(t){return typeof t=="object"&&t!==null&&zS in t&&t[zS]===!0}push(t){this.#e.push(t),this.#r(),this.#i?.(t)}iterate(t=0){let r=t;return{next:async()=>{for(;;){if(r<this.#e.length)return{value:this.#e[r++],done:!1};if(this.#n){if(this.#a)throw this.#a;return{value:void 0,done:!0}}await new Promise(n=>this.#t.push(n))}}}}toAsyncIterable(t=0){return{[Symbol.asyncIterator]:()=>this.iterate(t)}}toEventStream(t={}){let r=new TextEncoder,n=this.iterate(t.startAt),i=t.event??this.channelName,a=t.serialize??(o=>JSON.stringify(o)??"null");return new ReadableStream({async pull(o){try{let s=await n.next();if(s.done){o.close();return}let c=[];i!=null&&c.push(`event: ${i}`);for(let l of a(s.value).split(/\r\n|\r|\n/))c.push(`data: ${l}`);o.enqueue(r.encode(`${c.join(`
433
+ `)}
434
+
435
+ `))}catch(s){o.error(s)}},async cancel(){await n.return?.()}})}get(t){if(t<0||t>=this.#e.length)throw new RangeError(`StreamChannel index ${t} out of bounds (size=${this.#e.length})`);return this.#e[t]}get size(){return this.#e.length}get done(){return this.#n}close(){this.#n=!0,this.#r()}fail(t){this.#a=t,this.#n=!0,this.#r()}_wire(t){this.#i=t}_close(){this.close()}_fail(t){this.fail(t)}[Symbol.asyncIterator](){return this.iterate()}#r(){let t=this.#t.splice(0);for(let r of t)r()}};function WR(e){return on.isInstance(e)}var g9="custom:";function _9(e){return`${g9}${e}`}function y9(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}var _h=Symbol("resolveValues"),LS=Symbol("rejectValues"),JR=class{_events=on.local();_discoveries=on.local();#e=0;#t=!1;#n;#a=!1;#i=[];#r=[];#s=[];#o=new Map;#l=new Map;#c=[];#u=[];register(e,t){this.#o.set(vt(e),t)}addTransformer(e){let t=this._events.size;this.#r.push(e),e.onRegister&&e.onRegister({push:(r,n)=>this.push(r,n)});for(let r=0;r<t;r+=1)e.process(this._events.get(r));this.#t&&(this.#n!==void 0?e.fail?.(this.#n):e.finalize?.())}wireChannels(e){for(let[t,r]of Object.entries(e)){if(WR(r)){if(this.#s.push(r),typeof r.channelName!="string")continue;let n=_9(r.channelName);r._wire(i=>{this._events.push({type:"event",seq:this.#e++,method:n,params:{namespace:this.#i,timestamp:Date.now(),data:i}})});continue}y9(r)&&this.#u.push({name:t,promise:Promise.resolve(r)})}}push(e,t){t.method==="values"&&this.#l.set(vt(e),t.params.data);let r=this.#i;this.#i=e;let n=!0;for(let i of this.#r)i.process(t)||(n=!1);this.#i=r,n&&this._events.push({...t,seq:this.#e++})}close(){this.#t=!0;for(let[r,n]of this.#l.entries()){let i=r?r.split("\0"):[];this.#o.get(vt(i))?.[_h](n)}let e=[];for(let r of this.#r){let n=r.finalize?.();n!=null&&typeof n.then=="function"&&e.push(n)}for(let r of this.#s)r._close();let t=this.#u;t.length===0&&e.length===0?(this._events.close(),this._discoveries.close()):Promise.allSettled([...e,...t.map(async({name:r,promise:n})=>{try{let i=await n;this._events.done||this._events.push({type:"event",seq:this.#e++,method:"custom",params:{namespace:[],timestamp:Date.now(),data:{name:r,payload:i}}})}catch{}})]).then(()=>{this._events.close(),this._discoveries.close()});for(let r of this.#o.values())r[_h](void 0)}fail(e){this.#t=!0,this.#n=e;for(let t of this.#r)t.fail?.(e);for(let t of this.#s)t._fail(e);this._events.fail(e),this._discoveries.fail(e);for(let t of this.#o.values())t[LS](e)}markInterrupted(e){this.#a=!0,this.#c.push(...e)}get interrupted(){return this.#a}get interrupts(){return this.#c}subscribeEvents(e,t=0){let r=this._events.iterate(t);return{async next(){for(;;){let n=await r.next();if(n.done||ni(n.value.params.namespace,e))return n}}}}};async function KR(e,t){let r=0;try{for await(let n of e){let[i,a,o]=n;if(a==="values"&&Ja(o)){let c=o[Le];t.markInterrupted(c.map(l=>({interruptId:l.id??"",payload:l.value})))}let s=DS({namespace:i,mode:a,payload:o,seq:r});r+=s.length;for(let c of s)t.push(i,c)}}catch(n){t.fail(n);return}t.close()}function vt(e){return e.join("\0")}function ni(e,t){if(t.length>e.length)return!1;for(let r=0;r<t.length;r+=1)if(e[r]!==t[r])return!1;return!0}function yh(e,t,r=0){return{[Symbol.asyncIterator](){let n=e.iterate(r);return{async next(){for(;;){let i=await n.next();if(i.done)return{value:void 0,done:!0};if(ni(i.value.namespace,t))return{value:i.value,done:!1}}}}}}}var qR="root";function v9(e){if(e.length===0)return qR;let t=e[e.length-1],r=t.indexOf(":");return r===-1?t:t.slice(0,r)}function b9(e){if(e instanceof Error)return e.message;if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function ii(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function w9(e){if(!ii(e)||e.event!=="started")return;let t=e.cause;if(ii(t)&&typeof t.type=="string")return t}function x9(e){if(ii(e)&&"result"in e&&typeof e.name=="string"&&typeof e.id=="string"&&!e.name.startsWith("__"))return{name:e.name,id:e.id}}function FS(e={}){let t=e.rootGraphName??qR,r=e.initialStatus??"running",n=e.emitRootOnRegister??!0,i=e.getGraphName??v9,a=e.serializeError??b9,o=e.getTerminalStatusOverride,s=on.local(),c=new Map,l=new Map,u=new Map,d=new Map,f=new Set,p=[],m,h=0,_=!1,y=V=>{if(V.length===0)return t;let X=u.get(vt(V));return typeof X=="string"&&X.length>0?X:i(V)},w=(V,X)=>{let ne=vt(V);if(u.has(ne))return;let ie=(ii(X)&&ii(X.metadata)?X.metadata:void 0)?.lc_agent_name;u.set(ne,typeof ie=="string"?ie:void 0)},x=V=>{if(!ii(V))return;let X=V.id;if(typeof X!="string")return;let ne=V.input,ie;if(ii(ne)&&ii(ne.tool_call)){let Te=ne.tool_call.id;typeof Te=="string"&&(ie=Te)}else if(Array.isArray(ne)){for(let Te of ne)if(ii(Te)&&typeof Te.id=="string"){ie=Te.id;break}}ie!=null&&d.set(X,ie)},S=V=>{if(V.length===0)return;let X=u.get(vt(V));if(typeof X!="string"||X.length===0)return;let ne=V[V.length-1],ie=ne.indexOf(":");if(ie===-1)return;let Te=ne.slice(ie+1);if(Te.length===0)return;let Tr=d.get(Te);if(!(typeof Tr!="string"||Tr.length===0))return{type:"toolCall",tool_call_id:Tr}},E=V=>l.get(vt(V))??S(V),P=(V,X,ne)=>{let ie=vt(V),Te=c.get(ie),Tr=Te?.graphName??y(V);if(Te!=null&&Te.status===X&&Te.graphName===Tr&&ne?.error==null)return;Te==null?(Te={namespace:V,graphName:Tr,status:X},c.set(ie,Te)):Te.status=X;let Vi={event:X,graph_name:Tr,...ne?.cause!=null?{cause:ne.cause}:{},...ne?.error!=null?{error:ne.error}:{}},Zi=Date.now();if(s.push({namespace:V,timestamp:Zi,...Vi}),!(V.length===0&&!n)&&m!=null){h+=1;try{m.push(V,{type:"event",seq:0,method:"lifecycle",params:{namespace:V,timestamp:Zi,data:Vi}})}finally{h-=1}}},C=V=>{let X=vt(V),ne=c.get(X);return ne==null&&(ne={namespace:V,graphName:y(V),status:void 0},c.set(X,ne)),ne},b=()=>{if(p.length===0)return;let V=p.splice(0,p.length);for(let X of V){let ne=vt(X.namespace),ie=c.get(ne);ie==null||ie.status!=="started"||P(X.namespace,"completed")}},B=V=>{let X=vt(V.namespace),ne=c.get(X);ne==null||ne.status!=="started"||p.some(ie=>vt(ie.namespace)===X)||p.push(V)},L=(V,X)=>{for(let ne=p.length-1;ne>=0;ne-=1){let ie=p[ne];ie.source.type==="node"&&ie.source.node===X&&vt(ie.source.parent)===vt(V)&&p.splice(ne,1)}},q=V=>{for(let X=1;X<=V.length;X+=1){let ne=V.slice(0,X),ie=vt(ne);if(c.has(ie))continue;C(ne);let Te=E(ne);P(ne,"started",Te!=null?{cause:Te}:void 0)}},ae=()=>f.size>0?"interrupted":"completed",Se=V=>{for(let X of c.values())X.namespace.length!==0&&X.status==="started"&&P(X.namespace,V);P([],V),s.close()},Oe=async()=>{if(o==null)return ae();try{return await o()??ae()}catch{return ae()}},mt=(V,X)=>{let ne=`${X}:`;for(let ie of c.values()){if(ie.namespace.length!==V.length+1||ie.status!=="started"||!ni(ie.namespace,V))continue;let Te=ie.namespace[ie.namespace.length-1];if(Te===X||Te.startsWith(ne))return ie.namespace}},ye=(V,X)=>{let ne=[...V,`${X.name}:${X.id}`];return c.get(vt(ne))?.status==="started"?ne:void 0};return{__native:!0,init(){return{_lifecycleLog:s,lifecycle:yh(s,[],0)}},onRegister(V){m=V,C([]),n&&P([],r)},process(V){let X=V.params.namespace;if(h>0)return!0;let ne=V.method==="tasks"?x9(V.params.data):void 0;if(ne!=null?L(X,ne.name):V.method==="tasks"&&(w(X,V.params.data),x(V.params.data)),b(),V.method==="lifecycle"){let ie=w9(V.params.data);return ie!=null&&l.set(vt(X),ie),q(X),!1}if(q(X),V.method==="input"&&ii(V.params.data)&&V.params.data.event==="requested"){let ie=V.params.data.id;typeof ie=="string"&&f.add(ie)}if(ne!=null){let ie=ye(X,ne);ie!=null&&B({namespace:ie,source:{type:"task"}})}if(V.method==="updates"){let ie=V.params.node;if(typeof ie=="string"&&!ie.startsWith("__")){let Te=mt(X,ie);Te!=null&&B({namespace:Te,source:{type:"node",parent:X,node:ie}})}}return!0},finalize(){if(!_){if(_=!0,b(),o==null){Se(ae());return}return Oe().then(Se).catch(V=>{s.fail(V)})}},fail(V){if(_)return;_=!0;let X=a(V);for(let ne of c.values())ne.namespace.length!==0&&ne.status==="started"&&P(ne.namespace,"failed");P([],"failed",{error:X}),s.fail(V)}}}function Oc(e){let t=e;return typeof t.run_id=="string"?`run:${t.run_id}`:e.event==="message-start"&&typeof t.id=="string"?`message:${t.id}`:"__default__"}function Lu(e,t){let r=on.local(),n=new Map,i=new Set;return{init:()=>({messages:r.toAsyncIterable()}),process(a){if(a.method!=="messages"||!ni(a.params.namespace,e)||a.params.namespace.length!==e.length+1||t!==void 0&&a.params.node!==t)return!0;let o=a.params.data;switch(o.event){case"message-start":{let s=Oc(o);if(o.role==="tool"){i.add(s);break}let c=on.local(),l=Object.assign(new Pa(c.toAsyncIterable()),{namespace:a.params.namespace,node:a.params.node});n.set(s,{source:c,stream:l}),c.push(o),r.push(l);break}case"content-block-start":case"content-block-delta":case"content-block-finish":if(i.has(Oc(o)))break;n.get(Oc(o))?.source.push(o);break;case"message-finish":{let s=Oc(o);if(i.delete(s))break;let c=n.get(s);c&&(c.source.push(o),c.source.close(),n.delete(s));break}case"error":if(i.has(Oc(o)))break;n.get(Oc(o))?.source.push(o);break}return!0},finalize(){for(let[a,o]of n)o.source.push({event:"message-finish"}),o.source.close(),n.delete(a);i.clear(),r.close()},fail(a){for(let[o,s]of n)s.source.fail(a),n.delete(o);i.clear(),r.fail(a)}}}function Fu(e,t,r=0){let n=t.length+1;return{[Symbol.asyncIterator](){let i=e.iterate(r);return{async next(){for(;;){let a=await i.next();if(a.done)return{value:void 0,done:!0};let{ns:o,stream:s}=a.value;if(o.length===n&&ni(o,t))return{value:s,done:!1}}}}}}}function BS(e,t){let{createStream:r}=t,n=new Set;return{__native:!0,init(){return{_discoveries:e._discoveries,subgraphs:Fu(e._discoveries,[],0)}},process(i){let a=i.params.namespace;if(a.length===0)return!0;let o=a.slice(0,1),s=vt(o);if(n.has(s))return!0;n.add(s);let c=r(o,e._discoveries.size,e._events.size);return e.register(o,c),e._discoveries.push({ns:o,stream:c}),!0}}}function VS(e){let t=on.local();return{init:()=>({_valuesLog:t}),process(r){return r.method!=="values"||r.params.namespace.length!==e.length||!ni(r.params.namespace,e)||t.push(r.params.data),!0},finalize(){t.close()},fail(r){t.fail(r)}}}function vh(e){return"__native"in e&&e.__native===!0}var YR=Symbol("setValuesLog"),XR=Symbol("setMessagesIterable"),ZS=Symbol("setLifecycleIterable"),HS=Symbol("setSubgraphsIterable"),S9={[Symbol.asyncIterator](){return{next:()=>Promise.resolve({value:void 0,done:!0})}}},GS=class{path;extensions;_mux;#e;#t;#n;#a;#i;#r;#s;#o;#l;#c;constructor(e,t,r=0,n=0,i,a){this.path=e,this._mux=t,this.#t=r,this.#e=n,this.extensions=i??{},this.#n=a??new AbortController,this.#r=new Promise((o,s)=>{this.#a=o,this.#i=s}),this.#r.catch(()=>{})}[Symbol.asyncIterator](){return this._mux.subscribeEvents(this.path,this.#e)}get subgraphs(){return this.#c?this.#c:Fu(this._mux._discoveries,this.path,this.#t)}get values(){let e=this.#s,t=this.#r,r=this._mux,n=this.#e,i=this.path,a=e?e.toAsyncIterable():{[Symbol.asyncIterator]:()=>{let o=r.subscribeEvents(i,n);return{async next(){for(;;){let s=await o.next();if(s.done)return{value:void 0,done:!0};if(s.value.method==="values"&&s.value.params.namespace.length===i.length)return{value:s.value.params.data,done:!1}}}}}};return{[Symbol.asyncIterator]:()=>a[Symbol.asyncIterator](),then:t.then.bind(t)}}get messages(){if(this.#o)return this.#o;let e=Lu(this.path),t=e.init();return this._mux.addTransformer(e),this.#o=t.messages,this.#o}get lifecycle(){return this.#l??S9}messagesFrom(e){let t=Lu(this.path,e),r=t.init();return this._mux.addTransformer(t),r.messages}get output(){return this.#r}get interrupted(){return this._mux.interrupted}get interrupts(){return this._mux.interrupts}abort(e){this.#n.abort(e)}get signal(){return this.#n.signal}[_h](e){this.#a?.(e),this.#a=void 0}[LS](e){this.#i?.(e),this.#i=void 0}[YR](e){this.#s=e}[XR](e){this.#o=e}[ZS](e){this.#l=e}[HS](e){this.#c=e}},QR=class extends GS{name;index;constructor(e,t,r=0,n=0,i,a){super(e,t,r,n,i,a);let o=e[e.length-1]??"",s=o.lastIndexOf(":");if(s>=0){this.name=o.slice(0,s);let c=o.slice(s+1);this.index=/^\d+$/.test(c)?Number(c):0}else this.name=o,this.index=0}};function WS(e,t=[],r){let{abortController:n}=r instanceof AbortController?{abortController:r}:r??{},i=new JR,a=FS(),o=a.init(),s=o._lifecycleLog,c=BS(i,{createStream:(y,w,x)=>{let S=new QR(y,i,w,x);return S[HS](Fu(i._discoveries,y,w)),S[ZS](yh(s,y,s.size)),S}}),l=c.init();i.addTransformer(c),i.addTransformer(a);let u=VS([]),d=Lu([]);i.addTransformer(u),i.addTransformer(d);let f={},p=[];for(let y of t){let w=y();i.addTransformer(w);let x=w.init();vh(w)?p.push(x):Object.assign(f,x),typeof x=="object"&&x!==null&&!vh(w)&&i.wireChannels(x)}let m=new GS([],i,0,0,f,n);for(let y of p)Object.assign(m,y);let h=u.init();m[YR](h._valuesLog);let _=d.init();return m[XR](_.messages),m[ZS](o.lifecycle),m[HS](l.subgraphs),i.register([],m),KR(e,i).catch(y=>{}),m}var F=e=>BigInt(e),Ve=(e,t=0)=>new DataView(e.buffer,e.byteOffset+t,e.byteLength-t),nM=F("0x9E3779B1"),iM=F("0x85EBCA77"),k9=F("0xC2B2AE3D"),Ra=F("0x9E3779B185EBCA87"),Ko=F("0xC2B2AE3D27D4EB4F"),aM=F("0x165667B19E3779F9"),qS=F("0x85EBCA77C2B2AE63"),E9=F("0x27D4EB2F165667C5"),$9=F("0x165667919E3779F9"),I9=F("0x9FB21C651E98DF25"),T9=e=>{let t=e.length;if(t%2!==0)throw new Error("String should have an even number of characters");let r=t/2,n=new Uint8Array(r),i=0,a=0;for(;a<r;){let o=e.slice(i,i+=2);n[a]=Number.parseInt(o,16),a+=1}return Ve(n)},ai=T9("b8fe6c3923a44bbe7c01812cf721ad1cded46de9839097db7240a4a4b7b3671fcb79e64eccc0e578825ad07dccff7221b8084674f743248ee03590e6813a264c3c2852bb91c300cb88d0658b1b532ea371644897a20df94e3819ef46a9deacd8a8fa763fe39c343ff9dcbbc7c70b4f1d8a51e04bcdb45931c89f7ec9d9787364eac5ac8334d3ebc3c581a0fffa1363eb170ddd51b7f0da49d316552629d4689e2b16be587d47a1fc8ff8b8d17ad031ce45cb3a8f95160428afd7fbcabb4b407e"),Pc=(F(1)<<F(128))-F(1),xe=(F(1)<<F(64))-F(1),Sh=(F(1)<<F(32))-F(1),ji=64,oM=ji/8,C9=8,bh=4;function Nc(e){if(!e)throw new Error("Assert failed")}function A9(e){let t=new DataView(new ArrayBuffer(8));return t.setBigUint64(0,e,!0),t.getBigUint64(0,!1)}function O9(e){let t=e;return t=(t&F(65535))<<F(16)|(t&F(4294901760))>>F(16),t=(t&F(16711935))<<F(8)|(t&F(4278255360))>>F(8),t}function P9(e,t){return(e&Sh)*(t&Sh)&xe}function N9(e,t){return(e<<t|e>>F(32)-t)&Sh}function sM(e,t,r){for(let n=0;n<oM;n+=1){let i=t.getBigUint64(n*8,!0),a=i^r.getBigUint64(n*8,!0);e[n^1]+=i,e[n]+=P9(a,a>>F(32))}return e}function eM(e,t,r,n){for(let i=0;i<n;i+=1)sM(e,Ve(t,i*ji),Ve(r,i*8));return e}function R9(e,t){for(let r=0;r<oM;r+=1){let n=t.getBigUint64(r*8,!0),i=e[r];i=JS(i,F(47)),i^=n,i*=nM,e[r]=i&xe}return e}function wh(e,t){return cM(e[0]^t.getBigUint64(0,!0),e[1]^t.getBigUint64(C9,!0))}function tM(e,t,r){let n=r;return n+=wh(e.slice(0),Ve(t,0*bh)),n+=wh(e.slice(2),Ve(t,4*bh)),n+=wh(e.slice(4),Ve(t,8*bh)),n+=wh(e.slice(6),Ve(t,12*bh)),oi(n&xe)}function M9(e,t,r,n,i){let a=e,o=Math.floor((r.byteLength-ji)/8),s=ji*o,c=Math.floor((t.byteLength-1)/s);for(let l=0;l<c;l+=1)a=eM(a,Ve(t,l*s),r,o),a=i(a,Ve(r,r.byteLength-ji));{let l=Math.floor((t.byteLength-1-s*c)/ji);a=eM(a,Ve(t,c*s),r,l),a=n(a,Ve(t,t.byteLength-ji),Ve(r,r.byteLength-ji-7))}return a}function j9(e,t){let r=new BigUint64Array([k9,Ra,Ko,aM,qS,iM,E9,nM]);Nc(e.byteLength>128),r=M9(r,e,t,sM,R9),Nc(r.length*8===64);{let n=tM(r,Ve(t,11),F(e.byteLength)*Ra&xe);return tM(r,Ve(t,t.byteLength-ji-11),~(F(e.byteLength)*Ko)&xe)<<F(64)|n}}function cM(e,t){let r=e*t&Pc;return r&xe^r>>F(64)}function rM(e,t,r){return cM((e.getBigUint64(0,!0)^t.getBigUint64(0,!0)+r)&xe,(e.getBigUint64(8,!0)^t.getBigUint64(8,!0)-r)&xe)}function xh(e,t,r,n,i){let a=e&xe,o=e>>F(64)&xe;return a+=rM(t,n,i),a^=r.getBigUint64(0,!0)+r.getBigUint64(8,!0),a&=xe,o+=rM(r,Ve(n,16),i),o^=t.getBigUint64(0,!0)+t.getBigUint64(8,!0),o&=xe,o<<F(64)|a}function oi(e){let t=e;return t^=t>>F(37),t*=$9,t&=xe,t^=t>>F(32),t}function kh(e){let t=e;return t^=t>>F(33),t*=Ko,t&=xe,t^=t>>F(29),t*=aM,t&=xe,t^=t>>F(32),t}function D9(e,t,r){let n=e.byteLength;Nc(n>0&&n<=3);let i=F(e.getUint8(n-1))|F(n<<8)|F(e.getUint8(0)<<16)|F(e.getUint8(n>>1)<<24),a=(i^(F(t.getUint32(0,!0))^F(t.getUint32(4,!0)))+r)&xe,o=(F(t.getUint32(8,!0))^F(t.getUint32(12,!0)))-r;return(kh((N9(O9(i),F(13))^o)&xe)&xe)<<F(64)|kh(a)}function JS(e,t){return e^e>>t}function z9(e,t,r){let n=e.byteLength;Nc(n>=4&&n<=8);{let i=e.getUint32(0,!0),a=e.getUint32(n-4,!0),o=((F(i)|F(a)<<F(32))^(t.getBigUint64(16,!0)^t.getBigUint64(24,!0))+r&xe)*(Ra+(F(n)<<F(2)))&Pc;return o+=(o&xe)<<F(65),o&=Pc,o^=o>>F(67),JS(JS(o&xe,F(35))*I9&xe,F(28))|oi(o>>F(64))<<F(64)}}function U9(e,t,r){let n=e.byteLength;Nc(n>=9&&n<=16);{let i=(t.getBigUint64(32,!0)^t.getBigUint64(40,!0))+r&xe,a=(t.getBigUint64(48,!0)^t.getBigUint64(56,!0))-r&xe,o=e.getBigUint64(0,!0),s=e.getBigUint64(n-8,!0),c=(o^s^i)*Ra,l=(c&xe)+(F(n-1)<<F(54));c=c&(Pc^xe)|l,s^=a,c+=s+(s&Sh)*(iM-F(1))<<F(64),c&=Pc,c^=A9(c>>F(64));let u=(c&xe)*Ko;return u+=(c>>F(64))*Ko<<F(64),u&=Pc,oi(u&xe)|oi(u>>F(64))<<F(64)}}function L9(e,t){let r=e.byteLength;return Nc(r<=16),r>8?U9(e,ai,t):r>=4?z9(e,ai,t):r>0?D9(e,ai,t):kh(t^ai.getBigUint64(64,!0)^ai.getBigUint64(72,!0))|kh(t^ai.getBigUint64(80,!0)^ai.getBigUint64(88,!0))<<F(64)}function KS(e){return~e+F(1)&xe}function F9(e,t,r){let n=F(e.byteLength)*Ra&xe,i=F(e.byteLength-1)/F(32);for(;i>=0;){let s=Number(i);n=xh(n,Ve(e,16*s),Ve(e,e.byteLength-16*(s+1)),Ve(t,32*s),r),i-=F(1)}let a=n+(n>>F(64))&xe;a=oi(a);let o=(n&xe)*Ra+(n>>F(64))*qS+(F(e.byteLength)-r&xe)*Ko;return o&=xe,o=KS(oi(o)),a|o<<F(64)}function B9(e,t,r){let n=F(e.byteLength)*Ra&xe;for(let o=32;o<160;o+=32)n=xh(n,Ve(e,o-32),Ve(e,o-16),Ve(t,o-32),r);n=oi(n&xe)|oi(n>>F(64))<<F(64);for(let o=160;o<=e.byteLength;o+=32)n=xh(n,Ve(e,o-32),Ve(e,o-16),Ve(t,3+o-160),r);n=xh(n,Ve(e,e.byteLength-16),Ve(e,e.byteLength-32),Ve(t,103),KS(r));let i=n+(n>>F(64))&xe;i=oi(i);let a=(n&xe)*Ra+(n>>F(64))*qS+(F(e.byteLength)-r&xe)*Ko;return a&=xe,a=KS(oi(a)),i|a<<F(64)}function si(e,t=F(0)){let r=new TextEncoder,n=Ve(typeof e=="string"?r.encode(e):e),i=n.byteLength,a=o=>o.toString(16).padStart(32,"0");return i<=16?a(L9(n,t)):i<=128?a(F9(n,ai,t)):i<=240?a(B9(n,ai,t)):a(j9(n,ai))}function Eh(e){return/^[0-9a-f]{32}$/.test(e)}function YS(e){let t=Re.getRunnableConfig();if(!t)throw new Error("Called interrupt() outside the context of a graph.");let r=t.configurable;if(!r)throw new Error("No configurable found in config");if(!r.__pregel_checkpointer)throw new Ka("No checkpointer set",{lc_error_code:"MISSING_CHECKPOINTER"});let n=r[rr];n.interruptCounter+=1;let i=n.interruptCounter;if(n.resume.length>0&&i<n.resume.length)return r[Bt]?.([[nr,n.resume]]),n.resume[i];if(n.nullResume!==void 0){if(n.resume.length!==i)throw new Error(`Resume length mismatch: ${n.resume.length} !== ${i}`);let o=n.consumeNullResume();return n.resume.push(o),r[Bt]?.([[nr,n.resume]]),o}let a=r[Cr]?.split("|");throw new li([{id:a?si(a.join("|")):void 0,value:e}])}var Mt=class extends se{lc_namespace=["langgraph"];func;tags;config;trace=!0;recurse=!0;constructor(e){super(),this.name=e.name??e.func.name,this.func=e.func,this.config=e.tags?{tags:e.tags}:void 0,this.trace=e.trace??this.trace,this.recurse=e.recurse??this.recurse}async _tracedInvoke(e,t,r){return new Promise((n,i)=>{let a=$e(t,{callbacks:r?.getChild()});Re.runWithConfig(a,async()=>{try{n(await this.func(e,a))}catch(o){i(o)}})})}async invoke(e,t){let r,n=Cc(t),i=$t(this.config,n);return this.trace?r=await this._callWithConfig(this._tracedInvoke,e,i):r=await Re.runWithConfig(i,async()=>this.func(e,i)),se.isRunnable(r)&&this.recurse?await Re.runWithConfig(i,async()=>r.invoke(e,i)):r}};function*ci(e,t){if(t===void 0)yield*e;else for(let r of e)yield[t,r]}async function En(e){let t=[];for await(let r of await e)t.push(r);return t}function Ma(e){let t=[];for(let r of e)t.push(r);return t}function qo(e,t){return e?"configurable"in e?{...e,configurable:{...e.configurable,...t}}:{...e,configurable:t}:{configurable:t}}function XS(e){return e!=null&&typeof e=="function"&&e instanceof Object.getPrototypeOf(async function*(){}).constructor}function QS(e){return e!=null&&typeof e=="function"&&e instanceof Object.getPrototypeOf(function*(){}).constructor}function V9(e){return typeof e=="object"&&e?.[Symbol.for("LG_SKIP_WRITE")]!==void 0}var Ir={[Symbol.for("LG_PASSTHROUGH")]:!0};function $h(e){return typeof e=="object"&&e?.[Symbol.for("LG_PASSTHROUGH")]!==void 0}var ek=Symbol("IS_WRITER"),ut=class rk extends Mt{writes;constructor(t,r){let n=`ChannelWrite<${t.map(i=>wt(i)?i.node:"channel"in i?i.channel:"...").join(",")}>`;super({writes:t,name:n,tags:r,trace:!1,func:async(i,a)=>this._write(i,a??{})}),this.writes=t}async _write(t,r){let n=this.writes.map(i=>tk(i)&&$h(i.value)?{mapper:i.mapper,value:t}:Ih(i)&&$h(i.value)?{channel:i.channel,value:t,skipNone:i.skipNone,mapper:i.mapper}:i);return await rk.doWrite(r,n),t}static async doWrite(t,r){for(let a of r){if(Ih(a)){if(a.channel==="__pregel_tasks")throw new ve("Cannot write to the reserved channel TASKS");if($h(a.value))throw new ve("PASSTHROUGH value must be replaced")}if(tk(a)&&$h(a.value))throw new ve("PASSTHROUGH value must be replaced")}let n=[];for(let a of r)if(wt(a))n.push([Mn,a]);else if(tk(a)){let o=await a.mapper.invoke(a.value,t);o!=null&&o.length>0&&n.push(...o)}else if(Ih(a)){let o=a.mapper!==void 0?await a.mapper.invoke(a.value,t):a.value;if(V9(o)||a.skipNone&&o===void 0)continue;n.push([a.channel,o])}else throw new Error(`Invalid write entry: ${JSON.stringify(a)}`);let i=t.configurable?.[Bt];i(n)}static isWriter(t){return t instanceof rk||ek in t&&!!t[ek]}static registerWriter(t){return Object.defineProperty(t,ek,{value:!0})}};function Ih(e){return e!==void 0&&typeof e.channel=="string"}function tk(e){return e!==void 0&&!Ih(e)&&se.isRunnable(e.mapper)}var lM=class uM extends Mt{lc_graph_name="ChannelRead";channel;fresh=!1;mapper;constructor(t,r,n=!1){super({trace:!1,func:(i,a)=>uM.doRead(a,this.channel,this.fresh,this.mapper)}),this.fresh=n,this.mapper=r,this.channel=t,this.name=Array.isArray(t)?`ChannelRead<${t.join(",")}>`:`ChannelRead<${t}>`}static doRead(t,r,n,i){let a=t.configurable?.[tr];if(!a)throw new Error("Runnable is not configured with a read function. Make sure to call in the context of a Pregel process");return i?i(a(r,n)):a(r,n)}},Rc=new Oi,$n=class Bu extends en{lc_graph_name="PregelNode";channels;triggers=[];mapper;writers=[];bound=Rc;kwargs={};metadata={};tags=[];retryPolicy;cachePolicy;timeout;subgraphs;ends;isErrorHandler;errorHandlerNode;constructor(t){let{channels:r,triggers:n,mapper:i,writers:a,bound:o,kwargs:s,metadata:c,retryPolicy:l,cachePolicy:u,timeout:d,tags:f,subgraphs:p,ends:m,isErrorHandler:h,errorHandlerNode:_}=t,y=[...t.config?.tags?t.config.tags:[],...f??[]];super({...t,bound:t.bound??Rc,config:{...t.config?t.config:{},tags:y}}),this.channels=r,this.triggers=n,this.mapper=i,this.writers=a??this.writers,this.bound=o??this.bound,this.kwargs=s??this.kwargs,this.metadata=c??this.metadata,this.tags=y,this.retryPolicy=l,this.cachePolicy=u,this.timeout=d,this.subgraphs=p,this.ends=m,this.isErrorHandler=h,this.errorHandlerNode=_}getWriters(){let t=[...this.writers];for(;t.length>1&&t[t.length-1]instanceof ut&&t[t.length-2]instanceof ut;){let r=t.slice(-2),n=r[0].writes.concat(r[1].writes);t[t.length-2]=new ut(n,r[0].config?.tags),t.pop()}return t}getNode(){let t=this.getWriters();if(!(this.bound===Rc&&t.length===0))return this.bound===Rc&&t.length===1?t[0]:this.bound===Rc?new Lr({first:t[0],middle:t.slice(1,t.length-1),last:t[t.length-1],omitSequenceTags:!0}):t.length>0?new Lr({first:this.bound,middle:t.slice(0,t.length-1),last:t[t.length-1],omitSequenceTags:!0}):this.bound}join(t){if(!Array.isArray(t))throw new Error("channels must be a list");if(typeof this.channels!="object")throw new Error("all channels must be named when using .join()");return new Bu({channels:{...this.channels,...Object.fromEntries(t.map(r=>[r,r]))},triggers:this.triggers,mapper:this.mapper,writers:this.writers,bound:this.bound,kwargs:this.kwargs,config:this.config,retryPolicy:this.retryPolicy,cachePolicy:this.cachePolicy,timeout:this.timeout})}pipe(t){return ut.isWriter(t)?new Bu({channels:this.channels,triggers:this.triggers,mapper:this.mapper,writers:[...this.writers,t],bound:this.bound,config:this.config,kwargs:this.kwargs,retryPolicy:this.retryPolicy,cachePolicy:this.cachePolicy,timeout:this.timeout}):this.bound===Rc?new Bu({channels:this.channels,triggers:this.triggers,mapper:this.mapper,writers:this.writers,bound:at(t),config:this.config,kwargs:this.kwargs,retryPolicy:this.retryPolicy,cachePolicy:this.cachePolicy,timeout:this.timeout}):new Bu({channels:this.channels,triggers:this.triggers,mapper:this.mapper,writers:this.writers,bound:this.bound.pipe(t),config:this.config,kwargs:this.kwargs,retryPolicy:this.retryPolicy,cachePolicy:this.cachePolicy,timeout:this.timeout})}};function Z9(e){return"steps"in e&&Array.isArray(e.steps)}function Vu(e){return"lg_is_pregel"in e&&e.lg_is_pregel===!0}function Th(e){let t=[e];for(let r of t){if(Vu(r))return r;Z9(r)&&t.push(...r.steps)}}function Yo(e,t,r=!0,n=!1){try{return e[t].get()}catch(i){if(i.name===je.unminifiable_name){if(n)return i;if(r)return null}throw i}}function In(e,t,r=!0){if(Array.isArray(t)){let n={};for(let i of t)try{n[i]=Yo(e,i,!r)}catch(a){if(a.name===je.unminifiable_name)continue}return n}else return Yo(e,t)}function*dM(e,t){if(e.graph===_r.PARENT)throw new ve("There is no parent graph.");if(e.goto){let r;Array.isArray(e.goto)?r=e.goto:r=[e.goto];for(let n of r)if(wt(n))yield[ar,Mn,n];else if(typeof n=="string")yield[ar,`branch:to:${n}`,"__start__"];else throw new Error(`In Command.send, expected Send or string, got ${typeof n}`)}if(e.resume)if(typeof e.resume=="object"&&Object.keys(e.resume).length&&Object.keys(e.resume).every(Eh))for(let[r,n]of Object.entries(e.resume)){let i=t.filter(a=>a[0]===r&&a[1]==="__resume__").map(a=>a[2]).slice(0,1)??[];i.push(n),yield[r,nr,i]}else yield[ar,nr,e.resume];if(e.update){if(typeof e.update!="object"||!e.update)throw new Error("Expected cmd.update to be a dict mapping channel names to update values");if(Array.isArray(e.update))for(let[r,n]of e.update)yield[ar,r,n];else for(let[r,n]of Object.entries(e.update))yield[ar,r,n]}}function*Ch(e,t){if(t!=null)if(Array.isArray(e)&&typeof t=="object"&&!Array.isArray(t))for(let r in t)e.includes(r)&&(yield[r,t[r]]);else{if(Array.isArray(e))throw new Error('Input chunk must be an object when "inputChannels" is an array');yield[e,t]}}function*Ah(e,t,r){Array.isArray(e)?(t===!0||t.find(([n,i])=>e.includes(n)))&&(yield In(r,e)):(t===!0||t.some(([n,i])=>n===e))&&(yield Yo(r,e))}function*fM(e,t,r){let n=t.filter(([s,c])=>(s.config===void 0||!s.config.tags?.includes("langsmith:hidden"))&&c[0][0]!=="__error__"&&c[0][0]!=="__interrupt__");if(!n.length)return;let i;n.some(([s])=>s.writes.some(([c,l])=>c==="__return__"))?i=n.flatMap(([s])=>s.writes.filter(([c,l])=>c===Ki).map(([c,l])=>[s.name,l])):Array.isArray(e)?i=n.flatMap(([s])=>{let{writes:c}=s,l={};for(let[u]of c)e.includes(u)&&(l[u]=(l[u]||0)+1);return Object.values(l).some(u=>u>1)?c.filter(([u])=>e.includes(u)).map(([u,d])=>[s.name,{[u]:d}]):[[s.name,Object.fromEntries(c.filter(([u])=>e.includes(u)))]]}):i=n.flatMap(([s])=>s.writes.filter(([c,l])=>c===e).map(([c,l])=>[s.name,l]));let a={};for(let[s,c]of i)s in a||(a[s]=[]),a[s].push(c);let o={};for(let s in a)if(a[s].length===1){let[c]=a[s];o[s]=c}else o[s]=a[s];r&&(o.__metadata__={cached:r}),yield o}function Oh(e){let t=typeof e[Je];if(t==="number")return 0;if(t==="string")return"";for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;let n=typeof e[r];if(n==="number")return 0;if(n==="string")return"";break}}function Mc(e,t){if(Object.keys(e).length>0){let r=Oh(t);return Object.fromEntries(Object.entries(t).filter(([n,i])=>i>(e[n]??r)))}else return t}function pM(e,t){return e&&!Array.isArray(e)&&!(e instanceof Date)&&typeof e=="object"?e:{[t]:e}}function Tt(e,t){return e===null?{configurable:t}:e?.configurable===void 0?{...e,configurable:t}:{...e,configurable:{...e.configurable,...t}}}function ja(e,t){let r=t?.parents??{};return Object.keys(r).length>0?Tt(e,{[Vt]:{...r,[e.configurable?.checkpoint_ns??""]:e.configurable?.checkpoint_id}}):e}function Da(...e){let t=[...new Set(e.filter(Boolean))];if(t.length===0)return{signal:void 0,dispose:void 0};if(t.length===1)return{signal:t[0],dispose:void 0};let r=new AbortController,n=()=>{let a=t.find(o=>o.aborted)?.reason;r.abort(a),t.forEach(o=>o.removeEventListener("abort",n))};t.forEach(a=>a.addEventListener("abort",n,{once:!0}));let i=t.find(a=>a.aborted);return i&&r.abort(i.reason),{signal:r.signal,dispose:()=>{t.forEach(a=>a.removeEventListener("abort",n))}}}var mM=class{func;name;input;retry;cache;timeout;callbacks;__lg_type="call";constructor({func:e,name:t,input:r,retry:n,cache:i,timeout:a,callbacks:o}){this.func=e,this.name=t,this.input=r,this.retry=n,this.cache=i,this.timeout=a,this.callbacks=o}};function hM(e){return typeof e=="object"&&e!==null&&"__lg_type"in e&&e.__lg_type==="call"}function gM(e,t){return new Lr({name:e,first:new Mt({func:r=>t(...r),name:e,trace:!1,recurse:!1}),last:new ut([{channel:Ki,value:Ir}],[ht])})}function _M(e,t){return new Mt({func:(r,n)=>t(r,n),name:e,trace:!1,recurse:!1})}function yM({func:e,name:t,cache:r,retry:n,timeout:i},...a){let o=Re.getRunnableConfig();if(typeof o.configurable?.__pregel_call=="function")return o.configurable[Rn](e,t,a,{retry:n,cache:r,timeout:i,callbacks:o.callbacks});throw new Error("Async local storage not initialized. Please call initializeAsyncLocalStorageSingleton() before using this function.")}var vM=e=>e!==void 0?e+1:1;function H9(e,t){if(t==null)return!1;for(let r of e)if(t[r])return!0;return!1}function G9(e){let t;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t==null?t=e[r]:t=ju(t,e[r]));return t}function Zu(e,t,r){let n=Oh(e.channel_versions),i=e.versions_seen.__interrupt__??{},a=!1;if((e.channel_versions.__start__??n)>(i.__start__??n))a=!0;else for(let s in e.channel_versions)if(Object.prototype.hasOwnProperty.call(e.channel_versions,s)&&e.channel_versions[s]>(i[s]??n)){a=!0;break}let o=r.some(s=>t==="*"?!s.config?.tags?.includes(ht):t.includes(s.name));return a&&o}function jc(e,t,r,n,i=!1){let a=new Set;if(Array.isArray(n))a=new Set(n.filter(s=>r.writes.some(([c,l])=>c===s)));else{for(let[s]of r.writes)if(s===n){a=new Set([s]);break}a=a||new Set}let o;if(i&&a.size>0){let s=Object.fromEntries(Object.entries(t).filter(([d,f])=>a.has(d))),c=new Set;for(let d in s){if(!Object.prototype.hasOwnProperty.call(s,d))continue;let f=s[d];an(f)&&f.isAvailable()&&c.add(d)}let l=Sn(e,s,-1,{channelsToSnapshot:c}),u=dh(s,l);hr(xn(l),u,[r],void 0,void 0),o=In({...t,...u},n)}else o=In(t,n);return o}function Ph(e,t,r){for(let[n,i]of r)if(["__pregel_push","__pregel_tasks"].includes(n)&&i!=null){if(!wt(i))throw new ve(`Invalid packet type, expected SendProtocol, got ${JSON.stringify(i)}`);if(!(i.node in t))throw new ve(`Invalid node name "${i.node}" in Send packet`)}e(r)}var W9=new Set([Bc,ir,nr,Le,Ki,Gi,Uc]),J9=new Set(Ak);function hr(e,t,r,n,i){let a=new Map;for(let m of r)a.set(m,m.path?.slice(0,3)||[]);r.sort((m,h)=>{let _=a.get(m),y=a.get(h);for(let w=0;w<Math.min(_.length,y.length);w+=1){if(_[w]<y[w])return-1;if(_[w]>y[w])return 1}return _.length-y.length});let o=Ic(t),s=!1,c=new Set;for(let m of r){m.triggers.length>0&&(s=!0),e.versions_seen[m.name]??={};for(let h of m.triggers)h in e.channel_versions&&(e.versions_seen[m.name][h]=e.channel_versions[h]),J9.has(h)||c.add(h)}let l=G9(e.channel_versions),u=!1;for(let m of c)m in o&&o[m].consume()&&n!==void 0&&(e.channel_versions[m]=n(l),u=!0);let d={},f={};for(let m of r){let h=m.id??"";for(let[_,y]of m.writes)W9.has(_)||_ in o&&(d[_]??=[],d[_].push(y),f[_]??=[],f[_].push(h))}for(let[m,h]of Object.entries(d)){if(h.length<2||o[m]?.lc_graph_name!=="DeltaChannel")continue;let _=f[m],y=h.map((w,x)=>({val:w,taskId:_[x]}));y.sort((w,x)=>w.taskId<x.taskId?-1:w.taskId>x.taskId?1:0),d[m]=y.map(w=>w.val)}l!=null&&n!=null&&(l=u?n(l):l);let p=new Set;for(let[m,h]of Object.entries(d))if(m in o){let _=o[m],y;try{y=_.update(h)}catch(w){if(w.name===ve.unminifiable_name){let x=new ve(`Invalid update for channel "${m}" with values ${JSON.stringify(h)}: ${w.message}`);throw x.lc_error_code=w.lc_error_code,x}else throw w}y&&n!==void 0&&(e.channel_versions[m]=n(l),_.isAvailable()&&p.add(m))}if(s)for(let m in o){if(!Object.prototype.hasOwnProperty.call(o,m))continue;let h=o[m];h.isAvailable()&&!p.has(m)&&h.update([])&&n!==void 0&&(e.channel_versions[m]=n(l),h.isAvailable()&&p.add(m))}if(s&&!H9(p,i))for(let m in o){if(!Object.prototype.hasOwnProperty.call(o,m))continue;let h=o[m];h.finish()&&n!==void 0&&(e.channel_versions[m]=n(l),h.isAvailable()&&p.add(m))}return p}function*K9(e,t,r){if(r.updatedChannels!=null&&r.triggerToNodes!=null){let n=new Set;for(let i of r.updatedChannels){let a=r.triggerToNodes[i];for(let o of a??[])n.add(o)}yield*[...n].sort();return}if(!(()=>{for(let n in e.channel_versions)if(e.channel_versions[n]!==null)return!1;return!0})())for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&(yield n)}function q9(e){let t,r=new Map,n=new Set;if(e)for(let[i,a,o]of e){if(i==="00000000-0000-0000-0000-000000000000"&&a==="__resume__"&&t===void 0&&(t=o),a==="__resume__"&&i!=="00000000-0000-0000-0000-000000000000"){let s=r.get(i);s||(s=[],r.set(i,s)),s.push(o)}a!=="__error__"&&n.add(i)}return{nullResume:t,resumeByTaskId:r,successfulWriteTaskIds:n}}function za(e,t,r,n,i,a,o){let s={},c=o.pendingWritesIndex?o:{...o,pendingWritesIndex:q9(t)},l=n[Mn];if(l?.isAvailable()){let u=l.get().length;for(let d=0;d<u;d+=1){let f=Rh([ir,d],e,t,r,n,i,a,c);f!==void 0&&(s[f.id]=f)}}for(let u of K9(e,r,c)){let d=Rh([Qu,u],e,t,r,n,i,a,c);d!==void 0&&(s[d.id]=d)}return s}function Rh(e,t,r,n,i,a,o,s){let{step:c,checkpointer:l,manager:u}=s,d=a.configurable??{},f=d.checkpoint_ns??"";if(e[0]==="__pregel_push"&&hM(e[e.length-1])){let p=e[e.length-1],m=gM(p.name,p.func),h=[ir],_=f===""?p.name:`${f}|${p.name}`,y=jn(JSON.stringify([_,c.toString(),p.name,ir,e[1],e[2]]),t.id),w=`${_}:${y}`,x=[...e.slice(0,3),!0],S={langgraph_step:c,langgraph_node:p.name,langgraph_triggers:h,langgraph_path:x,langgraph_checkpoint_ns:w,checkpoint_ns:w};if(o){let E=[],P={checkpointId:t.id,checkpointNs:w,taskId:y,threadId:d.thread_id,runId:a.runId!=null?String(a.runId):void 0,nodeAttempt:1};return{name:p.name,input:p.input,proc:m,writes:E,config:{...$e($t(a,{metadata:S,store:s.store??a.store}),{runName:p.name,callbacks:u?.getChild(`graph:step:${c}`),configurable:{[ts]:y,[Bt]:C=>Ph(b=>E.push(...b),n,C),[tr]:(C,b=!1)=>jc(t,i,{name:p.name,writes:E,triggers:h,path:x},C,b),[Vr]:l??d.__pregel_checkpointer,[Vt]:{...d[Vt],[f]:t.id},[rr]:Nh({pendingWrites:r??[],taskId:y,currentTaskInput:p.input,resumeMap:a.configurable?.[Ga],namespaceHash:si(w),pendingWritesIndex:s.pendingWritesIndex}),[Wi]:t.channel_values[qi],checkpoint_id:void 0,checkpoint_ns:w}}),executionInfo:P},triggers:h,retry_policy:p.retry,cache_key:p.cache?{key:si((p.cache.keyFunc??JSON.stringify)([p.input])),ns:[Yu,p.name??"__dynamic__"],ttl:p.cache.ttl}:void 0,id:y,path:x,writers:[],timeout:p.timeout}}else return{id:y,name:p.name,interrupts:[],path:x}}else if(e[0]==="__pregel_push"){let p=typeof e[1]=="number"?e[1]:parseInt(e[1],10);if(!i.__pregel_tasks?.isAvailable())return;let m=i[Mn].get();if(p<0||p>=m.length)return;let h=ed(m[p])&&!wt(m[p])?new Za(m[p].node,m[p].args,m[p].timeout!==void 0?{timeout:m[p].timeout}:void 0):m[p];if(!ed(h)){console.warn(`Ignoring invalid packet ${JSON.stringify(h)} in pending sends.`);return}if(!(h.node in n)){console.warn(`Ignoring unknown node name ${h.node} in pending sends.`);return}let _=[ir],y=f===""?h.node:`${f}|${h.node}`,w=jn(JSON.stringify([y,c.toString(),h.node,ir,p.toString()]),t.id),x=`${y}:${w}`,S={langgraph_step:c,langgraph_node:h.node,langgraph_triggers:_,langgraph_path:e.slice(0,3),langgraph_checkpoint_ns:x,checkpoint_ns:x};if(o){let E=n[h.node],P=E.getNode();if(P!==void 0){E.metadata!==void 0&&(S={...S,...E.metadata});let C=[],b={checkpointId:t.id,checkpointNs:x,taskId:w,threadId:d.thread_id,runId:a.runId!=null?String(a.runId):void 0,nodeAttempt:1};return{name:h.node,input:h.args,proc:P,subgraphs:E.subgraphs,writes:C,config:{...$e($t(a,{metadata:S,tags:E.tags,store:s.store??a.store}),{runName:h.node,callbacks:u?.getChild(`graph:step:${c}`),configurable:{[ts]:w,[Bt]:B=>Ph(L=>C.push(...L),n,B),[tr]:(B,L=!1)=>jc(t,i,{name:h.node,writes:C,triggers:_,path:e},B,L),[Vr]:l??d.__pregel_checkpointer,[Vt]:{...d[Vt],[f]:t.id},[rr]:Nh({pendingWrites:r??[],taskId:w,currentTaskInput:h.args,resumeMap:a.configurable?.[Ga],namespaceHash:si(x),pendingWritesIndex:s.pendingWritesIndex}),[Wi]:t.channel_values[qi],checkpoint_id:void 0,checkpoint_ns:x}}),executionInfo:b},triggers:_,retry_policy:E.retryPolicy,cache_key:E.cachePolicy?{key:si((E.cachePolicy.keyFunc??JSON.stringify)([h.args])),ns:[Yu,E.name??"__dynamic__",h.node],ttl:E.cachePolicy.ttl}:void 0,id:w,path:e,writers:E.getWriters(),timeout:h.timeout??E.timeout}}}else return{id:w,name:h.node,interrupts:[],path:e}}else if(e[0]==="__pregel_pull"){let p=e[1].toString(),m=n[p];if(m===void 0)return;if(r?.length){let w=f===""?p:`${f}|${p}`,x=jn(JSON.stringify([w,c.toString(),p,Qu,p]),t.id);if(s.pendingWritesIndex?s.pendingWritesIndex.successfulWriteTaskIds.has(x):r.some(S=>S[0]===x&&S[1]!=="__error__"))return}let h=Oh(t.channel_versions);if(h===void 0)return;let _=t.versions_seen[p]??{},y=m.triggers.find(w=>i[w].isAvailable()?(t.channel_versions[w]??h)>(_[w]??h):!1);if(y!==void 0){let w=Y9(m,i,o);if(w===void 0)return;let x=f===""?p:`${f}|${p}`,S=jn(JSON.stringify([x,c.toString(),p,Qu,[y]]),t.id),E=`${x}:${S}`,P={langgraph_step:c,langgraph_node:p,langgraph_triggers:[y],langgraph_path:e,langgraph_checkpoint_ns:E,checkpoint_ns:E};if(o){let C=m.getNode();if(C!==void 0){m.metadata!==void 0&&(P={...P,...m.metadata});let b=[],B={checkpointId:t.id,checkpointNs:E,taskId:S,threadId:d.thread_id,runId:a.runId!=null?String(a.runId):void 0,nodeAttempt:1};return{name:p,input:w,proc:C,subgraphs:m.subgraphs,writes:b,config:{...$e($t(a,{metadata:P,tags:m.tags,store:s.store??a.store}),{runName:p,callbacks:u?.getChild(`graph:step:${c}`),configurable:{[ts]:S,[Bt]:L=>Ph(q=>{b.push(...q)},n,L),[tr]:(L,q=!1)=>jc(t,i,{name:p,writes:b,triggers:[y],path:e},L,q),[Vr]:l??d.__pregel_checkpointer,[Vt]:{...d[Vt],[f]:t.id},[rr]:Nh({pendingWrites:r??[],taskId:S,currentTaskInput:w,resumeMap:a.configurable?.[Ga],namespaceHash:si(E),pendingWritesIndex:s.pendingWritesIndex}),[Wi]:t.channel_values[qi],checkpoint_id:void 0,checkpoint_ns:E}}),executionInfo:B},triggers:[y],retry_policy:m.retryPolicy,cache_key:m.cachePolicy?{key:si((m.cachePolicy.keyFunc??JSON.stringify)([w])),ns:[Yu,m.name??"__dynamic__",p],ttl:m.cachePolicy.ttl}:void 0,id:S,path:e,writers:m.getWriters(),timeout:m.timeout}}}else return{id:S,name:p,interrupts:[],path:e}}}}function bM(e,t,r,n,i,a,o,s,c){let{step:l,checkpointer:u,manager:d}=c,f=a[t];if(f===void 0)return;let p=f.getNode();if(p===void 0)return;let m=s.configurable??{},h=m.checkpoint_ns??"",_=[ir],y=h===""?t:`${h}|${t}`,w=jn(JSON.stringify([y,l.toString(),t,ir,"node_error_handler",e.id]),n.id),x=`${y}:${w}`,S=[ir,String(e.name),t,!1],E={langgraph_step:l,langgraph_node:t,langgraph_triggers:_,langgraph_path:S,langgraph_checkpoint_ns:x,checkpoint_ns:x};f.metadata!==void 0&&(E={...E,...f.metadata});let P=[],C={checkpointId:n.id,checkpointNs:x,taskId:w,threadId:m.thread_id,runId:s.runId!=null?String(s.runId):void 0,nodeAttempt:1};return{name:t,input:e.input,proc:p,subgraphs:f.subgraphs,writes:P,config:{...$e($t(s,{metadata:E,tags:f.tags,store:c.store??s.store}),{runName:t,callbacks:d?.getChild(`graph:step:${l}`),configurable:{[ts]:w,[Bt]:b=>Ph(B=>P.push(...B),a,b),[tr]:(b,B=!1)=>jc(n,o,{name:t,writes:P,triggers:_,path:S},b,B),[Vr]:u??m.__pregel_checkpointer,[Vt]:{...m[Vt],[h]:n.id},[rr]:Nh({pendingWrites:i??[],taskId:w,currentTaskInput:e.input,resumeMap:s.configurable?.[Ga],namespaceHash:si(x)}),[Wi]:n.channel_values[qi],[Fc]:new ad(String(e.name),r),checkpoint_id:void 0,checkpoint_ns:x}}),executionInfo:C},triggers:_,retry_policy:f.retryPolicy,cache_key:void 0,id:w,path:S,writers:f.getWriters()}}function Y9(e,t,r){let n;if(typeof e.channels=="object"&&!Array.isArray(e.channels)){n={};for(let[i,a]of Object.entries(e.channels))if(e.triggers.includes(a))try{n[i]=Yo(t,a,!1)}catch(o){if(o.name===je.unminifiable_name)return;throw o}else if(a in t)try{n[i]=Yo(t,a,!1)}catch(o){if(o.name===je.unminifiable_name)continue;throw o}}else if(Array.isArray(e.channels)){let i=!1;for(let a of e.channels)try{n=Yo(t,a,!1),i=!0;break}catch(o){if(o.name===je.unminifiable_name)continue;throw o}if(!i)return}else throw new Error(`Invalid channels type, expected list or dict, got ${e.channels}`);return r&&e.mapper!==void 0&&(n=e.mapper(n)),n}function wM(e,t){if(typeof e.args!="object"||e.args===null)return e;let r={};for(let[n,i]of Object.entries(e.args)){let a=t[n];(!a||a.lc_graph_name!=="UntrackedValue")&&(r[n]=i)}return new Za(e.node,r)}function Nh({pendingWrites:e,taskId:t,currentTaskInput:r,resumeMap:n,namespaceHash:i,pendingWritesIndex:a}){let o=a?a.nullResume:e.find(([c,l])=>c==="00000000-0000-0000-0000-000000000000"&&l==="__resume__")?.[2],s={callCounter:0,interruptCounter:-1,resume:(()=>{let c=a?(a.resumeByTaskId.get(t)??[]).flat():e.filter(([l,u])=>l===t&&u==="__resume__").flatMap(([l,u,d])=>d);if(n!=null&&i in n){let l=n[i];c.push(l)}return c})(),nullResume:o,subgraphCounter:0,currentTaskInput:r,consumeNullResume:()=>{if(s.nullResume)return delete s.nullResume,e.splice(e.findIndex(([c,l])=>c==="00000000-0000-0000-0000-000000000000"&&l==="__resume__"),1),o}};return s}var Hu={blue:{start:"\x1B[34m",end:"\x1B[0m"},green:{start:"\x1B[32m",end:"\x1B[0m"},yellow:{start:"\x1B[33;1m",end:"\x1B[0m"}},Gu=(e,t)=>`${e.start}${t}${e.end}`;function X9(e){if(e==null)return;let t={};if(e.metadata!=null)for(let[n,i]of Object.entries(e.metadata))AS.has(n)||(t[n]=i);let r=HR(e.tags);return r!=null&&(t.tags=r),Object.keys(t).length>0?t:void 0}function*Mh(e){for(let{id:t,name:r,input:n,config:i,triggers:a,writes:o}of e){if(i?.tags?.includes("langsmith:hidden"))continue;let s={id:t,name:r,input:n,triggers:a,interrupts:o.filter(([l,u])=>l===t&&u==="__interrupt__").map(([,l])=>l)},c=X9(i);c!=null&&(s.metadata=c),yield s}}function Q9(e){return typeof e!="object"||e===null?!1:"$writes"in e&&Array.isArray(e.$writes)}function xM(e){let t={};for(let[r,n]of e){let i=String(r);if(i in t){let a=Q9(t[i])?t[i].$writes:[t[i]];a.push(n),t[i]={$writes:a}}else t[i]=n}return t}function*SM(e,t){for(let[{id:r,name:n,config:i},a]of e)i?.tags?.includes("langsmith:hidden")||(yield{id:r,name:n,result:xM(a.filter(([o])=>Array.isArray(t)?t.includes(o):o===t)),interrupts:a.filter(o=>o[0]===Le).map(o=>o[1])})}function*kM(e,t,r,n,i,a,o,s){function c(d){let f={};return d.callbacks!=null&&(f.callbacks=d.callbacks),d.configurable!=null&&(f.configurable=d.configurable),d.maxConcurrency!=null&&(f.max_concurrency=d.maxConcurrency),d.metadata!=null&&(f.metadata=d.metadata),d.recursionLimit!=null&&(f.recursion_limit=d.recursionLimit),d.runId!=null&&(f.run_id=d.runId),d.runName!=null&&(f.run_name=d.runName),d.tags!=null&&(f.tags=d.tags),f}let l=e.configurable?.checkpoint_ns,u={};for(let d of i){if(!(d.subgraphs?.length?d.subgraphs:[d.proc]).find(Th))continue;let f=`${d.name}:${d.id}`;l&&(f=`${l}|${f}`),u[d.id]={configurable:{thread_id:e.configurable?.thread_id,checkpoint_ns:f}}}yield{config:c(e),values:In(t,r),metadata:n,next:i.map(d=>d.name),tasks:nk(i,a,u,s),parentConfig:o?c(o):void 0}}function nk(e,t,r,n){return e.map(i=>{let a=t.find(([l,u])=>l===i.id&&u==="__error__")?.[2],o=t.filter(([l,u])=>l===i.id&&u==="__interrupt__").map(([,,l])=>l),s=(()=>{if(a||o.length||!t.length)return;let l=t.findIndex(([u,d])=>u===i.id&&d==="__return__");if(l>=0)return t[l][2];if(typeof n=="string")return t.find(([u,d])=>u===i.id&&d===n)?.[2];if(Array.isArray(n)){let u=t.filter(([d,f])=>d===i.id&&n.includes(f)).map(([,d,f])=>[d,f]);return u.length?xM(u):void 0}})();if(a)return{id:i.id,name:i.name,path:i.path,error:a,interrupts:o,result:s};let c=r?.[i.id];return{id:i.id,name:i.name,path:i.path,interrupts:o,...c!==void 0?{state:c}:{},result:s}})}function EM(e,t,r){console.log([`${Gu(Hu.blue,`[${e}:checkpoint]`)}`,`\x1B[1m State at the end of step ${e}:\x1B[0m
436
+ `,JSON.stringify(In(t,r),null,2)].join(""))}function Wu(e,t){let r=t.length;console.log([`${Gu(Hu.blue,`[${e}:tasks]`)}`,`\x1B[1m Starting step ${e} with ${r} task${r===1?"":"s"}:\x1B[0m
437
+ `,t.map(n=>`- ${Gu(Hu.green,String(n.name))} -> ${JSON.stringify(n.input,null,2)}`).join(`
438
+ `)].join(""))}function $M(e,t,r){let n={};for(let[i,a]of t)r.includes(i)&&(n[i]||(n[i]=[]),n[i].push(a));console.log([`${Gu(Hu.blue,`[${e}:writes]`)}`,`\x1B[1m Finished step ${e} with writes to ${Object.keys(n).length} channel${Object.keys(n).length!==1?"s":""}:\x1B[0m
439
+ `,Object.entries(n).map(([i,a])=>`- ${Gu(Hu.yellow,i)} -> ${a.map(o=>JSON.stringify(o)).join(", ")}`).join(`
440
+ `)].join(""))}var jh=class extends gt{_abortController;_innerReader;constructor(e,t){let r=e.getReader(),n=t??new AbortController;super({start(i){return a();function a(){return r.read().then(({done:o,value:s})=>{if(o){i.close();return}return i.enqueue(s),a()})}}}),this._abortController=n,this._innerReader=r}async cancel(e){this._abortController.abort(e),this._innerReader.releaseLock()}get signal(){return this._abortController.signal}},ak=class extends gt{modes;controller;passthroughFn;_closed=!1;get closed(){return this._closed}constructor(e){let t,r=new Promise(n=>{t=n});super({start:n=>{t(n)}}),r.then(n=>{this.controller=n}),this.passthroughFn=e.passthroughFn,this.modes=e.modes}push(e){this._closed||!this.controller||(this.passthroughFn?.(e),this.controller.enqueue(e))}close(){try{this.controller.close()}catch{}finally{this._closed=!0}}error(e){try{this.controller?.error(e)}finally{this._closed=!0}}},CM=class extends sr{name="StreamToolsHandler";awaitHandlers=!0;streamFn;runs={};constructor(e){super(),this.streamFn=e}handleToolStart(e,t,r,n,i,a,o,s){if(!a||i&&i.includes("langsmith:hidden"))return;let c=a.langgraph_checkpoint_ns?.split("|")??[],l={ns:c,toolCallId:s,toolName:o??"unknown",input:t};this.runs[r]=l,this.streamFn([c,"tools",{event:"on_tool_start",toolCallId:l.toolCallId,name:l.toolName,input:t}])}handleToolEvent(e,t){let r=this.runs[t];r&&this.streamFn([r.ns,"tools",{event:"on_tool_event",toolCallId:r.toolCallId,name:r.toolName,data:e}])}handleToolEnd(e,t){let r=this.runs[t];delete this.runs[t],r&&this.streamFn([r.ns,"tools",{event:"on_tool_end",toolCallId:r.toolCallId,name:r.toolName,output:e}])}handleToolError(e,t){let r=this.runs[t];delete this.runs[t],r&&this.streamFn([r.ns,"tools",{event:"on_tool_error",toolCallId:r.toolCallId,name:r.toolName,error:e}])}};function eZ(e){return JSON.stringify(e,function(t,r){let n=this[t];if(n!=null&&typeof n=="object"&&"toDict"in n&&typeof n.toDict=="function"){let{type:i,data:a}=n.toDict();return{...a,type:i}}return r})}function tZ(e){return e instanceof Error?{error:e.name,message:e.message}:{error:"Error",message:JSON.stringify(e)}}function ok(e){return typeof e!="object"||e==null?!1:"configurable"in e&&typeof e.configurable=="object"&&e.configurable!=null}function ik(e){return!ok(e)||!e.configurable.thread_id?null:{thread_id:e.configurable.thread_id,checkpoint_ns:e.configurable.checkpoint_ns||"",checkpoint_id:e.configurable.checkpoint_id||null,checkpoint_map:e.configurable.checkpoint_map||null}}function IM(e){if(ok(e)){let t=Object.fromEntries(Object.entries(e.configurable).filter(([n])=>!n.startsWith("__"))),r={...e,configurable:t};return delete r.callbacks,r}return e}function TM(e){let t={...e,checkpoint:ik(e.config),parent_checkpoint:ik(e.parentConfig),config:IM(e.config),parent_config:IM(e.parentConfig),tasks:e.tasks.map(r=>{if(ok(r.state)){let n=ik(r.state);if(n!=null){let i={...r,checkpoint:n};return delete i.state,i}}return r})};return delete t.parentConfig,t}function AM(e){let t=new TextEncoder;return new ReadableStream({async start(r){let n=i=>{r.enqueue(t.encode(`event: ${i.event}
441
+ data: ${eZ(i.data)}
442
+
443
+ `))};try{for await(let i of e){let[a,o,s]=i,c=s;if(o==="debug"){let l=s;l.type==="checkpoint"&&(c={...l,payload:TM(l.payload)})}o==="checkpoints"&&(c=TM(s)),n({event:a?.length?`${o}|${a.join("|")}`:o,data:c})}}catch(i){n({event:"error",data:tZ(i)})}r.close()}})}function OM(...e){return new ak({passthroughFn:t=>{let r=t[1]==="checkpoints"&&Ac(t[2]);for(let n of e)(n.modes.has(t[1])||r)&&n.push(t)},modes:new Set(e.flatMap(t=>Array.from(t.modes)))})}var PM=class{checkpointId;#e=new Set;constructor(e){this.checkpointId=e}#t(e){let t=e.includes(":")?e.slice(0,e.lastIndexOf(":")):e;return this.#e.has(t)?!1:(this.#e.add(t),!0)}async getCheckpoint(e,t,r){if(this.#t(e)){let n=[];for await(let i of t.list(r,{before:{configurable:{checkpoint_id:this.checkpointId}},limit:1}))n.push(i);return n.length>0?n[0]:void 0}return await t.getTuple(r)??void 0}};var Dh=Symbol.for("INPUT_DONE"),sk=Symbol.for("INPUT_RESUMING"),rZ=25;function NM(e){if(!(e==null||typeof e!="object")){if(Pe.isInstance(e)){let t=e;t.id==null&&(t.id=ea(),t.lc_kwargs!=null&&(t.lc_kwargs.id=t.id));return}if(Array.isArray(e)){for(let t of e)NM(t);return}}}function RM(e){return e===void 0||e===""?[]:e.split("|")}function nZ(e){if(!e)return[];let t="";for(let r of Object.keys(e))r!==""&&r.length>t.length&&(t=r);return RM(t)}var iZ=class extends uh{cache;queue=Promise.resolve();constructor(e){super(),this.cache=e}async get(e){return this.enqueueOperation("get",e)}async set(e){return this.enqueueOperation("set",e)}async clear(e){return this.enqueueOperation("clear",e)}async stop(){await this.queue}enqueueOperation(e,...t){let r=this.queue.then(()=>this.cache[e](...t));return this.queue=r.then(()=>{},()=>{}),r}},MM=class jM{input;output;config;checkpointer;checkpointerGetNextVersion;channels;checkpoint;checkpointIdSaved;_exitDeltaWrites;_deltaChannelsWithOverwrite=new Set;_hasPersistedParent=!1;_initialCheckpointConfig;checkpointConfig;checkpointMetadata;checkpointNamespace;checkpointPendingWrites=[];checkpointPreviousVersions;step;stop;durability;outputKeys;streamKeys;nodes;skipDoneTasks;prevCheckpointConfig;updatedChannels;status="pending";control;tasks={};stream;checkpointerPromises=new Set;isNested;resumeAtHead;_checkpointerChainedPromise=Promise.resolve();_trackCheckpointerPromise(t){let r=t.then(n=>(this.checkpointerPromises.delete(r),n),n=>{throw n});this.checkpointerPromises.add(r)}async _awaitCheckpointerPromises(){await Promise.all([...this.checkpointerPromises])}store;cache;manager;interruptAfter;interruptBefore;toInterrupt=[];debug=!1;triggerToNodes;get isResuming(){let t=!1;if("__start__"in this.checkpoint.channel_versions)t=!0;else for(let s in this.checkpoint.channel_versions)if(Object.prototype.hasOwnProperty.call(this.checkpoint.channel_versions,s)){t=!0;break}let r=this.config.configurable?.__pregel_resuming!==void 0&&this.config.configurable?.__pregel_resuming,n=this.input===null||this.input===void 0,i=At(this.input)&&this.input.resume!=null,a=this.input===sk,o=!this.isNested&&this.config.metadata?.run_id!==void 0&&this.checkpointMetadata?.run_id!==void 0&&this.config.metadata.run_id===this.checkpointMetadata?.run_id;return t&&(r||n||i||a||o)}get isReplaying(){return!this.skipDoneTasks}constructor(t){this.input=t.input,this.checkpointer=t.checkpointer,this.checkpointer!==void 0?this.checkpointerGetNextVersion=this.checkpointer.getNextVersion.bind(this.checkpointer):this.checkpointerGetNextVersion=vM,this.checkpoint=t.checkpoint,this.checkpointMetadata=t.checkpointMetadata,this.checkpointPreviousVersions=t.checkpointPreviousVersions,this.channels=t.channels,this.checkpointPendingWrites=t.checkpointPendingWrites,this.step=t.step,this.stop=t.stop,this.config=t.config,this.checkpointConfig=t.checkpointConfig,this.isNested=t.isNested,this.resumeAtHead=t.resumeAtHead,this.manager=t.manager,this.outputKeys=t.outputKeys,this.streamKeys=t.streamKeys,this.nodes=t.nodes,this.skipDoneTasks=t.skipDoneTasks,this.store=t.store,this.cache=t.cache?new iZ(t.cache):void 0,this.stream=t.stream,this.checkpointNamespace=t.checkpointNamespace,this.prevCheckpointConfig=t.prevCheckpointConfig,this.interruptAfter=t.interruptAfter,this.interruptBefore=t.interruptBefore,this.durability=t.durability,this.debug=t.debug,this.triggerToNodes=t.triggerToNodes,this.control=this.config.control,this._exitDeltaWrites=this.durability==="exit"&&this.checkpointer!=null?[]:void 0,this._hasPersistedParent=t.hasPersistedParent??!1,this._initialCheckpointConfig=t.checkpointConfig,this.checkpointIdSaved=t.checkpoint.id}static async initialize(t){let{config:r,stream:n}=t;n!==void 0&&r.configurable?.__pregel_stream!==void 0&&(n=OM(n,r.configurable[Lc]));let i=r.configurable?!("checkpoint_id"in r.configurable):!0,a=r.configurable?.[rr];r.configurable&&a&&(a.subgraphCounter>0&&(r=Tt(r,{[Cr]:[r.configurable[Cr],a.subgraphCounter.toString()].join("|")})),a.subgraphCounter+=1);let o=r.configurable?.checkpoint_id,s=tr in(r.configurable??{});!s&&r.configurable?.checkpoint_ns!==void 0&&r.configurable?.checkpoint_ns!==""&&(r=Tt(r,{checkpoint_ns:"",checkpoint_id:void 0}));let c=r;r.configurable?.checkpoint_id===void 0&&r.configurable?.checkpoint_map!==void 0&&r.configurable?.checkpoint_map?.[r.configurable?.checkpoint_ns]&&(c=Tt(r,{checkpoint_id:r.configurable[Vt][r.configurable?.checkpoint_ns]}));let l=RM(r.configurable?.checkpoint_ns),u;t.checkpointer?c.configurable?.checkpoint_id?u=await t.checkpointer.getTuple(c):r.configurable?.__pregel_replay_state?(u=await r.configurable[Xu].getCheckpoint(r.configurable?.checkpoint_ns??"",t.checkpointer,c),r.configurable&&delete r.configurable[Ha]):u=await t.checkpointer.getTuple(c):u=void 0;let d=u!==void 0;u||(u={config:r,checkpoint:Jo(),metadata:{source:"input",step:-2,parents:{}},pendingWrites:[]}),c={...r,...u.config,configurable:{checkpoint_ns:"",...r.configurable,...u.config.configurable}};let f=u.parentConfig,p=xn(u.checkpoint),m={...u.metadata},h=u.pendingWrites??[],_=r.configurable?.checkpoint_ns,y=r.configurable?.[Vt];typeof _=="string"&&_!==""&&typeof y=="object"&&y!==null&&_ in y&&h.length>0&&(h=h.filter(([,L])=>L!==nr));let w=!1,x=c.configurable?.thread_id,S=c.configurable?.checkpoint_ns??"";t.checkpointer&&o&&typeof x=="string"&&(w=(await t.checkpointer.getTuple({configurable:{thread_id:x,checkpoint_ns:S}}))?.config.configurable?.checkpoint_id===o&&m.source!=="update"&&m.source!=="fork");let E=await Tc(t.channelSpecs,p,{saver:t.checkpointer,config:c}),P=(m.step??0)+1,C=P+(r.recursionLimit??rZ)+1,b={...p.channel_versions},B=t.store?new lh(t.store):void 0;return B&&await B.start(),new jM({input:t.input,config:r,checkpointer:t.checkpointer,checkpoint:p,checkpointMetadata:m,checkpointConfig:c,prevCheckpointConfig:f,checkpointNamespace:l,channels:E,isNested:s,resumeAtHead:w,manager:t.manager,skipDoneTasks:i,step:P,stop:C,checkpointPreviousVersions:b,checkpointPendingWrites:h,outputKeys:t.outputKeys??[],streamKeys:t.streamKeys??[],nodes:t.nodes,stream:n,store:B,cache:t.cache,interruptAfter:t.interruptAfter,interruptBefore:t.interruptBefore,durability:t.durability,debug:t.debug,triggerToNodes:t.triggerToNodes,hasPersistedParent:d})}_checkpointerPutAfterPrevious(t){this._checkpointerChainedPromise=this._checkpointerChainedPromise.then(()=>this.checkpointer?.put(t.config,t.checkpoint,t.metadata,t.newVersions)),this._trackCheckpointerPromise(this._checkpointerChainedPromise)}putWrites(t,r){let n=r;if(n.length===0)return;n.every(([c])=>c in Du)&&(n=Array.from(new Map(n.map(c=>[c[0],c])).values()));let i=!1;for(let c in this.channels)if(Object.prototype.hasOwnProperty.call(this.channels,c)&&this.channels[c].lc_graph_name==="UntrackedValue"){i=!0;break}let a=n;i&&(a=n.filter(([c])=>{let l=this.channels[c];return!l||l.lc_graph_name!=="UntrackedValue"}).map(([c,l])=>c==="__pregel_tasks"&&wt(l)?[c,wM(l,this.channels)]:[c,l])),this.checkpointPendingWrites=this.checkpointPendingWrites.filter(c=>c[0]!==t);for(let[c,l]of a)this.checkpointPendingWrites.push([t,c,l]);for(let[c,l]of a){let u=this.channels[c];u!=null&&an(u)&&NM(l)}let o=Tt(this.checkpointConfig,{[Cr]:this.config.configurable?.checkpoint_ns??"",[Ji]:this.checkpoint.id});if(this.durability!=="exit"&&this.checkpointer!=null&&this._trackCheckpointerPromise(this.checkpointer.putWrites(o,a,t)),this.tasks&&this._outputWrites(t,n),!r.length||!this.cache||!this.tasks)return;let s=this.tasks[t];s==null||s.cache_key==null||r[0][0]==="__error__"||r[0][0]==="__interrupt__"||this.cache.set([{key:[s.cache_key.ns,s.cache_key.key],value:s.writes,ttl:s.cache_key.ttl}])}_outputWrites(t,r,n=!1){let i=this.tasks[t];if(i!==void 0){if(i.config!==void 0&&(i.config.tags??[]).includes("langsmith:hidden"))return;if(r.length>0)if(r[0][0]==="__interrupt__"){if(i.path?.[0]==="__pregel_push"&&i.path?.[i.path.length-1]===!0)return;let a=r.filter(o=>o[0]===Le).flatMap(o=>o[1]);this._emit([["updates",{[Le]:a}],["values",{[Le]:a}]])}else r[0][0]!=="__error__"&&this._emit(Ma(ci(fM(this.outputKeys,[[i,r]],n),"updates")));n||this._emit(Ma(ci(SM([[i,r]],this.streamKeys),"tasks")))}}async _matchCachedWrites(){if(!this.cache)return[];let t=[],r=([o,s])=>`ns:${o.join(",")}|key:${s}`,n=[],i={};for(let o of Object.values(this.tasks))o.cache_key!=null&&!o.writes.length&&(n.push([o.cache_key.ns,o.cache_key.key]),i[r([o.cache_key.ns,o.cache_key.key])]=o);if(n.length===0)return[];let a=await this.cache.get(n);for(let{key:o,value:s}of a){let c=i[r(o)];c!=null&&(c.writes.push(...s),t.push({task:c,result:s}))}return t}async tick(t){this.store&&!this.store.isRunning&&await this.store?.start();let{inputKeys:r=[]}=t;if(this.status!=="pending")throw new Error(`Cannot tick when status is no longer "pending". Current status: "${this.status}"`);if(![Dh,sk].includes(this.input))await this._first(r);else{if(this.toInterrupt.length>0)throw this.status="interrupt_before",new li;if(Object.values(this.tasks).every(i=>i.writes.length>0)){let i=Object.values(this.tasks),a=i.flatMap(s=>s.writes);this.updatedChannels=hr(this.checkpoint,this.channels,i,this.checkpointerGetNextVersion,this.triggerToNodes);for(let[s,c]of a){let l=this.channels[s];l!=null&&an(l)&&Wa(c)&&this._deltaChannelsWithOverwrite.add(s)}let o=await En(ci(Ah(this.outputKeys,a,this.channels),"values"));if(this._exitDeltaWrites!==void 0)for(let[s,c,l]of this.checkpointPendingWrites){let u=this.channels[c];u!=null&&an(u)&&this._exitDeltaWrites.push([this.step,s,c,l])}if(this.checkpointPendingWrites=[],await this._putCheckpoint({source:"loop"}),this.durability==="sync"&&await this._awaitCheckpointerPromises(),this._emitValuesWithCheckpointMeta(o),Zu(this.checkpoint,this.interruptAfter,i))throw this.status="interrupt_after",new li;this.config.configurable?.__pregel_resuming!==void 0&&delete this.config.configurable?.[Ha]}else return!1}if(this.step>this.stop)return this.status="out_of_steps",!1;this.tasks=za(this.checkpoint,this.checkpointPendingWrites,this.nodes,this.channels,this.config,!0,{step:this.step,checkpointer:this.checkpointer,isResuming:this.isResuming,manager:this.manager,store:this.store,stream:this.stream,triggerToNodes:this.triggerToNodes,updatedChannels:this.updatedChannels});let n=Object.values(this.tasks);if(this.checkpointer&&(this.stream.modes.has("checkpoints")||this.stream.modes.has("debug"))&&this._emit(await En(ci(kM(this.checkpointConfig,this.channels,this.streamKeys,this.checkpointMetadata,n,this.checkpointPendingWrites,this.prevCheckpointConfig,this.outputKeys),"checkpoints"))),n.length===0)return this.status="done",!1;if(this.control!=null&&this.control.drainRequested)return this.status="draining",!1;if(this.skipDoneTasks&&this.checkpointPendingWrites.length>0){for(let[i,a,o]of this.checkpointPendingWrites){if(a==="__error__"||a==="__error_source_node__"||a==="__interrupt__"||a==="__resume__")continue;let s=n.find(c=>c.id===i);s&&s.writes.push([a,o])}this._resumeErrorHandlersIfApplicable(),n=Object.values(this.tasks);for(let i of n)i.writes.length>0&&this._outputWrites(i.id,i.writes,!0)}if(n.every(i=>i.writes.length>0))return this.tick({inputKeys:r});if(Zu(this.checkpoint,this.interruptBefore,n))throw this.status="interrupt_before",new li;if(this.stream.modes.has("tasks")||this.stream.modes.has("debug")){let i=await En(ci(Mh(n),"tasks"));this._emit(i)}return!0}async finishAndHandleError(t){this.durability==="exit"&&(!this.isNested||typeof t<"u"||this.checkpointNamespace.every(n=>!n.includes(":")))&&(await this._putExitDeltaWrites(),this._putCheckpoint(this.checkpointMetadata),this._flushPendingWrites());let r=this._suppressInterrupt(t);return(r||t===void 0)&&(this.output=In(this.channels,this.outputKeys)),r&&(this.tasks!==void 0&&this.checkpointPendingWrites.length>0&&Object.values(this.tasks).some(n=>n.writes.length>0)&&(this.updatedChannels=hr(this.checkpoint,this.channels,Object.values(this.tasks),this.checkpointerGetNextVersion,this.triggerToNodes),this._emitValuesWithCheckpointMeta(Ma(ci(Ah(this.outputKeys,Object.values(this.tasks).flatMap(n=>n.writes),this.channels),"values")))),ui(t)&&!t.interrupts.length&&this._emit([["updates",{[Le]:[]}],["values",{[Le]:[]}]],this.#e())),r}async acceptPush(t,r,n){if(this.interruptAfter?.length>0&&Zu(this.checkpoint,this.interruptAfter,[t])){this.toInterrupt.push(t);return}let i=Rh([ir,t.path??[],r,t.id,n],this.checkpoint,this.checkpointPendingWrites,this.nodes,this.channels,t.config??{},!0,{step:this.step,checkpointer:this.checkpointer,manager:this.manager,store:this.store,stream:this.stream});if(!i)return;if(this.interruptBefore?.length>0&&Zu(this.checkpoint,this.interruptBefore,[i])){this.toInterrupt.push(i);return}(this.stream.modes.has("tasks")||this.stream.modes.has("debug"))&&this._emit(Ma(ci(Mh([i]),"tasks"))),this.debug&&Wu(this.step,[i]),this.tasks[i.id]=i,this.skipDoneTasks&&this._matchWrites({[i.id]:i});let a=await this._matchCachedWrites();for(let{task:o}of a)this._outputWrites(o.id,o.writes,!0);return i}getErrorHandlerNode(t){return this.nodes[t]?.errorHandlerNode}isErrorHandlerNode(t){return this.nodes[t]?.isErrorHandler===!0}scheduleErrorHandler(t,r){let n=this.getErrorHandlerNode(String(t.name));if(!n)return;let i=bM(t,n,r,this.checkpoint,this.checkpointPendingWrites,this.nodes,this.channels,t.config??this.config,{step:this.step,checkpointer:this.checkpointer,manager:this.manager,store:this.store,stream:this.stream});if(i!==void 0)return this.tasks[i.id]=i,this._emit(Ma(ci(Mh([i]),"tasks"))),this.debug&&Wu(this.step,[i]),i}_resumeErrorHandlersIfApplicable(){let t=new Map;for(let[r,n]of this.checkpointPendingWrites){if(n!=="__error_source_node__")continue;let i=this.checkpointPendingWrites.find(([s,c])=>s===r&&c==="__error__");if(i===void 0)continue;let a=i[2],o=new Error(a?.message??String(a));a?.name&&(o.name=a.name),t.set(r,o)}for(let[r,n]of t){let i=this.tasks[r];i!==void 0&&this.getErrorHandlerNode(String(i.name))&&(i.writes.length===0&&i.writes.push([Gi,{message:n.message,name:n.name}]),this.scheduleErrorHandler(i,n))}}_suppressInterrupt(t){return ui(t)&&!this.isNested}async _first(t){let{configurable:r}=this.config,n=r?.[rr];if(n&&n.nullResume!==void 0&&this.putWrites(ar,[[nr,n.nullResume]]),At(this.input)){let l=this.input.resume!=null;if(this.input.resume!=null&&typeof this.input.resume=="object"&&Object.keys(this.input.resume).every(Eh)&&(this.config.configurable??={},this.config.configurable[Ga]=this.input.resume),l&&this.checkpointer==null)throw new Error("Cannot use Command(resume=...) without checkpointer");let u={};for(let[d,f,p]of dM(this.input,this.checkpointPendingWrites))u[d]??=[],u[d].push([f,p]);if(Object.keys(u).length===0)throw new cd("Received empty Command input");for(let[d,f]of Object.entries(u))this.putWrites(d,f)}let i=(this.checkpointPendingWrites??[]).filter(l=>l[0]===ar).map(l=>l.slice(1));i.length>0&&hr(this.checkpoint,this.channels,[{name:Nn,writes:i,triggers:[]}],this.checkpointerGetNextVersion,this.triggerToNodes);let a=At(this.input),o=a&&i.length>0,s=this.isReplaying&&(this.isNested&&r?.checkpoint_ns!==void 0&&r?.checkpoint_ns!==""&&r?.checkpoint_map!==void 0&&r.checkpoint_ns in r.checkpoint_map||!(a&&this.input.resume!=null||r?.__pregel_resuming===!0||this.resumeAtHead));s&&(this.checkpointPendingWrites=this.checkpointPendingWrites.filter(l=>l[1]!==nr));let c=this.isResuming;if(c||o){let l={...this.checkpoint.versions_seen[Le]};for(let d in this.channels)Object.prototype.hasOwnProperty.call(this.channels,d)&&this.checkpoint.channel_versions[d]!==void 0&&(l[d]=this.checkpoint.channel_versions[d]);this.checkpoint.versions_seen[Le]=l,s&&this.checkpointMetadata.source!=="update"&&this.checkpointMetadata.source!=="fork"&&(this.checkpointPendingWrites=this.checkpointPendingWrites.filter(d=>d[1]!==Le),await this._putCheckpoint({source:"fork"}));let u=await En(ci(Ah(this.outputKeys,!0,this.channels),"values"));c?this.input=sk:o&&(await this._putCheckpoint({source:"input"}),this.input=Dh),this._emitValuesWithCheckpointMeta(u)}else{let l=await En(Ch(t,this.input));if(l.length>0){let u=za(this.checkpoint,this.checkpointPendingWrites,this.nodes,this.channels,this.config,!0,{step:this.step});this.updatedChannels=hr(this.checkpoint,this.channels,Object.values(u).concat([{name:Nn,writes:l,triggers:[]}]),this.checkpointerGetNextVersion,this.triggerToNodes);let d=l.filter(([f])=>{let p=this.channels[f];return p!=null&&an(p)});for(let[f,p]of d)Wa(p)&&this._deltaChannelsWithOverwrite.add(f);if(d.length>0)if(this._exitDeltaWrites!==void 0)for(let[f,p]of d)this._exitDeltaWrites.push([this.step,ar,f,p]);else this.checkpointer!=null&&this.putWrites(ar,d);await this._putCheckpoint({source:"input"}),this.input=Dh}else if("__pregel_resuming"in(this.config.configurable??{}))this.input=Dh;else throw new cd(`Received no input writes for ${JSON.stringify(t,null,2)}`)}if(!this.isNested){let l;if(s){let u=this.checkpoint.id;(this.checkpointMetadata.source==="update"||this.checkpointMetadata.source==="fork")&&this.prevCheckpointConfig&&(u=this.prevCheckpointConfig.configurable?.checkpoint_id??u),l=new PM(u)}this.config=Tt(this.config,{[Ha]:this.isResuming,[Xu]:l})}}#e(){let t=this.checkpointNamespace;if(!(t.length===0||t.length===1&&t[0]==="")||this.config.configurable?.__pregel_stream===void 0)return t;let r=nZ(this.config.configurable?.[Vt]);return r.length>0?r:t}_emit(t,r=this.checkpointNamespace){for(let[n,i]of t)if(this.stream.modes.has(n)&&this.stream.push([r,n,i]),(n==="checkpoints"||n==="tasks")&&this.stream.modes.has("debug")){let a=n==="checkpoints"?this.step-1:this.step,o=new Date().toISOString(),s=n==="checkpoints"?"checkpoint":typeof i=="object"&&i!=null&&"result"in i?"task_result":"task";this.stream.push([r,"debug",{step:a,type:s,timestamp:o,payload:i}])}}_currentCheckpointMeta(){if(!this.checkpointMetadata||!this.checkpoint?.id)return;let t=this.prevCheckpointConfig?.configurable?.checkpoint_id;return{checkpoint:{id:this.checkpoint.id,...t?{parent_id:t}:{},step:this.checkpointMetadata.step,source:this.checkpointMetadata.source}}}_emitValuesWithCheckpointMeta(t){let r=this._currentCheckpointMeta();for(let[n,i]of t)n==="values"&&r?.checkpoint!=null&&!this.stream.modes.has("checkpoints")&&this.stream.push([this.checkpointNamespace,"checkpoints",r.checkpoint]),this.stream.modes.has(n)&&this.stream.push([this.checkpointNamespace,n,i])}_putCheckpoint(t){let r=this.checkpointMetadata===t,n=this.checkpointer!=null&&(this.durability!=="exit"||r),i=c=>{this.prevCheckpointConfig=this.checkpointConfig?.configurable?.checkpoint_id?this.checkpointConfig:void 0,this.checkpointConfig=Tt(this.checkpointConfig,{[Cr]:this.config.configurable?.checkpoint_ns??""});let l={...this.checkpoint.channel_versions},u=Mc(this.checkpointPreviousVersions,l);this.checkpointPreviousVersions=l,this._checkpointerPutAfterPrevious({config:{...this.checkpointConfig},checkpoint:xn(c),metadata:{...this.checkpointMetadata},newVersions:u}),this.checkpointConfig={...this.checkpointConfig,configurable:{...this.checkpointConfig.configurable,checkpoint_id:this.checkpoint.id}}},a;if(r)a={...this.checkpointMetadata.counters_since_delta_snapshot??{}};else{let c=this.checkpointMetadata.counters_since_delta_snapshot??{};a={};let l=this.updatedChannels??new Set;for(let u in this.channels){if(!Object.prototype.hasOwnProperty.call(this.channels,u)||!an(this.channels[u]))continue;let[d,f]=c[u]??[0,0];a[u]=[l.has(u)?d+1:d,f+1]}this.checkpointMetadata={...t,step:this.step,parents:this.config.configurable?.checkpoint_map??{}}}let o=n?fh(this.channels,a):new Set;if(n)for(let c of this._deltaChannelsWithOverwrite)o.add(c);this.checkpoint=Sn(this.checkpoint,n?this.channels:void 0,this.step,{id:r?this.checkpoint.id:void 0,channelsToSnapshot:o,updatedChannels:this.updatedChannels,getNextVersion:n?c=>this.checkpointerGetNextVersion(c):void 0});for(let c of o)a[c]=[0,0],this._deltaChannelsWithOverwrite.delete(c);let s={};for(let c in a){if(!Object.prototype.hasOwnProperty.call(a,c))continue;let[l,u]=a[c];(l!==0||u!==0)&&(s[c]=[l,u])}Object.keys(s).length>0?this.checkpointMetadata.counters_since_delta_snapshot=s:delete this.checkpointMetadata.counters_since_delta_snapshot,n&&i(this.checkpoint),r||(this.step+=1)}async _putExitDeltaWrites(){if(this._exitDeltaWrites===void 0||this._exitDeltaWrites.length===0||this.checkpointer==null||this._initialCheckpointConfig===void 0)return;let t=this.checkpointMetadata.counters_since_delta_snapshot??{},r=fh(this.channels,t);for(let c of this._deltaChannelsWithOverwrite)r.add(c);let n=this._exitDeltaWrites.filter(([,,c])=>!r.has(c));if(n.length===0)return;let i;if(this._hasPersistedParent)i=this._initialCheckpointConfig;else{let c=Jo();c.id=this.checkpointIdSaved??c.id,c.ts=new Date().toISOString();let l=Tt(this._initialCheckpointConfig,{[Ji]:void 0});i=Tt(this._initialCheckpointConfig,{[Ji]:c.id}),this._trackCheckpointerPromise(this.checkpointer.put(l,c,{source:"loop",step:-2,parents:{}},{})),this.checkpointConfig=i}let a=Tt(i,{[Cr]:this.config.configurable?.checkpoint_ns??"",[Ji]:i.configurable?.[Ji]}),o=new Map,s=[];for(let[c,l,u,d]of n){let f=`${c}\0${l}`,p=o.get(f);p===void 0&&(p=[],o.set(f,p),s.push({key:f,step:c,tid:l})),p.push([u,d])}for(let{key:c,step:l,tid:u}of s){let d=NS(l,u);this._trackCheckpointerPromise(this.checkpointer.putWrites(a,o.get(c),d))}}_flushPendingWrites(){if(this.checkpointer==null||this.checkpointPendingWrites.length===0)return;let t=Tt(this.checkpointConfig,{[Cr]:this.config.configurable?.checkpoint_ns??"",[Ji]:this.checkpoint.id}),r={};for(let[n,i,a]of this.checkpointPendingWrites)r[n]??=[],r[n].push([i,a]);for(let[n,i]of Object.entries(r))this._trackCheckpointerPromise(this.checkpointer.putWrites(t,i,n))}_matchWrites(t){for(let[r,n,i]of this.checkpointPendingWrites){if(n==="__error__"||n==="__interrupt__"||n==="__resume__")continue;let a=Object.values(t).find(o=>o.id===r);a&&a.writes.push([n,i])}for(let r of Object.values(t))r.writes.length>0&&this._outputWrites(r.id,r.writes,!0)}};function aZ(e){return rt(e?.message)}function DM(e,t,r){if(!e)return;let n=e.langgraph_checkpoint_ns,i=e.checkpoint_ns,a=n??i;if(a)return[a.split("|"),{tags:t,name:r,...e}]}var zM=class extends sr{name="StreamMessagesHandler";streamFn;metadatas={};seen={};emittedChatModelRunIds={};stableMessageIdMap={};lc_prefer_streaming=!0;constructor(e){super(),this.streamFn=e}_emit(e,t,r,n=!1){if(n&&t.id!==void 0&&this.seen[t.id]!==void 0)return;let i=t.id;r!=null&&(Yc(t)?i??=`run-${r}-tool-${t.tool_call_id}`:((i==null||i===`run-${r}`)&&(i=this.stableMessageIdMap[r]??i??`run-${r}`),this.stableMessageIdMap[r]??=i)),i!==t.id&&(t.id=i,t.lc_kwargs.id=i),t.id!=null&&(this.seen[t.id]=t),this.streamFn([e[0],"messages",[t,e[1]]])}handleChatModelStart(e,t,r,n,i,a,o,s){o&&(!a||!a.includes("langsmith:nostream")&&!a.includes("nostream"))&&(this.metadatas[r]=DM(o,a,s))}handleLLMNewToken(e,t,r,n,i,a){let o=a?.chunk;this.emittedChatModelRunIds[r]=!0,this.metadatas[r]!==void 0&&(aZ(o)?this._emit(this.metadatas[r],o.message,r):this._emit(this.metadatas[r],new it({content:e}),r))}handleLLMEnd(e,t){if(this.metadatas[t]!==void 0){if(!this.emittedChatModelRunIds[t]){let r=e.generations?.[0]?.[0];rt(r?.message)&&this._emit(this.metadatas[t],r?.message,t,!0),delete this.emittedChatModelRunIds[t]}delete this.metadatas[t],delete this.stableMessageIdMap[t]}}handleLLMError(e,t){delete this.metadatas[t]}handleChainStart(e,t,r,n,i,a,o,s){if(a!==void 0&&s===a.langgraph_node&&(i===void 0||!i.includes("langsmith:hidden"))&&(this.metadatas[r]=DM(a,i,s),typeof t=="object")){for(let c of Object.values(t))if((rt(c)||mi(c))&&c.id!==void 0)this.seen[c.id]=c;else if(Array.isArray(c))for(let l of c)(rt(l)||mi(l))&&l.id!==void 0&&(this.seen[l.id]=l)}}handleChainEnd(e,t){let r=this.metadatas[t];if(delete this.metadatas[t],r!==void 0){if(rt(e))this._emit(r,e,t,!0);else if(Array.isArray(e))for(let n of e)rt(n)&&this._emit(r,n,t,!0);else if(e!=null&&typeof e=="object"){for(let n of Object.values(e))if(rt(n))this._emit(r,n,t,!0);else if(Array.isArray(n))for(let i of n)rt(i)&&this._emit(r,i,t,!0)}}}handleChainError(e,t){delete this.metadatas[t]}};function UM(e){if("response_metadata"in e&&typeof e.response_metadata=="object"&&e.response_metadata!=null)return e.response_metadata}function LM(e){if("usage_metadata"in e&&typeof e.usage_metadata=="object"&&e.usage_metadata!=null)return e.usage_metadata}function oZ(e){switch(e.type){case"text":return{type:"text",text:""};case"reasoning":return{type:"reasoning",reasoning:""};case"tool_call":case"tool_call_chunk":return{type:"tool_call_chunk",...e.id!=null?{id:e.id}:{},...e.name!=null?{name:e.name}:{},args:""};default:return e}}function sZ(e){switch(e.type){case"text":{let t=typeof e.text=="string"?e.text:"";return t.length>0?{event:"content-block-delta",index:typeof e.index=="number"?e.index:0,delta:{type:"text-delta",text:t}}:void 0}case"reasoning":{let t=typeof e.reasoning=="string"?e.reasoning:"";return t.length>0?{event:"content-block-delta",index:typeof e.index=="number"?e.index:0,delta:{type:"reasoning-delta",reasoning:t}}:void 0}case"tool_call_chunk":return{event:"content-block-delta",index:typeof e.index=="number"?e.index:0,delta:{type:"block-delta",fields:{...e,type:"tool_call_chunk"}}};default:return}}var FM=class extends sr{name="StreamProtocolMessagesHandler";streamFn;metadatas={};seen={};streamedRunIds=new Set;stableMessageIdMap={};lc_prefer_chat_model_stream_events=!0;awaitHandlers=!0;constructor(e){super(),this.streamFn=e}normalizeMessageId(e,t){let r=e.id;return t!=null&&(kt.isInstance(e)?r??=`run-${t}-tool-${e.tool_call_id}`:((r==null||r===`run-${t}`)&&(r=this.stableMessageIdMap[t]??r??`run-${t}`),this.stableMessageIdMap[t]??=r)),r!==e.id&&(e.id=r,e.lc_kwargs.id=r),e.id!=null&&(this.seen[e.id]=e),e.id}emit(e,t,r){let n=r!=null?{...e[1],run_id:r}:e[1];this.streamFn([e[0],"messages",[t,n]])}emitFinalMessage(e,t,r,n=!1){let i=t.id??(r!=null?this.stableMessageIdMap[r]:void 0);if(n&&i!=null&&this.seen[i]!==void 0)return;let a=this.normalizeMessageId(t,r),o=t.type==="human"?"human":t.type==="system"?"system":t.type==="tool"?"tool":"ai",s=o==="tool"&&kt.isInstance(t)?t.tool_call_id:void 0;this.emit(e,{event:"message-start",...a!=null?{id:a}:{},...o!=="ai"?{role:o}:{},...typeof s=="string"?{tool_call_id:s}:{}},r),(Array.isArray(t.content)?t.content:typeof t.content=="string"&&t.content.length>0?[{type:"text",text:t.content}]:[]).forEach((c,l)=>{let u=typeof c.index=="number"?c.index:l;this.emit(e,{event:"content-block-start",index:u,content:oZ(c)},r);let d=sZ({...c,index:u});d!=null&&this.emit(e,d,r),this.emit(e,{event:"content-block-finish",index:u,content:c},r)}),this.emit(e,{event:"message-finish",...LM(t)!=null?{usage:LM(t)}:{},...UM(t)!=null?{responseMetadata:UM(t)}:{}},r)}handleChatModelStart(e,t,r,n,i,a,o,s){o&&(!a||!a.includes("langsmith:nostream")&&!a.includes("nostream"))&&(this.metadatas[r]=[o.langgraph_checkpoint_ns.split("|"),{tags:a,name:s,...o}])}handleLLMNewToken(){}handleChatModelStreamEvent(e,t){let r=this.metadatas[t];if(r===void 0)return;let n=e;if(e.event==="message-start"){this.streamedRunIds.add(t);let i=e.id??`run-${t}`;this.seen[i]=!0,this.stableMessageIdMap[t]??=i,e.id==null&&(n={...e,id:i})}this.emit(r,n,t)}handleLLMEnd(e,t){let r=this.metadatas[t];if(r===void 0)return;let n=e.generations?.[0]?.[0],i=Pe.isInstance(n?.message)?n.message:void 0;if(i!=null)if(this.streamedRunIds.has(t)){let a=this.normalizeMessageId(i,t);a!=null&&(this.seen[a]=i)}else this.emitFinalMessage(r,i,t,!0);this.streamedRunIds.delete(t),delete this.metadatas[t],delete this.stableMessageIdMap[t]}handleLLMError(e,t){this.streamedRunIds.delete(t),delete this.metadatas[t],delete this.stableMessageIdMap[t]}handleChainStart(e,t,r,n,i,a,o,s){if(a!==void 0&&s===a.langgraph_node&&(i===void 0||!i.includes("langsmith:hidden"))&&(this.metadatas[r]=[a.langgraph_checkpoint_ns.split("|"),{tags:i,name:s,...a}],typeof t=="object")){for(let c of Object.values(t))if((Pe.isInstance(c)||Pt.isInstance(c))&&c.id!==void 0)this.seen[c.id]=c;else if(Array.isArray(c))for(let l of c)(Pe.isInstance(l)||Pt.isInstance(l))&&l.id!==void 0&&(this.seen[l.id]=l)}}handleChainEnd(e,t){let r=this.metadatas[t];if(delete this.metadatas[t],r===void 0)return;let n=i=>{Pe.isInstance(i)&&!kt.isInstance(i)&&this.emitFinalMessage(r,i,t,!0)};if(Pe.isInstance(e))n(e);else if(Array.isArray(e))for(let i of e)n(i);else if(e!=null&&typeof e=="object")for(let i of Object.values(e))if(Array.isArray(i))for(let a of i)n(a);else n(i);delete this.stableMessageIdMap[t]}handleChainError(e,t){delete this.metadatas[t],delete this.stableMessageIdMap[t]}};var cZ=class{active=!0;lastProgress=Date.now();refreshOn;constructor(e){this.refreshOn=e}touch(){this.lastProgress=Date.now()}autoTouch(){this.refreshOn==="auto"&&(this.lastProgress=Date.now())}close(){this.active=!1}},lZ=class extends sr{name="IdleProgressCallbackHandler";awaitHandlers=!1;#e;constructor(e){super(),this.#e=e}#t=()=>{this.#e.autoTouch()};handleLLMStart=this.#t;handleChatModelStart=this.#t;handleLLMNewToken=this.#t;handleLLMEnd=this.#t;handleLLMError=this.#t;handleChainStart=this.#t;handleChainEnd=this.#t;handleChainError=this.#t;handleToolStart=this.#t;handleToolEnd=this.#t;handleToolError=this.#t;handleText=this.#t;handleRetrieverStart=this.#t;handleRetrieverEnd=this.#t;handleRetrieverError=this.#t;handleCustomEvent=this.#t};function uZ(e,t,r,n){let i=e.configurable??{},a={},o=i[Bt];typeof o=="function"&&(a[Bt]=l=>{if(t.active)return l&&l.length&&t.autoTouch(),o(l)});let s=i[Rn];typeof s=="function"&&(a[Rn]=(...l)=>{if(!t.active)throw new Error(`Node "${n}" attempt was cancelled after its timeout fired`);return t.autoTouch(),s(...l)});let c={...Object.keys(a).length>0?Tt(e,a):e};if(c.heartbeat=()=>{r.idleTimeout!==void 0&&t.touch()},typeof c.writer=="function"){let l=c.writer;c.writer=(u=>{if(t.active)return t.autoTouch(),l(u)})}if((r.refreshOn??"auto")==="auto"&&r.idleTimeout!==void 0){let l=new lZ(t),u=c.callbacks;if(u===void 0)c.callbacks=[l];else if(Array.isArray(u))c.callbacks=[...u,l];else{let d=u.copy();d.addHandler(l,!0),c.callbacks=d}}return c}async function BM(e,t,r,n){let i=new cZ(r.refreshOn??"auto"),a=new AbortController,{signal:o,dispose:s}=Da(t.signal,a.signal),c=uZ({...t,signal:o},i,r,String(e.name)),l=Date.now(),u=n(c).then(y=>({type:"ok",value:y}),y=>({type:"err",error:y})),d,f,p=()=>{d!==void 0&&clearTimeout(d),f!==void 0&&clearTimeout(f)},m=new Promise(y=>{if(r.runTimeout!==void 0&&(d=setTimeout(()=>y({type:"timeout",kind:"run"}),r.runTimeout)),r.idleTimeout!==void 0){let w=r.idleTimeout,x=()=>{let S=i.lastProgress+w-Date.now();S<=0?y({type:"timeout",kind:"idle"}):f=setTimeout(x,S)};f=setTimeout(x,w)}}),h;try{h=await Promise.race([u,m])}finally{p()}if(h.type!=="timeout"){let y=Date.now();r.runTimeout!==void 0&&y-l>=r.runTimeout?h={type:"timeout",kind:"run"}:r.idleTimeout!==void 0&&y-i.lastProgress>=r.idleTimeout&&(h={type:"timeout",kind:"idle"})}if(h.type==="ok")return s?.(),h.value;if(h.type==="err")throw s?.(),h.error;let _=Date.now()-l;throw i.close(),e.writes.splice(0,e.writes.length),a.abort(),s?.(),new sd({node:String(e.name),elapsed:_,kind:h.kind,runTimeout:r.runTimeout,idleTimeout:r.idleTimeout})}var dZ=[400,401,402,403,404,405,406,407,409],fZ=e=>{if(e.message.startsWith("Cancel")||e.message.startsWith("AbortError")||e.name==="AbortError"||e.name==="GraphValueError"||e?.code==="ECONNABORTED")return!1;let t=e?.response?.status??e?.status;return!(t&&dZ.includes(+t)||e?.error?.code==="insufficient_quota")};async function zh(e,t,r,n){let i=e.retry_policy??t,a=0,o,s,c=e.config??{};r&&(c=Tt(c,r)),c={...c,signal:n};let l=Date.now();for(c.executionInfo!=null&&(c.executionInfo={...c.executionInfo,nodeFirstAttemptTime:l});!n?.aborted;){e.writes.splice(0,e.writes.length),o=void 0;try{e.timeout!==void 0?s=await BM(e,c,e.timeout,u=>e.proc.invoke(e.input,u)):s=await e.proc.invoke(e.input,c);break}catch(u){if(o=u,o.pregelTaskId=e.id,Gh(o)){let h=c?.configurable?.checkpoint_ns,_=o.command;if(_.graph===h){for(let y of e.writers)await y.invoke(_,c);o=void 0;break}else if(_.graph===_r.PARENT){let y=GR(h);o.command=new _r({...o.command,graph:y})}}if(Yi(o)||i===void 0||(a+=1,a>=(i.maxAttempts??3))||!(i.retryOn??fZ)(o))break;let d=i.initialInterval??500,f=Math.min(i.maxInterval??128e3,d*(i.backoffFactor??2)**(a-1)),p=i.jitter??!0?f+Math.random()*1e3:f;await new Promise(h=>setTimeout(h,p));let m=o.name??o.constructor.unminifiable_name??o.constructor.name;(i?.logWarning??!0)&&console.log(`Retrying task "${String(e.name)}" after ${p.toFixed(2)}ms (attempt ${a}) after ${m}: ${o}`),c=Tt(c,{[Ha]:!0}),c.executionInfo!=null&&(c.executionInfo={...c.executionInfo,nodeAttempt:a+1,nodeFirstAttemptTime:l})}}return{task:e,result:s,error:o,signalAborted:n?.aborted}}var ck=Symbol.for("promiseAdded");function pZ(){let e={next:()=>{},wait:Promise.resolve(ck)};function t(r){e.next=()=>{e.wait=new Promise(t),r(ck)}}return e.wait=new Promise(t),e}var VM=class{nodeFinished;loop;handledExceptions=new WeakSet;constructor({loop:e,nodeFinished:t}){this.loop=e,this.nodeFinished=t}async tick(e={}){let{timeout:t,retryPolicy:r,onStepWrite:n,maxConcurrency:i}=e,a=new Set,o,s=new AbortController,c=s.signal,l=t?AbortSignal.timeout(t):void 0,u=Object.values(this.loop.tasks),d=u.filter(h=>h.writes.length===0),{signals:f,disposeCombinedSignal:p}=this._initializeAbortSignals({exceptionSignal:c,stepTimeoutSignal:l,signal:e.signal}),m=this._executeTasksWithRetry(d,{signals:f,retryPolicy:r,maxConcurrency:i});for await(let{task:h,error:_,signalAborted:y}of m)this._commit(h,_),!(_!==void 0&&this.handledExceptions.has(_))&&(ui(_)||Yi(_)&&!ui(o)?o=_:_&&(a.size===0||!y)&&(s.abort(),a.add(_)));if(p?.(),n?.(this.loop.step,u.map(h=>h.writes).flat()),a.size===1)throw Array.from(a)[0];if(a.size>1)throw new AggregateError(Array.from(a),`Multiple errors occurred during superstep ${this.loop.step}. See the "errors" field of this exception for more details.`);if(ui(o)||nd(o)||Yi(o)&&this.loop.isNested)throw o}_initializeAbortSignals({exceptionSignal:e,stepTimeoutSignal:t,signal:r}){let n=this.loop.config.configurable?.__pregel_abort_signals??{},i=n.externalAbortSignal??r,a=t??n.timeoutAbortSignal,{signal:o,dispose:s}=Da(i,a,e),c={externalAbortSignal:i,timeoutAbortSignal:a,composedAbortSignal:o};return this.loop.config=Tt(this.loop.config,{[Ck]:c}),{signals:c,disposeCombinedSignal:s}}async*_executeTasksWithRetry(e,t){let{retryPolicy:r,maxConcurrency:n,signals:i}=t??{},a=pZ(),o={},s={executingTasksMap:o,barrier:a,retryPolicy:r,scheduleTask:async(f,p,m)=>this.loop.acceptPush(f,p,m)};if(i?.composedAbortSignal?.aborted)throw new Error("Abort");let c=0,l,u=Da(i?.externalAbortSignal,i?.timeoutAbortSignal),d=u.signal?new Promise((f,p)=>{l=()=>p(new Error("Abort")),u.signal?.addEventListener("abort",l,{once:!0})}):void 0;for(;(c===0||Object.keys(o).length>0)&&e.length;){for(;Object.values(o).length<(n??e.length)&&c<e.length;c+=1){let _=e[c];o[_.id]=zh(_,r,{[Rn]:lk?.bind(s,this,_)},i?.composedAbortSignal).catch(y=>({task:_,error:y,signalAborted:i?.composedAbortSignal?.aborted}))}let f=await Promise.race([...Object.values(o),...d?[d]:[],a.wait]);if(f===ck)continue;let p=f,{task:m,error:h}=p;if(h!==void 0&&!Yi(h)&&!this.loop.isErrorHandlerNode(String(m.name))&&this.loop.getErrorHandlerNode(String(m.name))!==void 0){let _=this.loop.scheduleErrorHandler(m,h);_!==void 0&&(o[_.id]=zh(_,r,{[Rn]:lk?.bind(s,this,_)},i?.composedAbortSignal).catch(y=>({task:_,error:y,signalAborted:i?.composedAbortSignal?.aborted})),a.next())}yield p,l!=null&&(u.signal?.removeEventListener("abort",l),u.dispose?.()),delete o[f.task.id]}}_shouldRouteToErrorHandler(e){let t=String(e.name);return this.loop.isErrorHandlerNode(t)?!1:this.loop.getErrorHandlerNode(t)!==void 0}_commit(e,t){if(t!==void 0)if(ui(t)){if(t.interrupts.length){let r=t.interrupts.map(i=>[Le,i]),n=e.writes.filter(i=>i[0]===nr);n.length&&r.push(...n),this.loop.putWrites(e.id,r)}}else nd(t)?e.writes.length&&this.loop.putWrites(e.id,e.writes):Yi(t)&&e.writes.length?this.loop.putWrites(e.id,e.writes):(e.writes.push([Gi,{message:t.message,name:t.name}]),this._shouldRouteToErrorHandler(e)&&(e.writes.push([Uc,String(e.name)]),this.handledExceptions.add(t)),this.loop.putWrites(e.id,e.writes));else this.nodeFinished&&(e.config?.tags==null||!e.config.tags.includes("langsmith:hidden"))&&this.nodeFinished(String(e.name)),e.writes.length===0&&e.writes.push([Bc,null]),this.loop.putWrites(e.id,e.writes)}};async function lk(e,t,r,n,i,a={}){let o=t.config?.configurable?.[rr];if(!o)throw new Error(`BUG: No scratchpad found on task ${t.name}__${t.id}`);let s=o.callCounter;o.callCounter+=1;let c=new mM({func:r,name:n,input:i,cache:a.cache,retry:a.retry,timeout:a.timeout,callbacks:a.callbacks}),l=await this.scheduleTask(t,s,c);if(!l)return;let u=this.executingTasksMap[l.id];if(u!==void 0)return u;if(l.writes.length>0){let d=l.writes.filter(([p])=>p===Ki),f=l.writes.filter(([p])=>p===Gi);if(d.length>0){if(d.length===1)return Promise.resolve(d[0][1]);throw new Error(`BUG: multiple returns found for task ${l.name}__${l.id}`)}if(f.length>0){if(f.length===1){let p=f[0][1],m=p instanceof Error?p:new Error(String(p));return Promise.reject(m)}throw new Error(`BUG: multiple errors found for task ${l.name}__${l.id}`)}return}else{let d=zh(l,a.retry,{[Rn]:lk.bind(this,e,l)});return this.executingTasksMap[l.id]=d,this.barrier.next(),d.then(({result:f,error:p})=>p?Promise.reject(p):f)}}var Di=class extends Error{constructor(e){super(e),this.name="GraphValidationError"}};function ZM({nodes:e,channels:t,inputChannels:r,outputChannels:n,streamChannels:i,interruptAfterNodes:a,interruptBeforeNodes:o}){if(!t)throw new Di("Channels not provided");let s=new Set,c=new Set;for(let[l,u]of Object.entries(e)){if(l==="__interrupt__")throw new Di(`"Node name ${Le} is reserved"`);if(u.constructor===$n)u.triggers.forEach(d=>s.add(d));else throw new Di(`Invalid node type ${typeof u}, expected PregelNode`)}for(let l of s)if(!(l in t))throw new Di(`Subscribed channel '${String(l)}' not in channels`);if(Array.isArray(r)){if(r.every(l=>!s.has(l)))throw new Di(`None of the input channels ${r} are subscribed to by any node`)}else if(!s.has(r))throw new Di(`Input channel ${String(r)} is not subscribed to by any node`);Array.isArray(n)?n.forEach(l=>c.add(l)):c.add(n),i&&!Array.isArray(i)?c.add(i):Array.isArray(i)&&i.forEach(l=>c.add(l));for(let l of c)if(!(l in t))throw new Di(`Output channel '${String(l)}' not in channels`);if(a&&a!=="*"){for(let l of a)if(!(l in e))throw new Di(`Node ${String(l)} not in nodes`)}if(o&&o!=="*"){for(let l of o)if(!(l in e))throw new Di(`Node ${String(l)} not in nodes`)}}function uk(e,t){if(Array.isArray(e)){for(let r of e)if(!(r in t))throw new Error(`Key ${String(r)} not found in channels`)}else if(!(e in t))throw new Error(`Key ${String(e)} not found in channels`)}function mZ(e){return Array.isArray(e)&&e.length===2&&Array.isArray(e[0])&&Array.isArray(e[1])}var dk=class HM extends yt{lc_graph_name="Topic";unique=!1;accumulate=!1;seen;values;constructor(t){super(),this.unique=t?.unique??this.unique,this.accumulate=t?.accumulate??this.accumulate,this.seen=new Set,this.values=[]}fromCheckpoint(t){let r=new HM({unique:this.unique,accumulate:this.accumulate});return typeof t>"u"?r:mZ(t)?(r.seen=new Set(t[0]),r.values=[...t[1]],r):(r.values=[...t],this.unique&&(r.seen=new Set(r.values)),r)}update(t){let r=!1;this.accumulate||(r=this.values.length>0,this.values=[]);let n=t.flat();if(n.length>0)if(this.unique)for(let i of n)this.seen.has(i)||(r=!0,this.seen.add(i),this.values.push(i));else r=!0,this.values.push(...n);return r}get(){if(this.values.length===0)throw new je;return this.values}checkpoint(){return this.unique?[[...this.seen],[...this.values]]:[...this.values]}isAvailable(){return this.values.length!==0}};function hZ(e){let t=new TextEncoder;return new ReadableStream({async start(r){try{for await(let n of e){let i=n.params.namespace,a=i.length?`${n.method}|${i.join("|")}`:n.method;r.enqueue(t.encode(`event: ${a}
444
+ data: ${JSON.stringify(n.params.data??{})}
445
+
446
+ `))}}catch(n){r.enqueue(t.encode(`event: error
447
+ data: ${JSON.stringify({message:String(n)})}
448
+
449
+ `))}finally{r.close()}}})}var GM=class{static subscribeTo(e,t){let{key:r,tags:n}={key:void 0,tags:void 0,...t??{}};if(Array.isArray(e)&&r!==void 0)throw new Error("Can't specify a key when subscribing to multiple channels");let i;return typeof e=="string"?r?i={[r]:e}:i=[e]:i=Object.fromEntries(e.map(a=>[a,a])),new $n({channels:i,triggers:Array.isArray(e)?e:[e],tags:n})}static writeTo(e,t){let r=[];for(let n of e)r.push({channel:n,value:Ir,skipNone:!1});for(let[n,i]of Object.entries(t??{}))se.isRunnable(i)||typeof i=="function"?r.push({channel:n,value:Ir,skipNone:!0,mapper:at(i)}):r.push({channel:n,value:i,skipNone:!1});return new ut(r)}},gZ=class extends se{lc_namespace=["langgraph","pregel"];invoke(e,t){throw new Error("Not implemented")}withConfig(e){return super.withConfig(e)}stream(e,t){return super.stream(e,t)}},Uh=class extends gZ{static lc_name(){return"LangGraph"}lc_namespace=["langgraph","pregel"];lg_is_pregel=!0;nodes;channels;inputChannels;outputChannels;autoValidate=!0;streamMode=["values"];streamChannels;interruptAfter;interruptBefore;stepTimeout;debug=!1;checkpointer;retryPolicy;config;store;cache;userInterrupt;streamTransformers;triggerToNodes={};constructor(e){super(e);let{streamMode:t}=e;if(t!=null&&!Array.isArray(t)&&(t=[t]),this.nodes=e.nodes,this.channels=e.channels,"__pregel_tasks"in this.channels&&"lc_graph_name"in this.channels.__pregel_tasks&&this.channels.__pregel_tasks.lc_graph_name!=="Topic")throw new Error(`Channel '${Mn}' is reserved and cannot be used in the graph.`);this.channels[Mn]=new dk({accumulate:!1}),this.autoValidate=e.autoValidate??this.autoValidate,this.streamMode=t??this.streamMode,this.inputChannels=e.inputChannels,this.outputChannels=e.outputChannels,this.streamChannels=e.streamChannels??this.streamChannels,this.interruptAfter=e.interruptAfter,this.interruptBefore=e.interruptBefore,this.stepTimeout=e.stepTimeout??this.stepTimeout,this.debug=e.debug??this.debug,this.checkpointer=e.checkpointer,this.retryPolicy=e.retryPolicy,this.config=e.config,this.store=e.store,this.cache=e.cache,this.name=e.name,this.triggerToNodes=e.triggerToNodes??this.triggerToNodes,this.userInterrupt=e.userInterrupt,this.streamTransformers=e.streamTransformers??[],this.autoValidate&&this.validate()}withConfig(e){let{streamTransformers:t,...r}=e,n=$t(this.config,r),i=[...this.streamTransformers,...t??[]];return new this.constructor({...this,config:n,streamTransformers:i})}validate(){ZM({nodes:this.nodes,channels:this.channels,outputChannels:this.outputChannels,inputChannels:this.inputChannels,streamChannels:this.streamChannels,interruptAfterNodes:this.interruptAfter,interruptBeforeNodes:this.interruptBefore});for(let[e,t]of Object.entries(this.nodes))for(let r of t.triggers)this.triggerToNodes[r]??=[],this.triggerToNodes[r].push(e);return this}get streamChannelsList(){return Array.isArray(this.streamChannels)?this.streamChannels:this.streamChannels?[this.streamChannels]:Object.keys(this.channels)}get streamChannelsAsIs(){return this.streamChannels?this.streamChannels:Object.keys(this.channels)}async getGraphAsync(e){return this.getGraph(e)}*getSubgraphs(e,t){for(let[r,n]of Object.entries(this.nodes)){if(e!==void 0&&!e.startsWith(r))continue;let i=n.subgraphs?.length?n.subgraphs:[n.bound];for(let a of i){let o=Th(a);if(o!==void 0){if(r===e){yield[r,o];return}if(e===void 0&&(yield[r,o]),t){let s=e;e!==void 0&&(s=e.slice(r.length+1));for(let[c,l]of o.getSubgraphs(s,t))yield[`${r}|${c}`,l]}}}}}async*getSubgraphsAsync(e,t){yield*this.getSubgraphs(e,t)}async _prepareStateSnapshot({config:e,saved:t,subgraphCheckpointer:r,applyPendingWrites:n=!1}){if(t===void 0)return{values:{},next:[],config:e,tasks:[]};let i=await Tc(this.channels,t.checkpoint,{saver:typeof this.checkpointer=="object"?this.checkpointer:void 0,config:t.config??e});if(t.pendingWrites?.length){let d=t.pendingWrites.filter(([f,p])=>f===ar).map(([f,p,m])=>[String(p),m]);d.length>0&&hr(t.checkpoint,i,[{name:Nn,writes:d,triggers:[]}],void 0,this.triggerToNodes)}let a=Object.values(za(t.checkpoint,t.pendingWrites,this.nodes,i,t.config,!0,{step:(t.metadata?.step??-1)+1,store:this.store})),o=await En(this.getSubgraphsAsync()),s=t.config.configurable?.checkpoint_ns??"",c={};for(let d of a){let f=o.find(([m])=>m===d.name);if(!f)continue;let p=`${String(d.name)}:${d.id}`;if(s&&(p=`${s}|${p}`),r===void 0){let m={configurable:{thread_id:t.config.configurable?.thread_id,checkpoint_ns:p}};c[d.id]=m}else{let m={configurable:{[Vr]:r,thread_id:t.config.configurable?.thread_id,checkpoint_ns:p}},h=f[1];c[d.id]=await h.getState(m,{subgraphs:!0})}}if(n&&t.pendingWrites?.length){let d=Object.fromEntries(a.map(p=>[p.id,p]));for(let[p,m,h]of t.pendingWrites)["__error__","__interrupt__",Ya].includes(m)||p in d&&d[p].writes.push([String(m),h]);let f=a.filter(p=>p.writes.length>0);f.length>0&&hr(t.checkpoint,i,f,void 0,this.triggerToNodes)}let l=t?.metadata;l&&t?.config?.configurable?.thread_id&&(l={...l,thread_id:t.config.configurable.thread_id});let u=a.filter(d=>d.writes.length===0).map(d=>d.name);return{values:In(i,this.streamChannelsAsIs),next:u,tasks:nk(a,t?.pendingWrites??[],c,this.streamChannelsAsIs),metadata:l,config:ja(t.config,t.metadata),createdAt:t.checkpoint.ts,parentConfig:t.parentConfig}}async getState(e,t){let r=e.configurable?.__pregel_checkpointer??this.checkpointer;if(!r)throw new Ka("No checkpointer set",{lc_error_code:"MISSING_CHECKPOINTER"});let n=e.configurable?.checkpoint_ns??"";if(n!==""&&e.configurable?.__pregel_read===void 0&&e.configurable?.__pregel_checkpointer===void 0){let o=gh(n);for await(let[s,c]of this.getSubgraphsAsync(o,!0))if(s===o)return await c.getState(qo(e,{[Vr]:r}),{subgraphs:t?.subgraphs})}let i=$t(this.config,e),a=await r.getTuple(e);return await this._prepareStateSnapshot({config:i,saved:a,subgraphCheckpointer:t?.subgraphs?r:void 0,applyPendingWrites:!e.configurable?.checkpoint_id})}async*getStateHistory(e,t){let r=e.configurable?.__pregel_checkpointer??this.checkpointer;if(!r)throw new Ka("No checkpointer set",{lc_error_code:"MISSING_CHECKPOINTER"});let n=e.configurable?.checkpoint_ns??"";if(n!==""&&e.configurable?.__pregel_checkpointer===void 0){let a=gh(n);for await(let[o,s]of this.getSubgraphsAsync(a,!0))if(o===a){yield*s.getStateHistory(qo(e,{[Vr]:r}),t);return}}let i=$t(this.config,e,{configurable:{checkpoint_ns:n}});for await(let a of r.list(i,t))yield this._prepareStateSnapshot({config:a.config,saved:a})}async bulkUpdateState(e,t){let r=e.configurable?.__pregel_checkpointer??this.checkpointer;if(!r)throw new Ka("No checkpointer set",{lc_error_code:"MISSING_CHECKPOINTER"});if(t.length===0)throw new Error("No supersteps provided");if(t.some(o=>o.updates.length===0))throw new Error("No updates provided");let n=e.configurable?.checkpoint_ns??"";if(n!==""&&e.configurable?.__pregel_checkpointer===void 0){let o=gh(n);for await(let[,s]of this.getSubgraphsAsync(o,!0))return await s.bulkUpdateState(qo(e,{[Vr]:r}),t);throw new Error(`Subgraph "${o}" not found`)}let i=async(o,s)=>{let c=this.config?$t(this.config,o):o,l=await r.getTuple(c),u=l!==void 0?xn(l.checkpoint):Jo(),d={...l?.checkpoint.channel_versions},f=l?.metadata?.step??-1,p=qo(c,{checkpoint_ns:c.configurable?.checkpoint_ns??""}),m=c.metadata??{};l?.config.configurable&&(p=qo(c,l.config.configurable),m={...l.metadata,...m});let{values:h,asNode:_}=s[0];if(h==null&&_===void 0){if(s.length>1)throw new ve("Cannot create empty checkpoint with multiple updates");return ja(await r.put(p,Sn(u,void 0,f),{source:"update",step:f+1,parents:l?.metadata?.parents??{}},{}),l?l.metadata:void 0)}let y=await Tc(this.channels,u,{saver:r,config:l?.config??p});if(h===null&&_==="__end__"){if(s.length>1)throw new ve("Cannot apply multiple updates when clearing state");if(l){let C=za(u,l.pendingWrites||[],this.nodes,y,l.config,!0,{step:(l.metadata?.step??-1)+1,checkpointer:r,store:this.store}),b=(l.pendingWrites||[]).filter(B=>B[0]===ar).map(B=>B.slice(1));b.length>0&&hr(u,y,[{name:Nn,writes:b,triggers:[]}],r.getNextVersion.bind(r),this.triggerToNodes);for(let[B,L,q]of l.pendingWrites||[])["__error__","__interrupt__",Ya].includes(L)||B in C&&C[B].writes.push([L,q]);hr(u,y,Object.values(C),r.getNextVersion.bind(r),this.triggerToNodes)}return ja(await r.put(p,Sn(u,y,f),{...m,source:"update",step:f+1,parents:l?.metadata?.parents??{}},Mc(d,u.channel_versions)),l?l.metadata:void 0)}if(_==="__copy__"){if(s.length>1)throw new ve("Cannot copy checkpoint with multiple updates");if(l==null)throw new ve("Cannot copy a non-existent checkpoint");let C=L=>!Array.isArray(L)||L.length===0?!1:L.every(q=>Array.isArray(q)&&q.length===2),b=Sn(u,void 0,f),B=await r.put(l.parentConfig??qo(l.config,{checkpoint_id:void 0}),b,{source:"fork",step:f+1,parents:l.metadata?.parents??{}},{});if(C(h)){let L=za(b,l.pendingWrites,this.nodes,y,B,!1,{step:f+2}),q=Object.values(L).reduce((Se,{name:Oe,id:mt})=>(Se[Oe]??=[],Se[Oe].push({id:mt}),Se),{}),ae=h.reduce((Se,Oe)=>{let[mt,ye]=Oe;Se[ye]??=[];let V=Se[ye].length,X=q[ye]?.[V]?.id;return Se[ye].push({values:mt,asNode:ye,taskId:X}),Se},{});return i(ja(B,l.metadata),Object.values(ae).flat())}return ja(B,l.metadata)}if(_==="__input__"){if(s.length>1)throw new ve("Cannot apply multiple updates when updating as input");let C=await En(Ch(this.inputChannels,h));if(C.length===0)throw new ve(`Received no input writes for ${JSON.stringify(this.inputChannels,null,2)}`);hr(u,y,[{name:Nn,writes:C,triggers:[]}],r.getNextVersion.bind(this.checkpointer),this.triggerToNodes);let b=l?.metadata?.step!=null?l.metadata.step+1:-1,B=await r.put(p,Sn(u,y,b),{source:"input",step:b,parents:l?.metadata?.parents??{}},Mc(d,u.channel_versions));return await r.putWrites(B,C,jn(Nn,u.id)),ja(B,l?l.metadata:void 0)}if(c.configurable?.checkpoint_id===void 0&&l?.pendingWrites!==void 0&&l.pendingWrites.length>0){let C=za(u,l.pendingWrites,this.nodes,y,l.config,!0,{store:this.store,checkpointer:this.checkpointer,step:(l.metadata?.step??-1)+1}),b=(l.pendingWrites??[]).filter(L=>L[0]===ar).map(L=>L.slice(1));b.length>0&&hr(l.checkpoint,y,[{name:Nn,writes:b,triggers:[]}],void 0,this.triggerToNodes);for(let[L,q,ae]of l.pendingWrites)["__error__","__interrupt__",Ya].includes(q)||C[L]===void 0||C[L].writes.push([q,ae]);let B=Object.values(C).filter(L=>L.writes.length>0);B.length>0&&hr(u,y,B,void 0,this.triggerToNodes)}let w=Object.values(u.versions_seen).map(C=>Object.values(C)).flat().find(C=>!!C),x=[];if(s.length===1){let{values:C,asNode:b,taskId:B}=s[0];if(b===void 0&&Object.keys(this.nodes).length===1)[b]=Object.keys(this.nodes);else if(b===void 0&&w===void 0)typeof this.inputChannels=="string"&&this.nodes[this.inputChannels]!==void 0&&(b=this.inputChannels);else if(b===void 0){let L=Object.entries(u.versions_seen).map(([q,ae])=>Object.values(ae).map(Se=>[Se,q])).flat().filter(([q,ae])=>ae!==Le).sort(([q],[ae])=>sh(q,ae));L&&(L.length===1?b=L[0][1]:L[L.length-1][0]!==L[L.length-2][0]&&(b=L[L.length-1][1]))}if(b===void 0)throw new ve('Ambiguous update, specify "asNode"');x.push({values:C,asNode:b,taskId:B})}else for(let{asNode:C,values:b,taskId:B}of s){if(C==null)throw new ve('"asNode" is required when applying multiple updates');x.push({values:b,asNode:C,taskId:B})}let S=[];for(let{asNode:C,values:b,taskId:B}of x){if(this.nodes[C]===void 0)throw new ve(`Node "${C.toString()}" does not exist`);let L=this.nodes[C].getWriters();if(!L.length)throw new ve(`No writers found for node "${C.toString()}"`);S.push({name:C,input:b,proc:L.length>1?Lr.from(L,{omitSequenceTags:!0}):L[0],writes:[],triggers:[Le],id:B??jn("__interrupt__",u.id),writers:[]})}for(let C of S)await C.proc.invoke(C.input,$e({...c,store:c?.store??this.store},{runName:c.runName??`${this.getName()}UpdateState`,configurable:{[Bt]:b=>C.writes.push(...b),[tr]:(b,B=!1)=>jc(u,y,C,b,B)}}));for(let C of S){let b=C.writes.filter(B=>B[0]!==ir);l!==void 0&&b.length>0&&await r.putWrites(p,b,C.id)}hr(u,y,S,r.getNextVersion.bind(this.checkpointer),this.triggerToNodes);let E=Mc(d,u.channel_versions),P=await r.put(p,Sn(u,y,f+1),{source:"update",step:f+1,parents:l?.metadata?.parents??{}},E);for(let C of S){let b=C.writes.filter(B=>B[0]===ir);b.length>0&&await r.putWrites(P,b,C.id)}return ja(P,l?l.metadata:void 0)},a=e;for(let{updates:o}of t)a=await i(a,o);return a}async updateState(e,t,r){return this.bulkUpdateState(e,[{updates:[{values:t,asNode:r}]}])}_defaults(e){let{debug:t,streamMode:r,inputKeys:n,outputKeys:i,interruptAfter:a,interruptBefore:o,...s}=e,c=!0,l=t!==void 0?t:this.debug,u=i;u===void 0?u=this.streamChannelsAsIs:uk(u,this.channels);let d=n;d===void 0?d=this.inputChannels:uk(d,this.channels);let f=o??this.interruptBefore??[],p=a??this.interruptAfter??[],m;r!==void 0?(m=Array.isArray(r)?r:[r],c=typeof r=="string"):(e.configurable?.__pregel_task_id!==void 0?m=["values"]:m=this.streamMode,c=!0);let h;if(this.checkpointer===!1)h=void 0;else if(e!==void 0&&e.configurable?.__pregel_checkpointer!==void 0)h=e.configurable[Vr];else{if(this.checkpointer===!0)throw new Error("checkpointer: true cannot be used for root graphs.");h=this.checkpointer}let _=e.store??this.store,y=e.cache??this.cache;if(e.durability!=null&&e.checkpointDuring!=null)throw new Error("Cannot use both `durability` and `checkpointDuring` at the same time.");let w=(()=>{if(e.checkpointDuring!=null)return e.checkpointDuring===!1?"exit":"async"})(),x=e.durability??w??e?.configurable?.__pregel_durability??"async";return[l,m,d,u,s,f,p,h,_,c,y,x]}async stream(e,t){let r=new AbortController,n=hh()?.configurable;n?.__pregel_read!==void 0&&t?.configurable?.__pregel_read===void 0&&(t={...t,configurable:{...n,...t?.configurable}});let i={recursionLimit:this.config?.recursionLimit,...t,signal:Da(t?.signal,r.signal).signal},a=await super.stream(e,i);return new jh(t?.encoding==="text/event-stream"?AM(a):a,r)}async#e(e,t){let{version:r,encoding:n,transformers:i,...a}=t,o={recursionLimit:this.config?.recursionLimit,...a,configurable:{...this.config?.configurable,...a?.configurable},version:r,streamMode:jS,subgraphs:!0,encoding:void 0},s=this.stream(e,o),c=WS({[Symbol.asyncIterator]:async function*(){let l=await s;for await(let u of l)yield u}},[...this.streamTransformers??[],...i??[]]);if(n==="text/event-stream"){let l=new AbortController;return l.signal.addEventListener("abort",()=>c.abort(l.signal.reason),{once:!0}),new jh(hZ(c),l)}return c}streamEvents(e,t,r){if(t.version==="v3")return this.#e(e,t);let n=new AbortController,i={recursionLimit:this.config?.recursionLimit,...t,signal:Da(t?.signal,n.signal).signal};return new jh(super.streamEvents(e,i,r),n)}async _validateInput(e){return e}async _validateContext(e){return e}async*_streamIterator(e,t){let r="version"in(t??{})?void 0:t?.encoding??void 0,n=t?.subgraphs,i=t?.version==="v3",a=Cc(this.config,t);if(a.recursionLimit===void 0||a.recursionLimit<1)throw new Error('Passed "recursionLimit" must be at least 1.');if(this.checkpointer!==void 0&&this.checkpointer!==!1&&a.configurable===void 0)throw new Error('Checkpointer requires one or more of the following "configurable" keys: "thread_id", "checkpoint_ns", "checkpoint_id"');let o=await this._validateInput(e),{runId:s,...c}=a,[l,u,,d,f,p,m,h,_,y,w,x]=this._defaults(c);f.metadata={ls_integration:"langgraph",...f.metadata},typeof f.context<"u"?f.context=await this._validateContext(f.context):f.configurable=await this._validateContext(f.configurable);let S=new ak({modes:new Set(u)});if(this.checkpointer===!0){f.configurable??={};let ae=f.configurable.checkpoint_ns??"";f.configurable[Cr]=ae.split("|").map(Se=>Se.split(":")[0]).join("|")}if(u.includes("messages")){let ae=i?new FM(Oe=>S.push(Oe)):new zM(Oe=>S.push(Oe)),{callbacks:Se}=f;if(Se===void 0)f.callbacks=[ae];else if(Array.isArray(Se))f.callbacks=Se.concat(ae);else{let Oe=Se.copy();Oe.addHandler(ae,!0),f.callbacks=Oe}}if(u.includes("tools")){let ae=new CM(Oe=>S.push(Oe)),{callbacks:Se}=f;if(Se===void 0)f.callbacks=[ae];else if(Array.isArray(Se))f.callbacks=Se.concat(ae);else{let Oe=Se.copy();Oe.addHandler(ae,!0),f.callbacks=Oe}}f.writer??=ae=>{if(!u.includes("custom"))return;let Se=hh()?.configurable?.[Cr]?.split("|").slice(0,-1);S.push([Se??[],"custom",ae])},f.interrupt??=this.userInterrupt??YS,f.serverInfo==null&&(f.serverInfo=_Z(f)),f.control??=new MS;let E={tracerInheritableMetadata:bZ(f)},P=await(await Ye._configureSync(f?.callbacks,void 0,f?.tags,void 0,f?.metadata,void 0,E))?.handleChainStart(this.toJSON(),pM(e,"input"),s,void 0,void 0,void 0,f?.runName??this.getName()),C=Ic(this.channels),b,B,q=(async()=>{try{b=await MM.initialize({input:o,config:f,checkpointer:h,nodes:this.nodes,channelSpecs:C,outputKeys:d,streamKeys:this.streamChannelsAsIs,store:_,cache:w,stream:S,interruptAfter:m,interruptBefore:p,manager:P,debug:this.debug,triggerToNodes:this.triggerToNodes,durability:x});let ae=new VM({loop:b,nodeFinished:f.configurable?.[Tk]});t?.subgraphs&&(b.config.configurable={...b.config.configurable,[Lc]:b.stream}),await this._runLoop({loop:b,runner:ae,debug:l,config:f}),x==="sync"&&await Promise.all(b?.checkpointerPromises??[])}catch(ae){B=ae}finally{try{b&&(await b.store?.stop(),await b.cache?.stop()),await Promise.all(b?.checkpointerPromises??[])}catch(ae){B=B??ae}B?(await new Promise(ae=>{queueMicrotask(ae)}),S.error(B)):S.close()}})();try{for await(let ae of S){if(ae===void 0)throw new Error("Data structure error.");let[Se,Oe,mt]=ae,ye="version"in(t??{});if(u.includes(Oe)||Oe==="checkpoints"&&Ac(mt)&&(i||ye&&n&&u.includes("values"))){if(r==="text/event-stream"){n?yield[Se,Oe,mt]:yield[null,Oe,mt];continue}n&&!y?yield[Se,Oe,mt]:y?n?yield[Se,mt]:yield mt:yield[Oe,mt]}}}catch(ae){throw await P?.handleChainError(B),ae}finally{await q}await P?.handleChainEnd(b?.output??{},s,void 0,void 0,void 0)}async invoke(e,t){let r=t?.streamMode??"values",n={...t,outputKeys:t?.outputKeys??this.outputChannels,streamMode:r,encoding:void 0},i=[],a=await this.stream(e,n),o=[],s;for await(let c of a)r==="values"?Ja(c)?o.push(c[Le]):s=c:i.push(c);if(r==="values"){if(o.length>0){let c=o.flat(1);if(s==null)return{[Le]:c};if(typeof s=="object")return{...s,[Le]:c}}return s}return i}async _runLoop(e){let{loop:t,runner:r,debug:n,config:i}=e,a;try{for(;await t.tick({inputKeys:this.inputChannels});){for(let{task:o}of await t._matchCachedWrites())t._outputWrites(o.id,o.writes,!0);n&&EM(t.checkpointMetadata.step,t.channels,this.streamChannelsList),n&&Wu(t.step,Object.values(t.tasks)),await r.tick({timeout:this.stepTimeout,retryPolicy:this.retryPolicy,onStepWrite:(o,s)=>{n&&$M(o,s,this.streamChannelsList)},maxConcurrency:i.maxConcurrency,signal:i.signal})}if(t.status==="draining")throw t.control==null?new Error("Draining status requires run control"):new rd(t.control.drainReason??"shutdown");if(t.status==="out_of_steps")throw new Hh([`Recursion limit of ${i.recursionLimit} reached`,"without hitting a stop condition. You can increase the",'limit by setting the "recursionLimit" config key.'].join(" "),{lc_error_code:"GRAPH_RECURSION_LIMIT"})}catch(o){if(a=o,!await t.finishAndHandleError(a))throw o}finally{a===void 0&&await t.finishAndHandleError()}}async clearCache(){await this.cache?.clear([])}};function _Z(e){let t=e.metadata??{},r=e.configurable??{},n=r.assistant_id??t.assistant_id,i=r.graph_id??t.graph_id,a=r.langgraph_auth_user,o;if(a!=null&&typeof a=="object"&&"identity"in a&&(o=a),n!=null||i!=null||o!=null)return{assistantId:n!=null?String(n):"",graphId:i!=null?String(i):"",user:o}}var yZ=new Set(["key","token","secret","password","auth"]);function vZ(e,t){let r=e.toLowerCase(),n=!1;for(let i of yZ)if(r.includes(i)){n=!0;break}return e.startsWith("__")||!(typeof t=="string"||typeof t=="number"||typeof t=="boolean")||n}function bZ(e){let t=e.configurable;if(!t)return;let r=e.context,n={};for(let[i,a]of Object.entries(t)){if(r!=null&&Object.prototype.hasOwnProperty.call(r,i)&&Object.is(r[i],a)){i.startsWith("__")||(n[i]=void 0);continue}vZ(i,a)||(n[i]=a)}return Object.keys(n).length>0?n:void 0}var Tn=class WM extends yt{lc_graph_name="EphemeralValue";guard;value=[];constructor(t=!0){super(),this.guard=t}fromCheckpoint(t){let r=new WM(this.guard);return typeof t<"u"&&(r.value=[t]),r}update(t){if(t.length===0){let r=this.value.length>0;return this.value=[],r}if(t.length!==1&&this.guard)throw new ve("EphemeralValue can only receive one value per step.");return this.value=[t[t.length-1]],!0}get(){if(this.value.length===0)throw new je;return this.value[0]}checkpoint(){if(this.value.length===0)throw new je;return this.value[0]}isAvailable(){return this.value.length!==0}};var fk=class{path;ends;constructor(e){se.isRunnable(e.path)?this.path=e.path:this.path=at(e.path),this.ends=Array.isArray(e.pathMap)?e.pathMap.reduce((t,r)=>(t[r]=r,t),{}):e.pathMap}run(e,t){return ut.registerWriter(new Mt({name:"<branch_run>",trace:!1,func:async(r,n)=>{try{return await this._route(r,n,e,t)}catch(i){throw i.name===id.unminifiable_name&&console.warn(`[WARN]: 'NodeInterrupt' thrown in conditional edge. This is likely a bug in your graph implementation.
450
+ NodeInterrupt should only be thrown inside a node, not in edge conditions.`),i}}}))}async _route(e,t,r,n){let i=await this.path.invoke(n?n(t):e,t);Array.isArray(i)||(i=[i]);let a;if(this.ends?a=i.map(o=>wt(o)?o:this.ends[o]):a=i,a.some(o=>!o))throw new Error("Branch condition returned unknown or null destination");if(a.filter(wt).some(o=>o.node==="__end__"))throw new ve("Cannot send a packet to the END node");return await r(a,t)??e}},pk=class{nodes;edges;branches;entryPoint;compiled=!1;constructor(){this.nodes={},this.edges=new Set,this.branches={}}warnIfCompiled(e){this.compiled&&console.warn(e)}get allEdges(){return this.edges}addNode(...e){function t(n){return n.length>=1&&typeof n[0]!="string"}let r=t(e)?Array.isArray(e[0])?e[0]:Object.entries(e[0]):[[e[0],e[1],e[2]]];if(r.length===0)throw new Error("No nodes provided in `addNode`");for(let[n,i,a]of r){for(let s of["|",":"])if(n.includes(s))throw new Error(`"${s}" is a reserved character and is not allowed in node names.`);if(this.warnIfCompiled("Adding a node to a graph that has already been compiled. This will not be reflected in the compiled graph."),n in this.nodes)throw new Error(`Node \`${n}\` already present.`);if(n==="__end__")throw new Error(`Node \`${n}\` is reserved.`);let o=at(i);this.nodes[n]={runnable:o,metadata:a?.metadata,subgraphs:Vu(o)?[o]:a?.subgraphs,ends:a?.ends}}return this}addEdge(e,t){if(this.warnIfCompiled("Adding an edge to a graph that has already been compiled. This will not be reflected in the compiled graph."),e==="__end__")throw new Error("END cannot be a start node");if(t==="__start__")throw new Error("START cannot be an end node");if(Array.from(this.edges).some(([r])=>r===e)&&!("channels"in this))throw new Error(`Already found path for ${e}. For multiple edges, use StateGraph.`);return this.edges.add([e,t]),this}addConditionalEdges(e,t,r){let n=typeof e=="object"?e:{source:e,path:t,pathMap:r};this.warnIfCompiled("Adding an edge to a graph that has already been compiled. This will not be reflected in the compiled graph."),se.isRunnable(n.path)||(n.path=at(n.path));let i=n.path.getName()==="RunnableLambda"?"condition":n.path.getName();if(this.branches[n.source]&&this.branches[n.source][i])throw new Error(`Condition \`${i}\` already present for node \`${e}\``);return this.branches[n.source]??={},this.branches[n.source][i]=new fk(n),this}setEntryPoint(e){return this.warnIfCompiled("Setting the entry point of a graph that has already been compiled. This will not be reflected in the compiled graph."),this.addEdge(Je,e)}setFinishPoint(e){return this.warnIfCompiled("Setting a finish point of a graph that has already been compiled. This will not be reflected in the compiled graph."),this.addEdge(e,et)}compile({checkpointer:e,interruptBefore:t,interruptAfter:r,name:n,transformers:i}={}){this.validate([...Array.isArray(t)?t:[],...Array.isArray(r)?r:[]]);let a=new mk({builder:this,checkpointer:e,interruptAfter:r,interruptBefore:t,autoValidate:!1,nodes:{},channels:{[Je]:new Tn,[et]:new Tn},inputChannels:Je,outputChannels:et,streamChannels:[],streamMode:"values",name:n,streamTransformers:i});for(let[o,s]of Object.entries(this.nodes))a.attachNode(o,s);for(let[o,s]of this.edges)a.attachEdge(o,s);for(let[o,s]of Object.entries(this.branches))for(let[c,l]of Object.entries(s))a.attachBranch(o,c,l);return a.validate()}validate(e){let t=new Set([...this.allEdges].map(([n,i])=>n));for(let[n]of Object.entries(this.branches))t.add(n);for(let n of t)if(n!=="__start__"&&!(n in this.nodes))throw new Error(`Found edge starting at unknown node \`${n}\``);let r=new Set([...this.allEdges].map(([n,i])=>i));for(let[n,i]of Object.entries(this.branches))for(let a of Object.values(i))if(a.ends!=null)for(let o of Object.values(a.ends))r.add(o);else{r.add(et);for(let o of Object.keys(this.nodes))o!==n&&r.add(o)}for(let n of Object.values(this.nodes))for(let i of n.ends??[])r.add(i);if(Object.values(this.nodes).some(n=>n.isErrorHandler))for(let n of Object.keys(this.nodes))r.add(n);for(let n of Object.keys(this.nodes))if(!this.nodes[n].isErrorHandler&&!r.has(n))throw new Wh([`Node \`${n}\` is not reachable.`,"","If you are returning Command objects from your node,",'make sure you are passing names of potential destination nodes as an "ends" array','into ".addNode(..., { ends: ["node1", "node2"] })".'].join(`
451
+ `),{lc_error_code:"UNREACHABLE_NODE"});for(let n of r)if(n!=="__end__"&&!(n in this.nodes))throw new Error(`Found edge ending at unknown node \`${n}\``);if(e){for(let n of e)if(!(n in this.nodes))throw new Error(`Interrupt node \`${n}\` is not present`)}this.compiled=!0}},mk=class extends Uh{builder;constructor({builder:e,...t}){super(t),this.builder=e}withConfig(e){return super.withConfig(e)}attachNode(e,t){this.channels[e]=new Tn,this.nodes[e]=new $n({channels:[],triggers:[],metadata:t.metadata,subgraphs:t.subgraphs,ends:t.ends}).pipe(t.runnable).pipe(new ut([{channel:e,value:Ir}],[ht])),this.streamChannels.push(e)}attachEdge(e,t){if(t==="__end__"){if(e==="__start__")throw new Error("Cannot have an edge from START to END");this.nodes[e].writers.push(new ut([{channel:et,value:Ir}],[ht]))}else this.nodes[t].triggers.push(e),this.nodes[t].channels.push(e)}attachBranch(e,t,r){e==="__start__"&&!this.nodes.__start__&&(this.nodes[Je]=GM.subscribeTo(Je,{tags:[ht]})),this.nodes[e].pipe(r.run(i=>new ut(i.map(a=>wt(a)?a:{channel:a==="__end__"?et:`branch:${e}:${t}:${a}`,value:Ir}),[ht])));let n=r.ends?Object.values(r.ends):Object.keys(this.nodes);for(let i of n)if(i!=="__end__"){let a=`branch:${e}:${t}:${i}`;this.channels[a]=new Tn,this.nodes[i].triggers.push(a),this.nodes[i].channels.push(a)}}async getGraphAsync(e){let t=e?.xray,r=new Bo,n={[Je]:r.addNode({schema:nn.any()},Je)},i={},a={};t&&(a=Object.fromEntries((await En(this.getSubgraphsAsync())).filter(l=>JM(l[1]))));let o=[];function s(l,u,d,f=!1){if(u==="__end__"&&i.__end__===void 0&&(i[et]=r.addNode({schema:nn.any()},et)),n[l]!==void 0){if(i[u]===void 0)throw new Error(`End node ${u} not found!`);return o.push({src:l,dest:u,conditional:f}),r.addEdge(n[l],i[u],d!==u?d:void 0,f)}}for(let[l,u]of Object.entries(this.builder.nodes)){let d=Ct(l),f=u.runnable,p=u.metadata??{};if(this.interruptBefore?.includes(l)&&this.interruptAfter?.includes(l)?p.__interrupt="before,after":this.interruptBefore?.includes(l)?p.__interrupt="before":this.interruptAfter?.includes(l)&&(p.__interrupt="after"),t){let m=typeof t=="number"?t-1:t,h=a[l]!==void 0?await a[l].getGraphAsync({...e,xray:m}):f.getGraph(e);if(h.trimFirstNode(),h.trimLastNode(),Object.keys(h.nodes).length>1){let w=function(S){return S?S.lc_runnable:!1},x=function(S,E){if(S!==void 0&&!di(S))return S;if(w(E))try{let P=E.getName();return P=P.startsWith("Runnable")?P.slice(8):P,P}catch{return E.getName()}else return E.name??"UnknownSchema"},[_,y]=r.extend(h,d);if(_===void 0)throw new Error(`Could not extend subgraph "${l}" due to missing entrypoint.`);y!==void 0&&(n[d]={name:x(y.id,y.data),...y}),i[d]={name:x(_.id,_.data),..._}}else{let _=r.addNode(f,d,p);n[d]=_,i[d]=_}}else{let m=r.addNode(f,d,p);n[d]=m,i[d]=m}}let c=[...this.builder.allEdges].sort(([l],[u])=>l<u?-1:u>l?1:0);for(let[l,u]of c)s(Ct(l),Ct(u));for(let[l,u]of Object.entries(this.builder.branches)){let d={...Object.fromEntries(Object.keys(this.builder.nodes).filter(f=>f!==l).map(f=>[Ct(f),Ct(f)])),[et]:et};for(let f of Object.values(u)){let p;f.ends!==void 0?p=f.ends:p=d;for(let[m,h]of Object.entries(p))s(Ct(l),Ct(h),m,!0)}}for(let[l,u]of Object.entries(this.builder.nodes))if(u.ends!==void 0)for(let d of u.ends)s(Ct(l),Ct(d),void 0,!0);return KM(this.builder.nodes,o,s),r}getGraph(e){let t=e?.xray,r=new Bo,n={[Je]:r.addNode({schema:nn.any()},Je)},i={},a={};t&&(a=Object.fromEntries(Ma(this.getSubgraphs()).filter(l=>JM(l[1]))));let o=[];function s(l,u,d,f=!1){if(u==="__end__"&&i.__end__===void 0&&(i[et]=r.addNode({schema:nn.any()},et)),n[l]!==void 0){if(i[u]===void 0)throw new Error(`End node ${u} not found!`);return o.push({src:l,dest:u,conditional:f}),r.addEdge(n[l],i[u],d!==u?d:void 0,f)}}for(let[l,u]of Object.entries(this.builder.nodes)){let d=Ct(l),f=u.runnable,p=u.metadata??{};if(this.interruptBefore?.includes(l)&&this.interruptAfter?.includes(l)?p.__interrupt="before,after":this.interruptBefore?.includes(l)?p.__interrupt="before":this.interruptAfter?.includes(l)&&(p.__interrupt="after"),t){let m=typeof t=="number"?t-1:t,h=a[l]!==void 0?a[l].getGraph({...e,xray:m}):f.getGraph(e);if(h.trimFirstNode(),h.trimLastNode(),Object.keys(h.nodes).length>1){let w=function(S){return S?S.lc_runnable:!1},x=function(S,E){if(S!==void 0&&!di(S))return S;if(w(E))try{let P=E.getName();return P=P.startsWith("Runnable")?P.slice(8):P,P}catch{return E.getName()}else return E.name??"UnknownSchema"},[_,y]=r.extend(h,d);if(_===void 0)throw new Error(`Could not extend subgraph "${l}" due to missing entrypoint.`);y!==void 0&&(n[d]={name:x(y.id,y.data),...y}),i[d]={name:x(_.id,_.data),..._}}else{let _=r.addNode(f,d,p);n[d]=_,i[d]=_}}else{let m=r.addNode(f,d,p);n[d]=m,i[d]=m}}let c=[...this.builder.allEdges].sort(([l],[u])=>l<u?-1:u>l?1:0);for(let[l,u]of c)s(Ct(l),Ct(u));for(let[l,u]of Object.entries(this.builder.branches)){let d={...Object.fromEntries(Object.keys(this.builder.nodes).filter(f=>f!==l).map(f=>[Ct(f),Ct(f)])),[et]:et};for(let f of Object.values(u)){let p;f.ends!==void 0?p=f.ends:p=d;for(let[m,h]of Object.entries(p))s(Ct(l),Ct(h),m,!0)}}for(let[l,u]of Object.entries(this.builder.nodes))if(u.ends!==void 0)for(let d of u.ends)s(Ct(l),Ct(d),void 0,!0);return KM(this.builder.nodes,o,s),r}};function JM(e){return typeof e.attachNode=="function"&&typeof e.attachEdge=="function"}function Ct(e){return e==="subgraph"?`"${e}"`:e}function KM(e,t,r){let n=new Set(t.map(a=>a.src)),i=[...new Set(t.filter(a=>!a.conditional&&a.dest!=="__end__").map(a=>a.dest))].sort();for(let a of i){if(n.has(a))continue;let o=Object.keys(e).find(s=>Ct(s)===a);o!==void 0&&e[o]?.isErrorHandler||r(a,et)}}function zi(e){return typeof e=="object"&&e!==null&&"~standard"in e&&typeof e["~standard"]=="object"&&e["~standard"]!==null&&"validate"in e["~standard"]}function hk(e){return typeof e=="object"&&e!==null&&"~standard"in e&&typeof e["~standard"]=="object"&&e["~standard"]!==null&&"jsonSchema"in e["~standard"]}function wZ(e){return zi(e)&&hk(e)}function Ua(e){if(hk(e))try{return e["~standard"].jsonSchema.input({target:"draft-07"})}catch{return}}function Ui(e){if(e!=null&&zi(e))try{let t=e["~standard"].validate(void 0);if(t&&typeof t=="object"&&!("then"in t&&typeof t.then=="function")){let r=t;if(!r.issues){let n=r.value;return()=>n}}}catch{}}var xZ=e=>e!=null&&e.lc_graph_name==="DeltaChannel",Lh=class qM extends yt{lc_graph_name="DeltaChannel";value;reducer;snapshotFrequency;initialValueFactory;constructor(t,r){super();let n=r?.snapshotFrequency??1e3;if(!Number.isInteger(n)||n<=0)throw new Error(`snapshotFrequency must be a positive integer, got ${n}`);this.reducer=t,this.snapshotFrequency=n,this.initialValueFactory=r?.initialValueFactory??(()=>[]),this.value=void 0}fromCheckpoint(t){let r=new qM(this.reducer,{snapshotFrequency:this.snapshotFrequency,initialValueFactory:this.initialValueFactory});return t===void 0?r.value=this.initialValueFactory():tg(t)?r.value=t.value:r.value=t,r}replayWrites(t){let r=t.map(o=>o[2]);if(r.length===0)return;let n=this.value,i=0;for(let o=0;o<r.length;o+=1){let[s,c]=cn(r[o]);s&&(n=c??this.initialValueFactory(),i=o+1)}let a=r.slice(i);this.value=a.length>0?this.reducer(n,a):n}update(t){if(t.length===0)return!1;let r,n=!1;for(let a of t)if(Wa(a)){if(n)throw new ve("Can receive only one Overwrite value per step.");n=!0,[,r]=cn(a)}if(n)return this.value=r??this.initialValueFactory(),!0;let i=this.value===void 0?this.initialValueFactory():this.value;return this.value=this.reducer(i,t),!0}get(){if(this.value===void 0)throw new je;return this.value}checkpoint(){}isAvailable(){return this.value!==void 0}equals(t){return this===t?!0:!xZ(t)||this.snapshotFrequency!==t.snapshotFrequency?!1:this.reducer===t.reducer}};var gk=Symbol.for("langgraph.channel.missing"),Fh=class YM extends yt{lc_graph_name="UntrackedValue";guard;_value=gk;initialValueFactory;constructor(t){super(),this.guard=t?.guard??!0,this.initialValueFactory=t?.initialValueFactory,this.initialValueFactory&&(this._value=this.initialValueFactory())}fromCheckpoint(t){return new YM({guard:this.guard,initialValueFactory:this.initialValueFactory})}update(t){if(t.length===0)return!1;if(t.length!==1&&this.guard)throw new ve("UntrackedValue(guard=true) can receive only one value per step. Use guard=false if you want to store any one of multiple values.",{lc_error_code:"INVALID_CONCURRENT_GRAPH_UPDATE"});return this._value=t[t.length-1],!0}get(){if(this._value===gk)throw new je;return this._value}checkpoint(){}isAvailable(){return this._value!==gk}};var La=(e,t)=>e.size===t.size&&[...e].every(r=>t.has(r)),_k=class XM extends yt{lc_graph_name="NamedBarrierValue";names;seen;constructor(t){super(),this.names=t,this.seen=new Set}fromCheckpoint(t){let r=new XM(this.names);return typeof t<"u"&&(r.seen=new Set(t)),r}update(t){let r=!1;for(let n of t)if(this.names.has(n))this.seen.has(n)||(this.seen.add(n),r=!0);else throw new ve(`Value ${JSON.stringify(n)} not in names ${JSON.stringify(this.names)}`);return r}get(){if(!La(this.names,this.seen))throw new je}checkpoint(){return[...this.seen]}consume(){return this.seen&&this.names&&La(this.seen,this.names)?(this.seen=new Set,!0):!1}isAvailable(){return!!this.names&&La(this.names,this.seen)}},yk=class QM extends yt{lc_graph_name="NamedBarrierValueAfterFinish";names;seen;finished;constructor(t){super(),this.names=t,this.seen=new Set,this.finished=!1}fromCheckpoint(t){let r=new QM(this.names);if(typeof t<"u"){let[n,i]=t;r.seen=new Set(n),r.finished=i}return r}update(t){let r=!1;for(let n of t)if(this.names.has(n)&&!this.seen.has(n))this.seen.add(n),r=!0;else if(!this.names.has(n))throw new ve(`Value ${JSON.stringify(n)} not in names ${JSON.stringify(this.names)}`);return r}get(){if(!this.finished||!La(this.names,this.seen))throw new je}checkpoint(){return[[...this.seen],this.finished]}consume(){return this.finished&&this.seen&&this.names&&La(this.seen,this.names)?(this.seen=new Set,this.finished=!1,!0):!1}finish(){return!this.finished&&this.names&&La(this.names,this.seen)?(this.finished=!0,!0):!1}isAvailable(){return this.finished&&!!this.names&&La(this.names,this.seen)}};var vk=Symbol.for("langgraph.state.reduced_value"),Li=class{[vk]=!0;valueSchema;inputSchema;reducer;jsonSchemaExtra;constructor(e,t){this.reducer=t.reducer,this.jsonSchemaExtra=t.jsonSchemaExtra,this.valueSchema=e,this.inputSchema="inputSchema"in t?t.inputSchema:e,this.jsonSchemaExtra=t.jsonSchemaExtra}static isInstance(e){return typeof e=="object"&&e!==null&&vk in e&&e[vk]===!0}};var ej=Symbol.for("langgraph.state.untracked_value"),Xo=class{[ej]=!0;schema;guard;constructor(e,t){this.schema=e,this.guard=t?.guard??!0}static isInstance(e){return typeof e=="object"&&e!==null&&ej in e}};var bk=Symbol.for("langgraph.state.delta_value"),Fi=class{[bk]=!0;valueSchema;inputSchema;reducer;snapshotFrequency;jsonSchemaExtra;constructor(e,t){this.reducer=t.reducer,this.valueSchema=e,this.inputSchema="inputSchema"in t?t.inputSchema:e,this.snapshotFrequency=t.snapshotFrequency,this.jsonSchemaExtra=t.jsonSchemaExtra}static isInstance(e){return typeof e=="object"&&e!==null&&bk in e&&e[bk]===!0}};var wk=Symbol.for("langgraph.state.state_schema"),Cn=class{[wk]=!0;constructor(e){this.fields=e}getChannels(){let e={};for(let[t,r]of Object.entries(this.fields))if(Fi.isInstance(r)){let n=Ui(r.valueSchema);e[t]=new Lh(r.reducer,{snapshotFrequency:r.snapshotFrequency,initialValueFactory:n})}else if(Li.isInstance(r)){let n=Ui(r.valueSchema);e[t]=new Mi(r.reducer,n)}else if(Xo.isInstance(r)){let n=r.schema?Ui(r.schema):void 0;e[t]=new Fh({guard:r.guard,initialValueFactory:n})}else if(zi(r))e[t]=new kn(Ui(r));else throw new Error(`Invalid state field "${t}": must be a schema, ReducedValue, DeltaValue, UntrackedValue, or ManagedValue`);return e}getJsonSchema(){let e={},t=[];for(let[r,n]of Object.entries(this.fields)){let i;if(Fi.isInstance(n)||Li.isInstance(n)?(i=Ua(n.valueSchema),n.jsonSchemaExtra&&(i={...i??{},...n.jsonSchemaExtra})):Xo.isInstance(n)?i=n.schema?Ua(n.schema):void 0:zi(n)&&(i=Ua(n)),i){e[r]=i;let a=!1;Fi.isInstance(n)||Li.isInstance(n)?a=Ui(n.valueSchema)!==void 0:Xo.isInstance(n)?a=n.schema?Ui(n.schema)!==void 0:!1:a=Ui(n)!==void 0,a||t.push(r)}}return{type:"object",properties:e,required:t.length>0?t:void 0}}getInputJsonSchema(){let e={};for(let[t,r]of Object.entries(this.fields)){let n;Fi.isInstance(r)||Li.isInstance(r)?(n=Ua(r.inputSchema),r.jsonSchemaExtra&&(n={...n??{},...r.jsonSchemaExtra})):Xo.isInstance(r)?n=r.schema?Ua(r.schema):void 0:zi(r)&&(n=Ua(r)),n&&(e[t]=n)}return{type:"object",properties:e}}getChannelKeys(){return Object.entries(this.fields).map(([e])=>e)}getAllKeys(){return Object.keys(this.fields)}async validateInput(e){if(e==null||typeof e!="object")return e;let t={};for(let[r,n]of Object.entries(e)){let i=this.fields[r];if(i===void 0){t[r]=n;continue}let a;if(Fi.isInstance(i)||Li.isInstance(i)){let[o,s]=cn(n);if(o){a=i.valueSchema;let c=await a["~standard"].validate(s);if(c.issues)throw new Error(`Validation failed for field "${r}": ${JSON.stringify(c.issues)}`);t[r]={[Pn]:c.value};continue}a=i.inputSchema}else Xo.isInstance(i)?a=i.schema:zi(i)&&(a=i);if(a){let o=await a["~standard"].validate(n);if(o.issues)throw new Error(`Validation failed for field "${r}": ${JSON.stringify(o.issues)}`);t[r]=o.value}else t[r]=n}return t}static isInstance(e){return typeof e=="object"&&e!==null&&wk in e&&e[wk]===!0}};var SZ="__remove_all__";function Fa(e,t){let r=Array.isArray(e)?e:[e],n=Array.isArray(t)?t:[t],i=r.map(Et),a=n.map(Et);for(let u of i)(u.id===null||u.id===void 0)&&(u.id=ea(),u.lc_kwargs.id=u.id);let o;for(let u=0;u<a.length;u+=1){let d=a[u];(d.id===null||d.id===void 0)&&(d.id=ea(),d.lc_kwargs.id=d.id),Nr.isInstance(d)&&d.id==="__remove_all__"&&(o=u)}if(o!=null)return a.slice(o+1);let s=[...i],c=new Map(s.map((u,d)=>[u.id,d])),l=new Set;for(let u of a){let d=c.get(u.id);if(d!==void 0)Nr.isInstance(u)?l.add(u.id):(l.delete(u.id),s[d]=u);else{if(Nr.isInstance(u))throw new Error(`Attempting to delete a message with an ID that doesn't exist ('${u.id}')`);c.set(u.id,s.length),s.push(u)}}return s.filter(u=>!l.has(u.id))}function xk(e,t){let r=[];for(let s of t)Array.isArray(s)?r.push(...s):r.push(s);let n=e.length>0&&Pe.isInstance(e[0])?e:e.map(Et),i=r.map(Et),a=new Map;for(let s=0;s<n.length;s+=1){let c=n[s].id;c!=null&&a.set(c,s)}let o=[...n];for(let s of i){let c=s.id;Nr.isInstance(s)&&c==="__remove_all__"?(o.length=0,a.clear()):c==null?o.push(s):Nr.isInstance(s)?a.has(c)&&(o[a.get(c)]=null,a.delete(c)):a.has(c)?o[a.get(c)]=s:(a.set(c,o.length),o.push(s))}return o.filter(s=>s!==null)}var tj=nn.custom().default(()=>[]),rj=nn.custom(),kZ=new Li(tj,{inputSchema:rj,reducer:Fa,jsonSchemaExtra:{langgraph_type:"messages",description:"A list of chat messages"}}),EZ=new Fi(tj,{inputSchema:rj,reducer:xk,jsonSchemaExtra:{langgraph_type:"messages",description:"A list of chat messages"}});var $Z=class{_map=new Map;_extensionCache=new Map;get(e){return this._map.get(e)}extend(e,t){let r=this.get(e);this._map.set(e,t(r))}remove(e){return this._map.delete(e),this}has(e){return this._map.has(e)}getChannelsForSchema(e){let t={},r=Ei(e);for(let[n,i]of Object.entries(r)){let a=this.get(i);a?.reducer?t[n]=new Mi(a.reducer.fn,a.default):t[n]=new kn(a?.default)}return t}getExtendedChannelSchemas(e,t){if(Object.keys(t).length===0)return e;let r=Object.entries(t).filter(([,a])=>a===!0).sort(([a],[o])=>a.localeCompare(o)).map(([a,o])=>`${a}:${o}`).join("|"),n=this._extensionCache.get(r)??new Map;if(n.has(e))return n.get(e);let i=e;if(t.withReducerSchema||t.withJsonSchemaExtrasAsDescription){let a=Object.entries(Ei(e)).map(([o,s])=>{let c=this.get(s),l=t.withReducerSchema?c?.reducer?.schema??s:s;if(t.withJsonSchemaExtrasAsDescription&&c?.jsonSchemaExtra){let u=$i(l)??$i(s),d=JSON.stringify({...c.jsonSchemaExtra,description:u});l=l.describe(`lg:${d}`)}return[o,l]});i=Ip(e,Object.fromEntries(a)),lt(i)&&(i._def.unknownKeys="strip")}return t.asPartial&&(i=$a(i)),n.set(e,i),this._extensionCache.set(r,n),i}},Ju=new $Z;function nj(e,t){if(t.reducer&&!t.default){let r=Tp(e);r!=null&&(t.default=r)}if(t.reducer){let r=Object.assign(e,{lg_reducer_schema:t.reducer?.schema??e});return Ju.extend(r,()=>t),r}else return Ju.extend(e,()=>t),e}function Qo(e){return e==null?!1:!!(Cn.isInstance(e)||Kt(e)||typeof e=="object"&&"lc_graph_name"in e&&e.lc_graph_name==="AnnotationRoot"||typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length>0&&Object.values(e).every(t=>typeof t=="function"||PS(t)))}function ij(e){if(typeof e!="object"||e==null)return!1;let t=e,r="state"in t&&Qo(t.state),n="stateSchema"in t&&Qo(t.stateSchema),i="input"in t&&Qo(t.input);return!(!r&&!n&&!i||"input"in t&&t.input!=null&&!Qo(t.input)||"output"in t&&t.output!=null&&!Qo(t.output))}var Bi="__root__",Dc="__default_error_handler__",Bh=Symbol.for("langgraph.state.partial"),Sk=class extends pk{channels={};waitingEdges=new Set;_schemaDefinition;_schemaRuntimeDefinition;_inputDefinition;_inputRuntimeDefinition;_outputDefinition;_outputRuntimeDefinition;_schemaDefinitions=new Map;_metaRegistry=Ju;_configSchema;_configRuntimeSchema;_interrupt;_writer;_nodeDefaults={};constructor(e,t){super();let r=this._normalizeToStateGraphInit(e,t),n=r.state??r.stateSchema??r.input;if(!n)throw new Vc;let i=this._getChannelsFromSchema(n);this._schemaDefinition=i,Cn.isInstance(n)?this._schemaRuntimeDefinition=n:Kt(n)&&(this._schemaRuntimeDefinition=n),r.input?Cn.isInstance(r.input)?this._inputRuntimeDefinition=r.input:Kt(r.input)?this._inputRuntimeDefinition=r.input:this._inputRuntimeDefinition=Bh:this._inputRuntimeDefinition=Bh,r.output?Cn.isInstance(r.output)?this._outputRuntimeDefinition=r.output:Kt(r.output)?this._outputRuntimeDefinition=r.output:this._outputRuntimeDefinition=this._schemaRuntimeDefinition:this._outputRuntimeDefinition=this._schemaRuntimeDefinition;let a=r.input?this._getChannelsFromSchema(r.input):i,o=r.output?this._getChannelsFromSchema(r.output):i;this._inputDefinition=a,this._outputDefinition=o,this._addSchema(this._schemaDefinition),this._addSchema(this._inputDefinition),this._addSchema(this._outputDefinition),r.context&&Kt(r.context)&&(this._configRuntimeSchema=r.context),this._interrupt=r.interrupt,this._writer=r.writer}setNodeDefaults(e){return e.retryPolicy!==void 0&&(this._nodeDefaults.retryPolicy=e.retryPolicy),e.cachePolicy!==void 0&&(this._nodeDefaults.cachePolicy=typeof e.cachePolicy=="boolean"?e.cachePolicy?{}:void 0:e.cachePolicy),e.timeout!==void 0&&(this._nodeDefaults.timeout=Hi(e.timeout)),e.errorHandler!==void 0&&(this._nodeDefaults.errorHandler=e.errorHandler),this}_createDefaultErrorHandlerSpec(){let e=this._nodeDefaults.errorHandler;if(e!==void 0)return{runnable:new Mt({func:(t,r)=>{let n=r?.configurable?.[Fc];return e(t,n,r)},name:Dc,trace:!1}),metadata:void 0,input:this._schemaDefinition,retryPolicy:void 0,cachePolicy:void 0,isErrorHandler:!0}}_normalizeToStateGraphInit(e,t){if(ij(e)){if(Kt(t)||ph.isInstance(t))return{...e,context:t};let r=t;return{...e,input:e.input??r?.input,output:e.output??r?.output,context:e.context??r?.context,interrupt:e.interrupt??r?.interrupt,writer:e.writer??r?.writer,nodes:e.nodes??r?.nodes}}if(Qo(e)){if(Kt(t)||ph.isInstance(t))return{state:e,context:t};let r=t;return{state:e,input:r?.input,output:r?.output,context:r?.context,interrupt:r?.interrupt,writer:r?.writer,nodes:r?.nodes}}if(TZ(e))return{state:IZ(e.channels)};throw new Vc}_getChannelsFromSchema(e){if(Cn.isInstance(e))return e.getChannels();if(Kt(e))return this._metaRegistry.getChannelsForSchema(e);if(typeof e=="object"&&"lc_graph_name"in e&&e.lc_graph_name==="AnnotationRoot")return e.spec;if(typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length>0)return e;throw new Vc("Invalid schema type. Expected StateSchema, Zod object, AnnotationRoot, or StateDefinition.")}get allEdges(){return new Set([...this.edges,...Array.from(this.waitingEdges).flatMap(([e,t])=>e.map(r=>[r,t]))])}_addSchema(e){if(!this._schemaDefinitions.has(e)){this._schemaDefinitions.set(e,e);for(let[t,r]of Object.entries(e)){let n;if(typeof r=="function"?n=r():n=r,this.channels[t]!==void 0){if(!this.channels[t].equals(n)&&n.lc_graph_name!=="LastValue")throw new Error(`Channel "${t}" already exists with a different type.`)}else this.channels[t]=n}}}addNode(...e){function t(n){return n.length>=1&&typeof n[0]!="string"}let r=t(e)?Array.isArray(e[0])?e[0]:Object.entries(e[0]).map(([n,i])=>[n,i]):[[e[0],e[1],e[2]]];if(r.length===0)throw new Error("No nodes provided in `addNode`");for(let[n,i,a]of r){if(n in this.channels)throw new Error(`${n} is already being used as a state attribute (a.k.a. a channel), cannot also be used as a node name.`);for(let f of["|",":"])if(n.includes(f))throw new Error(`"${f}" is a reserved character and is not allowed in node names.`);if(this.warnIfCompiled("Adding a node to a graph that has already been compiled. This will not be reflected in the compiled graph."),n in this.nodes)throw new Error(`Node \`${n}\` already present.`);if(n==="__end__"||n==="__start__")throw new Error(`Node \`${n}\` is reserved.`);let o=this._schemaDefinition;a?.input!==void 0&&(o=this._getChannelsFromSchema(a.input)),this._addSchema(o);let s;se.isRunnable(i)?s=i:typeof i=="function"?s=new Mt({func:i,name:n,trace:!1}):s=at(i);let c=a?.cachePolicy,l;c!==void 0&&(l=typeof c=="boolean"?c?{}:!1:c);let u;if(a?.errorHandler!==void 0){if(u=`__error_handler__${n}`,u in this.nodes)throw new Error(`Cannot add error handler to node \`${n}\`: the reserved name \`${u}\` is already in use. StateGraph registers \`__error_handler__<nodeName>\` when you pass \`errorHandler\` in addNode options. Remove or rename the existing node with that name (for example, you may have added it manually).`);let f=a.errorHandler,p={runnable:new Mt({func:(m,h)=>{let _=h?.configurable?.[Fc];return f(m,_,h)},name:u,trace:!1}),metadata:void 0,input:o??this._schemaDefinition,retryPolicy:void 0,cachePolicy:void 0,isErrorHandler:!0};this.nodes[u]=p}let d={runnable:s,retryPolicy:a?.retryPolicy,cachePolicy:l,timeout:Hi(a?.timeout),metadata:a?.metadata,input:o??this._schemaDefinition,subgraphs:Vu(s)?[s]:a?.subgraphs,ends:a?.ends,defer:a?.defer,errorHandlerNode:u};this.nodes[n]=d}return this}addEdge(e,t){if(typeof e=="string")return super.addEdge(e,t);this.compiled&&console.warn("Adding an edge to a graph that has already been compiled. This will not be reflected in the compiled graph.");for(let r of e){if(r==="__end__")throw new Error("END cannot be a start node");if(!Object.keys(this.nodes).some(n=>n===r))throw new Error(`Need to add a node named "${r}" first`)}if(t==="__end__")throw new Error("END cannot be an end node");if(!Object.keys(this.nodes).some(r=>r===t))throw new Error(`Need to add a node named "${t}" first`);return this.waitingEdges.add([e,t]),this}addSequence(e){let t=Array.isArray(e)?e:Object.entries(e);if(t.length===0)throw new Error("Sequence requires at least one node.");let r;for(let[n,i,a]of t){if(n in this.nodes)throw new Error(`Node names must be unique: node with the name "${n}" already exists.`);let o=n;this.addNode(n,i,a),r!=null&&this.addEdge(r,o),r=o}return this}compile({checkpointer:e,store:t,cache:r,interruptBefore:n,interruptAfter:i,name:a,description:o,transformers:s}={}){let c=this._createDefaultErrorHandlerSpec();if(c!==void 0){if(Dc in this.nodes)throw new Error(`Cannot apply a default error handler: the reserved node name \`${Dc}\` is already in use. setNodeDefaults({ errorHandler }) registers a node with that name; rename the conflicting node.`);this.nodes[Dc]=c}try{return this._compileResolved({checkpointer:e,store:t,cache:r,interruptBefore:n,interruptAfter:i,name:a,description:o,transformers:s,defaultErrorHandlerNode:c!==void 0?Dc:void 0})}finally{c!==void 0&&delete this.nodes[Dc]}}_compileResolved({checkpointer:e,store:t,cache:r,interruptBefore:n,interruptAfter:i,name:a,description:o,transformers:s,defaultErrorHandlerNode:c}){this.validate([...Array.isArray(n)?n:[],...Array.isArray(i)?i:[]]);let l=Object.keys(this._schemaDefinitions.get(this._outputDefinition)),u=l.length===1&&l[0]===Bi?Bi:l,d=Object.keys(this.channels),f=d.length===1&&d[0]===Bi?Bi:d,p=this._interrupt,m=new oj({builder:this,checkpointer:e,interruptAfter:i,interruptBefore:n,autoValidate:!1,nodes:{},channels:{...this.channels,[Je]:new Tn},inputChannels:Je,outputChannels:u,streamChannels:f,streamMode:"updates",store:t,cache:r,name:a,description:o,userInterrupt:p,streamTransformers:s});m.attachNode(Je);let h=this._nodeDefaults,_=h.retryPolicy!==void 0||h.cachePolicy!==void 0||h.timeout!==void 0||c!==void 0;for(let[y,w]of Object.entries(this.nodes)){let x=w.isErrorHandler===!0,S=_?{...w,retryPolicy:w.retryPolicy??h.retryPolicy,cachePolicy:x||w.cachePolicy===!1?void 0:w.cachePolicy??h.cachePolicy,timeout:w.timeout??h.timeout,errorHandlerNode:!x&&c!==void 0&&w.errorHandlerNode===void 0?c:w.errorHandlerNode}:w;m.attachNode(y,S)}m.attachBranch(Je,Zh,aj(),{withReader:!1});for(let[y]of Object.entries(this.nodes))m.attachBranch(y,Zh,aj(),{withReader:!1});for(let[y,w]of this.edges)m.attachEdge(y,w);for(let[y,w]of this.waitingEdges)m.attachEdge(y,w);for(let[y,w]of Object.entries(this.branches))for(let[x,S]of Object.entries(w))m.attachBranch(y,x,S);return m.validate()}};function IZ(e){let t={};for(let[r,n]of Object.entries(e))r===Bi?t[r]=mh(n):t[r]=mh(n);return t}var oj=class extends mk{description;_metaRegistry=Ju;constructor({description:e,...t}){super(t),this.description=e}attachNode(e,t){let r;e==="__start__"?r=Object.entries(this.builder._schemaDefinitions.get(this.builder._inputDefinition)).map(([c])=>c):r=Object.keys(this.builder.channels);function n(c){if(At(c))return c.graph===_r.PARENT?null:c._updateAsTuples();if(Array.isArray(c)&&c.length>0&&c.some(l=>At(l))){let l=[];for(let u of c)if(At(u)){if(u.graph===_r.PARENT)continue;l.push(...u._updateAsTuples())}else l.push([Bi,u]);return l}else if(c!=null)return[[Bi,c]];return null}let i=e,a=async c=>{if(c==null||c.length===0)return c;let l=this.builder._schemaRuntimeDefinition;if(Cn.isInstance(l)){let u=new Set(l.getChannelKeys());return Promise.all(c.map(async([d,f])=>{if(!u.has(d))return[d,f];let p=await l.validateInput({[d]:f});return[d,Object.prototype.hasOwnProperty.call(p,d)?p[d]:f]}))}if(Kt(l)){let u=new Set(Object.keys(Ei(l)));if(c.filter(([p])=>u.has(p)).length===0)return c;let d=$a(this._metaRegistry.getExtendedChannelSchemas(l,{withReducerSchema:!0})),f=$a(l);return c.map(([p,m])=>{if(!u.has(p))return[p,m];let[h,_]=cn(m);if(h){let w=Ea(f,{[p]:_});return[p,Object.prototype.hasOwnProperty.call(w,p)?{[Pn]:w[p]}:m]}let y=Ea(d,{[p]:m});return[p,Object.prototype.hasOwnProperty.call(y,p)?y[p]:m]})}return c};async function o(c){if(c){if(At(c))return c.graph===_r.PARENT?null:a(c._updateAsTuples().filter(([l])=>r.includes(l)));if(Array.isArray(c)&&c.length>0&&c.some(At)){let l=[];for(let u of c)if(At(u)){if(u.graph===_r.PARENT)continue;l.push(...u._updateAsTuples().filter(([d])=>r.includes(d)))}else{let d=await o(u);d&&l.push(...d??[])}return a(l)}else{if(typeof c=="object"&&!Array.isArray(c))return a(Object.entries(c).filter(([l])=>r.includes(l)));{let l=Array.isArray(c)?"array":typeof c;throw new ve(`Expected node "${i.toString()}" to return an object or an array containing at least one Command object, received ${l}`,{lc_error_code:"INVALID_GRAPH_NODE_RETURN_VALUE"})}}}else return null}let s=[{value:Ir,mapper:new Mt({func:r.length&&r[0]===Bi?n:o,trace:!1,recurse:!1})}];if(e==="__start__")this.nodes[e]=new $n({tags:[ht],triggers:[Je],channels:[Je],writers:[new ut(s,[ht])]});else{let c=t?.input??this.builder._schemaDefinition,l=Object.fromEntries(Object.keys(this.builder._schemaDefinitions.get(c)).map(m=>[m,m])),u=Object.keys(l).length===1&&Bi in l,d=`branch:to:${e}`;this.channels[d]=t?.defer?new RS:new Tn(!1);let f=t?.cachePolicy,p=f===!1?void 0:f;this.nodes[e]=new $n({triggers:[d],channels:u?Object.keys(l):l,writers:[new ut(s,[ht])],mapper:u?void 0:m=>Object.fromEntries(Object.entries(m).filter(([h])=>h in l)),bound:t?.runnable,metadata:t?.metadata,retryPolicy:t?.retryPolicy,cachePolicy:p,timeout:t?.timeout,subgraphs:t?.subgraphs,ends:t?.ends,isErrorHandler:t?.isErrorHandler,errorHandlerNode:t?.errorHandlerNode})}}attachEdge(e,t){if(t!=="__end__"){if(typeof e=="string")this.nodes[e].writers.push(new ut([{channel:`branch:to:${t}`,value:null}],[ht]));else if(Array.isArray(e)){let r=`join:${e.join("+")}:${t}`;this.channels[r]=this.builder.nodes[t].defer?new yk(new Set(e)):new _k(new Set(e)),this.nodes[t].triggers.push(r);for(let n of e)this.nodes[n].writers.push(new ut([{channel:r,value:n}],[ht]))}}}attachBranch(e,t,r,n={withReader:!0}){let i=async(a,o)=>{let s=a.filter(l=>l!==et);if(!s.length)return;let c=s.map(l=>wt(l)?l:{channel:l==="__end__"?l:`branch:to:${l}`,value:e});await ut.doWrite({...o,tags:(o.tags??[]).concat([ht])},c)};this.nodes[e].writers.push(r.run(i,n.withReader?a=>lM.doRead(a,this.streamChannels??this.outputChannels,!0):void 0))}async _validateInput(e){if(e==null)return e;let t=this.builder._inputRuntimeDefinition,r=this.builder._schemaRuntimeDefinition;if(Cn.isInstance(t)){if(At(e)){let i=e;return e.update&&(i.update=await t.validateInput(Array.isArray(e.update)?Object.fromEntries(e.update):e.update)),i}return await t.validateInput(e)}if(t===Bh&&Cn.isInstance(r)){if(At(e)){let i=e;return e.update&&(i.update=await r.validateInput(Array.isArray(e.update)?Object.fromEntries(e.update):e.update)),i}return await r.validateInput(e)}let n=(()=>{let i=a=>{if(a!=null)return this._metaRegistry.getExtendedChannelSchemas(a,{withReducerSchema:!0})};if(Kt(t))return i(t);if(t===Bh)return Kt(r)?$a(i(r)):void 0})();if(At(e)){let i=e;if(e.update&&n!=null){let a=Array.isArray(e.update)?Object.fromEntries(e.update):e.update,o=Ea(n,a);i.update=Object.fromEntries(Object.keys(a).map(s=>[s,o[s]]))}return i}return n!=null?Ea(n,e):e}isInterrupted(e){return Ja(e)}async _validateContext(e){let t=this.builder._configRuntimeSchema;return Kt(t)&&Ea(t,e),e}};function TZ(e){return typeof e=="object"&&e!==null&&e.channels!==void 0}function CZ(e){if(wt(e))return[e];let t=[];At(e)?t.push(e):Array.isArray(e)&&t.push(...e.filter(At));let r=[];for(let n of t){if(n.graph===_r.PARENT)throw new od(n);wt(n.goto)||typeof n.goto=="string"?r.push(n.goto):Array.isArray(n.goto)&&r.push(...n.goto)}return r}function aj(){return new fk({path:new Mt({func:CZ,tags:[ht],trace:!1,recurse:!1,name:"<control_branch>"})})}var AZ=class extends Sk{constructor(){super({channels:{__root__:{reducer:Fa,default:()=>[]}}})}};function OZ(e,t){let{stateKey:r,...n}=t??{},i=Cc(n),a=r??"messages";r===null&&(a=void 0);let o=Et(e);if(!o.id)throw new Error("Message ID is required.");let s=(Array.isArray(i.callbacks)?i.callbacks:typeof i.callbacks<"u"?i.callbacks.handlers:[]).find(c=>"name"in c&&c.name==="StreamMessagesHandler");if(s){let c=i.metadata??{},l=(c.langgraph_checkpoint_ns??"").split("|");s._emit([l,c],o,void 0,!1)}return a&&i.configurable?.__pregel_send?.([[a,o]]),o}function PZ(e,t){let r=typeof e=="string"?{name:e,retry:void 0,cachePolicy:void 0,timeout:void 0}:e,{name:n,retry:i}=r,a=Hi(r.timeout);if(XS(t)||QS(t))throw new Error("Generators are disallowed as tasks. For streaming responses, use config.write.");let o=r.cachePolicy??("cache"in r?r.cache:void 0),s;return typeof o=="boolean"?s=o?{}:void 0:s=o,(...c)=>yM({func:t,name:n,retry:i,cache:s,timeout:a},...c)}var sj=function(t,r){let{name:n,checkpointer:i,store:a,cache:o}=typeof t=="string"?{name:t,checkpointer:void 0,store:void 0}:t,s=Hi(typeof t=="string"?void 0:t.timeout);if(XS(r)||QS(r))throw new Error("Generators are disallowed as entrypoints. For streaming responses, use config.write.");let c="updates",l=_M(n,r);function u(m){return typeof m=="object"&&m!==null&&"__lg_type"in m&&m.__lg_type==="__pregel_final"}let d=new Mt({name:"pluckReturnValue",func:m=>u(m)?m.value:m}),f=new Mt({name:"pluckSaveValue",func:m=>u(m)?m.save:m}),p=new $n({bound:l,triggers:[Je],channels:[Je],timeout:s,writers:[new ut([{channel:et,value:Ir,mapper:d},{channel:qi,value:Ir,mapper:f}],[ht])]});return new Uh({name:n,checkpointer:i,nodes:{[n]:p},channels:{[Je]:new Tn,[et]:new kn,[qi]:new kn},inputChannels:Je,outputChannels:et,streamChannels:et,streamMode:c,store:a,cache:o})};sj.final=function({value:t,save:r}){return{value:t,save:r,__lg_type:"__pregel_final"}};function NZ(){return Re.getRunnableConfig().configurable?.[Wi]}var RZ=Uu.Root({messages:Uu({reducer:Fa,default:()=>[]})}),cj={reducer:{fn:Fa},jsonSchemaExtra:{langgraph_type:"messages"},default:()=>[]},MZ=Rt.object({messages:nj(Rt.custom(),cj)});function jZ(e){let t=Re.getRunnableConfig();if(!t)throw new Error("Called interrupt() outside the context of a graph.");let r=t.configurable;if(!r)throw new Error("No configurable found in config");return r.writer?.(e)}export{Je as a,et as b,Le as c,Vh as d,Ok as e,Za as f,wt as g,dj as h,Ja as i,_r as j,At as k,Zr as l,td as m,Hh as n,Ka as o,rd as p,nd as q,li as r,id as s,ad as t,pj as u,od as v,Gh as w,Yi as x,ui as y,sd as z,mj as A,cd as B,je as C,ve as D,hj as E,Wh as F,gj as G,Vc as H,_j as I,lE as J,xt as K,pi as L,sg as M,Zj as N,Dn as O,bE as P,Jc as Q,wE as R,rt as S,kt as T,ls as U,Ne as V,fs as W,it as X,fn as Y,Qa as Z,to as _,ro as $,hi as aa,h$ as ba,Jt as ca,fa as da,mo as ea,ya as fa,Jf as ga,ko as ha,Ge as ia,lt as ja,xr as ka,$i as la,Tp as ma,z as na,Rt as oa,It as pa,Yt as qa,Gp as ra,BF as sa,Xl as ta,em as ua,Ox as va,xP as wa,SP as xa,WF as ya,JF as za,Nx as Aa,Pa as Ba,om as Ca,Na as Da,oB as Ea,qx as Fa,pc as Ga,bu as Ha,nn as Ia,lV as Ja,mV as Ka,xV as La,CV as Ma,Jo as Na,xn as Oa,oh as Pa,zR as Qa,$c as Ra,lh as Sa,FR as Ta,yt as Ua,Mi as Va,Uu as Wa,u9 as Xa,d9 as Ya,hh as Za,f9 as _a,MS as $a,jS as ab,Ac as bb,DS as cb,on as db,yh as eb,FS as fb,Lu as gb,Fu as hb,BS as ib,VS as jb,vh as kb,GS as lb,QR as mb,WS as nb,YS as ob,Mt as pb,pk as qb,zi as rb,wZ as sb,Ua as tb,Ui as ub,Lh as vb,Fh as wb,Li as xb,Xo as yb,Fi as zb,Cn as Ab,SZ as Bb,Fa as Cb,xk as Db,kZ as Eb,EZ as Fb,Ju as Gb,nj as Hb,Sk as Ib,oj as Jb,AZ as Kb,OZ as Lb,PZ as Mb,sj as Nb,NZ as Ob,RZ as Pb,cj as Qb,MZ as Rb,jZ as Sb};