@arcgis/portal-components 6.0.0-next.3 → 6.0.0-next.31

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 (368) hide show
  1. package/dist/cdn/22DNGXFY.js +2 -0
  2. package/dist/cdn/234TH32X.js +106 -0
  3. package/dist/cdn/25K5D5HL.js +2 -0
  4. package/dist/cdn/2CC4MNQP.js +2 -0
  5. package/dist/cdn/365ICWHN.js +2 -0
  6. package/dist/cdn/3CXU5CCM.js +2 -0
  7. package/dist/cdn/3DTSKTHB.js +2 -0
  8. package/dist/cdn/3MUI6DF4.js +2 -0
  9. package/dist/cdn/{3NSHGKZA.js → 3QWNGHAK.js} +1 -1
  10. package/dist/cdn/3T3QBPC3.js +2 -0
  11. package/dist/cdn/4QYVBXZT.js +2 -0
  12. package/dist/cdn/{K75JTQPW.js → 4VLEUN7I.js} +1 -1
  13. package/dist/cdn/4X4EYM3Q.js +2 -0
  14. package/dist/cdn/4Y73LE7P.js +2 -0
  15. package/dist/cdn/5CEFJTG4.js +2 -0
  16. package/dist/cdn/5VFGR7LA.js +2 -0
  17. package/dist/cdn/5Y32T5IJ.js +2 -0
  18. package/dist/cdn/{JPUUMGX5.js → 6EMK2BU6.js} +1 -1
  19. package/dist/cdn/6HNKQNS5.js +2 -0
  20. package/dist/cdn/{NWVLGU2C.js → 7BFTXD5J.js} +1 -1
  21. package/dist/cdn/{URQML7KV.js → 7DAB2CEU.js} +1 -1
  22. package/dist/cdn/7ZWYPQMW.js +2 -0
  23. package/dist/cdn/AM3UTQWH.js +4 -0
  24. package/dist/cdn/{D2YQWKME.js → ASID6YW7.js} +2 -2
  25. package/dist/cdn/ASLKTYLX.js +2 -0
  26. package/dist/cdn/{7ZWYUHGK.js → B343BOVA.js} +1 -1
  27. package/dist/cdn/BHZKSSVZ.js +2 -0
  28. package/dist/cdn/BOEGDK4D.js +2 -0
  29. package/dist/cdn/{QTAYXO5T.js → BRWHEYLW.js} +1 -1
  30. package/dist/cdn/{74T6IXSN.js → BX2LXI3N.js} +1 -1
  31. package/dist/cdn/{JE2376SE.js → C3F24ZOM.js} +1 -1
  32. package/dist/cdn/C4GK263H.js +2 -0
  33. package/dist/cdn/CBFFZMX4.js +2 -0
  34. package/dist/cdn/CJ4S56BE.js +2 -0
  35. package/dist/cdn/{IN4JPZTY.js → CMNTOT5D.js} +1 -1
  36. package/dist/cdn/CVU6YKOA.js +2 -0
  37. package/dist/cdn/D52TYBRX.js +2 -0
  38. package/dist/cdn/DMS3R2W5.js +2 -0
  39. package/dist/cdn/{TWCJJCPC.js → DV57AOBF.js} +1 -1
  40. package/dist/cdn/EDQSL2P3.js +2 -0
  41. package/dist/cdn/ERBRAY5U.js +2 -0
  42. package/dist/cdn/{TRMFL7PT.js → ESKKH4DE.js} +1 -1
  43. package/dist/cdn/FAZVQI4K.js +2 -0
  44. package/dist/cdn/{TXC7YBGL.js → FGDSHTJ5.js} +1 -1
  45. package/dist/cdn/FGRMURKX.js +2 -0
  46. package/dist/cdn/{2TDHJSMP.js → FKOSVY5D.js} +1 -1
  47. package/dist/cdn/FN2QMDEW.js +2 -0
  48. package/dist/cdn/FOWOLUC3.js +2 -0
  49. package/dist/cdn/FVHP6PFG.js +2 -0
  50. package/dist/cdn/G7DJPREL.js +2 -0
  51. package/dist/cdn/GBXFX37Y.js +2 -0
  52. package/dist/cdn/{K2XSYDAP.js → GC4BV7IZ.js} +1 -1
  53. package/dist/cdn/H6MGSC3Y.js +2 -0
  54. package/dist/cdn/H6OQOEHS.js +2 -0
  55. package/dist/cdn/{YZTBAUIO.js → HBO7XTIL.js} +1 -1
  56. package/dist/cdn/HKHDBGNN.js +2 -0
  57. package/dist/cdn/HVQ7FKJ5.js +2 -0
  58. package/dist/cdn/HXR7GUM3.js +91 -0
  59. package/dist/cdn/IGOSZ2LL.js +2 -0
  60. package/dist/cdn/{GAF4YT5N.js → IUIFCQQU.js} +1 -1
  61. package/dist/cdn/IX4WEZZ2.js +2 -0
  62. package/dist/cdn/JA3GGSJJ.js +2 -0
  63. package/dist/cdn/{M5PPX4ZX.js → JEVNGG2O.js} +1 -1
  64. package/dist/cdn/JLT5GCLY.js +2 -0
  65. package/dist/cdn/K3GAZFRI.js +63 -0
  66. package/dist/cdn/KHA6NJ4N.js +2 -0
  67. package/dist/cdn/KRORL7QC.js +2 -0
  68. package/dist/cdn/KTTPPUQ7.js +2 -0
  69. package/dist/cdn/L25GEXL6.js +2 -0
  70. package/dist/cdn/LBW47BJG.js +2 -0
  71. package/dist/cdn/LR33CLTB.js +2 -0
  72. package/dist/cdn/{CFRJU6VA.js → M664QA6J.js} +1 -1
  73. package/dist/cdn/MJVKDAYF.js +2 -0
  74. package/dist/cdn/MSSJRDR7.js +2 -0
  75. package/dist/cdn/MVC6LIQ6.js +2 -0
  76. package/dist/cdn/NENAFJEC.js +2 -0
  77. package/dist/cdn/NHVPNSNH.js +2 -0
  78. package/dist/cdn/NLFBHNSX.js +2 -0
  79. package/dist/cdn/{VNU4QX7M.js → NQ2IAQKL.js} +17 -17
  80. package/dist/cdn/{2YZWRFCI.js → NYBLHT3F.js} +1 -1
  81. package/dist/cdn/O4YFPGD5.js +2 -0
  82. package/dist/cdn/OHAQPQAP.js +2 -0
  83. package/dist/cdn/OQ2JULON.js +2 -0
  84. package/dist/cdn/{JIJO4CAS.js → PJZZIITX.js} +1 -1
  85. package/dist/cdn/PRBP4AP6.js +2 -0
  86. package/dist/cdn/{ZKZDKJ6D.js → PST62OKJ.js} +1 -1
  87. package/dist/cdn/Q2CCAKI4.js +2 -0
  88. package/dist/cdn/QF626JXP.js +2 -0
  89. package/dist/cdn/QMIVFHQE.js +2 -0
  90. package/dist/cdn/QRHXMIMW.js +2 -0
  91. package/dist/cdn/R5LNWMD4.js +2 -0
  92. package/dist/cdn/RJ3SU3EV.js +2 -0
  93. package/dist/cdn/RJRTGF33.js +2 -0
  94. package/dist/cdn/RT26JZP5.js +2 -0
  95. package/dist/cdn/{I6IRHXWR.js → SO3IBFEU.js} +1 -1
  96. package/dist/cdn/SRWFOV5W.js +2 -0
  97. package/dist/cdn/SUA7ZZUH.js +2 -0
  98. package/dist/cdn/SV6SGTR6.js +2 -0
  99. package/dist/cdn/TAZDV6DB.js +2 -0
  100. package/dist/cdn/{ROX3GKKA.js → TIPQ2ZWK.js} +1 -1
  101. package/dist/cdn/TJANHZ25.js +2 -0
  102. package/dist/cdn/{MKSFNVXL.js → TO666HVV.js} +1 -1
  103. package/dist/cdn/UBPCKCW2.js +2 -0
  104. package/dist/cdn/ULGME5RT.js +2 -0
  105. package/dist/cdn/US37IXWO.js +2 -0
  106. package/dist/cdn/UZW2KV4X.js +2 -0
  107. package/dist/cdn/{Z6R3C4AK.js → VFECPSKA.js} +1 -1
  108. package/dist/cdn/VLD3MVSG.js +2 -0
  109. package/dist/cdn/VWV2LCNA.js +2 -0
  110. package/dist/cdn/WC3MDSMP.js +70 -0
  111. package/dist/cdn/WCZJXBW3.js +2 -0
  112. package/dist/cdn/WFPUAEJQ.js +3 -0
  113. package/dist/cdn/{OR6T5SB3.js → WIUFH5SJ.js} +1 -1
  114. package/dist/cdn/{5HZNBMW6.js → WZFGZEQI.js} +1 -1
  115. package/dist/cdn/XE3DCC5D.js +2 -0
  116. package/dist/cdn/{JN23JH3T.js → XEVOU7SJ.js} +1 -1
  117. package/dist/cdn/{BKD7JSV2.js → XH6RD5BO.js} +1 -1
  118. package/dist/cdn/XJNEK5Q7.js +2 -0
  119. package/dist/cdn/XK3WIW4R.js +2 -0
  120. package/dist/cdn/XOM3GLYF.js +2 -0
  121. package/dist/cdn/YGZICQBT.js +2 -0
  122. package/dist/cdn/YP7T6NKR.js +2 -0
  123. package/dist/cdn/{RHCRPJWS.js → YYKKXL62.js} +1 -1
  124. package/dist/cdn/Z5OZYZYV.js +2 -0
  125. package/dist/cdn/{SGDDFWCJ.js → ZGSAH7Z7.js} +1 -1
  126. package/dist/cdn/assets/portal-ai-assistant/t9n/messages.en.json +1 -1
  127. package/dist/cdn/assets/portal-entity-picker/t9n/messages.en.json +1 -1
  128. package/dist/cdn/assets/portal-item-card-sublayer-select/t9n/messages.en.json +1 -0
  129. package/dist/cdn/assets/portal-item-preview/t9n/messages.en.json +1 -0
  130. package/dist/cdn/assets/portal-item-share-summary/t9n/messages.en.json +1 -0
  131. package/dist/cdn/assets/portal-item-type/t9n/messages.en.json +1 -1
  132. package/dist/cdn/index.js +1 -1
  133. package/dist/cdn/main.css +1 -1
  134. package/dist/chunks/FieldIcons.js +24 -0
  135. package/dist/chunks/fieldAddDelete.js +7 -7
  136. package/dist/chunks/functionalities.js +14 -9
  137. package/dist/chunks/groups.js +8 -61
  138. package/dist/chunks/groups2.js +23 -8
  139. package/dist/chunks/info.js +2 -2
  140. package/dist/chunks/item.js +131 -33
  141. package/dist/chunks/item2.js +63 -125
  142. package/dist/chunks/itemThumbnail.js +21 -21
  143. package/dist/chunks/layers.js +196 -0
  144. package/dist/chunks/loadClassificationData.js +26 -27
  145. package/dist/chunks/portal-browser.js +49 -46
  146. package/dist/chunks/portal-delete-items-review.js +1 -1
  147. package/dist/chunks/portal-item-badge.js +1 -1
  148. package/dist/chunks/portal-item-preview-sublayer.js +214 -0
  149. package/dist/chunks/portal-related-items-list-item.js +1 -1
  150. package/dist/chunks/portal.js +6 -6
  151. package/dist/chunks/portal2.js +23 -23
  152. package/dist/chunks/portalEntitySelection.js +61 -0
  153. package/dist/chunks/query.js +13 -13
  154. package/dist/chunks/request.js +49 -41
  155. package/dist/chunks/requests.js +7 -7
  156. package/dist/chunks/selectedMentions.js +25 -0
  157. package/dist/chunks/services.js +5 -5
  158. package/dist/chunks/string.js +19 -11
  159. package/dist/chunks/ui.js +1 -0
  160. package/dist/chunks/url.js +2 -2
  161. package/dist/chunks/user.js +67 -53
  162. package/dist/chunks/user2.js +10 -10
  163. package/dist/chunks/utils.js +35 -22
  164. package/dist/chunks/utils2.js +4 -4
  165. package/dist/chunks/utils3.js +88 -657
  166. package/dist/chunks/utils4.js +663 -0
  167. package/dist/components/arcgis-portal-account-switcher/customElement.js +57 -54
  168. package/dist/components/arcgis-portal-add-gps-metadata/customElement.d.ts +27 -0
  169. package/dist/components/arcgis-portal-add-gps-metadata/customElement.js +185 -137
  170. package/dist/components/arcgis-portal-ai-assistant/customElement.d.ts +26 -17
  171. package/dist/components/arcgis-portal-ai-assistant/customElement.js +546 -2655
  172. package/dist/components/arcgis-portal-ai-assistant/index.js +4 -0
  173. package/dist/components/arcgis-portal-ai-assistant/tools/getItemTool.d.ts +11 -0
  174. package/dist/components/arcgis-portal-ai-assistant/tools/groups.d.ts +28 -0
  175. package/dist/components/arcgis-portal-ai-assistant/tools/users.d.ts +28 -0
  176. package/dist/components/arcgis-portal-ai-assistant/types/assistantTools.d.ts +8 -1
  177. package/dist/components/arcgis-portal-ai-assistant/types/portalEntityTools.d.ts +19 -0
  178. package/dist/components/arcgis-portal-ai-assistant-interrupt/customElement.d.ts +39 -0
  179. package/dist/components/arcgis-portal-ai-assistant-interrupt/customElement.js +67 -27
  180. package/dist/components/arcgis-portal-ai-assistant-interrupt/index.js +3 -1
  181. package/dist/components/arcgis-portal-browser/customElement.d.ts +3 -0
  182. package/dist/components/arcgis-portal-browser/customElement.js +3 -2
  183. package/dist/components/arcgis-portal-browser/index.js +1 -0
  184. package/dist/components/arcgis-portal-classification-banner/customElement.js +2 -2
  185. package/dist/components/arcgis-portal-classification-config/customElement.js +2 -2
  186. package/dist/components/arcgis-portal-classification-favorite/customElement.js +2 -2
  187. package/dist/components/arcgis-portal-classification-form-element/customElement.js +1 -1
  188. package/dist/components/arcgis-portal-delete-items/customElement.d.ts +69 -3
  189. package/dist/components/arcgis-portal-delete-items/customElement.js +446 -330
  190. package/dist/components/arcgis-portal-delete-items/index.js +1 -2
  191. package/dist/components/arcgis-portal-delete-items/types.d.ts +1 -0
  192. package/dist/components/arcgis-portal-entity-picker/customElement.d.ts +51 -5
  193. package/dist/components/arcgis-portal-entity-picker/customElement.js +204 -119
  194. package/dist/components/arcgis-portal-entity-picker/index.js +2 -0
  195. package/dist/components/arcgis-portal-field-delete/customElement.js +87 -101
  196. package/dist/components/arcgis-portal-field-delete/index.js +1 -1
  197. package/dist/components/arcgis-portal-group-badges/customElement.js +5 -5
  198. package/dist/components/arcgis-portal-group-browser/customElement.js +96 -100
  199. package/dist/components/arcgis-portal-group-browser/types.d.ts +3 -7
  200. package/dist/components/arcgis-portal-group-browser-preview/customElement.js +49 -40
  201. package/dist/components/arcgis-portal-group-browser-preview/index.js +1 -0
  202. package/dist/components/arcgis-portal-group-browser-preview-card/customElement.js +1 -4
  203. package/dist/components/arcgis-portal-group-card/customElement.js +16 -16
  204. package/dist/components/arcgis-portal-group-thumbnail/customElement.js +1 -1
  205. package/dist/components/arcgis-portal-item-badges/customElement.js +4 -4
  206. package/dist/components/arcgis-portal-item-card/customElement.d.ts +26 -10
  207. package/dist/components/arcgis-portal-item-card/customElement.js +90 -80
  208. package/dist/components/arcgis-portal-item-card/index.js +2 -1
  209. package/dist/components/arcgis-portal-item-card-sublayer-select/customElement.d.ts +102 -0
  210. package/dist/components/arcgis-portal-item-card-sublayer-select/customElement.js +181 -0
  211. package/dist/components/arcgis-portal-item-card-sublayer-select/index.d.ts +1 -0
  212. package/dist/components/arcgis-portal-item-card-sublayer-select/index.js +8 -0
  213. package/dist/components/arcgis-portal-item-card-sublayer-select/types.d.ts +22 -0
  214. package/dist/components/arcgis-portal-item-favorite/customElement.js +42 -29
  215. package/dist/components/arcgis-portal-item-preview/customElement.d.ts +263 -0
  216. package/dist/components/arcgis-portal-item-preview/customElement.js +137 -0
  217. package/dist/components/arcgis-portal-item-preview/index.d.ts +1 -0
  218. package/dist/components/arcgis-portal-item-preview/index.js +20 -0
  219. package/dist/components/arcgis-portal-item-preview/types.d.ts +14 -0
  220. package/dist/components/arcgis-portal-item-preview-copy/customElement.d.ts +215 -0
  221. package/dist/components/arcgis-portal-item-preview-copy/customElement.js +46 -0
  222. package/dist/components/arcgis-portal-item-preview-copy/index.d.ts +1 -0
  223. package/dist/components/arcgis-portal-item-preview-copy/index.js +5 -0
  224. package/dist/components/arcgis-portal-item-preview-field/customElement.d.ts +216 -0
  225. package/dist/components/arcgis-portal-item-preview-field/customElement.js +34 -0
  226. package/dist/components/arcgis-portal-item-preview-field/index.d.ts +1 -0
  227. package/dist/components/arcgis-portal-item-preview-field/index.js +6 -0
  228. package/dist/components/arcgis-portal-item-preview-sublayer/customElement.d.ts +216 -0
  229. package/dist/components/arcgis-portal-item-preview-sublayer/customElement.js +15 -0
  230. package/dist/components/arcgis-portal-item-preview-sublayer/index.d.ts +1 -0
  231. package/dist/components/arcgis-portal-item-preview-sublayer/index.js +11 -0
  232. package/dist/components/arcgis-portal-item-share-summary/customElement.d.ts +113 -0
  233. package/dist/components/arcgis-portal-item-share-summary/customElement.js +172 -0
  234. package/dist/components/arcgis-portal-item-share-summary/index.d.ts +1 -0
  235. package/dist/components/arcgis-portal-item-share-summary/index.js +5 -0
  236. package/dist/components/arcgis-portal-item-share-summary-editable/customElement.d.ts +33 -0
  237. package/dist/components/arcgis-portal-item-share-summary-editable/customElement.js +19 -0
  238. package/dist/components/arcgis-portal-item-share-summary-editable/index.d.ts +1 -0
  239. package/dist/components/arcgis-portal-item-share-summary-editable/index.js +2 -0
  240. package/dist/components/arcgis-portal-item-thumbnail/customElement.d.ts +1 -0
  241. package/dist/components/arcgis-portal-item-thumbnail/customElement.js +14 -14
  242. package/dist/components/arcgis-portal-item-type/customElement.d.ts +16 -14
  243. package/dist/components/arcgis-portal-item-type/customElement.js +25 -28
  244. package/dist/components/arcgis-portal-mentionable-text-area/customElement.js +61 -57
  245. package/dist/components/arcgis-portal-navigation/customElement.js +7 -8
  246. package/dist/components/arcgis-portal-navigation/index.js +4 -4
  247. package/dist/components/arcgis-portal-preview-panel/customElement.d.ts +40 -0
  248. package/dist/components/arcgis-portal-preview-panel/customElement.js +40 -0
  249. package/dist/components/arcgis-portal-preview-panel/index.d.ts +1 -0
  250. package/dist/components/arcgis-portal-preview-panel/index.js +1 -0
  251. package/dist/components/arcgis-portal-replacement-item-redirect/customElement.js +8 -8
  252. package/dist/components/arcgis-portal-review-related-items/customElement.d.ts +333 -0
  253. package/dist/components/arcgis-portal-review-related-items/customElement.js +46 -18
  254. package/dist/components/arcgis-portal-review-related-items/index.js +2 -0
  255. package/dist/components/arcgis-portal-sublayer-type/customElement.js +13 -103
  256. package/dist/components/arcgis-portal-user-avatar/customElement.d.ts +2 -3
  257. package/dist/components/arcgis-portal-user-avatar/customElement.js +15 -16
  258. package/dist/components/arcgis-portal-user-popup/customElement.d.ts +4 -7
  259. package/dist/components/arcgis-portal-user-popup/customElement.js +128 -111
  260. package/dist/components/portal-group-browser-filters/customElement.js +15 -15
  261. package/dist/components/portal-related-items-list-item/customElement.js +16 -14
  262. package/dist/components/portal-related-items-list-item/index.js +1 -1
  263. package/dist/docs/api.json +1 -1
  264. package/dist/docs/docs.json +1 -1
  265. package/dist/docs/vscode.css-custom-data.json +1 -1
  266. package/dist/docs/vscode.html-custom-data.json +1 -1
  267. package/dist/docs/web-types.json +1 -1
  268. package/dist/index.d.ts +63 -0
  269. package/dist/index.js +300 -6
  270. package/dist/loader.js +18 -10
  271. package/dist/services/group.d.ts +17 -0
  272. package/dist/services/groups.d.ts +9 -0
  273. package/dist/services/item.d.ts +9 -0
  274. package/dist/types/item.d.ts +17 -11
  275. package/dist/types/layer.d.ts +27 -0
  276. package/dist/types/lumina.d.ts +63 -11
  277. package/dist/types/portalAssistantCurrentContext.d.ts +9 -0
  278. package/dist/types/portalEntityPicker.d.ts +3 -0
  279. package/dist/types/preact.d.ts +71 -11
  280. package/dist/types/react.d.ts +79 -11
  281. package/dist/types/services.d.ts +28 -1
  282. package/dist/types/stencil.d.ts +63 -11
  283. package/dist/types/user.d.ts +14 -10
  284. package/dist/utils/generateEmbeddings.d.ts +7 -0
  285. package/dist/utils/semanticSearch.d.ts +60 -0
  286. package/dist/utils/types.d.ts +10 -0
  287. package/package.json +11 -10
  288. package/dist/cdn/23NXHNPU.js +0 -2
  289. package/dist/cdn/24QSQLRY.js +0 -2
  290. package/dist/cdn/2CN754CY.js +0 -2
  291. package/dist/cdn/2FQKDFEE.js +0 -2
  292. package/dist/cdn/2MPQ5IWJ.js +0 -2
  293. package/dist/cdn/3CQKCUM5.js +0 -2
  294. package/dist/cdn/3EYB5GQX.js +0 -2
  295. package/dist/cdn/3FSPL34I.js +0 -170
  296. package/dist/cdn/3LEQ37YT.js +0 -68
  297. package/dist/cdn/4MUB6TL6.js +0 -2
  298. package/dist/cdn/4PRXQFCV.js +0 -2
  299. package/dist/cdn/4QFTKB6T.js +0 -2
  300. package/dist/cdn/4TSXFX3M.js +0 -2
  301. package/dist/cdn/5C5GHX4D.js +0 -2
  302. package/dist/cdn/7LMZHJZG.js +0 -2
  303. package/dist/cdn/A2SQ4EMZ.js +0 -2
  304. package/dist/cdn/AICPYLWE.js +0 -4
  305. package/dist/cdn/AXOBMX3S.js +0 -2
  306. package/dist/cdn/AZOJHVAO.js +0 -2
  307. package/dist/cdn/BYHX3UWV.js +0 -2
  308. package/dist/cdn/CD5UWSCP.js +0 -2
  309. package/dist/cdn/DDBXEXOV.js +0 -2
  310. package/dist/cdn/DHMNNIXZ.js +0 -2
  311. package/dist/cdn/DLI4XKJ3.js +0 -2
  312. package/dist/cdn/DYO5P3F2.js +0 -2
  313. package/dist/cdn/E66BDC6N.js +0 -2
  314. package/dist/cdn/EEAVX4PP.js +0 -2
  315. package/dist/cdn/EMJQI4MA.js +0 -2
  316. package/dist/cdn/EY5S6ICQ.js +0 -2
  317. package/dist/cdn/FIBQAMJ3.js +0 -2
  318. package/dist/cdn/FIQZPIIK.js +0 -2
  319. package/dist/cdn/FNLBJ4ZQ.js +0 -2
  320. package/dist/cdn/FRE56NBG.js +0 -2
  321. package/dist/cdn/GSOBDGLK.js +0 -2
  322. package/dist/cdn/GXM3XY3J.js +0 -2
  323. package/dist/cdn/HCNTXLUT.js +0 -2
  324. package/dist/cdn/I273CANO.js +0 -2
  325. package/dist/cdn/I6NVKNZJ.js +0 -2
  326. package/dist/cdn/J5FKIZAM.js +0 -2
  327. package/dist/cdn/J5NPDIZM.js +0 -2
  328. package/dist/cdn/JOUR2FB2.js +0 -3
  329. package/dist/cdn/JWBUJT43.js +0 -2
  330. package/dist/cdn/LISDTBEX.js +0 -2
  331. package/dist/cdn/LYLQCBVX.js +0 -2
  332. package/dist/cdn/MQK63FV7.js +0 -2
  333. package/dist/cdn/N4VOTJ25.js +0 -2
  334. package/dist/cdn/N5QLV56W.js +0 -2
  335. package/dist/cdn/OD5WXP7J.js +0 -2
  336. package/dist/cdn/OXPXXIWL.js +0 -2
  337. package/dist/cdn/PKA745KL.js +0 -2
  338. package/dist/cdn/PMRFXB4F.js +0 -2
  339. package/dist/cdn/PNIFJ5DQ.js +0 -2
  340. package/dist/cdn/PZDI5ZDC.js +0 -2
  341. package/dist/cdn/QROXYP6V.js +0 -2
  342. package/dist/cdn/QUOLQGKP.js +0 -2
  343. package/dist/cdn/QWHGLE3O.js +0 -2
  344. package/dist/cdn/R3PK7XOP.js +0 -2
  345. package/dist/cdn/REM3KCX6.js +0 -2
  346. package/dist/cdn/RNWICLRH.js +0 -2
  347. package/dist/cdn/RQYNPDN3.js +0 -2
  348. package/dist/cdn/S6F7U36E.js +0 -400
  349. package/dist/cdn/SMX2LEJB.js +0 -2
  350. package/dist/cdn/SVROAT3Z.js +0 -2
  351. package/dist/cdn/TBZXKKGP.js +0 -2
  352. package/dist/cdn/TNUCSWBN.js +0 -2
  353. package/dist/cdn/TOICLGFK.js +0 -2
  354. package/dist/cdn/TOTWYGB3.js +0 -2
  355. package/dist/cdn/TUUUK3VX.js +0 -2
  356. package/dist/cdn/U3KMGSVH.js +0 -2
  357. package/dist/cdn/UEP2NYJK.js +0 -2
  358. package/dist/cdn/UZP4YMTE.js +0 -2
  359. package/dist/cdn/XYMBRPC7.js +0 -2
  360. package/dist/cdn/YB3DR4VO.js +0 -2
  361. package/dist/cdn/YYTEJVBL.js +0 -2
  362. package/dist/cdn/Z3HGPBOR.js +0 -2
  363. package/dist/cdn/ZDDN7UKS.js +0 -2
  364. package/dist/cdn/ZXNF77OB.js +0 -2
  365. package/dist/chunks/functional.js +0 -9
  366. package/dist/components/arcgis-portal-ai-assistant/data/capability-registries/types.d.ts +0 -45
  367. /package/dist/cdn/{OUMTV5H5.js → KHKREBVZ.js} +0 -0
  368. /package/dist/cdn/{GGDOGNH4.js → U2HTYOBB.js} +0 -0
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{$ as Ya,A as $a,Aa as ir,B as Va,Ba as hc,C as Fa,D as Mr,Da as pc,Ea as ri,F as La,Fa as fc,G as Ua,Ga as mc,H as Ha,I as kn,Ia as dc,J as Ba,K as Zs,Ka as gc,L as G,M as En,N as $t,O as Cn,P as Be,Q as Ga,R as Wa,S as Ka,T as qa,U as za,V as Ja,_ as wt,aa as Xa,ca as Qa,da as Za,ea as ei,fa as ec,g as Oa,ga as tc,ha as rc,ia as ti,j as nr,ja as nc,k as Xs,ka as sc,l as ge,m as Rr,ma as ic,n as Na,na as oc,o as sr,p as Pa,ra as ac,s as Qs,t as Ra,va as cc,w as Ma,wa as xn,x as st,xa as lc,y as ja,z as Da,za as uc}from"./3FSPL34I.js";import{$ as Zt,$a as ke,Aa as Nr,Ba as Pr,Ca as _a,D as Ws,Ea as Js,F as Oe,Fa as ya,G as Ks,H as fa,Ha as wa,Ia as ba,J as Dt,La as yt,M as ma,Na as va,O as da,Oa as Sa,P as vn,Pa as tr,Qa as ka,Sa as Ea,Ta as Ca,Ua as xa,V as qs,Va as Ta,Wa as rr,Xa as Ys,Y as Q,Ya as Z,Za as Ia,a as O,aa as zs,ab as Aa,bb as nt,e as aa,f as ca,g as la,h as ua,i as ha,ia as _t,j as pa,k as Ae,ma as er,na as Sn,sa as Ne,x as X,za as ga}from"./GGDOGNH4.js";function _c(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 bt(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=_c(t.runTimeout,"runTimeout"),s=_c(t.idleTimeout,"idleTimeout");if(!(n===void 0&&s===void 0))return{runTimeout:n,idleTimeout:s,refreshOn:r}}var W="__start__",K="__end__",We="__input__";var vt="__error__",Dr="__error_source_node__",Tn="__pregel_ns_writes";function yc(){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 oe="__pregel_send",Ke="__pregel_call",le="__pregel_read",Ee="__pregel_checkpointer",Ft="__pregel_resuming",or="__pregel_task_id",$r="__pregel_stream",Lh="__pregel_resume_value",Lt="__pregel_resume_map",ue="__pregel_scratchpad",St="__pregel_previous",Uh="__pregel_durability",kt="checkpoint_id",ve="checkpoint_ns",wc="__pregel_node_finished",Vr="__pregel_node_error",ae="checkpoint_map",In="__pregel_replay_state",bc="__pregel_abort_signals",L="__interrupt__",he="__resume__",Fr="__no_writes__",Et="__return__",Ct="__previous__",z="langsmith:hidden";var si="__self__",qe="__pregel_tasks",pe="__pregel_push",An="__pregel_pull",fe="00000000-0000-0000-0000-000000000000",vc=[z,We,L,he,vt,Dr,Fr,oe,le,Ee,Uh,$r,Ft,or,Ke,Lh,ue,St,ae,ve,kt,In],ni=Symbol.for("langgraph.command"),Sc=class{[ni];constructor(e){this[ni]=e}};function On(e){let t=e;return t!=null&&typeof t.node=="string"&&t.args!==void 0}var Vt=class{lg_name="Send";node;args;timeout;constructor(e,t,r){this.node=e,this.args=jr(t),this.timeout=bt(r?.timeout)}toJSON(){return{lg_name:this.lg_name,node:this.node,args:this.args,timeout:this.timeout}}};function ee(e){return e instanceof Vt}var Ge="__overwrite__",Hh=class{lg_name="Overwrite";[Ge];constructor(e){this[Ge]=e}get value(){return this[Ge]}toJSON(){return{[Ge]:this[Ge]}}static isInstance(e){return!e||typeof e!="object"?!1:"__overwrite__"in e||"lg_name"in e&&e.lg_name==="Overwrite"}};function Pe(e){if(typeof e=="object"&&e!==null){if("__overwrite__"in e)return[!0,e[Ge]];let t=e;if(t.type==="__overwrite__"&&"value"in t)return[!0,t.value]}return[!1,void 0]}function Ut(e){return Pe(e)[0]}function Ht(e){return!e||typeof e!="object"||!("__interrupt__"in e)?!1:Array.isArray(e[L])}var _e=class extends Sc{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)?jr(e.goto):[jr(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:ee(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 ne(e){return typeof e!="object"||e==null?!1:"lg_name"in e&&e.lg_name==="Command"}function Bh(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function jr(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,s)=>{r[s]=jr(n,t)});else if(e instanceof _e||e instanceof Vt||!Bh(e))r=e,t.set(e,r);else if(ne(e))r=new _e(e),t.set(e,r);else if(On(e))r=new Vt(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,s]of Object.entries(e))r[n]=jr(s,t)}return r}return e}var Ce=class extends Error{lc_error_code;constructor(e,t){let r=e??"";t?.lc_error_code&&(r=`${r}
2
+ import{$ as ec,Aa as mc,B as La,Ba as dc,C as Ua,D as Ha,Da as gc,E as kn,F as Ba,G as Zs,H as G,I as En,J as $t,K as Cn,L as Be,M as Ga,N as Wa,O as Ka,P as qa,Q as za,R as Ja,V as Ya,W as Xa,Y as Qa,Z as Za,_ as ei,aa as tc,ba as rc,c as Oa,ca as ti,da as nc,ea as sc,f as nr,g as Xs,ga as ic,h as ge,ha as oc,i as Rr,j as Na,k as sr,l as Pa,la as ac,o as Qs,p as Ra,pa as cc,qa as xn,ra as lc,s as Ma,t as st,ta as uc,u as ja,ua as ir,v as Da,va as hc,w as $a,x as Va,xa as pc,y as Fa,ya as ri,z as Mr,za as fc}from"./234TH32X.js";import{$ as Zt,$a as ke,Aa as Nr,Ba as Pr,Ca as _a,D as Ws,Ea as Js,F as Oe,Fa as ya,G as Ks,H as fa,Ha as wa,Ia as ba,J as Dt,La as yt,M as ma,Na as va,O as da,Oa as Sa,P as vn,Pa as tr,Qa as ka,Sa as Ea,Ta as Ca,Ua as xa,V as qs,Va as Ta,Wa as rr,Xa as Ys,Y as Q,Ya as Z,Za as Ia,a as O,aa as zs,ab as Aa,bb as nt,e as aa,f as ca,g as la,h as ua,i as ha,ia as _t,j as pa,k as Ae,ma as er,na as Sn,sa as Ne,x as X,za as ga}from"./U2HTYOBB.js";import{o as wt}from"./K3GAZFRI.js";function _c(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 bt(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=_c(t.runTimeout,"runTimeout"),s=_c(t.idleTimeout,"idleTimeout");if(!(n===void 0&&s===void 0))return{runTimeout:n,idleTimeout:s,refreshOn:r}}var W="__start__",K="__end__",We="__input__";var vt="__error__",Dr="__error_source_node__",Tn="__pregel_ns_writes";function yc(){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 oe="__pregel_send",Ke="__pregel_call",le="__pregel_read",Ee="__pregel_checkpointer",Ft="__pregel_resuming",or="__pregel_task_id",$r="__pregel_stream",Lh="__pregel_resume_value",Lt="__pregel_resume_map",ue="__pregel_scratchpad",St="__pregel_previous",Uh="__pregel_durability",kt="checkpoint_id",ve="checkpoint_ns",wc="__pregel_node_finished",Vr="__pregel_node_error",ae="checkpoint_map",In="__pregel_replay_state",bc="__pregel_abort_signals",L="__interrupt__",he="__resume__",Fr="__no_writes__",Et="__return__",Ct="__previous__",z="langsmith:hidden";var si="__self__",qe="__pregel_tasks",pe="__pregel_push",An="__pregel_pull",fe="00000000-0000-0000-0000-000000000000",vc=[z,We,L,he,vt,Dr,Fr,oe,le,Ee,Uh,$r,Ft,or,Ke,Lh,ue,St,ae,ve,kt,In],ni=Symbol.for("langgraph.command"),Sc=class{[ni];constructor(e){this[ni]=e}};function On(e){let t=e;return t!=null&&typeof t.node=="string"&&t.args!==void 0}var Vt=class{lg_name="Send";node;args;timeout;constructor(e,t,r){this.node=e,this.args=jr(t),this.timeout=bt(r?.timeout)}toJSON(){return{lg_name:this.lg_name,node:this.node,args:this.args,timeout:this.timeout}}};function ee(e){return e instanceof Vt}var Ge="__overwrite__",Hh=class{lg_name="Overwrite";[Ge];constructor(e){this[Ge]=e}get value(){return this[Ge]}toJSON(){return{[Ge]:this[Ge]}}static isInstance(e){return!e||typeof e!="object"?!1:"__overwrite__"in e||"lg_name"in e&&e.lg_name==="Overwrite"}};function Pe(e){if(typeof e=="object"&&e!==null){if("__overwrite__"in e)return[!0,e[Ge]];let t=e;if(t.type==="__overwrite__"&&"value"in t)return[!0,t.value]}return[!1,void 0]}function Ut(e){return Pe(e)[0]}function Ht(e){return!e||typeof e!="object"||!("__interrupt__"in e)?!1:Array.isArray(e[L])}var _e=class extends Sc{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)?jr(e.goto):[jr(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:ee(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 ne(e){return typeof e!="object"||e==null?!1:"lg_name"in e&&e.lg_name==="Command"}function Bh(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function jr(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,s)=>{r[s]=jr(n,t)});else if(e instanceof _e||e instanceof Vt||!Bh(e))r=e,t.set(e,r);else if(ne(e))r=new _e(e),t.set(e,r);else if(On(e))r=new Vt(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,s]of Object.entries(e))r[n]=jr(s,t)}return r}return e}var Ce=class extends Error{lc_error_code;constructor(e,t){let r=e??"";t?.lc_error_code&&(r=`${r}
3
3
 
4
4
  Troubleshooting URL: https://docs.langchain.com/oss/javascript/langgraph/${t.lc_error_code}/
5
5
  `),super(r),this.lc_error_code=t?.lc_error_code}},Nn=class extends Ce{get is_bubble_up(){return!0}},ii=class extends Ce{constructor(e,t){super(e,t),this.name="GraphRecursionError"}static get unminifiable_name(){return"GraphRecursionError"}},Bt=class extends Ce{constructor(e,t){super(e,t),this.name="GraphValueError"}static get unminifiable_name(){return"GraphValueError"}},Pn=class extends Nn{reason;constructor(e="shutdown",t){super(`Graph drained: ${e}`,t),this.name="GraphDrained",this.reason=e}static get unminifiable_name(){return"GraphDrained"}};function Rn(e){return e!==void 0&&e.name===Pn.unminifiable_name}var it=class extends Nn{interrupts;constructor(e,t){super(JSON.stringify(e,null,2),t),this.name="GraphInterrupt",this.interrupts=e??[]}static get unminifiable_name(){return"GraphInterrupt"}},Mn=class extends it{constructor(e,t){super([{value:e}],t),this.name="NodeInterrupt"}static get unminifiable_name(){return"NodeInterrupt"}},jn=class{node;error;constructor(e,t){this.node=e,this.error=t}static get unminifiable_name(){return"NodeError"}};function Gh(e){return e!=null&&typeof e=="object"&&e.constructor!=null&&e.constructor.unminifiable_name===jn.unminifiable_name}var Dn=class extends Nn{command;constructor(e){super(),this.name="ParentCommand",this.command=e}static get unminifiable_name(){return"ParentCommand"}};function oi(e){return e!==void 0&&e.name===Dn.unminifiable_name}function xt(e){return e!==void 0&&e.is_bubble_up===!0}function ot(e){return e!==void 0&&[it.unminifiable_name,Mn.unminifiable_name].includes(e.name)}var $n=class extends Ce{node;kind;timeout;elapsed;runTimeout;idleTimeout;constructor(e,t){let{node:r,elapsed:n,kind:s,runTimeout:i,idleTimeout:o}=e,a,c;if(s==="idle"){if(o===void 0)throw new Error("idleTimeout is required when kind='idle'");c=o,a=`Node "${r}" exceeded its idle timeout of ${o}ms without making progress (elapsed: ${n}ms).`}else{if(i===void 0)throw new Error("runTimeout is required when kind='run'");c=i,a=`Node "${r}" exceeded its run timeout of ${i}ms (elapsed: ${n}ms).`}super(a,t),this.name="NodeTimeoutError",this.node=r,this.kind=s,this.timeout=c,this.elapsed=n,this.runTimeout=i,this.idleTimeout=o}static get unminifiable_name(){return"NodeTimeoutError"}};function Wh(e){return e!==void 0&&e.name===$n.unminifiable_name}var Vn=class extends Ce{constructor(e,t){super(e,t),this.name="EmptyInputError"}static get unminifiable_name(){return"EmptyInputError"}},$=class extends Ce{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"}},R=class extends Ce{constructor(e,t){super(e,t),this.name="InvalidUpdateError"}static get unminifiable_name(){return"InvalidUpdateError"}},Kh=class extends Ce{constructor(e,t){super(e,t),this.name="MultipleSubgraphError"}static get unminifiable_name(){return"MultipleSubgraphError"}},ai=class extends Ce{constructor(e,t){super(e,t),this.name="UnreachableNodeError"}static get unminifiable_name(){return"UnreachableNodeError"}},qh=class extends Ce{constructor(e,t){super(e,t),this.name="RemoteException"}static get unminifiable_name(){return"RemoteException"}},Lr=class extends Ce{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"}},zh=()=>(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 ci=0,Ur=0;function Hr(e){let t=Date.now();return t<=ci?(Ur+=1,Ur>=1e4&&(Ur=0,t=ci+1)):Ur=0,ci=t,_a({clockseq:e,msecs:t,nsecs:Ur})}function ze(e,t){let r=t.replace(/-/g,"").match(/.{2}/g).map(n=>parseInt(n,16));return Pr(e,new Uint8Array(r))}var Br="__pregel_tasks",li="__error__",Gt="__scheduled__",ui="__interrupt__",hi="__resume__",ar=class{lg_name="DeltaSnapshot";value;constructor(e){this.value=e}};function pi(e){return e!=null&&typeof e=="object"&&e.lg_name==="DeltaSnapshot"}var kc="[...]",Jh="[Circular]",Fn=[],cr=[];function Yh(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function Ec(e,t,r,n){typeof n>"u"&&(n=Yh()),mi(e,"",0,[],void 0,0,n);var s;try{cr.length===0?s=JSON.stringify(e,t,r):s=JSON.stringify(e,Xh(t),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;Fn.length!==0;){var i=Fn.pop();i.length===4?Object.defineProperty(i[0],i[1],i[3]):i[0][i[1]]=i[2]}}return s}function fi(e,t,r,n){var s=Object.getOwnPropertyDescriptor(n,r);s.get!==void 0?s.configurable?(Object.defineProperty(n,r,{value:e}),Fn.push([n,r,t,s])):cr.push([t,r,e]):(n[r]=e,Fn.push([n,r,t]))}function mi(e,t,r,n,s,i,o){i+=1;var a;if(typeof e=="object"&&e!==null){for(a=0;a<n.length;a++)if(n[a]===e){fi(Jh,e,t,s);return}if(typeof o.depthLimit<"u"&&i>o.depthLimit){fi(kc,e,t,s);return}if(typeof o.edgesLimit<"u"&&r+1>o.edgesLimit){fi(kc,e,t,s);return}if(n.push(e),Array.isArray(e))for(a=0;a<e.length;a++)mi(e[a],a,a,n,e,i,o);else{var c=Object.keys(e);for(a=0;a<c.length;a++){var l=c[a];mi(e[l],l,a,n,e,i,o)}}n.pop()}}function Xh(e){return e=typeof e<"u"?e:function(t,r){return r},function(t,r){if(cr.length>0)for(var n=0;n<cr.length;n++){var s=cr[n];if(s[1]===t&&s[0]===r){r=s[2],cr.splice(n,1);break}}return e.call(this,t,r)}}var Cc=[];var xc=O({});var Tc=O({});var Ic=O({BaseChatMessageHistory:()=>di,BaseListChatMessageHistory:()=>Ln,InMemoryChatMessageHistory:()=>Qh}),di=class extends Ae{async addMessages(e){for(let t of e)await this.addMessage(t)}},Ln=class extends Ae{addUserMessage(e){return this.addMessage(new _t(e))}addAIMessage(e){return this.addMessage(new Q(e))}async addMessages(e){for(let t of e)await this.addMessage(t)}clear(){throw new Error("Not implemented.")}},Qh=class extends Ln{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 Se=class{pageContent;metadata;id;constructor(e){this.pageContent=e.pageContent!==void 0?e.pageContent.toString():"",this.metadata=e.metadata??{},this.id=e.id}};var gi=class extends G{lc_namespace=["langchain_core","documents","transformers"];invoke(e,t){return this.transformDocuments(e)}},Ac=class extends gi{async transformDocuments(e){let t=[];for(let r of e){let n=await this._transformDocument(r);t.push(n)}return t}};var Oc=O({BaseDocumentTransformer:()=>gi,Document:()=>Se,MappingDocumentTransformer:()=>Ac});var Nc=O({BaseDocumentLoader:()=>_i}),_i=class{};var Pc=O({LangSmithLoader:()=>Zh}),Zh=class extends _i{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 va(e?.clientConfig),this.contentKey=e.contentKey?e.contentKey.split("."):[],this.formatContent=e.formatContent??ep,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 i of this.contentKey)r=r[i];let n=this.formatContent(r),s=t;["created_at","modified_at"].forEach(i=>{i in s&&typeof s[i]=="object"&&(s[i]=s[i].toString())}),e.push({pageContent:n,metadata:s})}return e}};function ep(e){if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}var lr=class extends Ae{lc_namespace=["langchain_core","example_selectors","base"]};var yi=class{async getPromptAsync(e,t){return this.getPrompt(e).partial(t?.partialVariables??{})}},Rc=class extends yi{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 Mc(e){return e._modelType()==="base_llm"}function jc(e){return e._modelType()==="base_chat_model"}function Dc(e){return e.split(/\n| /).length}var $c=class Vc extends lr{examples=[];examplePrompt;getTextLength=Dc;maxLength=2048;exampleTextLengths=[];constructor(t){super(t),this.examplePrompt=t.examplePrompt,this.maxLength=t.maxLength??2048,this.getTextLength=t.getTextLength??Dc}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:s}=r;return(await Promise.all(n.map(i=>s.format(i)))).map(i=>this.getTextLength(i))}async selectExamples(t){let r=Object.values(t).join(" "),n=this.maxLength-this.getTextLength(r),s=0,i=[];for(;n>0&&s<this.examples.length;){let o=n-this.exampleTextLengths[s];if(o<0)break;i.push(this.examples[s]),n=o,s+=1}return i}static async fromExamples(t,r){let n=new Vc(r);return await Promise.all(t.map(s=>n.addExample(s))),n}};function wi(e){return Object.keys(e).sort().map(t=>e[t])}var Fc=class Lc extends lr{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=wi((this.inputKeys??Object.keys(t)).reduce((n,s)=>({...n,[s]:t[s]}),{})).join(" ");await this.vectorStoreRetriever.addDocuments([new Se({pageContent:r,metadata:t})])}async selectExamples(t){let r=wi((this.inputKeys??Object.keys(t)).reduce((s,i)=>({...s,[i]:t[i]}),{})).join(" "),n=(await this.vectorStoreRetriever.invoke(r)).map(s=>s.metadata);return this.exampleKeys?n.map(s=>this.exampleKeys.reduce((i,o)=>({...i,[o]:s[o]}),{})):n}static async fromExamples(t,r,n,s={}){let i=s.inputKeys??null,o=t.map(c=>wi(i?i.reduce((l,u)=>({...l,[u]:c[u]}),{}):c).join(" ")),a=await n.fromTexts(o,t,r,s);return new Lc({vectorStore:a,k:s.k??4,exampleKeys:s.exampleKeys,inputKeys:s.inputKeys})}};var Uc=O({BaseExampleSelector:()=>lr,BasePromptSelector:()=>yi,ConditionalPromptSelector:()=>Rc,LengthBasedExampleSelector:()=>$c,SemanticSimilarityExampleSelector:()=>Fc,isChatModel:()=>jc,isLLM:()=>Mc});var Gr="10f90ea3-90a4-4962-bf75-83a0f3c1c62a",Hc=class extends Ae{lc_namespace=["langchain","recordmanagers"]};var bi=class{uid;hash_;contentHash;metadataHash;pageContent;metadata;keyEncoder=ja;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 Se({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 Pr(this.keyEncoder(e),Gr)}_hashNestedDictToUUID(e){let t=JSON.stringify(e,Object.keys(e).sort());return Pr(this.keyEncoder(t),Gr)}};function vi(e,t){let r=[],n=[];return t.forEach(s=>{n.push(s),n.length>=e&&(r.push(n),n=[])}),n.length>0&&r.push(n),r}function Si(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 ki(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 Ei=e=>"load"in e&&typeof e.load=="function"&&"loadAndSplit"in e&&typeof e.loadAndSplit=="function";async function Bc(e){let{docsSource:t,recordManager:r,vectorStore:n,options:s}=e,{batchSize:i=100,cleanup:o,sourceIdKey:a,cleanupBatchSize:c=1e3,forceUpdate:l=!1}=s??{};if(o==="incremental"&&!a)throw new Error("sourceIdKey is required when cleanup mode is incremental. Please provide through 'options.sourceIdKey'.");let u=Ei(t)?await t.load():t,h=ki(a??null),p=await r.getTime(),f=0,m=0,d=0,_=0,g=vi(i??100,u);for(let y of g){let S=Si(y.map(x=>bi.fromDocument(x))),w=S.map(x=>h(x));o==="incremental"&&S.forEach((x,F)=>{if(w[F]===null)throw new Error("sourceIdKey must be provided when cleanup is incremental")});let C=await r.exists(S.map(x=>x.uid)),T=[],k=[],b=[],I=new Set;if(S.forEach((x,F)=>{if(C[F])if(l)I.add(x.uid);else{b.push(x.uid);return}T.push(x.uid),k.push(x.toDocument())}),b.length>0&&(await r.update(b,{timeAtLeast:p}),_+=b.length),k.length>0&&(await n.addDocuments(k,{ids:T}),f+=k.length-I.size,d+=I.size),await r.update(S.map(x=>x.uid),{timeAtLeast:p,groupIds:w}),o==="incremental"){w.forEach(F=>{if(!F)throw new Error("Source id cannot be null")});let x=await r.listKeys({before:p,groupIds:w});x.length>0&&(await n.delete({ids:x}),await r.deleteKeys(x),m+=x.length)}}if(o==="full"){let y=await r.listKeys({before:p,limit:c});for(;y.length>0;)await n.delete({ids:y}),await r.deleteKeys(y),m+=y.length,y=await r.listKeys({before:p,limit:c})}return{numAdded:f,numDeleted:m,numUpdated:d,numSkipped:_}}var Gc=O({RecordManager:()=>Hc,UUIDV5_NAMESPACE:()=>Gr,_HashedDocument:()=>bi,_batch:()=>vi,_deduplicateInOrder:()=>Si,_getSourceIdAssigner:()=>ki,_isBaseDocumentLoader:()=>Ei,index:()=>Bc});var Wc=O({});var Kc=O({});var qc=O({BaseMemory:()=>tp,getInputValue:()=>rp,getOutputValue:()=>np,getPromptInputKey:()=>sp}),tp=class{},zc=(e,t)=>{if(t!==void 0)return e[t];let r=Object.keys(e);if(r.length===1)return e[r[0]]},rp=(e,t)=>{let r=zc(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},np=(e,t)=>{let r=zc(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 sp(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 Ci=class extends ti{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)}`)}},xi=class extends sc{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 Ci(e)}_diff(e,t){if(t)return La(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?qs(n.arguments):{...n,arguments:qs(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""}},Jc=class extends ti{static lc_name(){return"JsonKeyOutputFunctionsParser"}lc_namespace=["langchain","output_parsers","openai_functions"];lc_serializable=!0;outputParser=new xi;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 Yc=O({JsonKeyOutputFunctionsParser:()=>Jc,JsonOutputFunctionsParser:()=>xi,OutputFunctionsParser:()=>Ci});var Je=class extends G{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,s]of Object.entries(t))typeof s=="string"?r[n]=s:r[n]=await s();return{...r,...e}}async invoke(e,t){let r={...this.metadata,...t?.metadata},n=[...this.tags??[],...t?.tags??[]];return this._callWithConfig(s=>this.formatPromptValue(s),e,{...t,tags:n,metadata:r,runType:"prompt"})}};var at=class extends Je{async formatPromptValue(e){return new Wa(await this.format(e))}};var ip=Object.prototype.toString,hr=Array.isArray||function(t){return ip.call(t)==="[object Array]"};function Ii(e){return typeof e=="function"}function op(e){return hr(e)?"array":typeof e}function Ti(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Xc(e,t){return e!=null&&typeof e=="object"&&t in e}function ap(e,t){return e!=null&&typeof e!="object"&&e.hasOwnProperty&&e.hasOwnProperty(t)}var cp=RegExp.prototype.test;function lp(e,t){return cp.call(e,t)}var up=/\S/;function hp(e){return!lp(up,e)}var pp={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function fp(e){return String(e).replace(/[&<>"'`=\/]/g,function(r){return pp[r]})}var mp=/\s*/,dp=/\s+/,Qc=/\s*=/,gp=/\s*\}/,_p=/#|\^|\/|>|\{|&|=|!/;function yp(e,t){if(!e)return[];var r=!1,n=[],s=[],i=[],o=!1,a=!1,c="",l=0;function u(){if(o&&!a)for(;i.length;)delete s[i.pop()];else i=[];o=!1,a=!1}var h,p,f;function m(b){if(typeof b=="string"&&(b=b.split(dp,2)),!hr(b)||b.length!==2)throw new Error("Invalid tags: "+b);h=new RegExp(Ti(b[0])+"\\s*"),p=new RegExp("\\s*"+Ti(b[1])),f=new RegExp("\\s*"+Ti("}"+b[1]))}m(t||xe.tags);for(var d=new Kr(e),_,g,y,S,w,C;!d.eos();){if(_=d.pos,y=d.scanUntil(h),y)for(var T=0,k=y.length;T<k;++T)S=y.charAt(T),hp(S)?(i.push(s.length),c+=S):(a=!0,r=!0,c+=" "),s.push(["text",S,_,_+1]),_+=1,S===`
@@ -132,4 +132,4 @@ data: ${JSON.stringify({message:String(n)})}
132
132
 
133
133
  `))}finally{r.close()}}})}var kh=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 s;return typeof e=="string"?r?s={[r]:e}:s=[e]:s=Object.fromEntries(e.map(i=>[i,i])),new Fe({channels:s,triggers:Array.isArray(e)?e:[e],tags:n})}static writeTo(e,t){let r=[];for(let n of e)r.push({channel:n,value:we,skipNone:!1});for(let[n,s]of Object.entries(t??{}))G.isRunnable(s)||typeof s=="function"?r.push({channel:n,value:we,skipNone:!0,mapper:Be(s)}):r.push({channel:n,value:s,skipNone:!1});return new q(r)}},Vm=class extends G{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)}},Us=class extends Vm{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 '${qe}' is reserved and cannot be used in the graph.`);this.channels[qe]=new Ko({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=ke(this.config,r),s=[...this.streamTransformers,...t??[]];return new this.constructor({...this,config:n,streamTransformers:s})}validate(){vh({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 s=n.subgraphs?.length?n.subgraphs:[n.bound];for(let i of s){let o=Os(i);if(o!==void 0){if(r===e){yield[r,o];return}if(e===void 0&&(yield[r,o]),t){let a=e;e!==void 0&&(a=e.slice(r.length+1));for(let[c,l]of o.getSubgraphs(a,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 s=await vr(this.channels,t.checkpoint,{saver:typeof this.checkpointer=="object"?this.checkpointer:void 0,config:t.config??e});if(t.pendingWrites?.length){let h=t.pendingWrites.filter(([p,f])=>p===fe).map(([p,f,m])=>[String(f),m]);h.length>0&&de(t.checkpoint,s,[{name:We,writes:h,triggers:[]}],void 0,this.triggerToNodes)}let i=Object.values(Nt(t.checkpoint,t.pendingWrites,this.nodes,s,t.config,!0,{step:(t.metadata?.step??-1)+1,store:this.store})),o=await Ve(this.getSubgraphsAsync()),a=t.config.configurable?.checkpoint_ns??"",c={};for(let h of i){let p=o.find(([m])=>m===h.name);if(!p)continue;let f=`${String(h.name)}:${h.id}`;if(a&&(f=`${a}|${f}`),r===void 0){let m={configurable:{thread_id:t.config.configurable?.thread_id,checkpoint_ns:f}};c[h.id]=m}else{let m={configurable:{[Ee]:r,thread_id:t.config.configurable?.thread_id,checkpoint_ns:f}},d=p[1];c[h.id]=await d.getState(m,{subgraphs:!0})}}if(n&&t.pendingWrites?.length){let h=Object.fromEntries(i.map(f=>[f.id,f]));for(let[f,m,d]of t.pendingWrites)["__error__","__interrupt__",Gt].includes(m)||f in h&&h[f].writes.push([String(m),d]);let p=i.filter(f=>f.writes.length>0);p.length>0&&de(t.checkpoint,s,p,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=i.filter(h=>h.writes.length===0).map(h=>h.name);return{values:Le(s,this.streamChannelsAsIs),next:u,tasks:Vo(i,t?.pendingWrites??[],c,this.streamChannelsAsIs),metadata:l,config:At(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 Bt("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=ys(n);for await(let[a,c]of this.getSubgraphsAsync(o,!0))if(a===o)return await c.getState(Jt(e,{[Ee]:r}),{subgraphs:t?.subgraphs})}let s=ke(this.config,e),i=await r.getTuple(e);return await this._prepareStateSnapshot({config:s,saved:i,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 Bt("No checkpointer set",{lc_error_code:"MISSING_CHECKPOINTER"});let n=e.configurable?.checkpoint_ns??"";if(n!==""&&e.configurable?.__pregel_checkpointer===void 0){let i=ys(n);for await(let[o,a]of this.getSubgraphsAsync(i,!0))if(o===i){yield*a.getStateHistory(Jt(e,{[Ee]:r}),t);return}}let s=ke(this.config,e,{configurable:{checkpoint_ns:n}});for await(let i of r.list(s,t))yield this._prepareStateSnapshot({config:i.config,saved:i})}async bulkUpdateState(e,t){let r=e.configurable?.__pregel_checkpointer??this.checkpointer;if(!r)throw new Bt("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=ys(n);for await(let[,a]of this.getSubgraphsAsync(o,!0))return await a.bulkUpdateState(Jt(e,{[Ee]:r}),t);throw new Error(`Subgraph "${o}" not found`)}let s=async(o,a)=>{let c=this.config?ke(this.config,o):o,l=await r.getTuple(c),u=l!==void 0?je(l.checkpoint):qt(),h={...l?.checkpoint.channel_versions},p=l?.metadata?.step??-1,f=Jt(c,{checkpoint_ns:c.configurable?.checkpoint_ns??""}),m=c.metadata??{};l?.config.configurable&&(f=Jt(c,l.config.configurable),m={...l.metadata,...m});let{values:d,asNode:_}=a[0];if(d==null&&_===void 0){if(a.length>1)throw new R("Cannot create empty checkpoint with multiple updates");return At(await r.put(f,De(u,void 0,p),{source:"update",step:p+1,parents:l?.metadata?.parents??{}},{}),l?l.metadata:void 0)}let g=await vr(this.channels,u,{saver:r,config:l?.config??f});if(d===null&&_==="__end__"){if(a.length>1)throw new R("Cannot apply multiple updates when clearing state");if(l){let k=Nt(u,l.pendingWrites||[],this.nodes,g,l.config,!0,{step:(l.metadata?.step??-1)+1,checkpointer:r,store:this.store}),b=(l.pendingWrites||[]).filter(I=>I[0]===fe).map(I=>I.slice(1));b.length>0&&de(u,g,[{name:We,writes:b,triggers:[]}],r.getNextVersion.bind(r),this.triggerToNodes);for(let[I,x,F]of l.pendingWrites||[])["__error__","__interrupt__",Gt].includes(x)||I in k&&k[I].writes.push([x,F]);de(u,g,Object.values(k),r.getNextVersion.bind(r),this.triggerToNodes)}return At(await r.put(f,De(u,g,p),{...m,source:"update",step:p+1,parents:l?.metadata?.parents??{}},Ir(h,u.channel_versions)),l?l.metadata:void 0)}if(_==="__copy__"){if(a.length>1)throw new R("Cannot copy checkpoint with multiple updates");if(l==null)throw new R("Cannot copy a non-existent checkpoint");let k=x=>!Array.isArray(x)||x.length===0?!1:x.every(F=>Array.isArray(F)&&F.length===2),b=De(u,void 0,p),I=await r.put(l.parentConfig??Jt(l.config,{checkpoint_id:void 0}),b,{source:"fork",step:p+1,parents:l.metadata?.parents??{}},{});if(k(d)){let x=Nt(b,l.pendingWrites,this.nodes,g,I,!1,{step:p+2}),F=Object.values(x).reduce((V,{name:B,id:be})=>(V[B]??=[],V[B].push({id:be}),V),{}),j=d.reduce((V,B)=>{let[be,rt]=B;V[rt]??=[];let E=V[rt].length,A=F[rt]?.[E]?.id;return V[rt].push({values:be,asNode:rt,taskId:A}),V},{});return s(At(I,l.metadata),Object.values(j).flat())}return At(I,l.metadata)}if(_==="__input__"){if(a.length>1)throw new R("Cannot apply multiple updates when updating as input");let k=await Ve(Ns(this.inputChannels,d));if(k.length===0)throw new R(`Received no input writes for ${JSON.stringify(this.inputChannels,null,2)}`);de(u,g,[{name:We,writes:k,triggers:[]}],r.getNextVersion.bind(this.checkpointer),this.triggerToNodes);let b=l?.metadata?.step!=null?l.metadata.step+1:-1,I=await r.put(f,De(u,g,b),{source:"input",step:b,parents:l?.metadata?.parents??{}},Ir(h,u.channel_versions));return await r.putWrites(I,k,ze(We,u.id)),At(I,l?l.metadata:void 0)}if(c.configurable?.checkpoint_id===void 0&&l?.pendingWrites!==void 0&&l.pendingWrites.length>0){let k=Nt(u,l.pendingWrites,this.nodes,g,l.config,!0,{store:this.store,checkpointer:this.checkpointer,step:(l.metadata?.step??-1)+1}),b=(l.pendingWrites??[]).filter(x=>x[0]===fe).map(x=>x.slice(1));b.length>0&&de(l.checkpoint,g,[{name:We,writes:b,triggers:[]}],void 0,this.triggerToNodes);for(let[x,F,j]of l.pendingWrites)["__error__","__interrupt__",Gt].includes(F)||k[x]===void 0||k[x].writes.push([F,j]);let I=Object.values(k).filter(x=>x.writes.length>0);I.length>0&&de(u,g,I,void 0,this.triggerToNodes)}let y=Object.values(u.versions_seen).map(k=>Object.values(k)).flat().find(k=>!!k),S=[];if(a.length===1){let{values:k,asNode:b,taskId:I}=a[0];if(b===void 0&&Object.keys(this.nodes).length===1)[b]=Object.keys(this.nodes);else if(b===void 0&&y===void 0)typeof this.inputChannels=="string"&&this.nodes[this.inputChannels]!==void 0&&(b=this.inputChannels);else if(b===void 0){let x=Object.entries(u.versions_seen).map(([F,j])=>Object.values(j).map(V=>[V,F])).flat().filter(([F,j])=>j!==L).sort(([F],[j])=>ls(F,j));x&&(x.length===1?b=x[0][1]:x[x.length-1][0]!==x[x.length-2][0]&&(b=x[x.length-1][1]))}if(b===void 0)throw new R('Ambiguous update, specify "asNode"');S.push({values:k,asNode:b,taskId:I})}else for(let{asNode:k,values:b,taskId:I}of a){if(k==null)throw new R('"asNode" is required when applying multiple updates');S.push({values:b,asNode:k,taskId:I})}let w=[];for(let{asNode:k,values:b,taskId:I}of S){if(this.nodes[k]===void 0)throw new R(`Node "${k.toString()}" does not exist`);let x=this.nodes[k].getWriters();if(!x.length)throw new R(`No writers found for node "${k.toString()}"`);w.push({name:k,input:b,proc:x.length>1?$t.from(x,{omitSequenceTags:!0}):x[0],writes:[],triggers:[L],id:I??ze("__interrupt__",u.id),writers:[]})}for(let k of w)await k.proc.invoke(k.input,nt({...c,store:c?.store??this.store},{runName:c.runName??`${this.getName()}UpdateState`,configurable:{[oe]:b=>k.writes.push(...b),[le]:(b,I=!1)=>Ar(u,g,k,b,I)}}));for(let k of w){let b=k.writes.filter(I=>I[0]!==pe);l!==void 0&&b.length>0&&await r.putWrites(f,b,k.id)}de(u,g,w,r.getNextVersion.bind(this.checkpointer),this.triggerToNodes);let C=Ir(h,u.channel_versions),T=await r.put(f,De(u,g,p+1),{source:"update",step:p+1,parents:l?.metadata?.parents??{}},C);for(let k of w){let b=k.writes.filter(I=>I[0]===pe);b.length>0&&await r.putWrites(T,b,k.id)}return At(T,l?l.metadata:void 0)},i=e;for(let{updates:o}of t)i=await s(i,o);return i}async updateState(e,t,r){return this.bulkUpdateState(e,[{updates:[{values:t,asNode:r}]}])}_defaults(e){let{debug:t,streamMode:r,inputKeys:n,outputKeys:s,interruptAfter:i,interruptBefore:o,...a}=e,c=!0,l=t!==void 0?t:this.debug,u=s;u===void 0?u=this.streamChannelsAsIs:Wo(u,this.channels);let h=n;h===void 0?h=this.inputChannels:Wo(h,this.channels);let p=o??this.interruptBefore??[],f=i??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 d;if(this.checkpointer===!1)d=void 0;else if(e!==void 0&&e.configurable?.__pregel_checkpointer!==void 0)d=e.configurable[Ee];else{if(this.checkpointer===!0)throw new Error("checkpointer: true cannot be used for root graphs.");d=this.checkpointer}let _=e.store??this.store,g=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 y=(()=>{if(e.checkpointDuring!=null)return e.checkpointDuring===!1?"exit":"async"})(),S=e.durability??y??e?.configurable?.__pregel_durability??"async";return[l,m,h,u,a,p,f,d,_,c,g,S]}async stream(e,t){let r=new AbortController,n=_s()?.configurable;n?.__pregel_read!==void 0&&t?.configurable?.__pregel_read===void 0&&(t={...t,configurable:{...n,...t?.configurable}});let s={recursionLimit:this.config?.recursionLimit,...t,signal:Ot(t?.signal,r.signal).signal},i=await super.stream(e,s);return new Vs(t?.encoding==="text/event-stream"?ah(i):i,r)}async#e(e,t){let{version:r,encoding:n,transformers:s,...i}=t,o={recursionLimit:this.config?.recursionLimit,...i,configurable:{...this.config?.configurable,...i?.configurable},version:r,streamMode:_o,subgraphs:!0,encoding:void 0},a=this.stream(e,o),c=Io({[Symbol.asyncIterator]:async function*(){let l=await a;for await(let u of l)yield u}},[...this.streamTransformers??[],...s??[]]);if(n==="text/event-stream"){let l=new AbortController;return l.signal.addEventListener("abort",()=>c.abort(l.signal.reason),{once:!0}),new Vs($m(c),l)}return c}streamEvents(e,t,r){if(t.version==="v3")return this.#e(e,t);let n=new AbortController,s={recursionLimit:this.config?.recursionLimit,...t,signal:Ot(t?.signal,n.signal).signal};return new Vs(super.streamEvents(e,s,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,s=t?.version==="v3",i=Sr(this.config,t);if(i.recursionLimit===void 0||i.recursionLimit<1)throw new Error('Passed "recursionLimit" must be at least 1.');if(this.checkpointer!==void 0&&this.checkpointer!==!1&&i.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:a,...c}=i,[l,u,,h,p,f,m,d,_,g,y,S]=this._defaults(c);p.metadata={ls_integration:"langgraph",...p.metadata},typeof p.context<"u"?p.context=await this._validateContext(p.context):p.configurable=await this._validateContext(p.configurable);let w=new Lo({modes:new Set(u)});if(this.checkpointer===!0){p.configurable??={};let j=p.configurable.checkpoint_ns??"";p.configurable[ve]=j.split("|").map(V=>V.split(":")[0]).join("|")}if(u.includes("messages")){let j=s?new yh(B=>w.push(B)):new dh(B=>w.push(B)),{callbacks:V}=p;if(V===void 0)p.callbacks=[j];else if(Array.isArray(V))p.callbacks=V.concat(j);else{let B=V.copy();B.addHandler(j,!0),p.callbacks=B}}if(u.includes("tools")){let j=new oh(B=>w.push(B)),{callbacks:V}=p;if(V===void 0)p.callbacks=[j];else if(Array.isArray(V))p.callbacks=V.concat(j);else{let B=V.copy();B.addHandler(j,!0),p.callbacks=B}}p.writer??=j=>{if(!u.includes("custom"))return;let V=_s()?.configurable?.[ve]?.split("|").slice(0,-1);w.push([V??[],"custom",j])},p.interrupt??=this.userInterrupt??Po,p.serverInfo==null&&(p.serverInfo=Fm(p)),p.control??=new go;let C={tracerInheritableMetadata:Hm(p)},T=await(await rr._configureSync(p?.callbacks,void 0,p?.tags,void 0,p?.metadata,void 0,C))?.handleChainStart(this.toJSON(),Gu(e,"input"),a,void 0,void 0,void 0,p?.runName??this.getName()),k=br(this.channels),b,I,F=(async()=>{try{b=await ph.initialize({input:o,config:p,checkpointer:d,nodes:this.nodes,channelSpecs:k,outputKeys:h,streamKeys:this.streamChannelsAsIs,store:_,cache:y,stream:w,interruptAfter:m,interruptBefore:f,manager:T,debug:this.debug,triggerToNodes:this.triggerToNodes,durability:S});let j=new bh({loop:b,nodeFinished:p.configurable?.[wc]});t?.subgraphs&&(b.config.configurable={...b.config.configurable,[$r]:b.stream}),await this._runLoop({loop:b,runner:j,debug:l,config:p}),S==="sync"&&await Promise.all(b?.checkpointerPromises??[])}catch(j){I=j}finally{try{b&&(await b.store?.stop(),await b.cache?.stop()),await Promise.all(b?.checkpointerPromises??[])}catch(j){I=I??j}I?(await new Promise(j=>{queueMicrotask(j)}),w.error(I)):w.close()}})();try{for await(let j of w){if(j===void 0)throw new Error("Data structure error.");let[V,B,be]=j,rt="version"in(t??{});if(u.includes(B)||B==="checkpoints"&&kr(be)&&(s||rt&&n&&u.includes("values"))){if(r==="text/event-stream"){n?yield[V,B,be]:yield[null,B,be];continue}n&&!g?yield[V,B,be]:g?n?yield[V,be]:yield be:yield[B,be]}}}catch(j){throw await T?.handleChainError(I),j}finally{await F}await T?.handleChainEnd(b?.output??{},a,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},s=[],i=await this.stream(e,n),o=[],a;for await(let c of i)r==="values"?Ht(c)?o.push(c[L]):a=c:s.push(c);if(r==="values"){if(o.length>0){let c=o.flat(1);if(a==null)return{[L]:c};if(typeof a=="object")return{...a,[L]:c}}return a}return s}async _runLoop(e){let{loop:t,runner:r,debug:n,config:s}=e,i;try{for(;await t.tick({inputKeys:this.inputChannels});){for(let{task:o}of await t._matchCachedWrites())t._outputWrites(o.id,o.writes,!0);n&&rh(t.checkpointMetadata.step,t.channels,this.streamChannelsList),n&&wn(t.step,Object.values(t.tasks)),await r.tick({timeout:this.stepTimeout,retryPolicy:this.retryPolicy,onStepWrite:(o,a)=>{n&&nh(o,a,this.streamChannelsList)},maxConcurrency:s.maxConcurrency,signal:s.signal})}if(t.status==="draining")throw t.control==null?new Error("Draining status requires run control"):new Pn(t.control.drainReason??"shutdown");if(t.status==="out_of_steps")throw new ii([`Recursion limit of ${s.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(i=o,!await t.finishAndHandleError(i))throw o}finally{i===void 0&&await t.finishAndHandleError()}}async clearCache(){await this.cache?.clear([])}};function Fm(e){let t=e.metadata??{},r=e.configurable??{},n=r.assistant_id??t.assistant_id,s=r.graph_id??t.graph_id,i=r.langgraph_auth_user,o;if(i!=null&&typeof i=="object"&&"identity"in i&&(o=i),n!=null||s!=null||o!=null)return{assistantId:n!=null?String(n):"",graphId:s!=null?String(s):"",user:o}}var Lm=new Set(["key","token","secret","password","auth"]);function Um(e,t){let r=e.toLowerCase(),n=!1;for(let s of Lm)if(r.includes(s)){n=!0;break}return e.startsWith("__")||!(typeof t=="string"||typeof t=="number"||typeof t=="boolean")||n}function Hm(e){let t=e.configurable;if(!t)return;let r=e.context,n={};for(let[s,i]of Object.entries(t)){if(r!=null&&Object.prototype.hasOwnProperty.call(r,s)&&Object.is(r[s],i)){s.startsWith("__")||(n[s]=void 0);continue}Um(s,i)||(n[s]=i)}return Object.keys(n).length>0?n:void 0}var Ue=class Eh extends J{lc_graph_name="EphemeralValue";guard;value=[];constructor(t=!0){super(),this.guard=t}fromCheckpoint(t){let r=new Eh(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 R("EphemeralValue can only receive one value per step.");return this.value=[t[t.length-1]],!0}get(){if(this.value.length===0)throw new $;return this.value[0]}checkpoint(){if(this.value.length===0)throw new $;return this.value[0]}isAvailable(){return this.value.length!==0}};var qo=class{path;ends;constructor(e){G.isRunnable(e.path)?this.path=e.path:this.path=Be(e.path),this.ends=Array.isArray(e.pathMap)?e.pathMap.reduce((t,r)=>(t[r]=r,t),{}):e.pathMap}run(e,t){return q.registerWriter(new se({name:"<branch_run>",trace:!1,func:async(r,n)=>{try{return await this._route(r,n,e,t)}catch(s){throw s.name===Mn.unminifiable_name&&console.warn(`[WARN]: 'NodeInterrupt' thrown in conditional edge. This is likely a bug in your graph implementation.
134
134
  NodeInterrupt should only be thrown inside a node, not in edge conditions.`),s}}}))}async _route(e,t,r,n){let s=await this.path.invoke(n?n(t):e,t);Array.isArray(s)||(s=[s]);let i;if(this.ends?i=s.map(o=>ee(o)?o:this.ends[o]):i=s,i.some(o=>!o))throw new Error("Branch condition returned unknown or null destination");if(i.filter(ee).some(o=>o.node==="__end__"))throw new R("Cannot send a packet to the END node");return await r(i,t)??e}},zo=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,s,i]of r){for(let a of["|",":"])if(n.includes(a))throw new Error(`"${a}" 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=Be(s);this.nodes[n]={runnable:o,metadata:i?.metadata,subgraphs:dn(o)?[o]:i?.subgraphs,ends:i?.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."),G.isRunnable(n.path)||(n.path=Be(n.path));let s=n.path.getName()==="RunnableLambda"?"condition":n.path.getName();if(this.branches[n.source]&&this.branches[n.source][s])throw new Error(`Condition \`${s}\` already present for node \`${e}\``);return this.branches[n.source]??={},this.branches[n.source][s]=new qo(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(W,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,K)}compile({checkpointer:e,interruptBefore:t,interruptAfter:r,name:n,transformers:s}={}){this.validate([...Array.isArray(t)?t:[],...Array.isArray(r)?r:[]]);let i=new Jo({builder:this,checkpointer:e,interruptAfter:r,interruptBefore:t,autoValidate:!1,nodes:{},channels:{[W]:new Ue,[K]:new Ue},inputChannels:W,outputChannels:K,streamChannels:[],streamMode:"values",name:n,streamTransformers:s});for(let[o,a]of Object.entries(this.nodes))i.attachNode(o,a);for(let[o,a]of this.edges)i.attachEdge(o,a);for(let[o,a]of Object.entries(this.branches))for(let[c,l]of Object.entries(a))i.attachBranch(o,c,l);return i.validate()}validate(e){let t=new Set([...this.allEdges].map(([n,s])=>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,s])=>s));for(let[n,s]of Object.entries(this.branches))for(let i of Object.values(s))if(i.ends!=null)for(let o of Object.values(i.ends))r.add(o);else{r.add(K);for(let o of Object.keys(this.nodes))o!==n&&r.add(o)}for(let n of Object.values(this.nodes))for(let s of n.ends??[])r.add(s);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 ai([`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(`
135
- `),{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}},Jo=class extends Us{builder;constructor({builder:e,...t}){super(t),this.builder=e}withConfig(e){return super.withConfig(e)}attachNode(e,t){this.channels[e]=new Ue,this.nodes[e]=new Fe({channels:[],triggers:[],metadata:t.metadata,subgraphs:t.subgraphs,ends:t.ends}).pipe(t.runnable).pipe(new q([{channel:e,value:we}],[z])),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 q([{channel:K,value:we}],[z]))}else this.nodes[t].triggers.push(e),this.nodes[t].channels.push(e)}attachBranch(e,t,r){e==="__start__"&&!this.nodes.__start__&&(this.nodes[W]=kh.subscribeTo(W,{tags:[z]})),this.nodes[e].pipe(r.run(s=>new q(s.map(i=>ee(i)?i:{channel:i==="__end__"?K:`branch:${e}:${t}:${i}`,value:we}),[z])));let n=r.ends?Object.values(r.ends):Object.keys(this.nodes);for(let s of n)if(s!=="__end__"){let i=`branch:${e}:${t}:${s}`;this.channels[i]=new Ue,this.nodes[s].triggers.push(i),this.nodes[s].channels.push(i)}}async getGraphAsync(e){let t=e?.xray,r=new Zs,n={[W]:r.addNode({schema:wt.any()},W)},s={},i={};t&&(i=Object.fromEntries((await Ve(this.getSubgraphsAsync())).filter(l=>Ch(l[1]))));let o=[];function a(l,u,h,p=!1){if(u==="__end__"&&s.__end__===void 0&&(s[K]=r.addNode({schema:wt.any()},K)),n[l]!==void 0){if(s[u]===void 0)throw new Error(`End node ${u} not found!`);return o.push({src:l,dest:u,conditional:p}),r.addEdge(n[l],s[u],h!==u?h:void 0,p)}}for(let[l,u]of Object.entries(this.builder.nodes)){let h=re(l),p=u.runnable,f=u.metadata??{};if(this.interruptBefore?.includes(l)&&this.interruptAfter?.includes(l)?f.__interrupt="before,after":this.interruptBefore?.includes(l)?f.__interrupt="before":this.interruptAfter?.includes(l)&&(f.__interrupt="after"),t){let m=typeof t=="number"?t-1:t,d=i[l]!==void 0?await i[l].getGraphAsync({...e,xray:m}):p.getGraph(e);if(d.trimFirstNode(),d.trimLastNode(),Object.keys(d.nodes).length>1){let y=function(w){return w?w.lc_runnable:!1},S=function(w,C){if(w!==void 0&&!Js(w))return w;if(y(C))try{let T=C.getName();return T=T.startsWith("Runnable")?T.slice(8):T,T}catch{return C.getName()}else return C.name??"UnknownSchema"},[_,g]=r.extend(d,h);if(_===void 0)throw new Error(`Could not extend subgraph "${l}" due to missing entrypoint.`);g!==void 0&&(n[h]={name:S(g.id,g.data),...g}),s[h]={name:S(_.id,_.data),..._}}else{let _=r.addNode(p,h,f);n[h]=_,s[h]=_}}else{let m=r.addNode(p,h,f);n[h]=m,s[h]=m}}let c=[...this.builder.allEdges].sort(([l],[u])=>l<u?-1:u>l?1:0);for(let[l,u]of c)a(re(l),re(u));for(let[l,u]of Object.entries(this.builder.branches)){let h={...Object.fromEntries(Object.keys(this.builder.nodes).filter(p=>p!==l).map(p=>[re(p),re(p)])),[K]:K};for(let p of Object.values(u)){let f;p.ends!==void 0?f=p.ends:f=h;for(let[m,d]of Object.entries(f))a(re(l),re(d),m,!0)}}for(let[l,u]of Object.entries(this.builder.nodes))if(u.ends!==void 0)for(let h of u.ends)a(re(l),re(h),void 0,!0);return xh(this.builder.nodes,o,a),r}getGraph(e){let t=e?.xray,r=new Zs,n={[W]:r.addNode({schema:wt.any()},W)},s={},i={};t&&(i=Object.fromEntries(It(this.getSubgraphs()).filter(l=>Ch(l[1]))));let o=[];function a(l,u,h,p=!1){if(u==="__end__"&&s.__end__===void 0&&(s[K]=r.addNode({schema:wt.any()},K)),n[l]!==void 0){if(s[u]===void 0)throw new Error(`End node ${u} not found!`);return o.push({src:l,dest:u,conditional:p}),r.addEdge(n[l],s[u],h!==u?h:void 0,p)}}for(let[l,u]of Object.entries(this.builder.nodes)){let h=re(l),p=u.runnable,f=u.metadata??{};if(this.interruptBefore?.includes(l)&&this.interruptAfter?.includes(l)?f.__interrupt="before,after":this.interruptBefore?.includes(l)?f.__interrupt="before":this.interruptAfter?.includes(l)&&(f.__interrupt="after"),t){let m=typeof t=="number"?t-1:t,d=i[l]!==void 0?i[l].getGraph({...e,xray:m}):p.getGraph(e);if(d.trimFirstNode(),d.trimLastNode(),Object.keys(d.nodes).length>1){let y=function(w){return w?w.lc_runnable:!1},S=function(w,C){if(w!==void 0&&!Js(w))return w;if(y(C))try{let T=C.getName();return T=T.startsWith("Runnable")?T.slice(8):T,T}catch{return C.getName()}else return C.name??"UnknownSchema"},[_,g]=r.extend(d,h);if(_===void 0)throw new Error(`Could not extend subgraph "${l}" due to missing entrypoint.`);g!==void 0&&(n[h]={name:S(g.id,g.data),...g}),s[h]={name:S(_.id,_.data),..._}}else{let _=r.addNode(p,h,f);n[h]=_,s[h]=_}}else{let m=r.addNode(p,h,f);n[h]=m,s[h]=m}}let c=[...this.builder.allEdges].sort(([l],[u])=>l<u?-1:u>l?1:0);for(let[l,u]of c)a(re(l),re(u));for(let[l,u]of Object.entries(this.builder.branches)){let h={...Object.fromEntries(Object.keys(this.builder.nodes).filter(p=>p!==l).map(p=>[re(p),re(p)])),[K]:K};for(let p of Object.values(u)){let f;p.ends!==void 0?f=p.ends:f=h;for(let[m,d]of Object.entries(f))a(re(l),re(d),m,!0)}}for(let[l,u]of Object.entries(this.builder.nodes))if(u.ends!==void 0)for(let h of u.ends)a(re(l),re(h),void 0,!0);return xh(this.builder.nodes,o,a),r}};function Ch(e){return typeof e.attachNode=="function"&&typeof e.attachEdge=="function"}function re(e){return e==="subgraph"?`"${e}"`:e}function xh(e,t,r){let n=new Set(t.map(i=>i.src)),s=[...new Set(t.filter(i=>!i.conditional&&i.dest!=="__end__").map(i=>i.dest))].sort();for(let i of s){if(n.has(i))continue;let o=Object.keys(e).find(a=>re(a)===i);o!==void 0&&e[o]?.isErrorHandler||r(i,K)}}function pt(e){return typeof e=="object"&&e!==null&&"~standard"in e&&typeof e["~standard"]=="object"&&e["~standard"]!==null&&"validate"in e["~standard"]}function Yo(e){return typeof e=="object"&&e!==null&&"~standard"in e&&typeof e["~standard"]=="object"&&e["~standard"]!==null&&"jsonSchema"in e["~standard"]}function Bm(e){return pt(e)&&Yo(e)}function Pt(e){if(Yo(e))try{return e["~standard"].jsonSchema.input({target:"draft-07"})}catch{return}}function ft(e){if(e!=null&&pt(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 Gm=e=>e!=null&&e.lc_graph_name==="DeltaChannel",Hs=class Th extends J{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 Th(this.reducer,{snapshotFrequency:this.snapshotFrequency,initialValueFactory:this.initialValueFactory});return t===void 0?r.value=this.initialValueFactory():pi(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,s=0;for(let o=0;o<r.length;o+=1){let[a,c]=Pe(r[o]);a&&(n=c??this.initialValueFactory(),s=o+1)}let i=r.slice(s);this.value=i.length>0?this.reducer(n,i):n}update(t){if(t.length===0)return!1;let r,n=!1;for(let i of t)if(Ut(i)){if(n)throw new R("Can receive only one Overwrite value per step.");n=!0,[,r]=Pe(i)}if(n)return this.value=r??this.initialValueFactory(),!0;let s=this.value===void 0?this.initialValueFactory():this.value;return this.value=this.reducer(s,t),!0}get(){if(this.value===void 0)throw new $;return this.value}checkpoint(){}isAvailable(){return this.value!==void 0}equals(t){return this===t?!0:!Gm(t)||this.snapshotFrequency!==t.snapshotFrequency?!1:this.reducer===t.reducer}};var Xo=Symbol.for("langgraph.channel.missing"),Bs=class Ih extends J{lc_graph_name="UntrackedValue";guard;_value=Xo;initialValueFactory;constructor(t){super(),this.guard=t?.guard??!0,this.initialValueFactory=t?.initialValueFactory,this.initialValueFactory&&(this._value=this.initialValueFactory())}fromCheckpoint(t){return new Ih({guard:this.guard,initialValueFactory:this.initialValueFactory})}update(t){if(t.length===0)return!1;if(t.length!==1&&this.guard)throw new R("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===Xo)throw new $;return this._value}checkpoint(){}isAvailable(){return this._value!==Xo}};var Rt=(e,t)=>e.size===t.size&&[...e].every(r=>t.has(r)),Qo=class Ah extends J{lc_graph_name="NamedBarrierValue";names;seen;constructor(t){super(),this.names=t,this.seen=new Set}fromCheckpoint(t){let r=new Ah(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 R(`Value ${JSON.stringify(n)} not in names ${JSON.stringify(this.names)}`);return r}get(){if(!Rt(this.names,this.seen))throw new $}checkpoint(){return[...this.seen]}consume(){return this.seen&&this.names&&Rt(this.seen,this.names)?(this.seen=new Set,!0):!1}isAvailable(){return!!this.names&&Rt(this.names,this.seen)}},Zo=class Oh extends J{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 Oh(this.names);if(typeof t<"u"){let[n,s]=t;r.seen=new Set(n),r.finished=s}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 R(`Value ${JSON.stringify(n)} not in names ${JSON.stringify(this.names)}`);return r}get(){if(!this.finished||!Rt(this.names,this.seen))throw new $}checkpoint(){return[[...this.seen],this.finished]}consume(){return this.finished&&this.seen&&this.names&&Rt(this.seen,this.names)?(this.seen=new Set,this.finished=!1,!0):!1}finish(){return!this.finished&&this.names&&Rt(this.names,this.seen)?(this.finished=!0,!0):!1}isAvailable(){return this.finished&&!!this.names&&Rt(this.names,this.seen)}};var ea=Symbol.for("langgraph.state.reduced_value"),mt=class{[ea]=!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&&ea in e&&e[ea]===!0}};var Nh=Symbol.for("langgraph.state.untracked_value"),Xt=class{[Nh]=!0;schema;guard;constructor(e,t){this.schema=e,this.guard=t?.guard??!0}static isInstance(e){return typeof e=="object"&&e!==null&&Nh in e}};var ta=Symbol.for("langgraph.state.delta_value"),dt=class{[ta]=!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&&ta in e&&e[ta]===!0}};var ra=Symbol.for("langgraph.state.state_schema"),He=class{[ra]=!0;constructor(e){this.fields=e}getChannels(){let e={};for(let[t,r]of Object.entries(this.fields))if(dt.isInstance(r)){let n=ft(r.valueSchema);e[t]=new Hs(r.reducer,{snapshotFrequency:r.snapshotFrequency,initialValueFactory:n})}else if(mt.isInstance(r)){let n=ft(r.valueSchema);e[t]=new lt(r.reducer,n)}else if(Xt.isInstance(r)){let n=r.schema?ft(r.schema):void 0;e[t]=new Bs({guard:r.guard,initialValueFactory:n})}else if(pt(r))e[t]=new $e(ft(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 s;if(dt.isInstance(n)||mt.isInstance(n)?(s=Pt(n.valueSchema),n.jsonSchemaExtra&&(s={...s??{},...n.jsonSchemaExtra})):Xt.isInstance(n)?s=n.schema?Pt(n.schema):void 0:pt(n)&&(s=Pt(n)),s){e[r]=s;let i=!1;dt.isInstance(n)||mt.isInstance(n)?i=ft(n.valueSchema)!==void 0:Xt.isInstance(n)?i=n.schema?ft(n.schema)!==void 0:!1:i=ft(n)!==void 0,i||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;dt.isInstance(r)||mt.isInstance(r)?(n=Pt(r.inputSchema),r.jsonSchemaExtra&&(n={...n??{},...r.jsonSchemaExtra})):Xt.isInstance(r)?n=r.schema?Pt(r.schema):void 0:pt(r)&&(n=Pt(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 s=this.fields[r];if(s===void 0){t[r]=n;continue}let i;if(dt.isInstance(s)||mt.isInstance(s)){let[o,a]=Pe(n);if(o){i=s.valueSchema;let c=await i["~standard"].validate(a);if(c.issues)throw new Error(`Validation failed for field "${r}": ${JSON.stringify(c.issues)}`);t[r]={[Ge]:c.value};continue}i=s.inputSchema}else Xt.isInstance(s)?i=s.schema:pt(s)&&(i=s);if(i){let o=await i["~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&&ra in e&&e[ra]===!0}};var Wm="__remove_all__";function Mt(e,t){let r=Array.isArray(e)?e:[e],n=Array.isArray(t)?t:[t],s=r.map(Ne),i=n.map(Ne);for(let u of s)(u.id===null||u.id===void 0)&&(u.id=Nr(),u.lc_kwargs.id=u.id);let o;for(let u=0;u<i.length;u+=1){let h=i[u];(h.id===null||h.id===void 0)&&(h.id=Nr(),h.lc_kwargs.id=h.id),er.isInstance(h)&&h.id==="__remove_all__"&&(o=u)}if(o!=null)return i.slice(o+1);let a=[...s],c=new Map(a.map((u,h)=>[u.id,h])),l=new Set;for(let u of i){let h=c.get(u.id);if(h!==void 0)er.isInstance(u)?l.add(u.id):(l.delete(u.id),a[h]=u);else{if(er.isInstance(u))throw new Error(`Attempting to delete a message with an ID that doesn't exist ('${u.id}')`);c.set(u.id,a.length),a.push(u)}}return a.filter(u=>!l.has(u.id))}function na(e,t){let r=[];for(let a of t)Array.isArray(a)?r.push(...a):r.push(a);let n=e.length>0&&X.isInstance(e[0])?e:e.map(Ne),s=r.map(Ne),i=new Map;for(let a=0;a<n.length;a+=1){let c=n[a].id;c!=null&&i.set(c,a)}let o=[...n];for(let a of s){let c=a.id;er.isInstance(a)&&c==="__remove_all__"?(o.length=0,i.clear()):c==null?o.push(a):er.isInstance(a)?i.has(c)&&(o[i.get(c)]=null,i.delete(c)):i.has(c)?o[i.get(c)]=a:(i.set(c,o.length),o.push(a))}return o.filter(a=>a!==null)}var Ph=wt.custom().default(()=>[]),Rh=wt.custom(),Km=new mt(Ph,{inputSchema:Rh,reducer:Mt,jsonSchemaExtra:{langgraph_type:"messages",description:"A list of chat messages"}}),qm=new dt(Ph,{inputSchema:Rh,reducer:na,jsonSchemaExtra:{langgraph_type:"messages",description:"A list of chat messages"}});var zm=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=Rr(e);for(let[n,s]of Object.entries(r)){let i=this.get(s);i?.reducer?t[n]=new lt(i.reducer.fn,i.default):t[n]=new $e(i?.default)}return t}getExtendedChannelSchemas(e,t){if(Object.keys(t).length===0)return e;let r=Object.entries(t).filter(([,i])=>i===!0).sort(([i],[o])=>i.localeCompare(o)).map(([i,o])=>`${i}:${o}`).join("|"),n=this._extensionCache.get(r)??new Map;if(n.has(e))return n.get(e);let s=e;if(t.withReducerSchema||t.withJsonSchemaExtrasAsDescription){let i=Object.entries(Rr(e)).map(([o,a])=>{let c=this.get(a),l=t.withReducerSchema?c?.reducer?.schema??a:a;if(t.withJsonSchemaExtrasAsDescription&&c?.jsonSchemaExtra){let u=Xs(l)??Xs(a),h=JSON.stringify({...c.jsonSchemaExtra,description:u});l=l.describe(`lg:${h}`)}return[o,l]});s=Na(e,Object.fromEntries(i)),Oa(s)&&(s._def.unknownKeys="strip")}return t.asPartial&&(s=sr(s)),n.set(e,s),this._extensionCache.set(r,n),s}},bn=new zm;function Mh(e,t){if(t.reducer&&!t.default){let r=Pa(e);r!=null&&(t.default=r)}if(t.reducer){let r=Object.assign(e,{lg_reducer_schema:t.reducer?.schema??e});return bn.extend(r,()=>t),r}else return bn.extend(e,()=>t),e}function Qt(e){return e==null?!1:!!(He.isInstance(e)||ge(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"||po(t)))}function jh(e){if(typeof e!="object"||e==null)return!1;let t=e,r="state"in t&&Qt(t.state),n="stateSchema"in t&&Qt(t.stateSchema),s="input"in t&&Qt(t.input);return!(!r&&!n&&!s||"input"in t&&t.input!=null&&!Qt(t.input)||"output"in t&&t.output!=null&&!Qt(t.output))}var gt="__root__",Or="__default_error_handler__",Gs=Symbol.for("langgraph.state.partial"),sa=class extends zo{channels={};waitingEdges=new Set;_schemaDefinition;_schemaRuntimeDefinition;_inputDefinition;_inputRuntimeDefinition;_outputDefinition;_outputRuntimeDefinition;_schemaDefinitions=new Map;_metaRegistry=bn;_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 Lr;let s=this._getChannelsFromSchema(n);this._schemaDefinition=s,He.isInstance(n)?this._schemaRuntimeDefinition=n:ge(n)&&(this._schemaRuntimeDefinition=n),r.input?He.isInstance(r.input)?this._inputRuntimeDefinition=r.input:ge(r.input)?this._inputRuntimeDefinition=r.input:this._inputRuntimeDefinition=Gs:this._inputRuntimeDefinition=Gs,r.output?He.isInstance(r.output)?this._outputRuntimeDefinition=r.output:ge(r.output)?this._outputRuntimeDefinition=r.output:this._outputRuntimeDefinition=this._schemaRuntimeDefinition:this._outputRuntimeDefinition=this._schemaRuntimeDefinition;let i=r.input?this._getChannelsFromSchema(r.input):s,o=r.output?this._getChannelsFromSchema(r.output):s;this._inputDefinition=i,this._outputDefinition=o,this._addSchema(this._schemaDefinition),this._addSchema(this._inputDefinition),this._addSchema(this._outputDefinition),r.context&&ge(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=bt(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 se({func:(t,r)=>{let n=r?.configurable?.[Vr];return e(t,n,r)},name:Or,trace:!1}),metadata:void 0,input:this._schemaDefinition,retryPolicy:void 0,cachePolicy:void 0,isErrorHandler:!0}}_normalizeToStateGraphInit(e,t){if(jh(e)){if(ge(t)||ds.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(Qt(e)){if(ge(t)||ds.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(Ym(e))return{state:Jm(e.channels)};throw new Lr}_getChannelsFromSchema(e){if(He.isInstance(e))return e.getChannels();if(ge(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 Lr("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,s])=>[n,s]):[[e[0],e[1],e[2]]];if(r.length===0)throw new Error("No nodes provided in `addNode`");for(let[n,s,i]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 p of["|",":"])if(n.includes(p))throw new Error(`"${p}" 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;i?.input!==void 0&&(o=this._getChannelsFromSchema(i.input)),this._addSchema(o);let a;G.isRunnable(s)?a=s:typeof s=="function"?a=new se({func:s,name:n,trace:!1}):a=Be(s);let c=i?.cachePolicy,l;c!==void 0&&(l=typeof c=="boolean"?c?{}:!1:c);let u;if(i?.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 p=i.errorHandler,f={runnable:new se({func:(m,d)=>{let _=d?.configurable?.[Vr];return p(m,_,d)},name:u,trace:!1}),metadata:void 0,input:o??this._schemaDefinition,retryPolicy:void 0,cachePolicy:void 0,isErrorHandler:!0};this.nodes[u]=f}let h={runnable:a,retryPolicy:i?.retryPolicy,cachePolicy:l,timeout:bt(i?.timeout),metadata:i?.metadata,input:o??this._schemaDefinition,subgraphs:dn(a)?[a]:i?.subgraphs,ends:i?.ends,defer:i?.defer,errorHandlerNode:u};this.nodes[n]=h}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,s,i]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,s,i),r!=null&&this.addEdge(r,o),r=o}return this}compile({checkpointer:e,store:t,cache:r,interruptBefore:n,interruptAfter:s,name:i,description:o,transformers:a}={}){let c=this._createDefaultErrorHandlerSpec();if(c!==void 0){if(Or in this.nodes)throw new Error(`Cannot apply a default error handler: the reserved node name \`${Or}\` is already in use. setNodeDefaults({ errorHandler }) registers a node with that name; rename the conflicting node.`);this.nodes[Or]=c}try{return this._compileResolved({checkpointer:e,store:t,cache:r,interruptBefore:n,interruptAfter:s,name:i,description:o,transformers:a,defaultErrorHandlerNode:c!==void 0?Or:void 0})}finally{c!==void 0&&delete this.nodes[Or]}}_compileResolved({checkpointer:e,store:t,cache:r,interruptBefore:n,interruptAfter:s,name:i,description:o,transformers:a,defaultErrorHandlerNode:c}){this.validate([...Array.isArray(n)?n:[],...Array.isArray(s)?s:[]]);let l=Object.keys(this._schemaDefinitions.get(this._outputDefinition)),u=l.length===1&&l[0]===gt?gt:l,h=Object.keys(this.channels),p=h.length===1&&h[0]===gt?gt:h,f=this._interrupt,m=new $h({builder:this,checkpointer:e,interruptAfter:s,interruptBefore:n,autoValidate:!1,nodes:{},channels:{...this.channels,[W]:new Ue},inputChannels:W,outputChannels:u,streamChannels:p,streamMode:"updates",store:t,cache:r,name:i,description:o,userInterrupt:f,streamTransformers:a});m.attachNode(W);let d=this._nodeDefaults,_=d.retryPolicy!==void 0||d.cachePolicy!==void 0||d.timeout!==void 0||c!==void 0;for(let[g,y]of Object.entries(this.nodes)){let S=y.isErrorHandler===!0,w=_?{...y,retryPolicy:y.retryPolicy??d.retryPolicy,cachePolicy:S||y.cachePolicy===!1?void 0:y.cachePolicy??d.cachePolicy,timeout:y.timeout??d.timeout,errorHandlerNode:!S&&c!==void 0&&y.errorHandlerNode===void 0?c:y.errorHandlerNode}:y;m.attachNode(g,w)}m.attachBranch(W,si,Dh(),{withReader:!1});for(let[g]of Object.entries(this.nodes))m.attachBranch(g,si,Dh(),{withReader:!1});for(let[g,y]of this.edges)m.attachEdge(g,y);for(let[g,y]of this.waitingEdges)m.attachEdge(g,y);for(let[g,y]of Object.entries(this.branches))for(let[S,w]of Object.entries(y))m.attachBranch(g,S,w);return m.validate()}};function Jm(e){let t={};for(let[r,n]of Object.entries(e))r===gt?t[r]=gs(n):t[r]=gs(n);return t}var $h=class extends Jo{description;_metaRegistry=bn;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(ne(c))return c.graph===_e.PARENT?null:c._updateAsTuples();if(Array.isArray(c)&&c.length>0&&c.some(l=>ne(l))){let l=[];for(let u of c)if(ne(u)){if(u.graph===_e.PARENT)continue;l.push(...u._updateAsTuples())}else l.push([gt,u]);return l}else if(c!=null)return[[gt,c]];return null}let s=e,i=async c=>{if(c==null||c.length===0)return c;let l=this.builder._schemaRuntimeDefinition;if(He.isInstance(l)){let u=new Set(l.getChannelKeys());return Promise.all(c.map(async([h,p])=>{if(!u.has(h))return[h,p];let f=await l.validateInput({[h]:p});return[h,Object.prototype.hasOwnProperty.call(f,h)?f[h]:p]}))}if(ge(l)){let u=new Set(Object.keys(Rr(l)));if(c.filter(([f])=>u.has(f)).length===0)return c;let h=sr(this._metaRegistry.getExtendedChannelSchemas(l,{withReducerSchema:!0})),p=sr(l);return c.map(([f,m])=>{if(!u.has(f))return[f,m];let[d,_]=Pe(m);if(d){let y=nr(p,{[f]:_});return[f,Object.prototype.hasOwnProperty.call(y,f)?{[Ge]:y[f]}:m]}let g=nr(h,{[f]:m});return[f,Object.prototype.hasOwnProperty.call(g,f)?g[f]:m]})}return c};async function o(c){if(c){if(ne(c))return c.graph===_e.PARENT?null:i(c._updateAsTuples().filter(([l])=>r.includes(l)));if(Array.isArray(c)&&c.length>0&&c.some(ne)){let l=[];for(let u of c)if(ne(u)){if(u.graph===_e.PARENT)continue;l.push(...u._updateAsTuples().filter(([h])=>r.includes(h)))}else{let h=await o(u);h&&l.push(...h??[])}return i(l)}else{if(typeof c=="object"&&!Array.isArray(c))return i(Object.entries(c).filter(([l])=>r.includes(l)));{let l=Array.isArray(c)?"array":typeof c;throw new R(`Expected node "${s.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 a=[{value:we,mapper:new se({func:r.length&&r[0]===gt?n:o,trace:!1,recurse:!1})}];if(e==="__start__")this.nodes[e]=new Fe({tags:[z],triggers:[W],channels:[W],writers:[new q(a,[z])]});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&&gt in l,h=`branch:to:${e}`;this.channels[h]=t?.defer?new mo:new Ue(!1);let p=t?.cachePolicy,f=p===!1?void 0:p;this.nodes[e]=new Fe({triggers:[h],channels:u?Object.keys(l):l,writers:[new q(a,[z])],mapper:u?void 0:m=>Object.fromEntries(Object.entries(m).filter(([d])=>d in l)),bound:t?.runnable,metadata:t?.metadata,retryPolicy:t?.retryPolicy,cachePolicy:f,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 q([{channel:`branch:to:${t}`,value:null}],[z]));else if(Array.isArray(e)){let r=`join:${e.join("+")}:${t}`;this.channels[r]=this.builder.nodes[t].defer?new Zo(new Set(e)):new Qo(new Set(e)),this.nodes[t].triggers.push(r);for(let n of e)this.nodes[n].writers.push(new q([{channel:r,value:n}],[z]))}}}attachBranch(e,t,r,n={withReader:!0}){let s=async(i,o)=>{let a=i.filter(l=>l!==K);if(!a.length)return;let c=a.map(l=>ee(l)?l:{channel:l==="__end__"?l:`branch:to:${l}`,value:e});await q.doWrite({...o,tags:(o.tags??[]).concat([z])},c)};this.nodes[e].writers.push(r.run(s,n.withReader?i=>Lu.doRead(i,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(He.isInstance(t)){if(ne(e)){let s=e;return e.update&&(s.update=await t.validateInput(Array.isArray(e.update)?Object.fromEntries(e.update):e.update)),s}return await t.validateInput(e)}if(t===Gs&&He.isInstance(r)){if(ne(e)){let s=e;return e.update&&(s.update=await r.validateInput(Array.isArray(e.update)?Object.fromEntries(e.update):e.update)),s}return await r.validateInput(e)}let n=(()=>{let s=i=>{if(i!=null)return this._metaRegistry.getExtendedChannelSchemas(i,{withReducerSchema:!0})};if(ge(t))return s(t);if(t===Gs)return ge(r)?sr(s(r)):void 0})();if(ne(e)){let s=e;if(e.update&&n!=null){let i=Array.isArray(e.update)?Object.fromEntries(e.update):e.update,o=nr(n,i);s.update=Object.fromEntries(Object.keys(i).map(a=>[a,o[a]]))}return s}return n!=null?nr(n,e):e}isInterrupted(e){return Ht(e)}async _validateContext(e){let t=this.builder._configRuntimeSchema;return ge(t)&&nr(t,e),e}};function Ym(e){return typeof e=="object"&&e!==null&&e.channels!==void 0}function Xm(e){if(ee(e))return[e];let t=[];ne(e)?t.push(e):Array.isArray(e)&&t.push(...e.filter(ne));let r=[];for(let n of t){if(n.graph===_e.PARENT)throw new Dn(n);ee(n.goto)||typeof n.goto=="string"?r.push(n.goto):Array.isArray(n.goto)&&r.push(...n.goto)}return r}function Dh(){return new qo({path:new se({func:Xm,tags:[z],trace:!1,recurse:!1,name:"<control_branch>"})})}var Qm=class extends sa{constructor(){super({channels:{__root__:{reducer:Mt,default:()=>[]}}})}};function Zm(e,t){let{stateKey:r,...n}=t??{},s=Sr(n),i=r??"messages";r===null&&(i=void 0);let o=Ne(e);if(!o.id)throw new Error("Message ID is required.");let a=Array.isArray(s.callbacks)?s.callbacks:typeof s.callbacks<"u"?s.callbacks.handlers:[],c=a.find(u=>"name"in u&&u.name==="StreamMessagesHandler"),l=a.find(u=>"name"in u&&u.name==="StreamProtocolMessagesHandler");if(c||l){let u=s.metadata??{},h=(u.langgraph_checkpoint_ns??"").split("|");c?c._emit([h,u],o,void 0,!1):l&&l.emitFinalMessage([h,u],o,void 0,!1)}return i&&s.configurable?.__pregel_send?.([[i,o]]),o}function ed(e,t){let r=typeof e=="string"?{name:e,retry:void 0,cachePolicy:void 0,timeout:void 0}:e,{name:n,retry:s}=r,i=bt(r.timeout);if(Ro(t)||Mo(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),a;return typeof o=="boolean"?a=o?{}:void 0:a=o,(...c)=>Ju({func:t,name:n,retry:s,cache:a,timeout:i},...c)}var Vh=function(t,r){let{name:n,checkpointer:s,store:i,cache:o}=typeof t=="string"?{name:t,checkpointer:void 0,store:void 0}:t,a=bt(typeof t=="string"?void 0:t.timeout);if(Ro(r)||Mo(r))throw new Error("Generators are disallowed as entrypoints. For streaming responses, use config.write.");let c="updates",l=zu(n,r);function u(m){return typeof m=="object"&&m!==null&&"__lg_type"in m&&m.__lg_type==="__pregel_final"}let h=new se({name:"pluckReturnValue",func:m=>u(m)?m.value:m}),p=new se({name:"pluckSaveValue",func:m=>u(m)?m.save:m}),f=new Fe({bound:l,triggers:[W],channels:[W],timeout:a,writers:[new q([{channel:K,value:we,mapper:h},{channel:Ct,value:we,mapper:p}],[z])]});return new Us({name:n,checkpointer:s,nodes:{[n]:f},channels:{[W]:new Ue,[K]:new $e,[Ct]:new $e},inputChannels:W,outputChannels:K,streamChannels:K,streamMode:c,store:i,cache:o})};Vh.final=function({value:t,save:r}){return{value:t,save:r,__lg_type:"__pregel_final"}};function td(){return Z.getRunnableConfig().configurable?.[St]}var rd=hn.Root({messages:hn({reducer:Mt,default:()=>[]})}),Fh={reducer:{fn:Mt},jsonSchemaExtra:{langgraph_type:"messages"},default:()=>[]},nd=Qs.object({messages:Mh(Qs.custom(),Fh)});function sd(e){let t=Z.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{W as a,K as b,L as c,ni as d,Sc as e,Vt as f,Hh as g,Ht as h,_e as i,ne as j,Ce as k,Nn as l,ii as m,Bt as n,Pn as o,Rn as p,it as q,Mn as r,jn as s,Gh as t,Dn as u,oi as v,xt as w,ot as x,$n as y,Wh as z,Vn as A,$ as B,R as C,Kh as D,ai as E,qh as F,Lr as G,zh as H,Fi as I,mr as J,qt as K,je as L,cs as M,du as N,wr as O,hs as P,yu as Q,J as R,lt as S,hn as T,Pf as U,Rf as V,_s as W,Mf as X,go as Y,_o as Z,kr as _,yo as $,Ie as aa,bs as ba,So as ca,pn as da,fn as ea,ko as fa,Eo as ga,vs as ha,To as ia,Ou as ja,Io as ka,Po as la,zo as ma,pt as na,Bm as oa,Pt as pa,ft as qa,Hs as ra,Bs as sa,mt as ta,Xt as ua,dt as va,He as wa,Wm as xa,Mt as ya,na as za,Km as Aa,qm as Ba,bn as Ca,Mh as Da,sa as Ea,$h as Fa,Qm as Ga,Zm as Ha,ed as Ia,Vh as Ja,td as Ka,rd as La,Fh as Ma,nd as Na,sd as Oa};
135
+ `),{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}},Jo=class extends Us{builder;constructor({builder:e,...t}){super(t),this.builder=e}withConfig(e){return super.withConfig(e)}attachNode(e,t){this.channels[e]=new Ue,this.nodes[e]=new Fe({channels:[],triggers:[],metadata:t.metadata,subgraphs:t.subgraphs,ends:t.ends}).pipe(t.runnable).pipe(new q([{channel:e,value:we}],[z])),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 q([{channel:K,value:we}],[z]))}else this.nodes[t].triggers.push(e),this.nodes[t].channels.push(e)}attachBranch(e,t,r){e==="__start__"&&!this.nodes.__start__&&(this.nodes[W]=kh.subscribeTo(W,{tags:[z]})),this.nodes[e].pipe(r.run(s=>new q(s.map(i=>ee(i)?i:{channel:i==="__end__"?K:`branch:${e}:${t}:${i}`,value:we}),[z])));let n=r.ends?Object.values(r.ends):Object.keys(this.nodes);for(let s of n)if(s!=="__end__"){let i=`branch:${e}:${t}:${s}`;this.channels[i]=new Ue,this.nodes[s].triggers.push(i),this.nodes[s].channels.push(i)}}async getGraphAsync(e){let t=e?.xray,r=new Zs,n={[W]:r.addNode({schema:wt.any()},W)},s={},i={};t&&(i=Object.fromEntries((await Ve(this.getSubgraphsAsync())).filter(l=>Ch(l[1]))));let o=[];function a(l,u,h,p=!1){if(u==="__end__"&&s.__end__===void 0&&(s[K]=r.addNode({schema:wt.any()},K)),n[l]!==void 0){if(s[u]===void 0)throw new Error(`End node ${u} not found!`);return o.push({src:l,dest:u,conditional:p}),r.addEdge(n[l],s[u],h!==u?h:void 0,p)}}for(let[l,u]of Object.entries(this.builder.nodes)){let h=re(l),p=u.runnable,f=u.metadata??{};if(this.interruptBefore?.includes(l)&&this.interruptAfter?.includes(l)?f.__interrupt="before,after":this.interruptBefore?.includes(l)?f.__interrupt="before":this.interruptAfter?.includes(l)&&(f.__interrupt="after"),t){let m=typeof t=="number"?t-1:t,d=i[l]!==void 0?await i[l].getGraphAsync({...e,xray:m}):p.getGraph(e);if(d.trimFirstNode(),d.trimLastNode(),Object.keys(d.nodes).length>1){let y=function(w){return w?w.lc_runnable:!1},S=function(w,C){if(w!==void 0&&!Js(w))return w;if(y(C))try{let T=C.getName();return T=T.startsWith("Runnable")?T.slice(8):T,T}catch{return C.getName()}else return C.name??"UnknownSchema"},[_,g]=r.extend(d,h);if(_===void 0)throw new Error(`Could not extend subgraph "${l}" due to missing entrypoint.`);g!==void 0&&(n[h]={name:S(g.id,g.data),...g}),s[h]={name:S(_.id,_.data),..._}}else{let _=r.addNode(p,h,f);n[h]=_,s[h]=_}}else{let m=r.addNode(p,h,f);n[h]=m,s[h]=m}}let c=[...this.builder.allEdges].sort(([l],[u])=>l<u?-1:u>l?1:0);for(let[l,u]of c)a(re(l),re(u));for(let[l,u]of Object.entries(this.builder.branches)){let h={...Object.fromEntries(Object.keys(this.builder.nodes).filter(p=>p!==l).map(p=>[re(p),re(p)])),[K]:K};for(let p of Object.values(u)){let f;p.ends!==void 0?f=p.ends:f=h;for(let[m,d]of Object.entries(f))a(re(l),re(d),m,!0)}}for(let[l,u]of Object.entries(this.builder.nodes))if(u.ends!==void 0)for(let h of u.ends)a(re(l),re(h),void 0,!0);return xh(this.builder.nodes,o,a),r}getGraph(e){let t=e?.xray,r=new Zs,n={[W]:r.addNode({schema:wt.any()},W)},s={},i={};t&&(i=Object.fromEntries(It(this.getSubgraphs()).filter(l=>Ch(l[1]))));let o=[];function a(l,u,h,p=!1){if(u==="__end__"&&s.__end__===void 0&&(s[K]=r.addNode({schema:wt.any()},K)),n[l]!==void 0){if(s[u]===void 0)throw new Error(`End node ${u} not found!`);return o.push({src:l,dest:u,conditional:p}),r.addEdge(n[l],s[u],h!==u?h:void 0,p)}}for(let[l,u]of Object.entries(this.builder.nodes)){let h=re(l),p=u.runnable,f=u.metadata??{};if(this.interruptBefore?.includes(l)&&this.interruptAfter?.includes(l)?f.__interrupt="before,after":this.interruptBefore?.includes(l)?f.__interrupt="before":this.interruptAfter?.includes(l)&&(f.__interrupt="after"),t){let m=typeof t=="number"?t-1:t,d=i[l]!==void 0?i[l].getGraph({...e,xray:m}):p.getGraph(e);if(d.trimFirstNode(),d.trimLastNode(),Object.keys(d.nodes).length>1){let y=function(w){return w?w.lc_runnable:!1},S=function(w,C){if(w!==void 0&&!Js(w))return w;if(y(C))try{let T=C.getName();return T=T.startsWith("Runnable")?T.slice(8):T,T}catch{return C.getName()}else return C.name??"UnknownSchema"},[_,g]=r.extend(d,h);if(_===void 0)throw new Error(`Could not extend subgraph "${l}" due to missing entrypoint.`);g!==void 0&&(n[h]={name:S(g.id,g.data),...g}),s[h]={name:S(_.id,_.data),..._}}else{let _=r.addNode(p,h,f);n[h]=_,s[h]=_}}else{let m=r.addNode(p,h,f);n[h]=m,s[h]=m}}let c=[...this.builder.allEdges].sort(([l],[u])=>l<u?-1:u>l?1:0);for(let[l,u]of c)a(re(l),re(u));for(let[l,u]of Object.entries(this.builder.branches)){let h={...Object.fromEntries(Object.keys(this.builder.nodes).filter(p=>p!==l).map(p=>[re(p),re(p)])),[K]:K};for(let p of Object.values(u)){let f;p.ends!==void 0?f=p.ends:f=h;for(let[m,d]of Object.entries(f))a(re(l),re(d),m,!0)}}for(let[l,u]of Object.entries(this.builder.nodes))if(u.ends!==void 0)for(let h of u.ends)a(re(l),re(h),void 0,!0);return xh(this.builder.nodes,o,a),r}};function Ch(e){return typeof e.attachNode=="function"&&typeof e.attachEdge=="function"}function re(e){return e==="subgraph"?`"${e}"`:e}function xh(e,t,r){let n=new Set(t.map(i=>i.src)),s=[...new Set(t.filter(i=>!i.conditional&&i.dest!=="__end__").map(i=>i.dest))].sort();for(let i of s){if(n.has(i))continue;let o=Object.keys(e).find(a=>re(a)===i);o!==void 0&&e[o]?.isErrorHandler||r(i,K)}}function pt(e){return typeof e=="object"&&e!==null&&"~standard"in e&&typeof e["~standard"]=="object"&&e["~standard"]!==null&&"validate"in e["~standard"]}function Yo(e){return typeof e=="object"&&e!==null&&"~standard"in e&&typeof e["~standard"]=="object"&&e["~standard"]!==null&&"jsonSchema"in e["~standard"]}function Bm(e){return pt(e)&&Yo(e)}function Pt(e){if(Yo(e))try{return e["~standard"].jsonSchema.input({target:"draft-07"})}catch{return}}function ft(e){if(e!=null&&pt(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 Gm=e=>e!=null&&e.lc_graph_name==="DeltaChannel",Hs=class Th extends J{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 Th(this.reducer,{snapshotFrequency:this.snapshotFrequency,initialValueFactory:this.initialValueFactory});return t===void 0?r.value=this.initialValueFactory():pi(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,s=0;for(let o=0;o<r.length;o+=1){let[a,c]=Pe(r[o]);a&&(n=c??this.initialValueFactory(),s=o+1)}let i=r.slice(s);this.value=i.length>0?this.reducer(n,i):n}update(t){if(t.length===0)return!1;let r,n=!1;for(let i of t)if(Ut(i)){if(n)throw new R("Can receive only one Overwrite value per step.");n=!0,[,r]=Pe(i)}if(n)return this.value=r??this.initialValueFactory(),!0;let s=this.value===void 0?this.initialValueFactory():this.value;return this.value=this.reducer(s,t),!0}get(){if(this.value===void 0)throw new $;return this.value}checkpoint(){}isAvailable(){return this.value!==void 0}equals(t){return this===t?!0:!Gm(t)||this.snapshotFrequency!==t.snapshotFrequency?!1:this.reducer===t.reducer}};var Xo=Symbol.for("langgraph.channel.missing"),Bs=class Ih extends J{lc_graph_name="UntrackedValue";guard;_value=Xo;initialValueFactory;constructor(t){super(),this.guard=t?.guard??!0,this.initialValueFactory=t?.initialValueFactory,this.initialValueFactory&&(this._value=this.initialValueFactory())}fromCheckpoint(t){return new Ih({guard:this.guard,initialValueFactory:this.initialValueFactory})}update(t){if(t.length===0)return!1;if(t.length!==1&&this.guard)throw new R("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===Xo)throw new $;return this._value}checkpoint(){}isAvailable(){return this._value!==Xo}};var Rt=(e,t)=>e.size===t.size&&[...e].every(r=>t.has(r)),Qo=class Ah extends J{lc_graph_name="NamedBarrierValue";names;seen;constructor(t){super(),this.names=t,this.seen=new Set}fromCheckpoint(t){let r=new Ah(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 R(`Value ${JSON.stringify(n)} not in names ${JSON.stringify(this.names)}`);return r}get(){if(!Rt(this.names,this.seen))throw new $}checkpoint(){return[...this.seen]}consume(){return this.seen&&this.names&&Rt(this.seen,this.names)?(this.seen=new Set,!0):!1}isAvailable(){return!!this.names&&Rt(this.names,this.seen)}},Zo=class Oh extends J{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 Oh(this.names);if(typeof t<"u"){let[n,s]=t;r.seen=new Set(n),r.finished=s}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 R(`Value ${JSON.stringify(n)} not in names ${JSON.stringify(this.names)}`);return r}get(){if(!this.finished||!Rt(this.names,this.seen))throw new $}checkpoint(){return[[...this.seen],this.finished]}consume(){return this.finished&&this.seen&&this.names&&Rt(this.seen,this.names)?(this.seen=new Set,this.finished=!1,!0):!1}finish(){return!this.finished&&this.names&&Rt(this.names,this.seen)?(this.finished=!0,!0):!1}isAvailable(){return this.finished&&!!this.names&&Rt(this.names,this.seen)}};var ea=Symbol.for("langgraph.state.reduced_value"),mt=class{[ea]=!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&&ea in e&&e[ea]===!0}};var Nh=Symbol.for("langgraph.state.untracked_value"),Xt=class{[Nh]=!0;schema;guard;constructor(e,t){this.schema=e,this.guard=t?.guard??!0}static isInstance(e){return typeof e=="object"&&e!==null&&Nh in e}};var ta=Symbol.for("langgraph.state.delta_value"),dt=class{[ta]=!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&&ta in e&&e[ta]===!0}};var ra=Symbol.for("langgraph.state.state_schema"),He=class{[ra]=!0;constructor(e){this.fields=e}getChannels(){let e={};for(let[t,r]of Object.entries(this.fields))if(dt.isInstance(r)){let n=ft(r.valueSchema);e[t]=new Hs(r.reducer,{snapshotFrequency:r.snapshotFrequency,initialValueFactory:n})}else if(mt.isInstance(r)){let n=ft(r.valueSchema);e[t]=new lt(r.reducer,n)}else if(Xt.isInstance(r)){let n=r.schema?ft(r.schema):void 0;e[t]=new Bs({guard:r.guard,initialValueFactory:n})}else if(pt(r))e[t]=new $e(ft(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 s;if(dt.isInstance(n)||mt.isInstance(n)?(s=Pt(n.valueSchema),n.jsonSchemaExtra&&(s={...s??{},...n.jsonSchemaExtra})):Xt.isInstance(n)?s=n.schema?Pt(n.schema):void 0:pt(n)&&(s=Pt(n)),s){e[r]=s;let i=!1;dt.isInstance(n)||mt.isInstance(n)?i=ft(n.valueSchema)!==void 0:Xt.isInstance(n)?i=n.schema?ft(n.schema)!==void 0:!1:i=ft(n)!==void 0,i||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;dt.isInstance(r)||mt.isInstance(r)?(n=Pt(r.inputSchema),r.jsonSchemaExtra&&(n={...n??{},...r.jsonSchemaExtra})):Xt.isInstance(r)?n=r.schema?Pt(r.schema):void 0:pt(r)&&(n=Pt(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 s=this.fields[r];if(s===void 0){t[r]=n;continue}let i;if(dt.isInstance(s)||mt.isInstance(s)){let[o,a]=Pe(n);if(o){i=s.valueSchema;let c=await i["~standard"].validate(a);if(c.issues)throw new Error(`Validation failed for field "${r}": ${JSON.stringify(c.issues)}`);t[r]={[Ge]:c.value};continue}i=s.inputSchema}else Xt.isInstance(s)?i=s.schema:pt(s)&&(i=s);if(i){let o=await i["~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&&ra in e&&e[ra]===!0}};var Wm="__remove_all__";function Mt(e,t){let r=Array.isArray(e)?e:[e],n=Array.isArray(t)?t:[t],s=r.map(Ne),i=n.map(Ne);for(let u of s)(u.id===null||u.id===void 0)&&(u.id=Nr(),u.lc_kwargs.id=u.id);let o;for(let u=0;u<i.length;u+=1){let h=i[u];(h.id===null||h.id===void 0)&&(h.id=Nr(),h.lc_kwargs.id=h.id),er.isInstance(h)&&h.id==="__remove_all__"&&(o=u)}if(o!=null)return i.slice(o+1);let a=[...s],c=new Map(a.map((u,h)=>[u.id,h])),l=new Set;for(let u of i){let h=c.get(u.id);if(h!==void 0)er.isInstance(u)?l.add(u.id):(l.delete(u.id),a[h]=u);else{if(er.isInstance(u))throw new Error(`Attempting to delete a message with an ID that doesn't exist ('${u.id}')`);c.set(u.id,a.length),a.push(u)}}return a.filter(u=>!l.has(u.id))}function na(e,t){let r=[];for(let a of t)Array.isArray(a)?r.push(...a):r.push(a);let n=e.length>0&&X.isInstance(e[0])?e:e.map(Ne),s=r.map(Ne),i=new Map;for(let a=0;a<n.length;a+=1){let c=n[a].id;c!=null&&i.set(c,a)}let o=[...n];for(let a of s){let c=a.id;er.isInstance(a)&&c==="__remove_all__"?(o.length=0,i.clear()):c==null?o.push(a):er.isInstance(a)?i.has(c)&&(o[i.get(c)]=null,i.delete(c)):i.has(c)?o[i.get(c)]=a:(i.set(c,o.length),o.push(a))}return o.filter(a=>a!==null)}var Ph=wt.custom().default(()=>[]),Rh=wt.custom(),Km=new mt(Ph,{inputSchema:Rh,reducer:Mt,jsonSchemaExtra:{langgraph_type:"messages",description:"A list of chat messages"}}),qm=new dt(Ph,{inputSchema:Rh,reducer:na,jsonSchemaExtra:{langgraph_type:"messages",description:"A list of chat messages"}});var zm=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=Rr(e);for(let[n,s]of Object.entries(r)){let i=this.get(s);i?.reducer?t[n]=new lt(i.reducer.fn,i.default):t[n]=new $e(i?.default)}return t}getExtendedChannelSchemas(e,t){if(Object.keys(t).length===0)return e;let r=Object.entries(t).filter(([,i])=>i===!0).sort(([i],[o])=>i.localeCompare(o)).map(([i,o])=>`${i}:${o}`).join("|"),n=this._extensionCache.get(r)??new Map;if(n.has(e))return n.get(e);let s=e;if(t.withReducerSchema||t.withJsonSchemaExtrasAsDescription){let i=Object.entries(Rr(e)).map(([o,a])=>{let c=this.get(a),l=t.withReducerSchema?c?.reducer?.schema??a:a;if(t.withJsonSchemaExtrasAsDescription&&c?.jsonSchemaExtra){let u=Xs(l)??Xs(a),h=JSON.stringify({...c.jsonSchemaExtra,description:u});l=l.describe(`lg:${h}`)}return[o,l]});s=Na(e,Object.fromEntries(i)),Oa(s)&&(s._def.unknownKeys="strip")}return t.asPartial&&(s=sr(s)),n.set(e,s),this._extensionCache.set(r,n),s}},bn=new zm;function Mh(e,t){if(t.reducer&&!t.default){let r=Pa(e);r!=null&&(t.default=r)}if(t.reducer){let r=Object.assign(e,{lg_reducer_schema:t.reducer?.schema??e});return bn.extend(r,()=>t),r}else return bn.extend(e,()=>t),e}function Qt(e){return e==null?!1:!!(He.isInstance(e)||ge(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"||po(t)))}function jh(e){if(typeof e!="object"||e==null)return!1;let t=e,r="state"in t&&Qt(t.state),n="stateSchema"in t&&Qt(t.stateSchema),s="input"in t&&Qt(t.input);return!(!r&&!n&&!s||"input"in t&&t.input!=null&&!Qt(t.input)||"output"in t&&t.output!=null&&!Qt(t.output))}var gt="__root__",Or="__default_error_handler__",Gs=Symbol.for("langgraph.state.partial"),sa=class extends zo{channels={};waitingEdges=new Set;_schemaDefinition;_schemaRuntimeDefinition;_inputDefinition;_inputRuntimeDefinition;_outputDefinition;_outputRuntimeDefinition;_schemaDefinitions=new Map;_metaRegistry=bn;_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 Lr;let s=this._getChannelsFromSchema(n);this._schemaDefinition=s,He.isInstance(n)?this._schemaRuntimeDefinition=n:ge(n)&&(this._schemaRuntimeDefinition=n),r.input?He.isInstance(r.input)?this._inputRuntimeDefinition=r.input:ge(r.input)?this._inputRuntimeDefinition=r.input:this._inputRuntimeDefinition=Gs:this._inputRuntimeDefinition=Gs,r.output?He.isInstance(r.output)?this._outputRuntimeDefinition=r.output:ge(r.output)?this._outputRuntimeDefinition=r.output:this._outputRuntimeDefinition=this._schemaRuntimeDefinition:this._outputRuntimeDefinition=this._schemaRuntimeDefinition;let i=r.input?this._getChannelsFromSchema(r.input):s,o=r.output?this._getChannelsFromSchema(r.output):s;this._inputDefinition=i,this._outputDefinition=o,this._addSchema(this._schemaDefinition),this._addSchema(this._inputDefinition),this._addSchema(this._outputDefinition),r.context&&ge(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=bt(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 se({func:(t,r)=>{let n=r?.configurable?.[Vr];return e(t,n,r)},name:Or,trace:!1}),metadata:void 0,input:this._schemaDefinition,retryPolicy:void 0,cachePolicy:void 0,isErrorHandler:!0}}_normalizeToStateGraphInit(e,t){if(jh(e)){if(ge(t)||ds.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(Qt(e)){if(ge(t)||ds.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(Ym(e))return{state:Jm(e.channels)};throw new Lr}_getChannelsFromSchema(e){if(He.isInstance(e))return e.getChannels();if(ge(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 Lr("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,s])=>[n,s]):[[e[0],e[1],e[2]]];if(r.length===0)throw new Error("No nodes provided in `addNode`");for(let[n,s,i]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 p of["|",":"])if(n.includes(p))throw new Error(`"${p}" 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;i?.input!==void 0&&(o=this._getChannelsFromSchema(i.input)),this._addSchema(o);let a;G.isRunnable(s)?a=s:typeof s=="function"?a=new se({func:s,name:n,trace:!1}):a=Be(s);let c=i?.cachePolicy,l;c!==void 0&&(l=typeof c=="boolean"?c?{}:!1:c);let u;if(i?.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 p=i.errorHandler,f={runnable:new se({func:(m,d)=>{let _=d?.configurable?.[Vr];return p(m,_,d)},name:u,trace:!1}),metadata:void 0,input:o??this._schemaDefinition,retryPolicy:void 0,cachePolicy:void 0,isErrorHandler:!0};this.nodes[u]=f}let h={runnable:a,retryPolicy:i?.retryPolicy,cachePolicy:l,timeout:bt(i?.timeout),metadata:i?.metadata,input:o??this._schemaDefinition,subgraphs:dn(a)?[a]:i?.subgraphs,ends:i?.ends,defer:i?.defer,errorHandlerNode:u};this.nodes[n]=h}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,s,i]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,s,i),r!=null&&this.addEdge(r,o),r=o}return this}compile({checkpointer:e,store:t,cache:r,interruptBefore:n,interruptAfter:s,name:i,description:o,transformers:a}={}){let c=this._createDefaultErrorHandlerSpec();if(c!==void 0){if(Or in this.nodes)throw new Error(`Cannot apply a default error handler: the reserved node name \`${Or}\` is already in use. setNodeDefaults({ errorHandler }) registers a node with that name; rename the conflicting node.`);this.nodes[Or]=c}try{return this._compileResolved({checkpointer:e,store:t,cache:r,interruptBefore:n,interruptAfter:s,name:i,description:o,transformers:a,defaultErrorHandlerNode:c!==void 0?Or:void 0})}finally{c!==void 0&&delete this.nodes[Or]}}_compileResolved({checkpointer:e,store:t,cache:r,interruptBefore:n,interruptAfter:s,name:i,description:o,transformers:a,defaultErrorHandlerNode:c}){this.validate([...Array.isArray(n)?n:[],...Array.isArray(s)?s:[]]);let l=Object.keys(this._schemaDefinitions.get(this._outputDefinition)),u=l.length===1&&l[0]===gt?gt:l,h=Object.keys(this.channels),p=h.length===1&&h[0]===gt?gt:h,f=this._interrupt,m=new $h({builder:this,checkpointer:e,interruptAfter:s,interruptBefore:n,autoValidate:!1,nodes:{},channels:{...this.channels,[W]:new Ue},inputChannels:W,outputChannels:u,streamChannels:p,streamMode:"updates",store:t,cache:r,name:i,description:o,userInterrupt:f,streamTransformers:a});m.attachNode(W);let d=this._nodeDefaults,_=d.retryPolicy!==void 0||d.cachePolicy!==void 0||d.timeout!==void 0||c!==void 0;for(let[g,y]of Object.entries(this.nodes)){let S=y.isErrorHandler===!0,w=_?{...y,retryPolicy:y.retryPolicy??d.retryPolicy,cachePolicy:S||y.cachePolicy===!1?void 0:y.cachePolicy??d.cachePolicy,timeout:y.timeout??d.timeout,errorHandlerNode:!S&&c!==void 0&&y.errorHandlerNode===void 0?c:y.errorHandlerNode}:y;m.attachNode(g,w)}m.attachBranch(W,si,Dh(),{withReader:!1});for(let[g]of Object.entries(this.nodes))m.attachBranch(g,si,Dh(),{withReader:!1});for(let[g,y]of this.edges)m.attachEdge(g,y);for(let[g,y]of this.waitingEdges)m.attachEdge(g,y);for(let[g,y]of Object.entries(this.branches))for(let[S,w]of Object.entries(y))m.attachBranch(g,S,w);return m.validate()}};function Jm(e){let t={};for(let[r,n]of Object.entries(e))r===gt?t[r]=gs(n):t[r]=gs(n);return t}var $h=class extends Jo{description;_metaRegistry=bn;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(ne(c))return c.graph===_e.PARENT?null:c._updateAsTuples();if(Array.isArray(c)&&c.length>0&&c.some(l=>ne(l))){let l=[];for(let u of c)if(ne(u)){if(u.graph===_e.PARENT)continue;l.push(...u._updateAsTuples())}else l.push([gt,u]);return l}else if(c!=null)return[[gt,c]];return null}let s=e,i=async c=>{if(c==null||c.length===0)return c;let l=this.builder._schemaRuntimeDefinition;if(He.isInstance(l)){let u=new Set(l.getChannelKeys());return Promise.all(c.map(async([h,p])=>{if(!u.has(h))return[h,p];let f=await l.validateInput({[h]:p});return[h,Object.prototype.hasOwnProperty.call(f,h)?f[h]:p]}))}if(ge(l)){let u=new Set(Object.keys(Rr(l)));if(c.filter(([f])=>u.has(f)).length===0)return c;let h=sr(this._metaRegistry.getExtendedChannelSchemas(l,{withReducerSchema:!0})),p=sr(l);return c.map(([f,m])=>{if(!u.has(f))return[f,m];let[d,_]=Pe(m);if(d){let y=nr(p,{[f]:_});return[f,Object.prototype.hasOwnProperty.call(y,f)?{[Ge]:y[f]}:m]}let g=nr(h,{[f]:m});return[f,Object.prototype.hasOwnProperty.call(g,f)?g[f]:m]})}return c};async function o(c){if(c){if(ne(c))return c.graph===_e.PARENT?null:i(c._updateAsTuples().filter(([l])=>r.includes(l)));if(Array.isArray(c)&&c.length>0&&c.some(ne)){let l=[];for(let u of c)if(ne(u)){if(u.graph===_e.PARENT)continue;l.push(...u._updateAsTuples().filter(([h])=>r.includes(h)))}else{let h=await o(u);h&&l.push(...h??[])}return i(l)}else{if(typeof c=="object"&&!Array.isArray(c))return i(Object.entries(c).filter(([l])=>r.includes(l)));{let l=Array.isArray(c)?"array":typeof c;throw new R(`Expected node "${s.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 a=[{value:we,mapper:new se({func:r.length&&r[0]===gt?n:o,trace:!1,recurse:!1})}];if(e==="__start__")this.nodes[e]=new Fe({tags:[z],triggers:[W],channels:[W],writers:[new q(a,[z])]});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&&gt in l,h=`branch:to:${e}`;this.channels[h]=t?.defer?new mo:new Ue(!1);let p=t?.cachePolicy,f=p===!1?void 0:p;this.nodes[e]=new Fe({triggers:[h],channels:u?Object.keys(l):l,writers:[new q(a,[z])],mapper:u?void 0:m=>Object.fromEntries(Object.entries(m).filter(([d])=>d in l)),bound:t?.runnable,metadata:t?.metadata,retryPolicy:t?.retryPolicy,cachePolicy:f,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 q([{channel:`branch:to:${t}`,value:null}],[z]));else if(Array.isArray(e)){let r=`join:${e.join("+")}:${t}`;this.channels[r]=this.builder.nodes[t].defer?new Zo(new Set(e)):new Qo(new Set(e)),this.nodes[t].triggers.push(r);for(let n of e)this.nodes[n].writers.push(new q([{channel:r,value:n}],[z]))}}}attachBranch(e,t,r,n={withReader:!0}){let s=async(i,o)=>{let a=i.filter(l=>l!==K);if(!a.length)return;let c=a.map(l=>ee(l)?l:{channel:l==="__end__"?l:`branch:to:${l}`,value:e});await q.doWrite({...o,tags:(o.tags??[]).concat([z])},c)};this.nodes[e].writers.push(r.run(s,n.withReader?i=>Lu.doRead(i,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(He.isInstance(t)){if(ne(e)){let s=e;return e.update&&(s.update=await t.validateInput(Array.isArray(e.update)?Object.fromEntries(e.update):e.update)),s}return await t.validateInput(e)}if(t===Gs&&He.isInstance(r)){if(ne(e)){let s=e;return e.update&&(s.update=await r.validateInput(Array.isArray(e.update)?Object.fromEntries(e.update):e.update)),s}return await r.validateInput(e)}let n=(()=>{let s=i=>{if(i!=null)return this._metaRegistry.getExtendedChannelSchemas(i,{withReducerSchema:!0})};if(ge(t))return s(t);if(t===Gs)return ge(r)?sr(s(r)):void 0})();if(ne(e)){let s=e;if(e.update&&n!=null){let i=Array.isArray(e.update)?Object.fromEntries(e.update):e.update,o=nr(n,i);s.update=Object.fromEntries(Object.keys(i).map(a=>[a,o[a]]))}return s}return n!=null?nr(n,e):e}isInterrupted(e){return Ht(e)}async _validateContext(e){let t=this.builder._configRuntimeSchema;return ge(t)&&nr(t,e),e}};function Ym(e){return typeof e=="object"&&e!==null&&e.channels!==void 0}function Xm(e){if(ee(e))return[e];let t=[];ne(e)?t.push(e):Array.isArray(e)&&t.push(...e.filter(ne));let r=[];for(let n of t){if(n.graph===_e.PARENT)throw new Dn(n);ee(n.goto)||typeof n.goto=="string"?r.push(n.goto):Array.isArray(n.goto)&&r.push(...n.goto)}return r}function Dh(){return new qo({path:new se({func:Xm,tags:[z],trace:!1,recurse:!1,name:"<control_branch>"})})}var Qm=class extends sa{constructor(){super({channels:{__root__:{reducer:Mt,default:()=>[]}}})}};function Zm(e,t){let{stateKey:r,...n}=t??{},s=Sr(n),i=r??"messages";r===null&&(i=void 0);let o=Ne(e);if(!o.id)throw new Error("Message ID is required.");let a=Array.isArray(s.callbacks)?s.callbacks:typeof s.callbacks<"u"?s.callbacks.handlers:[],c=a.find(u=>"name"in u&&u.name==="StreamMessagesHandler"),l=a.find(u=>"name"in u&&u.name==="StreamProtocolMessagesHandler");if(c||l){let u=s.metadata??{},h=(u.langgraph_checkpoint_ns??"").split("|");c?c._emit([h,u],o,void 0,!1):l&&l.emitFinalMessage([h,u],o,void 0,!1)}return i&&s.configurable?.__pregel_send?.([[i,o]]),o}function ed(e,t){let r=typeof e=="string"?{name:e,retry:void 0,cachePolicy:void 0,timeout:void 0}:e,{name:n,retry:s}=r,i=bt(r.timeout);if(Ro(t)||Mo(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),a;return typeof o=="boolean"?a=o?{}:void 0:a=o,(...c)=>Ju({func:t,name:n,retry:s,cache:a,timeout:i},...c)}var Vh=function(t,r){let{name:n,checkpointer:s,store:i,cache:o}=typeof t=="string"?{name:t,checkpointer:void 0,store:void 0}:t,a=bt(typeof t=="string"?void 0:t.timeout);if(Ro(r)||Mo(r))throw new Error("Generators are disallowed as entrypoints. For streaming responses, use config.write.");let c="updates",l=zu(n,r);function u(m){return typeof m=="object"&&m!==null&&"__lg_type"in m&&m.__lg_type==="__pregel_final"}let h=new se({name:"pluckReturnValue",func:m=>u(m)?m.value:m}),p=new se({name:"pluckSaveValue",func:m=>u(m)?m.save:m}),f=new Fe({bound:l,triggers:[W],channels:[W],timeout:a,writers:[new q([{channel:K,value:we,mapper:h},{channel:Ct,value:we,mapper:p}],[z])]});return new Us({name:n,checkpointer:s,nodes:{[n]:f},channels:{[W]:new Ue,[K]:new $e,[Ct]:new $e},inputChannels:W,outputChannels:K,streamChannels:K,streamMode:c,store:i,cache:o})};Vh.final=function({value:t,save:r}){return{value:t,save:r,__lg_type:"__pregel_final"}};function td(){return Z.getRunnableConfig().configurable?.[St]}var rd=hn.Root({messages:hn({reducer:Mt,default:()=>[]})}),Fh={reducer:{fn:Mt},jsonSchemaExtra:{langgraph_type:"messages"},default:()=>[]},nd=Qs.object({messages:Mh(Qs.custom(),Fh)});function sd(e){let t=Z.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{mr as a,W as b,K as c,L as d,ni as e,Sc as f,Vt as g,Hh as h,Ht as i,_e as j,ne as k,Ce as l,Nn as m,ii as n,Bt as o,Pn as p,Rn as q,it as r,Mn as s,jn as t,Gh as u,Dn as v,oi as w,xt as x,ot as y,$n as z,Wh as A,Vn as B,$ as C,R as D,Kh as E,ai as F,qh as G,Lr as H,zh as I,qt as J,je as K,cs as L,du as M,wr as N,hs as O,yu as P,J as Q,lt as R,hn as S,Pf as T,Rf as U,_s as V,Mf as W,go as X,_o as Y,kr as Z,yo as _,Ie as $,bs as aa,So as ba,pn as ca,fn as da,ko as ea,Eo as fa,vs as ga,To as ha,Ou as ia,Io as ja,Po as ka,zo as la,pt as ma,Bm as na,Pt as oa,ft as pa,Hs as qa,Bs as ra,mt as sa,Xt as ta,dt as ua,He as va,Wm as wa,Mt as xa,na as ya,Km as za,qm as Aa,bn as Ba,Mh as Ca,sa as Da,$h as Ea,Qm as Fa,Zm as Ga,ed as Ha,Vh as Ia,td as Ja,rd as Ka,Fh as La,nd as Ma,sd as Na};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import d from"./5CEFJTG4.js";import{a as I}from"./NHVPNSNH.js";import c from"./CJ4S56BE.js";import{a as T,b as A}from"./4KTRAA2J.js";import a from"./OQ2JULON.js";import"./4VLEUN7I.js";import"./KV4ZZSNW.js";import"./FN2QMDEW.js";import{a as S}from"./B343BOVA.js";import"./G7DJPREL.js";import"./GC4BV7IZ.js";import{L as u,M as g,N as y,Q as b,T as w,h as p,j as o,v as h}from"./AM3UTQWH.js";import"./KHKREBVZ.js";import"./5PV2GUZW.js";export default $arcgis.t(([{formatNumber:q},{a:f,b:k,c:v,d:$},{d:d},{a:C,d:E}])=>{var B=p`:host,.dropdown{display:block}.title{max-inline-size:32rem;overflow-wrap:anywhere}.dropdown-group{max-block-size:10rem;overflow:auto}calcite-alert{--calcite-z-index-toast: 999;z-index:999}`,N={esriGeometryPoint:"point",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryMultipoint:"multipoint"};function G(s){return{id:s.id,title:s.title,description:s.description??"",fieldAliases:Array.isArray(s.fieldAliases)?s.fieldAliases.join(","):s.fieldAliases??"",geometryType:!s.geometryType||s.geometryType==="table"?"nonspatial":N[s.geometryType]??"nonspatial",sourceJSON:s.sourceJSON}}function x(s){let{messageCode:t}=C(s);return{error:{code:t==="OAUTH_0070"?"notebookAccessBlocked":"serviceUnavailable"}}}function P(s){return d(s)||!s.id?void 0:k("serviceInfo",s.id)?.result?.sublayers.map(G)}function O(s){s.id&&v("serviceInfo",s.id)}async function L({item:s,portal:t,signal:e}){try{if(e.throwIfAborted(),d(s)){if(!s.url)throw new Error("The geoprocessing item has no service URL.");let r=await $({url:s.url,portal:t,options:{signal:e,addTokenManually:!1}}),l=r.tasks??(r.parameters?[s.url.split("/GPServer/").pop()??""]:void 0);if(!l)throw new Error("The geoprocessing service did not return tasks.");return{result:{tasks:l}}}if(!s.id)throw new Error("The item has no ID.");let i=await f({requester:async()=>await E({item:s,portal:t,isSecure:!1,allowLoginWindow:!0}),key:"serviceInfo",id:s.id});return e.throwIfAborted(),i.result?{result:{sublayers:i.result.sublayers.map(G)}}:x(i.error)}catch(i){return x(i)}}var m=class extends y{constructor(){super(...arguments),this.messages=S({blocking:!0}),this.dropdown=u(),this.selectedEntries=[],this.loading=!1,this.fetched=!1,this.selectedItems=[],this.allowedGeometries=[],this.width="auto",this.appearance="outline",this.selection="single",this.disabled=!1,this.arcgisItemCardSelect=h(),this.arcgisItemCardSelectError=h()}static{this.properties={sublayers:16,tasks:16,loading:16,fetched:16,error:16,item:0,portal:0,selectedItems:0,allowedGeometries:0,width:1,appearance:1,selection:1,disabled:7,messageOverrides:0}}static{this.styles=B}get isTask(){return d(this.item)}get sortedSublayers(){return[...this.sublayers??[]].sort((t,e)=>Number(this.isAllowed(e))-Number(this.isAllowed(t))||e.id-t.id)}get selectText(){let t=this.selectedEntries,{messages:e}=this;if(this.isTask){let r=t[0];return t.length===1&&r&&"task"in r?e.selectedTask.replace("${task}",r.task):e.selectTask}if(!t.length&&!this.sublayers?.length)return this.isSelected()?e.selectedSingle:e.select;if(!t.length)return this.selection==="multiple"?e.selectLayers:e.select;if(this.selection==="multiple")return e.selectedLayers.replace("${num}",q(t.length));let i=t[0];return i&&"sublayer"in i?e.selectedName.replace("${name}",i.sublayer.title):e.select}willUpdate(t){if(t.has("disabled")&&this.disabled&&(this.requestController?.abort(),this.loading=!1,this.dropdown.value&&(this.dropdown.value.open=!1)),(t.has("item")||t.has("selectedItems"))&&(this.selectedEntries=this.selectedItems.filter(e=>"item"in e&&e.item.id===this.item?.id)),(t.has("item")||t.has("portal"))&&(this.requestController?.abort(),this.sublayers=this.item?T(this.item).sublayers:void 0,this.tasks=void 0,this.loading=!1,this.fetched=!1,this.error=void 0,this.item&&!this.sublayers)){let e=P(this.item);e&&(this.sublayers=e,this.fetched=!0)}}disconnectedCallback(){super.disconnectedCallback(),this.requestController?.abort(),this.loading=!1}isSelected(t,e){return this.selectedItems.some(i=>"item"in i?i.item.id===this.item.id&&(t?"sublayer"in i&&i.sublayer.id===t.id:e!==void 0&&"task"in i&&i.task===e):!t&&e===void 0&&i.id===this.item.id)}isAllowed(t){return!this.allowedGeometries.length||this.allowedGeometries.includes(t.geometryType)}select(t,e,i=this.selection==="single"||!this.isSelected(t,e)){this.disabled||(this.arcgisItemCardSelect.emit({item:this.item,...t?{sublayer:t}:{},...e!==void 0?{task:e}:{},selected:i}),this.requestUpdate(),this.reconcileSelection())}async reconcileSelection(){await this.updateComplete;let t=this.sortedSublayers;this.dropdown.value?.querySelectorAll("calcite-dropdown-item").forEach((e,i)=>{e.selected=this.isTask?this.isSelected(void 0,this.tasks?.[i]):this.isSelected(t[i])})}async handleTrigger(t=!1){if(this.loading||this.disabled)return;this.requestController?.abort();let e=new AbortController;this.requestController=e;let{item:i,portal:r}=this,l=()=>!e.signal.aborted&&this.item===i&&this.portal===r&&this.el.isConnected,c=t||!this.fetched&&(this.isTask||!this.sublayers&&this.item.type!=="Image Service"||A(this.item).includes("SubtypeGroupLayer"));if(c){t&&(O(i),this.fetched=!1),this.loading=!0,this.error=void 0;let a=await L({item:i,portal:r,signal:e.signal});if(!l())return;if(this.loading=!1,a.error||!a.result){this.error=a.error??{code:"serviceUnavailable"},this.arcgisItemCardSelectError.emit({item:i,error:this.error});return}if(this.sublayers=a.result.sublayers,this.tasks=a.result.tasks,this.fetched=!0,await this.updateComplete,!l())return}if(c&&this.isTask&&this.tasks?.length===1){this.dropdown.value&&(this.dropdown.value.open=!1),this.select(void 0,this.tasks[0],!0);return}if(!this.isTask&&!this.sublayers?.length){t||this.select(void 0,void 0,!this.isSelected());return}let n=this.dropdown.value;n&&(await n.componentOnReady(),l()&&(n.open=c||!n.open))}renderButton(t){return o`<calcite-button slot=${(t?"trigger":void 0)??b} class="dropdown" .loading=${this.loading} .disabled=${this.loading||this.disabled} .appearance=${this.selectedEntries.length||this.isSelected()?"solid":this.appearance} kind=neutral .iconEnd=${t?"chevron-down":void 0} .width=${this.width} @click=${e=>{e.stopPropagation(),this.handleTrigger()}}>${this.selectText}</calcite-button>`}render(){if(!this.item||!this.portal||!this.messages._lang)return null;let t=this.sortedSublayers;return o`${t.length||this.isTask?o`<calcite-dropdown class="dropdown" width=l .placement=${this.appearance==="solid"?"top":"bottom-end"} .closeOnSelectDisabled=${!this.isTask&&this.selection==="multiple"} overlay-positioning=fixed ${g(this.dropdown)}>${this.renderButton(!0)}<calcite-dropdown-group class="dropdown-group" .selectionMode=${this.selection} .groupTitle=${this.isTask&&this.tasks?.length?this.messages.selectTaskFrom.replace("${title}",this.item.title??""):void 0}>${this.isTask?this.tasks?.map(e=>o`<calcite-dropdown-item .disabled=${this.disabled} .selected=${this.isSelected(void 0,e)} @calciteDropdownItemSelect=${()=>this.select(void 0,e)}><span class="title">${e}</span></calcite-dropdown-item>`):t.map(e=>o`<calcite-dropdown-item .id=${`sublayer-${e.id}`} .iconStart=${I({geometry:e.geometryType}).icon} .disabled=${this.disabled||!this.isAllowed(e)} .selected=${this.isSelected(e)} @calciteDropdownItemSelect=${()=>{this.isAllowed(e)&&this.select(e)}}><span class="title">${e.title}</span></calcite-dropdown-item>${!this.isAllowed(e)&&o`<calcite-tooltip .referenceElement=${`sublayer-${e.id}`} overlay-positioning=fixed>${this.messages.geometryNotAllowed}</calcite-tooltip>`||""}`)}</calcite-dropdown-group></calcite-dropdown>`:this.renderButton(!1)}<calcite-alert .label=${this.messages.errorTitle} icon kind=danger .open=${!!this.error} @calciteAlertClose=${()=>{this.error=void 0}}><div slot=title>${this.messages.errorTitle}</div><div slot=message>${this.error?.code==="notebookAccessBlocked"?this.messages.notebookErrorBody:this.messages.errorBody}</div><calcite-link slot=link @click=${e=>{e.stopPropagation(),this.handleTrigger(!0)}}>${this.messages.retry}</calcite-link></calcite-alert>`}};w("arcgis-portal-item-card-sublayer-select",m);return m},"intl",a,c,d)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{d as r}from"./A2SQ4EMZ.js";import{S as o}from"./AICPYLWE.js";var s=r(o);export{s as a};
2
+ import{e as r}from"./G7DJPREL.js";import{U as o}from"./AM3UTQWH.js";var s=r(o);export{s as a};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import q from"./OHAQPQAP.js";import"./XH6RD5BO.js";import p from"./MVC6LIQ6.js";import o from"./XE3DCC5D.js";import n from"./ZGSAH7Z7.js";import"./QF626JXP.js";import{a as j}from"./SLQQ44IA.js";import{a as oe,b as Be,e as _e}from"./WFPUAEJQ.js";import m from"./7DAB2CEU.js";import"./4QYVBXZT.js";import"./JLT5GCLY.js";import l from"./FGDSHTJ5.js";import k from"./3QWNGHAK.js";import"./TO666HVV.js";import i from"./UBPCKCW2.js";import h from"./FOWOLUC3.js";import f from"./YYKKXL62.js";import e from"./WZFGZEQI.js";import"./FAZVQI4K.js";import"./VDXESPJK.js";import{a as M}from"./ULGME5RT.js";import"./DAAON2UO.js";import"./5Y32T5IJ.js";import d from"./365ICWHN.js";import b from"./TIPQ2ZWK.js";import{a as Ge}from"./DV57AOBF.js";import"./HBO7XTIL.js";import"./4KTRAA2J.js";import a from"./OQ2JULON.js";import"./4VLEUN7I.js";import"./KV4ZZSNW.js";import{a as N,d as B}from"./FN2QMDEW.js";import{a as ae}from"./B343BOVA.js";import"./G7DJPREL.js";import"./GC4BV7IZ.js";import{N as $e,O as E,Q as g,T as Fe,h as ye,j as c,v as S}from"./AM3UTQWH.js";import"./KHKREBVZ.js";import"./5PV2GUZW.js";export default $arcgis.t(([{substitute:L},{substitute:sr},{watch:ar},{substitute:D},,,,,{c:Oe},{a:Se,b:Pe},,,,,,,{a:Ce,b:J,c:K,d:X,e:Y,f:Z},{a:xe}])=>{function _(t){let{action:e,active:r=!1,clearDisabled:s=!1,clearLabel:i="Clear",children:n,expanded:a=!1,heading:l,noPadding:p=!1,onRemove:w,primary:$=!1,setExpanded:f}=t;return $?c`<div class="filter--primary"><div class="filter__header filter__header--primary"><h3 class="filter__title">${l}</h3>${e}</div>${n}</div>`:c`<calcite-accordion-item class="filter__accordion-item" .heading=${l} .expanded=${a} @calciteAccordionItemExpand=${()=>{f?.(!0)}} @calciteAccordionItemCollapse=${()=>{f?.(!1)}}><div slot=actions-end class="filter__actions-slot arcgis-item-browser-filter__actions-slot">${e}${r&&!s&&c`<calcite-button class="clear-button" scale=s kind=neutral appearance=transparent @click=${()=>w?.()}>${i}</calcite-button>`||""}</div><div class=${E({filter__content:!0,"filter__content--padded":!p})}>${n}</div></calcite-accordion-item>`}var I=1440*60*1e3;function y(t){let e=typeof t=="string"?Number.parseInt(t,10):typeof t=="number"?t:(t??new Date).valueOf(),r=new Date(e);return r.setHours(0,0,0,0),r.valueOf()}function x(t){return y(t)+I-1}var le=7*I,Ue=["today","yesterday","last7","last30","never","custom"],tr=(t,e,r)=>{let s=y(),i=x();switch(t){case"yesterday":return[s-I,s-1];case"today":return[s,i];case"last7":return[s-le,i];case"last30":return[s-I*30,i];case"never":return[-1,-1];case"custom":return e&&r?[y(e),x(r)]:null;default:return null}};function Te(t){let{clearLabel:e,end:r,expanded:s,filterDateMessages:i,includeNever:n,onFilter:a,onRemove:l,property:p,range:w,serverProperty:$,setExpanded:f,start:v}=t,q=i.title[p],u=n?Ue:Ue.filter(m=>m!=="never"),C=new Date().toISOString().slice(0,10),b=!!(w&&(w!=="custom"||v&&r)),O=(m,P,F)=>{let U=$??(p==="modified"?"modified":"uploaded"),G=tr(m,P,F),A=m?i[m]:"";a?.({id:p,label:m?sr(i[p],{date:A}):"",value:G?`(${U}:[${G[0]} TO ${G[1]}])`:"",range:m,start:G?new Date(G[0]):void 0,end:G?new Date(G[1]):void 0})};return _({heading:q,expanded:s,setExpanded:f,active:b,clearLabel:e,onRemove:l,children:c`<div><calcite-tree selection-mode=children scale=m @calciteTreeSelect=${m=>{let P=m.target.selectedItems?.[0]?.dataset.range,F=w===P?null:P;if(!F){l?.();return}O(F,v,r)}}>${u.map(m=>c`<calcite-tree-item data-range=${m??g} .selected=${m===w}>${i[m]}</calcite-tree-item>`)}</calcite-tree>${w==="custom"&&c`<calcite-input-date-picker class="custom-date-picker" @calciteInputDatePickerChange=${m=>{let P=m.target.valueAsDate,[F,U]=Array.isArray(P)?P:[];F&&U&&O("custom",F,U)}} scale=s .max=${C} calendars=1 layout=vertical month-style=abbreviated proximity-selection-disabled range .valueAsDate=${v&&r?[new Date(y(v)),new Date(y(r))]:[]}></calcite-input-date-picker>`||""}</div>`})}var ir=["title","relevance","modified"];function Re(t){let{slot:e="sort",sort:r,formFactor:s,sortField:i,sortOrder:n,onSortFieldChange:a,onSortOrderChange:l}=t;return r.enabled?c`<arcgis-portal-browser-sort slot=${e??g} .options=${r.props?.options??ir} .field=${i} .order=${n} .appearance=${r.props?.appearance??"dropdown"} .showText=${r.props?.showText??s!=="small"} .useDeleted=${r.props?.useDeleted??!1} @arcgisBrowserSortFieldChange=${p=>{a(p.detail)}} @arcgisBrowserSortOrderChange=${p=>{l(p.detail)}}></arcgis-portal-browser-sort>`:c`<slot name=${e??g} slot=${e??g}></slot>`}function ke(t){let{slot:e="pagination",store:r,total:s,start:i,num:n,onPage:a}=t;return c`<slot name=${e??g} slot=${e??g}><arcgis-portal-browser-pagination .store=${r} .total=${s} .start=${i} .num=${n} @arcgisBrowserPage=${l=>{a(l.detail)}}></arcgis-portal-browser-pagination></slot>`}function Ie(t){let{bottom:e,children:r,primary:s,slot:i,store:n,title:a,top:l}=t,p=!!n?.panel||(n?.width??0)<M.sm;return c`<div slot=${i??g} class="filters-shell" .inert=${!!n?.preview}><div class=${E({"filters-shell__top":!0,"filters-shell__top--padded":p})}>${l}</div>${s}${a}<calcite-accordion appearance=transparent icon-type=chevron icon-position=start scale=m>${r}</calcite-accordion>${e}</div>`}function qe(t){let{browserMessages:e,slot:r,filters:s,hasIndoorsSpaces:i,isFilterActive:n,messages:a,portal:l,selectedAccess:p,selectedGroupsByUser:w,selectedMemberOrg:$,selectedMembership:f,selectedOwner:v,selectedSpecialGroup:q,specialGroupOptions:u,store:C,handleRemove:b,handleSelect:O,handleUpsert:m,handleUserFilterChange:P}=t,F=l.isPortal,U=l.user,G=j(U),A=U?.username??"",We=o=>o===A?D(a.groupsByUser.me,{username:o}):o,me=(o,d)=>o==="owner"?d:o==="outsideOrg"&&G?a.owner.someoneElse:o==="inOrg"?a.owner.inOrg:o==="outsideOrg"?a.owner.outsideOrg:d,Q=s.owner,ue=v??Q?.props?.owner??null,H=Q?.props?.username??A,ze=l.id??"",Qe=G?["owner","outsideOrg"]:["owner","inOrg","outsideOrg"],re=s.membership,ge=f??re?.props?.membership??null,He=["org","collaboration","anyOrg"],V=s.memberOrg,we=$??V?.props?.memberOrg??null,Ve=V?.props?.orgId??"",Ne=["myOrg","anotherOrg"],se=s.specialGroups,fe=q??se?.props?.specialGroup??null,te=s.access,be=p??te?.props?.access??null,je=["public","org","private"],W=s.groupsByUser,ve=W?.props?.usernames??[],Je=W?.props?.selectedUsername??w??ve[0]??A,T=e.filter.clear,R=(o,d)=>{let h=s[o];h&&(h.props={...h.props,expanded:d})},Ke=o=>{if(o.assignedElements({flatten:!0}).length>0){o.setAttribute("data-has-before-filters","true");return}o.removeAttribute("data-has-before-filters")};return Ie({slot:r,store:C,title:c`<div class="filters-title"><h2 class="filters-title__heading">${a.filters.title}</h2><slot name=before-filters @slotchange=${o=>Ke(o.currentTarget)}></slot></div>`,children:c`${!!W?.enabled&&_({heading:a.groupsByUser.title,expanded:!!W?.props?.expanded,setExpanded:o=>R("groupsByUser",o),clearLabel:T,onRemove:()=>{O({kind:"groupsByUser",value:W?.props?.selectedUsername??A})},children:c`<calcite-tree selection-mode=single scale=m @calciteTreeSelect=${o=>{let d=o.target.selectedItems?.[0]?.dataset.username??"";O({kind:"groupsByUser",value:d}),P(d)}}>${ve.map(o=>c`<calcite-tree-item data-username=${o??g} .selected=${o===Je}><a class="groups-by-user__label">${We(o)}</a></calcite-tree-item>`)}</calcite-tree>`})||""}${!!Q?.enabled&&_({heading:a.owner.title,expanded:!!Q?.props?.expanded,setExpanded:o=>R("owner",o),active:n("owner"),clearLabel:T,onRemove:()=>b("owner"),children:c`<calcite-tree selection-mode=single scale=m @calciteTreeSelect=${o=>{let d="owner",h=z(ue,o,d);if(!h){b(d);return}m({id:d,label:D(a.owner.label,{label:me(h,H)}),param:"q",value:J(h,H,{isPublicUser:G,orgId:ze}),owner:h,username:H}),O({kind:d,value:h})}}>${Qe.filter(o=>!(F||i)||o!=="outsideOrg").map(o=>c`<calcite-tree-item data-owner=${o??g} .selected=${ue===o}>${me(o,H)}</calcite-tree-item>`)}</calcite-tree>`})||""}${!!(V?.enabled&&!F)&&_({heading:a.memberOrg.title,expanded:!!V?.props?.expanded,setExpanded:o=>R("memberOrg",o),active:n("memberOrg"),clearLabel:T,onRemove:()=>b("memberOrg"),children:c`<calcite-tree selection-mode=single scale=m @calciteTreeSelect=${o=>{let d="memberOrg",h=z(we,o,d);if(!h){b(d);return}m({id:d,label:D(a.memberOrg.label,{label:a.memberOrg[h]}),param:"q",value:X(h,Ve),memberOrg:h}),O({kind:d,value:h})}}>${Ne.map(o=>c`<calcite-tree-item data-member-org=${o??g} .selected=${we===o}>${a.memberOrg[o]}</calcite-tree-item>`)}</calcite-tree>`})||""}${!!(re?.enabled&&!F&&!i)&&_({heading:a.membership.title,expanded:!!re?.props?.expanded,setExpanded:o=>R("membership",o),active:n("membership"),clearLabel:T,onRemove:()=>b("membership"),children:c`<calcite-tree selection-mode=single scale=m @calciteTreeSelect=${o=>{let d="membership",h=z(ge,o,d);if(!h){b(d);return}m({id:d,label:D(a.membership.label,{label:a.membership[h]}),param:"q",value:K(h,i),membership:h}),O({kind:d,value:h})}}>${He.map(o=>c`<calcite-tree-item data-membership=${o??g} .selected=${ge===o}>${a.membership[o]}</calcite-tree-item>`)}</calcite-tree>`})||""}${se?.enabled&&_({heading:a.specialGroups.title,expanded:!!se.props?.expanded,setExpanded:o=>R("specialGroups",o),active:n("specialGroups"),clearLabel:T,onRemove:()=>b("specialGroups"),children:c`<calcite-tree selection-mode=single scale=m @calciteTreeSelect=${async o=>{let d="specialGroups",h=z(fe,o,d);if(!h){b(d);return}let ie=await Y(h,l);m({id:"specialGroups",label:D(a.specialGroups.label,{label:a.specialGroups[h]}),param:"q",value:ie,specialGroup:h}),O({kind:"specialGroups",value:h})}}>${u.map(o=>c`<calcite-tree-item data-special-groups=${o??g} .selected=${fe===o}><span class="special-groups-settings-option">${a.specialGroups[o]}${o==="settings"&&c`<span class="special-groups-settings-icon"><calcite-icon id=portal-group-browser-special-groups-settings-info icon=information scale=s text-label=${a.specialGroups.tooltipLabel??g}></calcite-icon><calcite-tooltip placement=bottom-end reference-element=portal-group-browser-special-groups-settings-info>${a.specialGroups.tooltip}</calcite-tooltip></span>`||""}</span></calcite-tree-item>`)}</calcite-tree>`})||""}${["modified","created"].filter(o=>s[o]?.enabled).map(o=>{let d=s[o]?.props,h=C.filters[o],ie=!!d?.includeNever,Xe=h?.range??d?.range??null,Ye=h?.start??d?.start,Ze=h?.end??d?.end,er=d?.serverProperty,rr=d?.expanded;return Te({property:o,filterDateMessages:e.filterDate,clearLabel:T,expanded:rr,setExpanded:k=>R(o,k),includeNever:ie,range:Xe,start:Ye,end:Ze,serverProperty:er,onRemove:()=>{m({id:o,label:"",param:"q",value:"",range:null,start:null,end:null})},onFilter:k=>{m({id:o,label:k.label,param:"q",value:k.value,range:k.range,start:k.start,end:k.end})}})})}${!!te?.enabled&&_({heading:a.access.title,expanded:!!te?.props?.expanded,setExpanded:o=>R("access",o),active:n("access"),clearLabel:T,onRemove:()=>b("access"),children:c`<calcite-tree selection-mode=single scale=m @calciteTreeSelect=${o=>{let d="access",h=z(be,o,d);if(!h){b(d);return}m({id:d,label:D(a.access.label,{label:a.access[h]}),param:"q",value:Z(h),access:h}),O({kind:d,value:h})}}>${je.map(o=>c`<calcite-tree-item data-access=${o??g} .selected=${be===o}>${a.access[o]}</calcite-tree-item>`)}</calcite-tree>`})||""}`})}var z=(t,e,r)=>{let s=e.target.selectedItems?.[0]?.dataset[r];return t===s?null:s??null};var Ae={select:"arcgisGroupCardSelect",preview:"arcgisGroupBrowserCardPreview"},or=ye`:host{position:relative;background-color:var(--calcite-color-background);display:flex;flex-direction:column;height:100%;min-height:0;overflow-y:auto;overflow-x:hidden;--portal-group-browser-max-width: var(--group-browser-max-width, 100%);--portal-group-browser-pane-width: 18.75rem;--portal-group-browser-pane-z-index: 11;container-type:inline-size;container-name:portal-group-browser}arcgis-portal-browser{--arcgis-browser-max-width: var(--portal-group-browser-max-width);--arcgis-browser-pane-width: var(--portal-group-browser-pane-width);--arcgis-browser-pane-z-index: var(--portal-group-browser-pane-z-index)}.filters-title__heading{color:var(--calcite-color-text-1);font-size:var(--calcite-font-size-0);font-weight:var(--calcite-font-weight-medium);line-height:1.2;margin:0;padding:1rem .5rem}.filters-title:has(>slot[name=before-filters][data-has-before-filters=true]) .filters-title__heading{border-bottom:1px solid var(--calcite-color-border-2)}.filters-shell{display:block}.filters-shell__top{padding:0}.filters-shell__top--padded{padding:0 1rem 1rem}.filter__accordion-item{--calcite-accordion-item-content-space: .75rem .25rem;--calcite-accordion-icon-margin: .5rem;border-top:1px solid var(--calcite-color-border-1)}.filter__actions-slot{display:flex;align-self:center;align-items:center;line-height:0}.filter__content{margin:0}.filter__content--padded{margin:-.75rem .5rem 0}.filter__content>calcite-tree>calcite-tree-item>a{padding-block:.25rem}.clear-button{line-height:1;margin-inline:.25rem}.custom-date-picker{margin-block:.5rem;margin-inline-start:1.75rem;width:12.75rem}.groups-by-user__label{display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}.special-groups-settings-option{display:inline-flex;align-items:center;gap:.25rem}.special-groups-settings-icon{display:inline-flex;align-items:center}.group-browser__results{display:grid;gap:.5rem}.group-browser__results--compact{gap:0}.group-browser__result-card{margin:0}@container portal-group-browser (max-width: 640px){arcgis-portal-browser{--portal-group-browser-pane-width: 100%}}.empty-text-slot{width:100%;height:100%;display:flex;justify-content:center}.empty-text-slot__default{@apply max-w-lg mx-auto px-6 pb-16;max-width:32rem;margin-inline:auto;padding-inline:1.5rem;padding-bottom:4rem;margin-top:min(8rem,30vh)}`;async function lr(t,e){let r=pr(e),s=dr(e),i=!!e.searchUser?.trim();if(!r.trim()&&!i)return{nextStart:-1,num:0,q:r,queryParams:{...s,q:r},results:[],start:0,total:0};let n={...s,q:r};return{...await xe(t,n),q:r,queryParams:n}}var nr=["created","modified","owner","title"];function cr(t){return!!t&&nr.includes(t)}function pr(t){let e=[],r=t.baseQuery?.trim();r&&e.push(r);let s=t.searchTerm?.trim();s&&e.push(Be(s));for(let i of Object.values(t.filters??{}))typeof i.value=="string"&&i.value.trim()&&e.push(i.value),typeof i.additionalParams=="string"&&i.additionalParams.trim()&&e.push(i.additionalParams);return _e(...e)}function dr(t){return{num:t.num,start:t.start,...t.searchUser?{searchUserAccess:"groupMember",searchUserName:t.searchUser}:{},...t.sortField==="relevance"||!cr(t.sortField)?{}:{sortField:t.sortField,sortOrder:t.sortOrder}}}function hr(t,e,r){switch(t){case"yesterday":{let s=y();return[s-I,s-1]}case"today":return[y(),x()];case"last7":return[y()-le,x()];case"last30":return[y()-I*30,x()];case"never":return[-1,-1];case"custom":return e&&r?[y(e),x(r)]:null;default:return N(t)}}var mr=["created","modified","owner","relevance","title"],ur=["asc","desc"],gr=["custom","last7","last30","never","today","yesterday"],wr=["inOrg","outsideOrg","owner"],fr=["anyOrg","collaboration","org"],br=["anotherOrg","myOrg"],vr=["admin","distributed","openData","settings","sharedUpdate"],yr=["org","private","public"],$r=["access","created","created_from","created_to","memberorgids","membershipaccess","modified","modified_from","modified_to","owner","q","searchTerm","sortField","sortOrder","specialGroups","start","num"];function ee(t){if(!t)return;let e=Number.parseInt(t,10);return Number.isFinite(e)&&e>0?e:void 0}function Ee(t,e){let r=t.get(e);if(!B(gr,r))return;if(r!=="custom")return{range:r};let s=ee(t.get(`${e}_from`)),i=ee(t.get(`${e}_to`));if(!(!s||!i))return{range:r,start:new Date(s),end:new Date(i)}}function Me(t,e,r){r?.range&&(t.set(e,r.range),r.range==="custom"&&(r.start&&t.set(`${e}_from`,`${y(r.start)}`),r.end&&t.set(`${e}_to`,`${x(r.end)}`)))}function Le(t){let e=t.get("searchTerm")?.trim()||t.get("q")?.trim()||void 0,r=t.get("sortField"),s=t.get("sortOrder"),i=ee(t.get("start")),n=ee(t.get("num")),a=t.get("access"),l=t.get("memberorgids"),p=t.get("membershipaccess"),w=t.get("owner"),$=t.get("specialGroups"),f=Ee(t,"created"),v=Ee(t,"modified");return{...e?{searchTerm:e}:{},...B(mr,r)?{sortField:r}:{},...B(ur,s)?{sortOrder:s}:{},...i?{start:i}:{},...n?{num:n}:{},filters:{...B(yr,a)?{access:a}:{},...f?{created:f}:{},...B(br,l)?{memberOrg:l}:{},...B(fr,p)?{membership:p}:{},...v?{modified:v}:{},...B(wr,w)?{owner:w}:{},...B(vr,$)?{specialGroups:$}:{}}}}function de(t){let e=Le(t),{filters:r,num:s,sortField:i,sortOrder:n,start:a}=e,{access:l,created:p,memberOrg:w,membership:$,modified:f,owner:v,specialGroups:q}=r,u={},C=t.get("searchTerm")?.trim()||void 0,b=t.get("q")?.trim()||void 0;return C&&(u.searchTerm=C),b&&(u.q=b),i&&(u.sortField=i),n&&(u.sortOrder=n),a&&(u.start=a),s&&(u.num=s),l&&(u.access=l),v&&(u.owner=v),$&&(u.membershipAccess=$),w&&(u.memberOrgIds=w),q&&(u.specialGroups=q),p?.range&&(u.created=p.range),p?.start&&(u.createdFrom=p.start.getTime()),p?.end&&(u.createdTo=p.end.getTime()),f?.range&&(u.modified=f.range),f?.start&&(u.modifiedFrom=f.start.getTime()),f?.end&&(u.modifiedTo=f.end.getTime()),u}function Fr(t){let e=new URLSearchParams(t.currentSearchParams);return $r.forEach(r=>{e.delete(r)}),t.searchTerm?.trim()&&e.set("searchTerm",t.searchTerm.trim()),t.sortField&&e.set("sortField",t.sortField),t.sortOrder&&e.set("sortOrder",t.sortOrder),Object.values(t.filters??{}).forEach(r=>{if(r)switch(r.id){case"owner":r.owner&&e.set("owner",r.owner);break;case"access":r.access&&e.set("access",r.access);break;case"specialGroups":r.specialGroup&&e.set("specialGroups",r.specialGroup);break;case"memberOrg":r.memberOrg&&r.value&&e.set("memberorgids",r.memberOrg);break;case"membership":r.membership&&e.set("membershipaccess",r.membership);break;case"created":Me(e,"created",r);break;case"modified":Me(e,"modified",r);break;default:N(r)}}),e}function ne(t,e="desc"){switch(t){case"owner":case"title":return"asc";case"created":case"modified":case"relevance":return"desc";default:return e}}function Gr(t){return!t||!(t instanceof HTMLElement)?null:t}async function Or(t){if(t){if(t.restoreFocus){await t.restoreFocus();return}if(t.setFocus){await t.setFocus();return}t.focus?.()}}function Sr(t){let e=null,r=async(s={})=>{t.onClose(),s.restoreFocus&&await Or(e)};return{handlePreview:(s,i)=>{if(!s?.id){r();return}e=Gr(i),t.onOpen({preview:s})},closePreview:r}}function Pr(t){let e,r,s,i=()=>{e?.();let a=ar(()=>t.getStore().width,()=>{n()});e=()=>{a.remove()}},n=()=>{let a=t.getStore(),l=a.width||t.getHostWidth()||t.getViewportWidth(),p=Math.min(l,t.getViewportWidth());a.width!==p&&(a.width=p);let w=p>M.md?"large":"small";t.getResponsiveFormFactor()==="large"&&w==="small"&&(a.panel=!1,a.filtersExpanded=!1),t.getResponsiveFormFactor()==="small"&&w==="large"&&(a.panel=!1,a.filtersExpanded=!0),t.setResponsiveFormFactor(w)};return{connect:()=>{typeof ResizeObserver<"u"&&(r=new ResizeObserver(a=>{let l=a[0]?.contentRect?.width??0;if(l>0){let p=Math.round(l);t.setHostWidth(p),t.getStore().width=p,n()}}),r.observe(t.el)),i(),n()},disconnect:()=>{s!==void 0&&(cancelAnimationFrame(s),s=void 0),e?.(),r?.disconnect(),r=void 0},refreshStoreWatcher:i,handleWindowResize:()=>{if(t.setViewportWidth(window.innerWidth),!r){if(s!==void 0)return;s=requestAnimationFrame(()=>{s=void 0;let a=Math.round(t.el.getBoundingClientRect().width||t.getHostWidth()||t.getViewportWidth()),l=Math.min(a,t.getViewportWidth()),p=t.getStore();p.width!==l&&(p.width=l),n()});return}n()},updateResponsiveLayout:n}}function Br(t){let e=!1,r=()=>!!t.getSearchParamInteraction()?.read,s=()=>!!t.getSearchParamInteraction()?.write;return{hydrateFromLocation:async()=>{if(!r()||typeof window>"u")return;let i=new URLSearchParams(window.location.search);await t.applySearchParams(i),t.onSearchParamsUpdate?.({phase:"hydrate",search:i.toString(),searchParams:i,searchParamMap:de(i)}),e=!0},writeToLocation:i=>{if(!s()||typeof window>"u")return;if(e){e=!1;return}let n=i.toString(),a=window.location.search.startsWith("?")?window.location.search.slice(1):window.location.search;if(n===a)return;let l=`${window.location.pathname}${n?`?${n}`:""}${window.location.hash}`;window.history.replaceState(window.history.state,"",l),t.onSearchParamsUpdate?.({phase:"write",search:n,searchParams:i,searchParamMap:de(i)})}}}var ce=["title","relevance","modified"],pe={queryParams:void 0,nextStart:-1,results:[],start:-1,num:0,total:0},De=["openData","sharedUpdate","distributed","admin","settings"],he=class extends $e{constructor(){super(),this._messages=ae({name:"portal-group-browser",blocking:!0}),this._browserMessages=ae({name:"portal-browser",blocking:!0}),this.responsiveLayoutController=Pr({el:this.el,getStore:()=>this.store,getViewportWidth:()=>this.viewportWidth,setViewportWidth:e=>{this.viewportWidth=e},getHostWidth:()=>this.hostWidth,setHostWidth:e=>{this.hostWidth=e},getResponsiveFormFactor:()=>this.responsiveFormFactor,setResponsiveFormFactor:e=>{this.responsiveFormFactor=e}}),this.previewSessionController=Sr({onOpen:({preview:e})=>{this.store.preview=e.id,this.arcgisGroupBrowserPreview.emit(e)},onClose:()=>{this.store.preview=null,this.arcgisGroupBrowserPreview.emit(null),this.arcgisGroupBrowserSublayerPreview.emit(null)}}),this.browserResponse=this.getBrowserResponseFromQueryResponse(pe),this.previewGroupsById=new Map,this.searchParamController=Br({applySearchParams:async e=>{await this.applySearchParams(e)},getSearchParamInteraction:()=>this.searchParamInteraction,onSearchParamsUpdate:e=>{this.arcgisGroupBrowserSearchParamsUpdate.emit(e)}}),this.handleBrowserFilterClear=()=>{this.clearFilters()},this.handleBrowserFilterRemove=e=>{let r=e.detail;r&&this.removeFilter(r)},this.onDelegatedGroupCardSelect=e=>{this.handleGroupCardSelect(e)},this.onDelegatedGroupCardPreview=e=>{this.handleGroupCardPreview(e)},this.selectedOwner=null,this.selectedMembership=null,this.selectedMemberOrg=null,this.selectedSpecialGroup=null,this.selectedAccess=null,this.selectedGroups=[],this.queryResponse=pe,this.specialGroupOptions=De,this.responsiveFormFactor="large",this.viewportWidth=typeof window>"u"?M.lg:window.innerWidth,this.hostWidth=0,this.store=Oe({type:"group-browser",width:window?.innerWidth??M.lg,hiddenFilters:[],filtersEmpty:!1,topbarEmpty:!1,sortEmpty:!1,filtersExpanded:!1,panel:!1,filters:{}}),this.filters={},this.loading=!1,this.formFactor="large",this.height="full",this.searchTerm="",this.messageOverrides={},this.hideTopBar=!1,this.cards={},this.preview="top",this.q="",this.num=60,this.sort={enabled:!0,props:{options:ce}},this.searchParamInteraction={read:!1,write:!1},this.selection="none",this.alwaysShowSelection=!1,this.hidePreviewFooter=!1,this.hidePreviewBadges=!1,this.hasIndoorsSpaces=!1,this.arcgisGroupBrowserLoading=S(),this.arcgisGroupBrowserPreview=S(),this.arcgisGroupBrowserSelect=S(),this.arcgisGroupBrowserSublayerPreview=S(),this.arcgisGroupBrowserUpdate=S(),this.arcgisGroupBrowserInternalUIAction=S(),this.arcgisGroupBrowserUserFilterChange=S(),this.arcgisGroupBrowserSearchParamsUpdate=S(),this.arcgisAriaUpdate=S(),this.listen(Ae.select,this.onDelegatedGroupCardSelect),this.listen(Ae.preview,this.onDelegatedGroupCardPreview)}static{this.properties={selectedGroupsByUser:16,selectedOwner:16,selectedMembership:16,selectedMemberOrg:16,selectedSpecialGroup:16,selectedAccess:16,selectedGroups:16,queryResponse:16,specialGroupOptions:16,sortField:16,sortOrder:16,responsiveFormFactor:16,viewportWidth:16,hostWidth:16,store:0,filters:0,loading:5,formFactor:1,height:3,searchTerm:1,messageOverrides:0,hideTopBar:5,selected:0,view:1,cards:0,preview:1,q:1,portal:0,num:9,sort:0,fetch:0,preflight:0,searchUser:1,searchParamInteraction:0,selection:1,alwaysShowSelection:5,hidePreviewFooter:5,hidePreviewBadges:5,hasIndoorsSpaces:5}}static{this.styles=or}get currentUsername(){return this.portal.user?.username??""}get selectedGroupsState(){return this.selectedGroups}get previewedGroupId(){return this.store.preview||void 0}async refresh(){await this.fetchGroups()}async clearFilters(){this.clearFiltersInternal(),await this.fetchGroups()}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.responsiveLayoutController.handleWindowResize),this.responsiveLayoutController.connect()}firstUpdated(){this.initializeBrowserState()}updated(e){e.has("view")&&(this.store.view=this.view),e.has("store")&&(this.view!==void 0&&(this.store.view=this.view),this.responsiveLayoutController.refreshStoreWatcher(),this.responsiveLayoutController.updateResponsiveLayout(),this.syncFiltersEmptyFromConfig()),e.has("filters")&&this.syncFiltersEmptyFromConfig(),e.has("selected")&&(this.selectedGroups=this.selected||[]);let r=e.get("num");r!==void 0&&r!==this.num&&this.fetchGroups(),(e.has("portal")||e.has("hasIndoorsSpaces")||e.has("filters"))&&this.updateSpecialGroupOptions(),e.has("sort")&&this.syncSortFromConfig()}disconnectedCallback(){this.responsiveLayoutController.disconnect(),window.removeEventListener("resize",this.responsiveLayoutController.handleWindowResize),super.disconnectedCallback()}syncSelectionsFromConfig(){this.selectedGroupsByUser=this.filters.groupsByUser?.props?.selectedUsername??this.currentUsername,this.selectedOwner=this.filters.owner?.props?.owner||null,this.selectedMembership=this.filters.membership?.props?.membership||null,this.selectedMemberOrg=this.filters.memberOrg?.props?.memberOrg||null,this.selectedSpecialGroup=this.filters.specialGroups?.props?.specialGroup||null,this.selectedAccess=this.filters.access?.props?.access||null}async initializeBrowserState(){this.syncSortFromConfig(),this.syncFiltersEmptyFromConfig(),this.selectedGroups=this.selected||[],this.syncSelectionsFromConfig(),await this.searchParamController.hydrateFromLocation(),await this.updateSpecialGroupOptions(!1),await this.fetchGroups()}resetSelectionByFilterId(e){switch(e){case"groupsByUser":this.selectedGroupsByUser=this.filters.groupsByUser?.props?.selectedUsername??this.currentUsername;break;case"owner":this.selectedOwner=null;break;case"membership":this.selectedMembership=null;break;case"memberOrg":this.selectedMemberOrg=null;break;case"specialGroups":this.selectedSpecialGroup=null;break;case"access":this.selectedAccess=null;break}}resetAllFilterSelections(){this.selectedGroupsByUser=this.filters.groupsByUser?.props?.selectedUsername??this.currentUsername,this.selectedOwner=null,this.selectedMembership=null,this.selectedMemberOrg=null,this.selectedSpecialGroup=null,this.selectedAccess=null}getSearchParamsSnapshot(e,r){return Fr({currentSearchParams:typeof window>"u"?void 0:new URLSearchParams(window.location.search),filters:this.store.filters,searchTerm:r,sortField:e.queryParams?.sortField,sortOrder:e.queryParams?.sortOrder})}publishFilterStateChange(){this.requestUpdate()}syncFiltersEmptyFromConfig(){let e=["created","modified","owner","membership","memberOrg","specialGroups","access","groupsByUser"].some(r=>!!this.filters[r]?.enabled);this.store.filtersEmpty=!e}syncSortFromConfig(){let e=this.sort,r=e.props?.options??ce;if(!e.enabled){this.sortField=void 0,this.sortOrder=void 0;return}if(!r.length){this.sortField=void 0,this.sortOrder=void 0;return}let s=e.props?.field,i=s&&r.includes(s)?s:r[0];this.sortField=i,this.sortOrder=e.props?.order??ne(i,this.sortOrder)}async updateSpecialGroupOptions(e=!0){if(!this.portal||!this.filters.specialGroups?.enabled){this.specialGroupOptions=[];return}let r="";try{r=await Ce(this.portal)}catch{r=""}if(this.specialGroupOptions=De.filter(s=>!(s==="openData"&&this.portal.isPortal||s==="distributed"&&this.hasIndoorsSpaces||s==="settings"&&!r)),this.selectedSpecialGroup&&!this.specialGroupOptions.includes(this.selectedSpecialGroup))if(e)this.removeFilter("specialGroups");else{let{specialGroups:s,...i}=this.store.filters;this.store.filters={...i},this.selectedSpecialGroup=null}}async applySearchParams(e){let r=Le(e);if(!this.searchTerm&&r.searchTerm&&(this.searchTerm=r.searchTerm),this.sort.enabled){let s=this.sort.props?.options??ce;r.sortField&&this.sort.props?.field===void 0&&s.includes(r.sortField)&&(this.sortField=r.sortField),r.sortOrder&&this.sort.props?.order===void 0?this.sortOrder=r.sortOrder:r.sortField&&this.sort.props?.order===void 0&&(this.sortOrder=ne(r.sortField,this.sortOrder))}await this.applyFilterSearchParams(r.filters)}async applyFilterSearchParams(e){let r={...this.store.filters},s=!1,i=j(this.portal.user);if(e.owner&&this.filters.owner?.enabled&&!this.filters.owner.props?.owner){let l=this.filters.owner.props?.username??this.currentUsername;r.owner={id:"owner",label:L(this._messages.owner.label,{label:this.getOwnerOptionLabel(e.owner,l,i)}),param:"q",value:J(e.owner,l,{isPublicUser:i,orgId:this.portal.id??""}),owner:e.owner,username:l},this.selectedOwner=e.owner,s=!0}if(e.membership&&this.filters.membership?.enabled&&!this.filters.membership.props?.membership&&(r.membership={id:"membership",label:L(this._messages.membership.label,{label:this._messages.membership[e.membership]}),param:"q",value:K(e.membership,this.hasIndoorsSpaces),membership:e.membership},this.selectedMembership=e.membership,s=!0),e.memberOrg&&this.filters.memberOrg?.enabled&&!this.filters.memberOrg.props?.memberOrg){let l=this.filters.memberOrg.props?.orgId??"";r.memberOrg={id:"memberOrg",label:L(this._messages.memberOrg.label,{label:this._messages.memberOrg[e.memberOrg]}),param:"q",value:X(e.memberOrg,l),memberOrg:e.memberOrg,orgId:l},this.selectedMemberOrg=e.memberOrg,s=!0}e.specialGroups&&this.filters.specialGroups?.enabled&&!this.filters.specialGroups.props?.specialGroup&&(r.specialGroups={id:"specialGroups",label:L(this._messages.specialGroups.label,{label:this._messages.specialGroups[e.specialGroups]}),param:"q",value:await Y(e.specialGroups,this.portal),specialGroup:e.specialGroups},this.selectedSpecialGroup=e.specialGroups,s=!0),e.access&&this.filters.access?.enabled&&!this.filters.access.props?.access&&(r.access={id:"access",label:L(this._messages.access.label,{label:this._messages.access[e.access]}),param:"q",value:Z(e.access),access:e.access},this.selectedAccess=e.access,s=!0);let n=this.getDateFilterDetailFromSearchParams("created",e.created);n&&(r.created=n,s=!0);let a=this.getDateFilterDetailFromSearchParams("modified",e.modified);a&&(r.modified=a,s=!0),s&&(this.store.filters=r,this.publishFilterStateChange())}getDateFilterDetailFromSearchParams(e,r){let s=this.filters[e];if(!s?.enabled||s.props?.range||s.props?.start||s.props?.end||!r?.range)return;let i=hr(r.range,r.start,r.end);if(!i)return;let n=this._browserMessages.filterDate[r.range],[a,l]=i;return{id:e,label:L(this._browserMessages.filterDate[e],{date:n}),param:"q",value:`(${s.props?.serverProperty??(e==="modified"?"modified":"uploaded")}:[${a} TO ${l}])`,range:r.range,start:new Date(a),end:new Date(l)}}getOwnerOptionLabel(e,r,s){return e==="owner"?r:e==="outsideOrg"&&s?this._messages.owner.someoneElse:e==="inOrg"?this._messages.owner.inOrg:this._messages.owner.outsideOrg}writeSearchParams(e){this.searchParamController.writeToLocation(e)}async fetchGroups(){this.loading=!0,this.arcgisGroupBrowserLoading.emit();let e=this.createQuery();await this.fetchAndEmit(e,this.searchTerm)}removeFilter(e){let r=this.store.filters[e];r&&(this.store.filters={...this.store.filters,[e]:Se(r)},this.resetSelectionByFilterId(e),this.publishFilterStateChange(),this.fetchGroups())}clearFiltersInternal(){this.store.filters=Pe(this.store.filters,{hiddenFilterIds:this.store.hiddenFilters}),this.resetAllFilterSelections(),this.publishFilterStateChange(),this.fetchGroups()}isFilterActive(e){let r=this.store.filters[e];return r?!!(r.value||"additionalParams"in r&&r.additionalParams):!1}setFilterSelection(e){switch(e.kind){case"owner":this.selectedOwner=e.value;break;case"membership":this.selectedMembership=e.value;break;case"memberOrg":this.selectedMemberOrg=e.value;break;case"access":this.selectedAccess=e.value;break;case"groupsByUser":this.selectedGroupsByUser=e.value;break;case"specialGroups":this.selectedSpecialGroup=e.value;break;default:N(e)}}selectGroup(e){this.isSelected(e)||(this.selectedGroups=[...this.selectedGroups,e])}deselectGroup(e){this.selectedGroups=this.selectedGroups.filter(({id:r})=>r!==e.id)}isSelected(e){return this.selectedGroups.some(({id:r})=>e.id===r)}handleGroupCardSelect(e){let{selected:r,group:s}=e.detail;switch(this.selection){case"single":this.selectedGroups=[s];break;case"multiple":r?this.selectGroup(s):this.deselectGroup(s);break;default:return}this.arcgisGroupBrowserSelect.emit(this.selectedGroups)}handleGroupCardPreview(e){let r=e.detail,s=!r?.id||this.store.preview===r.id;this.store.filtersExpanded=!1,s?this.closePreview():this.previewSessionController.handlePreview(r,e.target),this.arcgisGroupBrowserInternalUIAction.emit({action:s?"close panel":"open panel",category:"card action"})}closePreview(e={}){this.previewSessionController.closePreview(e)}async handleSortFieldChange(e){this.sortField=e,this.sortOrder=ne(e,this.sortOrder),this.loading=!0,this.arcgisGroupBrowserLoading.emit();let r=this.createQuery({start:1,total:0});await this.fetchAndEmit(r,this.searchTerm)}async handleSortOrderChange(e){this.sortOrder=e,this.loading=!0,this.arcgisGroupBrowserLoading.emit();let r=this.createQuery({start:1,total:0});await this.fetchAndEmit(r,this.searchTerm)}emitUpdate(e,r){let s=e.queryParams,i=this.getSearchParamsSnapshot(e,r),n=de(i);this.arcgisGroupBrowserUpdate.emit({queryResponse:e,sortField:s?.sortField,sortOrder:s?.sortOrder,selectedGroups:this.selectedGroups,filters:{...this.store.filters},searchTerm:r,searchParamMap:n}),this.writeSearchParams(i)}async queryGroups(e){return await(this.fetch?.(e)??lr(this.portal,e))}async fetchAndEmit(e,r){this.preflight&&(e=await this.preflight(e));let s=await this.queryGroups(e);this.store.preview&&!s.results.some(i=>i.id===this.store.preview)&&this.closePreview(),this.queryResponse=s,this.previewGroupsById=new Map(s.results.filter(i=>!!i.id).map(i=>[i.id,i])),this.browserResponse=this.getBrowserResponseFromQueryResponse(s),this.loading=!1,this.emitUpdate(s,r)}createQuery(e={}){return{filters:this.store.filters,searchUser:this.searchUser,searchTerm:e.searchTerm??this.searchTerm,baseQuery:this.q,sortField:this.sortField,sortOrder:this.sortOrder,start:e.start??1,num:e.num??this.num,total:e.total??this.queryResponse.total}}async handleSearch(e){this.searchTerm=e,this.loading=!0,this.arcgisGroupBrowserLoading.emit();let r=this.createQuery({searchTerm:e});await this.fetchAndEmit(r,e)}async handlePage({num:e,start:r,total:s}){this.loading=!0,this.arcgisGroupBrowserLoading.emit();let i=this.createQuery({start:r,num:e,total:s});await this.fetchAndEmit(i,this.searchTerm)}getBrowserResponseFromQueryResponse(e){let{nextStart:r,num:s,queryParams:i,results:n,start:a,total:l}=e??pe;return{nextStart:r??-1,num:s??i?.num??0,results:n,start:a??i?.start??1,total:l}}async formatRange({start:e,end:r,total:s}){if(this._messages._lang?.toLowerCase().startsWith("en"))return[`${e}-${r} of ${s}`,`${e}-${r} of ${s} group${s==="1"?"":"s"}`];let i=this._messages.browser,n={start:e,end:r,total:s},a=oe(i.pageRange,n),l=oe(i.pageRangeAria,n);return[a,l]}getPreviewFooterActionsEmpty(){return!this.el?.querySelector('[slot="preview-footer-action"]')}renderTopBar(){return c`<arcgis-portal-browser-top-bar slot=top-bar .store=${this.store}><slot name=top-bar-start slot=content-start></slot><arcgis-portal-browser-search slot=search .store=${this.store} .term=${this.searchTerm} .placeholder=${this.messageOverrides.searchPlaceholder} @arcgisBrowserSearch=${e=>{this.handleSearch(e.detail)}}></arcgis-portal-browser-search><slot name=top-bar-end slot=content-end></slot></arcgis-portal-browser-top-bar>`}renderEmptyTextSlot(e,r){return c`<div slot=${e??g} class="empty-text-slot"><slot name=${e??g}><p class="empty-text-slot__default">${r}</p></slot></div>`}renderDefaultContent(){let e=new Set(this.selectedGroups.map(a=>a.id)),r=!!this.el.querySelector('[slot="group-cards"]'),s=this.view??this.store.view??"list",i=this.queryResponse.results.map(a=>{let l=this.cards.group,p=typeof l=="function"?l(a):{};return{group:a,cardProps:p}}),n=i.length>0&&s==="compact";return c`<div slot=content class=${E({"group-browser__results":!0,"group-browser__results--compact":n})} .part=${"results"}>${r?c`<slot name=group-cards></slot>`:c`<slot name=group-cards>${i.map(({group:a,cardProps:l})=>{let p=a.id;return Ge(p,c`<arcgis-portal-group-card class="group-browser__result-card" .portal=${this.portal} .group=${a} .user=${l.user} .indeterminate=${l.indeterminate} .view=${s} .selection=${this.selection} .selected=${e.has(p)} .preview=${l.preview??this.preview} .previewed=${l.previewed??this.store.preview===p} .name=${l.name} .showSummary=${l.showSummary??!0} .hideBadges=${l.hideBadges??!1} .hideDateUpdated=${l.hideDateUpdated??!1} .showDateCreated=${l.showDateCreated??!1} .hideViewableBy=${l.hideViewableBy??!1} .hideOwner=${l.hideOwner??!1} .link=${l.link} .linkHandler=${l.linkHandler} .newTab=${l.newTab??!1} .disabled=${l.disabled??!1}></arcgis-portal-group-card>`)})}</slot>`}</div>`}render(){let e=this.responsiveFormFactor==="small"?"small":this.formFactor,r=this.previewGroupsById.get(this.store.preview??"");return c`<arcgis-portal-browser .store=${this.store} .response=${this.browserResponse} .loading=${this.loading} .formFactor=${e} .height=${this.height} .searchTerm=${this.searchTerm} .rangeFormatter=${this.formatRange} .selected=${this.selectedGroups} .alwaysShowSelection=${this.alwaysShowSelection} @arcgisBrowserFilterClear=${this.handleBrowserFilterClear} @arcgisBrowserFilterRemove=${this.handleBrowserFilterRemove} @arcgisPreviewClose=${s=>{s.stopPropagation(),this.closePreview({restoreFocus:!0})}} @arcgisAriaUpdate=${s=>{this.arcgisAriaUpdate.emit(s.detail)}}>${!this.hideTopBar&&c`<slot name=top-bar slot=top-bar>${this.renderTopBar()}</slot>`||""}<slot name=content-start slot=content-start></slot><slot name=selection slot=selection></slot><slot name=actions slot=actions></slot><slot name=view slot=view></slot>${Re({slot:"sort",sort:this.sort,formFactor:e,sortField:this.sortField,sortOrder:this.sortOrder,onSortFieldChange:s=>{this.handleSortFieldChange(s)},onSortOrderChange:s=>{this.handleSortOrderChange(s)}})}${this.renderDefaultContent()}${ke({slot:"pagination",store:this.store,total:this.queryResponse.total,start:this.queryResponse?.queryParams?.start??1,num:this.queryResponse?.queryParams?.num??this.num,onPage:s=>{this.handlePage(s)}})}<slot name=content-end slot=content-end></slot><slot name=preview slot=preview>${r&&c`<arcgis-portal-group-browser-preview .group=${r} .portal=${this.portal} .user=${this.portal.user??void 0} .hideBadges=${this.hidePreviewBadges} .hidePreviewFooter=${this.hidePreviewFooter} .currentResponse=${this.queryResponse} .previewFooterActionsSpaced=${!this.getPreviewFooterActionsEmpty()} @arcgisGroupBrowserInternalUIAction=${s=>{this.arcgisGroupBrowserInternalUIAction.emit(s.detail)}} @arcgisGroupBrowserPreviewClose=${()=>{this.closePreview({restoreFocus:!0})}}><slot name=preview-footer-action slot=footer-action></slot></arcgis-portal-group-browser-preview>`||""}</slot>${this.renderEmptyTextSlot("no-results",this._messages.content.noResults)}${this.renderEmptyTextSlot("no-content",this._messages.content.noContent)}<slot name=scroll-end slot=scroll-end></slot>${qe({slot:"filters",filters:this.filters,messages:this._messages,browserMessages:this._browserMessages,store:this.store,portal:this.portal,hasIndoorsSpaces:this.hasIndoorsSpaces,selectedGroupsByUser:this.selectedGroupsByUser,selectedOwner:this.selectedOwner,selectedMembership:this.selectedMembership,selectedMemberOrg:this.selectedMemberOrg,selectedSpecialGroup:this.selectedSpecialGroup,specialGroupOptions:this.specialGroupOptions,selectedAccess:this.selectedAccess,isFilterActive:s=>this.isFilterActive(s),handleSelect:s=>{this.setFilterSelection(s)},handleUserFilterChange:s=>{this.arcgisGroupBrowserUserFilterChange.emit(s)},handleRemove:s=>{this.removeFilter(s)},handleUpsert:s=>{this.store.filters={...this.store.filters,[s.id]:s},this.publishFilterStateChange(),this.fetchGroups()}})}</arcgis-portal-browser>`}};Fe("arcgis-portal-group-browser",he);return he},"intl","intl","core/reactiveUtils","intl",a,b,d,e,f,h,i,k,l,m,n,o,p,q)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import{a}from"./XH6RD5BO.js";import b from"./7DAB2CEU.js";import"./4QYVBXZT.js";import"./KV4ZZSNW.js";import"./FN2QMDEW.js";import"./B343BOVA.js";import"./G7DJPREL.js";import"./GC4BV7IZ.js";import"./AM3UTQWH.js";import"./KHKREBVZ.js";import"./5PV2GUZW.js";export default $arcgis.t(([])=>{return a},b)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{a as r}from"./Z6R3C4AK.js";import{a as g}from"./7ZWYUHGK.js";import"./A2SQ4EMZ.js";import"./K2XSYDAP.js";import{J as a,K as o,L as l,R as n,j as c,w as i}from"./AICPYLWE.js";import"./OUMTV5H5.js";import"./5PV2GUZW.js";export default $arcgis.t(([{substitute:m}])=>{var s=class extends l{constructor(){super(...arguments),this.messages=g({blocking:!0,name:"portal-account-switcher"}),this.dialogRef=a(),this.signedInAccounts=[],this.arcgisSignOutSwitchAccount=i(),this.arcgisSignOutAll=i(),this.arcgisSignOutCloseDialog=i()}static{this.properties={portal:0,signedInAccounts:0}}static{this.styles=r}render(){let{messages:t,portal:e,signedInAccounts:u}=this,d=e.user?.username??"";return c`<calcite-dialog scale=m width=s open outside-close-disabled close-disabled modal kind=success .heading=${t.signedOut} heading-level=2 @calciteDialogClose=${()=>this.arcgisSignOutCloseDialog.emit()} ${o(this.dialogRef)}><calcite-notice kind=neutral open width=full><h3 slot=title class="notice-title" .innerHTML=${m(t.signedOutHeader,{username:d})??""}></h3><p slot=message class="account-description">${t.closeWindow}</p></calcite-notice><calcite-block .heading=${t.stillSignedIn} .description=${t.clickToSwitch} expanded heading-level=3><arcgis-portal-account-switcher-list .portal=${e} .linkedAccounts=${u} .actions=${["switch"]} interactive @arcgisAccountListSwitch=${h=>{this.arcgisSignOutSwitchAccount.emit(h.detail)}}></arcgis-portal-account-switcher-list></calcite-block><calcite-button slot=footer width=full @click=${()=>this.arcgisSignOutAll.emit()}>${t.signOutAll}</calcite-button></calcite-dialog>`}};n("arcgis-portal-account-switcher-signout",s);return s},"intl")
2
+ import{a as r}from"./VFECPSKA.js";import{a as g}from"./B343BOVA.js";import"./G7DJPREL.js";import"./GC4BV7IZ.js";import{L as a,M as o,N as l,T as n,j as c,v as i}from"./AM3UTQWH.js";import"./KHKREBVZ.js";import"./5PV2GUZW.js";export default $arcgis.t(([{substitute:m}])=>{var s=class extends l{constructor(){super(...arguments),this.messages=g({blocking:!0,name:"portal-account-switcher"}),this.dialogRef=a(),this.signedInAccounts=[],this.arcgisSignOutSwitchAccount=i(),this.arcgisSignOutAll=i(),this.arcgisSignOutCloseDialog=i()}static{this.properties={portal:0,signedInAccounts:0}}static{this.styles=r}render(){let{messages:t,portal:e,signedInAccounts:u}=this,d=e.user?.username??"";return c`<calcite-dialog scale=m width=s open outside-close-disabled close-disabled modal kind=success .heading=${t.signedOut} heading-level=2 @calciteDialogClose=${()=>this.arcgisSignOutCloseDialog.emit()} ${o(this.dialogRef)}><calcite-notice kind=neutral open width=full><h3 slot=title class="notice-title" .innerHTML=${m(t.signedOutHeader,{username:d})??""}></h3><p slot=message class="account-description">${t.closeWindow}</p></calcite-notice><calcite-block .heading=${t.stillSignedIn} .description=${t.clickToSwitch} expanded heading-level=3><arcgis-portal-account-switcher-list .portal=${e} .linkedAccounts=${u} .actions=${["switch"]} interactive @arcgisAccountListSwitch=${h=>{this.arcgisSignOutSwitchAccount.emit(h.detail)}}></arcgis-portal-account-switcher-list></calcite-block><calcite-button slot=footer width=full @click=${()=>this.arcgisSignOutAll.emit()}>${t.signOutAll}</calcite-button></calcite-dialog>`}};n("arcgis-portal-account-switcher-signout",s);return s},"intl")
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import a from"./FRE56NBG.js";import"./GUL7EIJ4.js";import{a as v}from"./TWCJJCPC.js";import{a as b}from"./YZTBAUIO.js";import"./K75JTQPW.js";import"./KV4ZZSNW.js";import{b as $}from"./EMJQI4MA.js";import{a as F}from"./7ZWYUHGK.js";import"./A2SQ4EMZ.js";import"./K2XSYDAP.js";import{J as p,K as m,L as f,O as o,R as u,h as g,j as n,w as c}from"./AICPYLWE.js";import"./OUMTV5H5.js";import"./5PV2GUZW.js";export default $arcgis.t(([{a:y,b:I,c:k}])=>{var x=g`:host{display:inline-flex}.screen-readers-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}`,w=class extends f{constructor(){super(),this.messages=F({name:"portal-item-favorite",blocking:!0}),this.actionRef=p(),this.dropdownRef=p(),this.favoriteRequestId=0,this.didWarnEmptyActions=!1,this.handleFavoriteUpdate=e=>{let i=k(e,this.item.id??void 0);i&&(this.isFavorite=i.favorite)},this.isFavorite=!1,this.actions=[],this.showFavorite=!1,this.showPreview=!1,this.arcgisItemActionClick=c(),this.arcgisItemActionsOpen=c(),this.arcgisItemFavoriteUpdate=c(),this.arcgisItemActions=c(),this.listenOn(window,"arcgisItemFavoriteUpdate",this.handleFavoriteUpdate)}static{this.properties={isFavorite:16,item:0,portal:0,user:0,actions:0,keyHandler:0,label:1,showFavorite:5,showPreview:5,previewText:1,tabIndexOverride:9}}static{this.styles=x}async setFocus(){await this.actionRef.value?.setFocus()}willUpdate(e){(e.has("item")||e.has("portal")||e.has("user"))&&this.refreshFavorite()}async refreshFavorite(){if(!this.item.id||!this.portal||!this.user){this.isFavorite=!1;return}let e=++this.favoriteRequestId,i=await y(this.item.id,this.portal,this.user);e===this.favoriteRequestId&&(this.isFavorite=i)}async handleToggleFavorite(e){e.preventDefault(),e.stopPropagation();let{item:i,portal:d,user:l,isFavorite:a}=this;if(!i.id||!d||!l)return;let r={id:i.id,access:i.access},{updated:s}=await I({currentFavorite:a,item:r,portal:d,user:l});s&&(await $(300),this.isFavorite=!a,this.arcgisItemFavoriteUpdate.emit({id:i.id,favorite:this.isFavorite}))}handleActionClick(e,i){i.stopPropagation(),this.arcgisItemActionClick.emit(e.id||e.text),e.action&&(i.preventDefault(),e.action())}render(){let{item:e,actions:i,label:d,previewText:l}=this,a=i.length>0,r=this.showFavorite&&!!this.user;if(!a&&!r&&!this.showPreview&&!this.didWarnEmptyActions&&(console.warn("[arcgis-portal-item-actions] The actions menu is hidden because no actions were provided and both showFavorite/showPreview are disabled."),this.didWarnEmptyActions=!0),!a&&!r&&!this.showPreview)return null;let s=`${e.id}-title`;return n`<span class="screen-readers-only" id=${s??o}>${e.title}</span><calcite-dropdown overlay-positioning=fixed placement=bottom-end close-on-select-disabled @click=${t=>{t.stopPropagation()}} ${m(this.dropdownRef)}><calcite-action scale=s slot=trigger alignment=center .text=${d} icon=ellipsis tabindex=${this.tabIndexOverride??o} @click=${t=>{this.arcgisItemActionsOpen.emit({el:t.currentTarget})}} @keydown=${t=>{let h=this.dropdownRef.value;this.keyHandler&&h&&this.keyHandler(t,h)}} ${m(this.actionRef)}></calcite-action><calcite-dropdown-group selection-mode=none>${b(i,t=>t.id||t.text,t=>n`<calcite-dropdown-item aria-describedby=${s??o} .href=${t.link} .target=${t.newTab?"_blank":void 0} .rel=${t.newTab?"noopener noreferrer":void 0} .innerHTML=${t.text??""} @calciteDropdownItemSelect=${h=>{this.handleActionClick(t,h)}}></calcite-dropdown-item>`)}${r&&v("favorites",n`<calcite-dropdown-item aria-describedby=${s??o} @calciteDropdownItemSelect=${t=>{this.handleToggleFavorite(t)}} @click=${t=>{t.preventDefault(),t.stopPropagation()}}>${this.isFavorite?this.messages.remove:this.messages.add}</calcite-dropdown-item>`)||""}${this.showPreview&&v("preview",n`<calcite-dropdown-item id=item-preview aria-describedby=${s??o} @calciteDropdownItemSelect=${t=>{t.stopPropagation(),this.arcgisItemActionClick.emit("preview")}}>${l}</calcite-dropdown-item>`)||""}</calcite-dropdown-group></calcite-dropdown>`}};u("arcgis-portal-item-actions",w);return w},a)
2
+ import a from"./O4YFPGD5.js";import"./GUL7EIJ4.js";import{a as v}from"./DV57AOBF.js";import{a as b}from"./HBO7XTIL.js";import"./4VLEUN7I.js";import"./KV4ZZSNW.js";import{b as $}from"./FN2QMDEW.js";import{a as F}from"./B343BOVA.js";import"./G7DJPREL.js";import"./GC4BV7IZ.js";import{L as p,M as m,N as f,Q as o,T as u,h as g,j as n,v as c}from"./AM3UTQWH.js";import"./KHKREBVZ.js";import"./5PV2GUZW.js";export default $arcgis.t(([{a:y,b:I,c:k}])=>{var x=g`:host{display:inline-flex}.screen-readers-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}`,w=class extends f{constructor(){super(),this.messages=F({name:"portal-item-favorite",blocking:!0}),this.actionRef=p(),this.dropdownRef=p(),this.favoriteRequestId=0,this.didWarnEmptyActions=!1,this.handleFavoriteUpdate=e=>{let i=k(e,this.item.id??void 0);i&&(this.isFavorite=i.favorite)},this.isFavorite=!1,this.actions=[],this.showFavorite=!1,this.showPreview=!1,this.arcgisItemActionClick=c(),this.arcgisItemActionsOpen=c(),this.arcgisItemFavoriteUpdate=c(),this.arcgisItemActions=c(),this.listenOn(window,"arcgisItemFavoriteUpdate",this.handleFavoriteUpdate)}static{this.properties={isFavorite:16,item:0,portal:0,user:0,actions:0,keyHandler:0,label:1,showFavorite:5,showPreview:5,previewText:1,tabIndexOverride:9}}static{this.styles=x}async setFocus(){await this.actionRef.value?.setFocus()}willUpdate(e){(e.has("item")||e.has("portal")||e.has("user"))&&this.refreshFavorite()}async refreshFavorite(){if(!this.item.id||!this.portal||!this.user){this.isFavorite=!1;return}let e=++this.favoriteRequestId,i=await y(this.item.id,this.portal,this.user);e===this.favoriteRequestId&&(this.isFavorite=i)}async handleToggleFavorite(e){e.preventDefault(),e.stopPropagation();let{item:i,portal:d,user:l,isFavorite:a}=this;if(!i.id||!d||!l)return;let r={id:i.id,access:i.access},{updated:s}=await I({currentFavorite:a,item:r,portal:d,user:l});s&&(await $(300),this.isFavorite=!a,this.arcgisItemFavoriteUpdate.emit({id:i.id,favorite:this.isFavorite}))}handleActionClick(e,i){i.stopPropagation(),this.arcgisItemActionClick.emit(e.id||e.text),e.action&&(i.preventDefault(),e.action())}render(){let{item:e,actions:i,label:d,previewText:l}=this,a=i.length>0,r=this.showFavorite&&!!this.user;if(!a&&!r&&!this.showPreview&&!this.didWarnEmptyActions&&(console.warn("[arcgis-portal-item-actions] The actions menu is hidden because no actions were provided and both showFavorite/showPreview are disabled."),this.didWarnEmptyActions=!0),!a&&!r&&!this.showPreview)return null;let s=`${e.id}-title`;return n`<span class="screen-readers-only" id=${s??o}>${e.title}</span><calcite-dropdown overlay-positioning=fixed placement=bottom-end close-on-select-disabled @click=${t=>{t.stopPropagation()}} ${m(this.dropdownRef)}><calcite-action scale=s slot=trigger alignment=center .text=${d} icon=ellipsis tabindex=${this.tabIndexOverride??o} @click=${t=>{this.arcgisItemActionsOpen.emit({el:t.currentTarget})}} @keydown=${t=>{let h=this.dropdownRef.value;this.keyHandler&&h&&this.keyHandler(t,h)}} ${m(this.actionRef)}></calcite-action><calcite-dropdown-group selection-mode=none>${b(i,t=>t.id||t.text,t=>n`<calcite-dropdown-item aria-describedby=${s??o} .href=${t.link} .target=${t.newTab?"_blank":void 0} .rel=${t.newTab?"noopener noreferrer":void 0} .innerHTML=${t.text??""} @calciteDropdownItemSelect=${h=>{this.handleActionClick(t,h)}}></calcite-dropdown-item>`)}${r&&v("favorites",n`<calcite-dropdown-item aria-describedby=${s??o} @calciteDropdownItemSelect=${t=>{this.handleToggleFavorite(t)}} @click=${t=>{t.preventDefault(),t.stopPropagation()}}>${this.isFavorite?this.messages.remove:this.messages.add}</calcite-dropdown-item>`)||""}${this.showPreview&&v("preview",n`<calcite-dropdown-item id=item-preview aria-describedby=${s??o} @calciteDropdownItemSelect=${t=>{t.stopPropagation(),this.arcgisItemActionClick.emit("preview")}}>${l}</calcite-dropdown-item>`)||""}</calcite-dropdown-group></calcite-dropdown>`}};u("arcgis-portal-item-actions",w);return w},a)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{a as g}from"./YZTBAUIO.js";import{a as f}from"./AXOBMX3S.js";import{a as m}from"./Z6R3C4AK.js";import"./K75JTQPW.js";import"./KV4ZZSNW.js";import"./EMJQI4MA.js";import{a as d}from"./7ZWYUHGK.js";import"./A2SQ4EMZ.js";import"./K2XSYDAP.js";import{L as h,R as p,j as n,w as a}from"./AICPYLWE.js";import"./OUMTV5H5.js";import"./5PV2GUZW.js";export default $arcgis.t(([{substitute:o}])=>{var l=class extends h{constructor(){super(...arguments),this.messages=d({blocking:!0,name:"portal-account-switcher"}),this.tipReference=null,this.tooltipText="",this.linkedAccounts=[],this.interactive=!1,this.signedInUsers=[],this.accountAccess={},this.actions=[],this.arcgisAccountListSwitch=a({bubbles:!1}),this.arcgisAccountListUnlink=a()}static{this.properties={tipReference:16,tooltipText:16,portal:0,linkedAccounts:0,interactive:5,signedInUsers:0,accountAccess:0,actions:0}}static{this.styles=m}connectedCallback(){super.connectedCallback(),this.interactive&&this.actions.length===0?this.actions=["switch","unlink"]:this.interactive||(this.actions=[])}formatProvider(i){if(i.startsWith("oidc_"))return"OpenID";switch(i){case"arcgis":return"ArcGIS";case"enterprise":return"SAML";case"apple":return"Apple";case"facebook":return"Facebook";case"github":return"GitHub";case"google":return"Google";default:return"Unknown"}}formatProviderLabel(i){let{messages:e}=this;if(i.startsWith("oidc_"))return e.oidcProvider;switch(i){case"arcgis":return e.arcgisProvider;case"enterprise":return e.samlProvider;case"apple":return e.appleProvider;case"facebook":return e.facebookProvider;case"github":return e.githubProvider;case"google":return e.googleProvider;default:return"Account provider"}}formatSwitchToLabel(i,e,c=!0){let{messages:s}=this;return i.disabled?s.userDisabled:e[i.username]?.allowed??!0?c?i.orgName?o(s.switchToOrgUser,i):o(s.switchToPublicUser,i):s.switchTo:s.userNotAllowed}render(){let{linkedAccounts:i,messages:e,accountAccess:c,interactive:s,portal:$,actions:u}=this;return n`${g(i,t=>t.id??t.username,t=>n`<calcite-block .label=${t.orgName?`${t.username}, ${t.orgName}`:t.username} heading-level=4 .heading=${t.username} .description=${t.orgName?`${t.fullname}, ${t.orgName}`:t.fullname} class="linked-account"><calcite-avatar slot=content-start inert .fullName=${t.fullname} .username=${t.username} .userId=${t.id} .thumbnail=${f({fullName:t.fullname,...t},$)??void 0}></calcite-avatar><calcite-chip slot=content-end kind=neutral scale=s .label=${this.formatProviderLabel(t.provider)} class="provider-chip" @mouseenter=${r=>{this.tipReference=r.currentTarget,this.tooltipText=this.formatProviderLabel(t.provider)}} @mouseleave=${()=>{this.tipReference=null,this.tooltipText=""}}>${this.formatProvider(t.provider)}</calcite-chip>${s&&n`${u.includes("unlink")&&n`<calcite-button appearance=transparent slot=actions-end kind=danger icon-start=unlink .label=${o(t.orgName?e.unlinkOrgUser:e.unlinkPublicUser,t)} .id=${`unlink-${t.username}`} @mouseenter=${r=>{this.tipReference=r.currentTarget,this.tooltipText=e.unlinkAccount}} @mouseleave=${()=>{this.tipReference=null,this.tooltipText=""}} @focusin=${r=>{this.tipReference=r.currentTarget,this.tooltipText=e.unlinkAccount}} @focusout=${()=>{this.tipReference=null,this.tooltipText=""}} @click=${r=>{r.preventDefault(),this.arcgisAccountListUnlink.emit({account:t})}}></calcite-button>`||""}${u.includes("switch")&&n`<calcite-button appearance=transparent slot=actions-end kind=neutral icon-start=sign-in .label=${this.formatSwitchToLabel(t,c)} .disabled=${t.disabled||!(c[t.username]?.allowed??!0)} .id=${`switch-${t.username}`} @mouseenter=${r=>{this.tipReference=r.currentTarget,this.tooltipText=this.formatSwitchToLabel(t,c,!1)}} @mouseleave=${()=>{this.tipReference=null,this.tooltipText=""}} @focusin=${r=>{this.tipReference=r.currentTarget,this.tooltipText=this.formatSwitchToLabel(t,c,!1)}} @focusout=${()=>{this.tipReference=null,this.tooltipText=""}} @click=${r=>{r.preventDefault(),this.arcgisAccountListSwitch.emit({account:t})}}></calcite-button>`||""}`||""}</calcite-block>`)}<calcite-tooltip .open=${!!this.tipReference} .referenceElement=${this.tipReference}>${this.tooltipText}</calcite-tooltip>`}};p("arcgis-portal-account-switcher-list",l);return l},"intl")
2
+ import{a as g}from"./HBO7XTIL.js";import{a as f}from"./NLFBHNSX.js";import{a as m}from"./VFECPSKA.js";import"./4VLEUN7I.js";import"./KV4ZZSNW.js";import"./FN2QMDEW.js";import{a as d}from"./B343BOVA.js";import"./G7DJPREL.js";import"./GC4BV7IZ.js";import{N as h,T as p,j as n,v as a}from"./AM3UTQWH.js";import"./KHKREBVZ.js";import"./5PV2GUZW.js";export default $arcgis.t(([{substitute:o}])=>{var l=class extends h{constructor(){super(...arguments),this.messages=d({blocking:!0,name:"portal-account-switcher"}),this.tipReference=null,this.tooltipText="",this.linkedAccounts=[],this.interactive=!1,this.signedInUsers=[],this.accountAccess={},this.actions=[],this.arcgisAccountListSwitch=a({bubbles:!1}),this.arcgisAccountListUnlink=a()}static{this.properties={tipReference:16,tooltipText:16,portal:0,linkedAccounts:0,interactive:5,signedInUsers:0,accountAccess:0,actions:0}}static{this.styles=m}connectedCallback(){super.connectedCallback(),this.interactive&&this.actions.length===0?this.actions=["switch","unlink"]:this.interactive||(this.actions=[])}formatProvider(i){if(i.startsWith("oidc_"))return"OpenID";switch(i){case"arcgis":return"ArcGIS";case"enterprise":return"SAML";case"apple":return"Apple";case"facebook":return"Facebook";case"github":return"GitHub";case"google":return"Google";default:return"Unknown"}}formatProviderLabel(i){let{messages:e}=this;if(i.startsWith("oidc_"))return e.oidcProvider;switch(i){case"arcgis":return e.arcgisProvider;case"enterprise":return e.samlProvider;case"apple":return e.appleProvider;case"facebook":return e.facebookProvider;case"github":return e.githubProvider;case"google":return e.googleProvider;default:return"Account provider"}}formatSwitchToLabel(i,e,c=!0){let{messages:s}=this;return i.disabled?s.userDisabled:e[i.username]?.allowed??!0?c?i.orgName?o(s.switchToOrgUser,i):o(s.switchToPublicUser,i):s.switchTo:s.userNotAllowed}render(){let{linkedAccounts:i,messages:e,accountAccess:c,interactive:s,portal:$,actions:u}=this;return n`${g(i,t=>t.id??t.username,t=>n`<calcite-block .label=${t.orgName?`${t.username}, ${t.orgName}`:t.username} heading-level=4 .heading=${t.username} .description=${t.orgName?`${t.fullname}, ${t.orgName}`:t.fullname} class="linked-account"><calcite-avatar slot=content-start inert .fullName=${t.fullname} .username=${t.username} .userId=${t.id} .thumbnail=${f({fullName:t.fullname,...t},$)??void 0}></calcite-avatar><calcite-chip slot=content-end kind=neutral scale=s .label=${this.formatProviderLabel(t.provider)} class="provider-chip" @mouseenter=${r=>{this.tipReference=r.currentTarget,this.tooltipText=this.formatProviderLabel(t.provider)}} @mouseleave=${()=>{this.tipReference=null,this.tooltipText=""}}>${this.formatProvider(t.provider)}</calcite-chip>${s&&n`${u.includes("unlink")&&n`<calcite-button appearance=transparent slot=actions-end kind=danger icon-start=unlink .label=${o(t.orgName?e.unlinkOrgUser:e.unlinkPublicUser,t)} .id=${`unlink-${t.username}`} @mouseenter=${r=>{this.tipReference=r.currentTarget,this.tooltipText=e.unlinkAccount}} @mouseleave=${()=>{this.tipReference=null,this.tooltipText=""}} @focusin=${r=>{this.tipReference=r.currentTarget,this.tooltipText=e.unlinkAccount}} @focusout=${()=>{this.tipReference=null,this.tooltipText=""}} @click=${r=>{r.preventDefault(),this.arcgisAccountListUnlink.emit({account:t})}}></calcite-button>`||""}${u.includes("switch")&&n`<calcite-button appearance=transparent slot=actions-end kind=neutral icon-start=sign-in .label=${this.formatSwitchToLabel(t,c)} .disabled=${t.disabled||!(c[t.username]?.allowed??!0)} .id=${`switch-${t.username}`} @mouseenter=${r=>{this.tipReference=r.currentTarget,this.tooltipText=this.formatSwitchToLabel(t,c,!1)}} @mouseleave=${()=>{this.tipReference=null,this.tooltipText=""}} @focusin=${r=>{this.tipReference=r.currentTarget,this.tooltipText=this.formatSwitchToLabel(t,c,!1)}} @focusout=${()=>{this.tipReference=null,this.tooltipText=""}} @click=${r=>{r.preventDefault(),this.arcgisAccountListSwitch.emit({account:t})}}></calcite-button>`||""}`||""}</calcite-block>`)}<calcite-tooltip .open=${!!this.tipReference} .referenceElement=${this.tipReference}>${this.tooltipText}</calcite-tooltip>`}};p("arcgis-portal-account-switcher-list",l);return l},"intl")
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import d from"./US37IXWO.js";import b from"./CJ4S56BE.js";import"./4KTRAA2J.js";import"./4VLEUN7I.js";import"./KV4ZZSNW.js";import"./FN2QMDEW.js";import{a as h}from"./B343BOVA.js";import"./G7DJPREL.js";import"./GC4BV7IZ.js";import{N as c,O as p,Q as a,T as n,U as m,h as l,j as t}from"./AM3UTQWH.js";import"./KHKREBVZ.js";import"./5PV2GUZW.js";export default $arcgis.t(([,{b:g}])=>{var z=l`:host{display:inline-flex;align-items:center}:host([scale="s"]){--arcgis-portal-item-type-font-size: var(--calcite-font-size--2);--arcgis-portal-item-type-spacing: 1rem}:host([scale="m"]){--arcgis-portal-item-type-font-size: var(--calcite-font-size--1);--arcgis-portal-item-type-spacing: 1rem}:host([scale="l"]){--arcgis-portal-item-type-font-size: var(--calcite-font-size-0);--arcgis-portal-item-type-spacing: 1rem}.icon{display:block;flex-grow:0;flex-shrink:0;width:var(--arcgis-portal-item-type-spacing);height:var(--arcgis-portal-item-type-spacing)}.text{color:var(--calcite-text-color-2);font-size:var(--arcgis-portal-item-type-font-size);line-height:1.25rem}.text--ellipsis{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.text--spaced{margin-inline-start:calc(var(--arcgis-portal-item-type-spacing) / 2);word-wrap:break-word;word-break:break-word}`,r=class extends c{constructor(){super(...arguments),this.messages=h({blocking:!0}),this.scale="s"}static{this.properties={displayInfo:16,item:0,serviceInfo:0,portal:0,user:0,scale:3,hideText:5,hideIcon:5,ellipsis:5,showHosted:5}}static{this.styles=z}willUpdate(s){let e=this.messages._lang;(s.has("item")||s.has("serviceInfo")||s.has("portal")||s.has("user")||e!==this.displayLanguage)&&(this.displayLanguage=e,this.displayInfo=this.item&&e?g({item:this.item,messages:this.messages,serviceInfo:this.serviceInfo,portal:this.portal??this.item.portal,user:this.user}):void 0)}render(){let{displayInfo:s,showHosted:e,scale:d,hideText:f,hideIcon:o,ellipsis:y}=this;if(!s)return null;let{icon:v,displayName:x,displayNameHosted:u}=s,i=e?u:x,w=i?.includes("(")?"":"&#x202D;",$=m(`./assets/portal-item-type/icons/${v}16.svg`),I=this.hideText?i:void 0;return t`${!o&&t`<span class="icon"><img src=${$??a} alt=${(I||"")??a} class=${`icon icon--${d}`}></span>`||""}${!f&&t`<span class=${p({text:!0,"text--spaced":!o,"text--ellipsis":y})} .innerHTML=${`${w}${i}`}></span>`||""}`}};n("arcgis-portal-item-type",r);return r},b,d)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import d from"./PJZZIITX.js";import"./JLT5GCLY.js";import c from"./365ICWHN.js";import b from"./TIPQ2ZWK.js";import"./NLFBHNSX.js";import a from"./OQ2JULON.js";import"./4VLEUN7I.js";import"./KV4ZZSNW.js";import"./FN2QMDEW.js";import"./B343BOVA.js";import"./G7DJPREL.js";import"./GC4BV7IZ.js";import"./AM3UTQWH.js";import"./KHKREBVZ.js";import"./5PV2GUZW.js";export default $arcgis.t(([,,,a])=>{return a},a,b,c,d)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import{a as c}from"./4KTRAA2J.js";import{a as o}from"./4VLEUN7I.js";export default $arcgis.t(([a])=>{function v(e,n){return`${o(n)}content/items/${e}`}function h(e){return e.typeKeywords?.includes("Hosted Service")&&e.type!=="Insights Workbook"&&e.type!=="Insights Data Engineering Workbook"&&e.type!=="Insights Page"}function P(e){return e.typeKeywords?.includes("View Service")}function S(e){return e?.type==="Geoprocessing Service"}function I(e){return e.typeKeywords?.includes("Service Proxy")&&e.typeKeywords.includes("Geocoding filter")}function K(e){return e.type==="Image Collection"&&e.typeKeywords?.includes("Photo locations")}function y(e){return!!e&&("sourceType"in e&&e.sourceType==="mosaic-dataset"||"serviceSourceType"in e&&e.serviceSourceType==="esriImageServiceSourceTypeMosaicDataset")}function T(e,n){return e.typeKeywords?.includes("Managed Image Collection")||y(n)&&!e.typeKeywords?.includes("Tiled Imagery")}function j(e,n){let r="serviceProperties"in e?e.serviceProperties:void 0,t=r&&typeof r=="object"&&"tags"in r?r.tags:void 0,s=c(e).serviceProperties?.tags??t;return!!(Array.isArray(s)&&s.includes("hasMultidimensions")||n&&"hasMultidimensions"in n&&n.hasMultidimensions)}function k(e,n){return u(e,n)||m(e,n)}function u(e,n){return e.owner===n.username}function m(e,n){let r=e.owner,t=e.itemControl==="admin",s=["esri_livingatlas","esri_demographics","esri_boundaries"];return e.portal?.isPortal&&!u(e,n)&&t&&r?.includes("esri_")&&!s.includes(r)?!1:t}var $=(e,n)=>!!n.orgId&&e.every(r=>r.isOrgItem);function b(e){return e.typeKeywords?.includes("Spatiotemporal")}function M(e){return e.typeKeywords?.includes("View Service")}function q(e){return e.typeKeywords?.includes("Hosted Service")}function C(e){return e.typeKeywords?.includes("Multi Services View")}function V(e){return e?.hasViews&&!e.sourceSchemaChangesAllowed}async function A(e){let n=e?.portalItem;if(!n)return await Promise.resolve(null);let r=n.portal;if(r?.user){let t=`${o(r)}community/users/${r.user.username}`;return await a(t,{query:{f:"json",token:n.portal.credential?.token},responseType:"json"}).then(async s=>{let i=s.data?.groups??[];return await Promise.resolve(i)},async()=>await Promise.reject(new Error("Failed to fetch user groups")))}return await Promise.resolve(null)}async function _(e){let n=e?.portalItem;if(!n)return await Promise.resolve(null);let r=n.portal,t=`${o(r)}content/items/${n.id}/groups`;return await a(t,{query:{f:"json",token:n.portal.credential?.token},responseType:"json"}).then(async s=>{let i=s.data?.admin??[],l=s.data?.member??[],d=s.data?.other??[],p=[...i,...l,...d];return await Promise.resolve(p)},async()=>await Promise.reject(new Error("Failed to fetch item groups")))}async function E(e,n,{relationshipType:r,direction:t},s=!1){let i=`${o(n)}content/items/${e}/relatedItems`;return await a(i,{query:{f:"json",relationshipType:r,direction:t,includeRecycleBin:s},responseType:"json"})}function G(e,n){return e?.some(r=>n?.some(t=>r.id===t.id&&r.capabilities.includes("updateitemcontrol")))}return{a:v,b:h,c:P,d:S,e:I,f:K,g:T,h:j,i:k,j:$,k:b,l:M,m:q,n:C,o:V,p:A,q:_,r:E,s:G}},"request")
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{A as n,B as o,C as a,l as r,m as s}from"./AICPYLWE.js";var i=class extends a{constructor(t){if(super(t),this.it=s,t.type!==n.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===s||t==null)return this._t=void 0,this.it=t;if(t===r)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;let e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};i.directiveName="unsafeHTML",i.resultType=1;var f=o(i);export{f as a};
2
+ import{A as o,B as a,l as r,m as s,z as n}from"./AM3UTQWH.js";var i=class extends a{constructor(t){if(super(t),this.it=s,t.type!==n.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===s||t==null)return this._t=void 0,this.it=t;if(t===r)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;let e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};i.directiveName="unsafeHTML",i.resultType=1;var f=o(i);export{f as a};