apiuikit 1.1.0 → 1.2.0

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 (88) hide show
  1. package/README.md +1 -0
  2. package/dist/CodeSamples-CXtSA6EK.js +4298 -0
  3. package/dist/CodeSamples-D7dq1xEM.cjs +50 -0
  4. package/dist/apiuikit.cjs.js +1 -1
  5. package/dist/apiuikit.es.js +30 -22
  6. package/dist/config/config.d.ts +48 -0
  7. package/dist/contexts/useSpec.d.ts +3 -0
  8. package/dist/helpers/jsonPointer.d.ts +5 -0
  9. package/dist/helpers/llmsTxt.d.ts +51 -0
  10. package/dist/helpers/specAdapters.d.ts +32 -0
  11. package/dist/helpers/toMarkdown.d.ts +5 -6
  12. package/dist/hooks/useDocumentProviderValue.d.ts +3 -1
  13. package/dist/index-BJ0X8yP3.cjs +133 -0
  14. package/dist/{index-DM2MTkYV.js → index-BMRPdMaB.js} +1 -1
  15. package/dist/{index-EeGvEXPN.cjs → index-BoAORjov.cjs} +1 -1
  16. package/dist/{index-B5IBIM-V.cjs → index-CZjVUeK4.cjs} +1 -1
  17. package/dist/index-DCDYBZcY.js +1461 -0
  18. package/dist/index-DwzxTmOd.js +13614 -0
  19. package/dist/index-d8kJa7YD.cjs +4 -0
  20. package/dist/{index-iXpNcBcP.js → index-ib-tk7y5.js} +1 -1
  21. package/dist/index.d.ts +4 -1
  22. package/dist/markdown-assets/protoToJsonSchema-CBPWaboT.js +6193 -0
  23. package/dist/markdown-assets/protoToJsonSchema-CgkcluFJ.js +83 -0
  24. package/dist/markdown.cjs +91 -0
  25. package/dist/markdown.d.ts +8 -0
  26. package/dist/markdown.es.js +2101 -0
  27. package/dist/{protoToJsonSchema-CcEvAEt4.js → protoToJsonSchema-Btyc_WLL.js} +112 -108
  28. package/dist/{protoToJsonSchema-BNZrP3Fa.cjs → protoToJsonSchema-wxazjeYy.cjs} +10 -10
  29. package/dist/{protobufSchemaParser-BaWs_7UI.js → protobufSchemaParser-9KjS7p8W.js} +2 -2
  30. package/dist/{protobufSchemaParser-7sU6XBEb.cjs → protobufSchemaParser-G1NujZ28.cjs} +1 -1
  31. package/dist/shims/utilInspect.d.ts +2 -0
  32. package/package.json +8 -3
  33. package/dist/components/Navigation/tests/spineTicks.test.d.ts +0 -1
  34. package/dist/components/schema/tests/SchemaTab.test.d.ts +0 -1
  35. package/dist/components/schema/tests/schemaUtils.test.d.ts +0 -1
  36. package/dist/components/tests/Authorization.test.d.ts +0 -1
  37. package/dist/components/tests/Bindings.test.d.ts +0 -1
  38. package/dist/components/tests/ChannelAddress.test.d.ts +0 -1
  39. package/dist/components/tests/CodeBlock.test.d.ts +0 -1
  40. package/dist/components/tests/CodeSamples.test.d.ts +0 -1
  41. package/dist/components/tests/CopyMarkdownButton.test.d.ts +0 -1
  42. package/dist/components/tests/ErrorBoundary.test.d.ts +0 -1
  43. package/dist/components/tests/MarkdownExportMenu.test.d.ts +0 -1
  44. package/dist/components/tests/RenderExtensions.test.d.ts +0 -1
  45. package/dist/containers/AsyncAPI/tests/AsyncAPI.test.d.ts +0 -1
  46. package/dist/containers/AsyncAPI/tests/AsyncAPIErrorBoundary.test.d.ts +0 -1
  47. package/dist/containers/AsyncAPI/tests/AsyncAPIRenderer.test.d.ts +0 -1
  48. package/dist/containers/AsyncAPI/tests/searchHighlight.test.d.ts +0 -1
  49. package/dist/containers/OpenAPI/tests/OpenAPI.test.d.ts +0 -1
  50. package/dist/containers/OpenAPI/tests/OpenAPIErrorBoundary.test.d.ts +0 -1
  51. package/dist/containers/OpenAPI/tests/OpenAPIRenderer.test.d.ts +0 -1
  52. package/dist/containers/Path/tests/PathOperation.test.d.ts +0 -1
  53. package/dist/containers/Path/tests/Paths.test.d.ts +0 -1
  54. package/dist/helpers/avro/tests/avroToJsonSchema.test.d.ts +0 -1
  55. package/dist/helpers/protobuf/tests/protoToJsonSchema.test.d.ts +0 -1
  56. package/dist/helpers/protobuf/tests/protobufSchemaParser.test.d.ts +0 -1
  57. package/dist/helpers/tests/codeSamples.test.d.ts +0 -1
  58. package/dist/helpers/tests/exampleSchema.test.d.ts +0 -1
  59. package/dist/helpers/tests/openapiSearchIndex.test.d.ts +0 -1
  60. package/dist/helpers/tests/resolveDocument.test.d.ts +0 -1
  61. package/dist/helpers/tests/schemaFormat.test.d.ts +0 -1
  62. package/dist/helpers/tests/toMarkdown.test.d.ts +0 -1
  63. package/dist/index-BqogUhNO.js +0 -19011
  64. package/dist/index-mYBY1Eu8.cjs +0 -177
  65. package/dist/public/tests/sections.test.d.ts +0 -1
  66. package/dist/stories/AsyncAPI.stories.d.ts +0 -14
  67. package/dist/stories/AsyncAPIRenderer.stories.d.ts +0 -17
  68. package/dist/stories/Authorization.stories.d.ts +0 -13
  69. package/dist/stories/Bindings.stories.d.ts +0 -12
  70. package/dist/stories/ChannelAddress.stories.d.ts +0 -13
  71. package/dist/stories/CodeBlock.stories.d.ts +0 -11
  72. package/dist/stories/Examples.stories.d.ts +0 -11
  73. package/dist/stories/Information.stories.d.ts +0 -9
  74. package/dist/stories/Message.stories.d.ts +0 -11
  75. package/dist/stories/Messages.stories.d.ts +0 -11
  76. package/dist/stories/Operation.stories.d.ts +0 -10
  77. package/dist/stories/Operations.stories.d.ts +0 -16
  78. package/dist/stories/SchemaTab.stories.d.ts +0 -12
  79. package/dist/stories/SchemaTree.stories.d.ts +0 -24
  80. package/dist/stories/SearchPanel.stories.d.ts +0 -16
  81. package/dist/stories/Server.stories.d.ts +0 -12
  82. package/dist/stories/TabToggle.stories.d.ts +0 -10
  83. package/dist/stories/Tabs.stories.d.ts +0 -11
  84. package/dist/stories/documentContextDecorator.d.ts +0 -25
  85. package/dist/stories/noCanvasDocsPage.d.ts +0 -9
  86. package/dist/utils/tests/hasRef.test.d.ts +0 -1
  87. package/dist/utils/tests/theme.test.d.ts +0 -1
  88. package/dist/utils/tests/useElementRect.test.d.ts +0 -1
@@ -0,0 +1,4 @@
1
+ "use strict";var je=Object.defineProperty;var Me=(e,t,i)=>t in e?je(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var U=(e,t,i)=>Me(e,typeof t!="symbol"?t+"":t,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function Pe(e){let t=e|0;return()=>{t=t+1831565813|0;let i=Math.imul(t^t>>>15,1|t);return i=i+Math.imul(i^i>>>7,61|i)^i,((i^i>>>14)>>>0)/4294967296}}function se(e){let t=Pe(e),i={next(){return t()},int(n,r){return n+Math.floor(i.next()*(r-n+1))},bool(n=.5){return i.next()<n},pick(n){return n[i.int(0,n.length-1)]},shuffle(n){let r=[...n];for(let o=r.length-1;o>0;o--){let a=i.int(0,o);[r[o],r[a]]=[r[a],r[o]]}return r},fork(){let n=Math.floor(i.next()*4294967296);return se(n)}};return i}function ke(e){return null}function Ie(e){return e.random.bool()}function fe(e,t,i=!1){let n=-1e3,r=1e3,o=!1,a=!1;if(e.minimum!==void 0&&(n=e.minimum),e.maximum!==void 0&&(r=e.maximum),e.exclusiveMinimum!==void 0&&(n=e.exclusiveMinimum,o=!0),e.exclusiveMaximum!==void 0&&(r=e.exclusiveMaximum,a=!0),e.multipleOf!==void 0)return Je(e.multipleOf,n,r,o,a,t);if(i){let c=o?Math.floor(n)+1:Math.ceil(n),g=a?Math.ceil(r)-1:Math.floor(r);return t.random.int(c,g)}let l=o?n+Number.EPSILON:n,s=a?r-Number.EPSILON:r;return l+t.random.next()*(s-l)}function Je(e,t,i,n,r,o){let a=Math.ceil(t/e),l=Math.floor(i/e);return n&&a*e===t&&a++,r&&l*e===i&&l--,a>l?a*e:o.random.int(a,l)*e}function De(e,t){if(e.autoIncrement){let i=e.initialOffset??1,n=Ae(t.path),r=t.autoIncrementCounters??new Map,o=(r.get(n)??i-1)+1;return r.set(n,o),t.autoIncrementCounters&&t.autoIncrementCounters.set(n,o),o}return fe(e,t,!0)}function Ae(e){return e.split("/").filter(t=>t!==""&&!/^\d+$/.test(t)).join("/")}function V(e,t){let i=ue(e,0);return N(i.node,t)}function N(e,t){switch(e.type){case"literal":return e.value;case"dot":return t.pick([..."abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#%&*()-_=+[]{}|;:',.<>/? "]);case"anchor":return"";case"charClass":return Se(e,t);case"sequence":return e.nodes.map(i=>N(i,t)).join("");case"alternation":return N(t.pick(e.branches),t);case"quantifier":{let i=t.int(e.min,Math.min(e.max,e.min+5));return Array.from({length:i},()=>N(e.node,t)).join("")}case"group":return N(e.node,t)}}function Se(e,t){if(!e.negated)return t.pick(e.chars);let i=new Set(e.chars),n=[..."abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#%&*()-_=+[]{}|;:',.<>/? "].filter(r=>!i.has(r));return n.length>0?t.pick(n):"a"}function ue(e,t){let i=[],n=[];for(;t<e.length;){let r=e[t];if(r===")")break;if(r==="|"){i.push(_(n)),n=[],t++;continue}if(r==="("){let l=t+1;if(e[l]==="?")if(e[l+1]===":")l+=2;else if(e[l+1]==="="||e[l+1]==="!"){let d=1,w=l;for(;w<e.length&&d>0;)w++,e[w]==="("&&d++,e[w]===")"&&d--;t=w+1;continue}else{for(l+=2;l<e.length&&e[l]!==">";)l++;l++}let s=ue(e,l),c={type:"group",node:s.node};t=s.pos+1;let g=Z(e,t,c);n.push(g.node),t=g.pos;continue}if(r==="["){let l=Ee(e,t),s=Z(e,l.pos,l.node);n.push(s.node),t=s.pos;continue}if(r==="."){let l={type:"dot"};t++;let s=Z(e,t,l);n.push(s.node),t=s.pos;continue}if(r==="^"||r==="$"){n.push({type:"anchor"}),t++;continue}if(r==="\\"){t++;let l=Le(e,t);t=l.pos;let s=Z(e,t,l.node);n.push(s.node),t=s.pos;continue}let o={type:"literal",value:r};t++;let a=Z(e,t,o);n.push(a.node),t=a.pos}return i.push(_(n)),{node:i.length===1?i[0]:{type:"alternation",branches:i},pos:t}}function _(e){return e.length===0?{type:"literal",value:""}:e.length===1?e[0]:{type:"sequence",nodes:e}}function Le(e,t){let i=e[t];switch(t++,i){case"d":return{node:{type:"charClass",chars:[..."0123456789"],negated:!1},pos:t};case"D":return{node:{type:"charClass",chars:[..."0123456789"],negated:!0},pos:t};case"w":return{node:{type:"charClass",chars:[..."abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"],negated:!1},pos:t};case"W":return{node:{type:"charClass",chars:[..."abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"],negated:!0},pos:t};case"s":return{node:{type:"charClass",chars:[...`
2
+ `],negated:!1},pos:t};case"S":return{node:{type:"charClass",chars:[...`
3
+ `],negated:!0},pos:t};case"b":case"B":return{node:{type:"anchor"},pos:t};default:return{node:{type:"literal",value:i},pos:t}}}function Ee(e,t){t++;let i=!1;e[t]==="^"&&(i=!0,t++);let n=[];for(;t<e.length&&e[t]!=="]";){if(e[t]==="\\"&&t+1<e.length){t++;let r=e[t];switch(r){case"d":n.push(..."0123456789");break;case"w":n.push(..."abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_");break;case"s":n.push(...`
4
+ `);break;default:n.push(r)}t++;continue}if(t+2<e.length&&e[t+1]==="-"&&e[t+2]!=="]"){let r=e.charCodeAt(t),o=e.charCodeAt(t+2);for(let a=r;a<=o;a++)n.push(String.fromCharCode(a));t+=3;continue}n.push(e[t]),t++}return t++,{node:{type:"charClass",chars:n,negated:i},pos:t}}function Z(e,t,i){if(t>=e.length)return{node:i,pos:t};let n=e[t],r,o;switch(n){case"*":r=0,o=5,t++;break;case"+":r=1,o=5,t++;break;case"?":r=0,o=1,t++;break;case"{":{let a=Ze(e,t);if(a)r=a.min,o=a.max,t=a.pos;else return{node:i,pos:t};break}default:return{node:i,pos:t}}return t<e.length&&(e[t]==="?"||e[t]==="+")&&t++,{node:{type:"quantifier",node:i,min:r,max:o},pos:t}}function Ze(e,t){let i=e.slice(t).match(/^\{(\d+)(?:,(\d*))?\}/);if(!i)return null;let n=parseInt(i[1],10),r;return i[2]===void 0?r=n:i[2]===""?r=n+5:r=parseInt(i[2],10),{min:n,max:r,pos:t+i[0].length}}function I(e){return e<10?`0${e}`:`${e}`}function Ne(e,t){return new Date(e,t,0).getDate()}var pe="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";function Xe(e){return!(e==="^"||e==="$"||e==="^$")}function qe(e,t){if(e.format){if(e.format==="date-time"&&(t.minDateTime!==void 0||t.maxDateTime!==void 0))return Qe(t);let a=t.formatRegistry.get(e.format);if(a){let l=a(t.random),s=t.minLength??e.minLength,c=t.maxLength??e.maxLength;return s!==void 0&&l.length<s?R(l,s,t):c!==void 0&&l.length>c?l.slice(0,c):l}}if(e.pattern){let a=t.minLength??e.minLength,l=t.maxLength??e.maxLength;for(let g=0;g<50;g++){let d=V(e.pattern,t.random);if(!(a!==void 0&&d.length<a)&&!(l!==void 0&&d.length>l))return d}let s=V(e.pattern,t.random),c=Xe(e.pattern);return a!==void 0&&s.length<a&&c?R(s,a,t):l!==void 0&&s.length>l?s.slice(0,l):s}let i=e.minLength??0,n=e.maxLength??Math.max(i+10,10),r=t.random.int(i,n),o="";for(let a=0;a<r;a++)o+=t.random.pick([...pe]);return t.maxLength!==void 0&&o.length>t.maxLength&&(o=o.slice(0,t.maxLength)),t.minLength!==void 0&&o.length<t.minLength&&(o=R(o,t.minLength,t)),o}function R(e,t,i){for(;e.length<t;)e+=i.random.pick([...pe]);return e}function Qe(e){let t=e.minDateTime?new Date(e.minDateTime):new Date("1970-01-01"),i=e.maxDateTime?new Date(e.maxDateTime):new Date,n=t.getTime(),r=i.getTime(),o=n+e.random.next()*(r-n),a=new Date(o),l=a.getFullYear(),s=I(a.getMonth()+1),c=I(a.getDate());return`${l}-${s}-${c}T01:01:01.0Z`}function z(e,t){if(e.const!==void 0)return structuredClone(e.const);if(e.enum!==void 0&&e.enum.length>0){let i=e.enum;if(e.minimum!==void 0||e.maximum!==void 0||e.exclusiveMinimum!==void 0||e.exclusiveMaximum!==void 0||e.multipleOf!==void 0){let r=e.exclusiveMinimum??e.minimum??-1/0,o=e.exclusiveMaximum??e.maximum??1/0,a=e.exclusiveMinimum!==void 0,l=e.exclusiveMaximum!==void 0;i=i.filter(s=>{if(typeof s!="number")return!0;let c=a?s>r:s>=r,g=l?s<o:s<=o;if(!c||!g)return!1;if(e.multipleOf!==void 0){let d=e.multipleOf,w=d.toString().includes(".")?d.toString().split(".")[1].length:0,j=Math.pow(10,w),k=Math.round(s*j),E=Math.round(d*j);if(k%E!==0)return!1}return!0})}if(e.minLength!==void 0||e.maxLength!==void 0){let r=e.minLength??0,o=e.maxLength??1/0;i=i.filter(a=>typeof a!="string"?!0:a.length>=r&&a.length<=o)}if(e.minItems!==void 0||e.maxItems!==void 0){let r=e.minItems??0,o=e.maxItems??1/0;i=i.filter(a=>Array.isArray(a)?a.length>=r&&a.length<=o:!0)}if(e.minProperties!==void 0||e.maxProperties!==void 0){let r=e.minProperties??0,o=e.maxProperties??1/0;i=i.filter(a=>typeof a!="object"||a===null||Array.isArray(a)?!0:Object.keys(a).length>=r&&Object.keys(a).length<=o)}if(i.length===0){let r=[];throw e.minLength!==void 0&&r.push(`minLength: ${e.minLength}`),e.maxLength!==void 0&&r.push(`maxLength: ${e.maxLength}`),e.minItems!==void 0&&r.push(`minItems: ${e.minItems}`),e.maxItems!==void 0&&r.push(`maxItems: ${e.maxItems}`),e.minProperties!==void 0&&r.push(`minProperties: ${e.minProperties}`),e.maxProperties!==void 0&&r.push(`maxProperties: ${e.maxProperties}`),e.minimum!==void 0&&r.push(`minimum: ${e.minimum}`),e.maximum!==void 0&&r.push(`maximum: ${e.maximum}`),e.exclusiveMinimum!==void 0&&r.push(`exclusiveMinimum: ${e.exclusiveMinimum}`),e.exclusiveMaximum!==void 0&&r.push(`exclusiveMaximum: ${e.exclusiveMaximum}`),e.multipleOf!==void 0&&r.push(`multipleOf: ${e.multipleOf}`),Error(`enum values conflict with constraints [${r.join(", ")}] at ${t.path}`)}let n=t.random.pick(i);return typeof n=="object"&&n!==null?structuredClone(n):n}throw Error(`generateEnumConst called without enum or const at ${t.path}`)}function J(e){let t={};for(let i of e){if(typeof i=="boolean"){if(!i)return{not:{}};continue}me(t,i)}return t}function ce(e,t){if(typeof e=="boolean"||typeof t=="boolean")return{};if(typeof e!="object"||e===null)return typeof t=="object"&&t!==null?t:{};if(typeof t!="object"||t===null)return e;let i={...e};return me(i,t),i}function me(e,t){if(t.type!==void 0&&(e.type===void 0?e.type=t.type:e.type=Te(e.type,t.type)),t.minimum!==void 0&&(e.minimum=e.minimum!==void 0?Math.max(e.minimum,t.minimum):t.minimum),t.maximum!==void 0&&(e.maximum=e.maximum!==void 0?Math.min(e.maximum,t.maximum):t.maximum),t.exclusiveMinimum!==void 0&&(e.exclusiveMinimum=e.exclusiveMinimum!==void 0?Math.max(e.exclusiveMinimum,t.exclusiveMinimum):t.exclusiveMinimum),t.exclusiveMaximum!==void 0&&(e.exclusiveMaximum=e.exclusiveMaximum!==void 0?Math.min(e.exclusiveMaximum,t.exclusiveMaximum):t.exclusiveMaximum),t.multipleOf!==void 0&&(e.multipleOf=t.multipleOf),t.minLength!==void 0&&(e.minLength=e.minLength!==void 0?Math.max(e.minLength,t.minLength):t.minLength),t.maxLength!==void 0&&(e.maxLength=e.maxLength!==void 0?Math.min(e.maxLength,t.maxLength):t.maxLength),t.pattern!==void 0&&(e.pattern=t.pattern),t.format!==void 0&&(e.format=t.format),t.minItems!==void 0&&(e.minItems=e.minItems!==void 0?Math.max(e.minItems,t.minItems):t.minItems),t.maxItems!==void 0&&(e.maxItems=e.maxItems!==void 0?Math.min(e.maxItems,t.maxItems):t.maxItems),t.uniqueItems&&(e.uniqueItems=!0),t.items!==void 0&&(e.items=t.items),t.prefixItems!==void 0)if(e.prefixItems===void 0)e.prefixItems=t.prefixItems;else{let i=[],n=Math.max(e.prefixItems.length,t.prefixItems.length);for(let r=0;r<n;r++){let o=e.prefixItems[r],a=t.prefixItems[r];o!==void 0&&a!==void 0?i.push(ce(o,a)):o!==void 0?i.push(o):a!==void 0&&i.push(a)}e.prefixItems=i}if(t.contains!==void 0&&(e.containsAll!==void 0?e.containsAll=[...e.containsAll,t.contains]:e.contains!==void 0?(e.containsAll=[e.contains,t.contains],delete e.contains):e.contains=t.contains),t.properties&&(e.properties=Re(e.properties??{},t.properties)),t.required&&(e.required=[...new Set([...e.required??[],...t.required])]),t.additionalProperties!==void 0&&(e.additionalProperties=t.additionalProperties),t.patternProperties&&(e.patternProperties={...e.patternProperties??{},...t.patternProperties}),t.minProperties!==void 0&&(e.minProperties=e.minProperties!==void 0?Math.max(e.minProperties,t.minProperties):t.minProperties),t.maxProperties!==void 0&&(e.maxProperties=e.maxProperties!==void 0?Math.min(e.maxProperties,t.maxProperties):t.maxProperties),t.const!==void 0&&(e.const=t.const),t.enum!==void 0)if(e.enum!==void 0){let i=new Set(t.enum.map(n=>JSON.stringify(n)));e.enum=e.enum.filter(n=>i.has(JSON.stringify(n)))}else e.enum=t.enum;t.$ref&&(e.$ref=t.$ref),t.$defs&&(e.$defs={...e.$defs??{},...t.$defs}),t.allOf&&(e.allOf=[...e.allOf??[],...t.allOf]),t.anyOf&&(e.anyOf=t.anyOf),t.oneOf&&(e.oneOf=t.oneOf)}function Te(e,t){let i=Array.isArray(e)?e:[e],n=Array.isArray(t)?t:[t],r=i.filter(o=>n.includes(o));return r.length===0?i[0]:r.length===1?r[0]:r}function Re(e,t){let i={...e};for(let[n,r]of Object.entries(t)){let o=e[n];o===void 0?i[n]=r:typeof o=="object"&&typeof r=="object"?i[n]=ce(o,r):i[n]=r}return i}var Q=new Set(["$schema","$id","$ref","$defs","$anchor","$dynamicRef","$dynamicAnchor","$vocabulary","$comment","type","enum","const","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","minLength","maxLength","pattern","format","contentEncoding","contentMediaType","contentSchema","items","prefixItems","contains","minItems","maxItems","uniqueItems","minContains","maxContains","properties","required","additionalProperties","patternProperties","minProperties","maxProperties","propertyNames","dependentRequired","dependentSchemas","allOf","anyOf","oneOf","not","if","then","else","faker","chance","jsonPath","template","default","examples","description","title","readOnly","writeOnly","deprecated"]);function he(e){return typeof e!="object"||e===null?!1:Object.keys(e).some(t=>Q.has(t))}function K(e,t){if(typeof t!="object"||t===null)return!1;let i=t;return i.const!==void 0?e===i.const:i.enum!==void 0?i.enum.some(n=>n===e):!1}function Ce(e){return typeof e=="boolean"?!e:typeof e!="object"||e===null?!1:e.not===!0||typeof e.not=="object"&&e.not!==null&&Object.keys(e.not).length===0}function Ye(e){if(e.properties)return e.properties;if(e.type==="object"||e.type===void 0){let t={},i=!1;for(let[n,r]of Object.entries(e))Q.has(n)||(he(r)?(t[n]=r,i=!0):(t[n]={const:r},i=!0));if(i)return t}return{}}function We(e,t){return e.required?e.required:e.properties===void 0&&Object.keys(t).length>0?Object.keys(t):[]}async function He(e,t){var y;let i=Ye(e),n=We(e,i);if(t.depth>=t.maxDepth){if(n.length===0)return{};let f={};for(let u of n){let h=i[u];if(h&&typeof h=="object"&&h!==null){let p=h;p.const!==void 0?f[u]=p.const:p.default!==void 0?f[u]=p.default:p.enum!==void 0&&p.enum.length>0?f[u]=p.enum[0]:f[u]=Ve(p.type)}else f[u]=null}return f}if(e.additionalProperties===!1){let f=Object.keys(i).length>0,u=e.patternProperties&&Object.keys(e.patternProperties).length>0,h=new Set(Object.keys(i)),p=[...new Set(n)].filter(m=>!h.has(m));if((e.minProperties??0)>0&&!f&&!u)throw Error(`missing properties for ${e.minProperties} in ${t.path}: additionalProperties is false but no properties or patternProperties defined`);if(p.length>0&&!u&&!f)throw Error(`missing properties for ${p.join(", ")} in ${t.path}: additionalProperties is false but required properties not defined in properties`)}let r=t.path==="/"?"/properties":`${t.path}/properties`,o={...t,depth:t.depth+1,path:r},a={},l=new Set,s=new Set(n),c=t.alwaysFakeOptionals??!1,g=t.fillProperties??!0,d=t.fixedProbabilities??!1,w=t.optionalsProbability??.5,j=Object.keys(i).filter(f=>!s.has(f)),k;if(d&&!c&&j.length>0){let f=Math.round(j.length*w);k=new Set(j.slice(0,f))}let E=f=>c?!0:k?k.has(f):t.random.bool(w);if(Object.keys(i).length>0)for(let[f,u]of Object.entries(i)){if(Ce(u))continue;l.add(f);let h=S(o,f),p=s.has(f),m=typeof u=="object"&&u!==null&&u.type==="object",b=u;if(e.patternProperties&&typeof u=="object"&&u!==null){let x=[];for(let[O,D]of Object.entries(e.patternProperties))try{new RegExp(O).test(f)&&x.push(D)}catch{}x.length>0&&(b=J([u,...x]))}if(p){let x=await v(b,h);x!==void 0&&(a[f]=x)}else if(E(f)){let x=await v(b,h);x!==void 0&&(a[f]=x)}else if(m&&!g){let x=u.required??[];if(x.length>0){let O={};for(let D of x){let we=(u.properties??{})[D]??{},Oe=S(h,D),B=await v(we,Oe);B!==void 0&&(O[D]=B)}a[f]=O}}}for(let f of s)if(!(a[f]!==void 0||l.has(f))){if(e.patternProperties){let u=[];for(let[h,p]of Object.entries(e.patternProperties))new RegExp(h).test(f)&&u.push(p);if(u.length>0){let h=u.length===1?u[0]:J(u),p=S(o,f),m=await v(h,p);m!==void 0&&(a[f]=m),l.add(f)}}if(!l.has(f)){let u=e.additionalProperties??!0;if(u!==!1){let h=S(o,f),p=await v(u===!0?{}:u,h);p!==void 0&&(a[f]=p),l.add(f)}}}if(e.dependencies){for(let[f,u]of Object.entries(e.dependencies))if(!(typeof u!="object"||u===null||Array.isArray(u))&&a[f]!==void 0&&!l.has(f+"_dep")){l.add(f+"_dep");let h=u.oneOf??u.anyOf??u.allOf??[u],p=null;for(let m of h){if(typeof m!="object"||m===null)continue;let{properties:b,not:x}=m;if(b&&b[f]){let O=b[f],D=a[f];if(K(D,O)){p=m;break}}if(x!=null&&x.properties){let O=x.properties[f];if(O){let D=a[f];if(!K(D,O)){p=m;break}}}}if(!p&&h.length>0&&typeof h[0]=="object"&&(p=h[0]),p!=null&&p.not){let m=p.not;if(m.required&&Array.isArray(m.required))for(let b of m.required)delete a[b]}if(p!=null&&p.required)for(let m of p.required){if(m===f||a[m]!==void 0)continue;let b=((y=p.properties)==null?void 0:y[m])??{type:"object"},x=S(o,m),O=await v(b,x);O!==void 0&&(a[m]=O)}if(p&&p.properties)for(let[m,b]of Object.entries(p.properties)){if(m===f)continue;let x=S(o,m),O=await v(b,x);O!==void 0&&(a[m]=O)}}}let P=e.minProperties??0,A=e.maxProperties;if(Object.keys(a).length<P){if(e.patternProperties&&Object.keys(e.patternProperties).length>0){let f=Object.entries(e.patternProperties),u=0,h=1e3;for(;Object.keys(a).length<P&&u<h;){u++;let[p,m]=t.random.pick(f),b=Ue(p,t);if(b&&!a[b]){let x=S(o,b),O=await v(m,x);O!==void 0&&(a[b]=O),l.add(b)}}}if(Object.keys(a).length<P){let f=e.additionalProperties,u=f===void 0||f===!0?{type:"string"}:f;if(u!==!1){let h=0,p=1e3;for(;Object.keys(a).length<P&&h<p;){h++;let m=`prop${t.random.int(0,99999)}`;if(!a[m]){let b=S(o,m),x=await v(u,b);x!==void 0&&(a[m]=x),l.add(m)}}}}if(Object.keys(a).length<P){let f=Object.keys(i).join(", ");throw Error(`properties '${f}' were not found while additionalProperties is false in ${t.path}`)}}if(A!==void 0&&Object.keys(a).length>A){let f=Object.keys(a).filter(u=>!s.has(u));for(t.random.shuffle(f);Object.keys(a).length>A&&f.length>0;){let u=f.pop();delete a[u]}}return t.pruneProperties&&t.pruneProperties.length>0&&C(a,t.pruneProperties),Be(a,i),a}function S(e,t){let i=Fe(t),n=e.outputPath==="/"?`/${i}`:`${e.outputPath}/${i}`;return{...e,path:`${e.path}/${t}`,outputPath:n}}function Fe(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Be(e,t){for(let[i,n]of Object.entries(t)){if(typeof n!="object"||n===null)continue;let r=n;if(r.template===void 0)continue;let o=r.template;if(typeof o!="string")continue;let a=o.replace(/#\{(\w+)\}/g,(l,s)=>{let c=e[s];return c!==void 0?String(c):""});e[i]=a}}function Ue(e,t){let i=e.match(/^\^([a-zA-Z]+)(\.\*|\(\?\:.*\))?/);if(i){let s=i[1],c=i[2];if(c===".*"||c!=null&&c.includes("?:")){let g=t.random.int(0,10),d="";for(let w=0;w<g;w++)d+=t.random.pick("abcdefghijklmnopqrstuvwxyz".split(""));return s+d}return s}let n=e.match(/(.*\*)?([a-zA-Z]+)\$$/);if(n){let s=n[2],c=t.random.int(1,10),g="";for(let d=0;d<c;d++)g+=t.random.pick("abcdefghijklmnopqrstuvwxyz".split(""));return g+s}let r=e.match(/^\^([a-zA-Z]+)\$$/);if(r)return r[1];let o=t.random.int(3,10),a="abcdefghijklmnopqrstuvwxyz",l="";for(let s=0;s<o;s++)l+=t.random.pick(a.split(""));try{if(new RegExp(e).test(l))return l}catch{}return null}function C(e,t){if(typeof e!="object"||e===null)return;if(Array.isArray(e)){for(let n of e)C(n,t);return}let i=e;for(let n of Object.keys(i))t.includes(n)?delete i[n]:C(i[n],t)}function Ve(e){switch(Array.isArray(e)?e[0]:e){case"string":return"";case"number":case"integer":return 0;case"boolean":return!1;case"null":return null;case"array":return[];case"object":return{};default:return null}}async function _e(e,t){var A;if(t.depth>=t.maxDepth){let y=e.minItems??0;return y>0?Array.from({length:y},()=>null):[]}if(t.refDepthReached){let y=e.minItems??0;return y>0?Array.from({length:y},()=>null):[]}if(e.items===!1&&(e.minItems??0)>0){let y=((A=e.prefixItems)==null?void 0:A.length)??0;if((e.minItems??0)>y)throw Error(`missing items for ${e.minItems} in ${t.path}: items is false but minItems (${e.minItems}) exceeds prefixItems count (${y})`)}let i=t.path==="/"?"/items":`${t.path}/items`,n={...t,depth:t.depth+1,path:i},r=[],o=t.refDepthMax,a=t.minItems??e.minItems??0,l=t.maxItems??e.maxItems??Math.max(a,t.maxDefaultItems);e.maxItems!==void 0&&l>e.maxItems&&(l=e.maxItems),e.minItems!==void 0&&a<e.minItems&&(a=e.minItems),l<a&&(e.maxItems!==void 0?a=l:l=a),t.alwaysFakeOptionals&&(l=Math.max(a,l));let s=e.uniqueItems?new Set:null,c=async(y,f)=>{let u=await v(y,f);if(u===void 0)return"omitted";if(s){let h=JSON.stringify(u);if(s.has(h)){for(let p=0;p<50;p++){if(u=await v(y,L(n,r.length)),u===void 0)continue;let m=JSON.stringify(u);if(!s.has(m))return s.add(m),r.push(u),"added"}return"failed"}s.add(h)}return r.push(u),"added"};if(e.prefixItems)for(let y=0;y<e.prefixItems.length&&r.length<l;y++){let f=L(n,y);if(await c(e.prefixItems[y],f)==="failed")break}let g;if(o!==void 0&&t.refDepth>=o-1){let y=e.minItems??0;return y>0?Array.from({length:y},()=>null):[]}let d=t.alwaysFakeOptionals??!1,w=t.fixedProbabilities??!1,j=t.optionalsProbability??.5;if(d)g=l;else if(w){let y=l-Math.max(a,r.length),f=Math.round(y*j);g=Math.max(a,r.length)+f}else g=t.random.int(Math.max(a,r.length),l);e.items;let k=e.prefixItems!==void 0,E=e.additionalItems!==void 0,P;if(k?E?P=e.additionalItems:e.items!==void 0&&(P=e.items):P=e.items,P!==!1&&P!==void 0){let y=P??{},f=0,u=Math.max(g*20,50);for(;r.length<g;){let h=await c(y,L(n,r.length));if(h==="added"){f=0;continue}if(f++,h==="failed"||f>=u)break}}if(e.contains){let y=e.minContains??1,f=e.maxContains??Math.max(y,1),u=t.random.int(y,f);for(let h=0;h<u;h++){let p=await v(e.contains,L(n,r.length));if(p!==void 0){if(s){let m=JSON.stringify(p);if(s.has(m)){let b=!1;for(let x=0;x<50;x++){if(p=await v(e.contains,L(n,r.length)),p===void 0)continue;let O=JSON.stringify(p);if(!s.has(O)){s.add(O),b=!0;break}}if(!b)continue}else s.add(m)}if(r.length<l){let m=t.random.int(0,r.length);r.splice(m,0,p)}else if(r.length>0){let m=t.random.int(0,r.length-1);r[m]=p}}}for(;r.length>l;)r.pop()}if(e.containsAll){let y=new Set;for(let f of e.containsAll){let u=await v(f,L(n,r.length));if(u!==void 0){if(s){let h=JSON.stringify(u);if(s.has(h)){let p=!1;for(let m=0;m<50;m++){if(u=await v(f,L(n,r.length)),u===void 0)continue;let b=JSON.stringify(u);if(!s.has(b)){s.add(b),p=!0;break}}if(!p)continue}else s.add(h)}if(r.length<l){let h=t.random.int(0,r.length);r.splice(h,0,u);let p=new Set;for(let m of y)p.add(m>=h?m+1:m);y.clear();for(let m of p)y.add(m);y.add(h)}else if(r.length>0){let h=Array.from({length:r.length},(p,m)=>m).filter(p=>!y.has(p));if(h.length>0){let p=h[t.random.int(0,h.length-1)];r[p]=u,y.add(p)}else r.push(u),y.add(r.length-1)}}}for(;r.length>l;)r.pop()}return e.uniqueItems&&r.length>0?ze(r,e,n,a,l,s):r}async function ze(e,t,i,n,r,o){let a=t.items??{},l=0,s=100;for(;e.length<n&&l<s;){l++;let c=await v(a,L(i,e.length));if(c===void 0)continue;let g=JSON.stringify(c);o.has(g)||(o.add(g),e.push(c))}for(;e.length>r;)e.pop();return e}function L(e,t){let i=e.outputPath==="/"?`/${t}`:`${e.outputPath}/${t}`;return{...e,path:`${e.path}/${t}`,outputPath:i}}function Ke(e={}){let t=e.cache??new Map,i=e.baseUrl;return async n=>{let{url:r,fragment:o}=$e(n,i),a;if(t.has(r))a=t.get(r);else{if(r.startsWith("http://")||r.startsWith("https://"))a=await Ge(r,e.fetch);else if(r.startsWith("file://")){let l=decodeURIComponent(r.slice(7));a=await G(l,e.readFile)}else a=await G(r,e.readFile);t.set(r,a)}return a}}function $e(e,t){let i=e.indexOf("#");if(i===-1)return{url:$(e,t),fragment:null};let n=e.slice(0,i),r=e.slice(i+1);return{url:$(n||"#",t),fragment:r||null}}function $(e,t){if(!t||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("file://"))return e==="#"?t||"#":e;if(t.startsWith("file://")){let i=t.slice(7),n=i.includes("/")?"/":"\\",r=i.lastIndexOf(n);return(r>=0?i.slice(0,r+1):"")+e}try{return new URL(e,t).href}catch{return e}}async function Ge(e,t){let i=t??globalThis.fetch;if(!i)throw Error(`Cannot fetch ${e}: fetch is not available. Provide a custom fetch function via the 'fetch' option.`);let n=await i(e);if(!n.ok)throw Error(`Failed to fetch schema from ${e}: ${n.status} ${n.statusText}`);if((n.headers.get("content-type")||"").includes("application/json"))return n.json();let r=await n.text();try{return JSON.parse(r)}catch(o){throw Error(`Failed to parse schema from ${e} as JSON: ${o}`)}}async function G(e,t){if(!t)throw Error(`Cannot read file ${e}: readFile is not available. Provide a custom readFile function via the 'readFile' option. In Node.js, import { readFile } from "node:fs/promises" and pass it as an option.`);let i=await t(e);return JSON.parse(i)}function ee(e,t){if(!t||t==="")return e;if(typeof e!="object"||e===null)throw Error(`Cannot resolve fragment "${t}" in non-object schema`);if(t.startsWith("/"))return et(e,t);throw Error(`Unsupported fragment type: ${t}. Only JSON pointers (starting with /) are supported.`)}function et(e,t){if(t===""||t==="/")return e;let i=t.slice(1).split("/"),n=e;for(let r of i){let o=r.replace(/~1/g,"/").replace(/~0/g,"~");if(typeof n!="object"||n===null)throw Error(`Cannot resolve JSON pointer "${t}": not an object at "${o}"`);if(Array.isArray(n)){let a=parseInt(o,10);if(isNaN(a)||a<0||a>=n.length)throw Error(`Cannot resolve JSON pointer "${t}": invalid array index "${o}"`);n=n[a]}else{if(!(o in n))throw Error(`Cannot resolve JSON pointer "${t}": property "${o}" not found`);n=n[o]}}return n}function tt(e){let t=new Map;if(typeof e=="boolean")return t;if(e.$id&&typeof e=="object"){let i=e,n=i.$id,{$id:r,...o}=i;t.set(n,o)}if(e.$defs)for(let[i,n]of Object.entries(e.$defs))t.set(`#/$defs/${i}`,n);return t}async function q(e,t){let i=e.$ref;if(!i)return{schema:e,ctx:t};let n=t.refDepth+1;if(t.refDepthMax!==void 0&&n>=t.refDepthMax)return{schema:{},ctx:{...t,refDepthReached:!0}};if(t.refStack.has(i)){if(t.refDepthMax!==void 0){if(t.refDepth>=t.refDepthMax)return{schema:{},ctx:{...t,refDepthReached:!0}}}else if(t.depth>=t.maxDepth)return{schema:{type:"null"},ctx:t}}let r,o;if(i.startsWith("#/")){if(r=t.refRegistry.get(i),r===void 0&&i.length>2){let d=t.refRegistry.get("#");if(d!==void 0&&typeof d=="object")try{r=ee(d,i.slice(1))}catch{}}r===void 0&&t.refResolver&&(r=await t.refResolver(i),r!==void 0&&t.refRegistry.set(i,r))}else if(i==="#")r=t.refRegistry.get("#")??{};else if(r=t.refRegistry.get(i),r===void 0&&t.refResolver){o=await t.refResolver(i);let d=i.indexOf("#");if(d!==-1){let w=i.slice(d+1);w?r=ee(o,w):r=o}else r=o;if(o&&typeof o=="object"&&o!==null){let w=o;if(w.$defs)for(let[j,k]of Object.entries(w.$defs))t.refRegistry.set(`#/$defs/${j}`,k)}}if(r===void 0)throw Error(`Unresolved $ref: ${i}`);let a=new Set(["description","title","$comment","readOnly","writeOnly","deprecated"]),{$ref:l,...s}=e,c=Object.fromEntries(Object.entries(s).filter(([d])=>!a.has(d)));Object.keys(c).length>0&&typeof r=="object"&&r!==null&&(r={...r,...c});let g={...t,refStack:new Set([...t.refStack,i]),refDepth:t.refDepth+1};return{schema:r,ctx:g}}function it(e,t){typeof e!="boolean"&&(t.set("#",e),Y(e,"#",t))}function Y(e,t,i){if(e.$id){let{$id:n,...r}=e;i.set(n,r)}if(e.$defs)for(let[n,r]of Object.entries(e.$defs)){let o=`${t}/$defs/${n}`;i.set(o,r),typeof r=="object"&&r!==null&&Y(r,o,i)}if(e.properties)for(let[n,r]of Object.entries(e.properties))typeof r=="object"&&r!==null&&Y(r,`${t}/properties/${n}`,i)}async function rt(e,t){return e.$ref?(await q(e,t)).schema:e}async function nt(e,t){let i=[];for(let n of e)if(typeof n=="object"&&n!==null&&"$ref"in n){let r=await rt(n,t);i.push(r)}else typeof n=="object"&&n!==null&&i.push(n);return i}async function ot(e,t){let{allOf:i,anyOf:n,oneOf:r,not:o,if:a,then:l,else:s,...c}=e;if(i){let g=await nt(i,t),d=J([c,...g]);return v(d,t)}if(r){let g=t.random.shuffle([...r]),d=c.required??[];for(let f of g){let u=typeof f=="object"&&f!==null?f:{};u.$ref&&(u=(await q(u,t)).schema);let h=u.required??[],p=[...new Set([...d,...h])],m={...c,required:p},b=J([m,u]),x={...t,optionalsProbability:0,alwaysFakeOptionals:!1};try{return await v(b,x)}catch{}}let w=r[0],j=typeof w=="object"&&w!==null?w:{};j.$ref&&(j=(await q(j,t)).schema);let k=j.required??[],E=[...new Set([...d,...k])],P={...c,required:E},A=J([P,j]),y={...t,optionalsProbability:0,alwaysFakeOptionals:!1};return v(A,y)}if(n){let g=t.random.shuffle([...n]);for(let j of g){let k=J([c,j]);try{return await v(k,t)}catch{}}let d=n[0],w=J([c,d]);return v(w,t)}return a!==void 0?at(c,a,l,s,t):o?lt(c,o,t):v(c,t)}async function at(e,t,i,n,r){if(i!==void 0){let o=J([e,t,i]);try{return await v(o,r)}catch{}}if(n!==void 0){let o=J([e,n]);try{return await v(o,r)}catch{}}return v(e,r)}async function lt(e,t,i){if(typeof t=="boolean"){if(t===!0)throw Error(`Cannot generate value for 'not: true' at ${i.path}`);return v(e,i)}if(t.type&&!t.enum&&!t.const){let n=Array.isArray(t.type)?t.type:[t.type],r=["string","number","integer","boolean","null","object","array"].filter(o=>!n.includes(o));if(r.length>0){let o=i.random.pick(r),a=J([e,{type:o}]);return v(a,i)}}if(t.const!==void 0||t.enum!==void 0){let n=t.enum??[t.const],r=new Set(n.map(o=>JSON.stringify(o)));for(let o=0;o<20;o++){let a=await v(e,i);if(!r.has(JSON.stringify(a)))return a}}return v(e,i)}class st{constructor(){U(this,"extensions",new Map)}define(t,i){this.extensions.set(t,{callback:i,context:{}})}has(t){return this.extensions.has(t)}reset(t){if(t){let i=this.extensions.get(t);i&&(i.context={},this.extensions.delete(t))}else this.extensions.clear()}keys(){return this.extensions.keys()}generate(t,i){let n=Object.keys(t);for(let r=n.length-1;r>=0;r--){let o=n[r],a=o.startsWith("x-")?o.slice(2):o,l=this.extensions.get(a);if(l){let s=t[o],c=l.callback.call(l.context,s,t,i);if(c!==void 0)return c}}}getContext(t){var i;return(i=this.extensions.get(t))==null?void 0:i.context}}var F=new st;function ft(e,t){F.define(e,t)}function ut(e){F.reset(e)}function pt(e,t){return F.generate(e,t)}var ct=["string","number","integer","boolean","null","object","array"];function te(e,t,i){if(e.faker!==void 0&&e.chance!==void 0)throw Error(`ambiguous generator: both faker and chance are defined in ${t.path}`);if(e.faker!==void 0)try{let n=mt(e.faker,t),r=re(n,i??e.type,t.path);return typeof r=="string"&&e.format?ie(r,e.format,t):r}catch{}if(e.chance!==void 0)try{let n=ht(e.chance,t),r=re(n,i??e.type,t.path);return typeof r=="string"&&e.format?ie(r,e.format,t):r}catch{}}function ie(e,t,i){if(t==="date"){let n=typeof e=="string"?new Date(e):e;if(n instanceof Date&&!isNaN(n.getTime())){let r=n.getFullYear(),o=I(n.getMonth()+1),a=I(n.getDate());return`${r}-${o}-${a}`}if(typeof e=="string"){let r=Date.parse(e);if(!isNaN(r)){let o=new Date(r),a=o.getFullYear(),l=I(o.getMonth()+1),s=I(o.getDate());return`${a}-${l}-${s}`}}}if(t==="date-time"){let n=typeof e=="string"?new Date(e):e;if(n instanceof Date&&!isNaN(n.getTime()))return n.toISOString();if(typeof e=="string"&&Date.parse(e))return new Date(e).toISOString()}return e}function re(e,t,i){if(t===void 0)return e;let n=Array.isArray(t)?t[0]:t;switch(n){case"string":return e===null?"null":e===void 0?"undefined":String(e);case"number":case"integer":let r=Number(e);return n==="integer"?Math.floor(r):r;case"boolean":return!!e;case"null":return null;default:return e}}function mt(e,t){var a;if(!((a=t.extensions)!=null&&a.faker)){let l=typeof e=="string"?e:JSON.stringify(e);throw Error(`cannot resolve faker-generator for ${l} in ${t.path}`)}let i,n;if(typeof e=="object"&&e!==null){let l=e,s=Object.keys(l);if(s.length>0)i=s[0],n=l[i];else throw Error(`cannot resolve faker-generator for ${JSON.stringify(e)} in ${t.path}`)}else i=e;let r=i.split("."),o=t.extensions.faker;for(let l of r)try{o=o[l]}catch{throw Error(`failed to resolve .${l} (${i})`)}if(typeof o=="function")return n?o(...n):o();throw Error(`cannot resolve faker-generator for ${i} in ${t.path}`)}function ht(e,t){var i;if(!((i=t.extensions)!=null&&i.chance)){let n=typeof e=="string"?e:Object.keys(e)[0];throw Error(`cannot resolve chance-generator for ${n} in ${t.path}`)}if(typeof e=="string"){let n=t.extensions.chance[e];if(typeof n=="function")return n.call(t.extensions.chance);throw Error(`cannot resolve chance-generator for ${e} in ${t.path}`)}if(typeof e=="object"&&e!==null){let n=e,r=Object.keys(n)[0],o=n[r],a=t.extensions.chance[r];if(typeof a=="function")return o?a.call(t.extensions.chance,o):a.call(t.extensions.chance)}throw Error(`cannot resolve chance-generator in ${t.path}`)}function dt(e,t){let i=e.path==="/"?`/${t}`:`${e.path}/${t}`;return{...e,depth:e.depth+1,path:i,refDepthReached:e.refDepthReached}}async function M(e,t,i){return i.outputTransform?i.outputTransform(e,t,i.outputPath):e}async function v(e,t){if(e===!0)return v({},t);if(e===!1)throw Error(`Cannot generate value for 'false' schema at ${t.path}`);if(t.propAliases&&typeof e=="object"&&e!==null){let o=e,a=null;for(let[l,s]of Object.entries(t.propAliases))l in o&&!(s in o)&&(a||(a={...o}),a[s]=a[l],delete a[l]);a&&(e=a)}let i;if(Array.isArray(e.type)){let o=e.type;i=t.random.pick(o);let a={...t,resolvedType:i},l=te(e,a,i);if(l!==void 0)return typeof l=="string"&&a.maxLength!==void 0&&l.length>a.maxLength?M(l.slice(0,a.maxLength),e,a):M(l,e,a)}else{let o=te(e,t,i);if(o!==void 0)return typeof o=="string"&&t.maxLength!==void 0&&o.length>t.maxLength?M(o.slice(0,t.maxLength),e,t):M(o,e,t)}let n=pt(e,t);if(n!==void 0)return M(n,e,t);if(e.$ref){let o=await q(e,t);return v(o.schema,dt(o.ctx,"$ref"))}if(e.allOf||e.anyOf||e.oneOf||e.not||e.if)return ot(e,t);if(e.const!==void 0)return M(z(e,t),e,t);if(t.useDefaultValue&&e.default!==void 0)return M(e.default,e,t);if(e.enum!==void 0)return M(z(e,t),e,t);if(t.useExamplesValue){if(Array.isArray(e.examples)&&e.examples.length>0)return M(t.random.pick(e.examples),e,t);if(e.example!==void 0)return M(e.example,e,t)}let r=gt(e,t);if(r===null){if(t.failOnInvalidTypes===!1){if(t.defaultInvalidTypeProduct!==void 0){let o=t.defaultInvalidTypeProduct;return typeof o=="string"?vt(o):o}return null}throw Error(`unknown primitive ${e.type} in ${t.path}/type`)}switch(r){case"null":return M(ke(),e,t);case"boolean":return M(Ie(t),e,t);case"number":return M(fe(e,t),e,t);case"integer":return M(De(e,t),e,t);case"string":return M(qe(e,t),e,t);case"object":return M(await He(e,t),e,t);case"array":return M(await _e(e,t),e,t);default:throw Error(`Unknown type: ${r} at ${t.path}`)}}function gt(e,t){return t.resolvedType!==void 0?t.resolvedType:typeof e.type=="string"?["string","number","integer","boolean","null","object","array"].includes(e.type)?e.type:null:Array.isArray(e.type)?t.random.pick(e.type):e.properties||e.required||e.additionalProperties!==void 0||e.patternProperties||e.minProperties!==void 0||e.maxProperties!==void 0||yt(e)?"object":e.items||e.prefixItems||e.contains||e.minItems!==void 0||e.maxItems!==void 0||e.uniqueItems?"array":e.minimum!==void 0||e.maximum!==void 0||e.exclusiveMinimum!==void 0||e.exclusiveMaximum!==void 0||e.multipleOf!==void 0?"number":e.minLength!==void 0||e.maxLength!==void 0||e.pattern||e.format||e.faker!==void 0||e.chance!==void 0?"string":t.random.pick(ct)}function yt(e){if(e.properties||e.type==="object"||e.type==="array")return!1;for(let t of Object.keys(e)){if(Q.has(t))continue;let i=e[t];if(typeof i=="object"&&i!==null&&!Array.isArray(i))return!0}return!1}function vt(e,t){switch(e){case"string":return"";case"number":case"integer":return 0;case"boolean":return!1;case"null":return null;case"object":return{};case"array":return[];default:return null}}function xt(e){let t=de(e),i=ge(e);return`${t}T${i}`}function de(e){let t=e.int(2e3,2030),i=e.int(1,12),n=Ne(t,i),r=e.int(1,n);return`${t}-${I(i)}-${I(r)}`}function ge(e){let t=e.int(0,23),i=e.int(0,59),n=e.int(0,59);return`${I(t)}:${I(i)}:${I(n)}Z`}var bt=["alice","bob","charlie","dave","eve","frank","grace","heidi"],wt=["example.com","test.org","demo.net","sample.io"];function ne(e){let t=e.pick(bt),i=e.int(1,999),n=e.pick(wt);return`${t}${i}@${n}`}var Ot=["https"],jt=["example.com","test.org","demo.net"],Mt=["api","v1","users","items","data","resource"];function X(e){let t=e.pick(Ot),i=e.pick(jt),n=e.int(1,3),r=[];for(let o=0;o<n;o++)r.push(e.pick(Mt));return`${t}://${i}/${r.join("/")}`}var Pt=["alpha","beta","gamma","delta","echo","fox","golf","hotel"],kt=["com","org","net","io","dev"];function oe(e){let t=e.int(1,3),i=[];for(let n=0;n<t;n++)i.push(e.pick(Pt));return i.push(e.pick(kt)),i.join(".")}function It(e){return`${e.int(1,254)}.${e.int(0,255)}.${e.int(0,255)}.${e.int(1,254)}`}function Jt(e){let t=[];for(let i=0;i<8;i++)t.push(e.int(0,65535).toString(16));return t.join(":")}function Dt(e){let t=i=>{let n="";for(let r=0;r<i;r++)n+=e.int(0,15).toString(16);return n};return`${t(8)}-${t(4)}-4${t(3)}-${["8","9","a","b"][e.int(0,3)]}${t(3)}-${t(12)}`}var At=["foo","bar","baz","items","0","1","2","name","value"];function ae(e){let t=e.int(1,4),i=[];for(let n=0;n<t;n++)i.push(e.pick(At));return"/"+i.join("/")}function St(e){let t=["P"],i=e.bool(),n=e.bool();return i&&(e.bool()&&t.push(`${e.int(0,100)}Y`),e.bool()&&t.push(`${e.int(0,12)}M`),e.bool()&&t.push(`${e.int(0,30)}D`)),n&&(t.push("T"),e.bool()&&t.push(`${e.int(0,23)}H`),e.bool()&&t.push(`${e.int(0,59)}M`),e.bool()&&t.push(`${e.int(0,59)}S`)),(t.length===1||t.length===2&&t[1]==="T")&&t.push("0D"),t.join("")}var Lt=new Map([["date-time",xt],["date",de],["time",ge],["duration",St],["email",ne],["idn-email",ne],["uri",X],["uri-reference",X],["iri",X],["iri-reference",X],["hostname",oe],["idn-hostname",oe],["ipv4",It],["ipv6",Jt],["uuid",Dt],["json-pointer",ae],["relative-json-pointer",e=>`${e.int(0,5)}${ae(e)}`]]);function ye(e){let t=new Map(Lt);if(e)for(let[i,n]of Object.entries(e))t.set(i,n);return t}function Et(e,t,i){i.set(e,t)}function Zt(e,t){if(!e.startsWith("$"))throw Error(`Invalid JSONPath: ${e} (must start with $)`);let i=e.slice(1).split(/\.|\[(\d+|\*)\]/).filter(Boolean),n=[t];for(let r of i){if(r==="")continue;let o=[];for(let a of n)if(a!=null)if(r==="*")Array.isArray(a)&&o.push(...a);else if(/^\d+$/.test(r)){let l=parseInt(r,10);Array.isArray(a)&&l<a.length&&o.push(a[l])}else r===""?W(a,o):typeof a=="object"&&a!==null&&r in a&&o.push(a[r]);n=o}return n}function W(e,t){if(e!=null){if(Array.isArray(e))for(let i of e)t.push(i),W(i,t);else if(typeof e=="object")for(let i of Object.values(e))t.push(i),W(i,t)}}function Nt(e){if(e.properties)return e.properties;if(e.type==="object"||e.type===void 0){let t={},i=!1;for(let[n,r]of Object.entries(e))Q.has(n)||(he(r)?(t[n]=r,i=!0):(t[n]={const:r},i=!0));if(i)return t}return{}}async function H(e,t,i,n){if(!i.resolveJsonPath)return e;let r=n??e;if(t===!0||t===!1||t.$ref)return e;let o=t;if(o.allOf||o.anyOf||o.oneOf)return e;if(typeof e=="object"&&e!==null&&!Array.isArray(e)){let a={...e},l=Nt(o);for(let[s,c]of Object.entries(l))if(s in a){let g=a[s];if(typeof c=="object"&&c!==null&&"jsonPath"in c&&typeof c.jsonPath=="string"){let d=Zt(c.jsonPath,r);d.length>0&&(a[s]=i.random.pick(d))}else{let d=await H(g,c,i,r);a[s]=d}}return a}if(Array.isArray(e)&&o.items){let a=[];for(let l of e){let s=await H(l,o.items,i,r);a.push(s)}return a}return e}var ve=ye(),le=new Set(["https://json-schema.org/draft/2020-12/schema","https://json-schema.org/draft/2019-09/schema"]);async function T(e,t){if((t==null?void 0:t.validateSchemaVersion)===!0&&!(t!=null&&t.propAliases)&&typeof e=="object"&&e!==null&&"$schema"in e){let d=e.$schema;if(typeof d=="string"&&!le.has(d))throw Error(`Unsupported JSON Schema version: ${d}. Supported versions: ${[...le].join(", ")}`)}let i=Wt(t),n=se((t==null?void 0:t.seed)??1),r=i.propAliases?Yt(e,i.propAliases):e,o=tt(r);it(r,o);let a=i.formats?ye(i.formats):new Map(ve),l=i.refDepthMin??i.refDepth,s=i.refDepthMax??i.refDepth;if(l!==void 0&&s!==void 0&&l>s)throw Error(`refDepthMin (${l}) cannot be greater than refDepthMax (${s})`);let c={random:n,maxDepth:i.maxDepth??(s?s+20:5),maxDefaultItems:i.maxDefaultItems??3,optionalsProbability:i.optionalsProbability??.5,depth:0,refRegistry:o,refStack:new Set,formatRegistry:a,refResolver:i.refResolver,minItems:i.minItems,maxItems:i.maxItems,minLength:i.minLength,maxLength:i.maxLength,useDefaultValue:i.useDefaultValue,path:"/",outputPath:"/",alwaysFakeOptionals:i.alwaysFakeOptionals,fixedProbabilities:i.fixedProbabilities,fillProperties:i.fillProperties,extensions:i.extensions,resolveJsonPath:i.resolveJsonPath,autoIncrementCounters:new Map,refDepth:0,refDepthMin:l,refDepthMax:s,useExamplesValue:i.useExamplesValue,pruneProperties:i.pruneProperties,failOnInvalidTypes:i.failOnInvalidTypes,defaultInvalidTypeProduct:i.defaultInvalidTypeProduct,minDateTime:i.minDateTime,maxDateTime:i.maxDateTime,propAliases:i.propAliases,outputTransform:i.outputTransform},g=await v(r,c);return i.resolveJsonPath?H(g,e,c,g):g}function Xt(e){let t={...e},i=0;return{generate(n){let r=(t.seed??1)+i++;return T(n,{...t,seed:r})}}}function qt(e,t){Et(e,t,ve)}function Qt(e,t){ft(e,t)}function Tt(e){ut(e)}async function xe(e,t){let i=await T(e,t),n=(t==null?void 0:t.pretty)!==!1?{space:2,...t==null?void 0:t.jsonStringifyOptions}:{space:0,...t==null?void 0:t.jsonStringifyOptions};return JSON.stringify(i,n.replacer,n.space)}function Rt(e){let t={...e},i=0;return{generate(n){let r=(t.seed??1)+i++;return xe(n,{...t,seed:r})}}}async function be(e,t){var o;let i=(t==null?void 0:t.yaml)??((o=t==null?void 0:t.extensions)==null?void 0:o.yaml);if(!i)throw Error("YAML support requires 'yaml' package. Provide via options.extensions.yaml or options.yaml.");let n=await T(e,t),r=(t==null?void 0:t.pretty)!==!1?{indent:2,lineWidth:0}:{};return i.stringify(n,r)}function Ct(e){let t={...e},i=0;return{generate(n){let r=(t.seed??1)+i++;return be(n,{...t,seed:r})}}}function Yt(e,t){if(typeof e!="object"||e===null)return e;let i=e,n=null;for(let[r,o]of Object.entries(t))r in i&&!(o in i)&&(n||(n={...i}),n[o]=n[r],delete n[r]);return n??e}function Wt(e){if(!e)return{};let t=e,i={...e};return t.requiredOnly===!0&&i.optionalsProbability===void 0&&(i={...i,optionalsProbability:0,alwaysFakeOptionals:!1}),t.ignoreProperties&&t.ignoreProperties.length>0&&(i={...i,outputTransform:Ht(i.outputTransform,Ft(t.ignoreProperties))}),i}function Ht(e,t){return e?t?async(i,n,r)=>{let o=await e(i,n,r);return t(o,n,r)}:e:t}function Ft(e){return(t,i,n)=>{if(n==="/")return t;let r=Bt(n.slice(n.lastIndexOf("/")+1));return e.some(o=>typeof o=="string"?o===r:o instanceof RegExp?o.test(r):o(i))?void 0:t}}function Bt(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}exports.createGenerator=Xt;exports.createJsonGenerator=Rt;exports.createRemoteResolver=Ke;exports.createYamlGenerator=Ct;exports.define=Qt;exports.generate=T;exports.generateJson=xe;exports.generateYaml=be;exports.registerFormat=qt;exports.reset=Tt;
@@ -5,7 +5,7 @@ var Vp = (xi) => {
5
5
  var bd = (xi, Oi, Ai) => Oi in xi ? gd(xi, Oi, { enumerable: !0, configurable: !0, writable: !0, value: Ai }) : xi[Oi] = Ai;
6
6
  var Np = (xi, Oi, Ai) => bd(xi, typeof Oi != "symbol" ? Oi + "" : Oi, Ai), Fp = (xi, Oi, Ai) => Oi.has(xi) || Vp("Cannot " + Ai);
7
7
  var ir = (xi, Oi, Ai) => (Fp(xi, Oi, "read from private field"), Ai ? Ai.call(xi) : Oi.get(xi)), so = (xi, Oi, Ai) => Oi.has(xi) ? Vp("Cannot add the same private member more than once") : Oi instanceof WeakSet ? Oi.add(xi) : Oi.set(xi, Ai), ca = (xi, Oi, Ai, sn) => (Fp(xi, Oi, "write to private field"), sn ? sn.call(xi, Ai) : Oi.set(xi, Ai), Ai);
8
- import { g as vd } from "./index-BqogUhNO.js";
8
+ import { g as vd } from "./index-DwzxTmOd.js";
9
9
  function jd(xi, Oi) {
10
10
  for (var Ai = 0; Ai < Oi.length; Ai++) {
11
11
  const sn = Oi[Ai];
package/dist/index.d.ts CHANGED
@@ -2,7 +2,10 @@ export { default, default as AsyncAPI } from './containers/AsyncAPI/AsyncAPI';
2
2
  export type { IAsyncAPIProps } from './containers/AsyncAPI/AsyncAPI';
3
3
  export { default as OpenAPI } from './containers/OpenAPI/OpenAPI';
4
4
  export type { IOpenAPIProps } from './containers/OpenAPI/OpenAPI';
5
- export type { ConfigInterface } from './config';
5
+ export type { ConfigInterface, MarkdownConfig, MarkdownTarget, MarkdownUrlResolver } from './config';
6
+ export { documentToLlmsTxt, documentToMarkdown, listDocumentTargets, targetSlug } from './helpers/llmsTxt';
7
+ export type { DocumentTarget, LlmsTxtLink, LlmsTxtOptions } from './helpers/llmsTxt';
8
+ export { asyncApiOperationToMarkdown, asyncApiToMarkdown, openApiEndpointToMarkdown, openApiToMarkdown, } from './helpers/toMarkdown';
6
9
  export { defaultConfig } from './config';
7
10
  export type { AsyncAPIDocumentData } from './types/schema';
8
11
  export type { OpenAPIDocumentData } from './types/openapi';