@scalar/agent-chat 0.1.2

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 (157) hide show
  1. package/dist/App.vue.d.ts +10 -0
  2. package/dist/App.vue.d.ts.map +1 -0
  3. package/dist/App.vue.js +23 -0
  4. package/dist/App.vue.js.map +1 -0
  5. package/dist/App.vue2.js +5 -0
  6. package/dist/App.vue2.js.map +1 -0
  7. package/dist/Chat.vue.d.ts +3 -0
  8. package/dist/Chat.vue.d.ts.map +1 -0
  9. package/dist/Chat.vue.js +55 -0
  10. package/dist/Chat.vue.js.map +1 -0
  11. package/dist/Chat.vue2.js +5 -0
  12. package/dist/Chat.vue2.js.map +1 -0
  13. package/dist/_virtual/_plugin-vue_export-helper.js +11 -0
  14. package/dist/_virtual/_plugin-vue_export-helper.js.map +1 -0
  15. package/dist/components/ContextItem.vue.d.ts +16 -0
  16. package/dist/components/ContextItem.vue.d.ts.map +1 -0
  17. package/dist/components/ContextItem.vue.js +8 -0
  18. package/dist/components/ContextItem.vue.js.map +1 -0
  19. package/dist/components/ContextItem.vue2.js +22 -0
  20. package/dist/components/ContextItem.vue2.js.map +1 -0
  21. package/dist/components/Endpoint.vue.d.ts +9 -0
  22. package/dist/components/Endpoint.vue.d.ts.map +1 -0
  23. package/dist/components/Endpoint.vue.js +8 -0
  24. package/dist/components/Endpoint.vue.js.map +1 -0
  25. package/dist/components/Endpoint.vue2.js +98 -0
  26. package/dist/components/Endpoint.vue2.js.map +1 -0
  27. package/dist/components/LoadingMiniOpenAPIDoc.vue.d.ts +3 -0
  28. package/dist/components/LoadingMiniOpenAPIDoc.vue.d.ts.map +1 -0
  29. package/dist/components/LoadingMiniOpenAPIDoc.vue.js +32 -0
  30. package/dist/components/LoadingMiniOpenAPIDoc.vue.js.map +1 -0
  31. package/dist/components/Logo.vue.d.ts +3 -0
  32. package/dist/components/Logo.vue.d.ts.map +1 -0
  33. package/dist/components/Logo.vue.js +25 -0
  34. package/dist/components/Logo.vue.js.map +1 -0
  35. package/dist/components/SendingRequest.vue.d.ts +3 -0
  36. package/dist/components/SendingRequest.vue.d.ts.map +1 -0
  37. package/dist/components/SendingRequest.vue.js +26 -0
  38. package/dist/components/SendingRequest.vue.js.map +1 -0
  39. package/dist/components/Suggestion.vue.d.ts +10 -0
  40. package/dist/components/Suggestion.vue.d.ts.map +1 -0
  41. package/dist/components/Suggestion.vue.js +8 -0
  42. package/dist/components/Suggestion.vue.js.map +1 -0
  43. package/dist/components/Suggestion.vue2.js +28 -0
  44. package/dist/components/Suggestion.vue2.js.map +1 -0
  45. package/dist/components/TestRequestButton.vue.d.ts +8 -0
  46. package/dist/components/TestRequestButton.vue.d.ts.map +1 -0
  47. package/dist/components/TestRequestButton.vue.js +8 -0
  48. package/dist/components/TestRequestButton.vue.js.map +1 -0
  49. package/dist/components/TestRequestButton.vue2.js +37 -0
  50. package/dist/components/TestRequestButton.vue2.js.map +1 -0
  51. package/dist/helpers.d.ts +39 -0
  52. package/dist/helpers.d.ts.map +1 -0
  53. package/dist/helpers.js +111 -0
  54. package/dist/helpers.js.map +1 -0
  55. package/dist/hooks/useActiveServer.d.ts +2 -0
  56. package/dist/hooks/useActiveServer.d.ts.map +1 -0
  57. package/dist/hooks/useActiveServer.js +20 -0
  58. package/dist/hooks/useActiveServer.js.map +1 -0
  59. package/dist/hooks/useChatOperationBlocks.d.ts +3 -0
  60. package/dist/hooks/useChatOperationBlocks.d.ts.map +1 -0
  61. package/dist/hooks/useChatOperationBlocks.js +29 -0
  62. package/dist/hooks/useChatOperationBlocks.js.map +1 -0
  63. package/dist/hooks/useChatScroll.d.ts +2 -0
  64. package/dist/hooks/useChatScroll.d.ts.map +1 -0
  65. package/dist/hooks/useChatScroll.js +22 -0
  66. package/dist/hooks/useChatScroll.js.map +1 -0
  67. package/dist/hooks/useSecuritySchemes.d.ts +2 -0
  68. package/dist/hooks/useSecuritySchemes.d.ts.map +1 -0
  69. package/dist/hooks/useSecuritySchemes.js +29 -0
  70. package/dist/hooks/useSecuritySchemes.js.map +1 -0
  71. package/dist/index.d.ts +2 -0
  72. package/dist/index.d.ts.map +1 -0
  73. package/dist/index.js +5 -0
  74. package/dist/index.js.map +1 -0
  75. package/dist/node_modules/.pnpm/zod@4.1.11/node_modules/zod/v4/core/api.js +11 -0
  76. package/dist/node_modules/.pnpm/zod@4.1.11/node_modules/zod/v4/core/api.js.map +1 -0
  77. package/dist/node_modules/.pnpm/zod@4.1.11/node_modules/zod/v4/core/core.js +58 -0
  78. package/dist/node_modules/.pnpm/zod@4.1.11/node_modules/zod/v4/core/core.js.map +1 -0
  79. package/dist/node_modules/.pnpm/zod@4.1.11/node_modules/zod/v4/core/errors.js +25 -0
  80. package/dist/node_modules/.pnpm/zod@4.1.11/node_modules/zod/v4/core/errors.js.map +1 -0
  81. package/dist/node_modules/.pnpm/zod@4.1.11/node_modules/zod/v4/core/parse.js +64 -0
  82. package/dist/node_modules/.pnpm/zod@4.1.11/node_modules/zod/v4/core/parse.js.map +1 -0
  83. package/dist/node_modules/.pnpm/zod@4.1.11/node_modules/zod/v4/core/regexes.js +8 -0
  84. package/dist/node_modules/.pnpm/zod@4.1.11/node_modules/zod/v4/core/regexes.js.map +1 -0
  85. package/dist/node_modules/.pnpm/zod@4.1.11/node_modules/zod/v4/core/schemas.js +181 -0
  86. package/dist/node_modules/.pnpm/zod@4.1.11/node_modules/zod/v4/core/schemas.js.map +1 -0
  87. package/dist/node_modules/.pnpm/zod@4.1.11/node_modules/zod/v4/core/util.js +61 -0
  88. package/dist/node_modules/.pnpm/zod@4.1.11/node_modules/zod/v4/core/util.js.map +1 -0
  89. package/dist/node_modules/.pnpm/zod@4.1.11/node_modules/zod/v4/core/versions.js +9 -0
  90. package/dist/node_modules/.pnpm/zod@4.1.11/node_modules/zod/v4/core/versions.js.map +1 -0
  91. package/dist/node_modules/.pnpm/zod@4.1.11/node_modules/zod/v4/mini/schemas.js +60 -0
  92. package/dist/node_modules/.pnpm/zod@4.1.11/node_modules/zod/v4/mini/schemas.js.map +1 -0
  93. package/dist/package.json +63 -0
  94. package/dist/registry/get-document.d.ts +4 -0
  95. package/dist/registry/get-document.d.ts.map +1 -0
  96. package/dist/registry/get-document.js +23 -0
  97. package/dist/registry/get-document.js.map +1 -0
  98. package/dist/state/state.d.ts +47 -0
  99. package/dist/state/state.d.ts.map +1 -0
  100. package/dist/state/state.js +107 -0
  101. package/dist/state/state.js.map +1 -0
  102. package/dist/style.css +12261 -0
  103. package/dist/views/Auth.vue.d.ts +17 -0
  104. package/dist/views/Auth.vue.d.ts.map +1 -0
  105. package/dist/views/Auth.vue.js +71 -0
  106. package/dist/views/Auth.vue.js.map +1 -0
  107. package/dist/views/Auth.vue2.js +5 -0
  108. package/dist/views/Auth.vue2.js.map +1 -0
  109. package/dist/views/Chat/Chat.vue.d.ts +7 -0
  110. package/dist/views/Chat/Chat.vue.d.ts.map +1 -0
  111. package/dist/views/Chat/Chat.vue.js +8 -0
  112. package/dist/views/Chat/Chat.vue.js.map +1 -0
  113. package/dist/views/Chat/Chat.vue2.js +72 -0
  114. package/dist/views/Chat/Chat.vue2.js.map +1 -0
  115. package/dist/views/Chat/Messages/ExecuteRequestTool.vue.d.ts +10 -0
  116. package/dist/views/Chat/Messages/ExecuteRequestTool.vue.d.ts.map +1 -0
  117. package/dist/views/Chat/Messages/ExecuteRequestTool.vue.js +8 -0
  118. package/dist/views/Chat/Messages/ExecuteRequestTool.vue.js.map +1 -0
  119. package/dist/views/Chat/Messages/ExecuteRequestTool.vue2.js +62 -0
  120. package/dist/views/Chat/Messages/ExecuteRequestTool.vue2.js.map +1 -0
  121. package/dist/views/Chat/Messages/GetMiniOpenAPIDocTool.vue.d.ts +11 -0
  122. package/dist/views/Chat/Messages/GetMiniOpenAPIDocTool.vue.d.ts.map +1 -0
  123. package/dist/views/Chat/Messages/GetMiniOpenAPIDocTool.vue.js +8 -0
  124. package/dist/views/Chat/Messages/GetMiniOpenAPIDocTool.vue.js.map +1 -0
  125. package/dist/views/Chat/Messages/GetMiniOpenAPIDocTool.vue2.js +66 -0
  126. package/dist/views/Chat/Messages/GetMiniOpenAPIDocTool.vue2.js.map +1 -0
  127. package/dist/views/Chat/Messages/Text.vue.d.ts +8 -0
  128. package/dist/views/Chat/Messages/Text.vue.d.ts.map +1 -0
  129. package/dist/views/Chat/Messages/Text.vue.js +21 -0
  130. package/dist/views/Chat/Messages/Text.vue.js.map +1 -0
  131. package/dist/views/Chat/Messages/Text.vue2.js +5 -0
  132. package/dist/views/Chat/Messages/Text.vue2.js.map +1 -0
  133. package/dist/views/Layout.vue.d.ts +7 -0
  134. package/dist/views/Layout.vue.d.ts.map +1 -0
  135. package/dist/views/Layout.vue.js +8 -0
  136. package/dist/views/Layout.vue.js.map +1 -0
  137. package/dist/views/Layout.vue2.js +32 -0
  138. package/dist/views/Layout.vue2.js.map +1 -0
  139. package/dist/views/PromptForm.vue.d.ts +10 -0
  140. package/dist/views/PromptForm.vue.d.ts.map +1 -0
  141. package/dist/views/PromptForm.vue.js +8 -0
  142. package/dist/views/PromptForm.vue.js.map +1 -0
  143. package/dist/views/PromptForm.vue2.js +125 -0
  144. package/dist/views/PromptForm.vue2.js.map +1 -0
  145. package/dist/views/Settings.vue.d.ts +7 -0
  146. package/dist/views/Settings.vue.d.ts.map +1 -0
  147. package/dist/views/Settings.vue.js +9 -0
  148. package/dist/views/Settings.vue.js.map +1 -0
  149. package/dist/views/Settings.vue2.js +81 -0
  150. package/dist/views/Settings.vue2.js.map +1 -0
  151. package/dist/views/Start.vue.d.ts +7 -0
  152. package/dist/views/Start.vue.d.ts.map +1 -0
  153. package/dist/views/Start.vue.js +8 -0
  154. package/dist/views/Start.vue.js.map +1 -0
  155. package/dist/views/Start.vue2.js +57 -0
  156. package/dist/views/Start.vue2.js.map +1 -0
  157. package/package.json +63 -0
@@ -0,0 +1,37 @@
1
+ import { defineComponent, ref, createElementBlock, openBlock, withModifiers, createVNode, createElementVNode, unref } from "vue";
2
+ import { ScalarIconPlay } from "@scalar/icons";
3
+ import { emitCustomEvent } from "@scalar/workspace-store/events";
4
+ const _hoisted_1 = ["method"];
5
+ const _sfc_main = /* @__PURE__ */ defineComponent({
6
+ __name: "TestRequestButton",
7
+ props: {
8
+ method: {},
9
+ path: {}
10
+ },
11
+ setup(__props) {
12
+ const el = ref(null);
13
+ const handleClick = () => {
14
+ emitCustomEvent(el.value, "scalar-open-client", { method: __props.method, path: __props.path });
15
+ };
16
+ return (_ctx, _cache) => {
17
+ return openBlock(), createElementBlock("button", {
18
+ ref_key: "el",
19
+ ref: el,
20
+ class: "show-api-client-button",
21
+ method: _ctx.method,
22
+ type: "button",
23
+ onClick: withModifiers(handleClick, ["stop"])
24
+ }, [
25
+ createVNode(unref(ScalarIconPlay), {
26
+ class: "size-3",
27
+ weight: "fill"
28
+ }),
29
+ _cache[0] || (_cache[0] = createElementVNode("span", null, "Test Request", -1))
30
+ ], 8, _hoisted_1);
31
+ };
32
+ }
33
+ });
34
+ export {
35
+ _sfc_main as default
36
+ };
37
+ //# sourceMappingURL=TestRequestButton.vue2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TestRequestButton.vue2.js","sources":["../../src/components/TestRequestButton.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ref } from 'vue'\n\nimport type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport { ScalarIconPlay } from '@scalar/icons'\nimport { emitCustomEvent } from '@scalar/workspace-store/events'\n\nconst { method, path } = defineProps<{\n method: HttpMethod\n path: string\n}>()\n\nconst el = ref<HTMLElement | null>(null)\nconst handleClick = () => {\n emitCustomEvent(el.value, 'scalar-open-client', { method, path })\n}\n</script>\n<template>\n <!-- Render the Test Request Button -->\n <button\n ref=\"el\"\n class=\"show-api-client-button\"\n :method=\"method\"\n type=\"button\"\n @click.stop=\"handleClick\">\n <ScalarIconPlay\n class=\"size-3\"\n weight=\"fill\" />\n <span>Test Request</span>\n </button>\n</template>\n<style scoped>\n.show-api-client-button {\n appearance: none;\n border: none;\n padding: 1px 6px;\n white-space: nowrap;\n border-radius: var(--scalar-radius);\n display: flex;\n justify-content: center;\n align-items: center;\n font-weight: var(--scalar-semibold);\n font-size: var(--scalar-small);\n line-height: 22px;\n color: var(--scalar-background-2);\n font-family: var(--scalar-font);\n background: var(--scalar-button-1);\n cursor: pointer;\n box-sizing: border-box;\n box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);\n\n outline-offset: 2px;\n}\n.show-api-client-button span,\n.show-api-client-button svg {\n fill: currentColor;\n color: var(--scalar-button-1-color);\n z-index: 1;\n}\n.show-api-client-button:hover {\n background: var(--scalar-button-1-hover);\n}\n.show-api-client-button svg {\n margin-right: 4px;\n}\n</style>\n"],"names":["_createElementBlock","method","_createVNode","_unref","_createElementVNode"],"mappings":";;;;;;;;;;;AAYA,UAAM,KAAK,IAAwB,IAAI;AACvC,UAAM,cAAc,MAAM;AACxB,sBAAgB,GAAG,OAAO,sBAAsB,EAAE,QAAK,QAAA,QAAG,MAAG,QAAA,KAAA,CAAG;AAAA,IAClE;;0BAIEA,mBAUS,UAAA;AAAA,iBATH;AAAA,QAAJ,KAAI;AAAA,QACJ,OAAM;AAAA,QACL,QAAQC,KAAAA;AAAAA,QACT,MAAK;AAAA,QACJ,uBAAY,aAAW,CAAA,MAAA,CAAA;AAAA,MAAA;QACxBC,YAEkBC,MAAA,cAAA,GAAA;AAAA,UADhB,OAAM;AAAA,UACN,QAAO;AAAA,QAAA;QACT,OAAA,CAAA,MAAA,OAAA,CAAA,IAAAC,mBAAyB,cAAnB,gBAAY,EAAA;AAAA,MAAA;;;;"}
@@ -0,0 +1,39 @@
1
+ import type { ToolUIPart, UIDataTypes, UIMessagePart } from 'ai';
2
+ import type { MergedSecuritySchemes } from '@scalar/api-client/v2/blocks/scalar-auth-selector-block';
3
+ import type { OpenAPIV3_1 } from '@scalar/openapi-types';
4
+ import type { AuthenticationConfiguration } from '@scalar/types/api-reference';
5
+ import type { OpenApiDocument, OperationObject, ParameterObject, PathItemObject, SecurityRequirementObject, SecuritySchemeObject, ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
6
+ import type { Tools } from './state/state.js';
7
+ /** Combine pathItem and operation parameters into a single, dereferenced parameter array */
8
+ export declare const combineParams: (pathParams?: PathItemObject["parameters"], operationParams?: OperationObject["parameters"]) => ParameterObject[];
9
+ /**
10
+ * Iterate through all available servers and pick the first one
11
+ *
12
+ * @example
13
+ * getFirstServer([operation.servers, pathItem.servers, server])
14
+ */
15
+ export declare function getFirstServer(...availableServers: (ServerObject[] | ServerObject | undefined | null)[]): ServerObject | undefined;
16
+ /** Determine if a message part is a tool */
17
+ export declare function isToolPart(part: UIMessagePart<UIDataTypes, Tools>): part is ToolUIPart<Tools>;
18
+ /**
19
+ * Extracts the default scopes for a security scheme.
20
+ * Only OAuth2 schemes can have default scopes via the x-default-scopes extension.
21
+ */
22
+ export declare const getDefaultScopes: (scheme: SecuritySchemeObject | undefined) => string[];
23
+ /**
24
+ * Determines the default security scheme to use for an operation.
25
+ *
26
+ * Priority order:
27
+ * 1. User-configured preferred security scheme (if provided)
28
+ * 2. First security requirement from the OpenAPI spec
29
+ * 3. null (no security required)
30
+ */
31
+ export declare const getDefaultSecurity: (securityRequirements: SecurityRequirementObject[], preferredSecurityScheme: AuthenticationConfiguration["preferredSecurityScheme"], securitySchemes: MergedSecuritySchemes) => SecurityRequirementObject | null;
32
+ /**
33
+ * Find the intersection between which security is selected on the document and what this operation requires
34
+ *
35
+ * If there is no overlap, we return the first requirement
36
+ */
37
+ export declare const filterSelectedSecurity: (document: OpenApiDocument, operation: OperationObject | null, securitySchemes?: MergedSecuritySchemes) => SecuritySchemeObject[];
38
+ export declare function getOperations(doc: Partial<OpenAPIV3_1.Document>): OperationObject[];
39
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,IAAI,CAAA;AAGhE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yDAAyD,CAAA;AAGpG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAA;AAG9E,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EACf,eAAe,EACf,cAAc,EACd,yBAAyB,EACzB,oBAAoB,EACpB,YAAY,EACb,MAAM,8DAA8D,CAAA;AAErE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAE1C,4FAA4F;AAC5F,eAAO,MAAM,aAAa,GACxB,aAAY,cAAc,CAAC,YAAY,CAAM,EAC7C,kBAAiB,eAAe,CAAC,YAAY,CAAM,KAClD,eAAe,EAgBjB,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,GAAG,gBAAgB,EAAE,CAAC,YAAY,EAAE,GAAG,YAAY,GAAG,SAAS,GAAG,IAAI,CAAC,EAAE,GACxE,YAAY,GAAG,SAAS,CAyB1B;AAED,4CAA4C;AAC5C,wBAAgB,UAAU,CACxB,IAAI,EAAE,aAAa,CAAC,WAAW,EAAE,KAAK,CAAC,GACtC,IAAI,IAAI,UAAU,CAAC,KAAK,CAAC,CAE3B;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAC3B,QAAQ,oBAAoB,GAAG,SAAS,KACvC,MAAM,EAMR,CAAA;AA2CD;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,GAC7B,sBAAsB,yBAAyB,EAAE,EACjD,yBAAyB,2BAA2B,CAAC,yBAAyB,CAAC,EAC/E,iBAAiB,qBAAqB,KACrC,yBAAyB,GAAG,IAc9B,CAAA;AAMD;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GACjC,UAAU,eAAe,EACzB,WAAW,eAAe,GAAG,IAAI,EACjC,kBAAiB,qBAA0B,KAC1C,oBAAoB,EAsCtB,CAAA;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,GAGzD,eAAe,EAAE,CACvB"}
@@ -0,0 +1,111 @@
1
+ import { getSecuritySchemes } from "@scalar/api-client/v2/blocks/operation-block";
2
+ import { getSelectedSecurity } from "@scalar/api-client/v2/features/operation";
3
+ import { isDefined } from "@scalar/helpers/array/is-defined";
4
+ import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
5
+ import { unpackProxyObject } from "@scalar/workspace-store/helpers/unpack-proxy";
6
+ const combineParams = (pathParams = [], operationParams = []) => {
7
+ const allParams = [...pathParams, ...operationParams].map((param) => getResolvedRef(param)).filter((e) => isDefined(e) && e.name);
8
+ const uniqueParams = /* @__PURE__ */ new Map();
9
+ for (const param of allParams) {
10
+ const key = `${param.in}:${param.name}`;
11
+ uniqueParams.set(key, param);
12
+ }
13
+ return Array.from(uniqueParams.values());
14
+ };
15
+ function getFirstServer(...availableServers) {
16
+ for (const serverSource of availableServers) {
17
+ if (!serverSource) {
18
+ continue;
19
+ }
20
+ if (!Array.isArray(serverSource)) {
21
+ const resolvedServer = getResolvedRef(serverSource);
22
+ if (resolvedServer?.url) {
23
+ return resolvedServer;
24
+ }
25
+ continue;
26
+ }
27
+ for (const server of serverSource) {
28
+ const resolvedServer = getResolvedRef(server);
29
+ if (resolvedServer?.url) {
30
+ return resolvedServer;
31
+ }
32
+ }
33
+ }
34
+ return void 0;
35
+ }
36
+ const getDefaultScopes = (scheme) => {
37
+ if (!scheme || scheme.type !== "oauth2") {
38
+ return [];
39
+ }
40
+ return scheme["x-default-scopes"] ?? [];
41
+ };
42
+ const addSchemeToRequirement = (acc, schemeName, securitySchemes) => {
43
+ const scheme = getResolvedRef(securitySchemes[schemeName]);
44
+ acc[schemeName] = getDefaultScopes(scheme);
45
+ };
46
+ const buildSecurityRequirementFromPreferred = (preferredSecurityScheme, securitySchemes) => {
47
+ if (!Array.isArray(preferredSecurityScheme)) {
48
+ const scheme = getResolvedRef(securitySchemes[preferredSecurityScheme]);
49
+ return { [preferredSecurityScheme]: getDefaultScopes(scheme) };
50
+ }
51
+ const requirement = {};
52
+ for (const item of preferredSecurityScheme) {
53
+ if (Array.isArray(item)) {
54
+ for (const schemeName of item) {
55
+ addSchemeToRequirement(requirement, schemeName, securitySchemes);
56
+ }
57
+ } else {
58
+ addSchemeToRequirement(requirement, item, securitySchemes);
59
+ }
60
+ }
61
+ return requirement;
62
+ };
63
+ const getDefaultSecurity = (securityRequirements, preferredSecurityScheme, securitySchemes) => {
64
+ if (preferredSecurityScheme) {
65
+ return buildSecurityRequirementFromPreferred(
66
+ preferredSecurityScheme,
67
+ securitySchemes
68
+ );
69
+ }
70
+ const firstRequirement = securityRequirements[0];
71
+ if (firstRequirement) {
72
+ return unpackProxyObject(firstRequirement, { depth: 1 });
73
+ }
74
+ return null;
75
+ };
76
+ const getKey = (requirement) => Object.keys(requirement).sort().join(",");
77
+ const filterSelectedSecurity = (document, operation, securitySchemes = {}) => {
78
+ const securityRequirements = operation?.security ?? document.security ?? [];
79
+ const selectedSecurity = getSelectedSecurity(
80
+ document?.["x-scalar-selected-security"],
81
+ operation?.["x-scalar-selected-security"]
82
+ );
83
+ const requirementSet = new Set(securityRequirements.map((r) => getKey(r)));
84
+ const selectedRequirement = selectedSecurity.selectedSchemes[selectedSecurity.selectedIndex];
85
+ if (selectedRequirement && requirementSet.has(getKey(selectedRequirement))) {
86
+ return getSecuritySchemes(securitySchemes, [selectedRequirement]);
87
+ }
88
+ for (const selected of selectedSecurity.selectedSchemes) {
89
+ if (requirementSet.has(getKey(selected))) {
90
+ return getSecuritySchemes(securitySchemes, [selected]);
91
+ }
92
+ }
93
+ if (operation?.security?.length && !document?.["x-scalar-set-operation-security"]) {
94
+ return getSecuritySchemes(securitySchemes, securityRequirements.slice(0, 1));
95
+ }
96
+ return [];
97
+ };
98
+ function getOperations(doc) {
99
+ return Object.values(doc.paths ?? {}).flatMap(
100
+ (path) => Object.values(path ?? {})
101
+ );
102
+ }
103
+ export {
104
+ combineParams,
105
+ filterSelectedSecurity,
106
+ getDefaultScopes,
107
+ getDefaultSecurity,
108
+ getFirstServer,
109
+ getOperations
110
+ };
111
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sources":["../src/helpers.ts"],"sourcesContent":["import type { ToolUIPart, UIDataTypes, UIMessagePart } from 'ai'\n\nimport { getSecuritySchemes } from '@scalar/api-client/v2/blocks/operation-block'\nimport type { MergedSecuritySchemes } from '@scalar/api-client/v2/blocks/scalar-auth-selector-block'\nimport { getSelectedSecurity } from '@scalar/api-client/v2/features/operation'\nimport { isDefined } from '@scalar/helpers/array/is-defined'\nimport type { OpenAPIV3_1 } from '@scalar/openapi-types'\nimport type { AuthenticationConfiguration } from '@scalar/types/api-reference'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { unpackProxyObject } from '@scalar/workspace-store/helpers/unpack-proxy'\nimport type {\n OpenApiDocument,\n OperationObject,\n ParameterObject,\n PathItemObject,\n SecurityRequirementObject,\n SecuritySchemeObject,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\nimport type { Tools } from '@/state/state'\n\n/** Combine pathItem and operation parameters into a single, dereferenced parameter array */\nexport const combineParams = (\n pathParams: PathItemObject['parameters'] = [],\n operationParams: OperationObject['parameters'] = [],\n): ParameterObject[] => {\n const allParams = [...pathParams, ...operationParams]\n .map((param) => getResolvedRef(param))\n // For unresolved params, coercion is going to generate a template object with an empty name, we don't want to include those\n .filter((e) => isDefined(e) && e.name)\n\n // Use a Map to ensure unique in+name combinations\n // Operation parameters take precedence over path parameters\n const uniqueParams = new Map<string, ParameterObject>()\n\n for (const param of allParams) {\n const key = `${param.in}:${param.name}`\n uniqueParams.set(key, param)\n }\n\n return Array.from(uniqueParams.values())\n}\n\n/**\n * Iterate through all available servers and pick the first one\n *\n * @example\n * getFirstServer([operation.servers, pathItem.servers, server])\n */\nexport function getFirstServer(\n ...availableServers: (ServerObject[] | ServerObject | undefined | null)[]\n): ServerObject | undefined {\n for (const serverSource of availableServers) {\n if (!serverSource) {\n continue\n }\n\n // Handle single server object\n if (!Array.isArray(serverSource)) {\n const resolvedServer = getResolvedRef(serverSource) as ServerObject\n if (resolvedServer?.url) {\n return resolvedServer\n }\n continue\n }\n\n // Handle array of servers, pick the first one with a URL\n for (const server of serverSource) {\n const resolvedServer = getResolvedRef(server) as ServerObject\n if (resolvedServer?.url) {\n return resolvedServer\n }\n }\n }\n\n return undefined\n}\n\n/** Determine if a message part is a tool */\nexport function isToolPart(\n part: UIMessagePart<UIDataTypes, Tools>,\n): part is ToolUIPart<Tools> {\n return part.type.startsWith('tool-')\n}\n\n/**\n * Extracts the default scopes for a security scheme.\n * Only OAuth2 schemes can have default scopes via the x-default-scopes extension.\n */\nexport const getDefaultScopes = (\n scheme: SecuritySchemeObject | undefined,\n): string[] => {\n if (!scheme || scheme.type !== 'oauth2') {\n return []\n }\n\n return scheme['x-default-scopes'] ?? []\n}\n\n/**\n * Processes a single scheme name and adds it to the accumulator with its default scopes.\n */\nconst addSchemeToRequirement = (\n acc: SecurityRequirementObject,\n schemeName: string,\n securitySchemes: MergedSecuritySchemes,\n): void => {\n const scheme = getResolvedRef(securitySchemes[schemeName])\n acc[schemeName] = getDefaultScopes(scheme)\n}\n\n/**\n * Converts the preferred security scheme configuration into a SecurityRequirementObject.\n * Handles both flat arrays and nested arrays (for complex auth scenarios).\n */\nconst buildSecurityRequirementFromPreferred = (\n preferredSecurityScheme: string | (string | string[])[],\n securitySchemes: MergedSecuritySchemes,\n): SecurityRequirementObject => {\n if (!Array.isArray(preferredSecurityScheme)) {\n const scheme = getResolvedRef(securitySchemes[preferredSecurityScheme])\n return { [preferredSecurityScheme]: getDefaultScopes(scheme) }\n }\n\n const requirement: SecurityRequirementObject = {}\n\n for (const item of preferredSecurityScheme) {\n if (Array.isArray(item)) {\n // Handle nested arrays for complex auth (e.g., [['oauth2', 'apiKey'], 'basic'])\n for (const schemeName of item) {\n addSchemeToRequirement(requirement, schemeName, securitySchemes)\n }\n } else {\n addSchemeToRequirement(requirement, item, securitySchemes)\n }\n }\n\n return requirement\n}\n\n/**\n * Determines the default security scheme to use for an operation.\n *\n * Priority order:\n * 1. User-configured preferred security scheme (if provided)\n * 2. First security requirement from the OpenAPI spec\n * 3. null (no security required)\n */\nexport const getDefaultSecurity = (\n securityRequirements: SecurityRequirementObject[],\n preferredSecurityScheme: AuthenticationConfiguration['preferredSecurityScheme'],\n securitySchemes: MergedSecuritySchemes,\n): SecurityRequirementObject | null => {\n if (preferredSecurityScheme) {\n return buildSecurityRequirementFromPreferred(\n preferredSecurityScheme,\n securitySchemes,\n )\n }\n\n const firstRequirement = securityRequirements[0]\n if (firstRequirement) {\n return unpackProxyObject(firstRequirement, { depth: 1 })\n }\n\n return null\n}\n\n/** Builds a quick cache key from the sorted object keys */\nconst getKey = (requirement: SecurityRequirementObject) =>\n Object.keys(requirement).sort().join(',')\n\n/**\n * Find the intersection between which security is selected on the document and what this operation requires\n *\n * If there is no overlap, we return the first requirement\n */\nexport const filterSelectedSecurity = (\n document: OpenApiDocument,\n operation: OperationObject | null,\n securitySchemes: MergedSecuritySchemes = {},\n): SecuritySchemeObject[] => {\n const securityRequirements = operation?.security ?? document.security ?? []\n\n /** The selected security keys for the document */\n const selectedSecurity = getSelectedSecurity(\n document?.['x-scalar-selected-security'],\n operation?.['x-scalar-selected-security'],\n )\n\n /** Build a set for O(1) lookup */\n const requirementSet = new Set(securityRequirements.map((r) => getKey(r)))\n\n // Lets check the selectedIndex first\n const selectedRequirement =\n selectedSecurity.selectedSchemes[selectedSecurity.selectedIndex]\n if (selectedRequirement && requirementSet.has(getKey(selectedRequirement))) {\n return getSecuritySchemes(securitySchemes, [selectedRequirement])\n }\n\n // Otherwise lets loop over all selected\n for (const selected of selectedSecurity.selectedSchemes) {\n if (requirementSet.has(getKey(selected))) {\n return getSecuritySchemes(securitySchemes, [selected])\n }\n }\n\n /**\n * If we are selected security on the document,\n * we should show the first requirement of the operation to show auth is required\n */\n if (\n operation?.security?.length &&\n !document?.['x-scalar-set-operation-security']\n ) {\n return getSecuritySchemes(securitySchemes, securityRequirements.slice(0, 1))\n }\n\n return []\n}\n\nexport function getOperations(doc: Partial<OpenAPIV3_1.Document>) {\n return Object.values(doc.paths ?? {}).flatMap((path) =>\n Object.values(path ?? {}),\n ) as OperationObject[]\n}\n"],"names":[],"mappings":";;;;;AAuBO,MAAM,gBAAgB,CAC3B,aAA2C,IAC3C,kBAAiD,CAAA,MAC3B;AACtB,QAAM,YAAY,CAAC,GAAG,YAAY,GAAG,eAAe,EACjD,IAAI,CAAC,UAAU,eAAe,KAAK,CAAC,EAEpC,OAAO,CAAC,MAAM,UAAU,CAAC,KAAK,EAAE,IAAI;AAIvC,QAAM,mCAAmB,IAAA;AAEzB,aAAW,SAAS,WAAW;AAC7B,UAAM,MAAM,GAAG,MAAM,EAAE,IAAI,MAAM,IAAI;AACrC,iBAAa,IAAI,KAAK,KAAK;AAAA,EAC7B;AAEA,SAAO,MAAM,KAAK,aAAa,OAAA,CAAQ;AACzC;AAQO,SAAS,kBACX,kBACuB;AAC1B,aAAW,gBAAgB,kBAAkB;AAC3C,QAAI,CAAC,cAAc;AACjB;AAAA,IACF;AAGA,QAAI,CAAC,MAAM,QAAQ,YAAY,GAAG;AAChC,YAAM,iBAAiB,eAAe,YAAY;AAClD,UAAI,gBAAgB,KAAK;AACvB,eAAO;AAAA,MACT;AACA;AAAA,IACF;AAGA,eAAW,UAAU,cAAc;AACjC,YAAM,iBAAiB,eAAe,MAAM;AAC5C,UAAI,gBAAgB,KAAK;AACvB,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAaO,MAAM,mBAAmB,CAC9B,WACa;AACb,MAAI,CAAC,UAAU,OAAO,SAAS,UAAU;AACvC,WAAO,CAAA;AAAA,EACT;AAEA,SAAO,OAAO,kBAAkB,KAAK,CAAA;AACvC;AAKA,MAAM,yBAAyB,CAC7B,KACA,YACA,oBACS;AACT,QAAM,SAAS,eAAe,gBAAgB,UAAU,CAAC;AACzD,MAAI,UAAU,IAAI,iBAAiB,MAAM;AAC3C;AAMA,MAAM,wCAAwC,CAC5C,yBACA,oBAC8B;AAC9B,MAAI,CAAC,MAAM,QAAQ,uBAAuB,GAAG;AAC3C,UAAM,SAAS,eAAe,gBAAgB,uBAAuB,CAAC;AACtE,WAAO,EAAE,CAAC,uBAAuB,GAAG,iBAAiB,MAAM,EAAA;AAAA,EAC7D;AAEA,QAAM,cAAyC,CAAA;AAE/C,aAAW,QAAQ,yBAAyB;AAC1C,QAAI,MAAM,QAAQ,IAAI,GAAG;AAEvB,iBAAW,cAAc,MAAM;AAC7B,+BAAuB,aAAa,YAAY,eAAe;AAAA,MACjE;AAAA,IACF,OAAO;AACL,6BAAuB,aAAa,MAAM,eAAe;AAAA,IAC3D;AAAA,EACF;AAEA,SAAO;AACT;AAUO,MAAM,qBAAqB,CAChC,sBACA,yBACA,oBACqC;AACrC,MAAI,yBAAyB;AAC3B,WAAO;AAAA,MACL;AAAA,MACA;AAAA,IAAA;AAAA,EAEJ;AAEA,QAAM,mBAAmB,qBAAqB,CAAC;AAC/C,MAAI,kBAAkB;AACpB,WAAO,kBAAkB,kBAAkB,EAAE,OAAO,GAAG;AAAA,EACzD;AAEA,SAAO;AACT;AAGA,MAAM,SAAS,CAAC,gBACd,OAAO,KAAK,WAAW,EAAE,KAAA,EAAO,KAAK,GAAG;AAOnC,MAAM,yBAAyB,CACpC,UACA,WACA,kBAAyC,CAAA,MACd;AAC3B,QAAM,uBAAuB,WAAW,YAAY,SAAS,YAAY,CAAA;AAGzE,QAAM,mBAAmB;AAAA,IACvB,WAAW,4BAA4B;AAAA,IACvC,YAAY,4BAA4B;AAAA,EAAA;AAI1C,QAAM,iBAAiB,IAAI,IAAI,qBAAqB,IAAI,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC;AAGzE,QAAM,sBACJ,iBAAiB,gBAAgB,iBAAiB,aAAa;AACjE,MAAI,uBAAuB,eAAe,IAAI,OAAO,mBAAmB,CAAC,GAAG;AAC1E,WAAO,mBAAmB,iBAAiB,CAAC,mBAAmB,CAAC;AAAA,EAClE;AAGA,aAAW,YAAY,iBAAiB,iBAAiB;AACvD,QAAI,eAAe,IAAI,OAAO,QAAQ,CAAC,GAAG;AACxC,aAAO,mBAAmB,iBAAiB,CAAC,QAAQ,CAAC;AAAA,IACvD;AAAA,EACF;AAMA,MACE,WAAW,UAAU,UACrB,CAAC,WAAW,iCAAiC,GAC7C;AACA,WAAO,mBAAmB,iBAAiB,qBAAqB,MAAM,GAAG,CAAC,CAAC;AAAA,EAC7E;AAEA,SAAO,CAAA;AACT;AAEO,SAAS,cAAc,KAAoC;AAChE,SAAO,OAAO,OAAO,IAAI,SAAS,CAAA,CAAE,EAAE;AAAA,IAAQ,CAAC,SAC7C,OAAO,OAAO,QAAQ,CAAA,CAAE;AAAA,EAAA;AAE5B;"}
@@ -0,0 +1,2 @@
1
+ export declare function useActiveServer(): void;
2
+ //# sourceMappingURL=useActiveServer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useActiveServer.d.ts","sourceRoot":"","sources":["../../src/hooks/useActiveServer.ts"],"names":[],"mappings":"AAMA,wBAAgB,eAAe,SAe9B"}
@@ -0,0 +1,20 @@
1
+ import { computed, watch } from "vue";
2
+ import { getSelectedServer } from "@scalar/api-client/v2/features/operation";
3
+ import { useState } from "../state/state.js";
4
+ function useActiveServer() {
5
+ const state = useState();
6
+ const server = computed(
7
+ () => getSelectedServer(state.workspaceStore.workspace.activeDocument ?? null)
8
+ );
9
+ watch(
10
+ server,
11
+ () => {
12
+ if (server.value) state.activeServer.value = server.value;
13
+ },
14
+ { immediate: true }
15
+ );
16
+ }
17
+ export {
18
+ useActiveServer
19
+ };
20
+ //# sourceMappingURL=useActiveServer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useActiveServer.js","sources":["../../src/hooks/useActiveServer.ts"],"sourcesContent":["import { computed, watch } from 'vue'\n\nimport { getSelectedServer } from '@scalar/api-client/v2/features/operation'\n\nimport { useState } from '@/state/state'\n\nexport function useActiveServer() {\n const state = useState()\n\n /** Compute the selected server for the document only (for now) */\n const server = computed(() =>\n getSelectedServer(state.workspaceStore.workspace.activeDocument ?? null),\n )\n\n watch(\n server,\n () => {\n if (server.value) state.activeServer.value = server.value\n },\n { immediate: true },\n )\n}\n"],"names":[],"mappings":";;;AAMO,SAAS,kBAAkB;AAChC,QAAM,QAAQ,SAAA;AAGd,QAAM,SAAS;AAAA,IAAS,MACtB,kBAAkB,MAAM,eAAe,UAAU,kBAAkB,IAAI;AAAA,EAAA;AAGzE;AAAA,IACE;AAAA,IACA,MAAM;AACJ,UAAI,OAAO,MAAO,OAAM,aAAa,QAAQ,OAAO;AAAA,IACtD;AAAA,IACA,EAAE,WAAW,KAAA;AAAA,EAAK;AAEtB;"}
@@ -0,0 +1,3 @@
1
+ import type { WorkspaceStore } from '@scalar/workspace-store/client';
2
+ export declare function useChatOperationBlocks(workspaceStore: WorkspaceStore): void;
3
+ //# sourceMappingURL=useChatOperationBlocks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useChatOperationBlocks.d.ts","sourceRoot":"","sources":["../../src/hooks/useChatOperationBlocks.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAKpE,wBAAgB,sBAAsB,CAAC,cAAc,EAAE,cAAc,QA0BpE"}
@@ -0,0 +1,29 @@
1
+ import { watch, createApp } from "vue";
2
+ import Endpoint from "../components/Endpoint.vue.js";
3
+ import { useState } from "../state/state.js";
4
+ import { array, string } from "../node_modules/.pnpm/zod@4.1.11/node_modules/zod/v4/mini/schemas.js";
5
+ function useChatOperationBlocks(workspaceStore) {
6
+ const state = useState();
7
+ watch(
8
+ () => state.chat.messages,
9
+ () => {
10
+ document.querySelectorAll(".scalar-api").forEach((el) => {
11
+ if ("__vue_app__" in el) return;
12
+ const [method, path] = array(string()).parse(el.getAttribute("method")?.split(" "));
13
+ const app = createApp(Endpoint, {
14
+ workspaceStore,
15
+ method,
16
+ config: state.config,
17
+ eventBus: state.eventBus,
18
+ path
19
+ });
20
+ app.mount(el);
21
+ });
22
+ },
23
+ { deep: true }
24
+ );
25
+ }
26
+ export {
27
+ useChatOperationBlocks
28
+ };
29
+ //# sourceMappingURL=useChatOperationBlocks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useChatOperationBlocks.js","sources":["../../src/hooks/useChatOperationBlocks.ts"],"sourcesContent":["import { createApp, watch } from 'vue'\nimport { z } from 'zod/mini'\n\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\n\nimport Endpoint from '@/components/Endpoint.vue'\nimport { useState } from '@/state/state'\n\nexport function useChatOperationBlocks(workspaceStore: WorkspaceStore) {\n const state = useState()\n\n watch(\n () => state.chat.messages,\n () => {\n document.querySelectorAll<HTMLElement>('.scalar-api').forEach((el) => {\n if ('__vue_app__' in el) return\n\n const [method, path] = z\n .array(z.string())\n .parse(el.getAttribute('method')?.split(' '))\n\n const app = createApp(Endpoint, {\n workspaceStore,\n method,\n config: state.config,\n eventBus: state.eventBus,\n path,\n })\n\n app.mount(el)\n })\n },\n { deep: true },\n )\n}\n"],"names":["z.array","z.string"],"mappings":";;;;AAQO,SAAS,uBAAuB,gBAAgC;AACrE,QAAM,QAAQ,SAAA;AAEd;AAAA,IACE,MAAM,MAAM,KAAK;AAAA,IACjB,MAAM;AACJ,eAAS,iBAA8B,aAAa,EAAE,QAAQ,CAAC,OAAO;AACpE,YAAI,iBAAiB,GAAI;AAEzB,cAAM,CAAC,QAAQ,IAAI,IAAIA,MACdC,OAAE,CAAQ,EAChB,MAAM,GAAG,aAAa,QAAQ,GAAG,MAAM,GAAG,CAAC;AAE9C,cAAM,MAAM,UAAU,UAAU;AAAA,UAC9B;AAAA,UACA;AAAA,UACA,QAAQ,MAAM;AAAA,UACd,UAAU,MAAM;AAAA,UAChB;AAAA,QAAA,CACD;AAED,YAAI,MAAM,EAAE;AAAA,MACd,CAAC;AAAA,IACH;AAAA,IACA,EAAE,MAAM,KAAA;AAAA,EAAK;AAEjB;"}
@@ -0,0 +1,2 @@
1
+ export declare function useChatScroll(): void;
2
+ //# sourceMappingURL=useChatScroll.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useChatScroll.d.ts","sourceRoot":"","sources":["../../src/hooks/useChatScroll.ts"],"names":[],"mappings":"AAKA,wBAAgB,aAAa,SAmB5B"}
@@ -0,0 +1,22 @@
1
+ import { watch, nextTick } from "vue";
2
+ import { useState } from "../state/state.js";
3
+ function useChatScroll() {
4
+ const state = useState();
5
+ function getMsgContent(msg) {
6
+ const lastPart = msg?.parts.at(-1);
7
+ if (!lastPart) return;
8
+ if (lastPart.type !== "text") return;
9
+ return lastPart.text;
10
+ }
11
+ watch(
12
+ [() => state.chat.status, () => getMsgContent(state.chat.lastMessage)],
13
+ async () => {
14
+ await nextTick();
15
+ window.scrollTo(0, document.body.scrollHeight);
16
+ }
17
+ );
18
+ }
19
+ export {
20
+ useChatScroll
21
+ };
22
+ //# sourceMappingURL=useChatScroll.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useChatScroll.js","sources":["../../src/hooks/useChatScroll.ts"],"sourcesContent":["import type { UIMessage } from 'ai'\nimport { nextTick, watch } from 'vue'\n\nimport { useState } from '@/state/state'\n\nexport function useChatScroll() {\n const state = useState()\n\n function getMsgContent(msg?: UIMessage) {\n const lastPart = msg?.parts.at(-1)\n if (!lastPart) return\n\n if (lastPart.type !== 'text') return\n\n return lastPart.text\n }\n\n watch(\n [() => state.chat.status, () => getMsgContent(state.chat.lastMessage)],\n async () => {\n await nextTick()\n window.scrollTo(0, document.body.scrollHeight)\n },\n )\n}\n"],"names":[],"mappings":";;AAKO,SAAS,gBAAgB;AAC9B,QAAM,QAAQ,SAAA;AAEd,WAAS,cAAc,KAAiB;AACtC,UAAM,WAAW,KAAK,MAAM,GAAG,EAAE;AACjC,QAAI,CAAC,SAAU;AAEf,QAAI,SAAS,SAAS,OAAQ;AAE9B,WAAO,SAAS;AAAA,EAClB;AAEA;AAAA,IACE,CAAC,MAAM,MAAM,KAAK,QAAQ,MAAM,cAAc,MAAM,KAAK,WAAW,CAAC;AAAA,IACrE,YAAY;AACV,YAAM,SAAA;AACN,aAAO,SAAS,GAAG,SAAS,KAAK,YAAY;AAAA,IAC/C;AAAA,EAAA;AAEJ;"}
@@ -0,0 +1,2 @@
1
+ export declare function useSecuritySchemes(): void;
2
+ //# sourceMappingURL=useSecuritySchemes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSecuritySchemes.d.ts","sourceRoot":"","sources":["../../src/hooks/useSecuritySchemes.ts"],"names":[],"mappings":"AAOA,wBAAgB,kBAAkB,SAuBjC"}
@@ -0,0 +1,29 @@
1
+ import { computed, watch } from "vue";
2
+ import { mergeAuthConfig } from "@scalar/api-client/v2/blocks/scalar-auth-selector-block";
3
+ import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
4
+ import { useState } from "../state/state.js";
5
+ function useSecuritySchemes() {
6
+ const state = useState();
7
+ const activeDocument = computed(
8
+ () => state.workspaceStore.workspace.activeDocument
9
+ );
10
+ const securitySchemes = computed(
11
+ () => mergeAuthConfig(
12
+ activeDocument.value?.components?.securitySchemes,
13
+ state.config.value.authentication?.securitySchemes
14
+ )
15
+ );
16
+ watch(
17
+ () => securitySchemes,
18
+ () => {
19
+ state.securitySchemes.value = Object.values(securitySchemes.value).map(
20
+ (scheme) => getResolvedRef(scheme)
21
+ );
22
+ },
23
+ { immediate: true, deep: true }
24
+ );
25
+ }
26
+ export {
27
+ useSecuritySchemes
28
+ };
29
+ //# sourceMappingURL=useSecuritySchemes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSecuritySchemes.js","sources":["../../src/hooks/useSecuritySchemes.ts"],"sourcesContent":["import { computed, watch } from 'vue'\n\nimport { mergeAuthConfig } from '@scalar/api-client/v2/blocks/scalar-auth-selector-block'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\n\nimport { useState } from '@/state/state'\n\nexport function useSecuritySchemes() {\n const state = useState()\n\n const activeDocument = computed(\n () => state.workspaceStore.workspace.activeDocument,\n )\n\n const securitySchemes = computed(() =>\n mergeAuthConfig(\n activeDocument.value?.components?.securitySchemes,\n state.config.value.authentication?.securitySchemes,\n ),\n )\n\n watch(\n () => securitySchemes,\n () => {\n state.securitySchemes.value = Object.values(securitySchemes.value).map(\n (scheme) => getResolvedRef(scheme),\n )\n },\n { immediate: true, deep: true },\n )\n}\n"],"names":[],"mappings":";;;;AAOO,SAAS,qBAAqB;AACnC,QAAM,QAAQ,SAAA;AAEd,QAAM,iBAAiB;AAAA,IACrB,MAAM,MAAM,eAAe,UAAU;AAAA,EAAA;AAGvC,QAAM,kBAAkB;AAAA,IAAS,MAC/B;AAAA,MACE,eAAe,OAAO,YAAY;AAAA,MAClC,MAAM,OAAO,MAAM,gBAAgB;AAAA,IAAA;AAAA,EACrC;AAGF;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AACJ,YAAM,gBAAgB,QAAQ,OAAO,OAAO,gBAAgB,KAAK,EAAE;AAAA,QACjE,CAAC,WAAW,eAAe,MAAM;AAAA,MAAA;AAAA,IAErC;AAAA,IACA,EAAE,WAAW,MAAM,MAAM,KAAA;AAAA,EAAK;AAElC;"}
@@ -0,0 +1,2 @@
1
+ export { default as Chat } from './App.vue.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,WAAW,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ import { default as default2 } from "./App.vue.js";
2
+ export {
3
+ default2 as Chat
4
+ };
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,11 @@
1
+ import { normalizeParams } from "./util.js";
2
+ function _string(Class, params) {
3
+ return new Class({
4
+ type: "string",
5
+ ...normalizeParams()
6
+ });
7
+ }
8
+ export {
9
+ _string
10
+ };
11
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sources":["../../../../../../../../../../node_modules/.pnpm/zod@4.1.11/node_modules/zod/v4/core/api.js"],"sourcesContent":["import * as checks from \"./checks.js\";\nimport * as schemas from \"./schemas.js\";\nimport * as util from \"./util.js\";\nexport function _string(Class, params) {\n return new Class({\n type: \"string\",\n ...util.normalizeParams(params),\n });\n}\nexport function _coercedString(Class, params) {\n return new Class({\n type: \"string\",\n coerce: true,\n ...util.normalizeParams(params),\n });\n}\nexport function _email(Class, params) {\n return new Class({\n type: \"string\",\n format: \"email\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\nexport function _guid(Class, params) {\n return new Class({\n type: \"string\",\n format: \"guid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\nexport function _uuid(Class, params) {\n return new Class({\n type: \"string\",\n format: \"uuid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\nexport function _uuidv4(Class, params) {\n return new Class({\n type: \"string\",\n format: \"uuid\",\n check: \"string_format\",\n abort: false,\n version: \"v4\",\n ...util.normalizeParams(params),\n });\n}\nexport function _uuidv6(Class, params) {\n return new Class({\n type: \"string\",\n format: \"uuid\",\n check: \"string_format\",\n abort: false,\n version: \"v6\",\n ...util.normalizeParams(params),\n });\n}\nexport function _uuidv7(Class, params) {\n return new Class({\n type: \"string\",\n format: \"uuid\",\n check: \"string_format\",\n abort: false,\n version: \"v7\",\n ...util.normalizeParams(params),\n });\n}\nexport function _url(Class, params) {\n return new Class({\n type: \"string\",\n format: \"url\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\nexport function _emoji(Class, params) {\n return new Class({\n type: \"string\",\n format: \"emoji\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\nexport function _nanoid(Class, params) {\n return new Class({\n type: \"string\",\n format: \"nanoid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\nexport function _cuid(Class, params) {\n return new Class({\n type: \"string\",\n format: \"cuid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\nexport function _cuid2(Class, params) {\n return new Class({\n type: \"string\",\n format: \"cuid2\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\nexport function _ulid(Class, params) {\n return new Class({\n type: \"string\",\n format: \"ulid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\nexport function _xid(Class, params) {\n return new Class({\n type: \"string\",\n format: \"xid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\nexport function _ksuid(Class, params) {\n return new Class({\n type: \"string\",\n format: \"ksuid\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\nexport function _ipv4(Class, params) {\n return new Class({\n type: \"string\",\n format: \"ipv4\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\nexport function _ipv6(Class, params) {\n return new Class({\n type: \"string\",\n format: \"ipv6\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\nexport function _cidrv4(Class, params) {\n return new Class({\n type: \"string\",\n format: \"cidrv4\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\nexport function _cidrv6(Class, params) {\n return new Class({\n type: \"string\",\n format: \"cidrv6\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\nexport function _base64(Class, params) {\n return new Class({\n type: \"string\",\n format: \"base64\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\nexport function _base64url(Class, params) {\n return new Class({\n type: \"string\",\n format: \"base64url\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\nexport function _e164(Class, params) {\n return new Class({\n type: \"string\",\n format: \"e164\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\nexport function _jwt(Class, params) {\n return new Class({\n type: \"string\",\n format: \"jwt\",\n check: \"string_format\",\n abort: false,\n ...util.normalizeParams(params),\n });\n}\nexport const TimePrecision = {\n Any: null,\n Minute: -1,\n Second: 0,\n Millisecond: 3,\n Microsecond: 6,\n};\nexport function _isoDateTime(Class, params) {\n return new Class({\n type: \"string\",\n format: \"datetime\",\n check: \"string_format\",\n offset: false,\n local: false,\n precision: null,\n ...util.normalizeParams(params),\n });\n}\nexport function _isoDate(Class, params) {\n return new Class({\n type: \"string\",\n format: \"date\",\n check: \"string_format\",\n ...util.normalizeParams(params),\n });\n}\nexport function _isoTime(Class, params) {\n return new Class({\n type: \"string\",\n format: \"time\",\n check: \"string_format\",\n precision: null,\n ...util.normalizeParams(params),\n });\n}\nexport function _isoDuration(Class, params) {\n return new Class({\n type: \"string\",\n format: \"duration\",\n check: \"string_format\",\n ...util.normalizeParams(params),\n });\n}\nexport function _number(Class, params) {\n return new Class({\n type: \"number\",\n checks: [],\n ...util.normalizeParams(params),\n });\n}\nexport function _coercedNumber(Class, params) {\n return new Class({\n type: \"number\",\n coerce: true,\n checks: [],\n ...util.normalizeParams(params),\n });\n}\nexport function _int(Class, params) {\n return new Class({\n type: \"number\",\n check: \"number_format\",\n abort: false,\n format: \"safeint\",\n ...util.normalizeParams(params),\n });\n}\nexport function _float32(Class, params) {\n return new Class({\n type: \"number\",\n check: \"number_format\",\n abort: false,\n format: \"float32\",\n ...util.normalizeParams(params),\n });\n}\nexport function _float64(Class, params) {\n return new Class({\n type: \"number\",\n check: \"number_format\",\n abort: false,\n format: \"float64\",\n ...util.normalizeParams(params),\n });\n}\nexport function _int32(Class, params) {\n return new Class({\n type: \"number\",\n check: \"number_format\",\n abort: false,\n format: \"int32\",\n ...util.normalizeParams(params),\n });\n}\nexport function _uint32(Class, params) {\n return new Class({\n type: \"number\",\n check: \"number_format\",\n abort: false,\n format: \"uint32\",\n ...util.normalizeParams(params),\n });\n}\nexport function _boolean(Class, params) {\n return new Class({\n type: \"boolean\",\n ...util.normalizeParams(params),\n });\n}\nexport function _coercedBoolean(Class, params) {\n return new Class({\n type: \"boolean\",\n coerce: true,\n ...util.normalizeParams(params),\n });\n}\nexport function _bigint(Class, params) {\n return new Class({\n type: \"bigint\",\n ...util.normalizeParams(params),\n });\n}\nexport function _coercedBigint(Class, params) {\n return new Class({\n type: \"bigint\",\n coerce: true,\n ...util.normalizeParams(params),\n });\n}\nexport function _int64(Class, params) {\n return new Class({\n type: \"bigint\",\n check: \"bigint_format\",\n abort: false,\n format: \"int64\",\n ...util.normalizeParams(params),\n });\n}\nexport function _uint64(Class, params) {\n return new Class({\n type: \"bigint\",\n check: \"bigint_format\",\n abort: false,\n format: \"uint64\",\n ...util.normalizeParams(params),\n });\n}\nexport function _symbol(Class, params) {\n return new Class({\n type: \"symbol\",\n ...util.normalizeParams(params),\n });\n}\nexport function _undefined(Class, params) {\n return new Class({\n type: \"undefined\",\n ...util.normalizeParams(params),\n });\n}\nexport function _null(Class, params) {\n return new Class({\n type: \"null\",\n ...util.normalizeParams(params),\n });\n}\nexport function _any(Class) {\n return new Class({\n type: \"any\",\n });\n}\nexport function _unknown(Class) {\n return new Class({\n type: \"unknown\",\n });\n}\nexport function _never(Class, params) {\n return new Class({\n type: \"never\",\n ...util.normalizeParams(params),\n });\n}\nexport function _void(Class, params) {\n return new Class({\n type: \"void\",\n ...util.normalizeParams(params),\n });\n}\nexport function _date(Class, params) {\n return new Class({\n type: \"date\",\n ...util.normalizeParams(params),\n });\n}\nexport function _coercedDate(Class, params) {\n return new Class({\n type: \"date\",\n coerce: true,\n ...util.normalizeParams(params),\n });\n}\nexport function _nan(Class, params) {\n return new Class({\n type: \"nan\",\n ...util.normalizeParams(params),\n });\n}\nexport function _lt(value, params) {\n return new checks.$ZodCheckLessThan({\n check: \"less_than\",\n ...util.normalizeParams(params),\n value,\n inclusive: false,\n });\n}\nexport function _lte(value, params) {\n return new checks.$ZodCheckLessThan({\n check: \"less_than\",\n ...util.normalizeParams(params),\n value,\n inclusive: true,\n });\n}\nexport { \n/** @deprecated Use `z.lte()` instead. */\n_lte as _max, };\nexport function _gt(value, params) {\n return new checks.$ZodCheckGreaterThan({\n check: \"greater_than\",\n ...util.normalizeParams(params),\n value,\n inclusive: false,\n });\n}\nexport function _gte(value, params) {\n return new checks.$ZodCheckGreaterThan({\n check: \"greater_than\",\n ...util.normalizeParams(params),\n value,\n inclusive: true,\n });\n}\nexport { \n/** @deprecated Use `z.gte()` instead. */\n_gte as _min, };\nexport function _positive(params) {\n return _gt(0, params);\n}\n// negative\nexport function _negative(params) {\n return _lt(0, params);\n}\n// nonpositive\nexport function _nonpositive(params) {\n return _lte(0, params);\n}\n// nonnegative\nexport function _nonnegative(params) {\n return _gte(0, params);\n}\nexport function _multipleOf(value, params) {\n return new checks.$ZodCheckMultipleOf({\n check: \"multiple_of\",\n ...util.normalizeParams(params),\n value,\n });\n}\nexport function _maxSize(maximum, params) {\n return new checks.$ZodCheckMaxSize({\n check: \"max_size\",\n ...util.normalizeParams(params),\n maximum,\n });\n}\nexport function _minSize(minimum, params) {\n return new checks.$ZodCheckMinSize({\n check: \"min_size\",\n ...util.normalizeParams(params),\n minimum,\n });\n}\nexport function _size(size, params) {\n return new checks.$ZodCheckSizeEquals({\n check: \"size_equals\",\n ...util.normalizeParams(params),\n size,\n });\n}\nexport function _maxLength(maximum, params) {\n const ch = new checks.$ZodCheckMaxLength({\n check: \"max_length\",\n ...util.normalizeParams(params),\n maximum,\n });\n return ch;\n}\nexport function _minLength(minimum, params) {\n return new checks.$ZodCheckMinLength({\n check: \"min_length\",\n ...util.normalizeParams(params),\n minimum,\n });\n}\nexport function _length(length, params) {\n return new checks.$ZodCheckLengthEquals({\n check: \"length_equals\",\n ...util.normalizeParams(params),\n length,\n });\n}\nexport function _regex(pattern, params) {\n return new checks.$ZodCheckRegex({\n check: \"string_format\",\n format: \"regex\",\n ...util.normalizeParams(params),\n pattern,\n });\n}\nexport function _lowercase(params) {\n return new checks.$ZodCheckLowerCase({\n check: \"string_format\",\n format: \"lowercase\",\n ...util.normalizeParams(params),\n });\n}\nexport function _uppercase(params) {\n return new checks.$ZodCheckUpperCase({\n check: \"string_format\",\n format: \"uppercase\",\n ...util.normalizeParams(params),\n });\n}\nexport function _includes(includes, params) {\n return new checks.$ZodCheckIncludes({\n check: \"string_format\",\n format: \"includes\",\n ...util.normalizeParams(params),\n includes,\n });\n}\nexport function _startsWith(prefix, params) {\n return new checks.$ZodCheckStartsWith({\n check: \"string_format\",\n format: \"starts_with\",\n ...util.normalizeParams(params),\n prefix,\n });\n}\nexport function _endsWith(suffix, params) {\n return new checks.$ZodCheckEndsWith({\n check: \"string_format\",\n format: \"ends_with\",\n ...util.normalizeParams(params),\n suffix,\n });\n}\nexport function _property(property, schema, params) {\n return new checks.$ZodCheckProperty({\n check: \"property\",\n property,\n schema,\n ...util.normalizeParams(params),\n });\n}\nexport function _mime(types, params) {\n return new checks.$ZodCheckMimeType({\n check: \"mime_type\",\n mime: types,\n ...util.normalizeParams(params),\n });\n}\nexport function _overwrite(tx) {\n return new checks.$ZodCheckOverwrite({\n check: \"overwrite\",\n tx,\n });\n}\n// normalize\nexport function _normalize(form) {\n return _overwrite((input) => input.normalize(form));\n}\n// trim\nexport function _trim() {\n return _overwrite((input) => input.trim());\n}\n// toLowerCase\nexport function _toLowerCase() {\n return _overwrite((input) => input.toLowerCase());\n}\n// toUpperCase\nexport function _toUpperCase() {\n return _overwrite((input) => input.toUpperCase());\n}\nexport function _array(Class, element, params) {\n return new Class({\n type: \"array\",\n element,\n // get element() {\n // return element;\n // },\n ...util.normalizeParams(params),\n });\n}\nexport function _union(Class, options, params) {\n return new Class({\n type: \"union\",\n options,\n ...util.normalizeParams(params),\n });\n}\nexport function _discriminatedUnion(Class, discriminator, options, params) {\n return new Class({\n type: \"union\",\n options,\n discriminator,\n ...util.normalizeParams(params),\n });\n}\nexport function _intersection(Class, left, right) {\n return new Class({\n type: \"intersection\",\n left,\n right,\n });\n}\n// export function _tuple(\n// Class: util.SchemaClass<schemas.$ZodTuple>,\n// items: [],\n// params?: string | $ZodTupleParams\n// ): schemas.$ZodTuple<[], null>;\nexport function _tuple(Class, items, _paramsOrRest, _params) {\n const hasRest = _paramsOrRest instanceof schemas.$ZodType;\n const params = hasRest ? _params : _paramsOrRest;\n const rest = hasRest ? _paramsOrRest : null;\n return new Class({\n type: \"tuple\",\n items,\n rest,\n ...util.normalizeParams(params),\n });\n}\nexport function _record(Class, keyType, valueType, params) {\n return new Class({\n type: \"record\",\n keyType,\n valueType,\n ...util.normalizeParams(params),\n });\n}\nexport function _map(Class, keyType, valueType, params) {\n return new Class({\n type: \"map\",\n keyType,\n valueType,\n ...util.normalizeParams(params),\n });\n}\nexport function _set(Class, valueType, params) {\n return new Class({\n type: \"set\",\n valueType,\n ...util.normalizeParams(params),\n });\n}\nexport function _enum(Class, values, params) {\n const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;\n // if (Array.isArray(values)) {\n // for (const value of values) {\n // entries[value] = value;\n // }\n // } else {\n // Object.assign(entries, values);\n // }\n // const entries: util.EnumLike = {};\n // for (const val of values) {\n // entries[val] = val;\n // }\n return new Class({\n type: \"enum\",\n entries,\n ...util.normalizeParams(params),\n });\n}\n/** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.\n *\n * ```ts\n * enum Colors { red, green, blue }\n * z.enum(Colors);\n * ```\n */\nexport function _nativeEnum(Class, entries, params) {\n return new Class({\n type: \"enum\",\n entries,\n ...util.normalizeParams(params),\n });\n}\nexport function _literal(Class, value, params) {\n return new Class({\n type: \"literal\",\n values: Array.isArray(value) ? value : [value],\n ...util.normalizeParams(params),\n });\n}\nexport function _file(Class, params) {\n return new Class({\n type: \"file\",\n ...util.normalizeParams(params),\n });\n}\nexport function _transform(Class, fn) {\n return new Class({\n type: \"transform\",\n transform: fn,\n });\n}\nexport function _optional(Class, innerType) {\n return new Class({\n type: \"optional\",\n innerType,\n });\n}\nexport function _nullable(Class, innerType) {\n return new Class({\n type: \"nullable\",\n innerType,\n });\n}\nexport function _default(Class, innerType, defaultValue) {\n return new Class({\n type: \"default\",\n innerType,\n get defaultValue() {\n return typeof defaultValue === \"function\" ? defaultValue() : util.shallowClone(defaultValue);\n },\n });\n}\nexport function _nonoptional(Class, innerType, params) {\n return new Class({\n type: \"nonoptional\",\n innerType,\n ...util.normalizeParams(params),\n });\n}\nexport function _success(Class, innerType) {\n return new Class({\n type: \"success\",\n innerType,\n });\n}\nexport function _catch(Class, innerType, catchValue) {\n return new Class({\n type: \"catch\",\n innerType,\n catchValue: (typeof catchValue === \"function\" ? catchValue : () => catchValue),\n });\n}\nexport function _pipe(Class, in_, out) {\n return new Class({\n type: \"pipe\",\n in: in_,\n out,\n });\n}\nexport function _readonly(Class, innerType) {\n return new Class({\n type: \"readonly\",\n innerType,\n });\n}\nexport function _templateLiteral(Class, parts, params) {\n return new Class({\n type: \"template_literal\",\n parts,\n ...util.normalizeParams(params),\n });\n}\nexport function _lazy(Class, getter) {\n return new Class({\n type: \"lazy\",\n getter,\n });\n}\nexport function _promise(Class, innerType) {\n return new Class({\n type: \"promise\",\n innerType,\n });\n}\nexport function _custom(Class, fn, _params) {\n const norm = util.normalizeParams(_params);\n norm.abort ?? (norm.abort = true); // default to abort:false\n const schema = new Class({\n type: \"custom\",\n check: \"custom\",\n fn: fn,\n ...norm,\n });\n return schema;\n}\n// same as _custom but defaults to abort:false\nexport function _refine(Class, fn, _params) {\n const schema = new Class({\n type: \"custom\",\n check: \"custom\",\n fn: fn,\n ...util.normalizeParams(_params),\n });\n return schema;\n}\nexport function _superRefine(fn) {\n const ch = _check((payload) => {\n payload.addIssue = (issue) => {\n if (typeof issue === \"string\") {\n payload.issues.push(util.issue(issue, payload.value, ch._zod.def));\n }\n else {\n // for Zod 3 backwards compatibility\n const _issue = issue;\n if (_issue.fatal)\n _issue.continue = false;\n _issue.code ?? (_issue.code = \"custom\");\n _issue.input ?? (_issue.input = payload.value);\n _issue.inst ?? (_issue.inst = ch);\n _issue.continue ?? (_issue.continue = !ch._zod.def.abort); // abort is always undefined, so this is always true...\n payload.issues.push(util.issue(_issue));\n }\n };\n return fn(payload.value, payload);\n });\n return ch;\n}\nexport function _check(fn, params) {\n const ch = new checks.$ZodCheck({\n check: \"custom\",\n ...util.normalizeParams(params),\n });\n ch._zod.check = fn;\n return ch;\n}\nexport function _stringbool(Classes, _params) {\n const params = util.normalizeParams(_params);\n let truthyArray = params.truthy ?? [\"true\", \"1\", \"yes\", \"on\", \"y\", \"enabled\"];\n let falsyArray = params.falsy ?? [\"false\", \"0\", \"no\", \"off\", \"n\", \"disabled\"];\n if (params.case !== \"sensitive\") {\n truthyArray = truthyArray.map((v) => (typeof v === \"string\" ? v.toLowerCase() : v));\n falsyArray = falsyArray.map((v) => (typeof v === \"string\" ? v.toLowerCase() : v));\n }\n const truthySet = new Set(truthyArray);\n const falsySet = new Set(falsyArray);\n const _Codec = Classes.Codec ?? schemas.$ZodCodec;\n const _Boolean = Classes.Boolean ?? schemas.$ZodBoolean;\n const _String = Classes.String ?? schemas.$ZodString;\n const stringSchema = new _String({ type: \"string\", error: params.error });\n const booleanSchema = new _Boolean({ type: \"boolean\", error: params.error });\n const codec = new _Codec({\n type: \"pipe\",\n in: stringSchema,\n out: booleanSchema,\n transform: ((input, payload) => {\n let data = input;\n if (params.case !== \"sensitive\")\n data = data.toLowerCase();\n if (truthySet.has(data)) {\n return true;\n }\n else if (falsySet.has(data)) {\n return false;\n }\n else {\n payload.issues.push({\n code: \"invalid_value\",\n expected: \"stringbool\",\n values: [...truthySet, ...falsySet],\n input: payload.value,\n inst: codec,\n continue: false,\n });\n return {};\n }\n }),\n reverseTransform: ((input, _payload) => {\n if (input === true) {\n return truthyArray[0] || \"true\";\n }\n else {\n return falsyArray[0] || \"false\";\n }\n }),\n error: params.error,\n });\n return codec;\n}\nexport function _stringFormat(Class, format, fnOrRegex, _params = {}) {\n const params = util.normalizeParams(_params);\n const def = {\n ...util.normalizeParams(_params),\n check: \"string_format\",\n type: \"string\",\n format,\n fn: typeof fnOrRegex === \"function\" ? fnOrRegex : (val) => fnOrRegex.test(val),\n ...params,\n };\n if (fnOrRegex instanceof RegExp) {\n def.pattern = fnOrRegex;\n }\n const inst = new Class(def);\n return inst;\n}\n"],"names":["util.normalizeParams"],"mappings":";AAGO,SAAS,QAAQ,OAAO,QAAQ;AACnC,SAAO,IAAI,MAAM;AAAA,IACb,MAAM;AAAA,IACN,GAAGA,gBAA2B;AAAA,EACtC,CAAK;AACL;","x_google_ignoreList":[0]}
@@ -0,0 +1,58 @@
1
+ function $constructor(name, initializer, params) {
2
+ function init(inst, def) {
3
+ var _a;
4
+ Object.defineProperty(inst, "_zod", {
5
+ value: inst._zod ?? {},
6
+ enumerable: false
7
+ });
8
+ (_a = inst._zod).traits ?? (_a.traits = /* @__PURE__ */ new Set());
9
+ inst._zod.traits.add(name);
10
+ initializer(inst, def);
11
+ for (const k in _.prototype) {
12
+ if (!(k in inst))
13
+ Object.defineProperty(inst, k, { value: _.prototype[k].bind(inst) });
14
+ }
15
+ inst._zod.constr = _;
16
+ inst._zod.def = def;
17
+ }
18
+ const Parent = params?.Parent ?? Object;
19
+ class Definition extends Parent {
20
+ }
21
+ Object.defineProperty(Definition, "name", { value: name });
22
+ function _(def) {
23
+ var _a;
24
+ const inst = params?.Parent ? new Definition() : this;
25
+ init(inst, def);
26
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
27
+ for (const fn of inst._zod.deferred) {
28
+ fn();
29
+ }
30
+ return inst;
31
+ }
32
+ Object.defineProperty(_, "init", { value: init });
33
+ Object.defineProperty(_, Symbol.hasInstance, {
34
+ value: (inst) => {
35
+ if (params?.Parent && inst instanceof params.Parent)
36
+ return true;
37
+ return inst?._zod?.traits?.has(name);
38
+ }
39
+ });
40
+ Object.defineProperty(_, "name", { value: name });
41
+ return _;
42
+ }
43
+ class $ZodAsyncError extends Error {
44
+ constructor() {
45
+ super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
46
+ }
47
+ }
48
+ const globalConfig = {};
49
+ function config(newConfig) {
50
+ return globalConfig;
51
+ }
52
+ export {
53
+ $ZodAsyncError,
54
+ $constructor,
55
+ config,
56
+ globalConfig
57
+ };
58
+ //# sourceMappingURL=core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.js","sources":["../../../../../../../../../../node_modules/.pnpm/zod@4.1.11/node_modules/zod/v4/core/core.js"],"sourcesContent":["/** A special constant with type `never` */\nexport const NEVER = Object.freeze({\n status: \"aborted\",\n});\nexport /*@__NO_SIDE_EFFECTS__*/ function $constructor(name, initializer, params) {\n function init(inst, def) {\n var _a;\n Object.defineProperty(inst, \"_zod\", {\n value: inst._zod ?? {},\n enumerable: false,\n });\n (_a = inst._zod).traits ?? (_a.traits = new Set());\n inst._zod.traits.add(name);\n initializer(inst, def);\n // support prototype modifications\n for (const k in _.prototype) {\n if (!(k in inst))\n Object.defineProperty(inst, k, { value: _.prototype[k].bind(inst) });\n }\n inst._zod.constr = _;\n inst._zod.def = def;\n }\n // doesn't work if Parent has a constructor with arguments\n const Parent = params?.Parent ?? Object;\n class Definition extends Parent {\n }\n Object.defineProperty(Definition, \"name\", { value: name });\n function _(def) {\n var _a;\n const inst = params?.Parent ? new Definition() : this;\n init(inst, def);\n (_a = inst._zod).deferred ?? (_a.deferred = []);\n for (const fn of inst._zod.deferred) {\n fn();\n }\n return inst;\n }\n Object.defineProperty(_, \"init\", { value: init });\n Object.defineProperty(_, Symbol.hasInstance, {\n value: (inst) => {\n if (params?.Parent && inst instanceof params.Parent)\n return true;\n return inst?._zod?.traits?.has(name);\n },\n });\n Object.defineProperty(_, \"name\", { value: name });\n return _;\n}\n////////////////////////////// UTILITIES ///////////////////////////////////////\nexport const $brand = Symbol(\"zod_brand\");\nexport class $ZodAsyncError extends Error {\n constructor() {\n super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);\n }\n}\nexport class $ZodEncodeError extends Error {\n constructor(name) {\n super(`Encountered unidirectional transform during encode: ${name}`);\n this.name = \"ZodEncodeError\";\n }\n}\nexport const globalConfig = {};\nexport function config(newConfig) {\n if (newConfig)\n Object.assign(globalConfig, newConfig);\n return globalConfig;\n}\n"],"names":[],"mappings":"AAIgC,SAAS,aAAa,MAAM,aAAa,QAAQ;AAC7E,WAAS,KAAK,MAAM,KAAK;AACrB,QAAI;AACJ,WAAO,eAAe,MAAM,QAAQ;AAAA,MAChC,OAAO,KAAK,QAAQ,CAAA;AAAA,MACpB,YAAY;AAAA,IACxB,CAAS;AACD,KAAC,KAAK,KAAK,MAAM,WAAW,GAAG,SAAS,oBAAI;AAC5C,SAAK,KAAK,OAAO,IAAI,IAAI;AACzB,gBAAY,MAAM,GAAG;AAErB,eAAW,KAAK,EAAE,WAAW;AACzB,UAAI,EAAE,KAAK;AACP,eAAO,eAAe,MAAM,GAAG,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,KAAK,IAAI,EAAC,CAAE;AAAA,IAC3E;AACA,SAAK,KAAK,SAAS;AACnB,SAAK,KAAK,MAAM;AAAA,EACpB;AAEA,QAAM,SAAS,QAAQ,UAAU;AAAA,EACjC,MAAM,mBAAmB,OAAO;AAAA,EACpC;AACI,SAAO,eAAe,YAAY,QAAQ,EAAE,OAAO,MAAM;AACzD,WAAS,EAAE,KAAK;AACZ,QAAI;AACJ,UAAM,OAAO,QAAQ,SAAS,IAAI,WAAU,IAAK;AACjD,SAAK,MAAM,GAAG;AACd,KAAC,KAAK,KAAK,MAAM,aAAa,GAAG,WAAW;AAC5C,eAAW,MAAM,KAAK,KAAK,UAAU;AACjC,SAAE;AAAA,IACN;AACA,WAAO;AAAA,EACX;AACA,SAAO,eAAe,GAAG,QAAQ,EAAE,OAAO,MAAM;AAChD,SAAO,eAAe,GAAG,OAAO,aAAa;AAAA,IACzC,OAAO,CAAC,SAAS;AACb,UAAI,QAAQ,UAAU,gBAAgB,OAAO;AACzC,eAAO;AACX,aAAO,MAAM,MAAM,QAAQ,IAAI,IAAI;AAAA,IACvC;AAAA,EACR,CAAK;AACD,SAAO,eAAe,GAAG,QAAQ,EAAE,OAAO,MAAM;AAChD,SAAO;AACX;AAGO,MAAM,uBAAuB,MAAM;AAAA,EACtC,cAAc;AACV,UAAM,0EAA0E;AAAA,EACpF;AACJ;AAOY,MAAC,eAAe,CAAA;AACrB,SAAS,OAAO,WAAW;AAG9B,SAAO;AACX;","x_google_ignoreList":[0]}
@@ -0,0 +1,25 @@
1
+ import { $constructor } from "./core.js";
2
+ import { jsonStringifyReplacer } from "./util.js";
3
+ const initializer = (inst, def) => {
4
+ inst.name = "$ZodError";
5
+ Object.defineProperty(inst, "_zod", {
6
+ value: inst._zod,
7
+ enumerable: false
8
+ });
9
+ Object.defineProperty(inst, "issues", {
10
+ value: def,
11
+ enumerable: false
12
+ });
13
+ inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
14
+ Object.defineProperty(inst, "toString", {
15
+ value: () => inst.message,
16
+ enumerable: false
17
+ });
18
+ };
19
+ const $ZodError = $constructor("$ZodError", initializer);
20
+ const $ZodRealError = $constructor("$ZodError", initializer, { Parent: Error });
21
+ export {
22
+ $ZodError,
23
+ $ZodRealError
24
+ };
25
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sources":["../../../../../../../../../../node_modules/.pnpm/zod@4.1.11/node_modules/zod/v4/core/errors.js"],"sourcesContent":["import { $constructor } from \"./core.js\";\nimport * as util from \"./util.js\";\nconst initializer = (inst, def) => {\n inst.name = \"$ZodError\";\n Object.defineProperty(inst, \"_zod\", {\n value: inst._zod,\n enumerable: false,\n });\n Object.defineProperty(inst, \"issues\", {\n value: def,\n enumerable: false,\n });\n inst.message = JSON.stringify(def, util.jsonStringifyReplacer, 2);\n Object.defineProperty(inst, \"toString\", {\n value: () => inst.message,\n enumerable: false,\n });\n};\nexport const $ZodError = $constructor(\"$ZodError\", initializer);\nexport const $ZodRealError = $constructor(\"$ZodError\", initializer, { Parent: Error });\nexport function flattenError(error, mapper = (issue) => issue.message) {\n const fieldErrors = {};\n const formErrors = [];\n for (const sub of error.issues) {\n if (sub.path.length > 0) {\n fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];\n fieldErrors[sub.path[0]].push(mapper(sub));\n }\n else {\n formErrors.push(mapper(sub));\n }\n }\n return { formErrors, fieldErrors };\n}\nexport function formatError(error, _mapper) {\n const mapper = _mapper ||\n function (issue) {\n return issue.message;\n };\n const fieldErrors = { _errors: [] };\n const processError = (error) => {\n for (const issue of error.issues) {\n if (issue.code === \"invalid_union\" && issue.errors.length) {\n issue.errors.map((issues) => processError({ issues }));\n }\n else if (issue.code === \"invalid_key\") {\n processError({ issues: issue.issues });\n }\n else if (issue.code === \"invalid_element\") {\n processError({ issues: issue.issues });\n }\n else if (issue.path.length === 0) {\n fieldErrors._errors.push(mapper(issue));\n }\n else {\n let curr = fieldErrors;\n let i = 0;\n while (i < issue.path.length) {\n const el = issue.path[i];\n const terminal = i === issue.path.length - 1;\n if (!terminal) {\n curr[el] = curr[el] || { _errors: [] };\n }\n else {\n curr[el] = curr[el] || { _errors: [] };\n curr[el]._errors.push(mapper(issue));\n }\n curr = curr[el];\n i++;\n }\n }\n }\n };\n processError(error);\n return fieldErrors;\n}\nexport function treeifyError(error, _mapper) {\n const mapper = _mapper ||\n function (issue) {\n return issue.message;\n };\n const result = { errors: [] };\n const processError = (error, path = []) => {\n var _a, _b;\n for (const issue of error.issues) {\n if (issue.code === \"invalid_union\" && issue.errors.length) {\n // regular union error\n issue.errors.map((issues) => processError({ issues }, issue.path));\n }\n else if (issue.code === \"invalid_key\") {\n processError({ issues: issue.issues }, issue.path);\n }\n else if (issue.code === \"invalid_element\") {\n processError({ issues: issue.issues }, issue.path);\n }\n else {\n const fullpath = [...path, ...issue.path];\n if (fullpath.length === 0) {\n result.errors.push(mapper(issue));\n continue;\n }\n let curr = result;\n let i = 0;\n while (i < fullpath.length) {\n const el = fullpath[i];\n const terminal = i === fullpath.length - 1;\n if (typeof el === \"string\") {\n curr.properties ?? (curr.properties = {});\n (_a = curr.properties)[el] ?? (_a[el] = { errors: [] });\n curr = curr.properties[el];\n }\n else {\n curr.items ?? (curr.items = []);\n (_b = curr.items)[el] ?? (_b[el] = { errors: [] });\n curr = curr.items[el];\n }\n if (terminal) {\n curr.errors.push(mapper(issue));\n }\n i++;\n }\n }\n }\n };\n processError(error);\n return result;\n}\n/** Format a ZodError as a human-readable string in the following form.\n *\n * From\n *\n * ```ts\n * ZodError {\n * issues: [\n * {\n * expected: 'string',\n * code: 'invalid_type',\n * path: [ 'username' ],\n * message: 'Invalid input: expected string'\n * },\n * {\n * expected: 'number',\n * code: 'invalid_type',\n * path: [ 'favoriteNumbers', 1 ],\n * message: 'Invalid input: expected number'\n * }\n * ];\n * }\n * ```\n *\n * to\n *\n * ```\n * username\n * ✖ Expected number, received string at \"username\n * favoriteNumbers[0]\n * ✖ Invalid input: expected number\n * ```\n */\nexport function toDotPath(_path) {\n const segs = [];\n const path = _path.map((seg) => (typeof seg === \"object\" ? seg.key : seg));\n for (const seg of path) {\n if (typeof seg === \"number\")\n segs.push(`[${seg}]`);\n else if (typeof seg === \"symbol\")\n segs.push(`[${JSON.stringify(String(seg))}]`);\n else if (/[^\\w$]/.test(seg))\n segs.push(`[${JSON.stringify(seg)}]`);\n else {\n if (segs.length)\n segs.push(\".\");\n segs.push(seg);\n }\n }\n return segs.join(\"\");\n}\nexport function prettifyError(error) {\n const lines = [];\n // sort by path length\n const issues = [...error.issues].sort((a, b) => (a.path ?? []).length - (b.path ?? []).length);\n // Process each issue\n for (const issue of issues) {\n lines.push(`✖ ${issue.message}`);\n if (issue.path?.length)\n lines.push(` → at ${toDotPath(issue.path)}`);\n }\n // Convert Map to formatted string\n return lines.join(\"\\n\");\n}\n"],"names":["util.jsonStringifyReplacer"],"mappings":";;AAEA,MAAM,cAAc,CAAC,MAAM,QAAQ;AAC/B,OAAK,OAAO;AACZ,SAAO,eAAe,MAAM,QAAQ;AAAA,IAChC,OAAO,KAAK;AAAA,IACZ,YAAY;AAAA,EACpB,CAAK;AACD,SAAO,eAAe,MAAM,UAAU;AAAA,IAClC,OAAO;AAAA,IACP,YAAY;AAAA,EACpB,CAAK;AACD,OAAK,UAAU,KAAK,UAAU,KAAKA,uBAA4B,CAAC;AAChE,SAAO,eAAe,MAAM,YAAY;AAAA,IACpC,OAAO,MAAM,KAAK;AAAA,IAClB,YAAY;AAAA,EACpB,CAAK;AACL;AACY,MAAC,YAAY,aAAa,aAAa,WAAW;AAClD,MAAC,gBAAgB,aAAa,aAAa,aAAa,EAAE,QAAQ,MAAK,CAAE;","x_google_ignoreList":[0]}