@mintlify/msft-sdk 1.1.27 → 1.1.28

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 (27) hide show
  1. package/dist/api-playground/ApiPlayground/index.js +13 -13
  2. package/dist/api-playground/ApiPlayground/index.js.map +1 -1
  3. package/dist/api-playground/EndpointFields/ParamFields/RecursiveParamField.js +7 -6
  4. package/dist/api-playground/EndpointFields/ParamFields/RecursiveParamField.js.map +1 -1
  5. package/dist/api-playground/EndpointFields/index.js +4 -3
  6. package/dist/api-playground/EndpointFields/index.js.map +1 -1
  7. package/dist/api-playground-2/OperationPage.js +1 -1
  8. package/dist/api-playground-2/OperationPage.js.map +1 -1
  9. package/dist/components/content-components/callouts.js +1 -1
  10. package/dist/components/content-components/callouts.js.map +1 -1
  11. package/dist/components/content-components/code-block.js +24 -24
  12. package/dist/components/content-components/code-block.js.map +1 -1
  13. package/dist/components/content-components/code-group.js +12 -12
  14. package/dist/components/content-components/code-group.js.map +1 -1
  15. package/dist/components/docsLayout.js +6 -6
  16. package/dist/components/docsLayout.js.map +1 -1
  17. package/dist/components/docsPage.js +24 -24
  18. package/dist/components/docsPage.js.map +1 -1
  19. package/dist/components/nav-tree/index.js +131 -127
  20. package/dist/components/nav-tree/index.js.map +1 -1
  21. package/dist/components/nav-tree/mobile-nav.js +2 -2
  22. package/dist/components/nav-tree/mobile-nav.js.map +1 -1
  23. package/dist/components/page-context-menu.js +61 -130
  24. package/dist/components/page-context-menu.js.map +1 -1
  25. package/dist/index.d.ts +4 -1
  26. package/dist/styles.css +1 -1
  27. package/package.json +9 -10
@@ -1,5 +1,5 @@
1
- import { jsx as s } from "react/jsx-runtime";
2
- import { useContext as U, useState as n, useEffect as b } from "react";
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { useContext as U, useState as o, useEffect as b } from "react";
3
3
  import { DocsConfigContext as L } from "../../contexts/ConfigContext.js";
4
4
  import { EndpointLocationProvider as T } from "../../contexts/EndpointLocationContext.js";
5
5
  import { useBaseUrlOptions as j } from "../../hooks/useBaseUrlOptions.js";
@@ -11,9 +11,9 @@ import { useSendPlaygroundRequest as N } from "../../hooks/useSendPlaygroundRequ
11
11
  import Q from "../../components/Api/ErrorBoundary.js";
12
12
  import { ApiPlaygroundContext as W } from "./ApiPlaygroundContext.js";
13
13
  import { Request as _ } from "./Request/index.js";
14
- const oe = ({ endpoint: r, display: f, pathname: x }) => {
15
- var m, p;
16
- const { docsConfig: a } = U(L), h = F(), I = D(), g = K(), e = j(), [c, P] = n(0), [l, i] = n(!1), [S, w] = n(!1), [E, B] = n(), [k, z] = n(0), v = Object.keys(r.request.body)[k], [A, C] = n(0), R = (e == null ? void 0 : e[c]) ?? (e == null ? void 0 : e[0]) ?? "";
14
+ const se = ({ endpoint: r, display: f, pathname: x }) => {
15
+ var p, m;
16
+ const { docsConfig: a } = U(L), h = F(), I = D(), g = K(), e = j(), [c, P] = o(0), [l, i] = o(!1), [S, w] = o(!1), [E, B] = o(), [k, z] = o(0), v = Object.keys(r.request.body)[k], [A, C] = o(0), R = (e == null ? void 0 : e[c]) ?? (e == null ? void 0 : e[0]) ?? "";
17
17
  b(() => {
18
18
  new URLSearchParams(window.location.search).has("playground") && requestAnimationFrame(() => {
19
19
  i(!0);
@@ -29,21 +29,21 @@ const oe = ({ endpoint: r, display: f, pathname: x }) => {
29
29
  P(t), g(t);
30
30
  }, u = (t) => {
31
31
  if (i(t), t) {
32
- const o = new URL(window.location.href);
33
- o.searchParams.set("playground", "open"), window.history.replaceState({}, "", o);
32
+ const s = new URL(window.location.href);
33
+ s.searchParams.set("playground", "open"), window.history.replaceState({}, "", s);
34
34
  } else {
35
- const o = new URL(window.location.href);
36
- o.searchParams.delete("playground"), window.history.replaceState({}, "", o);
35
+ const s = new URL(window.location.href);
36
+ s.searchParams.delete("playground"), window.history.replaceState({}, "", s);
37
37
  }
38
38
  };
39
39
  return y({
40
40
  key: "Enter",
41
- callback: ((p = (m = a == null ? void 0 : a.api) == null ? void 0 : m.playground) == null ? void 0 : p.display) === "interactive" ? d : void 0
41
+ callback: ((m = (p = a == null ? void 0 : a.api) == null ? void 0 : p.playground) == null ? void 0 : m.display) === "interactive" ? d : void 0
42
42
  }), y({
43
43
  key: "Escape",
44
44
  callback: l ? () => u(!1) : void 0,
45
45
  isSingleKey: !0
46
- }), /* @__PURE__ */ s(Q, { children: /* @__PURE__ */ s(
46
+ }), /* @__PURE__ */ n(Q, { children: /* @__PURE__ */ n(
47
47
  W.Provider,
48
48
  {
49
49
  value: {
@@ -58,11 +58,11 @@ const oe = ({ endpoint: r, display: f, pathname: x }) => {
58
58
  selectedExampleIndex: A,
59
59
  setSelectedExampleIndex: C
60
60
  },
61
- children: /* @__PURE__ */ s("div", { className: "mint:mt-6 mint:flex mint:w-full mint:flex-col mint:space-y-4", children: /* @__PURE__ */ s(T, { location: "request", children: /* @__PURE__ */ s(_, { inputs: h, setInputs: I, endpoint: r, display: f, pathname: x }) }) })
61
+ children: /* @__PURE__ */ n("div", { className: "mint:flex mint:w-full mint:flex-col mint:space-y-4", children: /* @__PURE__ */ n(T, { location: "request", children: /* @__PURE__ */ n(_, { inputs: h, setInputs: I, endpoint: r, display: f, pathname: x }) }) })
62
62
  }
63
63
  ) });
64
64
  };
65
65
  export {
66
- oe as ApiPlayground
66
+ se as ApiPlayground
67
67
  };
68
68
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/api-playground/ApiPlayground/index.tsx"],"sourcesContent":["\nimport { ApiPlaygroundResultType, ApiPlaygroundDisplayType } from '@mintlify/models';\nimport { Endpoint } from '@mintlify/validation';\nimport { useContext, useEffect, useState } from 'react';\n\nimport { DocsConfigContext } from '@/contexts/ConfigContext';\nimport { EndpointLocationProvider } from '@/contexts/EndpointLocationContext';\nimport { useBaseUrlOptions } from '../../hooks/useBaseUrlOptions';\nimport { useKeyboardShortcut } from '@/hooks/useKeyboardShortcut';\nimport { useApiPlaygroundInputs } from '@/hooks/useMDXContentController/useApiPlaygroundInputs';\nimport { useSetApiBaseIndexCallback } from '@/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiBaseIndexCallback';\nimport { useSetApiPlaygroundInputsCallback } from '@/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiPlaygroundInputsCallback';\nimport { useSendPlaygroundRequest } from '@/hooks/useSendPlaygroundRequest';\nimport ErrorBoundary from '@/components/Api/ErrorBoundary';\n\nimport { ApiPlaygroundContext } from './ApiPlaygroundContext';\nimport { Request } from './Request';\nimport { cn } from \"../../utils/cn\";\n\ntype ApiPlaygroundParams = {\n endpoint: Endpoint;\n display: ApiPlaygroundDisplayType;\n pathname: string;\n};\n\nexport const ApiPlayground = ({ endpoint, display, pathname }: ApiPlaygroundParams) => {\n const { docsConfig } = useContext(DocsConfigContext);\n const inputs = useApiPlaygroundInputs();\n const setInputs = useSetApiPlaygroundInputsCallback();\n const setApiBaseIndex = useSetApiBaseIndexCallback();\n\n const baseUrlOptions = useBaseUrlOptions();\n const [selectedBaseUrlIndex, setSelectedBaseUrlIndex] = useState(0);\n const [isPlaygroundExpanded, setIsPlaygroundExpanded] = useState(false);\n\n const [isSending, setIsSending] = useState(false);\n const [result, setResult] = useState<ApiPlaygroundResultType>();\n\n const [selectedContentTypeIndex, _setSelectedContentTypeIndex] = useState(0);\n const contentType = Object.keys(endpoint.request.body)[selectedContentTypeIndex];\n const [selectedExampleIndex, setSelectedExampleIndex] = useState(0);\n\n const baseUrl = baseUrlOptions?.[selectedBaseUrlIndex] ?? baseUrlOptions?.[0] ?? '';\n\n useEffect(() => {\n const searchParams = new URLSearchParams(window.location.search);\n if (searchParams.has('playground')) {\n requestAnimationFrame(() => {\n setIsPlaygroundExpanded(true);\n });\n }\n }, []);\n\n const sendRequest = useSendPlaygroundRequest({\n endpoint,\n baseUrl,\n contentType: contentType ?? 'application/json',\n setIsFetching: setIsSending,\n setResult,\n });\n\n const setBaseUrlIndex = (index: number) => {\n setSelectedBaseUrlIndex(index);\n setApiBaseIndex(index);\n };\n\n const setIsPlaygroundExpandedWithQueryParam = (expanded: boolean) => {\n setIsPlaygroundExpanded(expanded);\n if (expanded) {\n const url = new URL(window.location.href);\n url.searchParams.set('playground', 'open');\n window.history.replaceState({}, '', url);\n } else {\n const url = new URL(window.location.href);\n url.searchParams.delete('playground');\n window.history.replaceState({}, '', url);\n }\n };\n\n useKeyboardShortcut({\n key: 'Enter',\n callback: docsConfig?.api?.playground?.display === 'interactive' ? sendRequest : undefined,\n });\n useKeyboardShortcut({\n key: 'Escape',\n callback: isPlaygroundExpanded ? () => setIsPlaygroundExpandedWithQueryParam(false) : undefined,\n isSingleKey: true,\n });\n\n return (\n <ErrorBoundary>\n <ApiPlaygroundContext.Provider\n value={{\n isSending,\n sendRequest,\n result,\n setSelectedBaseUrlIndex: setBaseUrlIndex,\n selectedBaseUrlIndex,\n baseUrlOptions,\n isPlaygroundExpanded,\n setIsPlaygroundExpanded: setIsPlaygroundExpandedWithQueryParam,\n selectedExampleIndex,\n setSelectedExampleIndex,\n }}\n >\n <div className=\"mint:mt-6 mint:flex mint:w-full mint:flex-col mint:space-y-4\">\n <EndpointLocationProvider location=\"request\">\n <Request inputs={inputs} setInputs={setInputs} endpoint={endpoint} display={display} pathname={pathname} />\n </EndpointLocationProvider>\n </div>\n </ApiPlaygroundContext.Provider>\n </ErrorBoundary>\n );\n};\n"],"names":["ApiPlayground","endpoint","display","pathname","docsConfig","useContext","DocsConfigContext","inputs","useApiPlaygroundInputs","setInputs","useSetApiPlaygroundInputsCallback","setApiBaseIndex","useSetApiBaseIndexCallback","baseUrlOptions","useBaseUrlOptions","selectedBaseUrlIndex","setSelectedBaseUrlIndex","useState","isPlaygroundExpanded","setIsPlaygroundExpanded","isSending","setIsSending","result","setResult","selectedContentTypeIndex","_setSelectedContentTypeIndex","contentType","selectedExampleIndex","setSelectedExampleIndex","baseUrl","useEffect","sendRequest","useSendPlaygroundRequest","setBaseUrlIndex","index","setIsPlaygroundExpandedWithQueryParam","expanded","url","useKeyboardShortcut","_b","_a","ErrorBoundary","jsx","ApiPlaygroundContext","EndpointLocationProvider","Request"],"mappings":";;;;;;;;;;;;;AAyBO,MAAMA,KAAgB,CAAC,EAAE,UAAAC,GAAU,SAAAC,GAAS,UAAAC,QAAoC;;AACrF,QAAM,EAAE,YAAAC,EAAA,IAAeC,EAAWC,CAAiB,GAC7CC,IAASC,EAAA,GACTC,IAAYC,EAAA,GACZC,IAAkBC,EAAA,GAElBC,IAAiBC,EAAA,GACjB,CAACC,GAAsBC,CAAuB,IAAIC,EAAS,CAAC,GAC5D,CAACC,GAAsBC,CAAuB,IAAIF,EAAS,EAAK,GAEhE,CAACG,GAAWC,CAAY,IAAIJ,EAAS,EAAK,GAC1C,CAACK,GAAQC,CAAS,IAAIN,EAAA,GAEtB,CAACO,GAA0BC,CAA4B,IAAIR,EAAS,CAAC,GACrES,IAAc,OAAO,KAAKzB,EAAS,QAAQ,IAAI,EAAEuB,CAAwB,GACzE,CAACG,GAAsBC,CAAuB,IAAIX,EAAS,CAAC,GAE5DY,KAAUhB,KAAA,gBAAAA,EAAiBE,QAAyBF,KAAA,gBAAAA,EAAiB,OAAM;AAEjF,EAAAiB,EAAU,MAAM;AAEd,IADqB,IAAI,gBAAgB,OAAO,SAAS,MAAM,EAC9C,IAAI,YAAY,KAC/B,sBAAsB,MAAM;AAC1B,MAAAX,EAAwB,EAAI;AAAA,IAC9B,CAAC;AAAA,EAEL,GAAG,CAAA,CAAE;AAEL,QAAMY,IAAcC,EAAyB;AAAA,IAC3C,UAAA/B;AAAA,IACA,SAAA4B;AAAA,IACA,aAAaH,KAAe;AAAA,IAC5B,eAAeL;AAAA,IACf,WAAAE;AAAA,EAAA,CACD,GAEKU,IAAkB,CAACC,MAAkB;AACzC,IAAAlB,EAAwBkB,CAAK,GAC7BvB,EAAgBuB,CAAK;AAAA,EACvB,GAEMC,IAAwC,CAACC,MAAsB;AAEnE,QADAjB,EAAwBiB,CAAQ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"sourcesContent":["\nimport { ApiPlaygroundResultType, ApiPlaygroundDisplayType } from '@mintlify/models';\nimport { Endpoint } from '@mintlify/validation';\nimport { useContext, useEffect, useState } from 'react';\n\nimport { DocsConfigContext } from '@/contexts/ConfigContext';\nimport { EndpointLocationProvider } from '@/contexts/EndpointLocationContext';\nimport { useBaseUrlOptions } from '../../hooks/useBaseUrlOptions';\nimport { useKeyboardShortcut } from '@/hooks/useKeyboardShortcut';\nimport { useApiPlaygroundInputs } from '@/hooks/useMDXContentController/useApiPlaygroundInputs';\nimport { useSetApiBaseIndexCallback } from '@/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiBaseIndexCallback';\nimport { useSetApiPlaygroundInputsCallback } from '@/hooks/useMDXContentController/useMDXContentCallbacks/useSetApiPlaygroundInputsCallback';\nimport { useSendPlaygroundRequest } from '@/hooks/useSendPlaygroundRequest';\nimport ErrorBoundary from '@/components/Api/ErrorBoundary';\n\nimport { ApiPlaygroundContext } from './ApiPlaygroundContext';\nimport { Request } from './Request';\nimport { cn } from \"../../utils/cn\";\n\ntype ApiPlaygroundParams = {\n endpoint: Endpoint;\n display: ApiPlaygroundDisplayType;\n pathname: string;\n};\n\nexport const ApiPlayground = ({ endpoint, display, pathname }: ApiPlaygroundParams) => {\n const { docsConfig } = useContext(DocsConfigContext);\n const inputs = useApiPlaygroundInputs();\n const setInputs = useSetApiPlaygroundInputsCallback();\n const setApiBaseIndex = useSetApiBaseIndexCallback();\n\n const baseUrlOptions = useBaseUrlOptions();\n const [selectedBaseUrlIndex, setSelectedBaseUrlIndex] = useState(0);\n const [isPlaygroundExpanded, setIsPlaygroundExpanded] = useState(false);\n\n const [isSending, setIsSending] = useState(false);\n const [result, setResult] = useState<ApiPlaygroundResultType>();\n\n const [selectedContentTypeIndex, _setSelectedContentTypeIndex] = useState(0);\n const contentType = Object.keys(endpoint.request.body)[selectedContentTypeIndex];\n const [selectedExampleIndex, setSelectedExampleIndex] = useState(0);\n\n const baseUrl = baseUrlOptions?.[selectedBaseUrlIndex] ?? baseUrlOptions?.[0] ?? '';\n\n useEffect(() => {\n const searchParams = new URLSearchParams(window.location.search);\n if (searchParams.has('playground')) {\n requestAnimationFrame(() => {\n setIsPlaygroundExpanded(true);\n });\n }\n }, []);\n\n const sendRequest = useSendPlaygroundRequest({\n endpoint,\n baseUrl,\n contentType: contentType ?? 'application/json',\n setIsFetching: setIsSending,\n setResult,\n });\n\n const setBaseUrlIndex = (index: number) => {\n setSelectedBaseUrlIndex(index);\n setApiBaseIndex(index);\n };\n\n const setIsPlaygroundExpandedWithQueryParam = (expanded: boolean) => {\n setIsPlaygroundExpanded(expanded);\n if (expanded) {\n const url = new URL(window.location.href);\n url.searchParams.set('playground', 'open');\n window.history.replaceState({}, '', url);\n } else {\n const url = new URL(window.location.href);\n url.searchParams.delete('playground');\n window.history.replaceState({}, '', url);\n }\n };\n\n useKeyboardShortcut({\n key: 'Enter',\n callback: docsConfig?.api?.playground?.display === 'interactive' ? sendRequest : undefined,\n });\n useKeyboardShortcut({\n key: 'Escape',\n callback: isPlaygroundExpanded ? () => setIsPlaygroundExpandedWithQueryParam(false) : undefined,\n isSingleKey: true,\n });\n\n return (\n <ErrorBoundary>\n <ApiPlaygroundContext.Provider\n value={{\n isSending,\n sendRequest,\n result,\n setSelectedBaseUrlIndex: setBaseUrlIndex,\n selectedBaseUrlIndex,\n baseUrlOptions,\n isPlaygroundExpanded,\n setIsPlaygroundExpanded: setIsPlaygroundExpandedWithQueryParam,\n selectedExampleIndex,\n setSelectedExampleIndex,\n }}\n >\n <div className=\"mint:flex mint:w-full mint:flex-col mint:space-y-4\">\n <EndpointLocationProvider location=\"request\">\n <Request inputs={inputs} setInputs={setInputs} endpoint={endpoint} display={display} pathname={pathname} />\n </EndpointLocationProvider>\n </div>\n </ApiPlaygroundContext.Provider>\n </ErrorBoundary>\n );\n};\n"],"names":["ApiPlayground","endpoint","display","pathname","docsConfig","useContext","DocsConfigContext","inputs","useApiPlaygroundInputs","setInputs","useSetApiPlaygroundInputsCallback","setApiBaseIndex","useSetApiBaseIndexCallback","baseUrlOptions","useBaseUrlOptions","selectedBaseUrlIndex","setSelectedBaseUrlIndex","useState","isPlaygroundExpanded","setIsPlaygroundExpanded","isSending","setIsSending","result","setResult","selectedContentTypeIndex","_setSelectedContentTypeIndex","contentType","selectedExampleIndex","setSelectedExampleIndex","baseUrl","useEffect","sendRequest","useSendPlaygroundRequest","setBaseUrlIndex","index","setIsPlaygroundExpandedWithQueryParam","expanded","url","useKeyboardShortcut","_b","_a","ErrorBoundary","jsx","ApiPlaygroundContext","EndpointLocationProvider","Request"],"mappings":";;;;;;;;;;;;;AAyBO,MAAMA,KAAgB,CAAC,EAAE,UAAAC,GAAU,SAAAC,GAAS,UAAAC,QAAoC;;AACrF,QAAM,EAAE,YAAAC,EAAA,IAAeC,EAAWC,CAAiB,GAC7CC,IAASC,EAAA,GACTC,IAAYC,EAAA,GACZC,IAAkBC,EAAA,GAElBC,IAAiBC,EAAA,GACjB,CAACC,GAAsBC,CAAuB,IAAIC,EAAS,CAAC,GAC5D,CAACC,GAAsBC,CAAuB,IAAIF,EAAS,EAAK,GAEhE,CAACG,GAAWC,CAAY,IAAIJ,EAAS,EAAK,GAC1C,CAACK,GAAQC,CAAS,IAAIN,EAAA,GAEtB,CAACO,GAA0BC,CAA4B,IAAIR,EAAS,CAAC,GACrES,IAAc,OAAO,KAAKzB,EAAS,QAAQ,IAAI,EAAEuB,CAAwB,GACzE,CAACG,GAAsBC,CAAuB,IAAIX,EAAS,CAAC,GAE5DY,KAAUhB,KAAA,gBAAAA,EAAiBE,QAAyBF,KAAA,gBAAAA,EAAiB,OAAM;AAEjF,EAAAiB,EAAU,MAAM;AAEd,IADqB,IAAI,gBAAgB,OAAO,SAAS,MAAM,EAC9C,IAAI,YAAY,KAC/B,sBAAsB,MAAM;AAC1B,MAAAX,EAAwB,EAAI;AAAA,IAC9B,CAAC;AAAA,EAEL,GAAG,CAAA,CAAE;AAEL,QAAMY,IAAcC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EAAI,WAAU,sDACb,UAAA,gBAAAc,EAACE,KAAyB,UAAS,WACjC,UAAA,gBAAAF,EAACG,GAAA,EAAQ,QAAAtC,GAAgB,WAAAE,GAAsB,UAAAR,GAAoB,SAAAC,GAAkB,UAAAC,GAAoB,GAC3G,EAAA,CACF;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;"}
@@ -1,13 +1,14 @@
1
1
  import "react/jsx-runtime";
2
- import $ from "@sindresorhus/slugify";
3
- const c = (r, e, t, i) => $(
4
- `${r ? `${r}-` : ""}${t ? `${t}-` : ""}${e || ""}-`,
2
+ import i from "@sindresorhus/slugify";
3
+ import "../../../contexts/EndpointLocationContext.js";
4
+ const s = (r, t, e, $) => i(
5
+ `${r ? `${r}-` : ""}${e ? `${e}-` : ""}${t || ""}-`,
5
6
  {
6
7
  decamelize: !0
7
8
  }
8
- ), s = (r, e) => r ? `${e ? `${e}` : ""}${r}.` : "";
9
+ ), m = (r, t) => r ? `${t ? `${t}` : ""}${r}.` : "";
9
10
  export {
10
- c as buildRecursiveParamFieldId,
11
- s as getRecursiveParentName
11
+ s as buildRecursiveParamFieldId,
12
+ m as getRecursiveParentName
12
13
  };
13
14
  //# sourceMappingURL=RecursiveParamField.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RecursiveParamField.js","sources":["../../../../src/api-playground/EndpointFields/ParamFields/RecursiveParamField.tsx"],"sourcesContent":["\nimport { DataSchema, DataSchemaArray, IncrementalDataSchemaArray } from '@mintlify/validation';\nimport slugify from '@sindresorhus/slugify';\n\nimport { useEndpointLocation } from '@/contexts/EndpointLocationContext';\nimport { getConstFilteredSchemaArray } from '@/openapi/filterEnums';\nimport {\n getAuthFilteredSchemaArray,\n isDataSchemaArrayOrIncrementalDataSchemaArray,\n} from '@/openapi/getAuthFilteredSchemaArray';\nimport { getNextPropertiesByType } from '@/utils/api-reference/getNextPropertiesByType';\n\nimport { RecursiveParamFieldWithChildrenObserver } from './RecursiveParamFieldWithChildrenObserver';\nimport { RecursiveParamFieldWithObserver } from './RecursiveParamFieldWithObserver';\nimport { FieldType, RenderedRefs } from '@/api-playground-2/types/api';\n\nexport type RecursiveParamFieldParams = {\n fieldType: FieldType;\n schemaArray: DataSchemaArray | IncrementalDataSchemaArray;\n renderedRefs?: RenderedRefs;\n name?: string | null;\n location?: string;\n parentName?: string;\n depth?: number;\n hideDescription?: boolean;\n circularRefs?: string[];\n paramId?: string;\n style?: string;\n explode?: boolean;\n};\n\nexport const RecursiveParamField = ({\n fieldType,\n schemaArray,\n name,\n location,\n parentName,\n depth = 0,\n hideDescription = false,\n renderedRefs = new Set(),\n circularRefs,\n paramId,\n style,\n explode,\n}: RecursiveParamFieldParams) => {\n const { anchor } = useEndpointLocation();\n let filteredSchemaArray: DataSchemaArray | IncrementalDataSchemaArray | null = schemaArray;\n filteredSchemaArray = getAuthFilteredSchemaArray({ schemaArray, userGroups: undefined });\n\n if (\n filteredSchemaArray &&\n filteredSchemaArray.some((schema) => 'enum' in schema && 'const' in schema)\n ) {\n filteredSchemaArray = getConstFilteredSchemaArray({ schemaArray });\n }\n\n if (!isDataSchemaArrayOrIncrementalDataSchemaArray(filteredSchemaArray)) {\n return null;\n }\n\n const RecursiveParamFieldType = anchor\n ? RecursiveParamFieldWithChildrenObserver\n : RecursiveParamFieldWithObserver;\n\n return (\n <RecursiveParamFieldType\n fieldType={fieldType}\n schemaArray={filteredSchemaArray}\n name={name}\n location={location}\n parentName={parentName}\n depth={depth}\n style={style}\n explode={explode}\n hideDescription={hideDescription}\n renderedRefs={renderedRefs}\n circularRefs={circularRefs}\n paramId={paramId}\n />\n );\n};\n\ntype RenderNextPropertiesRecursivelyParams = {\n properties: [string, DataSchemaArray | IncrementalDataSchemaArray][];\n fieldType: FieldType;\n depth: number;\n refs: Set<string>;\n parentName?: string;\n name?: string | null;\n currentSchemaRef: string | undefined;\n style?: string;\n explode?: boolean;\n hideParentName?: boolean;\n};\n\nexport const renderNextPropertiesRecursively = ({\n currentSchemaRef,\n properties,\n fieldType,\n parentName,\n name,\n depth,\n refs,\n style,\n explode,\n hideParentName,\n}: RenderNextPropertiesRecursivelyParams) => {\n // Create a new set with the current refs for this level\n const currentLevelRefs = new Set(refs);\n\n if (currentSchemaRef) {\n currentLevelRefs.add(currentSchemaRef);\n }\n\n if (currentLevelRefs.size > 0) {\n return properties.map((property) => {\n const [propertyName, schemaArray] = property;\n const nextSchemaArray = schemaArray[0];\n const nextSchemaArrayProperties = getNextPropertiesByType(nextSchemaArray);\n const paramId = buildRecursiveParamFieldId(fieldType, name, parentName, propertyName);\n const passedName = hideParentName ? '' : name;\n let circularReferences: string[] = [];\n if (\n Object.values(nextSchemaArrayProperties).some(\n (value: unknown) => typeof value === 'string' && currentLevelRefs.has(value)\n )\n ) {\n circularReferences = Object.values(nextSchemaArrayProperties).filter(\n (value: unknown) => typeof value === 'string' && currentLevelRefs.has(value)\n );\n }\n return (\n <RecursiveParamField\n paramId={paramId}\n fieldType={fieldType}\n key={propertyName}\n schemaArray={schemaArray}\n name={propertyName}\n parentName={\n style === 'deepObject' && explode\n ? getDeepObjectParentName(passedName, parentName)\n : getRecursiveParentName(passedName, parentName)\n }\n depth={depth + 1}\n renderedRefs={new Set(currentLevelRefs)}\n circularRefs={circularReferences}\n style={style}\n explode={explode}\n />\n );\n });\n } else {\n return properties.map(([propertyName, schemaArray]) => {\n const paramId = buildRecursiveParamFieldId(fieldType, name, parentName, propertyName);\n const passedName = hideParentName ? '' : name;\n return (\n <RecursiveParamField\n paramId={paramId}\n fieldType={fieldType}\n key={propertyName}\n schemaArray={schemaArray}\n name={propertyName}\n parentName={\n style === 'deepObject' && explode\n ? getDeepObjectParentName(passedName, parentName)\n : getRecursiveParentName(passedName, parentName)\n }\n depth={depth + 1}\n renderedRefs={new Set()}\n style={style}\n explode={explode}\n />\n );\n });\n }\n};\n\ntype RenderTruncatedNextPropertiesParams = {\n properties: [string, DataSchemaArray | IncrementalDataSchemaArray][];\n fieldType: FieldType;\n parentName?: string;\n name?: string | null;\n depth: number;\n};\n\nexport const renderTruncatedNextProperties = ({\n properties,\n fieldType,\n parentName,\n name,\n depth,\n}: RenderTruncatedNextPropertiesParams) => {\n return properties.map((property) => {\n const [propertyName, schemaArray] = property;\n const nextSchemaArray = schemaArray[0];\n const baseSchema: DataSchema = nextSchemaArray as DataSchema;\n if (baseSchema.type === 'array') {\n baseSchema.items = [{ type: 'any' }];\n } else if (baseSchema.type === 'object') {\n baseSchema.properties = {};\n }\n const paramId = buildRecursiveParamFieldId(fieldType, name, parentName);\n const id = `${paramId}-${propertyName}`;\n return (\n <RecursiveParamField\n fieldType={fieldType}\n key={propertyName}\n schemaArray={[baseSchema]}\n name={propertyName}\n paramId={id}\n depth={depth + 1}\n renderedRefs={new Set()}\n />\n );\n });\n};\n\nexport const buildRecursiveParamFieldId = (\n fieldType: FieldType | undefined,\n name: string | undefined | null,\n parentName: string | undefined,\n propertyName?: string | undefined\n) => {\n return slugify(\n `${fieldType ? `${fieldType}-` : ''}${parentName ? `${parentName}-` : ''}${name ? name : ''}-${propertyName ? propertyName : ''}`,\n {\n decamelize: true,\n }\n );\n};\n\nexport const getRecursiveParentName = (name?: string | null, parentName?: string): string => {\n if (!name) {\n return '';\n }\n\n return `${parentName ? `${parentName}` : ''}${name}.`;\n};\n\nexport const getDeepObjectParentName = (name?: string | null, parentName?: string): string => {\n if (!name) {\n return '';\n }\n\n return parentName ? `${parentName}${name}][` : `${name}[`;\n};\n"],"names":["buildRecursiveParamFieldId","fieldType","name","parentName","propertyName","slugify","getRecursiveParentName"],"mappings":";;AAyNO,MAAMA,IAA6B,CACxCC,GACAC,GACAC,GACAC,MAEOC;AAAA,EACL,GAAGJ,IAAY,GAAGA,CAAS,MAAM,EAAE,GAAGE,IAAa,GAAGA,CAAU,MAAM,EAAE,GAAGD,KAAc,EAAE;AAAA,EAC3F;AAAA,IACE,YAAY;AAAA,EAAA;AACd,GAISI,IAAyB,CAACJ,GAAsBC,MACtDD,IAIE,GAAGC,IAAa,GAAGA,CAAU,KAAK,EAAE,GAAGD,CAAI,MAHzC;"}
1
+ {"version":3,"file":"RecursiveParamField.js","sources":["../../../../src/api-playground/EndpointFields/ParamFields/RecursiveParamField.tsx"],"sourcesContent":["\nimport { DataSchema, DataSchemaArray, IncrementalDataSchemaArray } from '@mintlify/validation';\nimport slugify from '@sindresorhus/slugify';\n\nimport { useEndpointLocation } from '@/contexts/EndpointLocationContext';\nimport { getConstFilteredSchemaArray } from '@/openapi/filterEnums';\nimport {\n getAuthFilteredSchemaArray,\n isDataSchemaArrayOrIncrementalDataSchemaArray,\n} from '@/openapi/getAuthFilteredSchemaArray';\nimport { getNextPropertiesByType } from '@/utils/api-reference/getNextPropertiesByType';\n\nimport { RecursiveParamFieldWithChildrenObserver } from './RecursiveParamFieldWithChildrenObserver';\nimport { RecursiveParamFieldWithObserver } from './RecursiveParamFieldWithObserver';\nimport { FieldType, RenderedRefs } from '@/api-playground-2/types/api';\n\nexport type RecursiveParamFieldParams = {\n fieldType: FieldType;\n schemaArray: DataSchemaArray | IncrementalDataSchemaArray;\n renderedRefs?: RenderedRefs;\n name?: string | null;\n location?: string;\n parentName?: string;\n depth?: number;\n hideDescription?: boolean;\n circularRefs?: string[];\n paramId?: string;\n style?: string;\n explode?: boolean;\n};\n\nexport const RecursiveParamField = ({\n fieldType,\n schemaArray,\n name,\n location,\n parentName,\n depth = 0,\n hideDescription = false,\n renderedRefs = new Set(),\n circularRefs,\n paramId,\n style,\n explode,\n}: RecursiveParamFieldParams) => {\n const { anchor } = useEndpointLocation();\n let filteredSchemaArray: DataSchemaArray | IncrementalDataSchemaArray | null = schemaArray;\n filteredSchemaArray = getAuthFilteredSchemaArray({ schemaArray, userGroups: undefined });\n\n if (\n filteredSchemaArray &&\n filteredSchemaArray.some((schema) => 'enum' in schema && 'const' in schema)\n ) {\n filteredSchemaArray = getConstFilteredSchemaArray({ schemaArray });\n }\n\n if (!isDataSchemaArrayOrIncrementalDataSchemaArray(filteredSchemaArray)) {\n return null;\n }\n\n const RecursiveParamFieldType = anchor\n ? RecursiveParamFieldWithChildrenObserver\n : RecursiveParamFieldWithObserver;\n\n return (\n <RecursiveParamFieldType\n fieldType={fieldType}\n schemaArray={filteredSchemaArray}\n name={name}\n location={location}\n parentName={parentName}\n depth={depth}\n style={style}\n explode={explode}\n hideDescription={hideDescription}\n renderedRefs={renderedRefs}\n circularRefs={circularRefs}\n paramId={paramId}\n />\n );\n};\n\ntype RenderNextPropertiesRecursivelyParams = {\n properties: [string, DataSchemaArray | IncrementalDataSchemaArray][];\n fieldType: FieldType;\n depth: number;\n refs: Set<string>;\n parentName?: string;\n name?: string | null;\n currentSchemaRef: string | undefined;\n style?: string;\n explode?: boolean;\n hideParentName?: boolean;\n};\n\nexport const renderNextPropertiesRecursively = ({\n currentSchemaRef,\n properties,\n fieldType,\n parentName,\n name,\n depth,\n refs,\n style,\n explode,\n hideParentName,\n}: RenderNextPropertiesRecursivelyParams) => {\n // Create a new set with the current refs for this level\n const currentLevelRefs = new Set(refs);\n\n if (currentSchemaRef) {\n currentLevelRefs.add(currentSchemaRef);\n }\n\n if (currentLevelRefs.size > 0) {\n return properties.map((property) => {\n const [propertyName, schemaArray] = property;\n const nextSchemaArray = schemaArray[0];\n const nextSchemaArrayProperties = getNextPropertiesByType(nextSchemaArray);\n const paramId = buildRecursiveParamFieldId(fieldType, name, parentName, propertyName);\n const passedName = hideParentName ? '' : name;\n let circularReferences: string[] = [];\n if (\n Object.values(nextSchemaArrayProperties).some(\n (value: unknown) => typeof value === 'string' && currentLevelRefs.has(value)\n )\n ) {\n circularReferences = Object.values(nextSchemaArrayProperties).filter(\n (value: unknown) => typeof value === 'string' && currentLevelRefs.has(value)\n );\n }\n return (\n <RecursiveParamField\n paramId={paramId}\n fieldType={fieldType}\n key={propertyName}\n schemaArray={schemaArray}\n name={propertyName}\n parentName={\n style === 'deepObject' && explode\n ? getDeepObjectParentName(passedName, parentName)\n : getRecursiveParentName(passedName, parentName)\n }\n depth={depth + 1}\n renderedRefs={new Set(currentLevelRefs)}\n circularRefs={circularReferences}\n style={style}\n explode={explode}\n />\n );\n });\n } else {\n return properties.map(([propertyName, schemaArray]) => {\n const paramId = buildRecursiveParamFieldId(fieldType, name, parentName, propertyName);\n const passedName = hideParentName ? '' : name;\n return (\n <RecursiveParamField\n paramId={paramId}\n fieldType={fieldType}\n key={propertyName}\n schemaArray={schemaArray}\n name={propertyName}\n parentName={\n style === 'deepObject' && explode\n ? getDeepObjectParentName(passedName, parentName)\n : getRecursiveParentName(passedName, parentName)\n }\n depth={depth + 1}\n renderedRefs={new Set()}\n style={style}\n explode={explode}\n />\n );\n });\n }\n};\n\ntype RenderTruncatedNextPropertiesParams = {\n properties: [string, DataSchemaArray | IncrementalDataSchemaArray][];\n fieldType: FieldType;\n parentName?: string;\n name?: string | null;\n depth: number;\n};\n\nexport const renderTruncatedNextProperties = ({\n properties,\n fieldType,\n parentName,\n name,\n depth,\n}: RenderTruncatedNextPropertiesParams) => {\n return properties.map((property) => {\n const [propertyName, schemaArray] = property;\n const nextSchemaArray = schemaArray[0];\n const baseSchema: DataSchema = nextSchemaArray as DataSchema;\n if (baseSchema.type === 'array') {\n baseSchema.items = [{ type: 'any' }];\n } else if (baseSchema.type === 'object') {\n baseSchema.properties = {};\n }\n const paramId = buildRecursiveParamFieldId(fieldType, name, parentName);\n const id = `${paramId}-${propertyName}`;\n return (\n <RecursiveParamField\n fieldType={fieldType}\n key={propertyName}\n schemaArray={[baseSchema]}\n name={propertyName}\n paramId={id}\n depth={depth + 1}\n renderedRefs={new Set()}\n />\n );\n });\n};\n\nexport const buildRecursiveParamFieldId = (\n fieldType: FieldType | undefined,\n name: string | undefined | null,\n parentName: string | undefined,\n propertyName?: string | undefined\n) => {\n return slugify(\n `${fieldType ? `${fieldType}-` : ''}${parentName ? `${parentName}-` : ''}${name ? name : ''}-${propertyName ? propertyName : ''}`,\n {\n decamelize: true,\n }\n );\n};\n\nexport const getRecursiveParentName = (name?: string | null, parentName?: string): string => {\n if (!name) {\n return '';\n }\n\n return `${parentName ? `${parentName}` : ''}${name}.`;\n};\n\nexport const getDeepObjectParentName = (name?: string | null, parentName?: string): string => {\n if (!name) {\n return '';\n }\n\n return parentName ? `${parentName}${name}][` : `${name}[`;\n};\n"],"names":["buildRecursiveParamFieldId","fieldType","name","parentName","propertyName","slugify","getRecursiveParentName"],"mappings":";;;AAyNO,MAAMA,IAA6B,CACxCC,GACAC,GACAC,GACAC,MAEOC;AAAA,EACL,GAAGJ,IAAY,GAAGA,CAAS,MAAM,EAAE,GAAGE,IAAa,GAAGA,CAAU,MAAM,EAAE,GAAGD,KAAc,EAAE;AAAA,EAC3F;AAAA,IACE,YAAY;AAAA,EAAA;AACd,GAISI,IAAyB,CAACJ,GAAsBC,MACtDD,IAIE,GAAGC,IAAa,GAAGA,CAAU,KAAK,EAAE,GAAGD,CAAI,MAHzC;"}
@@ -1,7 +1,8 @@
1
1
  import "react/jsx-runtime";
2
- import { useOpenApiEndpoint as n } from "../../hooks/useEndpoint.js";
3
- const p = () => (n(), null);
2
+ import "../../contexts/EndpointLocationContext.js";
3
+ import { useOpenApiEndpoint as t } from "../../hooks/useEndpoint.js";
4
+ const i = () => (t(), null);
4
5
  export {
5
- p as default
6
+ i as default
6
7
  };
7
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/api-playground/EndpointFields/index.tsx"],"sourcesContent":["\nimport { EndpointLocationProvider } from '@/contexts/EndpointLocationContext';\nimport { useOpenApiEndpoint } from '@/hooks/useEndpoint';\nimport { getFilteredSecurityOptions } from '@/utils/api-reference/getFilteredSecurityOptions';\n\nimport { EndpointBody } from './EndpointBody';\nimport { EndpointParameters } from './EndpointParameters';\nimport { EndpointResponse } from './EndpointResponse';\nimport { EndpointSecurity } from './EndpointSecurity';\n\nconst EndpointFields = () => {\n const endpoint = useOpenApiEndpoint();\n const newApiReferencePage = true;\n\n if (endpoint === undefined || newApiReferencePage) {\n return null;\n }\n\n // TODO(ronan): remove when all security options are handled (none should be empty)\n const filteredSecurityOptions = getFilteredSecurityOptions(endpoint);\n\n return (\n <>\n {filteredSecurityOptions.length > 0 && (\n <EndpointSecurity securityOptions={filteredSecurityOptions} />\n )}\n <EndpointParameters parameters={endpoint.request.parameters} />\n <EndpointLocationProvider location=\"request\">\n <EndpointBody body={endpoint.request.body} />\n </EndpointLocationProvider>\n <EndpointLocationProvider location=\"response\">\n {Object.entries(endpoint.response)[0] && <EndpointResponse response={endpoint.response} />}\n </EndpointLocationProvider>\n </>\n );\n};\n\nexport default EndpointFields;\n"],"names":["EndpointFields","useOpenApiEndpoint"],"mappings":";;AAUA,MAAMA,IAAiB,OACJC,EAAA,GAIR;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/api-playground/EndpointFields/index.tsx"],"sourcesContent":["\nimport { EndpointLocationProvider } from '@/contexts/EndpointLocationContext';\nimport { useOpenApiEndpoint } from '@/hooks/useEndpoint';\nimport { getFilteredSecurityOptions } from '@/utils/api-reference/getFilteredSecurityOptions';\n\nimport { EndpointBody } from './EndpointBody';\nimport { EndpointParameters } from './EndpointParameters';\nimport { EndpointResponse } from './EndpointResponse';\nimport { EndpointSecurity } from './EndpointSecurity';\n\nconst EndpointFields = () => {\n const endpoint = useOpenApiEndpoint();\n const newApiReferencePage = true;\n\n if (endpoint === undefined || newApiReferencePage) {\n return null;\n }\n\n // TODO(ronan): remove when all security options are handled (none should be empty)\n const filteredSecurityOptions = getFilteredSecurityOptions(endpoint);\n\n return (\n <>\n {filteredSecurityOptions.length > 0 && (\n <EndpointSecurity securityOptions={filteredSecurityOptions} />\n )}\n <EndpointParameters parameters={endpoint.request.parameters} />\n <EndpointLocationProvider location=\"request\">\n <EndpointBody body={endpoint.request.body} />\n </EndpointLocationProvider>\n <EndpointLocationProvider location=\"response\">\n {Object.entries(endpoint.response)[0] && <EndpointResponse response={endpoint.response} />}\n </EndpointLocationProvider>\n </>\n );\n};\n\nexport default EndpointFields;\n"],"names":["EndpointFields","useOpenApiEndpoint"],"mappings":";;;AAUA,MAAMA,IAAiB,OACJC,EAAA,GAIR;"}
@@ -50,7 +50,7 @@ const V = ({
50
50
  },
51
51
  children: [
52
52
  /* @__PURE__ */ i("div", { className: "mint:flex mint:flex-col mint:gap-8", children: [
53
- /* @__PURE__ */ i("div", { className: "mint:mt-6 mint:flex mint:w-full mint:flex-col mint:space-y-4", children: [
53
+ /* @__PURE__ */ i("div", { className: "mint:flex mint:w-full mint:flex-col mint:space-y-4", children: [
54
54
  /* @__PURE__ */ i("div", { className: "mint:flex mint:items-center mint:gap-3 mint:border mint:border-gray-200 mint:dark:border-[#2d2d2d] mint:rounded-2xl mint:p-1.5", children: [
55
55
  /* @__PURE__ */ e("div", { className: "mint:flex mint:items-center mint:gap-0 mint:flex-1 mint:bg-white mint:dark:bg-[#1a1a1a] mint:border mint:border-gray-200 mint:dark:border-[#2d2d2d] mint:rounded-2xl", children: /* @__PURE__ */ e(
56
56
  B,
@@ -1 +1 @@
1
- {"version":3,"file":"OperationPage.js","sources":["../../src/api-playground-2/OperationPage.tsx"],"sourcesContent":["import { ReactNode, useContext, useEffect, useState } from 'react';\n\nimport { SendPill } from '@/api-playground/ApiPlayground/components/SendPill';\nimport { PageContext } from '@/contexts/ConfigContext';\nimport { useApiPlaygroundDisplay } from '@/hooks/useApiPlaygroundDisplay';\nimport { copyToClipboard } from '@/utils/copyToClipboard';\n\nimport { ApiExamples } from './ApiExamples';\nimport { ApiFields } from './ApiFields';\nimport { EndpointHeader } from './EndpointHeader';\nimport { Playground } from './Playground';\nimport { ApiPlaygroundContext } from './contexts/ApiPlaygroundContext';\nimport { joinWithSingleSlash } from './hooks/useSendPlaygroundRequest';\nimport { ApiReferenceDataV2, OperationV2 } from './types';\nimport { cn } from \"../utils/cn\";\nimport { MethodPill } from '../components/Api/MethodPill';\n\nexport const OperationPage = ({\n apiReferenceData,\n operation,\n // eslint-disable-next-line unused-imports/no-unused-vars\n children,\n}: {\n apiReferenceData: ApiReferenceDataV2;\n operation: OperationV2;\n children: ReactNode;\n}) => {\n const { path, method, baseUrl: singleBaseUrl, baseUrlOptions } = operation;\n const { pageMetadata } = useContext(PageContext);\n const display = useApiPlaygroundDisplay();\n const [selectedBaseUrlIndex, setSelectedBaseUrlIndex] = useState(0);\n const [isPlaygroundExpanded, setIsPlaygroundExpanded] = useState(false);\n const [isCopiedActive, setIsCopiedActive] = useState(false);\n const playgroundDisabled = display === 'simple';\n const baseUrl = baseUrlOptions[selectedBaseUrlIndex] ?? singleBaseUrl ?? '';\n\n useEffect(() => {\n // TODO - Api Playground Refactor: SSR playground components\n if (typeof window === 'undefined') return;\n const searchParams = new URLSearchParams(window.location.search);\n if (searchParams.has('playground')) {\n requestAnimationFrame(() => {\n setIsPlaygroundExpanded(true);\n });\n }\n }, []);\n\n const onCopy = async () => {\n const toCopy = joinWithSingleSlash(baseUrl, path);\n const result = await copyToClipboard(toCopy);\n if (result === 'success') {\n setIsCopiedActive(true);\n setTimeout(() => {\n setIsCopiedActive(false);\n }, 2000);\n }\n };\n\n const setIsPlaygroundExpandedWithQueryParam = (expanded: boolean) => {\n setIsPlaygroundExpanded(expanded);\n // TODO - Api Playground Refactor: SSR playground components\n if (typeof window === 'undefined') return;\n if (expanded) {\n const url = new URL(window.location.href);\n url.searchParams.set('playground', 'open');\n window.history.replaceState({}, '', url);\n } else {\n const url = new URL(window.location.href);\n url.searchParams.delete('playground');\n window.history.replaceState({}, '', url);\n }\n };\n\n return (\n <ApiPlaygroundContext.Provider\n value={{\n setSelectedBaseUrlIndex,\n selectedBaseUrlIndex,\n baseUrlOptions,\n isPlaygroundExpanded,\n setIsPlaygroundExpanded: setIsPlaygroundExpandedWithQueryParam,\n }}\n >\n <div className=\"mint:flex mint:flex-col mint:gap-8\">\n <div className=\"mint:mt-6 mint:flex mint:w-full mint:flex-col mint:space-y-4\">\n <div className=\"mint:flex mint:items-center mint:gap-3 mint:border mint:border-gray-200 mint:dark:border-[#2d2d2d] mint:rounded-2xl mint:p-1.5\">\n <div className=\"mint:flex mint:items-center mint:gap-0 mint:flex-1 mint:bg-white mint:dark:bg-[#1a1a1a] mint:border mint:border-gray-200 mint:dark:border-[#2d2d2d] mint:rounded-2xl\">\n <EndpointHeader\n onCopy={onCopy}\n baseUrlOptions={baseUrlOptions}\n selectedBaseUrlIndex={selectedBaseUrlIndex}\n setSelectedBaseUrlIndex={setSelectedBaseUrlIndex}\n isCopiedActive={isCopiedActive}\n display={display}\n path={path}\n method={method}\n onBaseUrlChange={() => {}}\n isInPlaygroundModal={false}\n />\n </div>\n {playgroundDisabled ? null : (\n <SendPill\n label=\"Try it\"\n method={method}\n onClick={() => setIsPlaygroundExpandedWithQueryParam(true)}\n />\n )}\n </div>\n <div className=\"mint:mt-8 mint:lg:mt-0 mint:flex mint:flex-col mint:gap-6 mint:xl:!hidden mint:max-h-[30rem]\">\n <ApiExamples noInputs={true} />\n </div>\n </div>\n <ApiFields pageMetadata={pageMetadata} />\n </div>\n {!playgroundDisabled && (\n <Playground\n isPlaygroundExpanded={isPlaygroundExpanded}\n setIsPlaygroundExpanded={setIsPlaygroundExpandedWithQueryParam}\n baseUrl={baseUrl}\n baseUrlOptions={baseUrlOptions}\n apiReferenceData={apiReferenceData}\n />\n )}\n </ApiPlaygroundContext.Provider>\n );\n};\n"],"names":["OperationPage","apiReferenceData","operation","children","path","method","singleBaseUrl","baseUrlOptions","pageMetadata","useContext","PageContext","display","useApiPlaygroundDisplay","selectedBaseUrlIndex","setSelectedBaseUrlIndex","useState","isPlaygroundExpanded","setIsPlaygroundExpanded","isCopiedActive","setIsCopiedActive","playgroundDisabled","baseUrl","useEffect","onCopy","toCopy","joinWithSingleSlash","copyToClipboard","setIsPlaygroundExpandedWithQueryParam","expanded","url","jsxs","ApiPlaygroundContext","jsx","EndpointHeader","SendPill","ApiExamples","ApiFields","Playground"],"mappings":";;;;;;;;;;;;AAiBO,MAAMA,IAAgB,CAAC;AAAA,EAC5B,kBAAAC;AAAA,EACA,WAAAC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UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAAA;AAIR;"}
1
+ {"version":3,"file":"OperationPage.js","sources":["../../src/api-playground-2/OperationPage.tsx"],"sourcesContent":["import { ReactNode, useContext, useEffect, useState } from 'react';\n\nimport { SendPill } from '@/api-playground/ApiPlayground/components/SendPill';\nimport { PageContext } from '@/contexts/ConfigContext';\nimport { useApiPlaygroundDisplay } from '@/hooks/useApiPlaygroundDisplay';\nimport { copyToClipboard } from '@/utils/copyToClipboard';\n\nimport { ApiExamples } from './ApiExamples';\nimport { ApiFields } from './ApiFields';\nimport { EndpointHeader } from './EndpointHeader';\nimport { Playground } from './Playground';\nimport { ApiPlaygroundContext } from './contexts/ApiPlaygroundContext';\nimport { joinWithSingleSlash } from './hooks/useSendPlaygroundRequest';\nimport { ApiReferenceDataV2, OperationV2 } from './types';\nimport { cn } from \"../utils/cn\";\nimport { MethodPill } from '../components/Api/MethodPill';\n\nexport const OperationPage = ({\n apiReferenceData,\n operation,\n // eslint-disable-next-line unused-imports/no-unused-vars\n children,\n}: {\n apiReferenceData: ApiReferenceDataV2;\n operation: OperationV2;\n children: ReactNode;\n}) => {\n const { path, method, baseUrl: singleBaseUrl, baseUrlOptions } = operation;\n const { pageMetadata } = useContext(PageContext);\n const display = useApiPlaygroundDisplay();\n const [selectedBaseUrlIndex, setSelectedBaseUrlIndex] = useState(0);\n const [isPlaygroundExpanded, setIsPlaygroundExpanded] = useState(false);\n const [isCopiedActive, setIsCopiedActive] = useState(false);\n const playgroundDisabled = display === 'simple';\n const baseUrl = baseUrlOptions[selectedBaseUrlIndex] ?? singleBaseUrl ?? '';\n\n useEffect(() => {\n // TODO - Api Playground Refactor: SSR playground components\n if (typeof window === 'undefined') return;\n const searchParams = new URLSearchParams(window.location.search);\n if (searchParams.has('playground')) {\n requestAnimationFrame(() => {\n setIsPlaygroundExpanded(true);\n });\n }\n }, []);\n\n const onCopy = async () => {\n const toCopy = joinWithSingleSlash(baseUrl, path);\n const result = await copyToClipboard(toCopy);\n if (result === 'success') {\n setIsCopiedActive(true);\n setTimeout(() => {\n setIsCopiedActive(false);\n }, 2000);\n }\n };\n\n const setIsPlaygroundExpandedWithQueryParam = (expanded: boolean) => {\n setIsPlaygroundExpanded(expanded);\n // TODO - Api Playground Refactor: SSR playground components\n if (typeof window === 'undefined') return;\n if (expanded) {\n const url = new URL(window.location.href);\n url.searchParams.set('playground', 'open');\n window.history.replaceState({}, '', url);\n } else {\n const url = new URL(window.location.href);\n url.searchParams.delete('playground');\n window.history.replaceState({}, '', url);\n }\n };\n\n return (\n <ApiPlaygroundContext.Provider\n value={{\n setSelectedBaseUrlIndex,\n selectedBaseUrlIndex,\n baseUrlOptions,\n isPlaygroundExpanded,\n setIsPlaygroundExpanded: setIsPlaygroundExpandedWithQueryParam,\n }}\n >\n <div className=\"mint:flex mint:flex-col mint:gap-8\">\n <div className=\"mint:flex mint:w-full mint:flex-col mint:space-y-4\">\n <div className=\"mint:flex mint:items-center mint:gap-3 mint:border mint:border-gray-200 mint:dark:border-[#2d2d2d] mint:rounded-2xl mint:p-1.5\">\n <div className=\"mint:flex mint:items-center mint:gap-0 mint:flex-1 mint:bg-white mint:dark:bg-[#1a1a1a] mint:border mint:border-gray-200 mint:dark:border-[#2d2d2d] mint:rounded-2xl\">\n <EndpointHeader\n onCopy={onCopy}\n baseUrlOptions={baseUrlOptions}\n selectedBaseUrlIndex={selectedBaseUrlIndex}\n setSelectedBaseUrlIndex={setSelectedBaseUrlIndex}\n isCopiedActive={isCopiedActive}\n display={display}\n path={path}\n method={method}\n onBaseUrlChange={() => {}}\n isInPlaygroundModal={false}\n />\n </div>\n {playgroundDisabled ? null : (\n <SendPill\n label=\"Try it\"\n method={method}\n onClick={() => setIsPlaygroundExpandedWithQueryParam(true)}\n />\n )}\n </div>\n <div className=\"mint:mt-8 mint:lg:mt-0 mint:flex mint:flex-col mint:gap-6 mint:xl:!hidden mint:max-h-[30rem]\">\n <ApiExamples noInputs={true} />\n </div>\n </div>\n <ApiFields pageMetadata={pageMetadata} />\n </div>\n {!playgroundDisabled && (\n <Playground\n isPlaygroundExpanded={isPlaygroundExpanded}\n setIsPlaygroundExpanded={setIsPlaygroundExpandedWithQueryParam}\n baseUrl={baseUrl}\n baseUrlOptions={baseUrlOptions}\n apiReferenceData={apiReferenceData}\n />\n )}\n </ApiPlaygroundContext.Provider>\n );\n};\n"],"names":["OperationPage","apiReferenceData","operation","children","path","method","singleBaseUrl","baseUrlOptions","pageMetadata","useContext","PageContext","display","useApiPlaygroundDisplay","selectedBaseUrlIndex","setSelectedBaseUrlIndex","useState","isPlaygroundExpanded","setIsPlaygroundExpanded","isCopiedActive","setIsCopiedActive","playgroundDisabled","baseUrl","useEffect","onCopy","toCopy","joinWithSingleSlash","copyToClipboard","setIsPlaygroundExpandedWithQueryParam","expanded","url","jsxs","ApiPlaygroundContext","jsx","EndpointHeader","SendPill","ApiExamples","ApiFields","Playground"],"mappings":";;;;;;;;;;;;AAiBO,MAAMA,IAAgB,CAAC;AAAA,EAC5B,kBAAAC;AAAA,EACA,WAAAC;AAAA;AAAA,EAEA,UAAAC;AACF,MAIM;AACJ,QAAM,EAAE,MAAAC,GAAM,QAAAC,GAAQ,SAASC,GAAe,gBAAAC,MAAmBL,GAC3D,EAAE,cAAAM,EAAA,IAAiBC,EAAWC,CAAW,GACzCC,IAAUC,EAAA,GACV,CAACC,GAAsBC,CAAuB,IAAIC,EAAS,CAAC,GAC5D,CAACC,GAAsBC,CAAuB,IAAIF,EAAS,EAAK,GAChE,CAACG,GAAgBC,CAAiB,IAAIJ,EAAS,EAAK,GACpDK,IAAqBT,MAAY,UACjCU,IAAUd,EAAeM,CAAoB,KAAKP,KAAiB;AAEzE,EAAAgB,EAAU,MAAM;AAEd,QAAI,OAAO,SAAW,IAAa;AAEnC,IADqB,IAAI,gBAAgB,OAAO,SAAS,MAAM,EAC9C,IAAI,YAAY,KAC/B,sBAAsB,MAAM;AAC1B,MAAAL,EAAwB,EAAI;AA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;AAAA,kBACA,SAAAP;AAAA,kBACA,MAAAP;AAAA,kBACA,QAAAC;AAAA,kBACA,iBAAiB,MAAM;AAAA,kBAAC;AAAA,kBACxB,qBAAqB;AAAA,gBAAA;AAAA,cAAA,GAEzB;AAAA,cACCe,IAAqB,OACpB,gBAAAY;AAAA,gBAACE;AAAA,gBAAA;AAAA,kBACC,OAAM;AAAA,kBACN,QAAA7B;AAAA,kBACA,SAAS,MAAMsB,EAAsC,EAAI;AAAA,gBAAA;AAAA,cAAA;AAAA,YAC3D,GAEJ;AAAA,YACA,gBAAAK,EAAC,SAAI,WAAU,gGACb,4BAACG,GAAA,EAAY,UAAU,IAAM,EAAA,CAC/B;AAAA,UAAA,GACF;AAAA,UACA,gBAAAH,EAACI,KAAU,cAAA5B,EAAA,CAA4B;AAAA,QAAA,GACzC;AAAA,QACC,CAACY,KACA,gBAAAY;AAAA,UAACK;AAAA,UAAA;AAAA,YACC,sBAAArB;AAAA,YACA,yBAAyBW;AAAA,YACzB,SAAAN;AAAA,YACA,gBAAAd;AAAA,YACA,kBAAAN;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAAA;AAIR;"}
@@ -54,7 +54,7 @@ function h({ type: n, children: e }) {
54
54
  children: i.icon
55
55
  }
56
56
  ),
57
- /* @__PURE__ */ t("div", { className: "mint:text-sm mint:min-w-0 mint:w-full mint:prose mint:dark:prose-invert mint:[&>p:first-child]:font-semibold", children: e })
57
+ /* @__PURE__ */ t("div", { className: "mint:text-sm mint:min-w-0 mint:w-full mint:max-w-none mint:prose mint:dark:prose-invert mint:[&>p:first-child]:font-semibold", children: e })
58
58
  ]
59
59
  }
60
60
  );
@@ -1 +1 @@
1
- {"version":3,"file":"callouts.js","sources":["../../../src/components/content-components/callouts.tsx"],"sourcesContent":["import {\n Lightbulb20Regular,\n InfoFilled,\n Warning20Regular,\n DismissCircle20Regular,\n Info20Regular,\n} from \"@fluentui/react-icons\";\nimport { cn } from \"../../utils/cn\";\n\nexport type CalloutType =\n | \"note\"\n | \"tip\"\n | \"important\"\n | \"caution\"\n | \"warning\"\n | \"nextstepaction\";\n\ninterface CalloutProps {\n type: CalloutType;\n children: React.ReactNode;\n}\n\nconst calloutConfig: Record<\n CalloutType,\n {\n icon?: React.ReactNode;\n className: string;\n }\n> = {\n tip: {\n icon: <Lightbulb20Regular className=\"mint:w-5 mint:h-5 mint:shrink-0\" />,\n className:\n \"mint:bg-[#f1faf1] mint:border-[#9fd89f] mint:text-[#0c5e0c] mint:dark:bg-[#052505] mint:dark:border-[#54b054] mint:dark:text-[#54b054]\",\n },\n note: {\n icon: <Info20Regular className=\"mint:w-5 mint:h-5 mint:shrink-0\" />,\n className:\n \"mint:bg-[#f5f5f5] mint:border-[#d1d1d1] mint:text-[#242424] mint:dark:bg-[#141414] mint:dark:border-[#666666] mint:dark:text-white\",\n },\n warning: {\n icon: <Warning20Regular className=\"mint:w-5 mint:h-5 mint:shrink-0\" />,\n className:\n \"mint:bg-[#fff9f5] mint:border-[#fdcfb4] mint:text-[#8a3707] mint:dark:bg-[#4a1e04] mint:dark:border-[#de590b] mint:dark:text-[#faa06b]\",\n },\n caution: {\n icon: (\n <DismissCircle20Regular className=\"mint:w-5 mint:h-5 mint:shrink-0\" />\n ),\n className:\n \"mint:bg-[#fdf3f4] mint:border-[#eeacb2] mint:text-[#960b18] mint:dark:bg-[#3b0509] mint:dark:border-[#c50f1f] mint:dark:text-[#dc626d]\",\n },\n important: {\n icon: <Warning20Regular className=\"mint:w-5 mint:h-5 mint:shrink-0\" />,\n className:\n \"mint:bg-[#e1cefc] mint:border-[#8251ee] mint:text-[#643fb2] mint:dark:bg-[#1a1326] mint:dark:border-[#9263f1] mint:dark:text-[#9263f1]\",\n },\n nextstepaction: {\n icon: (\n <InfoFilled className=\"mint:w-5 mint:h-5 mint:shrink-0 mint:text-[#616161] mint:dark:text-white\" />\n ),\n className:\n \"mint:bg-[#f9fafb] mint:border-[#d1d1d1] mint:text-[#141414] mint:dark:bg-[#141414] mint:dark:border-[#666666] mint:dark:text-white\",\n },\n};\n\nconst calloutLabels: Record<CalloutType, string> = {\n note: \"Note\",\n tip: \"Tip\",\n important: \"Important\",\n caution: \"Caution\",\n warning: \"Warning\",\n nextstepaction: \"Next step action\",\n};\n\nexport function Callout({ type, children }: CalloutProps) {\n const config = calloutConfig[type];\n const label = calloutLabels[type];\n\n return (\n <aside\n role=\"note\"\n aria-label={label}\n className={cn(\n \"mint:my-4 mint:flex mint:gap-2 mint:px-3 mint:py-2.5 mint:rounded-lg mint:border mint:overflow-hidden\",\n config.className\n )}\n >\n {config.icon && (\n <div\n className=\"mint:flex mint:items-start mint:justify-center\"\n aria-hidden=\"true\"\n >\n {config.icon}\n </div>\n )}\n <div className=\"mint:text-sm mint:min-w-0 mint:w-full mint:prose mint:dark:prose-invert mint:[&>p:first-child]:font-semibold\">\n {children}\n </div>\n </aside>\n );\n}\n"],"names":["calloutConfig","jsx","Lightbulb20Regular","Info20Regular","Warning20Regular","DismissCircle20Regular","InfoFilled","calloutLabels","Callout","type","children","config","label","jsxs","cn"],"mappings":";;;AAsBA,MAAMA,IAMF;AAAA,EACF,KAAK;AAAA,IACH,MAAM,gBAAAC,EAACC,GAAA,EAAmB,WAAU,kCAAA,CAAkC;AAAA,IACtE,WACE;AAAA,EAAA;AAAA,EAEJ,MAAM;AAAA,IACJ,MAAM,gBAAAD,EAACE,GAAA,EAAc,WAAU,kCAAA,CAAkC;AAAA,IACjE,WACE;AAAA,EAAA;AAAA,EAEJ,SAAS;AAAA,IACP,MAAM,gBAAAF,EAACG,GAAA,EAAiB,WAAU,kCAAA,CAAkC;AAAA,IACpE,WACE;AAAA,EAAA;AAAA,EAEJ,SAAS;AAAA,IACP,MACE,gBAAAH,EAACI,GAAA,EAAuB,WAAU,kCAAA,CAAkC;AAAA,IAEtE,WACE;AAAA,EAAA;AAAA,EAEJ,WAAW;AAAA,IACT,MAAM,gBAAAJ,EAACG,GAAA,EAAiB,WAAU,kCAAA,CAAkC;AAAA,IACpE,WACE;AAAA,EAAA;AAAA,EAEJ,gBAAgB;AAAA,IACd,MACE,gBAAAH,EAACK,GAAA,EAAW,WAAU,2EAAA,CAA2E;AAAA,IAEnG,WACE;AAAA,EAAA;AAEN,GAEMC,IAA6C;AAAA,EACjD,MAAM;AAAA,EACN,KAAK;AAAA,EACL,WAAW;AAAA,EACX,SAAS;AAAA,EACT,SAAS;AAAA,EACT,gBAAgB;AAClB;AAEO,SAASC,EAAQ,EAAE,MAAAC,GAAM,UAAAC,KAA0B;AACxD,QAAMC,IAASX,EAAcS,CAAI,GAC3BG,IAAQL,EAAcE,CAAI;AAEhC,SACE,gBAAAI;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,cAAYD;AAAA,MACZ,WAAWE;AAAA,QACT;AAAA,QACAH,EAAO;AAAA,MAAA;AAAA,MAGR,UAAA;AAAA,QAAAA,EAAO,QACN,gBAAAV;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,eAAY;AAAA,YAEX,UAAAU,EAAO;AAAA,UAAA;AAAA,QAAA;AAAA,QAGZ,gBAAAV,EAAC,OAAA,EAAI,WAAU,gHACZ,UAAAS,EAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"callouts.js","sources":["../../../src/components/content-components/callouts.tsx"],"sourcesContent":["import {\n Lightbulb20Regular,\n InfoFilled,\n Warning20Regular,\n DismissCircle20Regular,\n Info20Regular,\n} from \"@fluentui/react-icons\";\nimport { cn } from \"../../utils/cn\";\n\nexport type CalloutType =\n | \"note\"\n | \"tip\"\n | \"important\"\n | \"caution\"\n | \"warning\"\n | \"nextstepaction\";\n\ninterface CalloutProps {\n type: CalloutType;\n children: React.ReactNode;\n}\n\nconst calloutConfig: Record<\n CalloutType,\n {\n icon?: React.ReactNode;\n className: string;\n }\n> = {\n tip: {\n icon: <Lightbulb20Regular className=\"mint:w-5 mint:h-5 mint:shrink-0\" />,\n className:\n \"mint:bg-[#f1faf1] mint:border-[#9fd89f] mint:text-[#0c5e0c] mint:dark:bg-[#052505] mint:dark:border-[#54b054] mint:dark:text-[#54b054]\",\n },\n note: {\n icon: <Info20Regular className=\"mint:w-5 mint:h-5 mint:shrink-0\" />,\n className:\n \"mint:bg-[#f5f5f5] mint:border-[#d1d1d1] mint:text-[#242424] mint:dark:bg-[#141414] mint:dark:border-[#666666] mint:dark:text-white\",\n },\n warning: {\n icon: <Warning20Regular className=\"mint:w-5 mint:h-5 mint:shrink-0\" />,\n className:\n \"mint:bg-[#fff9f5] mint:border-[#fdcfb4] mint:text-[#8a3707] mint:dark:bg-[#4a1e04] mint:dark:border-[#de590b] mint:dark:text-[#faa06b]\",\n },\n caution: {\n icon: (\n <DismissCircle20Regular className=\"mint:w-5 mint:h-5 mint:shrink-0\" />\n ),\n className:\n \"mint:bg-[#fdf3f4] mint:border-[#eeacb2] mint:text-[#960b18] mint:dark:bg-[#3b0509] mint:dark:border-[#c50f1f] mint:dark:text-[#dc626d]\",\n },\n important: {\n icon: <Warning20Regular className=\"mint:w-5 mint:h-5 mint:shrink-0\" />,\n className:\n \"mint:bg-[#e1cefc] mint:border-[#8251ee] mint:text-[#643fb2] mint:dark:bg-[#1a1326] mint:dark:border-[#9263f1] mint:dark:text-[#9263f1]\",\n },\n nextstepaction: {\n icon: (\n <InfoFilled className=\"mint:w-5 mint:h-5 mint:shrink-0 mint:text-[#616161] mint:dark:text-white\" />\n ),\n className:\n \"mint:bg-[#f9fafb] mint:border-[#d1d1d1] mint:text-[#141414] mint:dark:bg-[#141414] mint:dark:border-[#666666] mint:dark:text-white\",\n },\n};\n\nconst calloutLabels: Record<CalloutType, string> = {\n note: \"Note\",\n tip: \"Tip\",\n important: \"Important\",\n caution: \"Caution\",\n warning: \"Warning\",\n nextstepaction: \"Next step action\",\n};\n\nexport function Callout({ type, children }: CalloutProps) {\n const config = calloutConfig[type];\n const label = calloutLabels[type];\n\n return (\n <aside\n role=\"note\"\n aria-label={label}\n className={cn(\n \"mint:my-4 mint:flex mint:gap-2 mint:px-3 mint:py-2.5 mint:rounded-lg mint:border mint:overflow-hidden\",\n config.className\n )}\n >\n {config.icon && (\n <div\n className=\"mint:flex mint:items-start mint:justify-center\"\n aria-hidden=\"true\"\n >\n {config.icon}\n </div>\n )}\n <div className=\"mint:text-sm mint:min-w-0 mint:w-full mint:max-w-none mint:prose mint:dark:prose-invert mint:[&>p:first-child]:font-semibold\">\n {children}\n </div>\n </aside>\n );\n}\n"],"names":["calloutConfig","jsx","Lightbulb20Regular","Info20Regular","Warning20Regular","DismissCircle20Regular","InfoFilled","calloutLabels","Callout","type","children","config","label","jsxs","cn"],"mappings":";;;AAsBA,MAAMA,IAMF;AAAA,EACF,KAAK;AAAA,IACH,MAAM,gBAAAC,EAACC,GAAA,EAAmB,WAAU,kCAAA,CAAkC;AAAA,IACtE,WACE;AAAA,EAAA;AAAA,EAEJ,MAAM;AAAA,IACJ,MAAM,gBAAAD,EAACE,GAAA,EAAc,WAAU,kCAAA,CAAkC;AAAA,IACjE,WACE;AAAA,EAAA;AAAA,EAEJ,SAAS;AAAA,IACP,MAAM,gBAAAF,EAACG,GAAA,EAAiB,WAAU,kCAAA,CAAkC;AAAA,IACpE,WACE;AAAA,EAAA;AAAA,EAEJ,SAAS;AAAA,IACP,MACE,gBAAAH,EAACI,GAAA,EAAuB,WAAU,kCAAA,CAAkC;AAAA,IAEtE,WACE;AAAA,EAAA;AAAA,EAEJ,WAAW;AAAA,IACT,MAAM,gBAAAJ,EAACG,GAAA,EAAiB,WAAU,kCAAA,CAAkC;AAAA,IACpE,WACE;AAAA,EAAA;AAAA,EAEJ,gBAAgB;AAAA,IACd,MACE,gBAAAH,EAACK,GAAA,EAAW,WAAU,2EAAA,CAA2E;AAAA,IAEnG,WACE;AAAA,EAAA;AAEN,GAEMC,IAA6C;AAAA,EACjD,MAAM;AAAA,EACN,KAAK;AAAA,EACL,WAAW;AAAA,EACX,SAAS;AAAA,EACT,SAAS;AAAA,EACT,gBAAgB;AAClB;AAEO,SAASC,EAAQ,EAAE,MAAAC,GAAM,UAAAC,KAA0B;AACxD,QAAMC,IAASX,EAAcS,CAAI,GAC3BG,IAAQL,EAAcE,CAAI;AAEhC,SACE,gBAAAI;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,cAAYD;AAAA,MACZ,WAAWE;AAAA,QACT;AAAA,QACAH,EAAO;AAAA,MAAA;AAAA,MAGR,UAAA;AAAA,QAAAA,EAAO,QACN,gBAAAV;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,eAAY;AAAA,YAEX,UAAAU,EAAO;AAAA,UAAA;AAAA,QAAA;AAAA,QAGZ,gBAAAV,EAAC,OAAA,EAAI,WAAU,gIACZ,UAAAS,EAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -1,4 +1,4 @@
1
- import { jsx as n, jsxs as v } from "react/jsx-runtime";
1
+ import { jsx as o, jsxs as v } from "react/jsx-runtime";
2
2
  import N, { useState as C, useEffect as B } from "react";
3
3
  import b from "prismjs";
4
4
  import "prismjs/components/prism-javascript.js";
@@ -14,14 +14,14 @@ import { cn as h } from "../../utils/cn.js";
14
14
  import { ClipboardCheckmarkRegular as A, Copy20Regular as R } from "@fluentui/react-icons";
15
15
  const w = ["image/png", "text/plain"];
16
16
  function g() {
17
- const [t, e] = C(!1), o = async (r) => {
17
+ const [t, e] = C(!1), n = async (r) => {
18
18
  try {
19
19
  await navigator.clipboard.writeText(r), e(!0), setTimeout(() => e(!1), 2e3);
20
20
  } catch (l) {
21
21
  console.error("Failed to copy to clipboard:", l);
22
22
  }
23
23
  };
24
- return { isCopied: t, copy: o, copyBlob: async (r, l) => {
24
+ return { isCopied: t, copy: n, copyBlob: async (r, l) => {
25
25
  try {
26
26
  if (w.includes(l)) {
27
27
  const i = await r.arrayBuffer(), a = new Blob([i], { type: l }), m = new ClipboardItem({
@@ -30,56 +30,56 @@ function g() {
30
30
  await navigator.clipboard.write([m]), e(!0), setTimeout(() => e(!1), 2e3);
31
31
  } else {
32
32
  const i = await r.text();
33
- await o(i);
33
+ await n(i);
34
34
  }
35
35
  } catch (i) {
36
36
  console.error("Failed to copy blob to clipboard:", i);
37
37
  try {
38
38
  const a = await r.text();
39
- await o(a);
39
+ await n(a);
40
40
  } catch (a) {
41
41
  console.error("Failed to copy as text fallback:", a);
42
42
  }
43
43
  }
44
44
  } };
45
45
  }
46
- function _({ onClick: t, isCopied: e, showTooltip: o = !0 }) {
46
+ function _({ onClick: t, isCopied: e, showTooltip: n = !0 }) {
47
47
  return /* @__PURE__ */ v("div", { className: "mint:relative", children: [
48
- o && e && /* @__PURE__ */ n("div", { className: "mint:absolute mint:bottom-[calc(100%+0.5rem)] mint:left-1/2 mint:-translate-x-1/2 mint:bg-white mint:dark:bg-[#1a1a1a] mint:text-[#171717] mint:dark:text-[#fafafa] mint:px-2.5 mint:py-1.5 mint:rounded-md mint:text-xs mint:font-medium mint:whitespace-nowrap mint:shadow-[0_4px_6px_-1px_rgba(0,0,0,0.1),0_2px_4px_-1px_rgba(0,0,0,0.06)] mint:dark:shadow-[0_4px_6px_-1px_rgba(0,0,0,0.3),0_2px_4px_-1px_rgba(0,0,0,0.2)] mint:z-10 mint:animate-[fadeIn_0.15s_ease-out] mint:after:content-[''] mint:after:absolute mint:after:top-full mint:after:left-1/2 mint:after:-translate-x-1/2 mint:after:w-0 mint:after:h-0 mint:after:border-l-[6px] mint:after:border-l-transparent mint:after:border-r-[6px] mint:after:border-r-transparent mint:after:border-t-[6px] mint:after:border-t-white mint:dark:after:border-t-[#1a1a1a]", children: "Copied!" }),
49
- /* @__PURE__ */ n(
48
+ n && e && /* @__PURE__ */ o("div", { className: "mint:absolute mint:bottom-[calc(100%+0.5rem)] mint:left-1/2 mint:-translate-x-1/2 mint:bg-white mint:dark:bg-[#1a1a1a] mint:text-[#171717] mint:dark:text-[#fafafa] mint:px-2.5 mint:py-1.5 mint:rounded-md mint:text-xs mint:font-medium mint:whitespace-nowrap mint:shadow-[0_4px_6px_-1px_rgba(0,0,0,0.1),0_2px_4px_-1px_rgba(0,0,0,0.06)] mint:dark:shadow-[0_4px_6px_-1px_rgba(0,0,0,0.3),0_2px_4px_-1px_rgba(0,0,0,0.2)] mint:z-10 mint:animate-[fadeIn_0.15s_ease-out] mint:after:content-[''] mint:after:absolute mint:after:top-full mint:after:left-1/2 mint:after:-translate-x-1/2 mint:after:w-0 mint:after:h-0 mint:after:border-l-[6px] mint:after:border-l-transparent mint:after:border-r-[6px] mint:after:border-r-transparent mint:after:border-t-[6px] mint:after:border-t-white mint:dark:after:border-t-[#1a1a1a]", children: "Copied!" }),
49
+ /* @__PURE__ */ o(
50
50
  "button",
51
51
  {
52
52
  onClick: t,
53
53
  className: "mint:flex mint:items-center mint:gap-1.5 mint:px-2 mint:py-1 mint:text-xs mint:text-[#737373] mint:dark:text-[#a3a3a3] mint:rounded mint:transition-colors mint:duration-150 mint:border-none mint:bg-transparent mint:cursor-pointer mint:hover:text-[#9263f1] mint:dark:hover:text-[#c9aaf9]",
54
54
  "aria-label": e ? "Copied" : "Copy code",
55
- children: e ? /* @__PURE__ */ n(A, { className: "mint:w-5 mint:h-5 mint:text-[#737373] mint:dark:text-[#a3a3a3]" }) : /* @__PURE__ */ n(R, { className: "mint:w-5 mint:h-5" })
55
+ children: e ? /* @__PURE__ */ o(A, { className: "mint:w-5 mint:h-5 mint:text-[#737373] mint:dark:text-[#a3a3a3]" }) : /* @__PURE__ */ o(R, { className: "mint:w-5 mint:h-5" })
56
56
  }
57
57
  )
58
58
  ] });
59
59
  }
60
60
  function q({ textToCopy: t, showTooltip: e = !0 }) {
61
- const { isCopied: o, copy: p } = g();
62
- return /* @__PURE__ */ n(_, { onClick: () => {
61
+ const { isCopied: n, copy: p } = g();
62
+ return /* @__PURE__ */ o(_, { onClick: () => {
63
63
  p(t);
64
- }, isCopied: o, showTooltip: e });
64
+ }, isCopied: n, showTooltip: e });
65
65
  }
66
66
  function G({ data: t, showTooltip: e = !0 }) {
67
- const { isCopied: o, copy: p, copyBlob: r } = g();
68
- return /* @__PURE__ */ n(_, { onClick: () => {
67
+ const { isCopied: n, copy: p, copyBlob: r } = g();
68
+ return /* @__PURE__ */ o(_, { onClick: () => {
69
69
  t.contentType && w.includes(t.contentType) ? r(t.blob, t.contentType) : t.type === "other" && t.content ? p(t.content) : console.error("Unsupported content type for clipboard");
70
- }, isCopied: o, showTooltip: e });
70
+ }, isCopied: n, showTooltip: e });
71
71
  }
72
72
  function J({
73
73
  children: t,
74
74
  className: e,
75
- fileName: o,
75
+ fileName: n,
76
76
  language: p,
77
77
  blob: r,
78
78
  contentType: l
79
79
  }) {
80
80
  const [i, a] = C("");
81
81
  g();
82
- const m = p || (e == null ? void 0 : e.replace(/^language-/, "")) || "text", d = I(t), k = !!o, x = N.useMemo(() => {
82
+ const m = p || (e == null ? void 0 : e.replace(/^language-/, "")) || "text", d = I(t), k = !!n, u = N.useMemo(() => {
83
83
  var f, y;
84
84
  if (typeof t != "object" || t == null)
85
85
  return !1;
@@ -87,25 +87,25 @@ function J({
87
87
  for (const c of s)
88
88
  if (typeof c == "object" && c != null && "props" in c && ((f = c.props) != null && f.children)) {
89
89
  const T = Array.isArray(c.props.children) ? c.props.children : [c.props.children];
90
- for (const u of T)
91
- if (typeof u == "object" && u != null && "props" in u && ((y = u.props) != null && y.className))
90
+ for (const x of T)
91
+ if (typeof x == "object" && x != null && "props" in x && ((y = x.props) != null && y.className))
92
92
  return !0;
93
93
  }
94
94
  return !1;
95
95
  }, [t]);
96
96
  return B(() => {
97
- if (!x)
97
+ if (!u)
98
98
  try {
99
99
  const s = b.languages[m] || b.languages.plaintext, f = b.highlight(d, s, m);
100
100
  a(f);
101
101
  } catch (s) {
102
102
  console.error("Failed to highlight code:", s), a(d);
103
103
  }
104
- }, [d, m, x]), /* @__PURE__ */ n(
104
+ }, [d, m, u]), /* @__PURE__ */ o(
105
105
  "div",
106
106
  {
107
107
  className: k ? "mint:flex mint:flex-col mint:gap-2 mint:px-0.5 mint:pb-0.5 mint:rounded-xl mint:overflow-hidden" : void 0,
108
- children: /* @__PURE__ */ n("div", { className: "not-prose mint:relative mint:rounded-xl mint:bg-[#f5f5f5] mint:dark:bg-[#141414]", children: /* @__PURE__ */ n("div", { className: "mint:code-scrollbar mint:overflow-x-auto", children: /* @__PURE__ */ n("pre", { className: "mint:px-4 mint:pb-3 mint:pt-2 mint:m-0 mint:whitespace-pre mint:text-sm", children: x ? /* @__PURE__ */ n(
108
+ children: /* @__PURE__ */ o("div", { className: "not-prose mint:relative mint:rounded-xl mint:bg-[#f5f5f5] mint:dark:bg-[#141414]", children: /* @__PURE__ */ o("div", { className: "mint:code-scrollbar mint:overflow-x-scroll", children: /* @__PURE__ */ o("pre", { className: "mint:px-4 mint:py-2 mint:m-0 mint:whitespace-pre mint:text-sm", children: u ? /* @__PURE__ */ o(
109
109
  "code",
110
110
  {
111
111
  className: h(
@@ -114,7 +114,7 @@ function J({
114
114
  ),
115
115
  children: t
116
116
  }
117
- ) : i ? /* @__PURE__ */ n(
117
+ ) : i ? /* @__PURE__ */ o(
118
118
  "code",
119
119
  {
120
120
  className: h(
@@ -123,7 +123,7 @@ function J({
123
123
  ),
124
124
  dangerouslySetInnerHTML: { __html: i }
125
125
  }
126
- ) : /* @__PURE__ */ n(
126
+ ) : /* @__PURE__ */ o(
127
127
  "code",
128
128
  {
129
129
  className: h(
@@ -1 +1 @@
1
- {"version":3,"file":"code-block.js","sources":["../../../src/components/content-components/code-block.tsx"],"sourcesContent":["\nimport React, { useEffect, useState } from \"react\";\nimport Prism from \"prismjs\";\nimport \"prismjs/components/prism-javascript.js\";\nimport \"prismjs/components/prism-typescript.js\";\nimport \"prismjs/components/prism-python.js\";\nimport \"prismjs/components/prism-bash.js\";\nimport \"prismjs/components/prism-json.js\";\nimport \"prismjs/components/prism-markdown.js\";\nimport \"prismjs/components/prism-csharp.js\";\nimport \"prismjs/components/prism-powershell.js\";\nimport { getNodeText } from \"../../utils/get-node-text\";\nimport { capitalize } from \"../../utils/string\";\nimport { cn } from \"../../utils/cn\";\nimport {\n Copy20Regular,\n ClipboardCheckmarkRegular,\n} from \"@fluentui/react-icons\";\n\nconst SUPPORTED_CLIPBOARD_CONTENT_TYPES = [\"image/png\", \"text/plain\"];\n\n// Hook for clipboard operations\nexport function useCopyToClipboard() {\n const [isCopied, setIsCopied] = useState(false);\n\n const copy = async (text: string) => {\n try {\n await navigator.clipboard.writeText(text);\n setIsCopied(true);\n setTimeout(() => setIsCopied(false), 2000);\n } catch (error) {\n console.error(\"Failed to copy to clipboard:\", error);\n }\n };\n\n const copyBlob = async (blob: Blob, contentType: string) => {\n try {\n // image/png, text/plain, and text/html are the only filetypes supported in the chromium\n // clipboard - however, text/html crashes chrome for some reason\n if (SUPPORTED_CLIPBOARD_CONTENT_TYPES.includes(contentType)) {\n const buffer = await blob.arrayBuffer();\n const newBlob = new Blob([buffer], { type: contentType });\n const clipboardItem = new ClipboardItem({\n [contentType]: newBlob,\n });\n await navigator.clipboard.write([clipboardItem]);\n setIsCopied(true);\n setTimeout(() => setIsCopied(false), 2000);\n } else {\n // Fallback to text copy for unsupported types\n const text = await blob.text();\n await copy(text);\n }\n } catch (error) {\n console.error(\"Failed to copy blob to clipboard:\", error);\n // Fallback to text copy if blob copy fails\n try {\n const text = await blob.text();\n await copy(text);\n } catch (fallbackError) {\n console.error(\"Failed to copy as text fallback:\", fallbackError);\n }\n }\n };\n\n return { isCopied, copy, copyBlob };\n}\n\n// Base copy icon button component\ninterface CopyIconButtonProps {\n onClick: () => void;\n isCopied: boolean;\n showTooltip?: boolean;\n}\n\nexport function CopyIconButton({ onClick, isCopied, showTooltip = true }: CopyIconButtonProps) {\n return (\n <div className=\"mint:relative\">\n {showTooltip && isCopied && (\n <div className=\"mint:absolute mint:bottom-[calc(100%+0.5rem)] mint:left-1/2 mint:-translate-x-1/2 mint:bg-white mint:dark:bg-[#1a1a1a] mint:text-[#171717] mint:dark:text-[#fafafa] mint:px-2.5 mint:py-1.5 mint:rounded-md mint:text-xs mint:font-medium mint:whitespace-nowrap mint:shadow-[0_4px_6px_-1px_rgba(0,0,0,0.1),0_2px_4px_-1px_rgba(0,0,0,0.06)] mint:dark:shadow-[0_4px_6px_-1px_rgba(0,0,0,0.3),0_2px_4px_-1px_rgba(0,0,0,0.2)] mint:z-10 mint:animate-[fadeIn_0.15s_ease-out] mint:after:content-[''] mint:after:absolute mint:after:top-full mint:after:left-1/2 mint:after:-translate-x-1/2 mint:after:w-0 mint:after:h-0 mint:after:border-l-[6px] mint:after:border-l-transparent mint:after:border-r-[6px] mint:after:border-r-transparent mint:after:border-t-[6px] mint:after:border-t-white mint:dark:after:border-t-[#1a1a1a]\">\n Copied!\n </div>\n )}\n <button\n onClick={onClick}\n className=\"mint:flex mint:items-center mint:gap-1.5 mint:px-2 mint:py-1 mint:text-xs mint:text-[#737373] mint:dark:text-[#a3a3a3] mint:rounded mint:transition-colors mint:duration-150 mint:border-none mint:bg-transparent mint:cursor-pointer mint:hover:text-[#9263f1] mint:dark:hover:text-[#c9aaf9]\"\n aria-label={isCopied ? \"Copied\" : \"Copy code\"}\n >\n {isCopied ? (\n <ClipboardCheckmarkRegular className=\"mint:w-5 mint:h-5 mint:text-[#737373] mint:dark:text-[#a3a3a3]\" />\n ) : (\n <Copy20Regular className=\"mint:w-5 mint:h-5\" />\n )}\n </button>\n </div>\n );\n}\n\n// Convenience component that handles text copying\ninterface CopyToClipboardButtonProps {\n textToCopy: string;\n showTooltip?: boolean;\n}\n\nexport function CopyToClipboardButton({ textToCopy, showTooltip = true }: CopyToClipboardButtonProps) {\n const { isCopied, copy } = useCopyToClipboard();\n\n const handleCopy = () => {\n copy(textToCopy);\n };\n\n return <CopyIconButton onClick={handleCopy} isCopied={isCopied} showTooltip={showTooltip} />;\n}\n\n// Convenience component that handles blob/data copying\ninterface CopyDataToClipboardButtonProps {\n data: {\n type: 'image' | 'audio' | 'video' | 'other';\n blob: Blob;\n contentType?: string;\n content?: string;\n };\n showTooltip?: boolean;\n}\n\nexport function CopyDataToClipboardButton({ data, showTooltip = true }: CopyDataToClipboardButtonProps) {\n const { isCopied, copy, copyBlob } = useCopyToClipboard();\n\n const handleCopy = () => {\n // Check if we can copy as blob (for images, etc.)\n if (data.contentType && SUPPORTED_CLIPBOARD_CONTENT_TYPES.includes(data.contentType)) {\n copyBlob(data.blob, data.contentType);\n } else if (data.type === 'other' && data.content) {\n // For text content, copy as text\n copy(data.content);\n } else {\n console.error('Unsupported content type for clipboard');\n }\n };\n\n return <CopyIconButton onClick={handleCopy} isCopied={isCopied} showTooltip={showTooltip} />;\n}\n\ninterface CodeBlockProps {\n children: React.ReactNode;\n className?: string;\n language?: string;\n fileName?: string;\n // Support for copying blobs (images, etc.)\n blob?: Blob;\n contentType?: string;\n}\n\nexport function CodeBlock({\n children,\n className,\n fileName,\n language,\n blob,\n contentType,\n}: CodeBlockProps) {\n const [highlightedCode, setHighlightedCode] = useState<string>(\"\");\n const { isCopied, copy, copyBlob } = useCopyToClipboard();\n const lang = language || className?.replace(/^language-/, \"\") || \"text\";\n const codeText = getNodeText(children);\n const showContainer = !!fileName;\n\n const isSSRHighlighted = React.useMemo(() => {\n if (typeof children !== \"object\" || children == null) {\n return false;\n }\n\n const childrenArray = Array.isArray(children) ? children : [children];\n for (const child of childrenArray) {\n if (\n typeof child === \"object\" &&\n child != null &&\n \"props\" in child &&\n child.props?.children\n ) {\n const codeChildren = Array.isArray(child.props.children)\n ? child.props.children\n : [child.props.children];\n\n for (const codeChild of codeChildren) {\n if (\n typeof codeChild === \"object\" &&\n codeChild != null &&\n \"props\" in codeChild &&\n codeChild.props?.className\n ) {\n return true;\n }\n }\n }\n }\n return false;\n }, [children]);\n\n useEffect(() => {\n if (isSSRHighlighted) {\n return;\n }\n\n try {\n const grammar = Prism.languages[lang] || Prism.languages.plaintext;\n const html = Prism.highlight(codeText, grammar, lang);\n setHighlightedCode(html);\n } catch (error) {\n console.error(\"Failed to highlight code:\", error);\n setHighlightedCode(codeText);\n }\n }, [codeText, lang, isSSRHighlighted]);\n\n const handleCopy = () => {\n // If blob and contentType are provided, use blob copying\n if (blob && contentType) {\n copyBlob(blob, contentType);\n } else {\n // Otherwise, use text copying\n copy(codeText);\n }\n };\n\n return (\n <div\n className={\n showContainer\n ? \"mint:flex mint:flex-col mint:gap-2 mint:px-0.5 mint:pb-0.5 mint:rounded-xl mint:overflow-hidden\"\n : undefined\n }\n >\n <div className=\"not-prose mint:relative mint:rounded-xl mint:bg-[#f5f5f5] mint:dark:bg-[#141414]\">\n <div className=\"mint:code-scrollbar mint:overflow-x-auto\">\n <pre className=\"mint:px-4 mint:pb-3 mint:pt-2 mint:m-0 mint:whitespace-pre mint:text-sm\">\n {isSSRHighlighted ? (\n <code\n className={cn(\n `language-${lang}`,\n \"mint:block mint:text-[#24292e] mint:dark:text-[#e6edf3]\"\n )}\n >\n {children}\n </code>\n ) : highlightedCode ? (\n <code\n className={cn(\n `language-${lang}`,\n \"mint:block mint:text-[#24292e] mint:dark:text-[#e6edf3]\"\n )}\n dangerouslySetInnerHTML={{ __html: highlightedCode }}\n />\n ) : (\n <code\n className={cn(\n `language-${lang}`,\n \"mint:block mint:text-[#24292e] mint:dark:text-[#e6edf3]\"\n )}\n >\n {codeText}\n </code>\n )}\n </pre>\n </div>\n </div>\n </div>\n );\n}\n"],"names":["SUPPORTED_CLIPBOARD_CONTENT_TYPES","useCopyToClipboard","isCopied","setIsCopied","useState","copy","text","error","blob","contentType","buffer","newBlob","clipboardItem","fallbackError","CopyIconButton","onClick","showTooltip","jsxs","jsx","ClipboardCheckmarkRegular","Copy20Regular","CopyToClipboardButton","textToCopy","CopyDataToClipboardButton","data","copyBlob","CodeBlock","children","className","fileName","language","highlightedCode","setHighlightedCode","lang","codeText","getNodeText","showContainer","isSSRHighlighted","React","childrenArray","child","_a","codeChildren","codeChild","_b","useEffect","grammar","Prism","html","cn"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,EAAC,OAAA,EAAI,WAAU,2EACZ,UAAAmB,IACC,gBAAAnB;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAW+B;AAAA,YACT,YAAYhB,CAAI;AAAA,YAChB;AAAA,UAAA;AAAA,UAGD,UAAAN;AAAA,QAAA;AAAA,MAAA,IAEDI,IACF,gBAAAb;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAW+B;AAAA,YACT,YAAYhB,CAAI;AAAA,YAChB;AAAA,UAAA;AAAA,UAEF,yBAAyB,EAAE,QAAQF,EAAA;AAAA,QAAgB;AAAA,MAAA,IAGrD,gBAAAb;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAW+B;AAAA,YACT,YAAYhB,CAAI;AAAA,YAChB;AAAA,UAAA;AAAA,UAGD,UAAAC;AAAA,QAAA;AAAA,MAAA,EACH,CAEJ,GACF,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"code-block.js","sources":["../../../src/components/content-components/code-block.tsx"],"sourcesContent":["\nimport React, { useEffect, useState } from \"react\";\nimport Prism from \"prismjs\";\nimport \"prismjs/components/prism-javascript.js\";\nimport \"prismjs/components/prism-typescript.js\";\nimport \"prismjs/components/prism-python.js\";\nimport \"prismjs/components/prism-bash.js\";\nimport \"prismjs/components/prism-json.js\";\nimport \"prismjs/components/prism-markdown.js\";\nimport \"prismjs/components/prism-csharp.js\";\nimport \"prismjs/components/prism-powershell.js\";\nimport { getNodeText } from \"../../utils/get-node-text\";\nimport { capitalize } from \"../../utils/string\";\nimport { cn } from \"../../utils/cn\";\nimport {\n Copy20Regular,\n ClipboardCheckmarkRegular,\n} from \"@fluentui/react-icons\";\n\nconst SUPPORTED_CLIPBOARD_CONTENT_TYPES = [\"image/png\", \"text/plain\"];\n\n// Hook for clipboard operations\nexport function useCopyToClipboard() {\n const [isCopied, setIsCopied] = useState(false);\n\n const copy = async (text: string) => {\n try {\n await navigator.clipboard.writeText(text);\n setIsCopied(true);\n setTimeout(() => setIsCopied(false), 2000);\n } catch (error) {\n console.error(\"Failed to copy to clipboard:\", error);\n }\n };\n\n const copyBlob = async (blob: Blob, contentType: string) => {\n try {\n // image/png, text/plain, and text/html are the only filetypes supported in the chromium\n // clipboard - however, text/html crashes chrome for some reason\n if (SUPPORTED_CLIPBOARD_CONTENT_TYPES.includes(contentType)) {\n const buffer = await blob.arrayBuffer();\n const newBlob = new Blob([buffer], { type: contentType });\n const clipboardItem = new ClipboardItem({\n [contentType]: newBlob,\n });\n await navigator.clipboard.write([clipboardItem]);\n setIsCopied(true);\n setTimeout(() => setIsCopied(false), 2000);\n } else {\n // Fallback to text copy for unsupported types\n const text = await blob.text();\n await copy(text);\n }\n } catch (error) {\n console.error(\"Failed to copy blob to clipboard:\", error);\n // Fallback to text copy if blob copy fails\n try {\n const text = await blob.text();\n await copy(text);\n } catch (fallbackError) {\n console.error(\"Failed to copy as text fallback:\", fallbackError);\n }\n }\n };\n\n return { isCopied, copy, copyBlob };\n}\n\n// Base copy icon button component\ninterface CopyIconButtonProps {\n onClick: () => void;\n isCopied: boolean;\n showTooltip?: boolean;\n}\n\nexport function CopyIconButton({ onClick, isCopied, showTooltip = true }: CopyIconButtonProps) {\n return (\n <div className=\"mint:relative\">\n {showTooltip && isCopied && (\n <div className=\"mint:absolute mint:bottom-[calc(100%+0.5rem)] mint:left-1/2 mint:-translate-x-1/2 mint:bg-white mint:dark:bg-[#1a1a1a] mint:text-[#171717] mint:dark:text-[#fafafa] mint:px-2.5 mint:py-1.5 mint:rounded-md mint:text-xs mint:font-medium mint:whitespace-nowrap mint:shadow-[0_4px_6px_-1px_rgba(0,0,0,0.1),0_2px_4px_-1px_rgba(0,0,0,0.06)] mint:dark:shadow-[0_4px_6px_-1px_rgba(0,0,0,0.3),0_2px_4px_-1px_rgba(0,0,0,0.2)] mint:z-10 mint:animate-[fadeIn_0.15s_ease-out] mint:after:content-[''] mint:after:absolute mint:after:top-full mint:after:left-1/2 mint:after:-translate-x-1/2 mint:after:w-0 mint:after:h-0 mint:after:border-l-[6px] mint:after:border-l-transparent mint:after:border-r-[6px] mint:after:border-r-transparent mint:after:border-t-[6px] mint:after:border-t-white mint:dark:after:border-t-[#1a1a1a]\">\n Copied!\n </div>\n )}\n <button\n onClick={onClick}\n className=\"mint:flex mint:items-center mint:gap-1.5 mint:px-2 mint:py-1 mint:text-xs mint:text-[#737373] mint:dark:text-[#a3a3a3] mint:rounded mint:transition-colors mint:duration-150 mint:border-none mint:bg-transparent mint:cursor-pointer mint:hover:text-[#9263f1] mint:dark:hover:text-[#c9aaf9]\"\n aria-label={isCopied ? \"Copied\" : \"Copy code\"}\n >\n {isCopied ? (\n <ClipboardCheckmarkRegular className=\"mint:w-5 mint:h-5 mint:text-[#737373] mint:dark:text-[#a3a3a3]\" />\n ) : (\n <Copy20Regular className=\"mint:w-5 mint:h-5\" />\n )}\n </button>\n </div>\n );\n}\n\n// Convenience component that handles text copying\ninterface CopyToClipboardButtonProps {\n textToCopy: string;\n showTooltip?: boolean;\n}\n\nexport function CopyToClipboardButton({ textToCopy, showTooltip = true }: CopyToClipboardButtonProps) {\n const { isCopied, copy } = useCopyToClipboard();\n\n const handleCopy = () => {\n copy(textToCopy);\n };\n\n return <CopyIconButton onClick={handleCopy} isCopied={isCopied} showTooltip={showTooltip} />;\n}\n\n// Convenience component that handles blob/data copying\ninterface CopyDataToClipboardButtonProps {\n data: {\n type: 'image' | 'audio' | 'video' | 'other';\n blob: Blob;\n contentType?: string;\n content?: string;\n };\n showTooltip?: boolean;\n}\n\nexport function CopyDataToClipboardButton({ data, showTooltip = true }: CopyDataToClipboardButtonProps) {\n const { isCopied, copy, copyBlob } = useCopyToClipboard();\n\n const handleCopy = () => {\n // Check if we can copy as blob (for images, etc.)\n if (data.contentType && SUPPORTED_CLIPBOARD_CONTENT_TYPES.includes(data.contentType)) {\n copyBlob(data.blob, data.contentType);\n } else if (data.type === 'other' && data.content) {\n // For text content, copy as text\n copy(data.content);\n } else {\n console.error('Unsupported content type for clipboard');\n }\n };\n\n return <CopyIconButton onClick={handleCopy} isCopied={isCopied} showTooltip={showTooltip} />;\n}\n\ninterface CodeBlockProps {\n children: React.ReactNode;\n className?: string;\n language?: string;\n fileName?: string;\n // Support for copying blobs (images, etc.)\n blob?: Blob;\n contentType?: string;\n}\n\nexport function CodeBlock({\n children,\n className,\n fileName,\n language,\n blob,\n contentType,\n}: CodeBlockProps) {\n const [highlightedCode, setHighlightedCode] = useState<string>(\"\");\n const { isCopied, copy, copyBlob } = useCopyToClipboard();\n const lang = language || className?.replace(/^language-/, \"\") || \"text\";\n const codeText = getNodeText(children);\n const showContainer = !!fileName;\n\n const isSSRHighlighted = React.useMemo(() => {\n if (typeof children !== \"object\" || children == null) {\n return false;\n }\n\n const childrenArray = Array.isArray(children) ? children : [children];\n for (const child of childrenArray) {\n if (\n typeof child === \"object\" &&\n child != null &&\n \"props\" in child &&\n child.props?.children\n ) {\n const codeChildren = Array.isArray(child.props.children)\n ? child.props.children\n : [child.props.children];\n\n for (const codeChild of codeChildren) {\n if (\n typeof codeChild === \"object\" &&\n codeChild != null &&\n \"props\" in codeChild &&\n codeChild.props?.className\n ) {\n return true;\n }\n }\n }\n }\n return false;\n }, [children]);\n\n useEffect(() => {\n if (isSSRHighlighted) {\n return;\n }\n\n try {\n const grammar = Prism.languages[lang] || Prism.languages.plaintext;\n const html = Prism.highlight(codeText, grammar, lang);\n setHighlightedCode(html);\n } catch (error) {\n console.error(\"Failed to highlight code:\", error);\n setHighlightedCode(codeText);\n }\n }, [codeText, lang, isSSRHighlighted]);\n\n const handleCopy = () => {\n // If blob and contentType are provided, use blob copying\n if (blob && contentType) {\n copyBlob(blob, contentType);\n } else {\n // Otherwise, use text copying\n copy(codeText);\n }\n };\n\n return (\n <div\n className={\n showContainer\n ? \"mint:flex mint:flex-col mint:gap-2 mint:px-0.5 mint:pb-0.5 mint:rounded-xl mint:overflow-hidden\"\n : undefined\n }\n >\n <div className=\"not-prose mint:relative mint:rounded-xl mint:bg-[#f5f5f5] mint:dark:bg-[#141414]\">\n <div className=\"mint:code-scrollbar mint:overflow-x-scroll\">\n <pre className=\"mint:px-4 mint:py-2 mint:m-0 mint:whitespace-pre mint:text-sm\">\n {isSSRHighlighted ? (\n <code\n className={cn(\n `language-${lang}`,\n \"mint:block mint:text-[#24292e] mint:dark:text-[#e6edf3]\"\n )}\n >\n {children}\n </code>\n ) : highlightedCode ? (\n <code\n className={cn(\n `language-${lang}`,\n \"mint:block mint:text-[#24292e] mint:dark:text-[#e6edf3]\"\n )}\n dangerouslySetInnerHTML={{ __html: highlightedCode }}\n />\n ) : (\n <code\n className={cn(\n `language-${lang}`,\n \"mint:block mint:text-[#24292e] mint:dark:text-[#e6edf3]\"\n )}\n >\n {codeText}\n </code>\n )}\n </pre>\n </div>\n </div>\n </div>\n );\n}\n"],"names":["SUPPORTED_CLIPBOARD_CONTENT_TYPES","useCopyToClipboard","isCopied","setIsCopied","useState","copy","text","error","blob","contentType","buffer","newBlob","clipboardItem","fallbackError","CopyIconButton","onClick","showTooltip","jsxs","jsx","ClipboardCheckmarkRegular","Copy20Regular","CopyToClipboardButton","textToCopy","CopyDataToClipboardButton","data","copyBlob","CodeBlock","children","className","fileName","language","highlightedCode","setHighlightedCode","lang","codeText","getNodeText","showContainer","isSSRHighlighted","React","childrenArray","child","_a","codeChildren","codeChild","_b","useEffect","grammar","Prism","html","cn"],"mappings":";;;;;;;;;;;;;;AAmBA,MAAMA,IAAoC,CAAC,aAAa,YAAY;AAG7D,SAASC,IAAqB;AACnC,QAAM,CAACC,GAAUC,CAAW,IAAIC,EAAS,EAAK,GAExCC,IAAO,OAAOC,MAAiB;AACnC,QAAI;AACF,YAAM,UAAU,UAAU,UAAUA,CAAI,GACxCH,EAAY,EAAI,GAChB,WAAW,MAAMA,EAAY,EAAK,GAAG,GAAI;AAAA,IAC3C,SAASI,GAAO;AACd,cAAQ,MAAM,gCAAgCA,CAAK;AAAA,IACrD;AAAA,EACF;AAgCA,SAA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AA,IAGrD,gBAAAb;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAW+B;AAAA,YACT,YAAYhB,CAAI;AAAA,YAChB;AAAA,UAAA;AAAA,UAGD,UAAAC;AAAA,QAAA;AAAA,MAAA,EACH,CAEJ,GACF,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -1,4 +1,4 @@
1
- import { jsxs as u, jsx as e } from "react/jsx-runtime";
1
+ import { jsxs as c, jsx as e } from "react/jsx-runtime";
2
2
  import * as f from "@radix-ui/react-tabs";
3
3
  import j, { forwardRef as k, useRef as F, useState as L, useCallback as V } from "react";
4
4
  import { ChevronDownFilled as B } from "@fluentui/react-icons";
@@ -23,14 +23,14 @@ const K = k(function({ children: r, onChange: a, className: o, dropdown: l, noMa
23
23
  return null;
24
24
  if (i.length === 0)
25
25
  return console.warn("CodeGroup has no children, expected at least one CodeBlock child."), null;
26
- const c = Number(v), I = () => {
26
+ const u = Number(v), I = () => {
27
27
  var n;
28
- return /* @__PURE__ */ e("div", { className: "mint:flex mint:items-center mint:gap-1.5 mint:text-xs mint:font-medium mint:min-w-0", children: /* @__PURE__ */ e("span", { className: "mint:truncate mint:text-[#171717] mint:dark:text-[#fafafa]", children: (n = i[c]) == null ? void 0 : n.props.fileName }) });
28
+ return /* @__PURE__ */ e("div", { className: "mint:flex mint:items-center mint:gap-1.5 mint:text-xs mint:font-medium mint:min-w-0", children: /* @__PURE__ */ e("span", { className: "mint:truncate mint:text-[#171717] mint:dark:text-[#fafafa]", children: (n = i[u]) == null ? void 0 : n.props.fileName }) });
29
29
  }, $ = () => /* @__PURE__ */ e(f.List, { className: "mint:flex-1 mint:min-w-0 mint:text-xs mint:leading-6 mint:rounded-tl-xl mint:gap-1 mint:flex mint:overflow-x-auto mint:overflow-y-hidden", children: i.map((n, t) => /* @__PURE__ */ e(
30
30
  _,
31
31
  {
32
32
  value: String(t),
33
- isSelected: c === t,
33
+ isSelected: u === t,
34
34
  tabsLength: i.length,
35
35
  ref: (m) => {
36
36
  m && b.current.set(t, m);
@@ -40,11 +40,11 @@ const K = k(function({ children: r, onChange: a, className: o, dropdown: l, noMa
40
40
  n.props.fileName + "TabItem" + t
41
41
  )) }), R = () => {
42
42
  var n;
43
- return /* @__PURE__ */ u("div", { className: "mint:relative", children: [
43
+ return /* @__PURE__ */ c("div", { className: "mint:relative", children: [
44
44
  /* @__PURE__ */ e(
45
45
  "select",
46
46
  {
47
- value: ((n = i[c]) == null ? void 0 : n.props.language) || "",
47
+ value: ((n = i[u]) == null ? void 0 : n.props.language) || "",
48
48
  onChange: (t) => {
49
49
  const m = t.target.value, s = i.findIndex((d) => d.props.language === m);
50
50
  s !== -1 && N(String(s));
@@ -56,7 +56,7 @@ const K = k(function({ children: r, onChange: a, className: o, dropdown: l, noMa
56
56
  /* @__PURE__ */ e(B, { className: "mint:absolute mint:right-2 mint:top-1/2 mint:-translate-y-1/2 mint:w-3.5 mint:h-3.5 mint:pointer-events-none mint:text-[#737373] mint:dark:text-[#a3a3a3]" })
57
57
  ] });
58
58
  };
59
- return /* @__PURE__ */ u(
59
+ return /* @__PURE__ */ c(
60
60
  f.Root,
61
61
  {
62
62
  defaultValue: p == null ? void 0 : typeof p == "string" ? p : String(p),
@@ -71,7 +71,7 @@ const K = k(function({ children: r, onChange: a, className: o, dropdown: l, noMa
71
71
  asChild: !1,
72
72
  ...S,
73
73
  children: [
74
- /* @__PURE__ */ u(
74
+ /* @__PURE__ */ c(
75
75
  "div",
76
76
  {
77
77
  className: g(
@@ -80,12 +80,12 @@ const K = k(function({ children: r, onChange: a, className: o, dropdown: l, noMa
80
80
  ),
81
81
  children: [
82
82
  l ? /* @__PURE__ */ e(I, {}) : /* @__PURE__ */ e($, {}),
83
- /* @__PURE__ */ u("div", { className: "mint:flex mint:items-center mint:justify-end mint:shrink-0 mint:gap-1.5", children: [
83
+ /* @__PURE__ */ c("div", { className: "mint:flex mint:items-center mint:justify-end mint:shrink-0 mint:gap-1.5", children: [
84
84
  l && /* @__PURE__ */ e(R, {}),
85
85
  /* @__PURE__ */ e(
86
86
  G,
87
87
  {
88
- textToCopy: z((y = (w = i[c]) == null ? void 0 : w.props) == null ? void 0 : y.children),
88
+ textToCopy: z((y = (w = i[u]) == null ? void 0 : w.props) == null ? void 0 : y.children),
89
89
  showTooltip: !0
90
90
  }
91
91
  )
@@ -99,7 +99,7 @@ const K = k(function({ children: r, onChange: a, className: o, dropdown: l, noMa
99
99
  value: String(t),
100
100
  className: "mint:w-full mint:min-w-full mint:max-w-full mint:h-full mint:max-h-full",
101
101
  tabIndex: -1,
102
- children: /* @__PURE__ */ e("div", { className: "mint:overflow-auto mint:max-h-[calc(40vh-3rem)]", children: n })
102
+ children: /* @__PURE__ */ e("div", { className: "mint:code-scrollbar mint:overflow-scroll mint:max-h-[calc(40vh-3rem)]", children: n })
103
103
  },
104
104
  `${n.props.fileName}-${n.props.language}-${t}`
105
105
  )) })
@@ -107,7 +107,7 @@ const K = k(function({ children: r, onChange: a, className: o, dropdown: l, noMa
107
107
  }
108
108
  );
109
109
  }), _ = k(function({ children: r, value: a, isSelected: o, tabsLength: l }, h) {
110
- return /* @__PURE__ */ u(
110
+ return /* @__PURE__ */ c(
111
111
  f.Trigger,
112
112
  {
113
113
  ref: h,