@powerhousedao/workflow 6.2.3-dev.88 → 6.2.3-dev.89

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 (108) hide show
  1. package/dist/browser/{BlockSelector-BKAJwJ4Y.js → BlockSelector-DFzzAWXh.js} +65 -7
  2. package/dist/browser/BlockSelector-DFzzAWXh.js.map +1 -0
  3. package/dist/browser/{connection-form-DltdMa8F.js → connection-form-B6zpGmAm.js} +3 -3
  4. package/dist/browser/{connection-form-DltdMa8F.js.map → connection-form-B6zpGmAm.js.map} +1 -1
  5. package/dist/browser/{data-tree-DAw8e0j8.js → data-tree-DKS0EQys.js} +2 -2
  6. package/dist/browser/{data-tree-DAw8e0j8.js.map → data-tree-DKS0EQys.js.map} +1 -1
  7. package/dist/browser/{editor-Dl6lzxkM.js → editor-Yt-_V04R.js} +207 -58
  8. package/dist/browser/editor-Yt-_V04R.js.map +1 -0
  9. package/dist/browser/{editor-CZLe6CAF.js → editor-bHCkW_XB.js} +4 -4
  10. package/dist/browser/{editor-CZLe6CAF.js.map → editor-bHCkW_XB.js.map} +1 -1
  11. package/dist/browser/{editor--J61vLSC.js → editor-gCkAwv09.js} +64 -132
  12. package/dist/browser/editor-gCkAwv09.js.map +1 -0
  13. package/dist/browser/editors/connection-editor/module.js +1 -1
  14. package/dist/browser/editors/runtime/index.js +1 -1
  15. package/dist/browser/editors/workflow-editor/module.js +1 -1
  16. package/dist/browser/editors/workflow-studio/module.js +1 -1
  17. package/dist/browser/index.js +2 -1
  18. package/dist/browser/index.js.map +1 -1
  19. package/dist/browser/{runtime-queries-D81Ghpok.js → runtime-queries-C5bqAgQy.js} +84 -13
  20. package/dist/browser/runtime-queries-C5bqAgQy.js.map +1 -0
  21. package/dist/browser/{trigger-text-BSVi5oGZ.js → trigger-text-BfIu-QcC.js} +176 -11
  22. package/dist/browser/trigger-text-BfIu-QcC.js.map +1 -0
  23. package/dist/node/{BlockSelector-DnTRF-C7.mjs → BlockSelector-Cia1Rpwz.mjs} +64 -6
  24. package/dist/node/BlockSelector-Cia1Rpwz.mjs.map +1 -0
  25. package/dist/node/{connection-form-DwSHfIRw.mjs → connection-form-CJFKPwfg.mjs} +3 -3
  26. package/dist/node/{connection-form-DwSHfIRw.mjs.map → connection-form-CJFKPwfg.mjs.map} +1 -1
  27. package/dist/node/{data-tree-uSJU9Ost.mjs → data-tree-D9jdFsaX.mjs} +2 -2
  28. package/dist/node/{data-tree-uSJU9Ost.mjs.map → data-tree-D9jdFsaX.mjs.map} +1 -1
  29. package/dist/node/{editor-B4ZwM3pR.mjs → editor-CwOjO82y.mjs} +63 -131
  30. package/dist/node/editor-CwOjO82y.mjs.map +1 -0
  31. package/dist/node/{editor-_4XHbqGl.mjs → editor-NMRVprgI.mjs} +206 -57
  32. package/dist/node/editor-NMRVprgI.mjs.map +1 -0
  33. package/dist/node/{editor-cXi5dIsd.mjs → editor-_c6UDRAN.mjs} +4 -4
  34. package/dist/node/{editor-cXi5dIsd.mjs.map → editor-_c6UDRAN.mjs.map} +1 -1
  35. package/dist/node/editors/connection-editor/module.mjs +1 -1
  36. package/dist/node/editors/runtime/index.mjs +1 -1
  37. package/dist/node/editors/workflow-editor/module.mjs +1 -1
  38. package/dist/node/editors/workflow-studio/module.mjs +1 -1
  39. package/dist/node/index.mjs +2 -1
  40. package/dist/node/index.mjs.map +1 -1
  41. package/dist/node/pieces/ai/descriptor.json +70 -1
  42. package/dist/node/pieces/ai/index.mjs +125 -125
  43. package/dist/node/pieces/ai/package.json +1 -1
  44. package/dist/node/pieces/reactor/descriptor.json +35 -1
  45. package/dist/node/pieces/reactor/index.mjs +39 -39
  46. package/dist/node/pieces/reactor/package.json +1 -1
  47. package/dist/node/{runtime-queries-VXJsWno5.mjs → runtime-queries-Ck5OoWdy.mjs} +137 -12
  48. package/dist/node/runtime-queries-Ck5OoWdy.mjs.map +1 -0
  49. package/dist/node/{trigger-text-BBP7QVLj.mjs → trigger-text-T2D0a2Br.mjs} +175 -10
  50. package/dist/node/trigger-text-T2D0a2Br.mjs.map +1 -0
  51. package/dist/powerhouse.manifest.json +2 -2
  52. package/dist/style.css +1 -1
  53. package/dist/types/ai/workflow-tools.d.ts.map +1 -1
  54. package/dist/types/editors/shared/icons.d.ts +4 -0
  55. package/dist/types/editors/shared/icons.d.ts.map +1 -1
  56. package/dist/types/editors/workflow-editor/editor.d.ts.map +1 -1
  57. package/dist/types/editors/workflow-editor/runtime-client.d.ts +5 -1
  58. package/dist/types/editors/workflow-editor/runtime-client.d.ts.map +1 -1
  59. package/dist/types/editors/workflow-editor/ui/BlockSelector.d.ts.map +1 -1
  60. package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts +1 -0
  61. package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts.map +1 -1
  62. package/dist/types/editors/workflow-editor/ui/StepPanel.d.ts.map +1 -1
  63. package/dist/types/editors/workflow-editor/ui/ap-edge.d.ts +1 -0
  64. package/dist/types/editors/workflow-editor/ui/ap-edge.d.ts.map +1 -1
  65. package/dist/types/editors/workflow-editor/ui/ap-layout.d.ts.map +1 -1
  66. package/dist/types/editors/workflow-editor/ui/ap-nodes.d.ts +4 -0
  67. package/dist/types/editors/workflow-editor/ui/ap-nodes.d.ts.map +1 -1
  68. package/dist/types/editors/workflow-editor/ui/block-meta.d.ts +3 -0
  69. package/dist/types/editors/workflow-editor/ui/block-meta.d.ts.map +1 -1
  70. package/dist/types/editors/workflow-editor/ui/blocks.d.ts +8 -0
  71. package/dist/types/editors/workflow-editor/ui/blocks.d.ts.map +1 -1
  72. package/dist/types/editors/workflow-editor/ui/canvas-menu.d.ts.map +1 -1
  73. package/dist/types/editors/workflow-editor/ui/flow-control.test.d.ts +2 -0
  74. package/dist/types/editors/workflow-editor/ui/flow-control.test.d.ts.map +1 -0
  75. package/dist/types/editors/workflow-editor/ui/prop-layout.d.ts +1 -0
  76. package/dist/types/editors/workflow-editor/ui/prop-layout.d.ts.map +1 -1
  77. package/dist/types/editors/workflow-editor/ui/prop-layout.test.d.ts +2 -0
  78. package/dist/types/editors/workflow-editor/ui/prop-layout.test.d.ts.map +1 -0
  79. package/dist/types/editors/workflow-editor/ui/trigger-text.d.ts.map +1 -1
  80. package/dist/types/editors/workflow-editor/ui/use-validity.d.ts.map +1 -1
  81. package/dist/types/editors/workflow-editor/ui/validation.d.ts +4 -1
  82. package/dist/types/editors/workflow-editor/ui/validation.d.ts.map +1 -1
  83. package/dist/types/editors/workflow-studio/components/RunsTable.d.ts +4 -1
  84. package/dist/types/editors/workflow-studio/components/RunsTable.d.ts.map +1 -1
  85. package/dist/types/editors/workflow-studio/components/Waitpoints.d.ts +9 -1
  86. package/dist/types/editors/workflow-studio/components/Waitpoints.d.ts.map +1 -1
  87. package/dist/types/editors/workflow-studio/components/WorkflowGraph.d.ts.map +1 -1
  88. package/dist/types/editors/workflow-studio/components/graph-layout.d.ts +1 -0
  89. package/dist/types/editors/workflow-studio/components/graph-layout.d.ts.map +1 -1
  90. package/dist/types/editors/workflow-studio/components/tips.d.ts.map +1 -1
  91. package/dist/types/pieces/ai/lib/actions/decide-on-documents.d.ts.map +1 -1
  92. package/dist/types/pieces/ai/lib/actions/extract.d.ts.map +1 -1
  93. package/dist/types/pieces/ai/lib/actions/propose-actions.d.ts.map +1 -1
  94. package/dist/types/pieces/ai/lib/actions/summarize.d.ts.map +1 -1
  95. package/dist/types/pieces/reactor/lib/actions/document-find.d.ts.map +1 -1
  96. package/dist/types/test/ui/flow-control.spec.d.ts +2 -0
  97. package/dist/types/test/ui/flow-control.spec.d.ts.map +1 -0
  98. package/package.json +9 -9
  99. package/dist/browser/BlockSelector-BKAJwJ4Y.js.map +0 -1
  100. package/dist/browser/editor--J61vLSC.js.map +0 -1
  101. package/dist/browser/editor-Dl6lzxkM.js.map +0 -1
  102. package/dist/browser/runtime-queries-D81Ghpok.js.map +0 -1
  103. package/dist/browser/trigger-text-BSVi5oGZ.js.map +0 -1
  104. package/dist/node/BlockSelector-DnTRF-C7.mjs.map +0 -1
  105. package/dist/node/editor-B4ZwM3pR.mjs.map +0 -1
  106. package/dist/node/editor-_4XHbqGl.mjs.map +0 -1
  107. package/dist/node/runtime-queries-VXJsWno5.mjs.map +0 -1
  108. package/dist/node/trigger-text-BBP7QVLj.mjs.map +0 -1
@@ -1,37 +1,37 @@
1
- import e from"crypto";var t=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);function n(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function r(e,t){return typeof t==`bigint`?t.toString():t}var i=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function a(e){return new i(e)}function o(e){return e==null}function s(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function c(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}const l=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function u(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function d(e){if(u(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return u(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}const f=/* @__PURE__*/ new Set([`string`,`number`,`symbol`]);function p(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function m(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function h(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function g(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}function _(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function v(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function y(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function b(e){return typeof e==`string`?e:e?.message}function x(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function S(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:b(e.inst?._zod.def?.error?.(e))??b(a?.(e))??b(t?.error?.(e))??b(n.customError?.(e))??b(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}const ee=/[\uD800-\uDBFF]/;function te(e){let t=e.length;if(!ee.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function ne(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function re(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function ie(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):se(e,n,r.value)}}function ae(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function oe(e,t,n){return ae(e,t,n,!1)}function se(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:ae(this,t,n.bind(this))},set(e){ae(this,t,e)}})}function ce(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}let le,C=!1;const ue={configurable:!0,get(){C=!0}};function w(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&le!==e._zod){le=void 0;return}le=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,ue);let e=C;C=!1;try{let r=n(this);return C?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),C||=e,r}catch(n){throw delete this[t],C||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function de(e,t,n,r){let i=ce(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var fe;const pe={value:void 0,enumerable:!1};let me=`captureStackTrace`in Error?Error:null;function he(e){let t=me;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return me=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function T(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=/* @__PURE__ */ new Set}a.prototype=i;let o=n,s=o&&/* @__PURE__ */ new WeakSet;function c(n,r){if(!n._zod){pe.value=new a(r);try{Object.defineProperty(n,"_zod",pe)}finally{pe.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),ie(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?he(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var E=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ge=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(fe=globalThis).__zod_globalConfig??(fe.__zod_globalConfig={});const D=globalThis.__zod_globalConfig;function O(e){return e&&Object.assign(D,e),D}function _e(){let e=this._zod;return e.message??=JSON.stringify(e.def,r,2),e.message}function ve(e){this._zod.message=e}const ye={get:_e,set:ve,enumerable:!0,configurable:!0},be={value:void 0,enumerable:!1},xe=/* @__PURE__ */ new WeakSet([Object.prototype,Error.prototype]),Se=(e,t)=>{e.name=`$ZodError`,be.value=t,Object.defineProperty(e,"issues",be),be.value=void 0,Object.defineProperty(e,"message",ye);let n=Object.getPrototypeOf(e);xe.has(n)||(xe.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))};T(`$ZodError`,Se);const Ce=T(`$ZodError`,Se,void 0,{Parent:Error}),we=/* @__PURE__*/ (e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new E;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>S(e,o,O())));throw l(n,a?.callee??t),n}return s.value};return t})(Ce),Te=/* @__PURE__*/ (e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>S(e,o,O())));throw l(n,a?.callee??t),n}return s.value};return t})(Ce),Ee=/* @__PURE__*/ (e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new E;return a.issues.length?De(e,a.issues,i):{success:!0,data:a.value}})(Ce);function De(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>S(e,n,O()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}const Oe=/* @__PURE__*/ (e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?De(e,a.issues,i):{success:!0,data:a.value}})(Ce);function ke(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Ae(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${ke({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${ke({precision:e.precision})}`:n;return RegExp(`^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:${r})$`)}const je=/^[\s\S]{0,}$/,Me=/^-?\d+(?:\.\d+)?$/,Ne=/^(?:true|false)$/i,Pe=/*@__PURE__*/ T(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Fe=e=>{let t=e.value;return!o(t)&&t.length!==void 0},Ie=/*@__PURE__*/ T(`$ZodCheckMinLength`,(e,t)=>{var n;Pe.init(e,t),(n=e._zod.def).when??(n.when=Fe),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?te(r):i)>=t.minimum)return;let a=ne(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Le=/*@__PURE__*/ T(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Pe.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Re=/*@__PURE__*/ T(`$ZodCheckRegex`,(e,t)=>{Le.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),ze={major:4,minor:6,patch:5},k=/*@__PURE__*/ T(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ze;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=_(t),a;for(let o of n){if(o._zod.def.when){if(v(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new E;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(x(t.issues,n,e),i||=_(t,n))});else{if(t.issues.length===n)continue;x(t.issues,n,e),i||=_(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(_(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new E;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new E;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return oe(this,`~standard`,He(this))},set"~standard"(e){ae(this,`~standard`,e)}}),Be=(e,t)=>e.issues.length?{issues:e.issues.map(e=>S(e,t,O()))}:{value:e.value};async function Ve(e,t){let n={async:!0};return Be(await e._zod.run({value:t,issues:[]},n),n)}function He(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Be(r,n)}catch{}return Ve(e,t)},vendor:`zod`,version:1}}const Ue=/*@__PURE__*/ T(`$ZodString`,(e,t)=>{k.init(e,t),e._zod.pattern=t.pattern??je,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),We=/*@__PURE__*/ T(`$ZodStringFormat`,(e,t)=>{Le.init(e,t),Ue.init(e,t)}),Ge=/*@__PURE__*/ T(`$ZodISODateTime`,(e,t)=>{t.pattern??=Ae(t),We.init(e,t)}),Ke=/*@__PURE__*/ T(`$ZodNumber`,(e,t)=>{k.init(e,t),e._zod.pattern=Me,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),qe=/*@__PURE__*/ T(`$ZodBoolean`,(e,t)=>{k.init(e,t),e._zod.pattern=Ne,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Je=/*@__PURE__*/ T(`$ZodAny`,(e,t)=>{k.init(e,t),e._zod.parse=e=>e}),Ye=/*@__PURE__*/ T(`$ZodUnknown`,(e,t)=>{k.init(e,t),e._zod.parse=e=>e}),Xe=/*@__PURE__*/ T(`$ZodVoid`,(e,t)=>{k.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`void`,code:`invalid_type`,input:r,inst:e}),t}});function Ze(e,t,n){e.issues.length&&t.issues.push(...y(n,e.issues)),t.value[n]=e.value}const Qe=/*@__PURE__*/ T(`$ZodArray`,(e,t)=>{k.init(e,t);let n=D.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>Ze(t,r,e)));else if(Ze(c,r,e),s&&c.issues.length!==0&&_(c))break}return o.length?Promise.all(o).then(()=>r):r}});function $e(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...y(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}const et=[];function tt(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:et,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=g(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function nt(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(_(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>$e(e,n,i,t,d,f))):$e(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}const rt=/*@__PURE__*/ T(`$ZodObject`,(e,t)=>{k.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=a(()=>tt(t));w(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||c(n,e,/* @__PURE__ */ new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let o=u,s=t.catchall,l,d=D.memoizer;d?.attach(e),e._zod.parse=(t,n)=>{l??=i.value;let r=t.value;if(!o(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=d?d.alloc(e,t,{},n):{};let a=[],c=l.shape,u=n?.abortEarly,f=t.issues.length;for(let e of l.allKeys){if(u&&t.issues.length!==f){if(_(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=c[e],o=i._zod.optin,s=i._zod.optout,l=i._zod.run({value:r[e],issues:[]},n);l instanceof Promise?a.push(l.then(n=>$e(n,t,e,r,o,s))):$e(l,t,e,r,o,s)}return s?nt(a,r,t,n,i.value,e,u===!0):a.length?Promise.all(a).then(()=>t):t}});function it(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!_(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>S(e,r,O())))}),t)}const at=/*@__PURE__*/ T(`$ZodUnion`,(e,t)=>{k.init(e,t),w(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),w(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),w(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),w(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>s(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>it(t,r,e,i)):it(o,r,e,i)}}),ot=/*@__PURE__*/ T(`$ZodRecord`,(e,t)=>{k.init(e,t);let n=D.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!d(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=/* @__PURE__ */ new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>S(e,i,O())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...y(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...y(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&Me.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>S(e,i,O())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...y(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...y(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),st=/*@__PURE__*/ T(`$ZodEnum`,(e,t)=>{k.init(e,t);let r=n(t.entries),i=new Set(r);e._zod.values=i,w(e,`pattern`,e=>{let t=n(e.def.entries).filter(e=>f.has(typeof e));return RegExp(t.length?`^(${t.map(e=>p(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,n)=>{let a=t.value;return i.has(a)||t.issues.push({code:`invalid_value`,values:r,input:a,inst:e}),t}}),ct=/*@__PURE__*/ T(`$ZodLiteral`,(e,t)=>{k.init(e,t);let n=new Set(t.values);e._zod.values=n,w(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?p(e):e?p(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),lt=/*@__PURE__*/ T(`$ZodTransform`,(e,t)=>{k.init(e,t),e._zod.optin=`optional`,D.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ge(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new E;return n.value=i,n}});function ut(e,t){return e.value=t.issues.length?void 0:t.value,e}const dt=/*@__PURE__*/ T(`$ZodOptional`,(e,t)=>{k.init(e,t),w(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,w(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?/* @__PURE__ */ new Set([...t,void 0]):void 0}),w(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${s(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>ut(e,t)):ut(e,r)}return t.innerType._zod.run(e,n)}}),ft=/*@__PURE__*/ T(`$ZodNullable`,(e,t)=>{k.init(e,t),w(e,`optin`,e=>e.def.innerType._zod.optin),w(e,`optout`,e=>e.def.innerType._zod.optout),w(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${s(t.source)}|null)$`):void 0}),w(e,`values`,e=>e.def.innerType._zod.values?/* @__PURE__ */ new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),pt=/*@__PURE__*/ T(`$ZodPipe`,(e,t)=>{k.init(e,t),w(e,`values`,e=>e.def.in._zod.values),w(e,`optin`,e=>e.def.in._zod.optin),w(e,`optout`,e=>e.def.out._zod.optout),w(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>mt(e,t.in,n)):mt(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>mt(e,t.out,n)):mt(r,t.out,n)}});function mt(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const ht=/*@__PURE__*/ T(`$ZodCustom`,(e,t)=>{Pe.init(e,t),k.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>gt(t,n,r,e));gt(i,n,r,e)}});function gt(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(re(e))}}function _t(e){return e.checks&&=[...e.checks],e}// @__NO_SIDE_EFFECTS__
2
- function vt(e,t){return new e(_t({type:`string`,...h(t)}))}// @__NO_SIDE_EFFECTS__
3
- function yt(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...h(t)})}// @__NO_SIDE_EFFECTS__
4
- function bt(e,t){return new e(_t({type:`number`,checks:[],...h(t)}))}// @__NO_SIDE_EFFECTS__
5
- function xt(e,t){return new e({type:`boolean`,...h(t)})}// @__NO_SIDE_EFFECTS__
6
- function St(e){return new e({type:`any`})}// @__NO_SIDE_EFFECTS__
7
- function Ct(e){return new e({type:`unknown`})}// @__NO_SIDE_EFFECTS__
8
- function wt(e,t){return new e({type:`void`,...h(t)})}// @__NO_SIDE_EFFECTS__
9
- function A(e,t){return new Ie({check:`min_length`,...h(t),minimum:e})}// @__NO_SIDE_EFFECTS__
10
- function Tt(e,t){return new Re({check:`string_format`,format:`regex`,...h(t),pattern:e})}// @__NO_SIDE_EFFECTS__
11
- function Et(e,t,n){let r=h(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}// @__NO_SIDE_EFFECTS__
12
- function Dt(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...h(n)})}const j=/*@__PURE__*/ T(`ZodMiniType`,(e,t)=>{if(!e._zod)throw Error(`Uninitialized schema in ZodMiniType.`);k.init(e,t),e.def=t,e.type=t.type},{get with(){return this.check},set with(e){ae(this,`with`,e)},parse(e,t){return we(this,e,t,{callee:this.parse})},parseAsync(e,t){return Te(this,e,t,{callee:this.parseAsync})},safeParse(e,t){return Ee(this,e,t)},safeParseAsync(e,t){return Oe(this,e,t)},check(...e){let t=this.def;return this.clone({...t,checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]},{parent:!0})},clone(e,t){return m(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},apply(e,...t){return t.length===0?e(this):e(this,...t)}}),Ot=/*@__PURE__*/ T(`ZodMiniString`,(e,t)=>{Ue.init(e,t),j.init(e,t)});// @__NO_SIDE_EFFECTS__
13
- function M(e){return/* @__PURE__ */ vt(Ot,e)}const kt=/*@__PURE__*/ T(`ZodMiniStringFormat`,(e,t)=>{We.init(e,t),Ot.init(e,t)}),At=/*@__PURE__*/ T(`ZodMiniNumber`,(e,t)=>{Ke.init(e,t),j.init(e,t)});// @__NO_SIDE_EFFECTS__
14
- function N(e){return/* @__PURE__ */ bt(At,e)}const jt=/*@__PURE__*/ T(`ZodMiniBoolean`,(e,t)=>{qe.init(e,t),j.init(e,t)});// @__NO_SIDE_EFFECTS__
15
- function P(e){return/* @__PURE__ */ xt(jt,e)}const Mt=/*@__PURE__*/ T(`ZodMiniAny`,(e,t)=>{Je.init(e,t),j.init(e,t)});// @__NO_SIDE_EFFECTS__
16
- function Nt(){return/* @__PURE__ */ St(Mt)}const Pt=/*@__PURE__*/ T(`ZodMiniUnknown`,(e,t)=>{Ye.init(e,t),j.init(e,t)});// @__NO_SIDE_EFFECTS__
17
- function F(){return/* @__PURE__ */ Ct(Pt)}const Ft=/*@__PURE__*/ T(`ZodMiniVoid`,(e,t)=>{Xe.init(e,t),j.init(e,t)});// @__NO_SIDE_EFFECTS__
18
- function It(e){return/* @__PURE__ */ wt(Ft,e)}const Lt=/*@__PURE__*/ T(`ZodMiniArray`,(e,t)=>{Qe.init(e,t),j.init(e,t)});// @__NO_SIDE_EFFECTS__
19
- function I(e,t){return new Lt({type:`array`,element:e,...h(t)})}const Rt=/*@__PURE__*/ T(`ZodMiniObject`,(e,t)=>{rt.init(e,t),j.init(e,t),de(e,`shape`,e=>e._zod.def.shape,!1)});// @__NO_SIDE_EFFECTS__
20
- function L(e,t){let n={type:`object`,shape:e??{},...h(t)};return new Rt(n)}const zt=/*@__PURE__*/ T(`ZodMiniUnion`,(e,t)=>{at.init(e,t),j.init(e,t)});// @__NO_SIDE_EFFECTS__
21
- function R(e,t){return new zt({type:`union`,options:e,...h(t)})}const Bt=/*@__PURE__*/ T(`ZodMiniRecord`,(e,t)=>{ot.init(e,t),j.init(e,t)});// @__NO_SIDE_EFFECTS__
22
- function z(e,t,n){return!t||!t._zod?new Bt({type:`record`,keyType:/* @__PURE__ */ M(),valueType:e,...h(t)}):new Bt({type:`record`,keyType:e,valueType:t,...h(n)})}const Vt=/*@__PURE__*/ T(`ZodMiniEnum`,(e,t)=>{st.init(e,t),j.init(e,t),e.options=[...e._zod.values]});// @__NO_SIDE_EFFECTS__
23
- function B(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Vt({type:`enum`,entries:n,...h(t)})}const Ht=/*@__PURE__*/ T(`ZodMiniLiteral`,(e,t)=>{ct.init(e,t),j.init(e,t)});// @__NO_SIDE_EFFECTS__
24
- function V(e,t){return new Ht({type:`literal`,values:Array.isArray(e)?e:[e],...h(t)})}const Ut=/*@__PURE__*/ T(`ZodMiniTransform`,(e,t)=>{lt.init(e,t),j.init(e,t)});// @__NO_SIDE_EFFECTS__
25
- function Wt(e){return new Ut({type:`transform`,transform:e})}const Gt=/*@__PURE__*/ T(`ZodMiniOptional`,(e,t)=>{dt.init(e,t),j.init(e,t)});// @__NO_SIDE_EFFECTS__
26
- function H(e){return new Gt({type:`optional`,innerType:e})}const Kt=/*@__PURE__*/ T(`ZodMiniNullable`,(e,t)=>{ft.init(e,t),j.init(e,t)});// @__NO_SIDE_EFFECTS__
27
- function qt(e){return new Kt({type:`nullable`,innerType:e})}const Jt=/*@__PURE__*/ T(`ZodMiniPipe`,(e,t)=>{pt.init(e,t),j.init(e,t)});// @__NO_SIDE_EFFECTS__
28
- function Yt(e,t){return new Jt({type:`pipe`,in:e,out:t})}const Xt=/*@__PURE__*/ T(`ZodMiniCustom`,(e,t)=>{ht.init(e,t),j.init(e,t)});// @__NO_SIDE_EFFECTS__
29
- function Zt(e,t){return/* @__PURE__ */ Et(Xt,e??(()=>!0),t)}// @__NO_SIDE_EFFECTS__
30
- function Qt(e,t={}){return/* @__PURE__ */ Dt(Xt,e,t)}const $t=/*@__PURE__*/ T(`ZodMiniISODateTime`,(e,t)=>{Ge.init(e,t),kt.init(e,t)});// @__NO_SIDE_EFFECTS__
31
- function en(e){return/* @__PURE__ */ yt($t,e)}const U=/* @__PURE__ */ L({displayName:/* @__PURE__ */ M(),description:/* @__PURE__ */ H(/* @__PURE__ */ M()),advanced:/* @__PURE__ */ H(/* @__PURE__ */ P()),width:/* @__PURE__ */ H(/* @__PURE__ */ B([`half`,`full`])),icon:/* @__PURE__ */ H(/* @__PURE__ */ M()),placeholder:/* @__PURE__ */ H(/* @__PURE__ */ M())}),W=(e,t)=>/* @__PURE__ */ L({type:/* @__PURE__ */ V(t),required:/* @__PURE__ */ P(),defaultValue:/* @__PURE__ */ H(/* @__PURE__ */ Nt())}),tn=/* @__PURE__ */ L({...U.shape,...W(/* @__PURE__ */ M(),`SHORT_TEXT`).shape}),nn=/* @__PURE__ */ L({...U.shape,...W(/* @__PURE__ */ M(),`LONG_TEXT`).shape}),rn=/* @__PURE__ */ L({disabled:/* @__PURE__ */ H(/* @__PURE__ */ P()),placeholder:/* @__PURE__ */ H(/* @__PURE__ */ M()),options:/* @__PURE__ */ I(/* @__PURE__ */ L({label:/* @__PURE__ */ M(),value:/* @__PURE__ */ F(),description:/* @__PURE__ */ H(/* @__PURE__ */ M()),icon:/* @__PURE__ */ H(/* @__PURE__ */ M())}))}),an=/* @__PURE__ */ B([`cards`]),on=/* @__PURE__ */ L({...U.shape,options:rn,display:/* @__PURE__ */ H(an),...W(/* @__PURE__ */ F(),`STATIC_DROPDOWN`).shape}),sn=/* @__PURE__ */ L({...U.shape,options:rn,...W(/* @__PURE__ */ I(/* @__PURE__ */ F()),`STATIC_MULTI_SELECT_DROPDOWN`).shape}),cn=/* @__PURE__ */ L({...U.shape,reveals:/* @__PURE__ */ H(/* @__PURE__ */ I(/* @__PURE__ */ M())),...W(/* @__PURE__ */ P(),`CHECKBOX`).shape}),ln=/* @__PURE__ */ L({...U.shape,display:/* @__PURE__ */ H(/* @__PURE__ */ B([`stepper`])),min:/* @__PURE__ */ H(/* @__PURE__ */ N()),max:/* @__PURE__ */ H(/* @__PURE__ */ N()),step:/* @__PURE__ */ H(/* @__PURE__ */ N()),...W(/* @__PURE__ */ N(),`NUMBER`).shape}),un=/* @__PURE__ */ L({...U.shape,streaming:/* @__PURE__ */ H(/* @__PURE__ */ P()),...W(/* @__PURE__ */ F(),`FILE`).shape}),dn=/* @__PURE__ */ L({preset:/* @__PURE__ */ H(/* @__PURE__ */ B([`any_time`,`last_24_hours`,`last_7_days`,`last_30_days`,`last_90_days`,`this_month`,`custom`])),after:/* @__PURE__ */ H(/* @__PURE__ */ M()),before:/* @__PURE__ */ H(/* @__PURE__ */ M())}),fn=/* @__PURE__ */ L({...U.shape,display:/* @__PURE__ */ H(/* @__PURE__ */ B([`dropdown`])),...W(dn,`DATE_RANGE`).shape});let pn=/* @__PURE__ */ function(e){return e.BORDERLESS=`BORDERLESS`,e.INFO=`INFO`,e.WARNING=`WARNING`,e.TIP=`TIP`,e}({});function mn(e){return e==null}const hn=/* @__PURE__ */ L({...U.shape,...W(/* @__PURE__ */ It(),`MARKDOWN`).shape,variant:/* @__PURE__ */ H(/* @__PURE__ */ B(pn))}),gn=/* @__PURE__ */ L({retryOnFailure:/* @__PURE__ */ L({defaultValue:/* @__PURE__ */ H(/* @__PURE__ */ P()),hide:/* @__PURE__ */ H(/* @__PURE__ */ P())}),continueOnFailure:/* @__PURE__ */ L({defaultValue:/* @__PURE__ */ H(/* @__PURE__ */ P()),hide:/* @__PURE__ */ H(/* @__PURE__ */ P())})});var _n=class{name;displayName;description;props;propertyGroups;run;test;requireAuth;errorHandlingOptions;outputSchema;audience;aiMetadata;classification;constructor(e,t,n,r,i,a,o,s,c,l,u,d,f){this.name=e,this.displayName=t,this.description=n,this.props=r,this.propertyGroups=i,this.run=a,this.test=o,this.requireAuth=s,this.errorHandlingOptions=c,this.outputSchema=l,this.audience=u,this.aiMetadata=d,this.classification=f}};const vn=e=>new _n(e.name,e.displayName,e.description,e.props,e.propertyGroups,e.run,e.test??e.run,e.requireAuth??!0,e.errorHandlingOptions??{continueOnFailure:{defaultValue:!1},retryOnFailure:{defaultValue:!1}},e.outputSchema,e.audience,e.aiMetadata,e.classification),yn=/* @__PURE__ */ L({...U.shape,...W(/* @__PURE__ */ F(),`DROPDOWN`).shape,refreshers:/* @__PURE__ */ I(/* @__PURE__ */ M())}),bn=/* @__PURE__ */ L({...U.shape,...W(/* @__PURE__ */ I(/* @__PURE__ */ F()),`MULTI_SELECT_DROPDOWN`).shape,refreshers:/* @__PURE__ */ I(/* @__PURE__ */ M())}),xn=/* @__PURE__ */ L({...U.shape,...W(/* @__PURE__ */ R([/* @__PURE__ */ z(/* @__PURE__ */ M(),/* @__PURE__ */ F())]),`JSON`).shape}),Sn=/* @__PURE__ */ L({...U.shape,...W(/* @__PURE__ */ M(),`COLOR`).shape}),Cn=/* @__PURE__ */ L({...U.shape,...W(/* @__PURE__ */ M(),`DATE_TIME`).shape}),wn=/* @__PURE__ */ z(/* @__PURE__ */ M(),/* @__PURE__ */ R([tn,nn,on,bn,sn,cn,ln,un,xn,Sn,Cn])),Tn=/* @__PURE__ */ L({...U.shape,properties:/* @__PURE__ */ H(wn),...W(/* @__PURE__ */ I(/* @__PURE__ */ F()),`ARRAY`).shape}),En=/* @__PURE__ */ L({refreshers:/* @__PURE__ */ I(/* @__PURE__ */ M()),...U.shape,...W(/* @__PURE__ */ F(),`DYNAMIC`).shape}),Dn=/* @__PURE__ */ L({...U.shape,...W(/* @__PURE__ */ z(/* @__PURE__ */ M(),/* @__PURE__ */ F()),`OBJECT`).shape}),On=/* @__PURE__ */ R([tn,nn,/* @__PURE__ */ L({...U.shape,formatProperty:/* @__PURE__ */ H(/* @__PURE__ */ M()),...W(/* @__PURE__ */ M(),`RICH_TEXT`).shape}),hn,cn,on,sn,yn,bn,En,ln,Tn,Dn,xn,Cn,fn,un,/* @__PURE__ */ L({...U.shape,...W(/* @__PURE__ */ F(),`CUSTOM`).shape,code:/* @__PURE__ */ M()}),Sn]),kn={ShortText(e){return{...e,valueSchema:void 0,type:`SHORT_TEXT`}},Checkbox(e){return{...e,valueSchema:void 0,type:`CHECKBOX`}},LongText(e){return{...e,valueSchema:void 0,type:`LONG_TEXT`}},RichText(e){return{...e,valueSchema:void 0,type:`RICH_TEXT`}},MarkDown(e){return{displayName:`Markdown`,required:!1,description:e.value,type:`MARKDOWN`,valueSchema:void 0,variant:e.variant??`INFO`}},Number(e){return{...e,valueSchema:void 0,type:`NUMBER`}},Json(e){return{...e,valueSchema:void 0,type:`JSON`}},Array(e){return{...e,valueSchema:void 0,type:`ARRAY`}},Object(e){return{...e,valueSchema:void 0,type:`OBJECT`}},Dropdown(e){return{...e,valueSchema:void 0,type:`DROPDOWN`}},StaticDropdown(e){return{...e,valueSchema:void 0,type:`STATIC_DROPDOWN`}},MultiSelectDropdown(e){return{...e,valueSchema:void 0,type:`MULTI_SELECT_DROPDOWN`}},DynamicProperties(e){return{...e,valueSchema:void 0,type:`DYNAMIC`}},StaticMultiSelectDropdown(e){return{...e,valueSchema:void 0,type:`STATIC_MULTI_SELECT_DROPDOWN`}},DateTime(e){return{...e,valueSchema:void 0,type:`DATE_TIME`}},DateRange(e){return{...e,valueSchema:void 0,type:`DATE_RANGE`}},File(e){return{...e,valueSchema:void 0,type:`FILE`}},Custom(e){let t=e.code.toString();return{...e,code:t,valueSchema:void 0,type:`CUSTOM`}},Color(e){return{...e,valueSchema:void 0,type:`COLOR`}}};let An=/* @__PURE__ */ function(e){return e.AUTHORIZATION_CODE=`authorization_code`,e.CLIENT_CREDENTIALS=`client_credentials`,e}({}),jn=/* @__PURE__ */ function(e){return e.POLLING=`POLLING`,e.WEBHOOK=`WEBHOOK`,e.APP_WEBHOOK=`APP_WEBHOOK`,e.MANUAL=`MANUAL`,e}({}),Mn=/* @__PURE__ */ function(e){return e.SIMULATION=`SIMULATION`,e.TEST_FUNCTION=`TEST_FUNCTION`,e}({});const Nn=/* @__PURE__ */ L({displayName:/* @__PURE__ */ M(),description:/* @__PURE__ */ H(/* @__PURE__ */ M()),hasConnectionIdentifier:/* @__PURE__ */ H(/* @__PURE__ */ P())}),Pn=/* @__PURE__ */ L({username:/* @__PURE__ */ M(),password:/* @__PURE__ */ M()}),Fn=/* @__PURE__ */ L({...Nn.shape,username:/* @__PURE__ */ L({displayName:/* @__PURE__ */ M(),description:/* @__PURE__ */ H(/* @__PURE__ */ M())}),password:/* @__PURE__ */ L({displayName:/* @__PURE__ */ M(),description:/* @__PURE__ */ H(/* @__PURE__ */ M())}),...W(Pn,`BASIC_AUTH`).shape}),In=/* @__PURE__ */ L({...Nn.shape,...W(/* @__PURE__ */ L({auth:/* @__PURE__ */ M()}),`SECRET_TEXT`).shape}),Ln=/* @__PURE__ */ z(/* @__PURE__ */ M(),/* @__PURE__ */ R([tn,nn,In,ln,on,cn,hn,sn])),Rn=/* @__PURE__ */ L({...Nn.shape,props:Ln,...W(/* @__PURE__ */ F(),`CUSTOM_AUTH`).shape}),zn=/* @__PURE__ */ z(/* @__PURE__ */ M(),/* @__PURE__ */ R([tn,nn,In,ln,cn,on,sn,hn])),Bn=/* @__PURE__ */ L({...Nn.shape,props:zn,...W(/* @__PURE__ */ F(),`OIDC`).shape});let Vn=/* @__PURE__ */ function(e){return e.HEADER=`HEADER`,e.BODY=`BODY`,e}({});const Hn=/* @__PURE__ */ R([tn,In,on]),Un=/* @__PURE__ */ z(/* @__PURE__ */ M(),Hn),Wn=/* @__PURE__ */ L({props:/* @__PURE__ */ H(/* @__PURE__ */ z(/* @__PURE__ */ M(),Hn)),authUrl:/* @__PURE__ */ M(),tokenUrl:/* @__PURE__ */ M(),scope:/* @__PURE__ */ I(/* @__PURE__ */ M()),prompt:/* @__PURE__ */ H(/* @__PURE__ */ R([/* @__PURE__ */ V(`none`),/* @__PURE__ */ V(`consent`),/* @__PURE__ */ V(`login`),/* @__PURE__ */ V(`omit`)])),pkce:/* @__PURE__ */ H(/* @__PURE__ */ P()),pkceMethod:/* @__PURE__ */ H(/* @__PURE__ */ R([/* @__PURE__ */ V(`plain`),/* @__PURE__ */ V(`S256`)])),authorizationMethod:/* @__PURE__ */ H(/* @__PURE__ */ B(Vn)),grantType:/* @__PURE__ */ H(/* @__PURE__ */ R([/* @__PURE__ */ B(An),/* @__PURE__ */ V(`both_client_credentials_and_authorization_code`)])),extra:/* @__PURE__ */ H(/* @__PURE__ */ z(/* @__PURE__ */ M(),/* @__PURE__ */ M()))}),Gn=/* @__PURE__ */ L({access_token:/* @__PURE__ */ M(),props:/* @__PURE__ */ H(Un),data:/* @__PURE__ */ z(/* @__PURE__ */ M(),/* @__PURE__ */ Nt())}),Kn=/* @__PURE__ */ R([Fn,Rn,Bn,/* @__PURE__ */ L({...Nn.shape,...Wn.shape,...W(Gn,`OAUTH2`).shape}),In]);let G,K,qn=t=>{if(t<0)throw RangeError(`Wrong ID size`);try{!G||G.length<t?(G=Buffer.allocUnsafe(t*128),e.randomFillSync(G),K=0):K+t>G.length&&(e.randomFillSync(G),K=0)}catch(e){throw G=void 0,e}K+=t},Jn=e=>(qn(e|=0),G.subarray(K-e,K)),Yn=(e,t,n)=>{let r=(2<<31-Math.clz32(e.length-1|1))-1,i=Math.ceil(1.6*r*t/e.length);return(a=t)=>{if(a<=0)return``;let o=``;for(;;){let t=n(i),s=i;for(;s--;)if(o+=e[t[s]&r]||``,o.length===a)return o}}},Xn=(e,t=21)=>Yn(e,t,Jn),Zn=/* @__PURE__ */ function(e){return e.ARCHIVE=`ARCHIVE`,e.REGISTRY=`REGISTRY`,e}({}),Qn=/* @__PURE__ */ function(e){return e.CUSTOM=`CUSTOM`,e.OFFICIAL=`OFFICIAL`,e}({}),$n=/* @__PURE__ */ function(e){return e.ARTIFICIAL_INTELLIGENCE=`ARTIFICIAL_INTELLIGENCE`,e.COMMUNICATION=`COMMUNICATION`,e.COMMERCE=`COMMERCE`,e.CORE=`CORE`,e.UNIVERSAL_AI=`UNIVERSAL_AI`,e.FLOW_CONTROL=`FLOW_CONTROL`,e.BUSINESS_INTELLIGENCE=`BUSINESS_INTELLIGENCE`,e.ACCOUNTING=`ACCOUNTING`,e.PRODUCTIVITY=`PRODUCTIVITY`,e.CONTENT_AND_FILES=`CONTENT_AND_FILES`,e.DEVELOPER_TOOLS=`DEVELOPER_TOOLS`,e.CUSTOMER_SUPPORT=`CUSTOMER_SUPPORT`,e.FORMS_AND_SURVEYS=`FORMS_AND_SURVEYS`,e.HUMAN_RESOURCES=`HUMAN_RESOURCES`,e.PAYMENT_PROCESSING=`PAYMENT_PROCESSING`,e.MARKETING=`MARKETING`,e.SALES_AND_CRM=`SALES_AND_CRM`,e}({});(/* @__PURE__ */ M()).check(/* @__PURE__ */ Tt(/* @__PURE__ */ RegExp(`^[0-9a-zA-Z]{21}$`))),Xn(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`,21);const er=/* @__PURE__ */ Yt(/* @__PURE__ */ Wt(e=>e instanceof Date?e.toISOString():e),/* @__PURE__ */ M()),tr={id:/* @__PURE__ */ M(),created:er,updated:er},nr=e=>/* @__PURE__ */ H(/* @__PURE__ */ qt(e));(/* @__PURE__ */ en({offset:!0})).check(/* @__PURE__ */ Qt(e=>e.slice(0,4)!==`0000`));let rr=/* @__PURE__ */ function(e){return e.IN_PROGRESS=`in-progress`,e.COMPLETED=`completed`,e}({});(/* @__PURE__ */ M()).check(/* @__PURE__ */ A(1)),(/* @__PURE__ */ M()).check(/* @__PURE__ */ A(1)),(/* @__PURE__ */ M()).check(/* @__PURE__ */ A(1)),(/* @__PURE__ */ M()).check(/* @__PURE__ */ A(1));const ir={type:/* @__PURE__ */ V(`TOOL_CALL`),input:nr(/* @__PURE__ */ z(/* @__PURE__ */ M(),/* @__PURE__ */ F())),output:/* @__PURE__ */ H(/* @__PURE__ */ F()),toolName:/* @__PURE__ */ M(),status:/* @__PURE__ */ B(rr),toolCallId:/* @__PURE__ */ M(),startTime:/* @__PURE__ */ M(),endTime:/* @__PURE__ */ H(/* @__PURE__ */ M())};({...ir}),{...ir},{...ir},{...ir},{...ir},(/* @__PURE__ */ M()).check(/* @__PURE__ */ A(1)),(/* @__PURE__ */ M()).check(/* @__PURE__ */ A(1)),(/* @__PURE__ */ M()).check(/* @__PURE__ */ A(1)),(/* @__PURE__ */ M()).check(/* @__PURE__ */ A(1)),(/* @__PURE__ */ M()).check(/* @__PURE__ */ Tt(/^[a-z0-9][a-z0-9-]{0,62}$/)),(/* @__PURE__ */ M()).check(/* @__PURE__ */ Tt(/^[a-z0-9][a-z0-9-]{0,62}$/));const ar=[`gpt-5.5`,`gpt-5.4-mini`,`gpt-5.4-nano`,`gpt-4.1`,`gpt-4.1-mini`],or=[`claude-sonnet-4-6`,`claude-opus-4-7`,`claude-haiku-4-5`],sr=[`claude-sonnet-4.6`,`claude-opus-4.7`,`claude-opus-4.8`,`claude-haiku-4.5`],cr=[`gemini-2.5-pro`,`gemini-2.5-flash`,`gemini-3.7-flash`,`gemini-3.1-pro-preview`,`gemini-3-flash-preview`],lr=[`grok-4.20`];sr.map(e=>`anthropic/${e}`);const ur={openai:ar,anthropic:or,google:cr,vertex:cr,activepieces:[...sr.map(e=>`anthropic/${e}`),...ar.map(e=>`openai/${e}`),...cr.map(e=>`google/${e}`),...lr.map(e=>`x-ai/${e}`)]},dr=128e3,fr={openai:128e3,anthropic:2e5,google:1048576,bedrock:2e5,vertex:1048576,azure:128e3,openrouter:128e3,activepieces:2e5,mistral:128e3};function pr({provider:e}){return e?fr[e]??dr:dr}const mr={openai:`text-embedding-3-small`,google:`text-embedding-004`,azure:`text-embedding-3-small`,activepieces:`text-embedding-3-small`,openrouter:`openai/text-embedding-3-small`},hr={anthropic:`native`,google:`native`,openrouter:`plugin`,activepieces:`plugin`},gr=/* @__PURE__ */ new Set([`anthropic`,`mistral`,`xai`,`deepseek`,`zai`,`qwen`,`minimax`,`moonshot`]);function q(e){return{chatModels:ur[e],maxContextTokens:pr({provider:e}),defaultEmbeddingModel:mr[e],supportsEmbedding:mr[e]!==void 0,supportsImageGeneration:!gr.has(e),webSearch:hr[e]}}q(`openai`),q(`anthropic`),q(`openrouter`),q(`azure`),q(`google`),q(`cloudflare-gateway`),q(`custom`),q(`bedrock`),q(`vertex`),q(`mistral`),q(`activepieces`),q(`xai`),q(`deepseek`),q(`zai`),q(`qwen`),q(`minimax`),q(`moonshot`),{...tr},{...tr},{...tr},{...tr},{...tr};const _r=/* @__PURE__ */ z(/* @__PURE__ */ M(),/* @__PURE__ */ R([On,Kn])),vr=/* @__PURE__ */ R([/* @__PURE__ */ L({strategy:/* @__PURE__ */ V(`CRON`),cronExpression:/* @__PURE__ */ M()}),/* @__PURE__ */ L({strategy:/* @__PURE__ */ V(`NONE`)})]);var yr=class{name;displayName;description;requireAuth;props;type;handshakeConfiguration;onHandshake;renewConfiguration;onRenew;onEnable;onDisable;onStart;run;test;sampleData;testStrategy;outputSchema;aiMetadata;classification;propertyGroups;constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b){this.name=e,this.displayName=t,this.description=n,this.requireAuth=r,this.props=i,this.type=a,this.handshakeConfiguration=o,this.onHandshake=s,this.renewConfiguration=c,this.onRenew=l,this.onEnable=u,this.onDisable=d,this.onStart=f,this.run=p,this.test=m,this.sampleData=h,this.testStrategy=g,this.outputSchema=_,this.aiMetadata=v,this.classification=y,this.propertyGroups=b}};const br=e=>{switch(e.type){case`WEBHOOK`:return new yr(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,e.handshakeConfiguration??{strategy:`NONE`},e.onHandshake??(async()=>({status:200})),e.renewConfiguration??{strategy:`NONE`},e.onRenew??(async()=>Promise.resolve()),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,e.test?`TEST_FUNCTION`:`SIMULATION`,e.outputSchema,e.aiMetadata,e.classification,e.propertyGroups);case`POLLING`:return new yr(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,{strategy:`NONE`},async()=>({status:200}),{strategy:`NONE`},async()=>Promise.resolve(),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,`TEST_FUNCTION`,e.outputSchema,e.aiMetadata,e.classification,e.propertyGroups);case`MANUAL`:return new yr(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,{strategy:`NONE`},async()=>({status:200}),{strategy:`NONE`},async()=>Promise.resolve(),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,`TEST_FUNCTION`,e.outputSchema,e.aiMetadata,e.classification,e.propertyGroups);case`APP_WEBHOOK`:return new yr(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,{strategy:`NONE`},async()=>({status:200}),{strategy:`NONE`},async()=>Promise.resolve(),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,mn(e.sampleData)&&mn(e.test)?`SIMULATION`:`TEST_FUNCTION`,e.outputSchema,e.aiMetadata,e.classification,e.propertyGroups);default:{let{name:t,type:n,strategy:r}=e;throw Error(n===void 0&&r!==void 0?`createTrigger: trigger ${JSON.stringify(t)} sets \`strategy\`; the field is \`type\`, e.g. type: TriggerStrategy.POLLING`:`createTrigger: trigger ${JSON.stringify(t)} has \`type\` ${JSON.stringify(n)}; set type: TriggerStrategy.POLLING or TriggerStrategy.WEBHOOK`)}}},xr=`0.82.0`;var Sr=class{displayName;logoUrl;authors;events;categories;auth;minimumSupportedRelease;maximumSupportedRelease;description;deprecated;_actions={};_triggers={};getContextInfo=()=>({version:`2`});constructor(e,t,n,r,i,a,o,s,c=xr,l,u=``,d){this.displayName=e,this.logoUrl=t,this.authors=n,this.events=r,this.categories=o,this.auth=s,this.minimumSupportedRelease=c,this.maximumSupportedRelease=l,this.description=u,this.deprecated=d,(!Er(c)||Dr(c,`0.82.0`))&&(this.minimumSupportedRelease=xr),i.forEach(e=>this._actions[e.name]=e),a.forEach(e=>this._triggers[e.name]=e)}metadata(){return{displayName:this.displayName,logoUrl:this.logoUrl,actions:this._actions,triggers:this._triggers,categories:this.categories,description:this.description,authors:this.authors,auth:wr(this.auth),minimumSupportedRelease:this.minimumSupportedRelease,maximumSupportedRelease:this.maximumSupportedRelease,deprecated:this.deprecated,contextInfo:this.getContextInfo?.()}}getAction(e){return this._actions[e]}getTrigger(e){return this._triggers[e]}actions(){return this._actions}triggers(){return this._triggers}};const Cr=e=>{if(e.auth&&Array.isArray(e.auth)&&!e.auth.every((e,t,n)=>t===n.findIndex(t=>t.type===e.type)))throw Error(`Auth properties must be unique by type`);return new Sr(e.displayName,e.logoUrl,e.authors??[],e.events,e.actions,e.triggers,e.categories??[],e.auth,e.minimumSupportedRelease,e.maximumSupportedRelease,e.description,e.deprecated)};function wr(e){if(e!==void 0)return Array.isArray(e)?e.map(Tr):Tr(e)}function Tr(e){return{...e,hasConnectionIdentifier:e.getConnectionIdentifier!==void 0}}function Er(e){return/^\d+\.\d+\.\d+$/.test(e)}function Dr(e,t){let[n,r,i]=e.split(`.`).map(Number),[a,o,s]=t.split(`.`).map(Number);return n===a?r===o?i<s:r<o:n<a}const Or=/* @__PURE__ */ L({id:/* @__PURE__ */ H(/* @__PURE__ */ M()),name:/* @__PURE__ */ M(),displayName:/* @__PURE__ */ M(),logoUrl:/* @__PURE__ */ M(),description:/* @__PURE__ */ M(),authors:/* @__PURE__ */ I(/* @__PURE__ */ M()),platformId:/* @__PURE__ */ H(/* @__PURE__ */ M()),directoryPath:/* @__PURE__ */ H(/* @__PURE__ */ M()),auth:/* @__PURE__ */ H(/* @__PURE__ */ R([Kn,/* @__PURE__ */ I(Kn)])),version:/* @__PURE__ */ M(),categories:/* @__PURE__ */ H(/* @__PURE__ */ I(/* @__PURE__ */ B($n))),minimumSupportedRelease:/* @__PURE__ */ H(/* @__PURE__ */ M()),maximumSupportedRelease:/* @__PURE__ */ H(/* @__PURE__ */ M()),deprecated:/* @__PURE__ */ H(/* @__PURE__ */ P()),i18n:/* @__PURE__ */ H(/* @__PURE__ */ z(/* @__PURE__ */ M(),/* @__PURE__ */ z(/* @__PURE__ */ M(),/* @__PURE__ */ M())))}),kr=/* @__PURE__ */ B([`human`,`ai`,`both`]),Ar=/* @__PURE__ */ L({description:/* @__PURE__ */ H(/* @__PURE__ */ M()),idempotent:/* @__PURE__ */ H(/* @__PURE__ */ P())}),jr=/* @__PURE__ */ B([`READ`,`SEARCH`,`WRITE`,`DESTRUCTIVE`]),Mr=/* @__PURE__ */ L({key:/* @__PURE__ */ M(),display:/* @__PURE__ */ B([`tabs`,`section`,`summary`,`builder`,`footer`]),label:/* @__PURE__ */ H(/* @__PURE__ */ M()),description:/* @__PURE__ */ H(/* @__PURE__ */ M()),icon:/* @__PURE__ */ H(/* @__PURE__ */ M()),props:/* @__PURE__ */ I(/* @__PURE__ */ M())}),Nr=/* @__PURE__ */ L({name:/* @__PURE__ */ M(),displayName:/* @__PURE__ */ M(),description:/* @__PURE__ */ M(),props:_r,propertyGroups:/* @__PURE__ */ H(/* @__PURE__ */ I(Mr)),requireAuth:/* @__PURE__ */ P(),errorHandlingOptions:/* @__PURE__ */ H(gn),outputSchema:/* @__PURE__ */ H(/* @__PURE__ */ Zt()),audience:/* @__PURE__ */ H(kr),aiMetadata:/* @__PURE__ */ H(Ar),classification:/* @__PURE__ */ H(jr)}),Pr=/* @__PURE__ */ L({name:/* @__PURE__ */ M(),displayName:/* @__PURE__ */ M(),description:/* @__PURE__ */ M(),props:_r,propertyGroups:/* @__PURE__ */ H(/* @__PURE__ */ I(Mr)),errorHandlingOptions:/* @__PURE__ */ H(gn),type:/* @__PURE__ */ B(jn),sampleData:/* @__PURE__ */ F(),handshakeConfiguration:/* @__PURE__ */ H(/* @__PURE__ */ Zt()),renewConfiguration:/* @__PURE__ */ H(vr),testStrategy:/* @__PURE__ */ B(Mn),outputSchema:/* @__PURE__ */ H(/* @__PURE__ */ Zt()),aiMetadata:/* @__PURE__ */ H(Ar),classification:/* @__PURE__ */ H(jr)}),Fr=/* @__PURE__ */ L({...Or.shape,actions:/* @__PURE__ */ z(/* @__PURE__ */ M(),Nr),triggers:/* @__PURE__ */ z(/* @__PURE__ */ M(),Pr)}),Ir=/* @__PURE__ */ L({...Or.shape,actions:/* @__PURE__ */ N(),triggers:/* @__PURE__ */ N(),suggestedActions:/* @__PURE__ */ H(/* @__PURE__ */ I(Nr)),suggestedTriggers:/* @__PURE__ */ H(/* @__PURE__ */ I(Pr))}),Lr=/* @__PURE__ */ L({projectUsage:/* @__PURE__ */ N(),pieceType:/* @__PURE__ */ B(Qn),packageType:/* @__PURE__ */ B(Zn),platformId:/* @__PURE__ */ H(/* @__PURE__ */ M()),archiveId:/* @__PURE__ */ H(/* @__PURE__ */ M())});({...Fr.shape,...Lr.shape}),{...Ir.shape,...Lr.shape};function J(e){let{requireReactor:t,defaultTimeoutSeconds:n,defaultRetry:r,...i}=e;return Rr(Br(vn(i),t),{defaultTimeoutSeconds:n,defaultRetry:r})}function Rr(e,{defaultTimeoutSeconds:t,defaultRetry:n}){if(t!==void 0){if(!Number.isFinite(t)||t<=0)throw Error(`defaultTimeoutSeconds must be a positive number, got ${JSON.stringify(t)}`);Object.assign(e,{defaultTimeoutSeconds:t})}if(n!==void 0){let t=n.maxAttempts;if(!Number.isInteger(t)||t<1)throw Error(`defaultRetry.maxAttempts must be a positive integer, got ${JSON.stringify(t)}`);Object.assign(e,{defaultRetry:n})}return e}function zr(e){let{requireReactor:t,...n}=e;return Br(br(n),t)}function Br(e,t){if(t===void 0||t===!1)return e;if(t!==`read`&&t!==`write`)throw Error(`requireReactor must be "read", "write" or false, got ${JSON.stringify(t)}`);return Object.assign(e,{requireReactor:t})}const Y={...kn,Dropdown(e){return kn.Dropdown(e)},MultiSelectDropdown(e){return kn.MultiSelectDropdown(e)},DynamicProperties(e){return kn.DynamicProperties(e)}};function Vr(e,t){let n=e.result?.actions??[],r=new Map(n.map(e=>[e.actionId,e])),i=(t?.map(e=>({id:e.id,label:e.type}))??n.map(({actionId:e})=>({id:e,label:e}))).flatMap(({id:e,label:t})=>{let n=r.get(e);return n?n.kind===`reducer-error`?[`Action ${t} failed: ${n.message}`]:n.kind===`denied`?[`Action ${t} was denied: ${n.reason}`]:[]:[`Action ${t} produced no operation`]});if(i.length>0){let e=Error(i.join(`; `));throw e.name=`ReactorActionsFailedError`,e}}function Hr(e){return{documentId:e.id,documentType:e.documentType,branch:e.branch,revision:{...e.revision}}}const Ur=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function Wr(e={}){let t=e.now??(()=>Date.now()),n=e.random??(e=>{globalThis.crypto.getRandomValues(e)}),r=/* @__PURE__ */ new Uint8Array(16),i=-1,a=0;return()=>{let e=t();n(r);let o=(r[6]&7)<<8|r[7];e>i?(i=e,a=o):a<4095?a++:(i++,a=o);let s=i;for(let e=5;e>=0;e--)r[e]=s%256,s=Math.floor(s/256);r[6]=112|a>>8,r[7]=a&255,r[8]=128|r[8]&63;let c=``;for(let e=0;e<16;e++)(e===4||e===6||e===8||e===10)&&(c+=`-`),c+=Ur[r[e]];return c}}const Gr=Wr();let Kr=0,qr=0;function Jr(){let e=Date.now();return qr=e<Kr||e>qr?e:qr+1,Kr=e,new Date(qr).toISOString()}const Yr=`powerhouse/document-drive`,Xr=/* @__PURE__ */ new Set([Yr,`powerhouse/reactor-drive`]),Zr=`main`,Qr=`global`;function $r(e){return{header:e.header,state:e.state}}function ei(e){let t=e.state.global;return t&&typeof t==`object`?t:{}}function ti(e){let t=ei(e).name;return typeof t==`string`&&t||e.header.name||``}function ni(e,t){let n=ei(e);for(let e of t.split(`.`)){if(typeof n!=`object`||!n)return;n=n[e]}return n}function ri(e,t){if(!t)return!0;let n=ni(e,t.path);return typeof n==`string`?n===t.value:typeof n==`number`||typeof n==`boolean`||typeof n==`bigint`?String(n)===t.value:!1}const ii={type:`SET_NAME`,module:`base`,scope:Qr,inputSchema:`input SetNameInput {
1
+ import e from"crypto";import t from"node:path";import n from"node:fs/promises";var r=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);function i(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function a(e,t){return typeof t==`bigint`?t.toString():t}var o=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function s(e){return new o(e)}function c(e){return e==null}function l(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function u(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}const d=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function f(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function p(e){if(f(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return f(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}const m=/* @__PURE__*/ new Set([`string`,`number`,`symbol`]);function h(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function g(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function _(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function v(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}function y(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function ee(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function b(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function x(e){return typeof e==`string`?e:e?.message}function te(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function S(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:x(e.inst?._zod.def?.error?.(e))??x(a?.(e))??x(t?.error?.(e))??x(n.customError?.(e))??x(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}const ne=/[\uD800-\uDBFF]/;function re(e){let t=e.length;if(!ne.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function ie(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function ae(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function oe(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):le(e,n,r.value)}}function se(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function ce(e,t,n){return se(e,t,n,!1)}function le(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:se(this,t,n.bind(this))},set(e){se(this,t,e)}})}function ue(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}let de,C=!1;const fe={configurable:!0,get(){C=!0}};function w(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&de!==e._zod){de=void 0;return}de=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,fe);let e=C;C=!1;try{let r=n(this);return C?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),C||=e,r}catch(n){throw delete this[t],C||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function pe(e,t,n,r){let i=ue(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var me;const he={value:void 0,enumerable:!1};let ge=`captureStackTrace`in Error?Error:null;function _e(e){let t=ge;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return ge=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function T(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=/* @__PURE__ */ new Set}a.prototype=i;let o=n,s=o&&/* @__PURE__ */ new WeakSet;function c(n,r){if(!n._zod){he.value=new a(r);try{Object.defineProperty(n,"_zod",he)}finally{he.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),oe(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?_e(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var E=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ve=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(me=globalThis).__zod_globalConfig??(me.__zod_globalConfig={});const D=globalThis.__zod_globalConfig;function O(e){return e&&Object.assign(D,e),D}function ye(){let e=this._zod;return e.message??=JSON.stringify(e.def,a,2),e.message}function be(e){this._zod.message=e}const xe={get:ye,set:be,enumerable:!0,configurable:!0},Se={value:void 0,enumerable:!1},Ce=/* @__PURE__ */ new WeakSet([Object.prototype,Error.prototype]),we=(e,t)=>{e.name=`$ZodError`,Se.value=t,Object.defineProperty(e,"issues",Se),Se.value=void 0,Object.defineProperty(e,"message",xe);let n=Object.getPrototypeOf(e);Ce.has(n)||(Ce.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))};T(`$ZodError`,we);const Te=T(`$ZodError`,we,void 0,{Parent:Error}),Ee=/* @__PURE__*/ (e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new E;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>S(e,o,O())));throw d(n,a?.callee??t),n}return s.value};return t})(Te),De=/* @__PURE__*/ (e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>S(e,o,O())));throw d(n,a?.callee??t),n}return s.value};return t})(Te),Oe=/* @__PURE__*/ (e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new E;return a.issues.length?ke(e,a.issues,i):{success:!0,data:a.value}})(Te);function ke(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>S(e,n,O()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}const Ae=/* @__PURE__*/ (e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?ke(e,a.issues,i):{success:!0,data:a.value}})(Te);function je(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Me(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${je({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${je({precision:e.precision})}`:n;return RegExp(`^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:${r})$`)}const Ne=/^[\s\S]{0,}$/,Pe=/^-?\d+(?:\.\d+)?$/,Fe=/^(?:true|false)$/i,Ie=/*@__PURE__*/ T(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Le=e=>{let t=e.value;return!c(t)&&t.length!==void 0},Re=/*@__PURE__*/ T(`$ZodCheckMinLength`,(e,t)=>{var n;Ie.init(e,t),(n=e._zod.def).when??(n.when=Le),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?re(r):i)>=t.minimum)return;let a=ie(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ze=/*@__PURE__*/ T(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Ie.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Be=/*@__PURE__*/ T(`$ZodCheckRegex`,(e,t)=>{ze.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Ve={major:4,minor:6,patch:5},k=/*@__PURE__*/ T(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ve;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=y(t),a;for(let o of n){if(o._zod.def.when){if(ee(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new E;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(te(t.issues,n,e),i||=y(t,n))});else{if(t.issues.length===n)continue;te(t.issues,n,e),i||=y(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(y(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new E;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new E;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return ce(this,`~standard`,We(this))},set"~standard"(e){se(this,`~standard`,e)}}),He=(e,t)=>e.issues.length?{issues:e.issues.map(e=>S(e,t,O()))}:{value:e.value};async function Ue(e,t){let n={async:!0};return He(await e._zod.run({value:t,issues:[]},n),n)}function We(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return He(r,n)}catch{}return Ue(e,t)},vendor:`zod`,version:1}}const Ge=/*@__PURE__*/ T(`$ZodString`,(e,t)=>{k.init(e,t),e._zod.pattern=t.pattern??Ne,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),Ke=/*@__PURE__*/ T(`$ZodStringFormat`,(e,t)=>{ze.init(e,t),Ge.init(e,t)}),qe=/*@__PURE__*/ T(`$ZodISODateTime`,(e,t)=>{t.pattern??=Me(t),Ke.init(e,t)}),Je=/*@__PURE__*/ T(`$ZodNumber`,(e,t)=>{k.init(e,t),e._zod.pattern=Pe,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Ye=/*@__PURE__*/ T(`$ZodBoolean`,(e,t)=>{k.init(e,t),e._zod.pattern=Fe,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Xe=/*@__PURE__*/ T(`$ZodAny`,(e,t)=>{k.init(e,t),e._zod.parse=e=>e}),Ze=/*@__PURE__*/ T(`$ZodUnknown`,(e,t)=>{k.init(e,t),e._zod.parse=e=>e}),Qe=/*@__PURE__*/ T(`$ZodVoid`,(e,t)=>{k.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`void`,code:`invalid_type`,input:r,inst:e}),t}});function $e(e,t,n){e.issues.length&&t.issues.push(...b(n,e.issues)),t.value[n]=e.value}const et=/*@__PURE__*/ T(`$ZodArray`,(e,t)=>{k.init(e,t);let n=D.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>$e(t,r,e)));else if($e(c,r,e),s&&c.issues.length!==0&&y(c))break}return o.length?Promise.all(o).then(()=>r):r}});function tt(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...b(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}const nt=[];function rt(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:nt,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=v(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function it(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(y(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>tt(e,n,i,t,d,f))):tt(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}const at=/*@__PURE__*/ T(`$ZodObject`,(e,t)=>{k.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=s(()=>rt(t));w(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||u(n,e,/* @__PURE__ */ new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=f,o=t.catchall,c,l=D.memoizer;l?.attach(e),e._zod.parse=(t,n)=>{c??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=l?l.alloc(e,t,{},n):{};let s=[],u=c.shape,d=n?.abortEarly,f=t.issues.length;for(let e of c.allKeys){if(d&&t.issues.length!==f){if(y(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,c=i._zod.run({value:r[e],issues:[]},n);c instanceof Promise?s.push(c.then(n=>tt(n,t,e,r,a,o))):tt(c,t,e,r,a,o)}return o?it(s,r,t,n,i.value,e,d===!0):s.length?Promise.all(s).then(()=>t):t}});function ot(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!y(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>S(e,r,O())))}),t)}const st=/*@__PURE__*/ T(`$ZodUnion`,(e,t)=>{k.init(e,t),w(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),w(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),w(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),w(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>l(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>ot(t,r,e,i)):ot(o,r,e,i)}}),ct=/*@__PURE__*/ T(`$ZodRecord`,(e,t)=>{k.init(e,t);let n=D.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!p(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=/* @__PURE__ */ new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>S(e,i,O())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...b(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...b(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&Pe.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>S(e,i,O())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...b(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...b(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),lt=/*@__PURE__*/ T(`$ZodEnum`,(e,t)=>{k.init(e,t);let n=i(t.entries),r=new Set(n);e._zod.values=r,w(e,`pattern`,e=>{let t=i(e.def.entries).filter(e=>m.has(typeof e));return RegExp(t.length?`^(${t.map(e=>h(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),ut=/*@__PURE__*/ T(`$ZodLiteral`,(e,t)=>{k.init(e,t);let n=new Set(t.values);e._zod.values=n,w(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?h(e):e?h(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),dt=/*@__PURE__*/ T(`$ZodTransform`,(e,t)=>{k.init(e,t),e._zod.optin=`optional`,D.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ve(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new E;return n.value=i,n}});function ft(e,t){return e.value=t.issues.length?void 0:t.value,e}const pt=/*@__PURE__*/ T(`$ZodOptional`,(e,t)=>{k.init(e,t),w(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,w(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?/* @__PURE__ */ new Set([...t,void 0]):void 0}),w(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${l(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>ft(e,t)):ft(e,r)}return t.innerType._zod.run(e,n)}}),mt=/*@__PURE__*/ T(`$ZodNullable`,(e,t)=>{k.init(e,t),w(e,`optin`,e=>e.def.innerType._zod.optin),w(e,`optout`,e=>e.def.innerType._zod.optout),w(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${l(t.source)}|null)$`):void 0}),w(e,`values`,e=>e.def.innerType._zod.values?/* @__PURE__ */ new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),ht=/*@__PURE__*/ T(`$ZodPipe`,(e,t)=>{k.init(e,t),w(e,`values`,e=>e.def.in._zod.values),w(e,`optin`,e=>e.def.in._zod.optin),w(e,`optout`,e=>e.def.out._zod.optout),w(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>gt(e,t.in,n)):gt(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>gt(e,t.out,n)):gt(r,t.out,n)}});function gt(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const _t=/*@__PURE__*/ T(`$ZodCustom`,(e,t)=>{Ie.init(e,t),k.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>vt(t,n,r,e));vt(i,n,r,e)}});function vt(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(ae(e))}}function yt(e){return e.checks&&=[...e.checks],e}// @__NO_SIDE_EFFECTS__
2
+ function bt(e,t){return new e(yt({type:`string`,..._(t)}))}// @__NO_SIDE_EFFECTS__
3
+ function xt(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,..._(t)})}// @__NO_SIDE_EFFECTS__
4
+ function St(e,t){return new e(yt({type:`number`,checks:[],..._(t)}))}// @__NO_SIDE_EFFECTS__
5
+ function Ct(e,t){return new e({type:`boolean`,..._(t)})}// @__NO_SIDE_EFFECTS__
6
+ function wt(e){return new e({type:`any`})}// @__NO_SIDE_EFFECTS__
7
+ function Tt(e){return new e({type:`unknown`})}// @__NO_SIDE_EFFECTS__
8
+ function Et(e,t){return new e({type:`void`,..._(t)})}// @__NO_SIDE_EFFECTS__
9
+ function A(e,t){return new Re({check:`min_length`,..._(t),minimum:e})}// @__NO_SIDE_EFFECTS__
10
+ function Dt(e,t){return new Be({check:`string_format`,format:`regex`,..._(t),pattern:e})}// @__NO_SIDE_EFFECTS__
11
+ function Ot(e,t,n){let r=_(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}// @__NO_SIDE_EFFECTS__
12
+ function kt(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,..._(n)})}const j=/*@__PURE__*/ T(`ZodMiniType`,(e,t)=>{if(!e._zod)throw Error(`Uninitialized schema in ZodMiniType.`);k.init(e,t),e.def=t,e.type=t.type},{get with(){return this.check},set with(e){se(this,`with`,e)},parse(e,t){return Ee(this,e,t,{callee:this.parse})},parseAsync(e,t){return De(this,e,t,{callee:this.parseAsync})},safeParse(e,t){return Oe(this,e,t)},safeParseAsync(e,t){return Ae(this,e,t)},check(...e){let t=this.def;return this.clone({...t,checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]},{parent:!0})},clone(e,t){return g(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},apply(e,...t){return t.length===0?e(this):e(this,...t)}}),At=/*@__PURE__*/ T(`ZodMiniString`,(e,t)=>{Ge.init(e,t),j.init(e,t)});// @__NO_SIDE_EFFECTS__
13
+ function M(e){return/* @__PURE__ */ bt(At,e)}const jt=/*@__PURE__*/ T(`ZodMiniStringFormat`,(e,t)=>{Ke.init(e,t),At.init(e,t)}),Mt=/*@__PURE__*/ T(`ZodMiniNumber`,(e,t)=>{Je.init(e,t),j.init(e,t)});// @__NO_SIDE_EFFECTS__
14
+ function N(e){return/* @__PURE__ */ St(Mt,e)}const Nt=/*@__PURE__*/ T(`ZodMiniBoolean`,(e,t)=>{Ye.init(e,t),j.init(e,t)});// @__NO_SIDE_EFFECTS__
15
+ function P(e){return/* @__PURE__ */ Ct(Nt,e)}const Pt=/*@__PURE__*/ T(`ZodMiniAny`,(e,t)=>{Xe.init(e,t),j.init(e,t)});// @__NO_SIDE_EFFECTS__
16
+ function Ft(){return/* @__PURE__ */ wt(Pt)}const It=/*@__PURE__*/ T(`ZodMiniUnknown`,(e,t)=>{Ze.init(e,t),j.init(e,t)});// @__NO_SIDE_EFFECTS__
17
+ function F(){return/* @__PURE__ */ Tt(It)}const Lt=/*@__PURE__*/ T(`ZodMiniVoid`,(e,t)=>{Qe.init(e,t),j.init(e,t)});// @__NO_SIDE_EFFECTS__
18
+ function Rt(e){return/* @__PURE__ */ Et(Lt,e)}const zt=/*@__PURE__*/ T(`ZodMiniArray`,(e,t)=>{et.init(e,t),j.init(e,t)});// @__NO_SIDE_EFFECTS__
19
+ function I(e,t){return new zt({type:`array`,element:e,..._(t)})}const Bt=/*@__PURE__*/ T(`ZodMiniObject`,(e,t)=>{at.init(e,t),j.init(e,t),pe(e,`shape`,e=>e._zod.def.shape,!1)});// @__NO_SIDE_EFFECTS__
20
+ function L(e,t){let n={type:`object`,shape:e??{},..._(t)};return new Bt(n)}const Vt=/*@__PURE__*/ T(`ZodMiniUnion`,(e,t)=>{st.init(e,t),j.init(e,t)});// @__NO_SIDE_EFFECTS__
21
+ function R(e,t){return new Vt({type:`union`,options:e,..._(t)})}const Ht=/*@__PURE__*/ T(`ZodMiniRecord`,(e,t)=>{ct.init(e,t),j.init(e,t)});// @__NO_SIDE_EFFECTS__
22
+ function z(e,t,n){return!t||!t._zod?new Ht({type:`record`,keyType:/* @__PURE__ */ M(),valueType:e,..._(t)}):new Ht({type:`record`,keyType:e,valueType:t,..._(n)})}const Ut=/*@__PURE__*/ T(`ZodMiniEnum`,(e,t)=>{lt.init(e,t),j.init(e,t),e.options=[...e._zod.values]});// @__NO_SIDE_EFFECTS__
23
+ function B(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Ut({type:`enum`,entries:n,..._(t)})}const Wt=/*@__PURE__*/ T(`ZodMiniLiteral`,(e,t)=>{ut.init(e,t),j.init(e,t)});// @__NO_SIDE_EFFECTS__
24
+ function V(e,t){return new Wt({type:`literal`,values:Array.isArray(e)?e:[e],..._(t)})}const Gt=/*@__PURE__*/ T(`ZodMiniTransform`,(e,t)=>{dt.init(e,t),j.init(e,t)});// @__NO_SIDE_EFFECTS__
25
+ function Kt(e){return new Gt({type:`transform`,transform:e})}const qt=/*@__PURE__*/ T(`ZodMiniOptional`,(e,t)=>{pt.init(e,t),j.init(e,t)});// @__NO_SIDE_EFFECTS__
26
+ function H(e){return new qt({type:`optional`,innerType:e})}const Jt=/*@__PURE__*/ T(`ZodMiniNullable`,(e,t)=>{mt.init(e,t),j.init(e,t)});// @__NO_SIDE_EFFECTS__
27
+ function Yt(e){return new Jt({type:`nullable`,innerType:e})}const Xt=/*@__PURE__*/ T(`ZodMiniPipe`,(e,t)=>{ht.init(e,t),j.init(e,t)});// @__NO_SIDE_EFFECTS__
28
+ function Zt(e,t){return new Xt({type:`pipe`,in:e,out:t})}const Qt=/*@__PURE__*/ T(`ZodMiniCustom`,(e,t)=>{_t.init(e,t),j.init(e,t)});// @__NO_SIDE_EFFECTS__
29
+ function $t(e,t){return/* @__PURE__ */ Ot(Qt,e??(()=>!0),t)}// @__NO_SIDE_EFFECTS__
30
+ function en(e,t={}){return/* @__PURE__ */ kt(Qt,e,t)}const tn=/*@__PURE__*/ T(`ZodMiniISODateTime`,(e,t)=>{qe.init(e,t),jt.init(e,t)});// @__NO_SIDE_EFFECTS__
31
+ function nn(e){return/* @__PURE__ */ xt(tn,e)}const U=/* @__PURE__ */ L({displayName:/* @__PURE__ */ M(),description:/* @__PURE__ */ H(/* @__PURE__ */ M()),advanced:/* @__PURE__ */ H(/* @__PURE__ */ P()),width:/* @__PURE__ */ H(/* @__PURE__ */ B([`half`,`full`])),icon:/* @__PURE__ */ H(/* @__PURE__ */ M()),placeholder:/* @__PURE__ */ H(/* @__PURE__ */ M())}),W=(e,t)=>/* @__PURE__ */ L({type:/* @__PURE__ */ V(t),required:/* @__PURE__ */ P(),defaultValue:/* @__PURE__ */ H(/* @__PURE__ */ Ft())}),rn=/* @__PURE__ */ L({...U.shape,...W(/* @__PURE__ */ M(),`SHORT_TEXT`).shape}),an=/* @__PURE__ */ L({...U.shape,...W(/* @__PURE__ */ M(),`LONG_TEXT`).shape}),on=/* @__PURE__ */ L({disabled:/* @__PURE__ */ H(/* @__PURE__ */ P()),placeholder:/* @__PURE__ */ H(/* @__PURE__ */ M()),options:/* @__PURE__ */ I(/* @__PURE__ */ L({label:/* @__PURE__ */ M(),value:/* @__PURE__ */ F(),description:/* @__PURE__ */ H(/* @__PURE__ */ M()),icon:/* @__PURE__ */ H(/* @__PURE__ */ M())}))}),sn=/* @__PURE__ */ B([`cards`]),cn=/* @__PURE__ */ L({...U.shape,options:on,display:/* @__PURE__ */ H(sn),...W(/* @__PURE__ */ F(),`STATIC_DROPDOWN`).shape}),ln=/* @__PURE__ */ L({...U.shape,options:on,...W(/* @__PURE__ */ I(/* @__PURE__ */ F()),`STATIC_MULTI_SELECT_DROPDOWN`).shape}),un=/* @__PURE__ */ L({...U.shape,reveals:/* @__PURE__ */ H(/* @__PURE__ */ I(/* @__PURE__ */ M())),...W(/* @__PURE__ */ P(),`CHECKBOX`).shape}),dn=/* @__PURE__ */ L({...U.shape,display:/* @__PURE__ */ H(/* @__PURE__ */ B([`stepper`])),min:/* @__PURE__ */ H(/* @__PURE__ */ N()),max:/* @__PURE__ */ H(/* @__PURE__ */ N()),step:/* @__PURE__ */ H(/* @__PURE__ */ N()),...W(/* @__PURE__ */ N(),`NUMBER`).shape}),fn=/* @__PURE__ */ L({...U.shape,streaming:/* @__PURE__ */ H(/* @__PURE__ */ P()),...W(/* @__PURE__ */ F(),`FILE`).shape}),pn=/* @__PURE__ */ L({preset:/* @__PURE__ */ H(/* @__PURE__ */ B([`any_time`,`last_24_hours`,`last_7_days`,`last_30_days`,`last_90_days`,`this_month`,`custom`])),after:/* @__PURE__ */ H(/* @__PURE__ */ M()),before:/* @__PURE__ */ H(/* @__PURE__ */ M())}),mn=/* @__PURE__ */ L({...U.shape,display:/* @__PURE__ */ H(/* @__PURE__ */ B([`dropdown`])),...W(pn,`DATE_RANGE`).shape});let hn=/* @__PURE__ */ function(e){return e.BORDERLESS=`BORDERLESS`,e.INFO=`INFO`,e.WARNING=`WARNING`,e.TIP=`TIP`,e}({});function gn(e){return e==null}const _n=/* @__PURE__ */ L({...U.shape,...W(/* @__PURE__ */ Rt(),`MARKDOWN`).shape,variant:/* @__PURE__ */ H(/* @__PURE__ */ B(hn))}),vn=/* @__PURE__ */ L({retryOnFailure:/* @__PURE__ */ L({defaultValue:/* @__PURE__ */ H(/* @__PURE__ */ P()),hide:/* @__PURE__ */ H(/* @__PURE__ */ P())}),continueOnFailure:/* @__PURE__ */ L({defaultValue:/* @__PURE__ */ H(/* @__PURE__ */ P()),hide:/* @__PURE__ */ H(/* @__PURE__ */ P())})});var yn=class{name;displayName;description;props;propertyGroups;run;test;requireAuth;errorHandlingOptions;outputSchema;audience;aiMetadata;classification;constructor(e,t,n,r,i,a,o,s,c,l,u,d,f){this.name=e,this.displayName=t,this.description=n,this.props=r,this.propertyGroups=i,this.run=a,this.test=o,this.requireAuth=s,this.errorHandlingOptions=c,this.outputSchema=l,this.audience=u,this.aiMetadata=d,this.classification=f}};const bn=e=>new yn(e.name,e.displayName,e.description,e.props,e.propertyGroups,e.run,e.test??e.run,e.requireAuth??!0,e.errorHandlingOptions??{continueOnFailure:{defaultValue:!1},retryOnFailure:{defaultValue:!1}},e.outputSchema,e.audience,e.aiMetadata,e.classification),xn=/* @__PURE__ */ L({...U.shape,...W(/* @__PURE__ */ F(),`DROPDOWN`).shape,refreshers:/* @__PURE__ */ I(/* @__PURE__ */ M())}),Sn=/* @__PURE__ */ L({...U.shape,...W(/* @__PURE__ */ I(/* @__PURE__ */ F()),`MULTI_SELECT_DROPDOWN`).shape,refreshers:/* @__PURE__ */ I(/* @__PURE__ */ M())}),Cn=/* @__PURE__ */ L({...U.shape,...W(/* @__PURE__ */ R([/* @__PURE__ */ z(/* @__PURE__ */ M(),/* @__PURE__ */ F())]),`JSON`).shape}),wn=/* @__PURE__ */ L({...U.shape,...W(/* @__PURE__ */ M(),`COLOR`).shape}),Tn=/* @__PURE__ */ L({...U.shape,...W(/* @__PURE__ */ M(),`DATE_TIME`).shape}),En=/* @__PURE__ */ z(/* @__PURE__ */ M(),/* @__PURE__ */ R([rn,an,cn,Sn,ln,un,dn,fn,Cn,wn,Tn])),Dn=/* @__PURE__ */ L({...U.shape,properties:/* @__PURE__ */ H(En),...W(/* @__PURE__ */ I(/* @__PURE__ */ F()),`ARRAY`).shape}),On=/* @__PURE__ */ L({refreshers:/* @__PURE__ */ I(/* @__PURE__ */ M()),...U.shape,...W(/* @__PURE__ */ F(),`DYNAMIC`).shape}),kn=/* @__PURE__ */ L({...U.shape,...W(/* @__PURE__ */ z(/* @__PURE__ */ M(),/* @__PURE__ */ F()),`OBJECT`).shape}),An=/* @__PURE__ */ R([rn,an,/* @__PURE__ */ L({...U.shape,formatProperty:/* @__PURE__ */ H(/* @__PURE__ */ M()),...W(/* @__PURE__ */ M(),`RICH_TEXT`).shape}),_n,un,cn,ln,xn,Sn,On,dn,Dn,kn,Cn,Tn,mn,fn,/* @__PURE__ */ L({...U.shape,...W(/* @__PURE__ */ F(),`CUSTOM`).shape,code:/* @__PURE__ */ M()}),wn]),jn={ShortText(e){return{...e,valueSchema:void 0,type:`SHORT_TEXT`}},Checkbox(e){return{...e,valueSchema:void 0,type:`CHECKBOX`}},LongText(e){return{...e,valueSchema:void 0,type:`LONG_TEXT`}},RichText(e){return{...e,valueSchema:void 0,type:`RICH_TEXT`}},MarkDown(e){return{displayName:`Markdown`,required:!1,description:e.value,type:`MARKDOWN`,valueSchema:void 0,variant:e.variant??`INFO`}},Number(e){return{...e,valueSchema:void 0,type:`NUMBER`}},Json(e){return{...e,valueSchema:void 0,type:`JSON`}},Array(e){return{...e,valueSchema:void 0,type:`ARRAY`}},Object(e){return{...e,valueSchema:void 0,type:`OBJECT`}},Dropdown(e){return{...e,valueSchema:void 0,type:`DROPDOWN`}},StaticDropdown(e){return{...e,valueSchema:void 0,type:`STATIC_DROPDOWN`}},MultiSelectDropdown(e){return{...e,valueSchema:void 0,type:`MULTI_SELECT_DROPDOWN`}},DynamicProperties(e){return{...e,valueSchema:void 0,type:`DYNAMIC`}},StaticMultiSelectDropdown(e){return{...e,valueSchema:void 0,type:`STATIC_MULTI_SELECT_DROPDOWN`}},DateTime(e){return{...e,valueSchema:void 0,type:`DATE_TIME`}},DateRange(e){return{...e,valueSchema:void 0,type:`DATE_RANGE`}},File(e){return{...e,valueSchema:void 0,type:`FILE`}},Custom(e){let t=e.code.toString();return{...e,code:t,valueSchema:void 0,type:`CUSTOM`}},Color(e){return{...e,valueSchema:void 0,type:`COLOR`}}};let Mn=/* @__PURE__ */ function(e){return e.AUTHORIZATION_CODE=`authorization_code`,e.CLIENT_CREDENTIALS=`client_credentials`,e}({}),Nn=/* @__PURE__ */ function(e){return e.POLLING=`POLLING`,e.WEBHOOK=`WEBHOOK`,e.APP_WEBHOOK=`APP_WEBHOOK`,e.MANUAL=`MANUAL`,e}({}),Pn=/* @__PURE__ */ function(e){return e.SIMULATION=`SIMULATION`,e.TEST_FUNCTION=`TEST_FUNCTION`,e}({});const Fn=/* @__PURE__ */ L({displayName:/* @__PURE__ */ M(),description:/* @__PURE__ */ H(/* @__PURE__ */ M()),hasConnectionIdentifier:/* @__PURE__ */ H(/* @__PURE__ */ P())}),In=/* @__PURE__ */ L({username:/* @__PURE__ */ M(),password:/* @__PURE__ */ M()}),Ln=/* @__PURE__ */ L({...Fn.shape,username:/* @__PURE__ */ L({displayName:/* @__PURE__ */ M(),description:/* @__PURE__ */ H(/* @__PURE__ */ M())}),password:/* @__PURE__ */ L({displayName:/* @__PURE__ */ M(),description:/* @__PURE__ */ H(/* @__PURE__ */ M())}),...W(In,`BASIC_AUTH`).shape}),Rn=/* @__PURE__ */ L({...Fn.shape,...W(/* @__PURE__ */ L({auth:/* @__PURE__ */ M()}),`SECRET_TEXT`).shape}),zn=/* @__PURE__ */ z(/* @__PURE__ */ M(),/* @__PURE__ */ R([rn,an,Rn,dn,cn,un,_n,ln])),Bn=/* @__PURE__ */ L({...Fn.shape,props:zn,...W(/* @__PURE__ */ F(),`CUSTOM_AUTH`).shape}),Vn=/* @__PURE__ */ z(/* @__PURE__ */ M(),/* @__PURE__ */ R([rn,an,Rn,dn,un,cn,ln,_n])),Hn=/* @__PURE__ */ L({...Fn.shape,props:Vn,...W(/* @__PURE__ */ F(),`OIDC`).shape});let Un=/* @__PURE__ */ function(e){return e.HEADER=`HEADER`,e.BODY=`BODY`,e}({});const Wn=/* @__PURE__ */ R([rn,Rn,cn]),Gn=/* @__PURE__ */ z(/* @__PURE__ */ M(),Wn),Kn=/* @__PURE__ */ L({props:/* @__PURE__ */ H(/* @__PURE__ */ z(/* @__PURE__ */ M(),Wn)),authUrl:/* @__PURE__ */ M(),tokenUrl:/* @__PURE__ */ M(),scope:/* @__PURE__ */ I(/* @__PURE__ */ M()),prompt:/* @__PURE__ */ H(/* @__PURE__ */ R([/* @__PURE__ */ V(`none`),/* @__PURE__ */ V(`consent`),/* @__PURE__ */ V(`login`),/* @__PURE__ */ V(`omit`)])),pkce:/* @__PURE__ */ H(/* @__PURE__ */ P()),pkceMethod:/* @__PURE__ */ H(/* @__PURE__ */ R([/* @__PURE__ */ V(`plain`),/* @__PURE__ */ V(`S256`)])),authorizationMethod:/* @__PURE__ */ H(/* @__PURE__ */ B(Un)),grantType:/* @__PURE__ */ H(/* @__PURE__ */ R([/* @__PURE__ */ B(Mn),/* @__PURE__ */ V(`both_client_credentials_and_authorization_code`)])),extra:/* @__PURE__ */ H(/* @__PURE__ */ z(/* @__PURE__ */ M(),/* @__PURE__ */ M())),discovery:/* @__PURE__ */ H(/* @__PURE__ */ L({serverUrlProp:/* @__PURE__ */ M(),authUrlProp:/* @__PURE__ */ M(),tokenUrlProp:/* @__PURE__ */ M(),scopesProp:/* @__PURE__ */ H(/* @__PURE__ */ M())}))}),qn=/* @__PURE__ */ L({access_token:/* @__PURE__ */ M(),props:/* @__PURE__ */ H(Gn),data:/* @__PURE__ */ z(/* @__PURE__ */ M(),/* @__PURE__ */ Ft())}),Jn=/* @__PURE__ */ R([Ln,Bn,Hn,/* @__PURE__ */ L({...Fn.shape,...Kn.shape,...W(qn,`OAUTH2`).shape}),Rn]);let G,K,Yn=t=>{if(t<0)throw RangeError(`Wrong ID size`);try{!G||G.length<t?(G=Buffer.allocUnsafe(t*128),e.randomFillSync(G),K=0):K+t>G.length&&(e.randomFillSync(G),K=0)}catch(e){throw G=void 0,e}K+=t},Xn=e=>(Yn(e|=0),G.subarray(K-e,K)),Zn=(e,t,n)=>{let r=(2<<31-Math.clz32(e.length-1|1))-1,i=Math.ceil(1.6*r*t/e.length);return(a=t)=>{if(a<=0)return``;let o=``;for(;;){let t=n(i),s=i;for(;s--;)if(o+=e[t[s]&r]||``,o.length===a)return o}}},Qn=(e,t=21)=>Zn(e,t,Xn),$n=/* @__PURE__ */ function(e){return e.ARCHIVE=`ARCHIVE`,e.REGISTRY=`REGISTRY`,e}({}),er=/* @__PURE__ */ function(e){return e.CUSTOM=`CUSTOM`,e.OFFICIAL=`OFFICIAL`,e}({}),tr=/* @__PURE__ */ function(e){return e.ARTIFICIAL_INTELLIGENCE=`ARTIFICIAL_INTELLIGENCE`,e.COMMUNICATION=`COMMUNICATION`,e.COMMERCE=`COMMERCE`,e.CORE=`CORE`,e.UNIVERSAL_AI=`UNIVERSAL_AI`,e.FLOW_CONTROL=`FLOW_CONTROL`,e.BUSINESS_INTELLIGENCE=`BUSINESS_INTELLIGENCE`,e.ACCOUNTING=`ACCOUNTING`,e.PRODUCTIVITY=`PRODUCTIVITY`,e.CONTENT_AND_FILES=`CONTENT_AND_FILES`,e.DEVELOPER_TOOLS=`DEVELOPER_TOOLS`,e.CUSTOMER_SUPPORT=`CUSTOMER_SUPPORT`,e.FORMS_AND_SURVEYS=`FORMS_AND_SURVEYS`,e.HUMAN_RESOURCES=`HUMAN_RESOURCES`,e.PAYMENT_PROCESSING=`PAYMENT_PROCESSING`,e.MARKETING=`MARKETING`,e.SALES_AND_CRM=`SALES_AND_CRM`,e}({});(/* @__PURE__ */ M()).check(/* @__PURE__ */ Dt(/* @__PURE__ */ RegExp(`^[0-9a-zA-Z]{21}$`))),Qn(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`,21);const nr=/* @__PURE__ */ Zt(/* @__PURE__ */ Kt(e=>e instanceof Date?e.toISOString():e),/* @__PURE__ */ M()),rr={id:/* @__PURE__ */ M(),created:nr,updated:nr},ir=e=>/* @__PURE__ */ H(/* @__PURE__ */ Yt(e));(/* @__PURE__ */ nn({offset:!0})).check(/* @__PURE__ */ en(e=>e.slice(0,4)!==`0000`));let ar=/* @__PURE__ */ function(e){return e.DUTCH=`nl`,e.ENGLISH=`en`,e.GERMAN=`de`,e.FRENCH=`fr`,e.SPANISH=`es`,e.JAPANESE=`ja`,e.CHINESE_SIMPLIFIED=`zh`,e.PORTUGUESE=`pt`,e.ARABIC=`ar`,e.CHINESE_TRADITIONAL=`zh-TW`,e}({}),or=/* @__PURE__ */ function(e){return e.IN_PROGRESS=`in-progress`,e.COMPLETED=`completed`,e}({});(/* @__PURE__ */ M()).check(/* @__PURE__ */ A(1)),(/* @__PURE__ */ M()).check(/* @__PURE__ */ A(1)),(/* @__PURE__ */ M()).check(/* @__PURE__ */ A(1)),(/* @__PURE__ */ M()).check(/* @__PURE__ */ A(1));const sr={type:/* @__PURE__ */ V(`TOOL_CALL`),input:ir(/* @__PURE__ */ z(/* @__PURE__ */ M(),/* @__PURE__ */ F())),output:/* @__PURE__ */ H(/* @__PURE__ */ F()),toolName:/* @__PURE__ */ M(),status:/* @__PURE__ */ B(or),toolCallId:/* @__PURE__ */ M(),startTime:/* @__PURE__ */ M(),endTime:/* @__PURE__ */ H(/* @__PURE__ */ M())};({...sr}),{...sr},{...sr},{...sr},{...sr},(/* @__PURE__ */ M()).check(/* @__PURE__ */ A(1)),(/* @__PURE__ */ M()).check(/* @__PURE__ */ A(1)),(/* @__PURE__ */ M()).check(/* @__PURE__ */ A(1)),(/* @__PURE__ */ M()).check(/* @__PURE__ */ A(1)),(/* @__PURE__ */ M()).check(/* @__PURE__ */ Dt(/^[a-z0-9][a-z0-9-]{0,62}$/)),(/* @__PURE__ */ M()).check(/* @__PURE__ */ Dt(/^[a-z0-9][a-z0-9-]{0,62}$/));const cr=[`gpt-5.5`,`gpt-5.6-sol`,`gpt-5.6-terra`,`gpt-5.6-luna`,`gpt-5.4-mini`,`gpt-5.4-nano`,`gpt-4.1`,`gpt-4.1-mini`],lr=[`claude-sonnet-5-5`,`claude-opus-5-5`,`claude-haiku-5-5`],ur=[`claude-sonnet-4.6`,`claude-opus-4.7`,`claude-opus-4.8`,`claude-haiku-4.5`],dr=[`gemini-3.7-flash`,`gemini-3.1-pro-preview`,`gemini-3-flash-preview`],fr=[`gemini-2.5-pro`,`gemini-2.5-flash`],pr=[`grok-4.20`];[...ur.map(e=>`anthropic/${e}`)];const mr={openai:cr,anthropic:lr,google:dr,vertex:dr,activepieces:[...ur.map(e=>`anthropic/${e}`),...cr.map(e=>`openai/${e}`),...[...dr,...fr].map(e=>`google/${e}`),...pr.map(e=>`x-ai/${e}`)]},hr=128e3,gr={openai:128e3,anthropic:2e5,google:1048576,bedrock:2e5,vertex:1048576,azure:128e3,openrouter:128e3,activepieces:2e5,mistral:128e3};function _r({provider:e}){return e?gr[e]??hr:hr}const vr={openai:[`text-embedding-3-small`,`text-embedding-3-large`],google:[`text-embedding-004`,`gemini-embedding-001`],azure:[`text-embedding-3-small`,`text-embedding-3-large`],activepieces:[`text-embedding-3-small`],openrouter:[`openai/text-embedding-3-small`,`openai/text-embedding-3-large`]},yr={anthropic:`native`,google:`native`,openrouter:`plugin`,activepieces:`plugin`},br=/* @__PURE__ */ new Set([`anthropic`,`mistral`,`xai`,`deepseek`,`zai`,`qwen`,`minimax`,`moonshot`]);function q(e){return{chatModels:mr[e],maxContextTokens:_r({provider:e}),embeddingModels:vr[e]??[],defaultEmbeddingModel:vr[e]?.[0],supportsEmbedding:(vr[e]??[]).length>0,supportsImageGeneration:!br.has(e),defaultImageModel:xr[e],webSearch:yr[e]}}const xr={activepieces:{id:`fast`,label:`Fast`,modelId:`google/gemini-3.1-flash-lite-image`}.modelId,openrouter:`google/gemini-3.1-flash-lite-image`,openai:`gpt-image-1.5`,google:`gemini-3.1-flash-image`};q(`openai`),q(`anthropic`),q(`openrouter`),q(`azure`),q(`google`),q(`cloudflare-gateway`),q(`custom`),q(`bedrock`),q(`vertex`),q(`mistral`),q(`activepieces`),q(`xai`),q(`deepseek`),q(`zai`),q(`qwen`),q(`minimax`),q(`moonshot`),{...rr},{...rr},{...rr},{...rr},{...rr};const Sr=/* @__PURE__ */ z(/* @__PURE__ */ M(),/* @__PURE__ */ R([An,Jn])),Cr=/* @__PURE__ */ R([/* @__PURE__ */ L({strategy:/* @__PURE__ */ V(`CRON`),cronExpression:/* @__PURE__ */ M()}),/* @__PURE__ */ L({strategy:/* @__PURE__ */ V(`NONE`)})]);var wr=class{name;displayName;description;requireAuth;props;type;handshakeConfiguration;onHandshake;renewConfiguration;onRenew;onEnable;onDisable;onStart;run;test;sampleData;testStrategy;outputSchema;aiMetadata;classification;propertyGroups;constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,ee){this.name=e,this.displayName=t,this.description=n,this.requireAuth=r,this.props=i,this.type=a,this.handshakeConfiguration=o,this.onHandshake=s,this.renewConfiguration=c,this.onRenew=l,this.onEnable=u,this.onDisable=d,this.onStart=f,this.run=p,this.test=m,this.sampleData=h,this.testStrategy=g,this.outputSchema=_,this.aiMetadata=v,this.classification=y,this.propertyGroups=ee}};const Tr=e=>{switch(e.type){case`WEBHOOK`:return new wr(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,e.handshakeConfiguration??{strategy:`NONE`},e.onHandshake??(async()=>({status:200})),e.renewConfiguration??{strategy:`NONE`},e.onRenew??(async()=>Promise.resolve()),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,e.test?`TEST_FUNCTION`:`SIMULATION`,e.outputSchema,e.aiMetadata,e.classification,e.propertyGroups);case`POLLING`:return new wr(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,{strategy:`NONE`},async()=>({status:200}),{strategy:`NONE`},async()=>Promise.resolve(),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,`TEST_FUNCTION`,e.outputSchema,e.aiMetadata,e.classification,e.propertyGroups);case`MANUAL`:return new wr(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,{strategy:`NONE`},async()=>({status:200}),{strategy:`NONE`},async()=>Promise.resolve(),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,`TEST_FUNCTION`,e.outputSchema,e.aiMetadata,e.classification,e.propertyGroups);case`APP_WEBHOOK`:return new wr(e.name,e.displayName,e.description,e.requireAuth??!0,e.props,e.type,{strategy:`NONE`},async()=>({status:200}),{strategy:`NONE`},async()=>Promise.resolve(),e.onEnable,e.onDisable,e.onStart??(async()=>Promise.resolve()),e.run,e.test??(()=>Promise.resolve([e.sampleData])),e.sampleData,gn(e.sampleData)&&gn(e.test)?`SIMULATION`:`TEST_FUNCTION`,e.outputSchema,e.aiMetadata,e.classification,e.propertyGroups);default:{let{name:t,type:n,strategy:r}=e;throw Error(n===void 0&&r!==void 0?`createTrigger: trigger ${JSON.stringify(t)} sets \`strategy\`; the field is \`type\`, e.g. type: TriggerStrategy.POLLING`:`createTrigger: trigger ${JSON.stringify(t)} has \`type\` ${JSON.stringify(n)}; set type: TriggerStrategy.POLLING or TriggerStrategy.WEBHOOK`)}}},Er=`0.82.0`;var Dr=class{displayName;logoUrl;authors;events;categories;auth;minimumSupportedRelease;maximumSupportedRelease;description;deprecated;_actions={};_triggers={};getContextInfo=()=>({version:`2`});constructor(e,t,n,r,i,a,o,s,c=Er,l,u=``,d){this.displayName=e,this.logoUrl=t,this.authors=n,this.events=r,this.categories=o,this.auth=s,this.minimumSupportedRelease=c,this.maximumSupportedRelease=l,this.description=u,this.deprecated=d,(!jr(c)||Mr(c,`0.82.0`))&&(this.minimumSupportedRelease=Er),i.forEach(e=>this._actions[e.name]=e),a.forEach(e=>this._triggers[e.name]=e)}metadata(){return{displayName:this.displayName,logoUrl:this.logoUrl,actions:this._actions,triggers:this._triggers,categories:this.categories,description:this.description,authors:this.authors,auth:kr(this.auth),minimumSupportedRelease:this.minimumSupportedRelease,maximumSupportedRelease:this.maximumSupportedRelease,deprecated:this.deprecated,contextInfo:this.getContextInfo?.()}}getAction(e){return this._actions[e]}getTrigger(e){return this._triggers[e]}actions(){return this._actions}triggers(){return this._triggers}};const Or=e=>{if(e.auth&&Array.isArray(e.auth)&&!e.auth.every((e,t,n)=>t===n.findIndex(t=>t.type===e.type)))throw Error(`Auth properties must be unique by type`);return new Dr(e.displayName,e.logoUrl,e.authors??[],e.events,e.actions,e.triggers,e.categories??[],e.auth,e.minimumSupportedRelease,e.maximumSupportedRelease,e.description,e.deprecated)};function kr(e){if(e!==void 0)return Array.isArray(e)?e.map(Ar):Ar(e)}function Ar(e){return{...e,hasConnectionIdentifier:e.getConnectionIdentifier!==void 0}}function jr(e){return/^\d+\.\d+\.\d+$/.test(e)}function Mr(e,t){let[n,r,i]=e.split(`.`).map(Number),[a,o,s]=t.split(`.`).map(Number);return n===a?r===o?i<s:r<o:n<a}const Nr=/* @__PURE__ */ L({id:/* @__PURE__ */ H(/* @__PURE__ */ M()),name:/* @__PURE__ */ M(),displayName:/* @__PURE__ */ M(),logoUrl:/* @__PURE__ */ M(),description:/* @__PURE__ */ M(),authors:/* @__PURE__ */ I(/* @__PURE__ */ M()),platformId:/* @__PURE__ */ H(/* @__PURE__ */ M()),directoryPath:/* @__PURE__ */ H(/* @__PURE__ */ M()),auth:/* @__PURE__ */ H(/* @__PURE__ */ R([Jn,/* @__PURE__ */ I(Jn)])),version:/* @__PURE__ */ M(),categories:/* @__PURE__ */ H(/* @__PURE__ */ I(/* @__PURE__ */ B(tr))),minimumSupportedRelease:/* @__PURE__ */ H(/* @__PURE__ */ M()),maximumSupportedRelease:/* @__PURE__ */ H(/* @__PURE__ */ M()),deprecated:/* @__PURE__ */ H(/* @__PURE__ */ P()),i18n:/* @__PURE__ */ H(/* @__PURE__ */ z(/* @__PURE__ */ M(),/* @__PURE__ */ z(/* @__PURE__ */ M(),/* @__PURE__ */ M())))}),Pr=/* @__PURE__ */ B([`human`,`ai`,`both`]),Fr=/* @__PURE__ */ L({description:/* @__PURE__ */ H(/* @__PURE__ */ M()),idempotent:/* @__PURE__ */ H(/* @__PURE__ */ P())}),Ir=/* @__PURE__ */ B([`READ`,`SEARCH`,`WRITE`,`DESTRUCTIVE`]),Lr=/* @__PURE__ */ L({key:/* @__PURE__ */ M(),display:/* @__PURE__ */ B([`tabs`,`section`,`summary`,`builder`,`footer`]),label:/* @__PURE__ */ H(/* @__PURE__ */ M()),description:/* @__PURE__ */ H(/* @__PURE__ */ M()),icon:/* @__PURE__ */ H(/* @__PURE__ */ M()),props:/* @__PURE__ */ I(/* @__PURE__ */ M())}),Rr=/* @__PURE__ */ L({name:/* @__PURE__ */ M(),displayName:/* @__PURE__ */ M(),description:/* @__PURE__ */ M(),props:Sr,propertyGroups:/* @__PURE__ */ H(/* @__PURE__ */ I(Lr)),requireAuth:/* @__PURE__ */ P(),errorHandlingOptions:/* @__PURE__ */ H(vn),outputSchema:/* @__PURE__ */ H(/* @__PURE__ */ $t()),audience:/* @__PURE__ */ H(Pr),aiMetadata:/* @__PURE__ */ H(Fr),classification:/* @__PURE__ */ H(Ir)}),zr=/* @__PURE__ */ L({name:/* @__PURE__ */ M(),displayName:/* @__PURE__ */ M(),description:/* @__PURE__ */ M(),props:Sr,propertyGroups:/* @__PURE__ */ H(/* @__PURE__ */ I(Lr)),errorHandlingOptions:/* @__PURE__ */ H(vn),type:/* @__PURE__ */ B(Nn),sampleData:/* @__PURE__ */ F(),handshakeConfiguration:/* @__PURE__ */ H(/* @__PURE__ */ $t()),renewConfiguration:/* @__PURE__ */ H(Cr),testStrategy:/* @__PURE__ */ B(Pn),outputSchema:/* @__PURE__ */ H(/* @__PURE__ */ $t()),aiMetadata:/* @__PURE__ */ H(Fr),classification:/* @__PURE__ */ H(Ir)}),Br=/* @__PURE__ */ L({...Nr.shape,actions:/* @__PURE__ */ z(/* @__PURE__ */ M(),Rr),triggers:/* @__PURE__ */ z(/* @__PURE__ */ M(),zr)}),Vr=/* @__PURE__ */ L({...Nr.shape,actions:/* @__PURE__ */ N(),triggers:/* @__PURE__ */ N(),suggestedActions:/* @__PURE__ */ H(/* @__PURE__ */ I(Rr)),suggestedTriggers:/* @__PURE__ */ H(/* @__PURE__ */ I(zr))}),Hr=/* @__PURE__ */ L({projectUsage:/* @__PURE__ */ N(),pieceType:/* @__PURE__ */ B(er),packageType:/* @__PURE__ */ B($n),platformId:/* @__PURE__ */ H(/* @__PURE__ */ M()),archiveId:/* @__PURE__ */ H(/* @__PURE__ */ M())});({...Br.shape,...Hr.shape}),{...Vr.shape,...Hr.shape};const Ur={translatePiece:({piece:e,locale:t})=>{let n=t?e.i18n?.[t]:void 0;return n?Yr({node:e,tree:qr(e.categories)?Gr:Wr,translations:n}):e},pathsToTranslate:e=>qr(e)?[...Ur.pathsToValuesToTranslate,`displayName`]:Ur.pathsToValuesToTranslate,initializeI18n:async e=>{try{let t=Object.values(ar),n={};for(let r of t){let t=await $r(r,e);t&&(n[r]=t)}return Object.keys(n).length>0?n:void 0}catch(t){console.log(`Error initializing i18n for ${e}:`,t);return}},pathsToValuesToTranslate:[`description`,`auth.username.displayName`,`auth.username.description`,`auth.password.displayName`,`auth.password.description`,`auth.props.*.displayName`,`auth.props.*.description`,`auth.props.*.options.options.*.label`,`auth.description`,`actions.*.displayName`,`actions.*.description`,`actions.*.props.*.displayName`,`actions.*.props.*.description`,`actions.*.props.*.options.options.*.label`,`actions.*.propertyGroups.*.label`,`actions.*.propertyGroups.*.description`,`triggers.*.displayName`,`triggers.*.description`,`triggers.*.props.*.displayName`,`triggers.*.props.*.description`,`triggers.*.props.*.options.options.*.label`,`triggers.*.propertyGroups.*.label`,`triggers.*.propertyGroups.*.description`]},Wr=Kr(Ur.pathsToTranslate()),Gr=Kr(Ur.pathsToTranslate([`CORE`]));function Kr(e){return e.reduce((e,t)=>Jr({tree:e,keys:t.split(`.`)}),{})}function qr(e){return e?.includes(`CORE`)??!1}function Jr({tree:e,keys:[t,...n]}){return{...e,[t]:n.length===0?null:Jr({tree:e[t]??{},keys:n})}}function Yr({node:e,tree:t,translations:n}){if(!Zr(e))return e;let r={},i=!1;for(let[a,o]of Object.entries(t))for(let t of a===`*`?Object.keys(e):[a]){let a=e[t],s=o===null?Xr({value:a,translations:n}):Yr({node:a,tree:o,translations:n});s!==a&&(r[t]=s,i=!0)}return i?Object.assign(Array.isArray(e)?[]:{},e,r):e}function Xr({value:e,translations:t}){return typeof e==`string`&&t[e.slice(0,512)]||e}function Zr(e){return typeof e==`object`&&!!e}async function Qr(e){try{return await n.access(e),!0}catch{return!1}}const $r=async(e,r)=>{let i=t.join(r,`src`,`i18n`,`${e}.json`);if(!await Qr(i))return null;try{let t=await n.readFile(i,`utf8`),a=JSON.parse(t);if(typeof a==`object`&&a)return a;throw Error(`Invalid i18n file format for ${e} in piece ${r}`)}catch(t){return console.error(`Error reading i18n file for ${e} in piece ${r}:`,t),null}};function J(e){let{requireReactor:t,defaultTimeoutSeconds:n,defaultRetry:r,...i}=e;return ei(ni(bn(i),t),{defaultTimeoutSeconds:n,defaultRetry:r})}function ei(e,{defaultTimeoutSeconds:t,defaultRetry:n}){if(t!==void 0){if(!Number.isFinite(t)||t<=0)throw Error(`defaultTimeoutSeconds must be a positive number, got ${JSON.stringify(t)}`);Object.assign(e,{defaultTimeoutSeconds:t})}if(n!==void 0){let t=n.maxAttempts;if(!Number.isInteger(t)||t<1)throw Error(`defaultRetry.maxAttempts must be a positive integer, got ${JSON.stringify(t)}`);Object.assign(e,{defaultRetry:n})}return e}function ti(e){let{requireReactor:t,...n}=e;return ni(Tr(n),t)}function ni(e,t){if(t===void 0||t===!1)return e;if(t!==`read`&&t!==`write`)throw Error(`requireReactor must be "read", "write" or false, got ${JSON.stringify(t)}`);return Object.assign(e,{requireReactor:t})}const Y={...jn,Dropdown(e){return jn.Dropdown(e)},MultiSelectDropdown(e){return jn.MultiSelectDropdown(e)},DynamicProperties(e){return jn.DynamicProperties(e)}};function ri(e,t){let n=e.result?.actions??[],r=new Map(n.map(e=>[e.actionId,e])),i=(t?.map(e=>({id:e.id,label:e.type}))??n.map(({actionId:e})=>({id:e,label:e}))).flatMap(({id:e,label:t})=>{let n=r.get(e);return n?n.kind===`reducer-error`?[`Action ${t} failed: ${n.message}`]:n.kind===`denied`?[`Action ${t} was denied: ${n.reason}`]:[]:[`Action ${t} produced no operation`]});if(i.length>0){let e=Error(i.join(`; `));throw e.name=`ReactorActionsFailedError`,e}}function ii(e){return{documentId:e.id,documentType:e.documentType,branch:e.branch,revision:{...e.revision}}}const ai=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function oi(e={}){let t=e.now??(()=>Date.now()),n=e.random??(e=>{globalThis.crypto.getRandomValues(e)}),r=/* @__PURE__ */ new Uint8Array(16),i=-1,a=0;return()=>{let e=t();n(r);let o=(r[6]&7)<<8|r[7];e>i?(i=e,a=o):a<4095?a++:(i++,a=o);let s=i;for(let e=5;e>=0;e--)r[e]=s%256,s=Math.floor(s/256);r[6]=112|a>>8,r[7]=a&255,r[8]=128|r[8]&63;let c=``;for(let e=0;e<16;e++)(e===4||e===6||e===8||e===10)&&(c+=`-`),c+=ai[r[e]];return c}}const si=oi();let ci=0,li=0;function ui(){let e=Date.now();return li=e<ci||e>li?e:li+1,ci=e,new Date(li).toISOString()}const di=`powerhouse/document-drive`,fi=/* @__PURE__ */ new Set([di,`powerhouse/reactor-drive`]),pi=`main`,mi=`global`;function hi(e){return{header:e.header,state:e.state}}function gi(e){let t=e.state.global;return t&&typeof t==`object`?t:{}}function _i(e){let t=gi(e).name;return typeof t==`string`&&t||e.header.name||``}function vi(e,t){let n=gi(e);for(let e of t.split(`.`)){if(typeof n!=`object`||!n)return;n=n[e]}return n}function yi(e,t){if(!t)return!0;let n=vi(e,t.path);return typeof n==`string`?n===t.value:typeof n==`number`||typeof n==`boolean`||typeof n==`bigint`?String(n)===t.value:!1}const bi={type:`SET_NAME`,module:`base`,scope:mi,inputSchema:`input SetNameInput {
32
32
  name: String!
33
- }`};function ai(e){let t=e.documentModel.global,n=t.specifications.at(-1);return{documentType:t.id,name:t.name,stateSchema:n?.state.global.schema??null,actions:[...(n?.modules??[]).flatMap(e=>e.operations.flatMap(t=>t.name?[{type:t.name,module:e.name,scope:t.scope||`global`,inputSchema:t.schema??null}]:[])),ii]}}function oi(e,t,n=Qr){return{id:Gr(),timestampUtcMs:n===`auth`?Jr():(/* @__PURE__ */ new Date()).toISOString(),type:e,input:t,scope:n}}function si(e){return e.toLowerCase().replace(/_+([a-z0-9])/g,(e,t)=>t.toUpperCase())}function ci(e,t,n){let r=e.actions[si(t)];if(r){let e=r(n);if(e.type===t)return e}return oi(t,n,ai(e).actions.find(e=>e.type===t)?.scope)}var li=/* @__PURE__ */ t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isObjectLike=t;function t(e){return typeof e==`object`&&!!e}})),ui=/* @__PURE__ */ t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.invariant=t;function t(e,t){if(!e)throw Error(t??`Unexpected invariant triggered.`)}})),di=/* @__PURE__ */ t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getLocation=r;var t=ui();let n=/\r\n|[\n\r]/g;function r(e,r){let i=0,a=1;for(let o of e.body.matchAll(n)){if(typeof o.index==`number`||(0,t.invariant)(!1),o.index>=r)break;i=o.index+o[0].length,a+=1}return{line:a,column:r+1-i}}})),fi=/* @__PURE__ */ t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.printLocation=n,e.printSourceLocation=r;var t=di();function n(e){return r(e.source,(0,t.getLocation)(e.source,e.start))}function r(e,t){let n=e.locationOffset.column-1,r=``.padStart(n)+e.body,a=t.line-1,o=e.locationOffset.line-1,s=t.line+o,c=t.line===1?n:0,l=t.column+c,u=`${e.name}:${s}:${l}\n`,d=r.split(/\r\n|[\n\r]/g),f=d[a];if(f.length>120){let e=Math.floor(l/80),t=l%80,n=[];for(let e=0;e<f.length;e+=80)n.push(f.slice(e,e+80));return u+i([[`${s} |`,n[0]],...n.slice(1,e+1).map(e=>[`|`,e]),[`|`,`^`.padStart(t)],[`|`,n[e+1]]])}return u+i([[`${s-1} |`,d[a-1]],[`${s} |`,f],[`|`,`^`.padStart(l)],[`${s+1} |`,d[a+1]]])}function i(e){let t=e.filter(([e,t])=>t!==void 0),n=Math.max(...t.map(([e])=>e.length));return t.map(([e,t])=>e.padStart(n)+(t?` `+t:``)).join(`
34
- `)}})),pi=/* @__PURE__ */ t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.GraphQLError=void 0,e.formatError=s,e.printError=o;var t=li(),n=di(),r=fi();function i(e){let t=e[0];return t==null||`kind`in t||`length`in t?{nodes:t,source:e[1],positions:e[2],path:e[3],originalError:e[4],extensions:e[5]}:t}e.GraphQLError=class e extends Error{constructor(r,...o){let{nodes:s,source:c,positions:l,path:u,originalError:d,extensions:f}=i(o);super(r),this.name=`GraphQLError`,this.path=u??void 0,this.originalError=d??void 0,this.nodes=a(Array.isArray(s)?s:s?[s]:void 0);let p=a(this.nodes?.map(e=>e.loc).filter(e=>e!=null));this.source=c??p?.[0]?.source,this.positions=l??p?.map(e=>e.start),this.locations=l&&c?l.map(e=>(0,n.getLocation)(c,e)):p?.map(e=>(0,n.getLocation)(e.source,e.start));let m=(0,t.isObjectLike)(d?.extensions)?d?.extensions:void 0;
33
+ }`};function xi(e){let t=e.documentModel.global,n=t.specifications.at(-1);return{documentType:t.id,name:t.name,stateSchema:n?.state.global.schema??null,actions:[...(n?.modules??[]).flatMap(e=>e.operations.flatMap(t=>t.name?[{type:t.name,module:e.name,scope:t.scope||`global`,inputSchema:t.schema??null}]:[])),bi]}}function Si(e,t,n=mi){return{id:si(),timestampUtcMs:n===`auth`?ui():(/* @__PURE__ */ new Date()).toISOString(),type:e,input:t,scope:n}}function Ci(e){return e.toLowerCase().replace(/_+([a-z0-9])/g,(e,t)=>t.toUpperCase())}function wi(e,t,n){let r=e.actions[Ci(t)];if(r){let e=r(n);if(e.type===t)return e}return Si(t,n,xi(e).actions.find(e=>e.type===t)?.scope)}var Ti=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isObjectLike=t;function t(e){return typeof e==`object`&&!!e}})),Ei=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.invariant=t;function t(e,t){if(!e)throw Error(t??`Unexpected invariant triggered.`)}})),Di=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getLocation=r;var t=Ei();let n=/\r\n|[\n\r]/g;function r(e,r){let i=0,a=1;for(let o of e.body.matchAll(n)){if(typeof o.index==`number`||(0,t.invariant)(!1),o.index>=r)break;i=o.index+o[0].length,a+=1}return{line:a,column:r+1-i}}})),Oi=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.printLocation=n,e.printSourceLocation=r;var t=Di();function n(e){return r(e.source,(0,t.getLocation)(e.source,e.start))}function r(e,t){let n=e.locationOffset.column-1,r=``.padStart(n)+e.body,a=t.line-1,o=e.locationOffset.line-1,s=t.line+o,c=t.line===1?n:0,l=t.column+c,u=`${e.name}:${s}:${l}\n`,d=r.split(/\r\n|[\n\r]/g),f=d[a];if(f.length>120){let e=Math.floor(l/80),t=l%80,n=[];for(let e=0;e<f.length;e+=80)n.push(f.slice(e,e+80));return u+i([[`${s} |`,n[0]],...n.slice(1,e+1).map(e=>[`|`,e]),[`|`,`^`.padStart(t)],[`|`,n[e+1]]])}return u+i([[`${s-1} |`,d[a-1]],[`${s} |`,f],[`|`,`^`.padStart(l)],[`${s+1} |`,d[a+1]]])}function i(e){let t=e.filter(([e,t])=>t!==void 0),n=Math.max(...t.map(([e])=>e.length));return t.map(([e,t])=>e.padStart(n)+(t?` `+t:``)).join(`
34
+ `)}})),ki=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.GraphQLError=void 0,e.formatError=s,e.printError=o;var t=Ti(),n=Di(),r=Oi();function i(e){let t=e[0];return t==null||`kind`in t||`length`in t?{nodes:t,source:e[1],positions:e[2],path:e[3],originalError:e[4],extensions:e[5]}:t}e.GraphQLError=class e extends Error{constructor(r,...o){let{nodes:s,source:c,positions:l,path:u,originalError:d,extensions:f}=i(o);super(r),this.name=`GraphQLError`,this.path=u??void 0,this.originalError=d??void 0,this.nodes=a(Array.isArray(s)?s:s?[s]:void 0);let p=a(this.nodes?.map(e=>e.loc).filter(e=>e!=null));this.source=c??p?.[0]?.source,this.positions=l??p?.map(e=>e.start),this.locations=l&&c?l.map(e=>(0,n.getLocation)(c,e)):p?.map(e=>(0,n.getLocation)(e.source,e.start));let m=(0,t.isObjectLike)(d?.extensions)?d?.extensions:void 0;
35
35
  /* c8 ignore start */
36
36
  this.extensions=f??m??Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),d!=null&&d.stack?Object.defineProperty(this,"stack",{value:d.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})
37
37
  /* c8 ignore stop */
@@ -39,11 +39,11 @@ this.extensions=f??m??Object.create(null),Object.defineProperties(this,{message:
39
39
 
40
40
  `+(0,r.printLocation)(t.loc));else if(this.source&&this.locations)for(let t of this.locations)e+=`
41
41
 
42
- `+(0,r.printSourceLocation)(this.source,t);return e}toJSON(){let e={message:this.message};return this.locations!=null&&(e.locations=this.locations),this.path!=null&&(e.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(e.extensions=this.extensions),e}};function a(e){return e===void 0||e.length===0?void 0:e}function o(e){return e.toString()}function s(e){return e.toJSON()}})),mi=/* @__PURE__ */ t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Kind=void 0;var t;e.Kind=t,(function(e){e.NAME=`Name`,e.DOCUMENT=`Document`,e.OPERATION_DEFINITION=`OperationDefinition`,e.VARIABLE_DEFINITION=`VariableDefinition`,e.SELECTION_SET=`SelectionSet`,e.FIELD=`Field`,e.ARGUMENT=`Argument`,e.FRAGMENT_SPREAD=`FragmentSpread`,e.INLINE_FRAGMENT=`InlineFragment`,e.FRAGMENT_DEFINITION=`FragmentDefinition`,e.VARIABLE=`Variable`,e.INT=`IntValue`,e.FLOAT=`FloatValue`,e.STRING=`StringValue`,e.BOOLEAN=`BooleanValue`,e.NULL=`NullValue`,e.ENUM=`EnumValue`,e.LIST=`ListValue`,e.OBJECT=`ObjectValue`,e.OBJECT_FIELD=`ObjectField`,e.DIRECTIVE=`Directive`,e.NAMED_TYPE=`NamedType`,e.LIST_TYPE=`ListType`,e.NON_NULL_TYPE=`NonNullType`,e.SCHEMA_DEFINITION=`SchemaDefinition`,e.OPERATION_TYPE_DEFINITION=`OperationTypeDefinition`,e.SCALAR_TYPE_DEFINITION=`ScalarTypeDefinition`,e.OBJECT_TYPE_DEFINITION=`ObjectTypeDefinition`,e.FIELD_DEFINITION=`FieldDefinition`,e.INPUT_VALUE_DEFINITION=`InputValueDefinition`,e.INTERFACE_TYPE_DEFINITION=`InterfaceTypeDefinition`,e.UNION_TYPE_DEFINITION=`UnionTypeDefinition`,e.ENUM_TYPE_DEFINITION=`EnumTypeDefinition`,e.ENUM_VALUE_DEFINITION=`EnumValueDefinition`,e.INPUT_OBJECT_TYPE_DEFINITION=`InputObjectTypeDefinition`,e.DIRECTIVE_DEFINITION=`DirectiveDefinition`,e.SCHEMA_EXTENSION=`SchemaExtension`,e.SCALAR_TYPE_EXTENSION=`ScalarTypeExtension`,e.OBJECT_TYPE_EXTENSION=`ObjectTypeExtension`,e.INTERFACE_TYPE_EXTENSION=`InterfaceTypeExtension`,e.UNION_TYPE_EXTENSION=`UnionTypeExtension`,e.ENUM_TYPE_EXTENSION=`EnumTypeExtension`,e.INPUT_OBJECT_TYPE_EXTENSION=`InputObjectTypeExtension`,e.TYPE_COORDINATE=`TypeCoordinate`,e.MEMBER_COORDINATE=`MemberCoordinate`,e.ARGUMENT_COORDINATE=`ArgumentCoordinate`,e.DIRECTIVE_COORDINATE=`DirectiveCoordinate`,e.DIRECTIVE_ARGUMENT_COORDINATE=`DirectiveArgumentCoordinate`})(t||(e.Kind=t={}))})),hi=/* @__PURE__ */ t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.syntaxError=n;var t=pi();function n(e,n,r){return new t.GraphQLError(`Syntax Error: ${r}`,{source:e,positions:[n]})}})),gi=/* @__PURE__ */ t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Token=e.QueryDocumentKeys=e.OperationTypeNode=e.Location=void 0,e.isNode=r,e.Location=class{constructor(e,t,n){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=n}get[Symbol.toStringTag](){return`Location`}toJSON(){return{start:this.start,end:this.end}}},e.Token=class{constructor(e,t,n,r,i,a){this.kind=e,this.start=t,this.end=n,this.line=r,this.column=i,this.value=a,this.prev=null,this.next=null}get[Symbol.toStringTag](){return`Token`}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}};let t={Name:[],Document:[`definitions`],OperationDefinition:[`description`,`name`,`variableDefinitions`,`directives`,`selectionSet`],VariableDefinition:[`description`,`variable`,`type`,`defaultValue`,`directives`],Variable:[`name`],SelectionSet:[`selections`],Field:[`alias`,`name`,`arguments`,`directives`,`selectionSet`],Argument:[`name`,`value`],FragmentSpread:[`name`,`directives`],InlineFragment:[`typeCondition`,`directives`,`selectionSet`],FragmentDefinition:[`description`,`name`,`variableDefinitions`,`typeCondition`,`directives`,`selectionSet`],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:[`values`],ObjectValue:[`fields`],ObjectField:[`name`,`value`],Directive:[`name`,`arguments`],NamedType:[`name`],ListType:[`type`],NonNullType:[`type`],SchemaDefinition:[`description`,`directives`,`operationTypes`],OperationTypeDefinition:[`type`],ScalarTypeDefinition:[`description`,`name`,`directives`],ObjectTypeDefinition:[`description`,`name`,`interfaces`,`directives`,`fields`],FieldDefinition:[`description`,`name`,`arguments`,`type`,`directives`],InputValueDefinition:[`description`,`name`,`type`,`defaultValue`,`directives`],InterfaceTypeDefinition:[`description`,`name`,`interfaces`,`directives`,`fields`],UnionTypeDefinition:[`description`,`name`,`directives`,`types`],EnumTypeDefinition:[`description`,`name`,`directives`,`values`],EnumValueDefinition:[`description`,`name`,`directives`],InputObjectTypeDefinition:[`description`,`name`,`directives`,`fields`],DirectiveDefinition:[`description`,`name`,`arguments`,`locations`],SchemaExtension:[`directives`,`operationTypes`],ScalarTypeExtension:[`name`,`directives`],ObjectTypeExtension:[`name`,`interfaces`,`directives`,`fields`],InterfaceTypeExtension:[`name`,`interfaces`,`directives`,`fields`],UnionTypeExtension:[`name`,`directives`,`types`],EnumTypeExtension:[`name`,`directives`,`values`],InputObjectTypeExtension:[`name`,`directives`,`fields`],TypeCoordinate:[`name`],MemberCoordinate:[`name`,`memberName`],ArgumentCoordinate:[`name`,`fieldName`,`argumentName`],DirectiveCoordinate:[`name`],DirectiveArgumentCoordinate:[`name`,`argumentName`]};e.QueryDocumentKeys=t;let n=new Set(Object.keys(t));function r(e){let t=e?.kind;return typeof t==`string`&&n.has(t)}var i;e.OperationTypeNode=i,(function(e){e.QUERY=`query`,e.MUTATION=`mutation`,e.SUBSCRIPTION=`subscription`})(i||(e.OperationTypeNode=i={}))})),_i=/* @__PURE__ */ t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DirectiveLocation=void 0;var t;e.DirectiveLocation=t,(function(e){e.QUERY=`QUERY`,e.MUTATION=`MUTATION`,e.SUBSCRIPTION=`SUBSCRIPTION`,e.FIELD=`FIELD`,e.FRAGMENT_DEFINITION=`FRAGMENT_DEFINITION`,e.FRAGMENT_SPREAD=`FRAGMENT_SPREAD`,e.INLINE_FRAGMENT=`INLINE_FRAGMENT`,e.VARIABLE_DEFINITION=`VARIABLE_DEFINITION`,e.SCHEMA=`SCHEMA`,e.SCALAR=`SCALAR`,e.OBJECT=`OBJECT`,e.FIELD_DEFINITION=`FIELD_DEFINITION`,e.ARGUMENT_DEFINITION=`ARGUMENT_DEFINITION`,e.INTERFACE=`INTERFACE`,e.UNION=`UNION`,e.ENUM=`ENUM`,e.ENUM_VALUE=`ENUM_VALUE`,e.INPUT_OBJECT=`INPUT_OBJECT`,e.INPUT_FIELD_DEFINITION=`INPUT_FIELD_DEFINITION`})(t||(e.DirectiveLocation=t={}))})),vi=/* @__PURE__ */ t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isDigit=n,e.isLetter=r,e.isNameContinue=a,e.isNameStart=i,e.isWhiteSpace=t;function t(e){return e===9||e===32}function n(e){return e>=48&&e<=57}function r(e){return e>=97&&e<=122||e>=65&&e<=90}function i(e){return r(e)||e===95}function a(e){return r(e)||n(e)||e===95}})),yi=/* @__PURE__ */ t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dedentBlockStringLines=n,e.isPrintableAsBlockString=i,e.printBlockString=a;var t=vi();function n(e){let t=2**53-1,n=null,i=-1;for(let a=0;a<e.length;++a){let o=e[a],s=r(o);s!==o.length&&(n??=a,i=a,a!==0&&s<t&&(t=s))}return e.map((e,n)=>n===0?e:e.slice(t)).slice(n??0,i+1)}function r(e){let n=0;for(;n<e.length&&(0,t.isWhiteSpace)(e.charCodeAt(n));)++n;return n}function i(e){if(e===``)return!0;let t=!0,n=!1,r=!0,i=!1;for(let a=0;a<e.length;++a)switch(e.codePointAt(a)){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 11:case 12:case 14:case 15:return!1;case 13:return!1;case 10:if(t&&!i)return!1;i=!0,t=!0,n=!1;break;case 9:case 32:n||=t;break;default:r&&=n,t=!1}return!(t||r&&i)}function a(e,n){let r=e.replace(/"""/g,`\\"""`),i=r.split(/\r\n|[\n\r]/g),a=i.length===1,o=i.length>1&&i.slice(1).every(e=>e.length===0||(0,t.isWhiteSpace)(e.charCodeAt(0))),s=r.endsWith(`\\"""`),c=e.endsWith(`"`)&&!s,l=e.endsWith(`\\`),u=c||l,d=!(n!=null&&n.minimize)&&(!a||e.length>70||u||o||s),f=``,p=a&&(0,t.isWhiteSpace)(e.charCodeAt(0));return(d&&!p||o)&&(f+=`
42
+ `+(0,r.printSourceLocation)(this.source,t);return e}toJSON(){let e={message:this.message};return this.locations!=null&&(e.locations=this.locations),this.path!=null&&(e.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(e.extensions=this.extensions),e}};function a(e){return e===void 0||e.length===0?void 0:e}function o(e){return e.toString()}function s(e){return e.toJSON()}})),Ai=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Kind=void 0;var t;e.Kind=t,(function(e){e.NAME=`Name`,e.DOCUMENT=`Document`,e.OPERATION_DEFINITION=`OperationDefinition`,e.VARIABLE_DEFINITION=`VariableDefinition`,e.SELECTION_SET=`SelectionSet`,e.FIELD=`Field`,e.ARGUMENT=`Argument`,e.FRAGMENT_SPREAD=`FragmentSpread`,e.INLINE_FRAGMENT=`InlineFragment`,e.FRAGMENT_DEFINITION=`FragmentDefinition`,e.VARIABLE=`Variable`,e.INT=`IntValue`,e.FLOAT=`FloatValue`,e.STRING=`StringValue`,e.BOOLEAN=`BooleanValue`,e.NULL=`NullValue`,e.ENUM=`EnumValue`,e.LIST=`ListValue`,e.OBJECT=`ObjectValue`,e.OBJECT_FIELD=`ObjectField`,e.DIRECTIVE=`Directive`,e.NAMED_TYPE=`NamedType`,e.LIST_TYPE=`ListType`,e.NON_NULL_TYPE=`NonNullType`,e.SCHEMA_DEFINITION=`SchemaDefinition`,e.OPERATION_TYPE_DEFINITION=`OperationTypeDefinition`,e.SCALAR_TYPE_DEFINITION=`ScalarTypeDefinition`,e.OBJECT_TYPE_DEFINITION=`ObjectTypeDefinition`,e.FIELD_DEFINITION=`FieldDefinition`,e.INPUT_VALUE_DEFINITION=`InputValueDefinition`,e.INTERFACE_TYPE_DEFINITION=`InterfaceTypeDefinition`,e.UNION_TYPE_DEFINITION=`UnionTypeDefinition`,e.ENUM_TYPE_DEFINITION=`EnumTypeDefinition`,e.ENUM_VALUE_DEFINITION=`EnumValueDefinition`,e.INPUT_OBJECT_TYPE_DEFINITION=`InputObjectTypeDefinition`,e.DIRECTIVE_DEFINITION=`DirectiveDefinition`,e.SCHEMA_EXTENSION=`SchemaExtension`,e.SCALAR_TYPE_EXTENSION=`ScalarTypeExtension`,e.OBJECT_TYPE_EXTENSION=`ObjectTypeExtension`,e.INTERFACE_TYPE_EXTENSION=`InterfaceTypeExtension`,e.UNION_TYPE_EXTENSION=`UnionTypeExtension`,e.ENUM_TYPE_EXTENSION=`EnumTypeExtension`,e.INPUT_OBJECT_TYPE_EXTENSION=`InputObjectTypeExtension`,e.TYPE_COORDINATE=`TypeCoordinate`,e.MEMBER_COORDINATE=`MemberCoordinate`,e.ARGUMENT_COORDINATE=`ArgumentCoordinate`,e.DIRECTIVE_COORDINATE=`DirectiveCoordinate`,e.DIRECTIVE_ARGUMENT_COORDINATE=`DirectiveArgumentCoordinate`})(t||(e.Kind=t={}))})),ji=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.syntaxError=n;var t=ki();function n(e,n,r){return new t.GraphQLError(`Syntax Error: ${r}`,{source:e,positions:[n]})}})),Mi=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Token=e.QueryDocumentKeys=e.OperationTypeNode=e.Location=void 0,e.isNode=r,e.Location=class{constructor(e,t,n){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=n}get[Symbol.toStringTag](){return`Location`}toJSON(){return{start:this.start,end:this.end}}},e.Token=class{constructor(e,t,n,r,i,a){this.kind=e,this.start=t,this.end=n,this.line=r,this.column=i,this.value=a,this.prev=null,this.next=null}get[Symbol.toStringTag](){return`Token`}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}};let t={Name:[],Document:[`definitions`],OperationDefinition:[`description`,`name`,`variableDefinitions`,`directives`,`selectionSet`],VariableDefinition:[`description`,`variable`,`type`,`defaultValue`,`directives`],Variable:[`name`],SelectionSet:[`selections`],Field:[`alias`,`name`,`arguments`,`directives`,`selectionSet`],Argument:[`name`,`value`],FragmentSpread:[`name`,`directives`],InlineFragment:[`typeCondition`,`directives`,`selectionSet`],FragmentDefinition:[`description`,`name`,`variableDefinitions`,`typeCondition`,`directives`,`selectionSet`],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:[`values`],ObjectValue:[`fields`],ObjectField:[`name`,`value`],Directive:[`name`,`arguments`],NamedType:[`name`],ListType:[`type`],NonNullType:[`type`],SchemaDefinition:[`description`,`directives`,`operationTypes`],OperationTypeDefinition:[`type`],ScalarTypeDefinition:[`description`,`name`,`directives`],ObjectTypeDefinition:[`description`,`name`,`interfaces`,`directives`,`fields`],FieldDefinition:[`description`,`name`,`arguments`,`type`,`directives`],InputValueDefinition:[`description`,`name`,`type`,`defaultValue`,`directives`],InterfaceTypeDefinition:[`description`,`name`,`interfaces`,`directives`,`fields`],UnionTypeDefinition:[`description`,`name`,`directives`,`types`],EnumTypeDefinition:[`description`,`name`,`directives`,`values`],EnumValueDefinition:[`description`,`name`,`directives`],InputObjectTypeDefinition:[`description`,`name`,`directives`,`fields`],DirectiveDefinition:[`description`,`name`,`arguments`,`locations`],SchemaExtension:[`directives`,`operationTypes`],ScalarTypeExtension:[`name`,`directives`],ObjectTypeExtension:[`name`,`interfaces`,`directives`,`fields`],InterfaceTypeExtension:[`name`,`interfaces`,`directives`,`fields`],UnionTypeExtension:[`name`,`directives`,`types`],EnumTypeExtension:[`name`,`directives`,`values`],InputObjectTypeExtension:[`name`,`directives`,`fields`],TypeCoordinate:[`name`],MemberCoordinate:[`name`,`memberName`],ArgumentCoordinate:[`name`,`fieldName`,`argumentName`],DirectiveCoordinate:[`name`],DirectiveArgumentCoordinate:[`name`,`argumentName`]};e.QueryDocumentKeys=t;let n=new Set(Object.keys(t));function r(e){let t=e?.kind;return typeof t==`string`&&n.has(t)}var i;e.OperationTypeNode=i,(function(e){e.QUERY=`query`,e.MUTATION=`mutation`,e.SUBSCRIPTION=`subscription`})(i||(e.OperationTypeNode=i={}))})),Ni=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DirectiveLocation=void 0;var t;e.DirectiveLocation=t,(function(e){e.QUERY=`QUERY`,e.MUTATION=`MUTATION`,e.SUBSCRIPTION=`SUBSCRIPTION`,e.FIELD=`FIELD`,e.FRAGMENT_DEFINITION=`FRAGMENT_DEFINITION`,e.FRAGMENT_SPREAD=`FRAGMENT_SPREAD`,e.INLINE_FRAGMENT=`INLINE_FRAGMENT`,e.VARIABLE_DEFINITION=`VARIABLE_DEFINITION`,e.SCHEMA=`SCHEMA`,e.SCALAR=`SCALAR`,e.OBJECT=`OBJECT`,e.FIELD_DEFINITION=`FIELD_DEFINITION`,e.ARGUMENT_DEFINITION=`ARGUMENT_DEFINITION`,e.INTERFACE=`INTERFACE`,e.UNION=`UNION`,e.ENUM=`ENUM`,e.ENUM_VALUE=`ENUM_VALUE`,e.INPUT_OBJECT=`INPUT_OBJECT`,e.INPUT_FIELD_DEFINITION=`INPUT_FIELD_DEFINITION`})(t||(e.DirectiveLocation=t={}))})),Pi=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isDigit=n,e.isLetter=r,e.isNameContinue=a,e.isNameStart=i,e.isWhiteSpace=t;function t(e){return e===9||e===32}function n(e){return e>=48&&e<=57}function r(e){return e>=97&&e<=122||e>=65&&e<=90}function i(e){return r(e)||e===95}function a(e){return r(e)||n(e)||e===95}})),Fi=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dedentBlockStringLines=n,e.isPrintableAsBlockString=i,e.printBlockString=a;var t=Pi();function n(e){let t=2**53-1,n=null,i=-1;for(let a=0;a<e.length;++a){let o=e[a],s=r(o);s!==o.length&&(n??=a,i=a,a!==0&&s<t&&(t=s))}return e.map((e,n)=>n===0?e:e.slice(t)).slice(n??0,i+1)}function r(e){let n=0;for(;n<e.length&&(0,t.isWhiteSpace)(e.charCodeAt(n));)++n;return n}function i(e){if(e===``)return!0;let t=!0,n=!1,r=!0,i=!1;for(let a=0;a<e.length;++a)switch(e.codePointAt(a)){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 11:case 12:case 14:case 15:return!1;case 13:return!1;case 10:if(t&&!i)return!1;i=!0,t=!0,n=!1;break;case 9:case 32:n||=t;break;default:r&&=n,t=!1}return!(t||r&&i)}function a(e,n){let r=e.replace(/"""/g,`\\"""`),i=r.split(/\r\n|[\n\r]/g),a=i.length===1,o=i.length>1&&i.slice(1).every(e=>e.length===0||(0,t.isWhiteSpace)(e.charCodeAt(0))),s=r.endsWith(`\\"""`),c=e.endsWith(`"`)&&!s,l=e.endsWith(`\\`),u=c||l,d=!(n!=null&&n.minimize)&&(!a||e.length>70||u||o||s),f=``,p=a&&(0,t.isWhiteSpace)(e.charCodeAt(0));return(d&&!p||o)&&(f+=`
43
43
  `),f+=r,(d||u)&&(f+=`
44
- `),`"""`+f+`"""`}})),bi=/* @__PURE__ */ t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TokenKind=void 0;var t;e.TokenKind=t,(function(e){e.SOF=`<SOF>`,e.EOF=`<EOF>`,e.BANG=`!`,e.DOLLAR=`$`,e.AMP=`&`,e.PAREN_L=`(`,e.PAREN_R=`)`,e.DOT=`.`,e.SPREAD=`...`,e.COLON=`:`,e.EQUALS=`=`,e.AT=`@`,e.BRACKET_L=`[`,e.BRACKET_R=`]`,e.BRACE_L=`{`,e.PIPE=`|`,e.BRACE_R=`}`,e.NAME=`Name`,e.INT=`Int`,e.FLOAT=`Float`,e.STRING=`String`,e.BLOCK_STRING=`BlockString`,e.COMMENT=`Comment`})(t||(e.TokenKind=t={}))})),xi=/* @__PURE__ */ t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Lexer=void 0,e.createToken=f,e.isPunctuatorTokenKind=o,e.printCodePointAt=d,e.readName=te;var t=hi(),n=gi(),r=yi(),i=vi(),a=bi();e.Lexer=class{constructor(e){let t=new n.Token(a.TokenKind.SOF,0,0,0,0);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return`Lexer`}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==a.TokenKind.EOF)do if(e.next)e=e.next;else{let t=p(this,e.end);e.next=t,t.prev=e,e=t}while(e.kind===a.TokenKind.COMMENT);return e}};function o(e){return e===a.TokenKind.BANG||e===a.TokenKind.DOLLAR||e===a.TokenKind.AMP||e===a.TokenKind.PAREN_L||e===a.TokenKind.PAREN_R||e===a.TokenKind.DOT||e===a.TokenKind.SPREAD||e===a.TokenKind.COLON||e===a.TokenKind.EQUALS||e===a.TokenKind.AT||e===a.TokenKind.BRACKET_L||e===a.TokenKind.BRACKET_R||e===a.TokenKind.BRACE_L||e===a.TokenKind.PIPE||e===a.TokenKind.BRACE_R}function s(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function c(e,t){return l(e.charCodeAt(t))&&u(e.charCodeAt(t+1))}function l(e){return e>=55296&&e<=56319}function u(e){return e>=56320&&e<=57343}function d(e,t){let n=e.source.body.codePointAt(t);if(n===void 0)return a.TokenKind.EOF;if(n>=32&&n<=126){let e=String.fromCodePoint(n);return e===`"`?`'"'`:`"${e}"`}return`U+`+n.toString(16).toUpperCase().padStart(4,`0`)}function f(e,t,r,i,a){let o=e.line,s=1+r-e.lineStart;return new n.Token(t,r,i,o,s,a)}function p(e,n){let r=e.source.body,o=r.length,l=n;for(;l<o;){let n=r.charCodeAt(l);switch(n){case 65279:case 9:case 32:case 44:++l;continue;case 10:++l,++e.line,e.lineStart=l;continue;case 13:r.charCodeAt(l+1)===10?l+=2:++l,++e.line,e.lineStart=l;continue;case 35:return m(e,l);case 33:return f(e,a.TokenKind.BANG,l,l+1);case 36:return f(e,a.TokenKind.DOLLAR,l,l+1);case 38:return f(e,a.TokenKind.AMP,l,l+1);case 40:return f(e,a.TokenKind.PAREN_L,l,l+1);case 41:return f(e,a.TokenKind.PAREN_R,l,l+1);case 46:if(r.charCodeAt(l+1)===46&&r.charCodeAt(l+2)===46)return f(e,a.TokenKind.SPREAD,l,l+3);break;case 58:return f(e,a.TokenKind.COLON,l,l+1);case 61:return f(e,a.TokenKind.EQUALS,l,l+1);case 64:return f(e,a.TokenKind.AT,l,l+1);case 91:return f(e,a.TokenKind.BRACKET_L,l,l+1);case 93:return f(e,a.TokenKind.BRACKET_R,l,l+1);case 123:return f(e,a.TokenKind.BRACE_L,l,l+1);case 124:return f(e,a.TokenKind.PIPE,l,l+1);case 125:return f(e,a.TokenKind.BRACE_R,l,l+1);case 34:return r.charCodeAt(l+1)===34&&r.charCodeAt(l+2)===34?ee(e,l):_(e,l)}if((0,i.isDigit)(n)||n===45)return h(e,l,n);if((0,i.isNameStart)(n))return te(e,l);throw(0,t.syntaxError)(e.source,l,n===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:s(n)||c(r,l)?`Unexpected character: ${d(e,l)}.`:`Invalid character: ${d(e,l)}.`)}return f(e,a.TokenKind.EOF,o,o)}function m(e,t){let n=e.source.body,r=n.length,i=t+1;for(;i<r;){let e=n.charCodeAt(i);if(e===10||e===13)break;if(s(e))++i;else if(c(n,i))i+=2;else break}return f(e,a.TokenKind.COMMENT,t,i,n.slice(t+1,i))}function h(e,n,r){let o=e.source.body,s=n,c=r,l=!1;if(c===45&&(c=o.charCodeAt(++s)),c===48){if(c=o.charCodeAt(++s),(0,i.isDigit)(c))throw(0,t.syntaxError)(e.source,s,`Invalid number, unexpected digit after 0: ${d(e,s)}.`)}else s=g(e,s,c),c=o.charCodeAt(s);if(c===46&&(l=!0,c=o.charCodeAt(++s),s=g(e,s,c),c=o.charCodeAt(s)),(c===69||c===101)&&(l=!0,c=o.charCodeAt(++s),(c===43||c===45)&&(c=o.charCodeAt(++s)),s=g(e,s,c),c=o.charCodeAt(s)),c===46||(0,i.isNameStart)(c))throw(0,t.syntaxError)(e.source,s,`Invalid number, expected digit but got: ${d(e,s)}.`);return f(e,l?a.TokenKind.FLOAT:a.TokenKind.INT,n,s,o.slice(n,s))}function g(e,n,r){if(!(0,i.isDigit)(r))throw(0,t.syntaxError)(e.source,n,`Invalid number, expected digit but got: ${d(e,n)}.`);let a=e.source.body,o=n+1;for(;(0,i.isDigit)(a.charCodeAt(o));)++o;return o}function _(e,n){let r=e.source.body,i=r.length,o=n+1,l=o,u=``;for(;o<i;){let i=r.charCodeAt(o);if(i===34)return u+=r.slice(l,o),f(e,a.TokenKind.STRING,n,o+1,u);if(i===92){u+=r.slice(l,o);let t=r.charCodeAt(o+1)===117?r.charCodeAt(o+2)===123?v(e,o):y(e,o):S(e,o);u+=t.value,o+=t.size,l=o;continue}if(i===10||i===13)break;if(s(i))++o;else if(c(r,o))o+=2;else throw(0,t.syntaxError)(e.source,o,`Invalid character within String: ${d(e,o)}.`)}throw(0,t.syntaxError)(e.source,o,`Unterminated string.`)}function v(e,n){let r=e.source.body,i=0,a=3;for(;a<12;){let e=r.charCodeAt(n+a++);if(e===125){if(a<5||!s(i))break;return{value:String.fromCodePoint(i),size:a}}if(i=i<<4|x(e),i<0)break}throw(0,t.syntaxError)(e.source,n,`Invalid Unicode escape sequence: "${r.slice(n,n+a)}".`)}function y(e,n){let r=e.source.body,i=b(r,n+2);if(s(i))return{value:String.fromCodePoint(i),size:6};if(l(i)&&r.charCodeAt(n+6)===92&&r.charCodeAt(n+7)===117){let e=b(r,n+8);if(u(e))return{value:String.fromCodePoint(i,e),size:12}}throw(0,t.syntaxError)(e.source,n,`Invalid Unicode escape sequence: "${r.slice(n,n+6)}".`)}function b(e,t){return x(e.charCodeAt(t))<<12|x(e.charCodeAt(t+1))<<8|x(e.charCodeAt(t+2))<<4|x(e.charCodeAt(t+3))}function x(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function S(e,n){let r=e.source.body;switch(r.charCodeAt(n+1)){case 34:return{value:`"`,size:2};case 92:return{value:`\\`,size:2};case 47:return{value:`/`,size:2};case 98:return{value:`\b`,size:2};case 102:return{value:`\f`,size:2};case 110:return{value:`
45
- `,size:2};case 114:return{value:`\r`,size:2};case 116:return{value:` `,size:2}}throw(0,t.syntaxError)(e.source,n,`Invalid character escape sequence: "${r.slice(n,n+2)}".`)}function ee(e,n){let i=e.source.body,o=i.length,l=e.lineStart,u=n+3,p=u,m=``,h=[];for(;u<o;){let o=i.charCodeAt(u);if(o===34&&i.charCodeAt(u+1)===34&&i.charCodeAt(u+2)===34){m+=i.slice(p,u),h.push(m);let t=f(e,a.TokenKind.BLOCK_STRING,n,u+3,(0,r.dedentBlockStringLines)(h).join(`
46
- `));return e.line+=h.length-1,e.lineStart=l,t}if(o===92&&i.charCodeAt(u+1)===34&&i.charCodeAt(u+2)===34&&i.charCodeAt(u+3)===34){m+=i.slice(p,u),p=u+1,u+=4;continue}if(o===10||o===13){m+=i.slice(p,u),h.push(m),o===13&&i.charCodeAt(u+1)===10?u+=2:++u,m=``,p=u,l=u;continue}if(s(o))++u;else if(c(i,u))u+=2;else throw(0,t.syntaxError)(e.source,u,`Invalid character within String: ${d(e,u)}.`)}throw(0,t.syntaxError)(e.source,u,`Unterminated string.`)}function te(e,t){let n=e.source.body,r=n.length,o=t+1;for(;o<r;){let e=n.charCodeAt(o);if((0,i.isNameContinue)(e))++o;else break}return f(e,a.TokenKind.NAME,t,o,n.slice(t,o))}})),Si=/* @__PURE__ */ t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SchemaCoordinateLexer=void 0;var t=hi(),n=gi(),r=vi(),i=xi(),a=bi();e.SchemaCoordinateLexer=class{line=1;lineStart=0;constructor(e){let t=new n.Token(a.TokenKind.SOF,0,0,0,0);this.source=e,this.lastToken=t,this.token=t}get[Symbol.toStringTag](){return`SchemaCoordinateLexer`}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==a.TokenKind.EOF){let t=o(this,e.end);e.next=t,t.prev=e,e=t}return e}};function o(e,n){let o=e.source.body,s=o.length,c=n;if(c<s){let n=o.charCodeAt(c);switch(n){case 46:return(0,i.createToken)(e,a.TokenKind.DOT,c,c+1);case 40:return(0,i.createToken)(e,a.TokenKind.PAREN_L,c,c+1);case 41:return(0,i.createToken)(e,a.TokenKind.PAREN_R,c,c+1);case 58:return(0,i.createToken)(e,a.TokenKind.COLON,c,c+1);case 64:return(0,i.createToken)(e,a.TokenKind.AT,c,c+1)}if((0,r.isNameStart)(n))return(0,i.readName)(e,c);throw(0,t.syntaxError)(e.source,c,`Invalid character: ${(0,i.printCodePointAt)(e,c)}.`)}return(0,i.createToken)(e,a.TokenKind.EOF,s,s)}})),Ci=/* @__PURE__ */ t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.devAssert=t;function t(e,t){if(!e)throw Error(t)}})),wi=/* @__PURE__ */ t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.inspect=t;function t(e){return n(e,[])}function n(e,t){switch(typeof e){case`string`:return JSON.stringify(e);case`function`:return e.name?`[function ${e.name}]`:`[function]`;case`object`:return r(e,t);default:return String(e)}}function r(e,t){if(e===null)return`null`;if(t.includes(e))return`[Circular]`;let r=[...t,e];if(i(e)){let t=e.toJSON();if(t!==e)return typeof t==`string`?t:n(t,r)}else if(Array.isArray(e))return o(e,r);return a(e,r)}function i(e){return typeof e.toJSON==`function`}function a(e,t){let r=Object.entries(e);return r.length===0?`{}`:t.length>2?`[`+s(e)+`]`:`{ `+r.map(([e,r])=>e+`: `+n(r,t)).join(`, `)+` }`}function o(e,t){if(e.length===0)return`[]`;if(t.length>2)return`[Array]`;let r=Math.min(10,e.length),i=e.length-r,a=[];for(let i=0;i<r;++i)a.push(n(e[i],t));return i===1?a.push(`... 1 more item`):i>1&&a.push(`... ${i} more items`),`[`+a.join(`, `)+`]`}function s(e){let t=Object.prototype.toString.call(e).replace(/^\[object /,``).replace(/]$/,``);if(t===`Object`&&typeof e.constructor==`function`){let t=e.constructor.name;if(typeof t==`string`&&t!==``)return t}return t}})),Ti=/* @__PURE__ */ t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.instanceOf=void 0;var t=wi();e.instanceOf=globalThis.process&&process.env.NODE_ENV===`production`?function(e,t){return e instanceof t}:function(e,n){if(e instanceof n)return!0;if(typeof e==`object`&&e){let r=n.prototype[Symbol.toStringTag];if(r===(Symbol.toStringTag in e?e[Symbol.toStringTag]:e.constructor?.name)){let n=(0,t.inspect)(e);throw Error(`Cannot use ${r} "${n}" from another module or realm.
44
+ `),`"""`+f+`"""`}})),Ii=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TokenKind=void 0;var t;e.TokenKind=t,(function(e){e.SOF=`<SOF>`,e.EOF=`<EOF>`,e.BANG=`!`,e.DOLLAR=`$`,e.AMP=`&`,e.PAREN_L=`(`,e.PAREN_R=`)`,e.DOT=`.`,e.SPREAD=`...`,e.COLON=`:`,e.EQUALS=`=`,e.AT=`@`,e.BRACKET_L=`[`,e.BRACKET_R=`]`,e.BRACE_L=`{`,e.PIPE=`|`,e.BRACE_R=`}`,e.NAME=`Name`,e.INT=`Int`,e.FLOAT=`Float`,e.STRING=`String`,e.BLOCK_STRING=`BlockString`,e.COMMENT=`Comment`})(t||(e.TokenKind=t={}))})),Li=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Lexer=void 0,e.createToken=f,e.isPunctuatorTokenKind=o,e.printCodePointAt=d,e.readName=S;var t=ji(),n=Mi(),r=Fi(),i=Pi(),a=Ii();e.Lexer=class{constructor(e){let t=new n.Token(a.TokenKind.SOF,0,0,0,0);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return`Lexer`}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==a.TokenKind.EOF)do if(e.next)e=e.next;else{let t=p(this,e.end);e.next=t,t.prev=e,e=t}while(e.kind===a.TokenKind.COMMENT);return e}};function o(e){return e===a.TokenKind.BANG||e===a.TokenKind.DOLLAR||e===a.TokenKind.AMP||e===a.TokenKind.PAREN_L||e===a.TokenKind.PAREN_R||e===a.TokenKind.DOT||e===a.TokenKind.SPREAD||e===a.TokenKind.COLON||e===a.TokenKind.EQUALS||e===a.TokenKind.AT||e===a.TokenKind.BRACKET_L||e===a.TokenKind.BRACKET_R||e===a.TokenKind.BRACE_L||e===a.TokenKind.PIPE||e===a.TokenKind.BRACE_R}function s(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function c(e,t){return l(e.charCodeAt(t))&&u(e.charCodeAt(t+1))}function l(e){return e>=55296&&e<=56319}function u(e){return e>=56320&&e<=57343}function d(e,t){let n=e.source.body.codePointAt(t);if(n===void 0)return a.TokenKind.EOF;if(n>=32&&n<=126){let e=String.fromCodePoint(n);return e===`"`?`'"'`:`"${e}"`}return`U+`+n.toString(16).toUpperCase().padStart(4,`0`)}function f(e,t,r,i,a){let o=e.line,s=1+r-e.lineStart;return new n.Token(t,r,i,o,s,a)}function p(e,n){let r=e.source.body,o=r.length,l=n;for(;l<o;){let n=r.charCodeAt(l);switch(n){case 65279:case 9:case 32:case 44:++l;continue;case 10:++l,++e.line,e.lineStart=l;continue;case 13:r.charCodeAt(l+1)===10?l+=2:++l,++e.line,e.lineStart=l;continue;case 35:return m(e,l);case 33:return f(e,a.TokenKind.BANG,l,l+1);case 36:return f(e,a.TokenKind.DOLLAR,l,l+1);case 38:return f(e,a.TokenKind.AMP,l,l+1);case 40:return f(e,a.TokenKind.PAREN_L,l,l+1);case 41:return f(e,a.TokenKind.PAREN_R,l,l+1);case 46:if(r.charCodeAt(l+1)===46&&r.charCodeAt(l+2)===46)return f(e,a.TokenKind.SPREAD,l,l+3);break;case 58:return f(e,a.TokenKind.COLON,l,l+1);case 61:return f(e,a.TokenKind.EQUALS,l,l+1);case 64:return f(e,a.TokenKind.AT,l,l+1);case 91:return f(e,a.TokenKind.BRACKET_L,l,l+1);case 93:return f(e,a.TokenKind.BRACKET_R,l,l+1);case 123:return f(e,a.TokenKind.BRACE_L,l,l+1);case 124:return f(e,a.TokenKind.PIPE,l,l+1);case 125:return f(e,a.TokenKind.BRACE_R,l,l+1);case 34:return r.charCodeAt(l+1)===34&&r.charCodeAt(l+2)===34?te(e,l):_(e,l)}if((0,i.isDigit)(n)||n===45)return h(e,l,n);if((0,i.isNameStart)(n))return S(e,l);throw(0,t.syntaxError)(e.source,l,n===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:s(n)||c(r,l)?`Unexpected character: ${d(e,l)}.`:`Invalid character: ${d(e,l)}.`)}return f(e,a.TokenKind.EOF,o,o)}function m(e,t){let n=e.source.body,r=n.length,i=t+1;for(;i<r;){let e=n.charCodeAt(i);if(e===10||e===13)break;if(s(e))++i;else if(c(n,i))i+=2;else break}return f(e,a.TokenKind.COMMENT,t,i,n.slice(t+1,i))}function h(e,n,r){let o=e.source.body,s=n,c=r,l=!1;if(c===45&&(c=o.charCodeAt(++s)),c===48){if(c=o.charCodeAt(++s),(0,i.isDigit)(c))throw(0,t.syntaxError)(e.source,s,`Invalid number, unexpected digit after 0: ${d(e,s)}.`)}else s=g(e,s,c),c=o.charCodeAt(s);if(c===46&&(l=!0,c=o.charCodeAt(++s),s=g(e,s,c),c=o.charCodeAt(s)),(c===69||c===101)&&(l=!0,c=o.charCodeAt(++s),(c===43||c===45)&&(c=o.charCodeAt(++s)),s=g(e,s,c),c=o.charCodeAt(s)),c===46||(0,i.isNameStart)(c))throw(0,t.syntaxError)(e.source,s,`Invalid number, expected digit but got: ${d(e,s)}.`);return f(e,l?a.TokenKind.FLOAT:a.TokenKind.INT,n,s,o.slice(n,s))}function g(e,n,r){if(!(0,i.isDigit)(r))throw(0,t.syntaxError)(e.source,n,`Invalid number, expected digit but got: ${d(e,n)}.`);let a=e.source.body,o=n+1;for(;(0,i.isDigit)(a.charCodeAt(o));)++o;return o}function _(e,n){let r=e.source.body,i=r.length,o=n+1,l=o,u=``;for(;o<i;){let i=r.charCodeAt(o);if(i===34)return u+=r.slice(l,o),f(e,a.TokenKind.STRING,n,o+1,u);if(i===92){u+=r.slice(l,o);let t=r.charCodeAt(o+1)===117?r.charCodeAt(o+2)===123?v(e,o):y(e,o):x(e,o);u+=t.value,o+=t.size,l=o;continue}if(i===10||i===13)break;if(s(i))++o;else if(c(r,o))o+=2;else throw(0,t.syntaxError)(e.source,o,`Invalid character within String: ${d(e,o)}.`)}throw(0,t.syntaxError)(e.source,o,`Unterminated string.`)}function v(e,n){let r=e.source.body,i=0,a=3;for(;a<12;){let e=r.charCodeAt(n+a++);if(e===125){if(a<5||!s(i))break;return{value:String.fromCodePoint(i),size:a}}if(i=i<<4|b(e),i<0)break}throw(0,t.syntaxError)(e.source,n,`Invalid Unicode escape sequence: "${r.slice(n,n+a)}".`)}function y(e,n){let r=e.source.body,i=ee(r,n+2);if(s(i))return{value:String.fromCodePoint(i),size:6};if(l(i)&&r.charCodeAt(n+6)===92&&r.charCodeAt(n+7)===117){let e=ee(r,n+8);if(u(e))return{value:String.fromCodePoint(i,e),size:12}}throw(0,t.syntaxError)(e.source,n,`Invalid Unicode escape sequence: "${r.slice(n,n+6)}".`)}function ee(e,t){return b(e.charCodeAt(t))<<12|b(e.charCodeAt(t+1))<<8|b(e.charCodeAt(t+2))<<4|b(e.charCodeAt(t+3))}function b(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function x(e,n){let r=e.source.body;switch(r.charCodeAt(n+1)){case 34:return{value:`"`,size:2};case 92:return{value:`\\`,size:2};case 47:return{value:`/`,size:2};case 98:return{value:`\b`,size:2};case 102:return{value:`\f`,size:2};case 110:return{value:`
45
+ `,size:2};case 114:return{value:`\r`,size:2};case 116:return{value:` `,size:2}}throw(0,t.syntaxError)(e.source,n,`Invalid character escape sequence: "${r.slice(n,n+2)}".`)}function te(e,n){let i=e.source.body,o=i.length,l=e.lineStart,u=n+3,p=u,m=``,h=[];for(;u<o;){let o=i.charCodeAt(u);if(o===34&&i.charCodeAt(u+1)===34&&i.charCodeAt(u+2)===34){m+=i.slice(p,u),h.push(m);let t=f(e,a.TokenKind.BLOCK_STRING,n,u+3,(0,r.dedentBlockStringLines)(h).join(`
46
+ `));return e.line+=h.length-1,e.lineStart=l,t}if(o===92&&i.charCodeAt(u+1)===34&&i.charCodeAt(u+2)===34&&i.charCodeAt(u+3)===34){m+=i.slice(p,u),p=u+1,u+=4;continue}if(o===10||o===13){m+=i.slice(p,u),h.push(m),o===13&&i.charCodeAt(u+1)===10?u+=2:++u,m=``,p=u,l=u;continue}if(s(o))++u;else if(c(i,u))u+=2;else throw(0,t.syntaxError)(e.source,u,`Invalid character within String: ${d(e,u)}.`)}throw(0,t.syntaxError)(e.source,u,`Unterminated string.`)}function S(e,t){let n=e.source.body,r=n.length,o=t+1;for(;o<r;){let e=n.charCodeAt(o);if((0,i.isNameContinue)(e))++o;else break}return f(e,a.TokenKind.NAME,t,o,n.slice(t,o))}})),Ri=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SchemaCoordinateLexer=void 0;var t=ji(),n=Mi(),r=Pi(),i=Li(),a=Ii();e.SchemaCoordinateLexer=class{line=1;lineStart=0;constructor(e){let t=new n.Token(a.TokenKind.SOF,0,0,0,0);this.source=e,this.lastToken=t,this.token=t}get[Symbol.toStringTag](){return`SchemaCoordinateLexer`}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==a.TokenKind.EOF){let t=o(this,e.end);e.next=t,t.prev=e,e=t}return e}};function o(e,n){let o=e.source.body,s=o.length,c=n;if(c<s){let n=o.charCodeAt(c);switch(n){case 46:return(0,i.createToken)(e,a.TokenKind.DOT,c,c+1);case 40:return(0,i.createToken)(e,a.TokenKind.PAREN_L,c,c+1);case 41:return(0,i.createToken)(e,a.TokenKind.PAREN_R,c,c+1);case 58:return(0,i.createToken)(e,a.TokenKind.COLON,c,c+1);case 64:return(0,i.createToken)(e,a.TokenKind.AT,c,c+1)}if((0,r.isNameStart)(n))return(0,i.readName)(e,c);throw(0,t.syntaxError)(e.source,c,`Invalid character: ${(0,i.printCodePointAt)(e,c)}.`)}return(0,i.createToken)(e,a.TokenKind.EOF,s,s)}})),zi=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.devAssert=t;function t(e,t){if(!e)throw Error(t)}})),Bi=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.inspect=t;function t(e){return n(e,[])}function n(e,t){switch(typeof e){case`string`:return JSON.stringify(e);case`function`:return e.name?`[function ${e.name}]`:`[function]`;case`object`:return r(e,t);default:return String(e)}}function r(e,t){if(e===null)return`null`;if(t.includes(e))return`[Circular]`;let r=[...t,e];if(i(e)){let t=e.toJSON();if(t!==e)return typeof t==`string`?t:n(t,r)}else if(Array.isArray(e))return o(e,r);return a(e,r)}function i(e){return typeof e.toJSON==`function`}function a(e,t){let r=Object.entries(e);return r.length===0?`{}`:t.length>2?`[`+s(e)+`]`:`{ `+r.map(([e,r])=>e+`: `+n(r,t)).join(`, `)+` }`}function o(e,t){if(e.length===0)return`[]`;if(t.length>2)return`[Array]`;let r=Math.min(10,e.length),i=e.length-r,a=[];for(let i=0;i<r;++i)a.push(n(e[i],t));return i===1?a.push(`... 1 more item`):i>1&&a.push(`... ${i} more items`),`[`+a.join(`, `)+`]`}function s(e){let t=Object.prototype.toString.call(e).replace(/^\[object /,``).replace(/]$/,``);if(t===`Object`&&typeof e.constructor==`function`){let t=e.constructor.name;if(typeof t==`string`&&t!==``)return t}return t}})),Vi=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.instanceOf=void 0;var t=Bi();e.instanceOf=globalThis.process&&process.env.NODE_ENV===`production`?function(e,t){return e instanceof t}:function(e,n){if(e instanceof n)return!0;if(typeof e==`object`&&e){let r=n.prototype[Symbol.toStringTag];if(r===(Symbol.toStringTag in e?e[Symbol.toStringTag]:e.constructor?.name)){let n=(0,t.inspect)(e);throw Error(`Cannot use ${r} "${n}" from another module or realm.
47
47
 
48
48
  Ensure that there is only one instance of "graphql" in the node_modules
49
49
  directory. If different versions of "graphql" are the dependencies of other
@@ -54,6 +54,6 @@ https://yarnpkg.com/en/docs/selective-version-resolutions
54
54
  Duplicate "graphql" modules cannot be used at the same time since different
55
55
  versions may have different capabilities and behavior. The data from one
56
56
  version used in the function from another could produce confusing and
57
- spurious results.`)}}return!1}})),Ei=/* @__PURE__ */ t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Source=void 0,e.isSource=a;var t=Ci(),n=wi(),r=Ti(),i=class{constructor(e,r=`GraphQL request`,i={line:1,column:1}){typeof e==`string`||(0,t.devAssert)(!1,`Body must be a string. Received: ${(0,n.inspect)(e)}.`),this.body=e,this.name=r,this.locationOffset=i,this.locationOffset.line>0||(0,t.devAssert)(!1,`line in locationOffset is 1-indexed and must be positive.`),this.locationOffset.column>0||(0,t.devAssert)(!1,`column in locationOffset is 1-indexed and must be positive.`)}get[Symbol.toStringTag](){return`Source`}};e.Source=i;function a(e){return(0,r.instanceOf)(e,i)}})),Di=/* @__PURE__ */ t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Parser=void 0,e.parse=c;var t=hi(),n=gi(),r=_i(),i=mi(),a=xi();Si();var o=Ei(),s=bi();function c(e,t){let n=new l(e,t),r=n.parseDocument();return Object.defineProperty(r,"tokenCount",{enumerable:!1,value:n.tokenCount}),r}var l=class{constructor(e,t={}){let{lexer:n,...r}=t;if(n)this._lexer=n;else{let t=(0,o.isSource)(e)?e:new o.Source(e);this._lexer=new a.Lexer(t)}this._options=r,this._tokenCounter=0}get tokenCount(){return this._tokenCounter}parseName(){let e=this.expectToken(s.TokenKind.NAME);return this.node(e,{kind:i.Kind.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:i.Kind.DOCUMENT,definitions:this.many(s.TokenKind.SOF,this.parseDefinition,s.TokenKind.EOF)})}parseDefinition(){if(this.peek(s.TokenKind.BRACE_L))return this.parseOperationDefinition();let e=this.peekDescription(),n=e?this._lexer.lookahead():this._lexer.token;if(e&&n.kind===s.TokenKind.BRACE_L)throw(0,t.syntaxError)(this._lexer.source,this._lexer.token.start,`Unexpected description, descriptions are not supported on shorthand queries.`);if(n.kind===s.TokenKind.NAME){switch(n.value){case`schema`:return this.parseSchemaDefinition();case`scalar`:return this.parseScalarTypeDefinition();case`type`:return this.parseObjectTypeDefinition();case`interface`:return this.parseInterfaceTypeDefinition();case`union`:return this.parseUnionTypeDefinition();case`enum`:return this.parseEnumTypeDefinition();case`input`:return this.parseInputObjectTypeDefinition();case`directive`:return this.parseDirectiveDefinition()}switch(n.value){case`query`:case`mutation`:case`subscription`:return this.parseOperationDefinition();case`fragment`:return this.parseFragmentDefinition()}if(e)throw(0,t.syntaxError)(this._lexer.source,this._lexer.token.start,`Unexpected description, only GraphQL definitions support descriptions.`);if(n.value===`extend`)return this.parseTypeSystemExtension()}throw this.unexpected(n)}parseOperationDefinition(){let e=this._lexer.token;if(this.peek(s.TokenKind.BRACE_L))return this.node(e,{kind:i.Kind.OPERATION_DEFINITION,operation:n.OperationTypeNode.QUERY,description:void 0,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});let t=this.parseDescription(),r=this.parseOperationType(),a;return this.peek(s.TokenKind.NAME)&&(a=this.parseName()),this.node(e,{kind:i.Kind.OPERATION_DEFINITION,operation:r,description:t,name:a,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){let e=this.expectToken(s.TokenKind.NAME);switch(e.value){case`query`:return n.OperationTypeNode.QUERY;case`mutation`:return n.OperationTypeNode.MUTATION;case`subscription`:return n.OperationTypeNode.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(s.TokenKind.PAREN_L,this.parseVariableDefinition,s.TokenKind.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:i.Kind.VARIABLE_DEFINITION,description:this.parseDescription(),variable:this.parseVariable(),type:(this.expectToken(s.TokenKind.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(s.TokenKind.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){let e=this._lexer.token;return this.expectToken(s.TokenKind.DOLLAR),this.node(e,{kind:i.Kind.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:i.Kind.SELECTION_SET,selections:this.many(s.TokenKind.BRACE_L,this.parseSelection,s.TokenKind.BRACE_R)})}parseSelection(){return this.peek(s.TokenKind.SPREAD)?this.parseFragment():this.parseField()}parseField(){let e=this._lexer.token,t=this.parseName(),n,r;return this.expectOptionalToken(s.TokenKind.COLON)?(n=t,r=this.parseName()):r=t,this.node(e,{kind:i.Kind.FIELD,alias:n,name:r,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(s.TokenKind.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){let t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(s.TokenKind.PAREN_L,t,s.TokenKind.PAREN_R)}parseArgument(e=!1){let t=this._lexer.token,n=this.parseName();return this.expectToken(s.TokenKind.COLON),this.node(t,{kind:i.Kind.ARGUMENT,name:n,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){let e=this._lexer.token;this.expectToken(s.TokenKind.SPREAD);let t=this.expectOptionalKeyword(`on`);return!t&&this.peek(s.TokenKind.NAME)?this.node(e,{kind:i.Kind.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:i.Kind.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){let e=this._lexer.token,t=this.parseDescription();return this.expectKeyword(`fragment`),this._options.allowLegacyFragmentVariables===!0?this.node(e,{kind:i.Kind.FRAGMENT_DEFINITION,description:t,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword(`on`),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(e,{kind:i.Kind.FRAGMENT_DEFINITION,description:t,name:this.parseFragmentName(),typeCondition:(this.expectKeyword(`on`),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if(this._lexer.token.value===`on`)throw this.unexpected();return this.parseName()}parseValueLiteral(e){let n=this._lexer.token;switch(n.kind){case s.TokenKind.BRACKET_L:return this.parseList(e);case s.TokenKind.BRACE_L:return this.parseObject(e);case s.TokenKind.INT:return this.advanceLexer(),this.node(n,{kind:i.Kind.INT,value:n.value});case s.TokenKind.FLOAT:return this.advanceLexer(),this.node(n,{kind:i.Kind.FLOAT,value:n.value});case s.TokenKind.STRING:case s.TokenKind.BLOCK_STRING:return this.parseStringLiteral();case s.TokenKind.NAME:switch(this.advanceLexer(),n.value){case`true`:return this.node(n,{kind:i.Kind.BOOLEAN,value:!0});case`false`:return this.node(n,{kind:i.Kind.BOOLEAN,value:!1});case`null`:return this.node(n,{kind:i.Kind.NULL});default:return this.node(n,{kind:i.Kind.ENUM,value:n.value})}case s.TokenKind.DOLLAR:if(e){if(this.expectToken(s.TokenKind.DOLLAR),this._lexer.token.kind===s.TokenKind.NAME){let e=this._lexer.token.value;throw(0,t.syntaxError)(this._lexer.source,n.start,`Unexpected variable "$${e}" in constant value.`)}throw this.unexpected(n)}return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){let e=this._lexer.token;return this.advanceLexer(),this.node(e,{kind:i.Kind.STRING,value:e.value,block:e.kind===s.TokenKind.BLOCK_STRING})}parseList(e){return this.node(this._lexer.token,{kind:i.Kind.LIST,values:this.any(s.TokenKind.BRACKET_L,()=>this.parseValueLiteral(e),s.TokenKind.BRACKET_R)})}parseObject(e){return this.node(this._lexer.token,{kind:i.Kind.OBJECT,fields:this.any(s.TokenKind.BRACE_L,()=>this.parseObjectField(e),s.TokenKind.BRACE_R)})}parseObjectField(e){let t=this._lexer.token,n=this.parseName();return this.expectToken(s.TokenKind.COLON),this.node(t,{kind:i.Kind.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e)})}parseDirectives(e){let t=[];for(;this.peek(s.TokenKind.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){let t=this._lexer.token;return this.expectToken(s.TokenKind.AT),this.node(t,{kind:i.Kind.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){let e=this._lexer.token,t;if(this.expectOptionalToken(s.TokenKind.BRACKET_L)){let n=this.parseTypeReference();this.expectToken(s.TokenKind.BRACKET_R),t=this.node(e,{kind:i.Kind.LIST_TYPE,type:n})}else t=this.parseNamedType();return this.expectOptionalToken(s.TokenKind.BANG)?this.node(e,{kind:i.Kind.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:i.Kind.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(s.TokenKind.STRING)||this.peek(s.TokenKind.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword(`schema`);let n=this.parseConstDirectives(),r=this.many(s.TokenKind.BRACE_L,this.parseOperationTypeDefinition,s.TokenKind.BRACE_R);return this.node(e,{kind:i.Kind.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:r})}parseOperationTypeDefinition(){let e=this._lexer.token,t=this.parseOperationType();this.expectToken(s.TokenKind.COLON);let n=this.parseNamedType();return this.node(e,{kind:i.Kind.OPERATION_TYPE_DEFINITION,operation:t,type:n})}parseScalarTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword(`scalar`);let n=this.parseName(),r=this.parseConstDirectives();return this.node(e,{kind:i.Kind.SCALAR_TYPE_DEFINITION,description:t,name:n,directives:r})}parseObjectTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword(`type`);let n=this.parseName(),r=this.parseImplementsInterfaces(),a=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(e,{kind:i.Kind.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:a,fields:o})}parseImplementsInterfaces(){return this.expectOptionalKeyword(`implements`)?this.delimitedMany(s.TokenKind.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(s.TokenKind.BRACE_L,this.parseFieldDefinition,s.TokenKind.BRACE_R)}parseFieldDefinition(){let e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseArgumentDefs();this.expectToken(s.TokenKind.COLON);let a=this.parseTypeReference(),o=this.parseConstDirectives();return this.node(e,{kind:i.Kind.FIELD_DEFINITION,description:t,name:n,arguments:r,type:a,directives:o})}parseArgumentDefs(){return this.optionalMany(s.TokenKind.PAREN_L,this.parseInputValueDef,s.TokenKind.PAREN_R)}parseInputValueDef(){let e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(s.TokenKind.COLON);let r=this.parseTypeReference(),a;this.expectOptionalToken(s.TokenKind.EQUALS)&&(a=this.parseConstValueLiteral());let o=this.parseConstDirectives();return this.node(e,{kind:i.Kind.INPUT_VALUE_DEFINITION,description:t,name:n,type:r,defaultValue:a,directives:o})}parseInterfaceTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword(`interface`);let n=this.parseName(),r=this.parseImplementsInterfaces(),a=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(e,{kind:i.Kind.INTERFACE_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:a,fields:o})}parseUnionTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword(`union`);let n=this.parseName(),r=this.parseConstDirectives(),a=this.parseUnionMemberTypes();return this.node(e,{kind:i.Kind.UNION_TYPE_DEFINITION,description:t,name:n,directives:r,types:a})}parseUnionMemberTypes(){return this.expectOptionalToken(s.TokenKind.EQUALS)?this.delimitedMany(s.TokenKind.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword(`enum`);let n=this.parseName(),r=this.parseConstDirectives(),a=this.parseEnumValuesDefinition();return this.node(e,{kind:i.Kind.ENUM_TYPE_DEFINITION,description:t,name:n,directives:r,values:a})}parseEnumValuesDefinition(){return this.optionalMany(s.TokenKind.BRACE_L,this.parseEnumValueDefinition,s.TokenKind.BRACE_R)}parseEnumValueDefinition(){let e=this._lexer.token,t=this.parseDescription(),n=this.parseEnumValueName(),r=this.parseConstDirectives();return this.node(e,{kind:i.Kind.ENUM_VALUE_DEFINITION,description:t,name:n,directives:r})}parseEnumValueName(){if(this._lexer.token.value===`true`||this._lexer.token.value===`false`||this._lexer.token.value===`null`)throw(0,t.syntaxError)(this._lexer.source,this._lexer.token.start,`${u(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword(`input`);let n=this.parseName(),r=this.parseConstDirectives(),a=this.parseInputFieldsDefinition();return this.node(e,{kind:i.Kind.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:r,fields:a})}parseInputFieldsDefinition(){return this.optionalMany(s.TokenKind.BRACE_L,this.parseInputValueDef,s.TokenKind.BRACE_R)}parseTypeSystemExtension(){let e=this._lexer.lookahead();if(e.kind===s.TokenKind.NAME)switch(e.value){case`schema`:return this.parseSchemaExtension();case`scalar`:return this.parseScalarTypeExtension();case`type`:return this.parseObjectTypeExtension();case`interface`:return this.parseInterfaceTypeExtension();case`union`:return this.parseUnionTypeExtension();case`enum`:return this.parseEnumTypeExtension();case`input`:return this.parseInputObjectTypeExtension()}throw this.unexpected(e)}parseSchemaExtension(){let e=this._lexer.token;this.expectKeyword(`extend`),this.expectKeyword(`schema`);let t=this.parseConstDirectives(),n=this.optionalMany(s.TokenKind.BRACE_L,this.parseOperationTypeDefinition,s.TokenKind.BRACE_R);if(t.length===0&&n.length===0)throw this.unexpected();return this.node(e,{kind:i.Kind.SCHEMA_EXTENSION,directives:t,operationTypes:n})}parseScalarTypeExtension(){let e=this._lexer.token;this.expectKeyword(`extend`),this.expectKeyword(`scalar`);let t=this.parseName(),n=this.parseConstDirectives();if(n.length===0)throw this.unexpected();return this.node(e,{kind:i.Kind.SCALAR_TYPE_EXTENSION,name:t,directives:n})}parseObjectTypeExtension(){let e=this._lexer.token;this.expectKeyword(`extend`),this.expectKeyword(`type`);let t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),a=this.parseFieldsDefinition();if(n.length===0&&r.length===0&&a.length===0)throw this.unexpected();return this.node(e,{kind:i.Kind.OBJECT_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:a})}parseInterfaceTypeExtension(){let e=this._lexer.token;this.expectKeyword(`extend`),this.expectKeyword(`interface`);let t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),a=this.parseFieldsDefinition();if(n.length===0&&r.length===0&&a.length===0)throw this.unexpected();return this.node(e,{kind:i.Kind.INTERFACE_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:a})}parseUnionTypeExtension(){let e=this._lexer.token;this.expectKeyword(`extend`),this.expectKeyword(`union`);let t=this.parseName(),n=this.parseConstDirectives(),r=this.parseUnionMemberTypes();if(n.length===0&&r.length===0)throw this.unexpected();return this.node(e,{kind:i.Kind.UNION_TYPE_EXTENSION,name:t,directives:n,types:r})}parseEnumTypeExtension(){let e=this._lexer.token;this.expectKeyword(`extend`),this.expectKeyword(`enum`);let t=this.parseName(),n=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();if(n.length===0&&r.length===0)throw this.unexpected();return this.node(e,{kind:i.Kind.ENUM_TYPE_EXTENSION,name:t,directives:n,values:r})}parseInputObjectTypeExtension(){let e=this._lexer.token;this.expectKeyword(`extend`),this.expectKeyword(`input`);let t=this.parseName(),n=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();if(n.length===0&&r.length===0)throw this.unexpected();return this.node(e,{kind:i.Kind.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:r})}parseDirectiveDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword(`directive`),this.expectToken(s.TokenKind.AT);let n=this.parseName(),r=this.parseArgumentDefs(),a=this.expectOptionalKeyword(`repeatable`);this.expectKeyword(`on`);let o=this.parseDirectiveLocations();return this.node(e,{kind:i.Kind.DIRECTIVE_DEFINITION,description:t,name:n,arguments:r,repeatable:a,locations:o})}parseDirectiveLocations(){return this.delimitedMany(s.TokenKind.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){let e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(r.DirectiveLocation,t.value))return t;throw this.unexpected(e)}parseSchemaCoordinate(){let e=this._lexer.token,t=this.expectOptionalToken(s.TokenKind.AT),n=this.parseName(),r;!t&&this.expectOptionalToken(s.TokenKind.DOT)&&(r=this.parseName());let a;return(t||r)&&this.expectOptionalToken(s.TokenKind.PAREN_L)&&(a=this.parseName(),this.expectToken(s.TokenKind.COLON),this.expectToken(s.TokenKind.PAREN_R)),t?a?this.node(e,{kind:i.Kind.DIRECTIVE_ARGUMENT_COORDINATE,name:n,argumentName:a}):this.node(e,{kind:i.Kind.DIRECTIVE_COORDINATE,name:n}):r?a?this.node(e,{kind:i.Kind.ARGUMENT_COORDINATE,name:n,fieldName:r,argumentName:a}):this.node(e,{kind:i.Kind.MEMBER_COORDINATE,name:n,memberName:r}):this.node(e,{kind:i.Kind.TYPE_COORDINATE,name:n})}node(e,t){return this._options.noLocation!==!0&&(t.loc=new n.Location(e,this._lexer.lastToken,this._lexer.source)),t}peek(e){return this._lexer.token.kind===e}expectToken(e){let n=this._lexer.token;if(n.kind===e)return this.advanceLexer(),n;throw(0,t.syntaxError)(this._lexer.source,n.start,`Expected ${d(e)}, found ${u(n)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e&&(this.advanceLexer(),!0)}expectKeyword(e){let n=this._lexer.token;if(n.kind===s.TokenKind.NAME&&n.value===e)this.advanceLexer();else throw(0,t.syntaxError)(this._lexer.source,n.start,`Expected "${e}", found ${u(n)}.`)}expectOptionalKeyword(e){let t=this._lexer.token;return t.kind===s.TokenKind.NAME&&t.value===e&&(this.advanceLexer(),!0)}unexpected(e){let n=e??this._lexer.token;return(0,t.syntaxError)(this._lexer.source,n.start,`Unexpected ${u(n)}.`)}any(e,t,n){this.expectToken(e);let r=[];for(;!this.expectOptionalToken(n);)r.push(t.call(this));return r}optionalMany(e,t,n){if(this.expectOptionalToken(e)){let e=[];do e.push(t.call(this));while(!this.expectOptionalToken(n));return e}return[]}many(e,t,n){this.expectToken(e);let r=[];do r.push(t.call(this));while(!this.expectOptionalToken(n));return r}delimitedMany(e,t){this.expectOptionalToken(e);let n=[];do n.push(t.call(this));while(this.expectOptionalToken(e));return n}advanceLexer(){let{maxTokens:e}=this._options,n=this._lexer.advance();if(n.kind!==s.TokenKind.EOF&&(++this._tokenCounter,e!==void 0&&this._tokenCounter>e))throw(0,t.syntaxError)(this._lexer.source,n.start,`Document contains more that ${e} tokens. Parsing aborted.`)}};e.Parser=l;function u(e){let t=e.value;return d(e.kind)+(t==null?``:` "${t}"`)}function d(e){return(0,a.isPunctuatorTokenKind)(e)?`"${e}"`:e}})),Oi=pi(),ki=mi(),Ai=Di();const ji={String:`text`,ID:`text`,OID:`text`,PHID:`text`,OLabel:`text`,URL:`text`,Date:`text`,DateTime:`text`,EmailAddress:`text`,EthereumAddress:`text`,Currency:`text`,Address:`text`,AttachmentRef:`text`,Int:`integer`,Float:`number`,Amount_Money:`number`,Amount_Percentage:`number`,Amount_Tokens:`number`,Boolean:`boolean`,Amount:`object`,Amount_Crypto:`object`,Amount_Currency:`object`,Amount_Fiat:`object`,Unknown:`json`};var Mi=class extends Error{constructor(e){super(`Invalid input SDL: ${e}`),this.name=`SdlSyntaxError`}};function Ni(e){return e.kind===ki.Kind.NON_NULL_TYPE?{...Ni(e.type),required:!0}:e.kind===ki.Kind.LIST_TYPE?{name:Ni(e.type).name,list:!0,required:!1}:{name:e.name.value,list:!1,required:!1}}function Pi(e){return(e.fields??[]).filter(e=>e.name.value!==`_`).map(e=>{let t=e.description?.value.replace(/\s+/g,` `);return{name:e.name.value,type:Ni(e.type),...t?{description:t}:{}}})}function Fi(e){let t;try{t=(0,Ai.parse)(e,{noLocation:!0})}catch(e){throw new Mi(e instanceof Oi.GraphQLError?e.message:String(e))}let n=/* @__PURE__ */ new Map,r=/* @__PURE__ */ new Map;for(let e of t.definitions)e.kind===ki.Kind.INPUT_OBJECT_TYPE_DEFINITION?n.set(e.name.value,Pi(e)):e.kind===ki.Kind.ENUM_TYPE_DEFINITION&&r.set(e.name.value,(e.values??[]).map(e=>e.name.value));return{inputs:n,enums:r}}const Ii=e=>e.replace(/[^A-Za-z0-9]/g,``).toLowerCase();function Li(e,t){let n=`${Ii(e)}input`,r=[...t].filter(e=>Ii(e)===n);return r.length===1?r[0]:void 0}function Ri(e,t){let{inputs:n,enums:r}=Fi(e),i=Li(t,n.keys()),a=i?n.get(i):void 0;return i&&a?{rootName:i,root:a,inputs:n,enums:r}:null}function zi(e,t){return t.inputs.has(e.name)?`object`:t.enums.has(e.name)?`enum`:ji[e.name]??`unsupported`}function Bi(e){let t=e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[_-]+/g,` `).toLowerCase().trim();return t.charAt(0).toUpperCase()+t.slice(1)}function Vi(e,t){let n={displayName:Bi(e.name),required:e.type.required,...e.description?{description:e.description}:{}};if(e.type.list)return Y.Json({...n,description:e.description??`A JSON list`});switch(zi(e.type,t)){case`text`:return Y.ShortText(n);case`integer`:case`number`:return Y.ShortText({...n,description:e.description??`A number`});case`boolean`:return Y.StaticDropdown({...n,options:{options:[{label:`Yes`,value:!0},{label:`No`,value:!1}]}});case`enum`:return Y.StaticDropdown({...n,options:{options:(t.enums.get(e.type.name)??[]).map(e=>({label:Bi(e),value:e}))}});case`unsupported`:return Y.Json({...n,description:`Type ${e.type.name} is not supported by this form`});default:return Y.Json(n)}}function Hi(e){let t={};for(let n of e.root)t[n.name]=Vi(n,e);return t}function Ui(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const Wi=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function Gi(e){let t=typeof e==`string`?e:JSON.stringify(e);return t.length>60?`${t.slice(0,57)}...`:t}function Ki(e,t,n){let r=t=>/* @__PURE__ */ Error(`input "${e.name}" (${e.type.name}) expects ${t}; got ${Gi(n)}`);if(e.type.list){if(!Array.isArray(n))throw r(`a list`);return n}switch(t){case`text`:case`enum`:if(typeof n!=`string`)throw r(`text`);return n;case`integer`:case`number`:{let e=typeof n==`number`?n:typeof n==`string`&&Wi.test(n.trim())?Number(n.trim()):NaN;if(!Number.isFinite(e))throw r(`a number`);if(t===`integer`&&!Number.isInteger(e))throw r(`an integer`);return e}case`boolean`:if(typeof n==`boolean`)return n;if(n===`true`||n===`false`)return n===`true`;throw r(`true or false`);case`object`:if(!Ui(n))throw r(`an object`);return n;case`json`:return n;case`unsupported`:throw Error(`input "${e.name}" has type ${e.type.name}, which this piece cannot map`)}}function qi(e,t){let n=t??{};if(!Ui(n))throw Error(`"input" must be an object; got ${Gi(n)}`);let r={};for(let t of e.root){let i=n[t.name];i!=null&&i!==``&&(r[t.name]=Ki(t,zi(t.type,e),i))}return r}const Ji=[{label:`Exact`,value:`exact`},{label:`Extract from AI output`,value:`extract`}];function Yi(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Xi(e){let t=typeof e==`string`?e:JSON.stringify(e);return t.length>60?`${t.slice(0,57)}...`:t}function Zi(e){return e.trim().replace(/^```(?:json)?\s*/i,``).replace(/```$/,``).trim()}function Qi(e){let t=[],n=0,r=-1,i=!1,a=!1;for(let o=0;o<e.length;o++){let s=e[o];if(i){a?a=!1:s===`\\`?a=!0:s===`"`&&(i=!1);continue}if(s===`"`){i=!0;continue}if(s===`{`||s===`[`){n===0&&(r=o),n++;continue}if(s===`}`||s===`]`){if(n===0)continue;n--,n===0&&r>=0&&(t.push(e.slice(r,o+1)),r=-1)}}return t}function $i(e){let t=Zi(e);try{return JSON.parse(t)}catch{}let n=Qi(t);for(let e=n.length-1;e>=0;e--)try{return JSON.parse(n[e])}catch{}throw SyntaxError(`no JSON value found`)}const ea=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i,ta=/(?<![A-Za-z0-9_-])[A-Za-z0-9_-]{43}(?![A-Za-z0-9_-])/;function na(e){let t=ea.exec(e)??ta.exec(e);return t?t[0]:e.trim().replace(/^["'`]+|["'`]+$/g,``).trim()||void 0}const ra=`set "Parse" to "Extract from AI output" to read one out of text`;var ia=class e{block;mode;extractedFrom={};constructor(e,t){this.block=e,this.mode=t}static of(t,n){if(n==null||n===``)return new e(t,`exact`);if(n!==`exact`&&n!==`extract`)throw Error(`${t}: "parse" must be "exact" or "extract"`);return new e(t,n)}get extract(){return this.mode===`extract`}documentId(e,t){if(e!=null&&e!==``){if(typeof e!=`string`)throw Error(`${this.block}: "${t}" must be a document id; got ${Xi(e)}`);if(this.extract){let n=na(e);return n!==void 0&&n!==e&&(this.extractedFrom[t]=e),n}if(!/^[^\s"'`]+$/.test(e))throw Error(`${this.block}: "${t}" is not a document id: ${Xi(e)}; ${ra}`);return e}}json(e,t){if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch(e){if(!this.extract){let n=e instanceof Error?e.message:String(e);throw Error(`${this.block}: "${t}" is not valid JSON (${n}); ${ra}`,{cause:e})}}try{let n=$i(e);return this.extractedFrom[t]=e,n}catch{throw Error(`${this.block}: "${t}" holds no JSON value`)}}output(){return Object.keys(this.extractedFrom).length?{extractedFrom:this.extractedFrom}:{}}};function aa(e,t,n){return e.map((e,r)=>{if(!Yi(e)||typeof e.type!=`string`)throw Error(`${t.block}: ${n}[${r}] needs a string "type"`);if(e.scope!==void 0&&typeof e.scope!=`string`)throw Error(`${t.block}: ${n}[${r}].scope must be a string`);return{type:e.type,input:e.input,scope:e.scope}})}function oa(e,t,n=`actions`){if(e==null||e===``)return{actions:[]};let r=t.json(e,n);if(Array.isArray(r))return{actions:aa(r,t,n)};if(Yi(r)){if(Array.isArray(r.actions))return{documentId:t.documentId(r.documentId,`${n}.documentId`),actions:aa(r.actions,t,n)};if(t.extract&&typeof r.type==`string`)return{actions:aa([r],t,n)}}throw Error(`${t.block}: "${n}" must be a list of actions or an object with an "actions" list; got ${Xi(r)}`)}function sa(e,t,n=`actions`){return oa(e,t,n).actions}function ca(e,t){if(e==null||e===``)return{};let n=t.json(e,`payload`);if(!Yi(n))throw Error(`${t.block}: "payload" must be an object; got ${Xi(n)}`);for(let e of[`documentType`,`name`])if(n[e]!==void 0&&typeof n[e]!=`string`)throw Error(`${t.block}: "payload.${e}" must be a string`);return{documentType:n.documentType,name:n.name,actions:n.actions}}function la(e,t){if(e==null||e===``)return{};let n=t.json(e,`input`);if(!Yi(n))throw Error(`${t.block}: "input" must be an object; got ${Xi(n)}`);return n}function ua(e){let t=typeof e==`string`?e.split(`,`):e;return Array.isArray(t)?t.map(e=>{if(typeof e==`string`)return e;let t=e;return typeof t?.type==`string`?t.type:``}).map(e=>e.trim()).filter(Boolean):[]}function da(e){if(typeof e!=`string`)return;let t=e.trim();if(t&&!t.includes(`{{`))return t}function fa(e){let t=e?.nodes;return Array.isArray(t)?t.filter(e=>typeof e==`object`&&!!e&&typeof e.id==`string`):[]}function pa(e){let t=fa(e).filter(e=>e.kind===`folder`),n=new Map(t.map(e=>[e.id,e])),r=e=>{let t=[],r=/* @__PURE__ */ new Set,i=e;for(;i&&!r.has(i.id);)r.add(i.id),t.unshift(i.name||`(unnamed)`),i=i.parentFolder?n.get(i.parentFolder):void 0;return t.join(` / `)};return t.map(e=>({label:r(e),value:e.id})).sort((e,t)=>e.label.localeCompare(t.label))}const ma=/\b(?:input|enum|type)\s+(\w+)/g,ha=/* @__PURE__ */ new Set([`String`,`Int`,`Float`,`Boolean`,`ID`]);function ga(e,t,n){return RegExp(`${t}\\s+${n}\\s*\\{[^}]*\\}`).exec(e)?.[0]??null}function _a(e,t){if(!t)return e;let n=new Set([...e.matchAll(ma)].map(e=>e[1])),r=[...new Set([...e.matchAll(/:\s*\[?\s*(\w+)/g)].map(e=>e[1]).filter(e=>!n.has(e)&&!ha.has(e)))].map(e=>ga(t,`enum`,e)).filter(e=>e!==null);return r.length?`${e}\n\n${r.join(`
57
+ spurious results.`)}}return!1}})),Hi=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Source=void 0,e.isSource=a;var t=zi(),n=Bi(),r=Vi(),i=class{constructor(e,r=`GraphQL request`,i={line:1,column:1}){typeof e==`string`||(0,t.devAssert)(!1,`Body must be a string. Received: ${(0,n.inspect)(e)}.`),this.body=e,this.name=r,this.locationOffset=i,this.locationOffset.line>0||(0,t.devAssert)(!1,`line in locationOffset is 1-indexed and must be positive.`),this.locationOffset.column>0||(0,t.devAssert)(!1,`column in locationOffset is 1-indexed and must be positive.`)}get[Symbol.toStringTag](){return`Source`}};e.Source=i;function a(e){return(0,r.instanceOf)(e,i)}})),Ui=/* @__PURE__ */ r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Parser=void 0,e.parse=c;var t=ji(),n=Mi(),r=Ni(),i=Ai(),a=Li();Ri();var o=Hi(),s=Ii();function c(e,t){let n=new l(e,t),r=n.parseDocument();return Object.defineProperty(r,"tokenCount",{enumerable:!1,value:n.tokenCount}),r}var l=class{constructor(e,t={}){let{lexer:n,...r}=t;if(n)this._lexer=n;else{let t=(0,o.isSource)(e)?e:new o.Source(e);this._lexer=new a.Lexer(t)}this._options=r,this._tokenCounter=0}get tokenCount(){return this._tokenCounter}parseName(){let e=this.expectToken(s.TokenKind.NAME);return this.node(e,{kind:i.Kind.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:i.Kind.DOCUMENT,definitions:this.many(s.TokenKind.SOF,this.parseDefinition,s.TokenKind.EOF)})}parseDefinition(){if(this.peek(s.TokenKind.BRACE_L))return this.parseOperationDefinition();let e=this.peekDescription(),n=e?this._lexer.lookahead():this._lexer.token;if(e&&n.kind===s.TokenKind.BRACE_L)throw(0,t.syntaxError)(this._lexer.source,this._lexer.token.start,`Unexpected description, descriptions are not supported on shorthand queries.`);if(n.kind===s.TokenKind.NAME){switch(n.value){case`schema`:return this.parseSchemaDefinition();case`scalar`:return this.parseScalarTypeDefinition();case`type`:return this.parseObjectTypeDefinition();case`interface`:return this.parseInterfaceTypeDefinition();case`union`:return this.parseUnionTypeDefinition();case`enum`:return this.parseEnumTypeDefinition();case`input`:return this.parseInputObjectTypeDefinition();case`directive`:return this.parseDirectiveDefinition()}switch(n.value){case`query`:case`mutation`:case`subscription`:return this.parseOperationDefinition();case`fragment`:return this.parseFragmentDefinition()}if(e)throw(0,t.syntaxError)(this._lexer.source,this._lexer.token.start,`Unexpected description, only GraphQL definitions support descriptions.`);if(n.value===`extend`)return this.parseTypeSystemExtension()}throw this.unexpected(n)}parseOperationDefinition(){let e=this._lexer.token;if(this.peek(s.TokenKind.BRACE_L))return this.node(e,{kind:i.Kind.OPERATION_DEFINITION,operation:n.OperationTypeNode.QUERY,description:void 0,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});let t=this.parseDescription(),r=this.parseOperationType(),a;return this.peek(s.TokenKind.NAME)&&(a=this.parseName()),this.node(e,{kind:i.Kind.OPERATION_DEFINITION,operation:r,description:t,name:a,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){let e=this.expectToken(s.TokenKind.NAME);switch(e.value){case`query`:return n.OperationTypeNode.QUERY;case`mutation`:return n.OperationTypeNode.MUTATION;case`subscription`:return n.OperationTypeNode.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(s.TokenKind.PAREN_L,this.parseVariableDefinition,s.TokenKind.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:i.Kind.VARIABLE_DEFINITION,description:this.parseDescription(),variable:this.parseVariable(),type:(this.expectToken(s.TokenKind.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(s.TokenKind.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){let e=this._lexer.token;return this.expectToken(s.TokenKind.DOLLAR),this.node(e,{kind:i.Kind.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:i.Kind.SELECTION_SET,selections:this.many(s.TokenKind.BRACE_L,this.parseSelection,s.TokenKind.BRACE_R)})}parseSelection(){return this.peek(s.TokenKind.SPREAD)?this.parseFragment():this.parseField()}parseField(){let e=this._lexer.token,t=this.parseName(),n,r;return this.expectOptionalToken(s.TokenKind.COLON)?(n=t,r=this.parseName()):r=t,this.node(e,{kind:i.Kind.FIELD,alias:n,name:r,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(s.TokenKind.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){let t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(s.TokenKind.PAREN_L,t,s.TokenKind.PAREN_R)}parseArgument(e=!1){let t=this._lexer.token,n=this.parseName();return this.expectToken(s.TokenKind.COLON),this.node(t,{kind:i.Kind.ARGUMENT,name:n,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){let e=this._lexer.token;this.expectToken(s.TokenKind.SPREAD);let t=this.expectOptionalKeyword(`on`);return!t&&this.peek(s.TokenKind.NAME)?this.node(e,{kind:i.Kind.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:i.Kind.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){let e=this._lexer.token,t=this.parseDescription();return this.expectKeyword(`fragment`),this._options.allowLegacyFragmentVariables===!0?this.node(e,{kind:i.Kind.FRAGMENT_DEFINITION,description:t,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword(`on`),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(e,{kind:i.Kind.FRAGMENT_DEFINITION,description:t,name:this.parseFragmentName(),typeCondition:(this.expectKeyword(`on`),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if(this._lexer.token.value===`on`)throw this.unexpected();return this.parseName()}parseValueLiteral(e){let n=this._lexer.token;switch(n.kind){case s.TokenKind.BRACKET_L:return this.parseList(e);case s.TokenKind.BRACE_L:return this.parseObject(e);case s.TokenKind.INT:return this.advanceLexer(),this.node(n,{kind:i.Kind.INT,value:n.value});case s.TokenKind.FLOAT:return this.advanceLexer(),this.node(n,{kind:i.Kind.FLOAT,value:n.value});case s.TokenKind.STRING:case s.TokenKind.BLOCK_STRING:return this.parseStringLiteral();case s.TokenKind.NAME:switch(this.advanceLexer(),n.value){case`true`:return this.node(n,{kind:i.Kind.BOOLEAN,value:!0});case`false`:return this.node(n,{kind:i.Kind.BOOLEAN,value:!1});case`null`:return this.node(n,{kind:i.Kind.NULL});default:return this.node(n,{kind:i.Kind.ENUM,value:n.value})}case s.TokenKind.DOLLAR:if(e){if(this.expectToken(s.TokenKind.DOLLAR),this._lexer.token.kind===s.TokenKind.NAME){let e=this._lexer.token.value;throw(0,t.syntaxError)(this._lexer.source,n.start,`Unexpected variable "$${e}" in constant value.`)}throw this.unexpected(n)}return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){let e=this._lexer.token;return this.advanceLexer(),this.node(e,{kind:i.Kind.STRING,value:e.value,block:e.kind===s.TokenKind.BLOCK_STRING})}parseList(e){return this.node(this._lexer.token,{kind:i.Kind.LIST,values:this.any(s.TokenKind.BRACKET_L,()=>this.parseValueLiteral(e),s.TokenKind.BRACKET_R)})}parseObject(e){return this.node(this._lexer.token,{kind:i.Kind.OBJECT,fields:this.any(s.TokenKind.BRACE_L,()=>this.parseObjectField(e),s.TokenKind.BRACE_R)})}parseObjectField(e){let t=this._lexer.token,n=this.parseName();return this.expectToken(s.TokenKind.COLON),this.node(t,{kind:i.Kind.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e)})}parseDirectives(e){let t=[];for(;this.peek(s.TokenKind.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){let t=this._lexer.token;return this.expectToken(s.TokenKind.AT),this.node(t,{kind:i.Kind.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){let e=this._lexer.token,t;if(this.expectOptionalToken(s.TokenKind.BRACKET_L)){let n=this.parseTypeReference();this.expectToken(s.TokenKind.BRACKET_R),t=this.node(e,{kind:i.Kind.LIST_TYPE,type:n})}else t=this.parseNamedType();return this.expectOptionalToken(s.TokenKind.BANG)?this.node(e,{kind:i.Kind.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:i.Kind.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(s.TokenKind.STRING)||this.peek(s.TokenKind.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword(`schema`);let n=this.parseConstDirectives(),r=this.many(s.TokenKind.BRACE_L,this.parseOperationTypeDefinition,s.TokenKind.BRACE_R);return this.node(e,{kind:i.Kind.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:r})}parseOperationTypeDefinition(){let e=this._lexer.token,t=this.parseOperationType();this.expectToken(s.TokenKind.COLON);let n=this.parseNamedType();return this.node(e,{kind:i.Kind.OPERATION_TYPE_DEFINITION,operation:t,type:n})}parseScalarTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword(`scalar`);let n=this.parseName(),r=this.parseConstDirectives();return this.node(e,{kind:i.Kind.SCALAR_TYPE_DEFINITION,description:t,name:n,directives:r})}parseObjectTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword(`type`);let n=this.parseName(),r=this.parseImplementsInterfaces(),a=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(e,{kind:i.Kind.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:a,fields:o})}parseImplementsInterfaces(){return this.expectOptionalKeyword(`implements`)?this.delimitedMany(s.TokenKind.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(s.TokenKind.BRACE_L,this.parseFieldDefinition,s.TokenKind.BRACE_R)}parseFieldDefinition(){let e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseArgumentDefs();this.expectToken(s.TokenKind.COLON);let a=this.parseTypeReference(),o=this.parseConstDirectives();return this.node(e,{kind:i.Kind.FIELD_DEFINITION,description:t,name:n,arguments:r,type:a,directives:o})}parseArgumentDefs(){return this.optionalMany(s.TokenKind.PAREN_L,this.parseInputValueDef,s.TokenKind.PAREN_R)}parseInputValueDef(){let e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(s.TokenKind.COLON);let r=this.parseTypeReference(),a;this.expectOptionalToken(s.TokenKind.EQUALS)&&(a=this.parseConstValueLiteral());let o=this.parseConstDirectives();return this.node(e,{kind:i.Kind.INPUT_VALUE_DEFINITION,description:t,name:n,type:r,defaultValue:a,directives:o})}parseInterfaceTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword(`interface`);let n=this.parseName(),r=this.parseImplementsInterfaces(),a=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(e,{kind:i.Kind.INTERFACE_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:a,fields:o})}parseUnionTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword(`union`);let n=this.parseName(),r=this.parseConstDirectives(),a=this.parseUnionMemberTypes();return this.node(e,{kind:i.Kind.UNION_TYPE_DEFINITION,description:t,name:n,directives:r,types:a})}parseUnionMemberTypes(){return this.expectOptionalToken(s.TokenKind.EQUALS)?this.delimitedMany(s.TokenKind.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword(`enum`);let n=this.parseName(),r=this.parseConstDirectives(),a=this.parseEnumValuesDefinition();return this.node(e,{kind:i.Kind.ENUM_TYPE_DEFINITION,description:t,name:n,directives:r,values:a})}parseEnumValuesDefinition(){return this.optionalMany(s.TokenKind.BRACE_L,this.parseEnumValueDefinition,s.TokenKind.BRACE_R)}parseEnumValueDefinition(){let e=this._lexer.token,t=this.parseDescription(),n=this.parseEnumValueName(),r=this.parseConstDirectives();return this.node(e,{kind:i.Kind.ENUM_VALUE_DEFINITION,description:t,name:n,directives:r})}parseEnumValueName(){if(this._lexer.token.value===`true`||this._lexer.token.value===`false`||this._lexer.token.value===`null`)throw(0,t.syntaxError)(this._lexer.source,this._lexer.token.start,`${u(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword(`input`);let n=this.parseName(),r=this.parseConstDirectives(),a=this.parseInputFieldsDefinition();return this.node(e,{kind:i.Kind.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:r,fields:a})}parseInputFieldsDefinition(){return this.optionalMany(s.TokenKind.BRACE_L,this.parseInputValueDef,s.TokenKind.BRACE_R)}parseTypeSystemExtension(){let e=this._lexer.lookahead();if(e.kind===s.TokenKind.NAME)switch(e.value){case`schema`:return this.parseSchemaExtension();case`scalar`:return this.parseScalarTypeExtension();case`type`:return this.parseObjectTypeExtension();case`interface`:return this.parseInterfaceTypeExtension();case`union`:return this.parseUnionTypeExtension();case`enum`:return this.parseEnumTypeExtension();case`input`:return this.parseInputObjectTypeExtension()}throw this.unexpected(e)}parseSchemaExtension(){let e=this._lexer.token;this.expectKeyword(`extend`),this.expectKeyword(`schema`);let t=this.parseConstDirectives(),n=this.optionalMany(s.TokenKind.BRACE_L,this.parseOperationTypeDefinition,s.TokenKind.BRACE_R);if(t.length===0&&n.length===0)throw this.unexpected();return this.node(e,{kind:i.Kind.SCHEMA_EXTENSION,directives:t,operationTypes:n})}parseScalarTypeExtension(){let e=this._lexer.token;this.expectKeyword(`extend`),this.expectKeyword(`scalar`);let t=this.parseName(),n=this.parseConstDirectives();if(n.length===0)throw this.unexpected();return this.node(e,{kind:i.Kind.SCALAR_TYPE_EXTENSION,name:t,directives:n})}parseObjectTypeExtension(){let e=this._lexer.token;this.expectKeyword(`extend`),this.expectKeyword(`type`);let t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),a=this.parseFieldsDefinition();if(n.length===0&&r.length===0&&a.length===0)throw this.unexpected();return this.node(e,{kind:i.Kind.OBJECT_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:a})}parseInterfaceTypeExtension(){let e=this._lexer.token;this.expectKeyword(`extend`),this.expectKeyword(`interface`);let t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),a=this.parseFieldsDefinition();if(n.length===0&&r.length===0&&a.length===0)throw this.unexpected();return this.node(e,{kind:i.Kind.INTERFACE_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:a})}parseUnionTypeExtension(){let e=this._lexer.token;this.expectKeyword(`extend`),this.expectKeyword(`union`);let t=this.parseName(),n=this.parseConstDirectives(),r=this.parseUnionMemberTypes();if(n.length===0&&r.length===0)throw this.unexpected();return this.node(e,{kind:i.Kind.UNION_TYPE_EXTENSION,name:t,directives:n,types:r})}parseEnumTypeExtension(){let e=this._lexer.token;this.expectKeyword(`extend`),this.expectKeyword(`enum`);let t=this.parseName(),n=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();if(n.length===0&&r.length===0)throw this.unexpected();return this.node(e,{kind:i.Kind.ENUM_TYPE_EXTENSION,name:t,directives:n,values:r})}parseInputObjectTypeExtension(){let e=this._lexer.token;this.expectKeyword(`extend`),this.expectKeyword(`input`);let t=this.parseName(),n=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();if(n.length===0&&r.length===0)throw this.unexpected();return this.node(e,{kind:i.Kind.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:r})}parseDirectiveDefinition(){let e=this._lexer.token,t=this.parseDescription();this.expectKeyword(`directive`),this.expectToken(s.TokenKind.AT);let n=this.parseName(),r=this.parseArgumentDefs(),a=this.expectOptionalKeyword(`repeatable`);this.expectKeyword(`on`);let o=this.parseDirectiveLocations();return this.node(e,{kind:i.Kind.DIRECTIVE_DEFINITION,description:t,name:n,arguments:r,repeatable:a,locations:o})}parseDirectiveLocations(){return this.delimitedMany(s.TokenKind.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){let e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(r.DirectiveLocation,t.value))return t;throw this.unexpected(e)}parseSchemaCoordinate(){let e=this._lexer.token,t=this.expectOptionalToken(s.TokenKind.AT),n=this.parseName(),r;!t&&this.expectOptionalToken(s.TokenKind.DOT)&&(r=this.parseName());let a;return(t||r)&&this.expectOptionalToken(s.TokenKind.PAREN_L)&&(a=this.parseName(),this.expectToken(s.TokenKind.COLON),this.expectToken(s.TokenKind.PAREN_R)),t?a?this.node(e,{kind:i.Kind.DIRECTIVE_ARGUMENT_COORDINATE,name:n,argumentName:a}):this.node(e,{kind:i.Kind.DIRECTIVE_COORDINATE,name:n}):r?a?this.node(e,{kind:i.Kind.ARGUMENT_COORDINATE,name:n,fieldName:r,argumentName:a}):this.node(e,{kind:i.Kind.MEMBER_COORDINATE,name:n,memberName:r}):this.node(e,{kind:i.Kind.TYPE_COORDINATE,name:n})}node(e,t){return this._options.noLocation!==!0&&(t.loc=new n.Location(e,this._lexer.lastToken,this._lexer.source)),t}peek(e){return this._lexer.token.kind===e}expectToken(e){let n=this._lexer.token;if(n.kind===e)return this.advanceLexer(),n;throw(0,t.syntaxError)(this._lexer.source,n.start,`Expected ${d(e)}, found ${u(n)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e&&(this.advanceLexer(),!0)}expectKeyword(e){let n=this._lexer.token;if(n.kind===s.TokenKind.NAME&&n.value===e)this.advanceLexer();else throw(0,t.syntaxError)(this._lexer.source,n.start,`Expected "${e}", found ${u(n)}.`)}expectOptionalKeyword(e){let t=this._lexer.token;return t.kind===s.TokenKind.NAME&&t.value===e&&(this.advanceLexer(),!0)}unexpected(e){let n=e??this._lexer.token;return(0,t.syntaxError)(this._lexer.source,n.start,`Unexpected ${u(n)}.`)}any(e,t,n){this.expectToken(e);let r=[];for(;!this.expectOptionalToken(n);)r.push(t.call(this));return r}optionalMany(e,t,n){if(this.expectOptionalToken(e)){let e=[];do e.push(t.call(this));while(!this.expectOptionalToken(n));return e}return[]}many(e,t,n){this.expectToken(e);let r=[];do r.push(t.call(this));while(!this.expectOptionalToken(n));return r}delimitedMany(e,t){this.expectOptionalToken(e);let n=[];do n.push(t.call(this));while(this.expectOptionalToken(e));return n}advanceLexer(){let{maxTokens:e}=this._options,n=this._lexer.advance();if(n.kind!==s.TokenKind.EOF&&(++this._tokenCounter,e!==void 0&&this._tokenCounter>e))throw(0,t.syntaxError)(this._lexer.source,n.start,`Document contains more that ${e} tokens. Parsing aborted.`)}};e.Parser=l;function u(e){let t=e.value;return d(e.kind)+(t==null?``:` "${t}"`)}function d(e){return(0,a.isPunctuatorTokenKind)(e)?`"${e}"`:e}})),Wi=ki(),Gi=Ai(),Ki=Ui();const qi={String:`text`,ID:`text`,OID:`text`,PHID:`text`,OLabel:`text`,URL:`text`,Date:`text`,DateTime:`text`,EmailAddress:`text`,EthereumAddress:`text`,Currency:`text`,Address:`text`,AttachmentRef:`text`,Int:`integer`,Float:`number`,Amount_Money:`number`,Amount_Percentage:`number`,Amount_Tokens:`number`,Boolean:`boolean`,Amount:`object`,Amount_Crypto:`object`,Amount_Currency:`object`,Amount_Fiat:`object`,Unknown:`json`};var Ji=class extends Error{constructor(e){super(`Invalid input SDL: ${e}`),this.name=`SdlSyntaxError`}};function Yi(e){return e.kind===Gi.Kind.NON_NULL_TYPE?{...Yi(e.type),required:!0}:e.kind===Gi.Kind.LIST_TYPE?{name:Yi(e.type).name,list:!0,required:!1}:{name:e.name.value,list:!1,required:!1}}function Xi(e){return(e.fields??[]).filter(e=>e.name.value!==`_`).map(e=>{let t=e.description?.value.replace(/\s+/g,` `);return{name:e.name.value,type:Yi(e.type),...t?{description:t}:{}}})}function Zi(e){let t;try{t=(0,Ki.parse)(e,{noLocation:!0})}catch(e){throw new Ji(e instanceof Wi.GraphQLError?e.message:String(e))}let n=/* @__PURE__ */ new Map,r=/* @__PURE__ */ new Map;for(let e of t.definitions)e.kind===Gi.Kind.INPUT_OBJECT_TYPE_DEFINITION?n.set(e.name.value,Xi(e)):e.kind===Gi.Kind.ENUM_TYPE_DEFINITION&&r.set(e.name.value,(e.values??[]).map(e=>e.name.value));return{inputs:n,enums:r}}const Qi=e=>e.replace(/[^A-Za-z0-9]/g,``).toLowerCase();function $i(e,t){let n=`${Qi(e)}input`,r=[...t].filter(e=>Qi(e)===n);return r.length===1?r[0]:void 0}function ea(e,t){let{inputs:n,enums:r}=Zi(e),i=$i(t,n.keys()),a=i?n.get(i):void 0;return i&&a?{rootName:i,root:a,inputs:n,enums:r}:null}function ta(e,t){return t.inputs.has(e.name)?`object`:t.enums.has(e.name)?`enum`:qi[e.name]??`unsupported`}function na(e){let t=e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[_-]+/g,` `).toLowerCase().trim();return t.charAt(0).toUpperCase()+t.slice(1)}function ra(e,t){let n={displayName:na(e.name),required:e.type.required,...e.description?{description:e.description}:{}};if(e.type.list)return Y.Json({...n,description:e.description??`A JSON list`});switch(ta(e.type,t)){case`text`:return Y.ShortText(n);case`integer`:case`number`:return Y.ShortText({...n,description:e.description??`A number`});case`boolean`:return Y.StaticDropdown({...n,options:{options:[{label:`Yes`,value:!0},{label:`No`,value:!1}]}});case`enum`:return Y.StaticDropdown({...n,options:{options:(t.enums.get(e.type.name)??[]).map(e=>({label:na(e),value:e}))}});case`unsupported`:return Y.Json({...n,description:`Type ${e.type.name} is not supported by this form`});default:return Y.Json(n)}}function ia(e){let t={};for(let n of e.root)t[n.name]=ra(n,e);return t}function aa(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const oa=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function sa(e){let t=typeof e==`string`?e:JSON.stringify(e);return t.length>60?`${t.slice(0,57)}...`:t}function ca(e,t,n){let r=t=>/* @__PURE__ */ Error(`input "${e.name}" (${e.type.name}) expects ${t}; got ${sa(n)}`);if(e.type.list){if(!Array.isArray(n))throw r(`a list`);return n}switch(t){case`text`:case`enum`:if(typeof n!=`string`)throw r(`text`);return n;case`integer`:case`number`:{let e=typeof n==`number`?n:typeof n==`string`&&oa.test(n.trim())?Number(n.trim()):NaN;if(!Number.isFinite(e))throw r(`a number`);if(t===`integer`&&!Number.isInteger(e))throw r(`an integer`);return e}case`boolean`:if(typeof n==`boolean`)return n;if(n===`true`||n===`false`)return n===`true`;throw r(`true or false`);case`object`:if(!aa(n))throw r(`an object`);return n;case`json`:return n;case`unsupported`:throw Error(`input "${e.name}" has type ${e.type.name}, which this piece cannot map`)}}function la(e,t){let n=t??{};if(!aa(n))throw Error(`"input" must be an object; got ${sa(n)}`);let r={};for(let t of e.root){let i=n[t.name];i!=null&&i!==``&&(r[t.name]=ca(t,ta(t.type,e),i))}return r}const ua=[{label:`Exact`,value:`exact`},{label:`Extract from AI output`,value:`extract`}];function da(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function fa(e){let t=typeof e==`string`?e:JSON.stringify(e);return t.length>60?`${t.slice(0,57)}...`:t}function pa(e){return e.trim().replace(/^```(?:json)?\s*/i,``).replace(/```$/,``).trim()}function ma(e){let t=[],n=0,r=-1,i=!1,a=!1;for(let o=0;o<e.length;o++){let s=e[o];if(i){a?a=!1:s===`\\`?a=!0:s===`"`&&(i=!1);continue}if(s===`"`){i=!0;continue}if(s===`{`||s===`[`){n===0&&(r=o),n++;continue}if(s===`}`||s===`]`){if(n===0)continue;n--,n===0&&r>=0&&(t.push(e.slice(r,o+1)),r=-1)}}return t}function ha(e){let t=pa(e);try{return JSON.parse(t)}catch{}let n=ma(t);for(let e=n.length-1;e>=0;e--)try{return JSON.parse(n[e])}catch{}throw SyntaxError(`no JSON value found`)}const ga=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i,_a=/(?<![A-Za-z0-9_-])[A-Za-z0-9_-]{43}(?![A-Za-z0-9_-])/;function va(e){let t=ga.exec(e)??_a.exec(e);return t?t[0]:e.trim().replace(/^["'`]+|["'`]+$/g,``).trim()||void 0}const ya=`set "Parse" to "Extract from AI output" to read one out of text`;var ba=class e{block;mode;extractedFrom={};constructor(e,t){this.block=e,this.mode=t}static of(t,n){if(n==null||n===``)return new e(t,`exact`);if(n!==`exact`&&n!==`extract`)throw Error(`${t}: "parse" must be "exact" or "extract"`);return new e(t,n)}get extract(){return this.mode===`extract`}documentId(e,t){if(e!=null&&e!==``){if(typeof e!=`string`)throw Error(`${this.block}: "${t}" must be a document id; got ${fa(e)}`);if(this.extract){let n=va(e);return n!==void 0&&n!==e&&(this.extractedFrom[t]=e),n}if(!/^[^\s"'`]+$/.test(e))throw Error(`${this.block}: "${t}" is not a document id: ${fa(e)}; ${ya}`);return e}}json(e,t){if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch(e){if(!this.extract){let n=e instanceof Error?e.message:String(e);throw Error(`${this.block}: "${t}" is not valid JSON (${n}); ${ya}`,{cause:e})}}try{let n=ha(e);return this.extractedFrom[t]=e,n}catch{throw Error(`${this.block}: "${t}" holds no JSON value`)}}output(){return Object.keys(this.extractedFrom).length?{extractedFrom:this.extractedFrom}:{}}};function xa(e,t,n){return e.map((e,r)=>{if(!da(e)||typeof e.type!=`string`)throw Error(`${t.block}: ${n}[${r}] needs a string "type"`);if(e.scope!==void 0&&typeof e.scope!=`string`)throw Error(`${t.block}: ${n}[${r}].scope must be a string`);return{type:e.type,input:e.input,scope:e.scope}})}function Sa(e,t,n=`actions`){if(e==null||e===``)return{actions:[]};let r=t.json(e,n);if(Array.isArray(r))return{actions:xa(r,t,n)};if(da(r)){if(Array.isArray(r.actions))return{documentId:t.documentId(r.documentId,`${n}.documentId`),actions:xa(r.actions,t,n)};if(t.extract&&typeof r.type==`string`)return{actions:xa([r],t,n)}}throw Error(`${t.block}: "${n}" must be a list of actions or an object with an "actions" list; got ${fa(r)}`)}function Ca(e,t,n=`actions`){return Sa(e,t,n).actions}function wa(e,t){if(e==null||e===``)return{};let n=t.json(e,`payload`);if(!da(n))throw Error(`${t.block}: "payload" must be an object; got ${fa(n)}`);for(let e of[`documentType`,`name`])if(n[e]!==void 0&&typeof n[e]!=`string`)throw Error(`${t.block}: "payload.${e}" must be a string`);return{documentType:n.documentType,name:n.name,actions:n.actions}}function Ta(e,t){if(e==null||e===``)return{};let n=t.json(e,`input`);if(!da(n))throw Error(`${t.block}: "input" must be an object; got ${fa(n)}`);return n}function Ea(e){let t=typeof e==`string`?e.split(`,`):e;return Array.isArray(t)?t.map(e=>{if(typeof e==`string`)return e;let t=e;return typeof t?.type==`string`?t.type:``}).map(e=>e.trim()).filter(Boolean):[]}function Da(e){if(typeof e!=`string`)return;let t=e.trim();if(t&&!t.includes(`{{`))return t}function Oa(e){let t=e?.nodes;return Array.isArray(t)?t.filter(e=>typeof e==`object`&&!!e&&typeof e.id==`string`):[]}function ka(e){let t=Oa(e).filter(e=>e.kind===`folder`),n=new Map(t.map(e=>[e.id,e])),r=e=>{let t=[],r=/* @__PURE__ */ new Set,i=e;for(;i&&!r.has(i.id);)r.add(i.id),t.unshift(i.name||`(unnamed)`),i=i.parentFolder?n.get(i.parentFolder):void 0;return t.join(` / `)};return t.map(e=>({label:r(e),value:e.id})).sort((e,t)=>e.label.localeCompare(t.label))}const Aa=/\b(?:input|enum|type)\s+(\w+)/g,ja=/* @__PURE__ */ new Set([`String`,`Int`,`Float`,`Boolean`,`ID`]);function Ma(e,t,n){return RegExp(`${t}\\s+${n}\\s*\\{[^}]*\\}`).exec(e)?.[0]??null}function Na(e,t){if(!t)return e;let n=new Set([...e.matchAll(Aa)].map(e=>e[1])),r=[...new Set([...e.matchAll(/:\s*\[?\s*(\w+)/g)].map(e=>e[1]).filter(e=>!n.has(e)&&!ja.has(e)))].map(e=>Ma(t,`enum`,e)).filter(e=>e!==null);return r.length?`${e}\n\n${r.join(`
58
58
 
59
- `)}`:e}function X(e){if(e.reactor)return e.reactor;let t=/* @__PURE__ */ Error(`ctx.reactor is not served to this resolver`);throw t.name=`ReactorAccessDeniedError`,t}async function va(e){let t=await e.getDocumentModelModules(),n=[...t.results];for(;t.next&&t.results.length>0;)t=await t.next(),n.push(...t.results);return n}async function ya(e){let t=/* @__PURE__ */ new Map;for(let n of await va(e)){let e=n.documentModel.global;e.id&&!t.has(e.id)&&t.set(e.id,e.name)}return[...t].map(([e,t])=>({documentType:e,name:t})).sort((e,t)=>e.documentType.localeCompare(t.documentType))}async function ba(e,t){let n=t?[t]:(await ya(e)).map(e=>e.documentType),r=(await Promise.all(n.map(t=>e.find({type:t},void 0,{cursor:``,limit:100})))).flatMap(e=>e.results),i=e=>ti(e)||e.header.slug||`(unnamed)`,a=/* @__PURE__ */ new Map;for(let e of r)a.set(i(e),(a.get(i(e))??0)+1);return{options:r.map(e=>{let n=i(e),{id:r,slug:o}=e.header,s=(a.get(n)??0)>1?`${n} (${o&&o!==n?o:r.slice(0,8)})`:n;return{label:t?s:`${s} — ${e.header.documentType}`,value:r}}),placeholder:t===`powerhouse/document-drive`?`Choose a drive`:t?`Documents of type ${t}`:`All documents on this reactor`}}const Z=(e=`Document type`,t=!1,n)=>Y.Dropdown({auth:void 0,displayName:e,description:n,required:t,refreshers:[],options:async(e,t)=>({options:(await ya(X(t))).map(e=>({label:e.name?`${e.name} (${e.documentType})`:e.documentType,value:e.documentType}))})}),xa=(e=`Document id`,t=!1,n)=>Y.Dropdown({auth:void 0,displayName:e,description:n,required:t,refreshers:[`documentType`],options:(e,t)=>ba(X(t),da(e.documentType))}),Sa=(e,t)=>Y.Dropdown({auth:void 0,displayName:e,description:t,required:!1,refreshers:[],options:(e,t)=>ba(X(t),Yr)}),Ca=(e,t,n)=>Y.Dropdown({auth:void 0,displayName:e,description:n,required:!1,refreshers:[t],options:async(e,n)=>{let r=da(e[t]);if(!r)return{disabled:!0,options:[],placeholder:`Pick a drive first`};let i=await X(n).get(r),a=i.state,o=pa(a.global).map(e=>({label:e.label,value:{driveId:i.header.id,folderId:e.value}})),s=ti(i);return{options:o,placeholder:o.length?`Folders in ${s||`this drive`}`:`${s||`This drive`} has no folders`}}}),wa=(e,t)=>({...Y.LongText({displayName:e,required:!1,description:t,advanced:!0}),display:`code`}),Ta=()=>Y.StaticDropdown({displayName:`Parse`,description:`Exact takes ids and JSON as given. Extract reads them out of an AI step's prose, and reports what it read from in extractedFrom`,required:!1,defaultValue:`exact`,advanced:!0,options:{options:Ji}});async function Ea(e,t){let n=da(t.documentType);if(n)return e.getDocumentModelModule(n);let r=da(t.documentId);if(!r)return;let i=await e.get(r);return e.getDocumentModelModuleForDocument(i)}const Da=(e=`Action type`,t=!1,n)=>Y.Dropdown({auth:void 0,displayName:e,description:n,required:t,refreshers:[`documentType`,`documentId`],options:async(e,t)=>{let n=await Ea(X(t),e);if(!n)return{disabled:!0,options:[{label:`SET_NAME (base)`,value:ii.type,inputSchema:ii.inputSchema??void 0}],placeholder:`Pick a document type first`};let r=ai(n);return{options:r.actions.map(e=>({label:`${e.type} (${e.module})`,value:e.type,documentType:r.documentType,...e.inputSchema?{inputSchema:_a(e.inputSchema,r.stateSchema)}:{}})),placeholder:`Actions of ${r.documentType}`}}});function Oa(e,t){let n=ai(e),r=n.actions.find(e=>e.type===t);if(r?.inputSchema)return Ri(_a(r.inputSchema,n.stateSchema),t)??void 0}const ka=(e=`Input`)=>Y.DynamicProperties({auth:void 0,displayName:e,required:!1,refreshers:[`documentType`,`documentId`,`actionType`],props:async(e,t)=>{let n=da(e.actionType);if(!n)return{};let r=await Ea(X(t),e),i=r&&Oa(r,n);return i?Hi(i):{}}}),Aa=e=>({key:`action`,display:`section`,label:`Action`,description:`${e} Pick a type, then fill in its input: the action needs both.`,props:[`actionType`,`input`]});function ja(e,t,n){let r=Error(t,n===void 0?{}:{cause:n});return r.name=e,r}async function Ma(e,t){let n;try{n=await e.readable}catch(t){throw t instanceof Error&&t.name===`JobFailedError`?ja(`ReactorJobFailedError`,`Reactor job ${e.jobId} failed: ${t.message}`,t):t}return Vr(n.job,t),n}async function Na(e,t){return await Ma(e,t),e.document()}const Q=`document-create`;function Pa(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Fa(e,t){if(e==null||e===``)return;let n=typeof e==`string`&&e.trim().startsWith(`{`)?t.json(e,`folderId`):e;if(typeof n==`string`)return n.trim()||void 0;if(Pa(n)&&typeof n.driveId==`string`&&typeof n.folderId==`string`)return{driveId:n.driveId,folderId:n.folderId};throw Error(`${Q}: "folderId" must be a folder from the list, or a folder id with "parentId" set to its drive`)}async function Ia(e,t,n){if(n&&typeof n==`object`)return{kind:`drive`,...n};if(!t){if(n)throw Error(`${Q}: a folder id needs "parentId", its drive`);return{kind:`none`}}let r=await e.get(t);if(Xr.has(r.header.documentType))return{kind:`drive`,driveId:r.header.id,folderId:n};if(n)throw Error(`${Q}: "parentId" names a document, not a drive`);return{kind:`parent`,parentId:r.header.id}}async function La(e,t,n,r){let i=t.documentModel.global.id;if(n.kind!==`drive`&&!r)return Na(await e.write.createEmpty(i,n.kind===`parent`?{parentIdentifier:n.parentId}:{}));let a=await e.newDocument(i,{parentIdentifier:n.kind===`drive`?n.driveId:n.kind===`parent`?n.parentId:void 0,name:r||void 0});if(n.kind===`drive`){let t=await Na(await e.write.create(a,n.driveId)),r=[oi(`ADD_FILE`,{id:t.header.id,name:t.header.name||t.header.id,documentType:i,parentFolder:n.folderId})];return await Ma(await e.write.execute(n.driveId,Zr,r),r),t}return Na(await e.write.create(a,n.kind===`parent`?n.parentId:void 0))}const Ra=J({name:Q,displayName:`Create document`,description:`Creates a Powerhouse document. Outputs a reference to it: id, type, branch and revision.`,requireAuth:!1,requireReactor:`write`,propertyGroups:[Aa(`Optional, sent right after the create.`)],props:{documentType:Z(),name:Y.ShortText({displayName:`Document name`,required:!1}),parentId:Sa(`Parent drive`,`A drive, or a document to create the new one under`),folderId:Ca(`Folder`,`parentId`,`Omit for the drive's root`),actionType:Da(`Type`,!1),input:ka(`Input`),actions:wa(`Action list (JSON)`,`Several actions after the create, or a payload from an earlier step: [{ "type": …, "input": … }]`),payload:Y.ShortText({displayName:`Payload`,description:`JSON {documentType, name, actions?}, e.g. {{steps.draft.output}}`,required:!1,advanced:!0}),parse:Ta()},run:async e=>{let t=e.reactor,n=e.propsValue,r=ia.of(Q,n.parse),i=ca(n.payload,r),a=typeof n.documentType==`string`&&n.documentType||i.documentType;if(!a)throw Error(`${Q}: "documentType" is required, in the config or the payload`);let o=typeof n.name==`string`&&n.name||i.name,s=await Ia(t,r.documentId(n.parentId,`parentId`),Fa(n.folderId,r)),c=await t.getDocumentModelModule(a),l=(n.actions===void 0?sa(i.actions,r,`payload.actions`):sa(n.actions,r)).map(e=>oi(e.type,e.input,e.scope)),u=typeof n.actionType==`string`?n.actionType.trim():``;if(u){let e=Oa(c,u),t=la(n.input,r);l.unshift(ci(c,u,e?qi(e,t):t))}let d=await La(t,c,s,o);return{...Hr((l.length?await Na(await t.write.execute(d.header.id,Zr,l),l):d).header),...r.output()}}}),za=`document-dispatch`,Ba=J({name:za,displayName:`Dispatch actions`,description:`Sends actions to a document. Outputs a reference to it: id, type, branch and revision.`,requireAuth:!1,requireReactor:`write`,propertyGroups:[Aa(`Sent to the document.`)],props:{documentId:xa(`Document id`,!0,`e.g. {{steps.create.output.documentId}}`),documentType:Z(`Document type`,!1,`Design-time hint when the document id is an expression`),actionType:Da(`Type`,!1),input:ka(`Input`),actions:wa(`Action list (JSON)`,`Several actions at once, or a payload from an earlier step: [{ "type": …, "input": …, "scope"?: "global" }]`),allowedActions:Y.ShortText({displayName:`Allowed action types`,description:`Comma-separated whitelist; enforced when set`,required:!1,advanced:!0}),branch:Y.ShortText({displayName:`Branch`,required:!1,defaultValue:Zr,advanced:!0}),parse:Ta()},run:async e=>{let t=e.reactor,n=e.propsValue,r=ia.of(za,n.parse),i=oa(n.actions,r),a=r.documentId(n.documentId,`documentId`)??i.documentId;if(!a)throw Error(`${za}: "documentId" is required, in the config or the actions payload`);let o=i.actions.map(e=>oi(e.type,e.input,e.scope)),s=typeof n.actionType==`string`?n.actionType.trim():``;if(s){let e=await t.getDocumentModelModuleForDocument(await t.get(a)),i=Oa(e,s),c=la(n.input,r);o.unshift(ci(e,s,i?qi(i,c):c))}let c=ua(n.allowedActions),l=c.length?o.filter(e=>!c.includes(e.type)):[];if(l.length>0)throw Error(`${za}: action(s) not allowed here: ${[...new Set(l.map(e=>e.type))].join(`, `)}`);if(o.length===0)throw Error(`${za}: choose an Action, or give a non-empty "Action list (JSON)"`);let u=typeof n.branch==`string`&&n.branch.trim()||`main`;return{...Hr((await Na(await t.write.execute(a,u,o),o)).header),...r.output()}}}),Va=`document-find`;function Ha(e){return btoa(JSON.stringify(e))}function Ua(e){if(e!=null&&e!==``){try{let t=JSON.parse(atob(typeof e==`string`?e.trim():``));if(Number.isInteger(t.q)&&typeof t.c==`string`&&Number.isInteger(t.s)&&Number.isInteger(t.l))return t}catch{}throw Error(`${Va}: "cursor" is not a nextCursor this step returned`)}}async function Wa(e,t,n){let r=n?{parentId:n}:{};return t?[{type:t,...r}]:n?[r]:(await ya(e)).map(e=>({type:e.documentType}))}const Ga=J({name:Va,displayName:`Find documents`,description:`Lists documents by type and name.`,requireAuth:!1,requireReactor:`read`,props:{documentType:Z(`Document type`,!1,`Omit for any type`),parentId:Sa(`In drive`,`Omit for the whole reactor`),name:Y.ShortText({displayName:`Name contains`,description:`Case-insensitive match`,required:!1}),matchPath:Y.ShortText({displayName:`State field`,description:`Dotted path into the document's state, e.g. "orderId" or "settlement.status". With a value below, only documents holding it are returned.`,required:!1}),matchValue:Y.ShortText({displayName:`State value`,description:`Compared as text, e.g. {{trigger.payload.orderId}}. Documents missing the field never match.`,required:!1}),includeState:Y.Checkbox({displayName:`Include state`,description:`Returns each document's state as well as its header. Off by default: a page of documents carries a page of states.`,required:!1,defaultValue:!1}),limit:Y.Number({displayName:`Max results`,description:`Defaults to 25, at most 100`,required:!1}),cursor:Y.ShortText({displayName:`Cursor`,description:`Resumes a search, e.g. {{steps.find.output.nextCursor}}; omit to start from the first page`,required:!1,advanced:!0})},run:async e=>{let{documentType:t,parentId:n,name:r,limit:i,matchPath:a,matchValue:o,includeState:s}=e.propsValue,c=Math.min(Math.max(typeof i==`number`?i:25,1),100),l=typeof a==`string`?a.trim():``,u=typeof o==`string`?o.trim():``;if(l===``!=(u===``))throw Error(`${Va}: "State field" and "State value" are set together or not at all`);let d=typeof r==`string`?r.trim().toLowerCase():``,f=l?{path:l,value:u}:void 0,p=e=>(!d||ti(e).toLowerCase().includes(d))&&ri(e,f),m=d!==``||f!==void 0,h=await Wa(e.reactor,typeof t==`string`&&t.trim()?t.trim():void 0,typeof n==`string`&&n.trim()?n.trim():void 0),g=Ua(e.propsValue.cursor)??{q:0,c:``,s:0,l:0},_=[],v;for(let t=0;g.q<h.length;t++){if(m&&t>=20){v=Ha(g);break}let n=g.l||(m?100:Math.max(c-_.length,1)),r=await e.reactor.find(h[g.q],void 0,{cursor:g.c,limit:n}),i=g.s;for(;i<r.results.length&&_.length<c;i++)p(r.results[i])&&_.push(r.results[i]);let a=i<r.results.length?{q:g.q,c:g.c,s:i,l:n}:r.nextCursor&&r.results.length>0?{q:g.q,c:r.nextCursor,s:0,l:0}:g.q+1<h.length?{q:g.q+1,c:``,s:0,l:0}:void 0;if(!a)break;if(_.length>=c){v=Ha(a);break}g=a}return{results:_.map(e=>s===!0?$r(e):{header:e.header}),...v?{nextCursor:v}:{}}}}),Ka=`document-get`,qa=J({name:Ka,displayName:`Get document`,description:`Reads a document's current state.`,requireAuth:!1,requireReactor:`read`,props:{documentId:xa(`Document id`,!0,`e.g. {{steps.find.output.results.0.header.id}}`),documentType:Z(`Document type`,!1,`Design-time hint when the document id is an expression`),parse:Ta()},run:async e=>{let t=ia.of(Ka,e.propsValue.parse),n=t.documentId(e.propsValue.documentId,`documentId`);if(!n)throw Error(`${Ka}: "documentId" is required`);return{...$r(await e.reactor.get(n)),...t.output()}}}),Ja=`document-schema`,Ya=J({name:Ja,displayName:`Get document schema`,description:`Action and state schemas of a document type.`,requireAuth:!1,requireReactor:`read`,props:{documentType:Z(`Document type`,!1,`Required unless a document id is given`),documentId:xa(`Document id`,!1,`Resolves the type from this document instead`),actionType:Da(`Only this action`,!1,`Omit to list every action`),parse:Ta()},run:async e=>{let t=e.reactor,{actionType:n}=e.propsValue,r=ia.of(Ja,e.propsValue.parse),i=typeof e.propsValue.documentType==`string`?e.propsValue.documentType.trim():``,a=i?void 0:r.documentId(e.propsValue.documentId,`documentId`);if(!i&&!a)throw Error(`${Ja}: "documentType" is required`);let o=ai(a?await t.getDocumentModelModuleForDocument(await t.get(a)):await t.getDocumentModelModule(i));return{documentType:o.documentType,name:o.name,stateSchema:o.stateSchema,actions:n?o.actions.filter(e=>e.type===n):o.actions,...r.output()}}}),Xa=J({name:`document-types`,displayName:`List document types`,description:`Document models installed on this reactor.`,requireAuth:!1,requireReactor:`read`,props:{},run:async e=>{let t=await ya(e.reactor);return{count:t.length,types:t}}}),Za=`index-query`,Qa=J({name:Za,displayName:`Query index`,description:`Runs a GraphQL query against one of this reactor's index subgraphs (a key index, a mail index, …) as the workflow's user. Outputs the query's data; a refused or unknown index is an error.`,requireAuth:!1,requireReactor:`read`,props:{subgraph:Y.ShortText({displayName:`Index`,description:`The subgraph's name as the switchboard registers it, e.g. "key-index".`,required:!0}),query:Y.LongText({displayName:`Query`,description:`A GraphQL query document. Mutations are refused.`,required:!0}),variables:Y.Json({displayName:`Variables`,description:`The query's variables, as JSON.`,required:!1})},run:async e=>{let t=e.propsValue,n=String(t.subgraph).trim(),r=String(t.query).trim();if(!n)throw Error(`${Za}: "Index" is required.`);if(!r)throw Error(`${Za}: "Query" is required.`);let i=await e.reactor.query({subgraph:n,query:r,variables:$a(t.variables)});if(i.errors?.length)throw Error(`The index "${n}" refused the query: ${i.errors.map(e=>e.message).join(`; `)}`);return i.data??{}}});function $a(e){if(e==null||e===``)return;let t=typeof e==`string`?JSON.parse(e):e;if(typeof t!=`object`||!t||Array.isArray(t))throw Error(`${Za}: "Variables" must be a JSON object.`);return t}function $(e){return()=>Promise.reject(/* @__PURE__ */ Error(`The "${e}" trigger is fired by the reactor, not polled`))}const eo={documentId:`01234567-89ab-cdef-0123-456789abcdef`,documentType:`powerhouse/workflow`,branch:`main`,scope:`global`,action:{type:`SET_NAME`,input:{name:`Invoice`}},operation:{index:7,timestampUtcMs:`1757500000000`}},to={documentId:`01234567-89ab-cdef-0123-456789abcdef`,documentType:`powerhouse/workflow`,name:`Invoice`,driveId:`fedcba98-7654-3210-fedc-ba9876543210`,parentId:null,operation:{index:0,timestampUtcMs:`1757500000000`}},no=zr({name:`document-event`,displayName:`Document event`,description:`Fires when a matching document operation lands.`,type:jn.POLLING,requireAuth:!1,requireReactor:`read`,props:{documentType:Z(`Document type`,!1,`e.g. powerhouse/connection`),documentId:xa(`Document id`,!1,`Omit to match any document`),actionType:Da(`Action type`,!1,`Omit to match any action`)},sampleData:eo,onEnable:$(`document-event`),onDisable:$(`document-event`),run:$(`document-event`)}),ro=zr({name:`document-created`,displayName:`Document created`,description:`Fires when a document is added to a drive.`,type:jn.POLLING,requireAuth:!1,requireReactor:`read`,props:{documentType:Z(`Document type`,!1,`Type of the created document; omit to match any`),driveId:Sa(`Drive`,`Omit to match documents outside every drive too`)},sampleData:to,onEnable:$(`document-created`),onDisable:$(`document-created`),run:$(`document-created`)}),io=zr({name:`document-deleted`,displayName:`Document deleted`,description:`Fires when a document is removed from a drive.`,type:jn.POLLING,requireAuth:!1,requireReactor:`read`,props:{documentType:Z(`Document type`,!1,`Type of the deleted document; omit to match any`),driveId:Sa(`Drive`,`Omit to match documents outside every drive too`)},sampleData:to,onEnable:$(`document-deleted`),onDisable:$(`document-deleted`),run:$(`document-deleted`)}),ao=Cr({displayName:`Powerhouse Reactor`,description:`Read and write Powerhouse documents on the reactor this workflow runs in: create documents, dispatch actions, read state, schemas and indexes, and fire on document events.`,logoUrl:`data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMTQgMTE0IiBmaWxsPSJub25lIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iIzE2MTYxNiIgZD0iTTcxLjI5MTkgMEwyNC4zNDE1IDM4Ljg3NzJDMTcuNDU0OCA0NC41Nzk4IDE2Ljk1MzkgNTQuOTY1OSAyMy4yNiA2MS4zMDQ3TDM5LjUwMjggNzcuNjMxOEM0NC4yNjg0IDgyLjQyMjEgNDUuMjk5NiA4OS43ODM0IDQyLjAzMzUgOTUuNjk4OEwzMS45MjkgMTE0SDE1LjJDNi44MDUyNyAxMTQgMCAxMDcuMTk1IDAgOTguOFYxNS4yQzAgNi44MDUyNyA2LjgwNTI3IDAgMTUuMiAwSDcxLjI5MTlaTTgwLjExMSAwTDcxLjM0MTIgMTUuOTc1OEM2OC4xMDc4IDIxLjg2NiA2OS4xMjU1IDI5LjE4MDQgNzMuODQ0MSAzMy45NjQxTDkxLjA3NTEgNTEuNDMzMUM5Ny4zNjc0IDU3LjgxMjQgOTYuODA0NCA2OC4yMjI3IDg5Ljg2MDcgNzMuODg2MUw0MC42NzgyIDExNEg5OC44QzEwNy4xOTUgMTE0IDExNCAxMDcuMTk1IDExNCA5OC44VjE1LjJDMTE0IDYuODA1MjcgMTA3LjE5NSAwIDk4LjggMEg4MC4xMTFaIi8+PC9zdmc+`,authors:[`powerhouse`],auth:void 0,actions:[Ra,Ba,qa,Ga,Ya,Xa,Qa],triggers:[no,ro,io]});export{ao as default,ao as reactor};
59
+ `)}`:e}function X(e){if(e.reactor)return e.reactor;let t=/* @__PURE__ */ Error(`ctx.reactor is not served to this resolver`);throw t.name=`ReactorAccessDeniedError`,t}async function Pa(e){let t=await e.getDocumentModelModules(),n=[...t.results];for(;t.next&&t.results.length>0;)t=await t.next(),n.push(...t.results);return n}async function Fa(e){let t=/* @__PURE__ */ new Map;for(let n of await Pa(e)){let e=n.documentModel.global;e.id&&!t.has(e.id)&&t.set(e.id,e.name)}return[...t].map(([e,t])=>({documentType:e,name:t})).sort((e,t)=>e.documentType.localeCompare(t.documentType))}async function Ia(e,t){let n=t?[t]:(await Fa(e)).map(e=>e.documentType),r=(await Promise.all(n.map(t=>e.find({type:t},void 0,{cursor:``,limit:100})))).flatMap(e=>e.results),i=e=>_i(e)||e.header.slug||`(unnamed)`,a=/* @__PURE__ */ new Map;for(let e of r)a.set(i(e),(a.get(i(e))??0)+1);return{options:r.map(e=>{let n=i(e),{id:r,slug:o}=e.header,s=(a.get(n)??0)>1?`${n} (${o&&o!==n?o:r.slice(0,8)})`:n;return{label:t?s:`${s} — ${e.header.documentType}`,value:r}}),placeholder:t===`powerhouse/document-drive`?`Choose a drive`:t?`Documents of type ${t}`:`All documents on this reactor`}}const Z=(e=`Document type`,t=!1,n)=>Y.Dropdown({auth:void 0,displayName:e,description:n,required:t,refreshers:[],options:async(e,t)=>({options:(await Fa(X(t))).map(e=>({label:e.name?`${e.name} (${e.documentType})`:e.documentType,value:e.documentType}))})}),La=(e=`Document id`,t=!1,n)=>Y.Dropdown({auth:void 0,displayName:e,description:n,required:t,refreshers:[`documentType`],options:(e,t)=>Ia(X(t),Da(e.documentType))}),Ra=(e,t)=>Y.Dropdown({auth:void 0,displayName:e,description:t,required:!1,refreshers:[],options:(e,t)=>Ia(X(t),di)}),za=(e,t,n)=>Y.Dropdown({auth:void 0,displayName:e,description:n,required:!1,refreshers:[t],options:async(e,n)=>{let r=Da(e[t]);if(!r)return{disabled:!0,options:[],placeholder:`Pick a drive first`};let i=await X(n).get(r),a=i.state,o=ka(a.global).map(e=>({label:e.label,value:{driveId:i.header.id,folderId:e.value}})),s=_i(i);return{options:o,placeholder:o.length?`Folders in ${s||`this drive`}`:`${s||`This drive`} has no folders`}}}),Ba=(e,t)=>({...Y.LongText({displayName:e,required:!1,description:t,advanced:!0}),display:`code`}),Va=()=>Y.StaticDropdown({displayName:`Parse`,description:`Exact takes ids and JSON as given. Extract reads them out of an AI step's prose, and reports what it read from in extractedFrom`,required:!1,defaultValue:`exact`,advanced:!0,options:{options:ua}});async function Ha(e,t){let n=Da(t.documentType);if(n)return e.getDocumentModelModule(n);let r=Da(t.documentId);if(!r)return;let i=await e.get(r);return e.getDocumentModelModuleForDocument(i)}const Ua=(e=`Action type`,t=!1,n)=>Y.Dropdown({auth:void 0,displayName:e,description:n,required:t,refreshers:[`documentType`,`documentId`],options:async(e,t)=>{let n=await Ha(X(t),e);if(!n)return{disabled:!0,options:[{label:`SET_NAME (base)`,value:bi.type,inputSchema:bi.inputSchema??void 0}],placeholder:`Pick a document type first`};let r=xi(n);return{options:r.actions.map(e=>({label:`${e.type} (${e.module})`,value:e.type,documentType:r.documentType,...e.inputSchema?{inputSchema:Na(e.inputSchema,r.stateSchema)}:{}})),placeholder:`Actions of ${r.documentType}`}}});function Wa(e,t){let n=xi(e),r=n.actions.find(e=>e.type===t);if(r?.inputSchema)return ea(Na(r.inputSchema,n.stateSchema),t)??void 0}const Ga=(e=`Input`)=>Y.DynamicProperties({auth:void 0,displayName:e,required:!1,refreshers:[`documentType`,`documentId`,`actionType`],props:async(e,t)=>{let n=Da(e.actionType);if(!n)return{};let r=await Ha(X(t),e),i=r&&Wa(r,n);return i?ia(i):{}}}),Ka=e=>({key:`action`,display:`section`,label:`Action`,description:`${e} Pick a type, then fill in its input: the action needs both.`,props:[`actionType`,`input`]});function qa(e,t,n){let r=Error(t,n===void 0?{}:{cause:n});return r.name=e,r}async function Ja(e,t){let n;try{n=await e.readable}catch(t){throw t instanceof Error&&t.name===`JobFailedError`?qa(`ReactorJobFailedError`,`Reactor job ${e.jobId} failed: ${t.message}`,t):t}return ri(n.job,t),n}async function Ya(e,t){return await Ja(e,t),e.document()}const Q=`document-create`;function Xa(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Za(e,t){if(e==null||e===``)return;let n=typeof e==`string`&&e.trim().startsWith(`{`)?t.json(e,`folderId`):e;if(typeof n==`string`)return n.trim()||void 0;if(Xa(n)&&typeof n.driveId==`string`&&typeof n.folderId==`string`)return{driveId:n.driveId,folderId:n.folderId};throw Error(`${Q}: "folderId" must be a folder from the list, or a folder id with "parentId" set to its drive`)}async function Qa(e,t,n){if(n&&typeof n==`object`)return{kind:`drive`,...n};if(!t){if(n)throw Error(`${Q}: a folder id needs "parentId", its drive`);return{kind:`none`}}let r=await e.get(t);if(fi.has(r.header.documentType))return{kind:`drive`,driveId:r.header.id,folderId:n};if(n)throw Error(`${Q}: "parentId" names a document, not a drive`);return{kind:`parent`,parentId:r.header.id}}async function $a(e,t,n,r){let i=t.documentModel.global.id;if(n.kind!==`drive`&&!r)return Ya(await e.write.createEmpty(i,n.kind===`parent`?{parentIdentifier:n.parentId}:{}));let a=await e.newDocument(i,{parentIdentifier:n.kind===`drive`?n.driveId:n.kind===`parent`?n.parentId:void 0,name:r||void 0});if(n.kind===`drive`){let t=await Ya(await e.write.create(a,n.driveId)),r=[Si(`ADD_FILE`,{id:t.header.id,name:t.header.name||t.header.id,documentType:i,parentFolder:n.folderId})];return await Ja(await e.write.execute(n.driveId,pi,r),r),t}return Ya(await e.write.create(a,n.kind===`parent`?n.parentId:void 0))}const eo=J({name:Q,displayName:`Create document`,description:`Creates a Powerhouse document. Outputs a reference to it: id, type, branch and revision.`,requireAuth:!1,requireReactor:`write`,propertyGroups:[Ka(`Optional, sent right after the create.`)],props:{documentType:Z(),name:Y.ShortText({displayName:`Document name`,required:!1}),parentId:Ra(`Parent drive`,`A drive, or a document to create the new one under`),folderId:za(`Folder`,`parentId`,`Omit for the drive's root`),actionType:Ua(`Type`,!1),input:Ga(`Input`),actions:Ba(`Action list (JSON)`,`Several actions after the create, or a payload from an earlier step: [{ "type": …, "input": … }]`),payload:Y.ShortText({displayName:`Payload`,description:`JSON {documentType, name, actions?}, e.g. {{steps.draft.output}}`,required:!1,advanced:!0}),parse:Va()},run:async e=>{let t=e.reactor,n=e.propsValue,r=ba.of(Q,n.parse),i=wa(n.payload,r),a=typeof n.documentType==`string`&&n.documentType||i.documentType;if(!a)throw Error(`${Q}: "documentType" is required, in the config or the payload`);let o=typeof n.name==`string`&&n.name||i.name,s=await Qa(t,r.documentId(n.parentId,`parentId`),Za(n.folderId,r)),c=await t.getDocumentModelModule(a),l=(n.actions===void 0?Ca(i.actions,r,`payload.actions`):Ca(n.actions,r)).map(e=>Si(e.type,e.input,e.scope)),u=typeof n.actionType==`string`?n.actionType.trim():``;if(u){let e=Wa(c,u),t=Ta(n.input,r);l.unshift(wi(c,u,e?la(e,t):t))}let d=await $a(t,c,s,o);return{...ii((l.length?await Ya(await t.write.execute(d.header.id,pi,l),l):d).header),...r.output()}}}),to=`document-dispatch`,no=J({name:to,displayName:`Dispatch actions`,description:`Sends actions to a document. Outputs a reference to it: id, type, branch and revision.`,requireAuth:!1,requireReactor:`write`,propertyGroups:[Ka(`Sent to the document.`)],props:{documentId:La(`Document id`,!0,`e.g. {{steps.create.output.documentId}}`),documentType:Z(`Document type`,!1,`Design-time hint when the document id is an expression`),actionType:Ua(`Type`,!1),input:Ga(`Input`),actions:Ba(`Action list (JSON)`,`Several actions at once, or a payload from an earlier step: [{ "type": …, "input": …, "scope"?: "global" }]`),allowedActions:Y.ShortText({displayName:`Allowed action types`,description:`Comma-separated whitelist; enforced when set`,required:!1,advanced:!0}),branch:Y.ShortText({displayName:`Branch`,required:!1,defaultValue:pi,advanced:!0}),parse:Va()},run:async e=>{let t=e.reactor,n=e.propsValue,r=ba.of(to,n.parse),i=Sa(n.actions,r),a=r.documentId(n.documentId,`documentId`)??i.documentId;if(!a)throw Error(`${to}: "documentId" is required, in the config or the actions payload`);let o=i.actions.map(e=>Si(e.type,e.input,e.scope)),s=typeof n.actionType==`string`?n.actionType.trim():``;if(s){let e=await t.getDocumentModelModuleForDocument(await t.get(a)),i=Wa(e,s),c=Ta(n.input,r);o.unshift(wi(e,s,i?la(i,c):c))}let c=Ea(n.allowedActions),l=c.length?o.filter(e=>!c.includes(e.type)):[];if(l.length>0)throw Error(`${to}: action(s) not allowed here: ${[...new Set(l.map(e=>e.type))].join(`, `)}`);if(o.length===0)throw Error(`${to}: choose an Action, or give a non-empty "Action list (JSON)"`);let u=typeof n.branch==`string`&&n.branch.trim()||`main`;return{...ii((await Ya(await t.write.execute(a,u,o),o)).header),...r.output()}}}),ro=`document-find`;function io(e){return btoa(JSON.stringify(e))}function ao(e){if(e!=null&&e!==``){try{let t=JSON.parse(atob(typeof e==`string`?e.trim():``));if(Number.isInteger(t.q)&&typeof t.c==`string`&&Number.isInteger(t.s)&&Number.isInteger(t.l))return t}catch{}throw Error(`${ro}: "cursor" is not a nextCursor this step returned`)}}async function oo(e,t,n){let r=n?{parentId:n}:{};return t?[{type:t,...r}]:n?[r]:(await Fa(e)).map(e=>({type:e.documentType}))}const so=J({name:ro,displayName:`Find documents`,description:`Lists documents by type and name.`,requireAuth:!1,requireReactor:`read`,propertyGroups:[{key:`where`,display:`section`,label:`Which documents`,icon:`search`,props:[`documentType`,`parentId`,`name`]},{key:`match`,display:`section`,label:`Match a state field`,description:`Only documents whose state holds this value.`,icon:`braces`,props:[`matchPath`,`matchValue`]},{key:`results`,display:`section`,label:`Results`,icon:`list`,props:[`includeState`,`limit`]}],props:{documentType:Z(`Document type`,!1,`Omit for any type`),parentId:Ra(`In drive`,`Omit for the whole reactor`),name:Y.ShortText({displayName:`Name contains`,description:`Case-insensitive match`,required:!1}),matchPath:Y.ShortText({displayName:`State field`,description:`Dotted path into the document's state, e.g. "orderId" or "settlement.status". With a value below, only documents holding it are returned.`,required:!1}),matchValue:Y.ShortText({displayName:`State value`,description:`Compared as text, e.g. {{trigger.payload.orderId}}. Documents missing the field never match.`,required:!1}),includeState:Y.Checkbox({displayName:`Include state`,description:`Returns each document's state as well as its header. Off by default: a page of documents carries a page of states.`,required:!1,defaultValue:!1}),limit:Y.Number({displayName:`Max results`,description:`Defaults to 25, at most 100`,required:!1}),cursor:Y.ShortText({displayName:`Cursor`,description:`Resumes a search, e.g. {{steps.find.output.nextCursor}}; omit to start from the first page`,required:!1,advanced:!0})},run:async e=>{let{documentType:t,parentId:n,name:r,limit:i,matchPath:a,matchValue:o,includeState:s}=e.propsValue,c=Math.min(Math.max(typeof i==`number`?i:25,1),100),l=typeof a==`string`?a.trim():``,u=typeof o==`string`?o.trim():``;if(l===``!=(u===``))throw Error(`${ro}: "State field" and "State value" are set together or not at all`);let d=typeof r==`string`?r.trim().toLowerCase():``,f=l?{path:l,value:u}:void 0,p=e=>(!d||_i(e).toLowerCase().includes(d))&&yi(e,f),m=d!==``||f!==void 0,h=await oo(e.reactor,typeof t==`string`&&t.trim()?t.trim():void 0,typeof n==`string`&&n.trim()?n.trim():void 0),g=ao(e.propsValue.cursor)??{q:0,c:``,s:0,l:0},_=[],v;for(let t=0;g.q<h.length;t++){if(m&&t>=20){v=io(g);break}let n=g.l||(m?100:Math.max(c-_.length,1)),r=await e.reactor.find(h[g.q],void 0,{cursor:g.c,limit:n}),i=g.s;for(;i<r.results.length&&_.length<c;i++)p(r.results[i])&&_.push(r.results[i]);let a=i<r.results.length?{q:g.q,c:g.c,s:i,l:n}:r.nextCursor&&r.results.length>0?{q:g.q,c:r.nextCursor,s:0,l:0}:g.q+1<h.length?{q:g.q+1,c:``,s:0,l:0}:void 0;if(!a)break;if(_.length>=c){v=io(a);break}g=a}return{results:_.map(e=>s===!0?hi(e):{header:e.header}),...v?{nextCursor:v}:{}}}}),co=`document-get`,lo=J({name:co,displayName:`Get document`,description:`Reads a document's current state.`,requireAuth:!1,requireReactor:`read`,props:{documentId:La(`Document id`,!0,`e.g. {{steps.find.output.results.0.header.id}}`),documentType:Z(`Document type`,!1,`Design-time hint when the document id is an expression`),parse:Va()},run:async e=>{let t=ba.of(co,e.propsValue.parse),n=t.documentId(e.propsValue.documentId,`documentId`);if(!n)throw Error(`${co}: "documentId" is required`);return{...hi(await e.reactor.get(n)),...t.output()}}}),uo=`document-schema`,fo=J({name:uo,displayName:`Get document schema`,description:`Action and state schemas of a document type.`,requireAuth:!1,requireReactor:`read`,props:{documentType:Z(`Document type`,!1,`Required unless a document id is given`),documentId:La(`Document id`,!1,`Resolves the type from this document instead`),actionType:Ua(`Only this action`,!1,`Omit to list every action`),parse:Va()},run:async e=>{let t=e.reactor,{actionType:n}=e.propsValue,r=ba.of(uo,e.propsValue.parse),i=typeof e.propsValue.documentType==`string`?e.propsValue.documentType.trim():``,a=i?void 0:r.documentId(e.propsValue.documentId,`documentId`);if(!i&&!a)throw Error(`${uo}: "documentType" is required`);let o=xi(a?await t.getDocumentModelModuleForDocument(await t.get(a)):await t.getDocumentModelModule(i));return{documentType:o.documentType,name:o.name,stateSchema:o.stateSchema,actions:n?o.actions.filter(e=>e.type===n):o.actions,...r.output()}}}),po=J({name:`document-types`,displayName:`List document types`,description:`Document models installed on this reactor.`,requireAuth:!1,requireReactor:`read`,props:{},run:async e=>{let t=await Fa(e.reactor);return{count:t.length,types:t}}}),mo=`index-query`,ho=J({name:mo,displayName:`Query index`,description:`Runs a GraphQL query against one of this reactor's index subgraphs (a key index, a mail index, …) as the workflow's user. Outputs the query's data; a refused or unknown index is an error.`,requireAuth:!1,requireReactor:`read`,props:{subgraph:Y.ShortText({displayName:`Index`,description:`The subgraph's name as the switchboard registers it, e.g. "key-index".`,required:!0}),query:Y.LongText({displayName:`Query`,description:`A GraphQL query document. Mutations are refused.`,required:!0}),variables:Y.Json({displayName:`Variables`,description:`The query's variables, as JSON.`,required:!1})},run:async e=>{let t=e.propsValue,n=String(t.subgraph).trim(),r=String(t.query).trim();if(!n)throw Error(`${mo}: "Index" is required.`);if(!r)throw Error(`${mo}: "Query" is required.`);let i=await e.reactor.query({subgraph:n,query:r,variables:go(t.variables)});if(i.errors?.length)throw Error(`The index "${n}" refused the query: ${i.errors.map(e=>e.message).join(`; `)}`);return i.data??{}}});function go(e){if(e==null||e===``)return;let t=typeof e==`string`?JSON.parse(e):e;if(typeof t!=`object`||!t||Array.isArray(t))throw Error(`${mo}: "Variables" must be a JSON object.`);return t}function $(e){return()=>Promise.reject(/* @__PURE__ */ Error(`The "${e}" trigger is fired by the reactor, not polled`))}const _o={documentId:`01234567-89ab-cdef-0123-456789abcdef`,documentType:`powerhouse/workflow`,branch:`main`,scope:`global`,action:{type:`SET_NAME`,input:{name:`Invoice`}},operation:{index:7,timestampUtcMs:`1757500000000`}},vo={documentId:`01234567-89ab-cdef-0123-456789abcdef`,documentType:`powerhouse/workflow`,name:`Invoice`,driveId:`fedcba98-7654-3210-fedc-ba9876543210`,parentId:null,operation:{index:0,timestampUtcMs:`1757500000000`}},yo=ti({name:`document-event`,displayName:`Document event`,description:`Fires when a matching document operation lands.`,type:Nn.POLLING,requireAuth:!1,requireReactor:`read`,props:{documentType:Z(`Document type`,!1,`e.g. powerhouse/connection`),documentId:La(`Document id`,!1,`Omit to match any document`),actionType:Ua(`Action type`,!1,`Omit to match any action`)},sampleData:_o,onEnable:$(`document-event`),onDisable:$(`document-event`),run:$(`document-event`)}),bo=ti({name:`document-created`,displayName:`Document created`,description:`Fires when a document is added to a drive.`,type:Nn.POLLING,requireAuth:!1,requireReactor:`read`,props:{documentType:Z(`Document type`,!1,`Type of the created document; omit to match any`),driveId:Ra(`Drive`,`Omit to match documents outside every drive too`)},sampleData:vo,onEnable:$(`document-created`),onDisable:$(`document-created`),run:$(`document-created`)}),xo=ti({name:`document-deleted`,displayName:`Document deleted`,description:`Fires when a document is removed from a drive.`,type:Nn.POLLING,requireAuth:!1,requireReactor:`read`,props:{documentType:Z(`Document type`,!1,`Type of the deleted document; omit to match any`),driveId:Ra(`Drive`,`Omit to match documents outside every drive too`)},sampleData:vo,onEnable:$(`document-deleted`),onDisable:$(`document-deleted`),run:$(`document-deleted`)}),So=Or({displayName:`Powerhouse Reactor`,description:`Read and write Powerhouse documents on the reactor this workflow runs in: create documents, dispatch actions, read state, schemas and indexes, and fire on document events.`,logoUrl:`data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMTQgMTE0IiBmaWxsPSJub25lIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iIzE2MTYxNiIgZD0iTTcxLjI5MTkgMEwyNC4zNDE1IDM4Ljg3NzJDMTcuNDU0OCA0NC41Nzk4IDE2Ljk1MzkgNTQuOTY1OSAyMy4yNiA2MS4zMDQ3TDM5LjUwMjggNzcuNjMxOEM0NC4yNjg0IDgyLjQyMjEgNDUuMjk5NiA4OS43ODM0IDQyLjAzMzUgOTUuNjk4OEwzMS45MjkgMTE0SDE1LjJDNi44MDUyNyAxMTQgMCAxMDcuMTk1IDAgOTguOFYxNS4yQzAgNi44MDUyNyA2LjgwNTI3IDAgMTUuMiAwSDcxLjI5MTlaTTgwLjExMSAwTDcxLjM0MTIgMTUuOTc1OEM2OC4xMDc4IDIxLjg2NiA2OS4xMjU1IDI5LjE4MDQgNzMuODQ0MSAzMy45NjQxTDkxLjA3NTEgNTEuNDMzMUM5Ny4zNjc0IDU3LjgxMjQgOTYuODA0NCA2OC4yMjI3IDg5Ljg2MDcgNzMuODg2MUw0MC42NzgyIDExNEg5OC44QzEwNy4xOTUgMTE0IDExNCAxMDcuMTk1IDExNCA5OC44VjE1LjJDMTE0IDYuODA1MjcgMTA3LjE5NSAwIDk4LjggMEg4MC4xMTFaIi8+PC9zdmc+`,authors:[`powerhouse`],auth:void 0,actions:[eo,no,lo,so,fo,po,ho],triggers:[yo,bo,xo]});export{So as default,So as reactor};