@superglue/cli 1.1.175 → 1.1.177
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.
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var sV=Object.create;var JA=Object.defineProperty;var aV=Object.getOwnPropertyDescriptor;var cV=Object.getOwnPropertyNames;var uV=Object.getPrototypeOf,lV=Object.prototype.hasOwnProperty;var He=(t,e)=>()=>(t&&(e=t(t=0)),e);var m=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),c_=(t,e)=>{for(var r in e)JA(t,r,{get:e[r],enumerable:!0})},u_=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of cV(e))!lV.call(t,i)&&i!==r&&JA(t,i,{get:()=>e[i],enumerable:!(n=aV(e,i))||n.enumerable});return t};var pe=(t,e,r)=>(r=t!=null?sV(uV(t)):{},u_(e||!t||!t.__esModule?JA(r,"default",{value:t,enumerable:!0}):r,t)),hE=t=>u_(JA({},"__esModule",{value:!0}),t);var dr=m(U=>{"use strict";Object.defineProperty(U,"__esModule",{value:!0});U.PLAYBOOK_LIMITS=U.MCP_SERVER_AUTH_MODES=U.OAUTH_POPUP_CLOSED_MESSAGE=U.OAUTH_CONTINUATION_REASON_MAX_CHARS=U.AGENT_REQUEST_BUSY_STATUSES=U.AGENT_SESSION_TASK_PREPARATION_METADATA_KEY=U.AGENT_SESSION_USER_OPENED_METADATA_KEY=U.AGENT_SESSION_RESOURCE_KINDS=U.AGENT_MESSAGE_SCHEMA_VERSION=U.AGENT_APPROVAL_MODES=U.ConfirmationAction=U.LOADABLE_MARKDOWN_NAMES=U.SKILL_REFERENCE_NAMES=U.SKILL_BODY_NAMES=U.AGENT_CHECKLIST_MAX_LABEL_CHARS=U.AGENT_CHECKLIST_MAX_ITEMS=U.AGENT_CHECKLIST_MIN_ITEMS=U.DYNAMIC_AGENT_TOOLS=U.AGENT_TOOLS=U.AGENT_NATIVE_TOOLS=U.MEMORY_AGENT_TYPES=U.PLAYBOOK_PLAYGROUND_DRAFT_ID=U.PLAYGROUND_TOOL_DRAFT_ID=U.AgentType=U.FileStatus=U.MAX_BULK_RESOURCE_SHARE_OPERATIONS=U.MAX_BULK_MUTATION_IDS=U.SERVER_MANAGED_CONFIG_FIELDS=U.RunExecutionKind=U.RequestSource=U.RunStatus=U.CredentialMode=U.UpsertMode=U.LogLevel=U.PaginationType=U.DecompressionMethod=U.AuthType=U.FileType=U.CacheMode=U.HttpMethod=U.SupportedFileType=U.RUN_COMMAND_EFFECT_KINDS=U.CONNECTION_PROTOCOLS=U.TURN_CONTEXT_BLOCK_TYPES=void 0;U.isRequestConfig=dV;U.isTransformConfig=AV;U.isAgentSessionOpenedByUser=B_;U.isAgentSessionHiddenUntilOpened=pV;U.TURN_CONTEXT_BLOCK_TYPES=["systems","playbooks","project"];U.CONNECTION_PROTOCOLS=["http","postgres","mssql","redis","mongodb","sftp","smb","odbc","script","suitecloud"];U.RUN_COMMAND_EFFECT_KINDS=["tool","tool_state","system","project","schedule","session","briefing","mcp_server","role","playbook","artifact","share","org_settings","file","memory"];var l_;(function(t){t.JSON="JSON",t.CSV="CSV",t.XML="XML",t.HTML="HTML",t.YAML="YAML",t.EXCEL="EXCEL",t.PDF="PDF",t.DOCX="DOCX",t.PPTX="PPTX",t.ZIP="ZIP",t.GZIP="GZIP",t.QBM="QBM",t.BINARY="BINARY",t.RAW="RAW",t.AUTO="AUTO"})(l_||(U.SupportedFileType=l_={}));var d_;(function(t){t.GET="GET",t.POST="POST",t.PUT="PUT",t.DELETE="DELETE",t.PATCH="PATCH",t.HEAD="HEAD",t.OPTIONS="OPTIONS"})(d_||(U.HttpMethod=d_={}));var A_;(function(t){t.ENABLED="ENABLED",t.READONLY="READONLY",t.WRITEONLY="WRITEONLY",t.DISABLED="DISABLED"})(A_||(U.CacheMode=A_={}));var p_;(function(t){t.CSV="CSV",t.JSON="JSON",t.XML="XML",t.YAML="YAML",t.EXCEL="EXCEL",t.HTML="HTML",t.PDF="PDF",t.DOCX="DOCX",t.PPTX="PPTX",t.ZIP="ZIP",t.BINARY="BINARY",t.RAW="RAW",t.AUTO="AUTO"})(p_||(U.FileType=p_={}));var f_;(function(t){t.NONE="NONE",t.OAUTH2="OAUTH2",t.HEADER="HEADER",t.QUERY_PARAM="QUERY_PARAM"})(f_||(U.AuthType=f_={}));var h_;(function(t){t.GZIP="GZIP",t.DEFLATE="DEFLATE",t.NONE="NONE",t.AUTO="AUTO",t.ZIP="ZIP"})(h_||(U.DecompressionMethod=h_={}));var g_;(function(t){t.OFFSET_BASED="OFFSET_BASED",t.PAGE_BASED="PAGE_BASED",t.CURSOR_BASED="CURSOR_BASED",t.DISABLED="DISABLED"})(g_||(U.PaginationType=g_={}));var m_;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARN="WARN",t.ERROR="ERROR"})(m_||(U.LogLevel=m_={}));var y_;(function(t){t.CREATE="CREATE",t.UPDATE="UPDATE",t.UPSERT="UPSERT"})(y_||(U.UpsertMode=y_={}));var E_;(function(t){t.MERGE="MERGE",t.REPLACE="REPLACE"})(E_||(U.CredentialMode=E_={}));var I_;(function(t){t.RUNNING="RUNNING",t.SUCCESS="SUCCESS",t.FAILED="FAILED",t.ABORTED="ABORTED"})(I_||(U.RunStatus=I_={}));var C_;(function(t){t.API="api",t.FRONTEND="frontend",t.AGENT="agent",t.SCHEDULER="scheduler",t.MCP="mcp",t.TOOL_CHAIN="tool-chain",t.WEBHOOK="webhook",t.CLI="cli"})(C_||(U.RequestSource=C_={}));var b_;(function(t){t.FULL="full",t.DRAFT="draft",t.SINGLE_STEP="single-step"})(b_||(U.RunExecutionKind=b_={}));U.SERVER_MANAGED_CONFIG_FIELDS=["version","createdByUserId","createdAt","updatedAt","lastUsedAt"];U.MAX_BULK_MUTATION_IDS=100;U.MAX_BULK_RESOURCE_SHARE_OPERATIONS=1e3;function dV(t){return!t||typeof t!="object"?!1:t.type==="request"||!("type"in t)||t.type===void 0}function AV(t){return t?.type==="transform"}var S_;(function(t){t.PENDING="PENDING",t.UPLOADING="UPLOADING",t.PROCESSING="PROCESSING",t.COMPLETED="COMPLETED",t.FAILED="FAILED"})(S_||(U.FileStatus=S_={}));var kn;(function(t){t.MAIN="main",t.PLAYGROUND="playground",t.SYSTEM_PLAYGROUND="system_playground",t.PLAYBOOK_PLAYGROUND="playbook_playground",t.ARTIFACT_PLAYGROUND="artifact_playground",t.ACCESS_RULES="access_rules",t.OUTLOOK="outlook"})(kn||(U.AgentType=kn={}));U.PLAYGROUND_TOOL_DRAFT_ID="@playground-draft";U.PLAYBOOK_PLAYGROUND_DRAFT_ID="@playground-draft";U.MEMORY_AGENT_TYPES=[kn.MAIN,kn.OUTLOOK];U.AGENT_NATIVE_TOOLS=["run_command","load_skill","use_checklist","set_credentials","authenticate_oauth","setup_gateway","request_sign_off"];U.AGENT_TOOLS={[kn.MAIN]:[...U.AGENT_NATIVE_TOOLS],[kn.PLAYGROUND]:[...U.AGENT_NATIVE_TOOLS],[kn.SYSTEM_PLAYGROUND]:[...U.AGENT_NATIVE_TOOLS],[kn.PLAYBOOK_PLAYGROUND]:[...U.AGENT_NATIVE_TOOLS],[kn.ARTIFACT_PLAYGROUND]:[...U.AGENT_NATIVE_TOOLS],[kn.ACCESS_RULES]:[...U.AGENT_NATIVE_TOOLS],[kn.OUTLOOK]:U.AGENT_NATIVE_TOOLS.filter(t=>t!=="use_checklist")};U.DYNAMIC_AGENT_TOOLS=["web_search"];U.AGENT_CHECKLIST_MIN_ITEMS=4;U.AGENT_CHECKLIST_MAX_ITEMS=15;U.AGENT_CHECKLIST_MAX_LABEL_CHARS=120;U.SKILL_BODY_NAMES=["superglue-info","tools","systems","access-management","tool-deployment","notifications","artifacts","playbooks","projects","superglue-brain","email","workspace-apps","meetings","brand-guidelines","demos"];U.SKILL_REFERENCE_NAMES=["http","graphql","postgres","mssql","odbc","redis","mongodb","sftp-smb","suitecloud","task-preparation","acumatica-configuration","sage-intacct-configuration","quickbooks-desktop-files","tool-files","tunnel-handling"];U.LOADABLE_MARKDOWN_NAMES=[...U.SKILL_BODY_NAMES,...U.SKILL_REFERENCE_NAMES];var w_;(function(t){t.CONFIRMED="confirmed",t.DECLINED="declined",t.OAUTH_SUCCESS="oauth_success",t.OAUTH_FAILURE="oauth_failure"})(w_||(U.ConfirmationAction=w_={}));U.AGENT_APPROVAL_MODES=["ask","act"];U.AGENT_MESSAGE_SCHEMA_VERSION=1;U.AGENT_SESSION_RESOURCE_KINDS=["tool","system","playbook","artifact","briefing"];U.AGENT_SESSION_USER_OPENED_METADATA_KEY="userOpened";U.AGENT_SESSION_TASK_PREPARATION_METADATA_KEY="taskPreparation";function B_(t){return t[U.AGENT_SESSION_USER_OPENED_METADATA_KEY]===!0}function pV(t){return(t.resourceBinding?.kind==="briefing"||t.metadata[U.AGENT_SESSION_TASK_PREPARATION_METADATA_KEY]===!0)&&!B_(t.metadata)}U.AGENT_REQUEST_BUSY_STATUSES=["queued","claimed","running","cancelling"];U.OAUTH_CONTINUATION_REASON_MAX_CHARS=500;U.OAUTH_POPUP_CLOSED_MESSAGE="OAuth authentication did not complete.";U.MCP_SERVER_AUTH_MODES=["oauth","creator_api_key"];U.PLAYBOOK_LIMITS={name:120,whenToRun:500,inputs:25e3,instructions:1e5,completionCriteria:25e3,systemRefs:10,toolRefs:25,credentialRefs:10,fileRefs:15,compiledRender:512e3}});var T_=m((eNe,D_)=>{"use strict";var Q_=9007199254740991,fV="[object Arguments]",hV="[object Function]",gV="[object GeneratorFunction]",mV=/^(?:0|[1-9]\d*)$/;function yV(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function EV(t,e){return function(r){return t(e(r))}}var WA=Object.prototype,gE=WA.hasOwnProperty,v_=WA.toString,IV=WA.propertyIsEnumerable,CV=EV(Object.keys,Object);function bV(t,e){var r=vV(t)||QV(t)?yV(t.length,String):[],n=r.length,i=!!n;for(var o in t)(e||gE.call(t,o))&&!(i&&(o=="length"||wV(o,n)))&&r.push(o);return r}function SV(t){if(!BV(t))return CV(t);var e=[];for(var r in Object(t))gE.call(t,r)&&r!="constructor"&&e.push(r);return e}function wV(t,e){return e=e??Q_,!!e&&(typeof t=="number"||mV.test(t))&&t>-1&&t%1==0&&t<e}function BV(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||WA;return t===r}function QV(t){return _V(t)&&gE.call(t,"callee")&&(!IV.call(t,"callee")||v_.call(t)==fV)}var vV=Array.isArray;function __(t){return t!=null&&TV(t.length)&&!DV(t)}function _V(t){return kV(t)&&__(t)}function DV(t){var e=RV(t)?v_.call(t):"";return e==hV||e==gV}function TV(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Q_}function RV(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function kV(t){return!!t&&typeof t=="object"}function NV(t){return __(t)?bV(t):SV(t)}D_.exports=NV});var o0=m((Al,mc)=>{"use strict";var OV=200,F_="__lodash_hash_undefined__",UV=800,MV=16,$_=9007199254740991,j_="[object Arguments]",xV="[object Array]",LV="[object AsyncFunction]",PV="[object Boolean]",FV="[object Date]",$V="[object Error]",q_="[object Function]",jV="[object GeneratorFunction]",qV="[object Map]",zV="[object Number]",HV="[object Null]",z_="[object Object]",GV="[object Proxy]",YV="[object RegExp]",VV="[object Set]",JV="[object String]",WV="[object Undefined]",ZV="[object WeakMap]",KV="[object ArrayBuffer]",XV="[object DataView]",eJ="[object Float32Array]",tJ="[object Float64Array]",rJ="[object Int8Array]",nJ="[object Int16Array]",iJ="[object Int32Array]",oJ="[object Uint8Array]",sJ="[object Uint8ClampedArray]",aJ="[object Uint16Array]",cJ="[object Uint32Array]",uJ=/[\\^$.*+?()[\]{}|]/g,lJ=/^\[object .+?Constructor\]$/,dJ=/^(?:0|[1-9]\d*)$/,Je={};Je[eJ]=Je[tJ]=Je[rJ]=Je[nJ]=Je[iJ]=Je[oJ]=Je[sJ]=Je[aJ]=Je[cJ]=!0;Je[j_]=Je[xV]=Je[KV]=Je[PV]=Je[XV]=Je[FV]=Je[$V]=Je[q_]=Je[qV]=Je[zV]=Je[z_]=Je[YV]=Je[VV]=Je[JV]=Je[ZV]=!1;var H_=typeof global=="object"&&global&&global.Object===Object&&global,AJ=typeof self=="object"&&self&&self.Object===Object&&self,hl=H_||AJ||Function("return this")(),G_=typeof Al=="object"&&Al&&!Al.nodeType&&Al,pl=G_&&typeof mc=="object"&&mc&&!mc.nodeType&&mc,Y_=pl&&pl.exports===G_,mE=Y_&&H_.process,R_=(function(){try{var t=pl&&pl.require&&pl.require("util").types;return t||mE&&mE.binding&&mE.binding("util")}catch{}})(),k_=R_&&R_.isTypedArray;function pJ(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function fJ(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function hJ(t){return function(e){return t(e)}}function gJ(t,e){return t?.[e]}function mJ(t,e){return function(r){return t(e(r))}}var yJ=Array.prototype,EJ=Function.prototype,XA=Object.prototype,yE=hl["__core-js_shared__"],ep=EJ.toString,Eo=XA.hasOwnProperty,N_=(function(){var t=/[^.]+$/.exec(yE&&yE.keys&&yE.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})(),V_=XA.toString,IJ=ep.call(Object),CJ=RegExp("^"+ep.call(Eo).replace(uJ,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ZA=Y_?hl.Buffer:void 0,O_=hl.Symbol,U_=hl.Uint8Array,M_=ZA?ZA.allocUnsafe:void 0,J_=mJ(Object.getPrototypeOf,Object),x_=Object.create,bJ=XA.propertyIsEnumerable,SJ=yJ.splice,ra=O_?O_.toStringTag:void 0,KA=(function(){try{var t=wE(Object,"defineProperty");return t({},"",{}),t}catch{}})(),wJ=ZA?ZA.isBuffer:void 0,L_=Math.max,BJ=Date.now,W_=wE(hl,"Map"),fl=wE(Object,"create"),QJ=(function(){function t(){}return function(e){if(!ia(e))return{};if(x_)return x_(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}})();function na(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function vJ(){this.__data__=fl?fl(null):{},this.size=0}function _J(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}function DJ(t){var e=this.__data__;if(fl){var r=e[t];return r===F_?void 0:r}return Eo.call(e,t)?e[t]:void 0}function TJ(t){var e=this.__data__;return fl?e[t]!==void 0:Eo.call(e,t)}function RJ(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=fl&&e===void 0?F_:e,this}na.prototype.clear=vJ;na.prototype.delete=_J;na.prototype.get=DJ;na.prototype.has=TJ;na.prototype.set=RJ;function Io(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function kJ(){this.__data__=[],this.size=0}function NJ(t){var e=this.__data__,r=tp(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():SJ.call(e,r,1),--this.size,!0}function OJ(t){var e=this.__data__,r=tp(e,t);return r<0?void 0:e[r][1]}function UJ(t){return tp(this.__data__,t)>-1}function MJ(t,e){var r=this.__data__,n=tp(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}Io.prototype.clear=kJ;Io.prototype.delete=NJ;Io.prototype.get=OJ;Io.prototype.has=UJ;Io.prototype.set=MJ;function yc(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function xJ(){this.size=0,this.__data__={hash:new na,map:new(W_||Io),string:new na}}function LJ(t){var e=np(this,t).delete(t);return this.size-=e?1:0,e}function PJ(t){return np(this,t).get(t)}function FJ(t){return np(this,t).has(t)}function $J(t,e){var r=np(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}yc.prototype.clear=xJ;yc.prototype.delete=LJ;yc.prototype.get=PJ;yc.prototype.has=FJ;yc.prototype.set=$J;function Ec(t){var e=this.__data__=new Io(t);this.size=e.size}function jJ(){this.__data__=new Io,this.size=0}function qJ(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}function zJ(t){return this.__data__.get(t)}function HJ(t){return this.__data__.has(t)}function GJ(t,e){var r=this.__data__;if(r instanceof Io){var n=r.__data__;if(!W_||n.length<OV-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new yc(n)}return r.set(t,e),this.size=r.size,this}Ec.prototype.clear=jJ;Ec.prototype.delete=qJ;Ec.prototype.get=zJ;Ec.prototype.has=HJ;Ec.prototype.set=GJ;function YJ(t,e){var r=bE(t),n=!r&&CE(t),i=!r&&!n&&e0(t),o=!r&&!n&&!i&&r0(t),s=r||n||i||o,a=s?fJ(t.length,String):[],c=a.length;for(var u in t)(e||Eo.call(t,u))&&!(s&&(u=="length"||i&&(u=="offset"||u=="parent")||o&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||K_(u,c)))&&a.push(u);return a}function EE(t,e,r){(r!==void 0&&!ip(t[e],r)||r===void 0&&!(e in t))&&SE(t,e,r)}function VJ(t,e,r){var n=t[e];(!(Eo.call(t,e)&&ip(n,r))||r===void 0&&!(e in t))&&SE(t,e,r)}function tp(t,e){for(var r=t.length;r--;)if(ip(t[r][0],e))return r;return-1}function SE(t,e,r){e=="__proto__"&&KA?KA(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var JJ=cW();function rp(t){return t==null?t===void 0?WV:HV:ra&&ra in Object(t)?uW(t):hW(t)}function P_(t){return gl(t)&&rp(t)==j_}function WJ(t){if(!ia(t)||pW(t))return!1;var e=QE(t)?CJ:lJ;return e.test(EW(t))}function ZJ(t){return gl(t)&&t0(t.length)&&!!Je[rp(t)]}function KJ(t){if(!ia(t))return fW(t);var e=X_(t),r=[];for(var n in t)n=="constructor"&&(e||!Eo.call(t,n))||r.push(n);return r}function Z_(t,e,r,n,i){t!==e&&JJ(e,function(o,s){if(i||(i=new Ec),ia(o))XJ(t,e,s,r,Z_,n,i);else{var a=n?n(IE(t,s),o,s+"",t,e,i):void 0;a===void 0&&(a=o),EE(t,s,a)}},n0)}function XJ(t,e,r,n,i,o,s){var a=IE(t,r),c=IE(e,r),u=s.get(c);if(u){EE(t,r,u);return}var l=o?o(a,c,r+"",t,e,s):void 0,d=l===void 0;if(d){var A=bE(c),p=!A&&e0(c),h=!A&&!p&&r0(c);l=c,A||p||h?bE(a)?l=a:IW(a)?l=oW(a):p?(d=!1,l=rW(c,!0)):h?(d=!1,l=iW(c,!0)):l=[]:CW(c)||CE(c)?(l=a,CE(a)?l=bW(a):(!ia(a)||QE(a))&&(l=lW(c))):d=!1}d&&(s.set(c,l),i(l,c,n,o,s),s.delete(c)),EE(t,r,l)}function eW(t,e){return mW(gW(t,e,i0),t+"")}var tW=KA?function(t,e){return KA(t,"toString",{configurable:!0,enumerable:!1,value:wW(e),writable:!0})}:i0;function rW(t,e){if(e)return t.slice();var r=t.length,n=M_?M_(r):new t.constructor(r);return t.copy(n),n}function nW(t){var e=new t.constructor(t.byteLength);return new U_(e).set(new U_(t)),e}function iW(t,e){var r=e?nW(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function oW(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}function sW(t,e,r,n){var i=!r;r||(r={});for(var o=-1,s=e.length;++o<s;){var a=e[o],c=n?n(r[a],t[a],a,r,t):void 0;c===void 0&&(c=t[a]),i?SE(r,a,c):VJ(r,a,c)}return r}function aW(t){return eW(function(e,r){var n=-1,i=r.length,o=i>1?r[i-1]:void 0,s=i>2?r[2]:void 0;for(o=t.length>3&&typeof o=="function"?(i--,o):void 0,s&&dW(r[0],r[1],s)&&(o=i<3?void 0:o,i=1),e=Object(e);++n<i;){var a=r[n];a&&t(e,a,n,o)}return e})}function cW(t){return function(e,r,n){for(var i=-1,o=Object(e),s=n(e),a=s.length;a--;){var c=s[t?a:++i];if(r(o[c],c,o)===!1)break}return e}}function np(t,e){var r=t.__data__;return AW(e)?r[typeof e=="string"?"string":"hash"]:r.map}function wE(t,e){var r=gJ(t,e);return WJ(r)?r:void 0}function uW(t){var e=Eo.call(t,ra),r=t[ra];try{t[ra]=void 0;var n=!0}catch{}var i=V_.call(t);return n&&(e?t[ra]=r:delete t[ra]),i}function lW(t){return typeof t.constructor=="function"&&!X_(t)?QJ(J_(t)):{}}function K_(t,e){var r=typeof t;return e=e??$_,!!e&&(r=="number"||r!="symbol"&&dJ.test(t))&&t>-1&&t%1==0&&t<e}function dW(t,e,r){if(!ia(r))return!1;var n=typeof e;return(n=="number"?BE(r)&&K_(e,r.length):n=="string"&&e in r)?ip(r[e],t):!1}function AW(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function pW(t){return!!N_&&N_ in t}function X_(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||XA;return t===r}function fW(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}function hW(t){return V_.call(t)}function gW(t,e,r){return e=L_(e===void 0?t.length-1:e,0),function(){for(var n=arguments,i=-1,o=L_(n.length-e,0),s=Array(o);++i<o;)s[i]=n[e+i];i=-1;for(var a=Array(e+1);++i<e;)a[i]=n[i];return a[e]=r(s),pJ(t,this,a)}}function IE(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}var mW=yW(tW);function yW(t){var e=0,r=0;return function(){var n=BJ(),i=MV-(n-r);if(r=n,i>0){if(++e>=UV)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function EW(t){if(t!=null){try{return ep.call(t)}catch{}try{return t+""}catch{}}return""}function ip(t,e){return t===e||t!==t&&e!==e}var CE=P_((function(){return arguments})())?P_:function(t){return gl(t)&&Eo.call(t,"callee")&&!bJ.call(t,"callee")},bE=Array.isArray;function BE(t){return t!=null&&t0(t.length)&&!QE(t)}function IW(t){return gl(t)&&BE(t)}var e0=wJ||BW;function QE(t){if(!ia(t))return!1;var e=rp(t);return e==q_||e==jV||e==LV||e==GV}function t0(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=$_}function ia(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function gl(t){return t!=null&&typeof t=="object"}function CW(t){if(!gl(t)||rp(t)!=z_)return!1;var e=J_(t);if(e===null)return!0;var r=Eo.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&ep.call(r)==IJ}var r0=k_?hJ(k_):ZJ;function bW(t){return sW(t,n0(t))}function n0(t){return BE(t)?YJ(t,!0):KJ(t)}var SW=aW(function(t,e,r){Z_(t,e,r)});function wW(t){return function(){return t}}function i0(t){return t}function BW(){return!1}mc.exports=SW});var E0=m((tNe,y0)=>{"use strict";var u0=200,DE="__lodash_hash_undefined__",QW=1/0,vW=9007199254740991,_W="[object Function]",DW="[object GeneratorFunction]",TW=/[\\^$.*+?()[\]{}|]/g,RW=/^\[object .+?Constructor\]$/,kW=typeof global=="object"&&global&&global.Object===Object&&global,NW=typeof self=="object"&&self&&self.Object===Object&&self,TE=kW||NW||Function("return this")();function OW(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function UW(t,e){for(var r=-1,n=t?t.length:0,i=0,o=[];++r<n;){var s=t[r];e(s,r,t)&&(o[i++]=s)}return o}function l0(t,e){var r=t?t.length:0;return!!r&&PW(t,e,0)>-1}function d0(t,e,r){for(var n=-1,i=t?t.length:0;++n<i;)if(r(e,t[n]))return!0;return!1}function MW(t,e){for(var r=-1,n=t?t.length:0,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}function xW(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}function LW(t,e,r,n){for(var i=t.length,o=r+(n?1:-1);n?o--:++o<i;)if(e(t[o],o,t))return o;return-1}function PW(t,e,r){if(e!==e)return LW(t,FW,r);for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}function FW(t){return t!==t}function $W(t){return function(e){return t(e)}}function A0(t,e){return t.has(e)}function jW(t,e){return t?.[e]}function qW(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function p0(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var zW=Array.prototype,HW=Function.prototype,f0=Object.prototype,vE=TE["__core-js_shared__"],s0=(function(){var t=/[^.]+$/.exec(vE&&vE.keys&&vE.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})(),h0=HW.toString,RE=f0.hasOwnProperty,GW=f0.toString,YW=RegExp("^"+h0.call(RE).replace(TW,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),VW=zW.splice,a0=Math.max,JW=kE(TE,"Map"),_E=kE(TE,"Set"),ml=kE(Object,"create");function oa(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function WW(){this.__data__=ml?ml(null):{}}function ZW(t){return this.has(t)&&delete this.__data__[t]}function KW(t){var e=this.__data__;if(ml){var r=e[t];return r===DE?void 0:r}return RE.call(e,t)?e[t]:void 0}function XW(t){var e=this.__data__;return ml?e[t]!==void 0:RE.call(e,t)}function e4(t,e){var r=this.__data__;return r[t]=ml&&e===void 0?DE:e,this}oa.prototype.clear=WW;oa.prototype.delete=ZW;oa.prototype.get=KW;oa.prototype.has=XW;oa.prototype.set=e4;function Ic(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function t4(){this.__data__=[]}function r4(t){var e=this.__data__,r=op(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():VW.call(e,r,1),!0}function n4(t){var e=this.__data__,r=op(e,t);return r<0?void 0:e[r][1]}function i4(t){return op(this.__data__,t)>-1}function o4(t,e){var r=this.__data__,n=op(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}Ic.prototype.clear=t4;Ic.prototype.delete=r4;Ic.prototype.get=n4;Ic.prototype.has=i4;Ic.prototype.set=o4;function Cc(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function s4(){this.__data__={hash:new oa,map:new(JW||Ic),string:new oa}}function a4(t){return sp(this,t).delete(t)}function c4(t){return sp(this,t).get(t)}function u4(t){return sp(this,t).has(t)}function l4(t,e){return sp(this,t).set(t,e),this}Cc.prototype.clear=s4;Cc.prototype.delete=a4;Cc.prototype.get=c4;Cc.prototype.has=u4;Cc.prototype.set=l4;function yl(t){var e=-1,r=t?t.length:0;for(this.__data__=new Cc;++e<r;)this.add(t[e])}function d4(t){return this.__data__.set(t,DE),this}function A4(t){return this.__data__.has(t)}yl.prototype.add=yl.prototype.push=d4;yl.prototype.has=A4;function op(t,e){for(var r=t.length;r--;)if(b4(t[r][0],e))return r;return-1}function c0(t,e,r,n){var i=-1,o=l0,s=!0,a=t.length,c=[],u=e.length;if(!a)return c;r&&(e=MW(e,$W(r))),n?(o=d0,s=!1):e.length>=u0&&(o=A0,s=!1,e=new yl(e));e:for(;++i<a;){var l=t[i],d=r?r(l):l;if(l=n||l!==0?l:0,s&&d===d){for(var A=u;A--;)if(e[A]===d)continue e;c.push(l)}else o(e,d,n)||c.push(l)}return c}function p4(t){if(!m0(t)||E4(t))return!1;var e=g0(t)||qW(t)?YW:RW;return e.test(I4(t))}function f4(t,e){return e=a0(e===void 0?t.length-1:e,0),function(){for(var r=arguments,n=-1,i=a0(r.length-e,0),o=Array(i);++n<i;)o[n]=r[e+n];n=-1;for(var s=Array(e+1);++n<e;)s[n]=r[n];return s[e]=o,OW(t,this,s)}}function h4(t,e,r){var n=-1,i=l0,o=t.length,s=!0,a=[],c=a;if(r)s=!1,i=d0;else if(o>=u0){var u=e?null:m4(t);if(u)return p0(u);s=!1,i=A0,c=new yl}else c=e?[]:a;e:for(;++n<o;){var l=t[n],d=e?e(l):l;if(l=r||l!==0?l:0,s&&d===d){for(var A=c.length;A--;)if(c[A]===d)continue e;e&&c.push(d),a.push(l)}else i(c,d,r)||(c!==a&&c.push(d),a.push(l))}return a}function g4(t,e,r){for(var n=-1,i=t.length;++n<i;)var o=o?xW(c0(o,t[n],e,r),c0(t[n],o,e,r)):t[n];return o&&o.length?h4(o,e,r):[]}var m4=_E&&1/p0(new _E([,-0]))[1]==QW?function(t){return new _E(t)}:v4;function sp(t,e){var r=t.__data__;return y4(e)?r[typeof e=="string"?"string":"hash"]:r.map}function kE(t,e){var r=jW(t,e);return p4(r)?r:void 0}function y4(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function E4(t){return!!s0&&s0 in t}function I4(t){if(t!=null){try{return h0.call(t)}catch{}try{return t+""}catch{}}return""}var C4=f4(function(t){return g4(UW(t,w4))});function b4(t,e){return t===e||t!==t&&e!==e}function S4(t){return t!=null&&B4(t.length)&&!g0(t)}function w4(t){return Q4(t)&&S4(t)}function g0(t){var e=m0(t)?GW.call(t):"";return e==_W||e==DW}function B4(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=vW}function m0(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function Q4(t){return!!t&&typeof t=="object"}function v4(){}y0.exports=C4});var cp=m(Co=>{"use strict";var ME=Co&&Co.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Co,"__esModule",{value:!0});Co.toJsonSchema=N4;Co.convertRequiredToArray=El;Co.generateDefaultFromSchema=Il;Co.parseJsonSafe=ap;Co.normalizeToolSchemas=O4;var NE=ME(T_()),OE=ME(o0()),_4=ME(E0());function bc(t,e){if(t===e)return!0;if(t===null||e===null||typeof t!="object"||typeof e!="object"||Array.isArray(t)!==Array.isArray(e))return!1;let r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;let i=e;return r.every(o=>o in i&&bc(t[o],i[o]))}var D4={required:!1,requiredDepth:Number.POSITIVE_INFINITY,postProcessFnc:null,strings:{preProcessFnc:null},arrays:{mode:"all"},objects:{preProcessFnc:null,postProcessFnc:null,additionalProperties:!0}},T4={string:function(e){return typeof e=="string"},number:function(e){return typeof e=="number"&&isFinite(e)},integer:function(e){return typeof e=="number"&&e%1===0},boolean:function(e){return typeof e=="boolean"},array:function(e){return e instanceof Array},null:function(e){return e===null},date:function(e){return e instanceof Date},any:function(e){return!0},object:function(e){return e&&typeof e=="object"&&!(e instanceof Array)&&!(e instanceof Date)}},Sc={typeNames:["integer","number","string","array","object","boolean","null","date"],getType(t){return Sc.typeNames.find(e=>T4[e](t))},mergeSchemaObjs(t,e){if(!t||!e)return null;let r=(0,NE.default)(t),n=(0,NE.default)(e);if(!bc(r,n)){if(t.type==="array"&&e.type==="array"&&bc((0,_4.default)(r,n),["items"])){let o=r.length>n.length?e:t,s=r.length>n.length?t:e;if((0,NE.default)(o).reduce((c,u)=>bc(o[u],s[u])&&c,!0))return o}if(t.type!=="object"||e.type!=="object")return null}let i={};for(let o=0,{length:s}=r;o<s;o++){let a=r[o];if(Sc.getType(t[a])==="object"){let c=Sc.mergeSchemaObjs(t[a],e[a]);if(c)i[a]=c;else{if(t.type==="object"||e.type==="object")return{type:"object"};if(a!=="items"||t.type!=="array"||e.type!=="array")return null}}else if(a==="type")if(t[a]!==e[a])if(t[a]==="integer"&&e[a]==="number"||t[a]==="number"&&e[a]==="integer")i[a]="number";else return null;else i[a]=t[a];else{if(!bc(t[a],e[a]))return null;i[a]=t[a]}}return i}};function R4(t){let e;for(let r=0,{length:n}=t;r<n;r++){let i=t[r];if(r>0&&(i==="integer"&&e==="number"?i="number":i==="number"&&e==="integer"&&(e="number"),e!==i))return null;e=i}return e}function k4(t){return R4(t.map(e=>Sc.getType(e)))}var UE=class{constructor(e){this.options=(0,OE.default)({},D4,e),this.depth=0,this.getObjectSchemaDefault=this.getObjectSchemaDefault.bind(this),this.getStringSchemaDefault=this.getStringSchemaDefault.bind(this),this.objectPostProcessDefault=this.objectPostProcessDefault.bind(this),this.commmonPostProcessDefault=this.commmonPostProcessDefault.bind(this),this.objectPostProcessDefault=this.objectPostProcessDefault.bind(this)}getCommonArrayItemSchema(e){let r=e.map(n=>{this.depth++;let i=this.getSchema(n);return this.depth--,i});return r.reduce((n,i)=>Sc.mergeSchemaObjs(n,i),r.pop())}getObjectSchemaDefault(e){let r={type:"object"},n=Object.keys(e);return n.length>0&&(r.properties=n.reduce((i,o)=>(this.depth++,i[o]=this.getSchema(e[o]),this.depth--,i),{})),r}getObjectSchema(e){return this.options.objects.preProcessFnc?this.options.objects.preProcessFnc(e,this.getObjectSchemaDefault):this.getObjectSchemaDefault(e)}getArraySchemaMerging(e){let r={type:"array"},n=k4(e);if(n)if(r.items={type:n},n!=="integer"&&n!=="number"){let i=this.getCommonArrayItemSchema(e);i&&(r.items=i)}else this.options.required&&(r.items.required=!0);return r}getArraySchemaNoMerging(e){let r={type:"array"};return e.length>0&&(this.depth++,r.items=this.getSchema(e[0]),this.depth--),r}getArraySchemaTuple(e){let r={type:"array"};return e.length>0&&(r.items=e.map(n=>{this.depth++;let i=this.getSchema(n);return this.depth--,i})),r}getArraySchemaUniform(e){let r=this.getArraySchemaNoMerging(e);if(e.length>1)for(let n=1;n<e.length;n++){this.depth++;let i=this.getSchema(e[n]);if(this.depth--,!bc(r.items,i))throw new Error("Invalid schema, incompatible array items")}return r}getArraySchema(e){if(e.length===0)return{type:"array"};switch(this.options.arrays.mode){case"all":return this.getArraySchemaMerging(e);case"first":return this.getArraySchemaNoMerging(e);case"uniform":return this.getArraySchemaUniform(e);case"tuple":return this.getArraySchemaTuple(e);default:throw new Error(`Unknown array mode option '${this.options.arrays.mode}'`)}}getStringSchemaDefault(e){return{type:"string"}}getStringSchema(e){return this.options.strings.preProcessFnc?this.options.strings.preProcessFnc(e,this.getStringSchemaDefault):this.getStringSchemaDefault(e)}commmonPostProcessDefault(e,r,n){return this.options.required&&this.depth<=this.options.requiredDepth?(0,OE.default)({},r,{required:!0}):r}objectPostProcessDefault(e,r){return this.options.objects.additionalProperties===!1&&Object.getOwnPropertyNames(r).length>0?(0,OE.default)({},e,{additionalProperties:!1}):e}getSchema(e){let r=Sc.getType(e);r||(r="null");let n;switch(r){case"object":n=this.getObjectSchema(e);break;case"array":n=this.getArraySchema(e);break;case"string":n=this.getStringSchema(e);break;default:n={type:r}}return this.options.postProcessFnc?n=this.options.postProcessFnc(r,n,e,this.commmonPostProcessDefault):n=this.commmonPostProcessDefault(r,n,e),r==="object"&&(this.options.objects.postProcessFnc?n=this.options.objects.postProcessFnc(n,e,this.objectPostProcessDefault):n=this.objectPostProcessDefault(n,e)),n}};function N4(t,e){return new UE(e).getSchema(t)}function El(t){if(!t||typeof t!="object")return t;if(Array.isArray(t))return t.map(r=>El(r));let e={...t};if(delete e.required,e.properties&&typeof e.properties=="object"){let r=[],n={};for(let[i,o]of Object.entries(e.properties)){let s=o;if(s&&typeof s=="object"&&s.required===!0){r.push(i);let{required:a,...c}=s;n[i]=El(c)}else n[i]=El(s)}e.properties=n,r.length>0&&(e.required=r)}return e.items&&(e.items=El(e.items)),e}function Il(t){if(!t||typeof t!="object")return null;if(t.const!==void 0)return t.const;if(t.enum&&Array.isArray(t.enum)&&t.enum.length>0)return t.enum[0];if(t.default!==void 0)return t.default;if(t.oneOf&&Array.isArray(t.oneOf)&&t.oneOf.length>0)return Il(t.oneOf[0]);if(t.anyOf&&Array.isArray(t.anyOf)&&t.anyOf.length>0)return Il(t.anyOf[0]);switch(Array.isArray(t.type)?t.type[0]:t.type){case"string":case"number":case"integer":case"boolean":return null;case"null":return null;case"array":return t.items?[]:[];case"object":let r={};if(t.properties&&typeof t.properties=="object"){let n=t.required||[];for(let[i,o]of Object.entries(t.properties))r[i]=Il(o)}return r;default:if(t.properties&&typeof t.properties=="object"){let n={};for(let[i,o]of Object.entries(t.properties))n[i]=Il(o);return n}return null}}function ap(t){if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return t}}function O4(t){let e={...t};return e.inputSchema&&(e.inputSchema=ap(e.inputSchema)),e.outputSchema&&(e.outputSchema=ap(e.outputSchema)),e.responseSchema&&(e.responseSchema=ap(e.responseSchema)),e}});var U4,C0,I0,M4,x4,L4,P4,b0=He(()=>{"use strict";U4=t=>{let e=I0(t,0);if(e===void 0||!x4(t[e]))return;let r=I0(t,e+1);if(r!==void 0)return L4(t,e,r)},C0=U4,I0=(t,e)=>{for(let r=e;r<t.length;r+=1){let n=t[r];if(!M4(n))return r}},M4=t=>t===" "||t===" "||t===`
|
|
2
|
+
"use strict";var sV=Object.create;var JA=Object.defineProperty;var aV=Object.getOwnPropertyDescriptor;var cV=Object.getOwnPropertyNames;var uV=Object.getPrototypeOf,lV=Object.prototype.hasOwnProperty;var He=(t,e)=>()=>(t&&(e=t(t=0)),e);var m=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),c_=(t,e)=>{for(var r in e)JA(t,r,{get:e[r],enumerable:!0})},u_=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of cV(e))!lV.call(t,i)&&i!==r&&JA(t,i,{get:()=>e[i],enumerable:!(n=aV(e,i))||n.enumerable});return t};var pe=(t,e,r)=>(r=t!=null?sV(uV(t)):{},u_(e||!t||!t.__esModule?JA(r,"default",{value:t,enumerable:!0}):r,t)),hE=t=>u_(JA({},"__esModule",{value:!0}),t);var dr=m(U=>{"use strict";Object.defineProperty(U,"__esModule",{value:!0});U.PLAYBOOK_LIMITS=U.MCP_SERVER_AUTH_MODES=U.OAUTH_POPUP_CLOSED_MESSAGE=U.OAUTH_CONTINUATION_REASON_MAX_CHARS=U.AGENT_REQUEST_BUSY_STATUSES=U.AGENT_SESSION_TASK_PREPARATION_METADATA_KEY=U.AGENT_SESSION_USER_OPENED_METADATA_KEY=U.AGENT_SESSION_RESOURCE_KINDS=U.AGENT_MESSAGE_SCHEMA_VERSION=U.AGENT_APPROVAL_MODES=U.ConfirmationAction=U.LOADABLE_MARKDOWN_NAMES=U.SKILL_REFERENCE_NAMES=U.SKILL_BODY_NAMES=U.AGENT_CHECKLIST_MAX_LABEL_CHARS=U.AGENT_CHECKLIST_MAX_ITEMS=U.AGENT_CHECKLIST_MIN_ITEMS=U.DYNAMIC_AGENT_TOOLS=U.AGENT_TOOLS=U.AGENT_NATIVE_TOOLS=U.MEMORY_AGENT_TYPES=U.PLAYBOOK_PLAYGROUND_DRAFT_ID=U.PLAYGROUND_TOOL_DRAFT_ID=U.AgentType=U.FileStatus=U.MAX_BULK_RESOURCE_SHARE_OPERATIONS=U.MAX_BULK_MUTATION_IDS=U.SERVER_MANAGED_CONFIG_FIELDS=U.RunExecutionKind=U.RequestSource=U.RunStatus=U.CredentialMode=U.UpsertMode=U.LogLevel=U.PaginationType=U.DecompressionMethod=U.AuthType=U.FileType=U.CacheMode=U.HttpMethod=U.SupportedFileType=U.RUN_COMMAND_EFFECT_KINDS=U.CONNECTION_PROTOCOLS=U.TURN_CONTEXT_BLOCK_TYPES=void 0;U.isRequestConfig=dV;U.isTransformConfig=AV;U.isAgentSessionOpenedByUser=B_;U.isAgentSessionHiddenUntilOpened=pV;U.TURN_CONTEXT_BLOCK_TYPES=["systems","playbooks","project"];U.CONNECTION_PROTOCOLS=["http","postgres","mssql","redis","mongodb","sftp","smb","odbc","script","suitecloud"];U.RUN_COMMAND_EFFECT_KINDS=["tool","tool_state","system","project","schedule","session","briefing","mcp_server","role","playbook","artifact","share","org_settings","file","memory"];var l_;(function(t){t.JSON="JSON",t.CSV="CSV",t.XML="XML",t.HTML="HTML",t.YAML="YAML",t.EXCEL="EXCEL",t.PDF="PDF",t.DOCX="DOCX",t.PPTX="PPTX",t.ZIP="ZIP",t.GZIP="GZIP",t.QBM="QBM",t.BINARY="BINARY",t.RAW="RAW",t.AUTO="AUTO"})(l_||(U.SupportedFileType=l_={}));var d_;(function(t){t.GET="GET",t.POST="POST",t.PUT="PUT",t.DELETE="DELETE",t.PATCH="PATCH",t.HEAD="HEAD",t.OPTIONS="OPTIONS"})(d_||(U.HttpMethod=d_={}));var A_;(function(t){t.ENABLED="ENABLED",t.READONLY="READONLY",t.WRITEONLY="WRITEONLY",t.DISABLED="DISABLED"})(A_||(U.CacheMode=A_={}));var p_;(function(t){t.CSV="CSV",t.JSON="JSON",t.XML="XML",t.YAML="YAML",t.EXCEL="EXCEL",t.HTML="HTML",t.PDF="PDF",t.DOCX="DOCX",t.PPTX="PPTX",t.ZIP="ZIP",t.BINARY="BINARY",t.RAW="RAW",t.AUTO="AUTO"})(p_||(U.FileType=p_={}));var f_;(function(t){t.NONE="NONE",t.OAUTH2="OAUTH2",t.HEADER="HEADER",t.QUERY_PARAM="QUERY_PARAM"})(f_||(U.AuthType=f_={}));var h_;(function(t){t.GZIP="GZIP",t.DEFLATE="DEFLATE",t.NONE="NONE",t.AUTO="AUTO",t.ZIP="ZIP"})(h_||(U.DecompressionMethod=h_={}));var g_;(function(t){t.OFFSET_BASED="OFFSET_BASED",t.PAGE_BASED="PAGE_BASED",t.CURSOR_BASED="CURSOR_BASED",t.DISABLED="DISABLED"})(g_||(U.PaginationType=g_={}));var m_;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARN="WARN",t.ERROR="ERROR"})(m_||(U.LogLevel=m_={}));var y_;(function(t){t.CREATE="CREATE",t.UPDATE="UPDATE",t.UPSERT="UPSERT"})(y_||(U.UpsertMode=y_={}));var E_;(function(t){t.MERGE="MERGE",t.REPLACE="REPLACE"})(E_||(U.CredentialMode=E_={}));var I_;(function(t){t.RUNNING="RUNNING",t.SUCCESS="SUCCESS",t.FAILED="FAILED",t.ABORTED="ABORTED"})(I_||(U.RunStatus=I_={}));var C_;(function(t){t.API="api",t.FRONTEND="frontend",t.AGENT="agent",t.SCHEDULER="scheduler",t.MCP="mcp",t.TOOL_CHAIN="tool-chain",t.WEBHOOK="webhook",t.CLI="cli"})(C_||(U.RequestSource=C_={}));var b_;(function(t){t.FULL="full",t.DRAFT="draft",t.SINGLE_STEP="single-step"})(b_||(U.RunExecutionKind=b_={}));U.SERVER_MANAGED_CONFIG_FIELDS=["version","createdByUserId","createdAt","updatedAt","lastUsedAt"];U.MAX_BULK_MUTATION_IDS=100;U.MAX_BULK_RESOURCE_SHARE_OPERATIONS=1e3;function dV(t){return!t||typeof t!="object"?!1:t.type==="request"||!("type"in t)||t.type===void 0}function AV(t){return t?.type==="transform"}var S_;(function(t){t.PENDING="PENDING",t.UPLOADING="UPLOADING",t.PROCESSING="PROCESSING",t.COMPLETED="COMPLETED",t.FAILED="FAILED"})(S_||(U.FileStatus=S_={}));var kn;(function(t){t.MAIN="main",t.PLAYGROUND="playground",t.SYSTEM_PLAYGROUND="system_playground",t.PLAYBOOK_PLAYGROUND="playbook_playground",t.ARTIFACT_PLAYGROUND="artifact_playground",t.ACCESS_RULES="access_rules",t.OUTLOOK="outlook"})(kn||(U.AgentType=kn={}));U.PLAYGROUND_TOOL_DRAFT_ID="@playground-draft";U.PLAYBOOK_PLAYGROUND_DRAFT_ID="@playground-draft";U.MEMORY_AGENT_TYPES=[kn.MAIN,kn.OUTLOOK];U.AGENT_NATIVE_TOOLS=["run_command","load_skill","use_checklist","set_credentials","authenticate_oauth","setup_gateway","request_sign_off"];U.AGENT_TOOLS={[kn.MAIN]:[...U.AGENT_NATIVE_TOOLS],[kn.PLAYGROUND]:[...U.AGENT_NATIVE_TOOLS],[kn.SYSTEM_PLAYGROUND]:[...U.AGENT_NATIVE_TOOLS],[kn.PLAYBOOK_PLAYGROUND]:[...U.AGENT_NATIVE_TOOLS],[kn.ARTIFACT_PLAYGROUND]:[...U.AGENT_NATIVE_TOOLS],[kn.ACCESS_RULES]:[...U.AGENT_NATIVE_TOOLS],[kn.OUTLOOK]:U.AGENT_NATIVE_TOOLS.filter(t=>t!=="use_checklist")};U.DYNAMIC_AGENT_TOOLS=["web_search"];U.AGENT_CHECKLIST_MIN_ITEMS=4;U.AGENT_CHECKLIST_MAX_ITEMS=15;U.AGENT_CHECKLIST_MAX_LABEL_CHARS=120;U.SKILL_BODY_NAMES=["superglue-info","tools","systems","access-management","tool-deployment","notifications","artifacts","playbooks","projects","superglue-brain","email","workspace-apps","meetings","brand-guidelines","demos","acumatica","netsuite","sage-intacct"];U.SKILL_REFERENCE_NAMES=["http","graphql","postgres","mssql","odbc","redis","mongodb","sftp-smb","suitecloud","task-preparation","acumatica-configuration","acumatica-dependencies","netsuite-dependencies","sage-intacct-dependencies","sage-intacct-configuration","quickbooks-desktop-files","tool-files","tunnel-handling"];U.LOADABLE_MARKDOWN_NAMES=[...U.SKILL_BODY_NAMES,...U.SKILL_REFERENCE_NAMES];var w_;(function(t){t.CONFIRMED="confirmed",t.DECLINED="declined",t.OAUTH_SUCCESS="oauth_success",t.OAUTH_FAILURE="oauth_failure"})(w_||(U.ConfirmationAction=w_={}));U.AGENT_APPROVAL_MODES=["ask","act"];U.AGENT_MESSAGE_SCHEMA_VERSION=1;U.AGENT_SESSION_RESOURCE_KINDS=["tool","system","playbook","artifact","briefing"];U.AGENT_SESSION_USER_OPENED_METADATA_KEY="userOpened";U.AGENT_SESSION_TASK_PREPARATION_METADATA_KEY="taskPreparation";function B_(t){return t[U.AGENT_SESSION_USER_OPENED_METADATA_KEY]===!0}function pV(t){return(t.resourceBinding?.kind==="briefing"||t.metadata[U.AGENT_SESSION_TASK_PREPARATION_METADATA_KEY]===!0)&&!B_(t.metadata)}U.AGENT_REQUEST_BUSY_STATUSES=["queued","claimed","running","cancelling"];U.OAUTH_CONTINUATION_REASON_MAX_CHARS=500;U.OAUTH_POPUP_CLOSED_MESSAGE="OAuth authentication did not complete.";U.MCP_SERVER_AUTH_MODES=["oauth","creator_api_key"];U.PLAYBOOK_LIMITS={name:120,whenToRun:500,inputs:25e3,instructions:1e5,completionCriteria:25e3,systemRefs:10,toolRefs:25,credentialRefs:10,fileRefs:15,compiledRender:512e3}});var T_=m((eNe,D_)=>{"use strict";var Q_=9007199254740991,fV="[object Arguments]",hV="[object Function]",gV="[object GeneratorFunction]",mV=/^(?:0|[1-9]\d*)$/;function yV(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function EV(t,e){return function(r){return t(e(r))}}var WA=Object.prototype,gE=WA.hasOwnProperty,v_=WA.toString,IV=WA.propertyIsEnumerable,CV=EV(Object.keys,Object);function bV(t,e){var r=vV(t)||QV(t)?yV(t.length,String):[],n=r.length,i=!!n;for(var o in t)(e||gE.call(t,o))&&!(i&&(o=="length"||wV(o,n)))&&r.push(o);return r}function SV(t){if(!BV(t))return CV(t);var e=[];for(var r in Object(t))gE.call(t,r)&&r!="constructor"&&e.push(r);return e}function wV(t,e){return e=e??Q_,!!e&&(typeof t=="number"||mV.test(t))&&t>-1&&t%1==0&&t<e}function BV(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||WA;return t===r}function QV(t){return _V(t)&&gE.call(t,"callee")&&(!IV.call(t,"callee")||v_.call(t)==fV)}var vV=Array.isArray;function __(t){return t!=null&&TV(t.length)&&!DV(t)}function _V(t){return kV(t)&&__(t)}function DV(t){var e=RV(t)?v_.call(t):"";return e==hV||e==gV}function TV(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Q_}function RV(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function kV(t){return!!t&&typeof t=="object"}function NV(t){return __(t)?bV(t):SV(t)}D_.exports=NV});var o0=m((Al,mc)=>{"use strict";var OV=200,F_="__lodash_hash_undefined__",UV=800,MV=16,$_=9007199254740991,j_="[object Arguments]",xV="[object Array]",LV="[object AsyncFunction]",PV="[object Boolean]",FV="[object Date]",$V="[object Error]",q_="[object Function]",jV="[object GeneratorFunction]",qV="[object Map]",zV="[object Number]",HV="[object Null]",z_="[object Object]",GV="[object Proxy]",YV="[object RegExp]",VV="[object Set]",JV="[object String]",WV="[object Undefined]",ZV="[object WeakMap]",KV="[object ArrayBuffer]",XV="[object DataView]",eJ="[object Float32Array]",tJ="[object Float64Array]",rJ="[object Int8Array]",nJ="[object Int16Array]",iJ="[object Int32Array]",oJ="[object Uint8Array]",sJ="[object Uint8ClampedArray]",aJ="[object Uint16Array]",cJ="[object Uint32Array]",uJ=/[\\^$.*+?()[\]{}|]/g,lJ=/^\[object .+?Constructor\]$/,dJ=/^(?:0|[1-9]\d*)$/,Je={};Je[eJ]=Je[tJ]=Je[rJ]=Je[nJ]=Je[iJ]=Je[oJ]=Je[sJ]=Je[aJ]=Je[cJ]=!0;Je[j_]=Je[xV]=Je[KV]=Je[PV]=Je[XV]=Je[FV]=Je[$V]=Je[q_]=Je[qV]=Je[zV]=Je[z_]=Je[YV]=Je[VV]=Je[JV]=Je[ZV]=!1;var H_=typeof global=="object"&&global&&global.Object===Object&&global,AJ=typeof self=="object"&&self&&self.Object===Object&&self,hl=H_||AJ||Function("return this")(),G_=typeof Al=="object"&&Al&&!Al.nodeType&&Al,pl=G_&&typeof mc=="object"&&mc&&!mc.nodeType&&mc,Y_=pl&&pl.exports===G_,mE=Y_&&H_.process,R_=(function(){try{var t=pl&&pl.require&&pl.require("util").types;return t||mE&&mE.binding&&mE.binding("util")}catch{}})(),k_=R_&&R_.isTypedArray;function pJ(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function fJ(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function hJ(t){return function(e){return t(e)}}function gJ(t,e){return t?.[e]}function mJ(t,e){return function(r){return t(e(r))}}var yJ=Array.prototype,EJ=Function.prototype,XA=Object.prototype,yE=hl["__core-js_shared__"],ep=EJ.toString,Eo=XA.hasOwnProperty,N_=(function(){var t=/[^.]+$/.exec(yE&&yE.keys&&yE.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})(),V_=XA.toString,IJ=ep.call(Object),CJ=RegExp("^"+ep.call(Eo).replace(uJ,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ZA=Y_?hl.Buffer:void 0,O_=hl.Symbol,U_=hl.Uint8Array,M_=ZA?ZA.allocUnsafe:void 0,J_=mJ(Object.getPrototypeOf,Object),x_=Object.create,bJ=XA.propertyIsEnumerable,SJ=yJ.splice,ra=O_?O_.toStringTag:void 0,KA=(function(){try{var t=wE(Object,"defineProperty");return t({},"",{}),t}catch{}})(),wJ=ZA?ZA.isBuffer:void 0,L_=Math.max,BJ=Date.now,W_=wE(hl,"Map"),fl=wE(Object,"create"),QJ=(function(){function t(){}return function(e){if(!ia(e))return{};if(x_)return x_(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}})();function na(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function vJ(){this.__data__=fl?fl(null):{},this.size=0}function _J(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}function DJ(t){var e=this.__data__;if(fl){var r=e[t];return r===F_?void 0:r}return Eo.call(e,t)?e[t]:void 0}function TJ(t){var e=this.__data__;return fl?e[t]!==void 0:Eo.call(e,t)}function RJ(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=fl&&e===void 0?F_:e,this}na.prototype.clear=vJ;na.prototype.delete=_J;na.prototype.get=DJ;na.prototype.has=TJ;na.prototype.set=RJ;function Io(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function kJ(){this.__data__=[],this.size=0}function NJ(t){var e=this.__data__,r=tp(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():SJ.call(e,r,1),--this.size,!0}function OJ(t){var e=this.__data__,r=tp(e,t);return r<0?void 0:e[r][1]}function UJ(t){return tp(this.__data__,t)>-1}function MJ(t,e){var r=this.__data__,n=tp(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}Io.prototype.clear=kJ;Io.prototype.delete=NJ;Io.prototype.get=OJ;Io.prototype.has=UJ;Io.prototype.set=MJ;function yc(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function xJ(){this.size=0,this.__data__={hash:new na,map:new(W_||Io),string:new na}}function LJ(t){var e=np(this,t).delete(t);return this.size-=e?1:0,e}function PJ(t){return np(this,t).get(t)}function FJ(t){return np(this,t).has(t)}function $J(t,e){var r=np(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}yc.prototype.clear=xJ;yc.prototype.delete=LJ;yc.prototype.get=PJ;yc.prototype.has=FJ;yc.prototype.set=$J;function Ec(t){var e=this.__data__=new Io(t);this.size=e.size}function jJ(){this.__data__=new Io,this.size=0}function qJ(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}function zJ(t){return this.__data__.get(t)}function HJ(t){return this.__data__.has(t)}function GJ(t,e){var r=this.__data__;if(r instanceof Io){var n=r.__data__;if(!W_||n.length<OV-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new yc(n)}return r.set(t,e),this.size=r.size,this}Ec.prototype.clear=jJ;Ec.prototype.delete=qJ;Ec.prototype.get=zJ;Ec.prototype.has=HJ;Ec.prototype.set=GJ;function YJ(t,e){var r=bE(t),n=!r&&CE(t),i=!r&&!n&&e0(t),o=!r&&!n&&!i&&r0(t),s=r||n||i||o,a=s?fJ(t.length,String):[],c=a.length;for(var u in t)(e||Eo.call(t,u))&&!(s&&(u=="length"||i&&(u=="offset"||u=="parent")||o&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||K_(u,c)))&&a.push(u);return a}function EE(t,e,r){(r!==void 0&&!ip(t[e],r)||r===void 0&&!(e in t))&&SE(t,e,r)}function VJ(t,e,r){var n=t[e];(!(Eo.call(t,e)&&ip(n,r))||r===void 0&&!(e in t))&&SE(t,e,r)}function tp(t,e){for(var r=t.length;r--;)if(ip(t[r][0],e))return r;return-1}function SE(t,e,r){e=="__proto__"&&KA?KA(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var JJ=cW();function rp(t){return t==null?t===void 0?WV:HV:ra&&ra in Object(t)?uW(t):hW(t)}function P_(t){return gl(t)&&rp(t)==j_}function WJ(t){if(!ia(t)||pW(t))return!1;var e=QE(t)?CJ:lJ;return e.test(EW(t))}function ZJ(t){return gl(t)&&t0(t.length)&&!!Je[rp(t)]}function KJ(t){if(!ia(t))return fW(t);var e=X_(t),r=[];for(var n in t)n=="constructor"&&(e||!Eo.call(t,n))||r.push(n);return r}function Z_(t,e,r,n,i){t!==e&&JJ(e,function(o,s){if(i||(i=new Ec),ia(o))XJ(t,e,s,r,Z_,n,i);else{var a=n?n(IE(t,s),o,s+"",t,e,i):void 0;a===void 0&&(a=o),EE(t,s,a)}},n0)}function XJ(t,e,r,n,i,o,s){var a=IE(t,r),c=IE(e,r),u=s.get(c);if(u){EE(t,r,u);return}var l=o?o(a,c,r+"",t,e,s):void 0,d=l===void 0;if(d){var A=bE(c),p=!A&&e0(c),h=!A&&!p&&r0(c);l=c,A||p||h?bE(a)?l=a:IW(a)?l=oW(a):p?(d=!1,l=rW(c,!0)):h?(d=!1,l=iW(c,!0)):l=[]:CW(c)||CE(c)?(l=a,CE(a)?l=bW(a):(!ia(a)||QE(a))&&(l=lW(c))):d=!1}d&&(s.set(c,l),i(l,c,n,o,s),s.delete(c)),EE(t,r,l)}function eW(t,e){return mW(gW(t,e,i0),t+"")}var tW=KA?function(t,e){return KA(t,"toString",{configurable:!0,enumerable:!1,value:wW(e),writable:!0})}:i0;function rW(t,e){if(e)return t.slice();var r=t.length,n=M_?M_(r):new t.constructor(r);return t.copy(n),n}function nW(t){var e=new t.constructor(t.byteLength);return new U_(e).set(new U_(t)),e}function iW(t,e){var r=e?nW(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function oW(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}function sW(t,e,r,n){var i=!r;r||(r={});for(var o=-1,s=e.length;++o<s;){var a=e[o],c=n?n(r[a],t[a],a,r,t):void 0;c===void 0&&(c=t[a]),i?SE(r,a,c):VJ(r,a,c)}return r}function aW(t){return eW(function(e,r){var n=-1,i=r.length,o=i>1?r[i-1]:void 0,s=i>2?r[2]:void 0;for(o=t.length>3&&typeof o=="function"?(i--,o):void 0,s&&dW(r[0],r[1],s)&&(o=i<3?void 0:o,i=1),e=Object(e);++n<i;){var a=r[n];a&&t(e,a,n,o)}return e})}function cW(t){return function(e,r,n){for(var i=-1,o=Object(e),s=n(e),a=s.length;a--;){var c=s[t?a:++i];if(r(o[c],c,o)===!1)break}return e}}function np(t,e){var r=t.__data__;return AW(e)?r[typeof e=="string"?"string":"hash"]:r.map}function wE(t,e){var r=gJ(t,e);return WJ(r)?r:void 0}function uW(t){var e=Eo.call(t,ra),r=t[ra];try{t[ra]=void 0;var n=!0}catch{}var i=V_.call(t);return n&&(e?t[ra]=r:delete t[ra]),i}function lW(t){return typeof t.constructor=="function"&&!X_(t)?QJ(J_(t)):{}}function K_(t,e){var r=typeof t;return e=e??$_,!!e&&(r=="number"||r!="symbol"&&dJ.test(t))&&t>-1&&t%1==0&&t<e}function dW(t,e,r){if(!ia(r))return!1;var n=typeof e;return(n=="number"?BE(r)&&K_(e,r.length):n=="string"&&e in r)?ip(r[e],t):!1}function AW(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function pW(t){return!!N_&&N_ in t}function X_(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||XA;return t===r}function fW(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}function hW(t){return V_.call(t)}function gW(t,e,r){return e=L_(e===void 0?t.length-1:e,0),function(){for(var n=arguments,i=-1,o=L_(n.length-e,0),s=Array(o);++i<o;)s[i]=n[e+i];i=-1;for(var a=Array(e+1);++i<e;)a[i]=n[i];return a[e]=r(s),pJ(t,this,a)}}function IE(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}var mW=yW(tW);function yW(t){var e=0,r=0;return function(){var n=BJ(),i=MV-(n-r);if(r=n,i>0){if(++e>=UV)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function EW(t){if(t!=null){try{return ep.call(t)}catch{}try{return t+""}catch{}}return""}function ip(t,e){return t===e||t!==t&&e!==e}var CE=P_((function(){return arguments})())?P_:function(t){return gl(t)&&Eo.call(t,"callee")&&!bJ.call(t,"callee")},bE=Array.isArray;function BE(t){return t!=null&&t0(t.length)&&!QE(t)}function IW(t){return gl(t)&&BE(t)}var e0=wJ||BW;function QE(t){if(!ia(t))return!1;var e=rp(t);return e==q_||e==jV||e==LV||e==GV}function t0(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=$_}function ia(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function gl(t){return t!=null&&typeof t=="object"}function CW(t){if(!gl(t)||rp(t)!=z_)return!1;var e=J_(t);if(e===null)return!0;var r=Eo.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&ep.call(r)==IJ}var r0=k_?hJ(k_):ZJ;function bW(t){return sW(t,n0(t))}function n0(t){return BE(t)?YJ(t,!0):KJ(t)}var SW=aW(function(t,e,r){Z_(t,e,r)});function wW(t){return function(){return t}}function i0(t){return t}function BW(){return!1}mc.exports=SW});var E0=m((tNe,y0)=>{"use strict";var u0=200,DE="__lodash_hash_undefined__",QW=1/0,vW=9007199254740991,_W="[object Function]",DW="[object GeneratorFunction]",TW=/[\\^$.*+?()[\]{}|]/g,RW=/^\[object .+?Constructor\]$/,kW=typeof global=="object"&&global&&global.Object===Object&&global,NW=typeof self=="object"&&self&&self.Object===Object&&self,TE=kW||NW||Function("return this")();function OW(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function UW(t,e){for(var r=-1,n=t?t.length:0,i=0,o=[];++r<n;){var s=t[r];e(s,r,t)&&(o[i++]=s)}return o}function l0(t,e){var r=t?t.length:0;return!!r&&PW(t,e,0)>-1}function d0(t,e,r){for(var n=-1,i=t?t.length:0;++n<i;)if(r(e,t[n]))return!0;return!1}function MW(t,e){for(var r=-1,n=t?t.length:0,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}function xW(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}function LW(t,e,r,n){for(var i=t.length,o=r+(n?1:-1);n?o--:++o<i;)if(e(t[o],o,t))return o;return-1}function PW(t,e,r){if(e!==e)return LW(t,FW,r);for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}function FW(t){return t!==t}function $W(t){return function(e){return t(e)}}function A0(t,e){return t.has(e)}function jW(t,e){return t?.[e]}function qW(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function p0(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var zW=Array.prototype,HW=Function.prototype,f0=Object.prototype,vE=TE["__core-js_shared__"],s0=(function(){var t=/[^.]+$/.exec(vE&&vE.keys&&vE.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})(),h0=HW.toString,RE=f0.hasOwnProperty,GW=f0.toString,YW=RegExp("^"+h0.call(RE).replace(TW,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),VW=zW.splice,a0=Math.max,JW=kE(TE,"Map"),_E=kE(TE,"Set"),ml=kE(Object,"create");function oa(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function WW(){this.__data__=ml?ml(null):{}}function ZW(t){return this.has(t)&&delete this.__data__[t]}function KW(t){var e=this.__data__;if(ml){var r=e[t];return r===DE?void 0:r}return RE.call(e,t)?e[t]:void 0}function XW(t){var e=this.__data__;return ml?e[t]!==void 0:RE.call(e,t)}function e4(t,e){var r=this.__data__;return r[t]=ml&&e===void 0?DE:e,this}oa.prototype.clear=WW;oa.prototype.delete=ZW;oa.prototype.get=KW;oa.prototype.has=XW;oa.prototype.set=e4;function Ic(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function t4(){this.__data__=[]}function r4(t){var e=this.__data__,r=op(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():VW.call(e,r,1),!0}function n4(t){var e=this.__data__,r=op(e,t);return r<0?void 0:e[r][1]}function i4(t){return op(this.__data__,t)>-1}function o4(t,e){var r=this.__data__,n=op(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}Ic.prototype.clear=t4;Ic.prototype.delete=r4;Ic.prototype.get=n4;Ic.prototype.has=i4;Ic.prototype.set=o4;function Cc(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function s4(){this.__data__={hash:new oa,map:new(JW||Ic),string:new oa}}function a4(t){return sp(this,t).delete(t)}function c4(t){return sp(this,t).get(t)}function u4(t){return sp(this,t).has(t)}function l4(t,e){return sp(this,t).set(t,e),this}Cc.prototype.clear=s4;Cc.prototype.delete=a4;Cc.prototype.get=c4;Cc.prototype.has=u4;Cc.prototype.set=l4;function yl(t){var e=-1,r=t?t.length:0;for(this.__data__=new Cc;++e<r;)this.add(t[e])}function d4(t){return this.__data__.set(t,DE),this}function A4(t){return this.__data__.has(t)}yl.prototype.add=yl.prototype.push=d4;yl.prototype.has=A4;function op(t,e){for(var r=t.length;r--;)if(b4(t[r][0],e))return r;return-1}function c0(t,e,r,n){var i=-1,o=l0,s=!0,a=t.length,c=[],u=e.length;if(!a)return c;r&&(e=MW(e,$W(r))),n?(o=d0,s=!1):e.length>=u0&&(o=A0,s=!1,e=new yl(e));e:for(;++i<a;){var l=t[i],d=r?r(l):l;if(l=n||l!==0?l:0,s&&d===d){for(var A=u;A--;)if(e[A]===d)continue e;c.push(l)}else o(e,d,n)||c.push(l)}return c}function p4(t){if(!m0(t)||E4(t))return!1;var e=g0(t)||qW(t)?YW:RW;return e.test(I4(t))}function f4(t,e){return e=a0(e===void 0?t.length-1:e,0),function(){for(var r=arguments,n=-1,i=a0(r.length-e,0),o=Array(i);++n<i;)o[n]=r[e+n];n=-1;for(var s=Array(e+1);++n<e;)s[n]=r[n];return s[e]=o,OW(t,this,s)}}function h4(t,e,r){var n=-1,i=l0,o=t.length,s=!0,a=[],c=a;if(r)s=!1,i=d0;else if(o>=u0){var u=e?null:m4(t);if(u)return p0(u);s=!1,i=A0,c=new yl}else c=e?[]:a;e:for(;++n<o;){var l=t[n],d=e?e(l):l;if(l=r||l!==0?l:0,s&&d===d){for(var A=c.length;A--;)if(c[A]===d)continue e;e&&c.push(d),a.push(l)}else i(c,d,r)||(c!==a&&c.push(d),a.push(l))}return a}function g4(t,e,r){for(var n=-1,i=t.length;++n<i;)var o=o?xW(c0(o,t[n],e,r),c0(t[n],o,e,r)):t[n];return o&&o.length?h4(o,e,r):[]}var m4=_E&&1/p0(new _E([,-0]))[1]==QW?function(t){return new _E(t)}:v4;function sp(t,e){var r=t.__data__;return y4(e)?r[typeof e=="string"?"string":"hash"]:r.map}function kE(t,e){var r=jW(t,e);return p4(r)?r:void 0}function y4(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function E4(t){return!!s0&&s0 in t}function I4(t){if(t!=null){try{return h0.call(t)}catch{}try{return t+""}catch{}}return""}var C4=f4(function(t){return g4(UW(t,w4))});function b4(t,e){return t===e||t!==t&&e!==e}function S4(t){return t!=null&&B4(t.length)&&!g0(t)}function w4(t){return Q4(t)&&S4(t)}function g0(t){var e=m0(t)?GW.call(t):"";return e==_W||e==DW}function B4(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=vW}function m0(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function Q4(t){return!!t&&typeof t=="object"}function v4(){}y0.exports=C4});var cp=m(Co=>{"use strict";var ME=Co&&Co.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Co,"__esModule",{value:!0});Co.toJsonSchema=N4;Co.convertRequiredToArray=El;Co.generateDefaultFromSchema=Il;Co.parseJsonSafe=ap;Co.normalizeToolSchemas=O4;var NE=ME(T_()),OE=ME(o0()),_4=ME(E0());function bc(t,e){if(t===e)return!0;if(t===null||e===null||typeof t!="object"||typeof e!="object"||Array.isArray(t)!==Array.isArray(e))return!1;let r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;let i=e;return r.every(o=>o in i&&bc(t[o],i[o]))}var D4={required:!1,requiredDepth:Number.POSITIVE_INFINITY,postProcessFnc:null,strings:{preProcessFnc:null},arrays:{mode:"all"},objects:{preProcessFnc:null,postProcessFnc:null,additionalProperties:!0}},T4={string:function(e){return typeof e=="string"},number:function(e){return typeof e=="number"&&isFinite(e)},integer:function(e){return typeof e=="number"&&e%1===0},boolean:function(e){return typeof e=="boolean"},array:function(e){return e instanceof Array},null:function(e){return e===null},date:function(e){return e instanceof Date},any:function(e){return!0},object:function(e){return e&&typeof e=="object"&&!(e instanceof Array)&&!(e instanceof Date)}},Sc={typeNames:["integer","number","string","array","object","boolean","null","date"],getType(t){return Sc.typeNames.find(e=>T4[e](t))},mergeSchemaObjs(t,e){if(!t||!e)return null;let r=(0,NE.default)(t),n=(0,NE.default)(e);if(!bc(r,n)){if(t.type==="array"&&e.type==="array"&&bc((0,_4.default)(r,n),["items"])){let o=r.length>n.length?e:t,s=r.length>n.length?t:e;if((0,NE.default)(o).reduce((c,u)=>bc(o[u],s[u])&&c,!0))return o}if(t.type!=="object"||e.type!=="object")return null}let i={};for(let o=0,{length:s}=r;o<s;o++){let a=r[o];if(Sc.getType(t[a])==="object"){let c=Sc.mergeSchemaObjs(t[a],e[a]);if(c)i[a]=c;else{if(t.type==="object"||e.type==="object")return{type:"object"};if(a!=="items"||t.type!=="array"||e.type!=="array")return null}}else if(a==="type")if(t[a]!==e[a])if(t[a]==="integer"&&e[a]==="number"||t[a]==="number"&&e[a]==="integer")i[a]="number";else return null;else i[a]=t[a];else{if(!bc(t[a],e[a]))return null;i[a]=t[a]}}return i}};function R4(t){let e;for(let r=0,{length:n}=t;r<n;r++){let i=t[r];if(r>0&&(i==="integer"&&e==="number"?i="number":i==="number"&&e==="integer"&&(e="number"),e!==i))return null;e=i}return e}function k4(t){return R4(t.map(e=>Sc.getType(e)))}var UE=class{constructor(e){this.options=(0,OE.default)({},D4,e),this.depth=0,this.getObjectSchemaDefault=this.getObjectSchemaDefault.bind(this),this.getStringSchemaDefault=this.getStringSchemaDefault.bind(this),this.objectPostProcessDefault=this.objectPostProcessDefault.bind(this),this.commmonPostProcessDefault=this.commmonPostProcessDefault.bind(this),this.objectPostProcessDefault=this.objectPostProcessDefault.bind(this)}getCommonArrayItemSchema(e){let r=e.map(n=>{this.depth++;let i=this.getSchema(n);return this.depth--,i});return r.reduce((n,i)=>Sc.mergeSchemaObjs(n,i),r.pop())}getObjectSchemaDefault(e){let r={type:"object"},n=Object.keys(e);return n.length>0&&(r.properties=n.reduce((i,o)=>(this.depth++,i[o]=this.getSchema(e[o]),this.depth--,i),{})),r}getObjectSchema(e){return this.options.objects.preProcessFnc?this.options.objects.preProcessFnc(e,this.getObjectSchemaDefault):this.getObjectSchemaDefault(e)}getArraySchemaMerging(e){let r={type:"array"},n=k4(e);if(n)if(r.items={type:n},n!=="integer"&&n!=="number"){let i=this.getCommonArrayItemSchema(e);i&&(r.items=i)}else this.options.required&&(r.items.required=!0);return r}getArraySchemaNoMerging(e){let r={type:"array"};return e.length>0&&(this.depth++,r.items=this.getSchema(e[0]),this.depth--),r}getArraySchemaTuple(e){let r={type:"array"};return e.length>0&&(r.items=e.map(n=>{this.depth++;let i=this.getSchema(n);return this.depth--,i})),r}getArraySchemaUniform(e){let r=this.getArraySchemaNoMerging(e);if(e.length>1)for(let n=1;n<e.length;n++){this.depth++;let i=this.getSchema(e[n]);if(this.depth--,!bc(r.items,i))throw new Error("Invalid schema, incompatible array items")}return r}getArraySchema(e){if(e.length===0)return{type:"array"};switch(this.options.arrays.mode){case"all":return this.getArraySchemaMerging(e);case"first":return this.getArraySchemaNoMerging(e);case"uniform":return this.getArraySchemaUniform(e);case"tuple":return this.getArraySchemaTuple(e);default:throw new Error(`Unknown array mode option '${this.options.arrays.mode}'`)}}getStringSchemaDefault(e){return{type:"string"}}getStringSchema(e){return this.options.strings.preProcessFnc?this.options.strings.preProcessFnc(e,this.getStringSchemaDefault):this.getStringSchemaDefault(e)}commmonPostProcessDefault(e,r,n){return this.options.required&&this.depth<=this.options.requiredDepth?(0,OE.default)({},r,{required:!0}):r}objectPostProcessDefault(e,r){return this.options.objects.additionalProperties===!1&&Object.getOwnPropertyNames(r).length>0?(0,OE.default)({},e,{additionalProperties:!1}):e}getSchema(e){let r=Sc.getType(e);r||(r="null");let n;switch(r){case"object":n=this.getObjectSchema(e);break;case"array":n=this.getArraySchema(e);break;case"string":n=this.getStringSchema(e);break;default:n={type:r}}return this.options.postProcessFnc?n=this.options.postProcessFnc(r,n,e,this.commmonPostProcessDefault):n=this.commmonPostProcessDefault(r,n,e),r==="object"&&(this.options.objects.postProcessFnc?n=this.options.objects.postProcessFnc(n,e,this.objectPostProcessDefault):n=this.objectPostProcessDefault(n,e)),n}};function N4(t,e){return new UE(e).getSchema(t)}function El(t){if(!t||typeof t!="object")return t;if(Array.isArray(t))return t.map(r=>El(r));let e={...t};if(delete e.required,e.properties&&typeof e.properties=="object"){let r=[],n={};for(let[i,o]of Object.entries(e.properties)){let s=o;if(s&&typeof s=="object"&&s.required===!0){r.push(i);let{required:a,...c}=s;n[i]=El(c)}else n[i]=El(s)}e.properties=n,r.length>0&&(e.required=r)}return e.items&&(e.items=El(e.items)),e}function Il(t){if(!t||typeof t!="object")return null;if(t.const!==void 0)return t.const;if(t.enum&&Array.isArray(t.enum)&&t.enum.length>0)return t.enum[0];if(t.default!==void 0)return t.default;if(t.oneOf&&Array.isArray(t.oneOf)&&t.oneOf.length>0)return Il(t.oneOf[0]);if(t.anyOf&&Array.isArray(t.anyOf)&&t.anyOf.length>0)return Il(t.anyOf[0]);switch(Array.isArray(t.type)?t.type[0]:t.type){case"string":case"number":case"integer":case"boolean":return null;case"null":return null;case"array":return t.items?[]:[];case"object":let r={};if(t.properties&&typeof t.properties=="object"){let n=t.required||[];for(let[i,o]of Object.entries(t.properties))r[i]=Il(o)}return r;default:if(t.properties&&typeof t.properties=="object"){let n={};for(let[i,o]of Object.entries(t.properties))n[i]=Il(o);return n}return null}}function ap(t){if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return t}}function O4(t){let e={...t};return e.inputSchema&&(e.inputSchema=ap(e.inputSchema)),e.outputSchema&&(e.outputSchema=ap(e.outputSchema)),e.responseSchema&&(e.responseSchema=ap(e.responseSchema)),e}});var U4,C0,I0,M4,x4,L4,P4,b0=He(()=>{"use strict";U4=t=>{let e=I0(t,0);if(e===void 0||!x4(t[e]))return;let r=I0(t,e+1);if(r!==void 0)return L4(t,e,r)},C0=U4,I0=(t,e)=>{for(let r=e;r<t.length;r+=1){let n=t[r];if(!M4(n))return r}},M4=t=>t===" "||t===" "||t===`
|
|
3
3
|
`||t==="\r",x4=t=>t==="{"||t==="[",L4=(t,e,r)=>{let n;for(let i=r-1;i>e;i-=1){let o=t[i];if(o==="\r")return;if(o===`
|
|
4
4
|
`)return P4(n);if(n===void 0)n=o;else if(n[0]===o)n+=o;else return}},P4=t=>t===void 0?0:t[0]===" "?t.length:t});var S0,xE,F4,$4,w0=He(()=>{"use strict";S0=(t,e)=>{let r=xE(t,"toPrecision",e,e);return r===void 0?xE(t,"toExponential",e,e):r},xE=(t,e,r,n)=>{let o=t[e](n).replace(F4,"$1").replace($4,"$1");return o.length<=r?o:n===1?void 0:xE(t,e,r,n-1)},F4=/(e)\+/iu,$4=/\.?0*($|e)/iu});var Q0,j4,q4,B0,v0=He(()=>{"use strict";Q0=(t,e)=>{if(typeof t!="string")throw new TypeError(`Input must be a JSON string: ${t}`);j4(e)},j4=t=>{if(q4(t),t<0)throw new TypeError(`"maxSize" argument must be positive: ${t}`);if(t<B0)throw new TypeError(`"maxSize" argument must be at least ${B0}: ${t}`)},q4=t=>{if(t===void 0)throw new TypeError('"maxSize" argument must be defined');if(!Number.isInteger(t))throw new TypeError(`"maxSize" argument must be an integer: ${t}`)},B0=7});var up,_0,lp,z4,H4,G4,Y4,D0,V4,J4,W4,Z4,K4,X4,LE=He(()=>{"use strict";up=(t,e,r)=>{let n=D0(e,r);return _0(t,e,n)},_0=(t,e,r)=>{if(r>=e)return r;let n=t[r];return n>=K4&&n<=X4?_0(t,e,r+1):r},lp=(t,e,r)=>{if(r===void 0)return r;let n=D0(e,r);return z4(t,n)},z4=(t,e)=>H4(t,e)?e-3:G4(t,e)?e-2:Y4(t,e)?e-1:e,H4=(t,e)=>e>=3&&t[e-3]>=V4&&t[e-3]<=J4,G4=(t,e)=>e>=2&&t[e-2]>=W4,Y4=(t,e)=>e>=1&&t[e-1]>=Z4,D0=(t,e)=>e<0||Object.is(e,-0)?Math.max(t+e,0):e,V4=240,J4=244,W4=224,Z4=194,K4=128,X4=191});var T0,R0=He(()=>{"use strict";LE();T0=(t,e,r)=>{let n=globalThis.Buffer.from(t),i=up(n,n.length,e),o=lp(n,n.length,r);return i===0&&o>=n.length?n.toString():n.toString("utf8",i,o)}});var k0,N0=He(()=>{"use strict";k0=/[\uD800-\uDFFF]/gu});var dp,tZ,$E=He(()=>{"use strict";N0();dp=t=>tZ(t)?t.replace(k0,"\uFFFD"):t,tZ=t=>{for(let e=0;e<t.length;e+=1){let r=t.codePointAt(e);if(r>=55296&&r<=57343)return!0}return!1}});var jE,O0=He(()=>{"use strict";jE=({input:t,targetByteCount:e,firstStartSurrogate:r,lastStartSurrogate:n,firstEndSurrogate:i,lastEndSurrogate:o,increment:s,canBacktrack:a,shift:c,charIndexInit:u})=>{let l=u,d=l,A=0;for(;A<e;l+=s){d=l;let h=t.charCodeAt(l);if(Number.isNaN(h))break;if(h<=127){A+=1;continue}if(h<=2047){A+=2;continue}if(A+=3,h<r||h>n)continue;let g=t.charCodeAt(l+s);Number.isNaN(g)||g<i||g>o||(A+=1,l+=s)}return(a&&A>e?d:l)+c}});var qE,sZ,aZ,U0=He(()=>{"use strict";O0();qE=(t,e,r)=>e<0||Object.is(e,-0)?aZ(t,e,r):sZ(t,e,r),sZ=(t,e,r)=>jE({input:t,targetByteCount:e,firstStartSurrogate:55296,lastStartSurrogate:56319,firstEndSurrogate:56320,lastEndSurrogate:57343,increment:1,canBacktrack:r,shift:0,charIndexInit:0}),aZ=(t,e,r)=>jE({input:t,targetByteCount:-e,firstStartSurrogate:56320,lastStartSurrogate:57343,firstEndSurrogate:55296,lastEndSurrogate:56319,increment:-1,canBacktrack:!r,shift:1,charIndexInit:t.length-1})});var Ap,cZ,M0=He(()=>{"use strict";$E();U0();Ap=(t,e,r)=>{let n=qE(t,e,!1),i=cZ(t,r),o=n===0&&i===void 0?t:t.slice(n,i);return dp(o)},cZ=(t,e)=>{if(e===void 0)return e;let r=qE(t,e,!0);return r===t.length?void 0:r}});var L0,uZ,zE,x0,lZ,dZ,pp,P0=He(()=>{"use strict";LE();L0=(t,e,r)=>{let{textEncoder:n,textDecoder:i}=uZ(),o=lZ(t),{written:s}=n.encodeInto(t,o),a=up(o,s,e),c=lp(o,s,r),u=c===void 0?s:Math.min(c,s),l=o.subarray(a,u);return i.decode(l)},uZ=()=>(zE===void 0&&(zE=new globalThis.TextEncoder,x0=new globalThis.TextDecoder("utf8",{fatal:!1})),{textEncoder:zE,textDecoder:x0}),lZ=t=>{let e=t.length*3;return e>dZ?new Uint8Array(e):((pp===void 0||pp.length<e)&&(pp=new Uint8Array(e)),pp)},dZ=1e5});var F0,HE,$0,j0=He(()=>{"use strict";F0=(t,e)=>{if(e===void 0)return e;let r=HE(t,e);return r>=t.length*$0?void 0:r},HE=(t,e)=>e<=t.length*-$0?0:e,$0=4});var q0,AZ,pZ,z0,H0=He(()=>{"use strict";q0=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`First argument must be a string: ${t}`);AZ(e),pZ(r)},AZ=t=>{if(t===void 0)throw new TypeError("Second argument is required.");z0("Second",t)},pZ=t=>{t!==void 0&&z0("Third",t)},z0=(t,e)=>{if(!Number.isInteger(e))throw new TypeError(`${t} argument must be an integer: ${e}`)}});var G0,fZ,GE,Y0=He(()=>{"use strict";G0=t=>{let e=!0,r=0;for(let n=0;n<GE;n+=1){let i=fZ(t,n);i<=127||(e&&(e=!1),i>2047&&(r+=1))}return{asciiOnly:e,longCharsPercentage:r/GE}},fZ=(t,e)=>{let r=GE-1,n=1-(r-e)/r,i=Math.round(n*(t.length-1));return t.charCodeAt(i)},GE=50});var hZ,V0,gZ,mZ,yZ,EZ,J0,W0=He(()=>{"use strict";R0();M0();P0();j0();$E();H0();Y0();hZ=(t,e,r)=>{if(q0(t,e,r),t==="")return t;let n=HE(t,e),i=F0(t,r);return i===void 0&&Object.is(n,0)?dp(t):gZ(t,n,i)},V0=hZ,gZ=(t,e,r)=>{if(t.length<=mZ)return Ap(t,e,r);let{asciiOnly:n,longCharsPercentage:i}=G0(t);return n?EZ(t,e,r):i>=yZ?Ap(t,e,r):J0(t,e,r)},mZ=200,yZ=.4,EZ=(t,e,r)=>"Buffer"in globalThis&&"from"in globalThis.Buffer?T0(t,e,r):J0(t,e,r),J0=(t,e,r)=>"TextEncoder"in globalThis?L0(t,e,r):Ap(t,e,r)});var K0,IZ,CZ,bZ,SZ,Cl,Z0,X0=He(()=>{"use strict";W0();K0=(t,e)=>{let r=JSON.stringify(t),n=bZ(r),i=V0(n,0,e-Z0.length-Cl.length*2),s=`${IZ(i)}${Z0}`;return SZ(s)},IZ=t=>t.replace(CZ,""),CZ=/(\\|\\u[0-9a-fA-F]{0,3})$/u,bZ=t=>t.slice(Cl.length,-Cl.length),SZ=t=>`${Cl}${t}${Cl}`,Cl='"',Z0="..."});var eD,tD=He(()=>{"use strict";eD=t=>globalThis.Buffer.byteLength(t)});var YE,wZ,BZ,QZ,vZ,_Z,DZ,rD=He(()=>{"use strict";YE=t=>{let e=t.length,r=e;for(let n=0;n<e;n+=1){let i=t.charCodeAt(n);if(i<=wZ)continue;if(i<=BZ){r+=1;continue}if(r+=2,i<QZ||i>vZ)continue;let o=t.charCodeAt(n+1);o<_Z||o>DZ||(n+=1)}return r},wZ=127,BZ=2047,QZ=55296,vZ=56319,_Z=56320,DZ=57343});var nD,TZ,RZ,kZ,fp,iD=He(()=>{"use strict";nD=()=>TZ.bind(void 0,new TextEncoder),TZ=(t,e)=>{let r=RZ(e);return t.encodeInto(e,r).written},RZ=t=>{let e=t.length*3;return e>kZ?new Uint8Array(e):((fp===void 0||fp.length<e)&&(fp=new Uint8Array(e)),fp)},kZ=1e5});var OZ,UZ,oD,sD=He(()=>{"use strict";tD();rD();iD();OZ=()=>"Buffer"in globalThis&&"byteLength"in globalThis.Buffer?eD:"TextEncoder"in globalThis?UZ.bind(void 0,nD()):YE,UZ=(t,e)=>e.length<100?YE(e):t(e),oD=OZ()});var aD,MZ,xZ,LZ,PZ,VE,cD=He(()=>{"use strict";sD();aD=t=>{if(t===null)return MZ;if(t===!0)return xZ;if(t===!1)return LZ;let e=typeof t;return e==="object"?PZ:e==="number"?JSON.stringify(t).length:VE(t)},MZ=4,xZ=4,LZ=5,PZ=2,VE=t=>oD(JSON.stringify(t))});var hp,lD,dD,AD,FZ,pD,uD,fD,$Z,bl=He(()=>{"use strict";cD();hp=({size:t,increment:e,maxSize:r,truncatedProps:n,path:i,value:o})=>{let s=t+e,a=s>r;return a?{size:t,stop:a,truncatedProps:[...n,{path:i,value:o}]}:{size:s,stop:a,truncatedProps:n}},lD=t=>aD(t),dD=(t,e,r)=>{let n=pD({empty:t,indent:e,depth:r,keySpaceSize:0}),i=fD(t);return n+i},AD=({key:t,empty:e,indent:r,depth:n})=>{let i=pD({empty:e,indent:r,depth:n,keySpaceSize:1}),o=VE(t),s=fD(e);return i+o+FZ+s},FZ=1,pD=({empty:t,indent:e,depth:r,keySpaceSize:n})=>{if(e===void 0)return 0;let i=uD+e*(r+1),o=t?uD+e*r:0;return n+i+o},uD=1,fD=t=>t?0:$Z,$Z=1});var gp,jZ,JE=He(()=>{"use strict";bl();gp=({parent:t,truncatedProps:e,path:r,increment:n,maxSize:i,key:o,empty:s,size:a,truncateValue:c,indent:u,depth:l})=>{let d=t[o],A=[...r,o],{size:p,stop:h,truncatedProps:g}=hp({size:a,increment:n,maxSize:i,truncatedProps:e,path:A,value:d});return h?{empty:s,size:p,truncatedProps:g}:jZ({value:d,truncatedProps:e,path:A,maxSize:i,empty:s,size:a,newSize:p,truncateValue:c,indent:u,depth:l})},jZ=({value:t,truncatedProps:e,path:r,maxSize:n,empty:i,size:o,newSize:s,truncateValue:a,indent:c,depth:u})=>{let{value:l,size:d,truncatedProps:A}=a({value:t,truncatedProps:e,path:r,size:s,maxSize:n,indent:c,depth:u+1});return l===void 0?{empty:i,size:o,truncatedProps:A}:{empty:!1,size:d,value:l,truncatedProps:A}}});var hD,gD=He(()=>{"use strict";JE();bl();hD=({array:t,truncatedProps:e,path:r,size:n,maxSize:i,truncateValue:o,indent:s,depth:a})=>{let c=[],u={empty:!0,size:n,truncatedProps:e};for(let l=0;l<t.length;l+=1){let d=dD(u.empty,s,a);u=gp({parent:t,truncatedProps:u.truncatedProps,path:r,increment:d,maxSize:i,key:l,empty:u.empty,size:u.size,truncateValue:o,indent:s,depth:a}),u.value!==void 0&&c.push(u.value)}return{value:c,size:u.size,truncatedProps:u.truncatedProps}}});var mD,yD=He(()=>{"use strict";JE();bl();mD=({object:t,truncatedProps:e,path:r,size:n,maxSize:i,truncateValue:o,indent:s,depth:a})=>{let c={},u={empty:!0,size:n,truncatedProps:e};for(let l in t){let d=AD({key:l,empty:u.empty,indent:s,depth:a});u=gp({parent:t,truncatedProps:u.truncatedProps,path:r,increment:d,maxSize:i,key:l,empty:u.empty,size:u.size,truncateValue:o,indent:s,depth:a}),u.value!==void 0&&(c[l]=u.value)}return{value:c,size:u.size,truncatedProps:u.truncatedProps}}});var mp,qZ,ED=He(()=>{"use strict";gD();yD();bl();mp=({value:t,truncatedProps:e,path:r,size:n,maxSize:i,indent:o,depth:s})=>{let a=lD(t),{size:c,stop:u,truncatedProps:l}=hp({size:n,increment:a,maxSize:i,truncatedProps:e,path:r,value:t});return u?{value:void 0,size:c,truncatedProps:l}:qZ({value:t,truncatedProps:l,path:r,size:c,maxSize:i,indent:o,depth:s})},qZ=({value:t,truncatedProps:e,path:r,size:n,maxSize:i,indent:o,depth:s})=>typeof t!="object"||t===null?{value:t,size:n,truncatedProps:e}:Array.isArray(t)?hD({array:t,truncatedProps:e,path:r,size:n,maxSize:i,truncateValue:mp,indent:o,depth:s}):mD({object:t,truncatedProps:e,path:r,size:n,maxSize:i,truncateValue:mp,indent:o,depth:s})});var ID={};c_(ID,{default:()=>HZ});var zZ,HZ,GZ,YZ,VZ,CD=He(()=>{"use strict";b0();w0();v0();X0();ED();zZ=(t,e)=>{Q0(t,e);let r=GZ(t),n=YZ(t),{value:i,truncatedProps:o}=mp({value:n,truncatedProps:[],path:[],size:0,maxSize:e,indent:r,depth:0});return{jsonString:VZ({newValue:i,value:n,maxSize:e,indent:r}),truncatedProps:o}},HZ=zZ,GZ=t=>{let e=C0(t);return typeof e=="string"?e.length:e},YZ=t=>{try{return JSON.parse(t)}catch(e){throw new TypeError(`Invalid JSON string: "${t}"
|
|
5
5
|
${e.message}`)}},VZ=({newValue:t,value:e,maxSize:r,indent:n})=>t!==void 0?JSON.stringify(t,void 0,n):typeof e=="number"?S0(e,r):K0(e,r)});var SD=m(bD=>{"use strict";Object.defineProperty(bD,"__esModule",{value:!0})});var rs=m(yp=>{"use strict";Object.defineProperty(yp,"__esModule",{value:!0});yp.CronField=void 0;var WE=class t{#e=!1;#t=!1;#n=!1;#i=[];options={rawValue:""};static get min(){throw new Error("min must be overridden")}static get max(){throw new Error("max must be overridden")}static get chars(){return Object.freeze([])}static get validChars(){return/^[?,*\dH/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}static get constraints(){return{min:this.min,max:this.max,chars:this.chars,validChars:this.validChars}}constructor(e,r={rawValue:""}){if(!Array.isArray(e))throw new Error(`${this.constructor.name} Validation error, values is not an array`);if(!(e.length>0))throw new Error(`${this.constructor.name} Validation error, values contains no values`);this.options={...r,rawValue:r.rawValue??""},this.#i=e.sort(t.sorter),this.#n=this.options.wildcard!==void 0?this.options.wildcard:this.#o(),this.#e=this.options.rawValue.includes("L")||e.includes("L"),this.#t=this.options.rawValue.includes("?")||e.includes("?")}get min(){return this.constructor.min}get max(){return this.constructor.max}get chars(){return this.constructor.chars}get hasLastChar(){return this.#e}get hasQuestionMarkChar(){return this.#t}get isWildcard(){return this.#n}get values(){return this.#i}static sorter(e,r){let n=typeof e=="number",i=typeof r=="number";return n&&i?e-r:!n&&!i?e.localeCompare(r):n?-1:1}static findNearestValueInList(e,r,n=!1){if(n){for(let i=e.length-1;i>=0;i--)if(e[i]<r)return e[i];return null}for(let i=0;i<e.length;i++)if(e[i]>r)return e[i];return null}findNearestValue(e,r=!1){return this.constructor.findNearestValueInList(this.values,e,r)}serialize(){return{wildcard:this.#n,values:this.#i}}validate(){let e,r=this.chars.length>0?` or chars ${this.chars.join("")}`:"",n=a=>c=>new RegExp(`^\\d{0,2}${c}$`).test(a),i=a=>(e=a,typeof a=="number"?a>=this.min&&a<=this.max:this.chars.some(n(a)));if(!this.#i.every(i))throw new Error(`${this.constructor.name} Validation error, got value ${e} expected range ${this.min}-${this.max}${r}`);let s=this.#i.find((a,c)=>this.#i.indexOf(a)!==c);if(s)throw new Error(`${this.constructor.name} Validation error, duplicate values found: ${s}`)}#o(){return this.options.rawValue.length>0?["*","?"].includes(this.options.rawValue):Array.from({length:this.max-this.min+1},(e,r)=>r+this.min).every(e=>this.#i.includes(e))}};yp.CronField=WE});var wD=m(Ep=>{"use strict";Object.defineProperty(Ep,"__esModule",{value:!0});Ep.CronDayOfMonth=void 0;var JZ=rs(),WZ=1,ZZ=31,KZ=Object.freeze(["L"]),ZE=class extends JZ.CronField{static get min(){return WZ}static get max(){return ZZ}static get chars(){return KZ}static get validChars(){return/^[?,*\dLH/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}constructor(e,r){super(e,r),this.validate()}get values(){return super.values}};Ep.CronDayOfMonth=ZE});var BD=m(Ip=>{"use strict";Object.defineProperty(Ip,"__esModule",{value:!0});Ip.CronDayOfWeek=void 0;var XZ=rs(),e6=0,t6=7,r6=Object.freeze(["L"]),KE=class extends XZ.CronField{static get min(){return e6}static get max(){return t6}static get chars(){return r6}static get validChars(){return/^[?,*\dLH#/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}constructor(e,r){super(e,r),this.validate()}get values(){return super.values}get nthDay(){return this.options.nthDayOfWeek??0}};Ip.CronDayOfWeek=KE});var QD=m(Cp=>{"use strict";Object.defineProperty(Cp,"__esModule",{value:!0});Cp.CronHour=void 0;var n6=rs(),i6=0,o6=23,s6=Object.freeze([]),XE=class extends n6.CronField{static get min(){return i6}static get max(){return o6}static get chars(){return s6}constructor(e,r){super(e,r),this.validate()}get values(){return super.values}};Cp.CronHour=XE});var vD=m(bp=>{"use strict";Object.defineProperty(bp,"__esModule",{value:!0});bp.CronMinute=void 0;var a6=rs(),c6=0,u6=59,l6=Object.freeze([]),eI=class extends a6.CronField{static get min(){return c6}static get max(){return u6}static get chars(){return l6}constructor(e,r){super(e,r),this.validate()}get values(){return super.values}};bp.CronMinute=eI});var nR=m(Nr=>{"use strict";Object.defineProperty(Nr,"__esModule",{value:!0});var So=class extends Error{},lI=class extends So{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},dI=class extends So{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},AI=class extends So{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},os=class extends So{},Tp=class extends So{constructor(e){super(`Invalid unit ${e}`)}},Tt=class extends So{},Vn=class extends So{constructor(){super("Zone is an abstract class")}},q="numeric",Un="short",Rr="long",Rp={year:q,month:q,day:q},iT={year:q,month:Un,day:q},d6={year:q,month:Un,day:q,weekday:Un},oT={year:q,month:Rr,day:q},sT={year:q,month:Rr,day:q,weekday:Rr},aT={hour:q,minute:q},cT={hour:q,minute:q,second:q},uT={hour:q,minute:q,second:q,timeZoneName:Un},lT={hour:q,minute:q,second:q,timeZoneName:Rr},dT={hour:q,minute:q,hourCycle:"h23"},AT={hour:q,minute:q,second:q,hourCycle:"h23"},pT={hour:q,minute:q,second:q,hourCycle:"h23",timeZoneName:Un},fT={hour:q,minute:q,second:q,hourCycle:"h23",timeZoneName:Rr},hT={year:q,month:q,day:q,hour:q,minute:q},gT={year:q,month:q,day:q,hour:q,minute:q,second:q},mT={year:q,month:Un,day:q,hour:q,minute:q},yT={year:q,month:Un,day:q,hour:q,minute:q,second:q},A6={year:q,month:Un,day:q,weekday:Un,hour:q,minute:q},ET={year:q,month:Rr,day:q,hour:q,minute:q,timeZoneName:Un},IT={year:q,month:Rr,day:q,hour:q,minute:q,second:q,timeZoneName:Un},CT={year:q,month:Rr,day:q,weekday:Rr,hour:q,minute:q,timeZoneName:Rr},bT={year:q,month:Rr,day:q,weekday:Rr,hour:q,minute:q,second:q,timeZoneName:Rr},as=class{get type(){throw new Vn}get name(){throw new Vn}get ianaName(){return this.name}get isUniversal(){throw new Vn}offsetName(e,r){throw new Vn}formatOffset(e,r){throw new Vn}offset(e){throw new Vn}equals(e){throw new Vn}get isValid(){throw new Vn}},tI=null,_l=class t extends as{static get instance(){return tI===null&&(tI=new t),tI}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return NT(e,r,n)}formatOffset(e,r){return vl(this.offset(e),r)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}},pI=new Map;function p6(t){let e=pI.get(t);return e===void 0&&(e=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),pI.set(t,e)),e}var f6={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function h6(t,e){let r=t.format(e).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(r),[,i,o,s,a,c,u,l]=n;return[s,i,o,a,c,u,l]}function g6(t,e){let r=t.formatToParts(e),n=[];for(let i=0;i<r.length;i++){let{type:o,value:s}=r[i],a=f6[o];o==="era"?n[a]=s:he(a)||(n[a]=parseInt(s,10))}return n}var rI=new Map,wo=class t extends as{static create(e){let r=rI.get(e);return r===void 0&&rI.set(e,r=new t(e)),r}static resetCache(){rI.clear(),pI.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=t.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return NT(e,r,n,this.name)}formatOffset(e,r){return vl(this.offset(e),r)}offset(e){if(!this.valid)return NaN;let r=new Date(e);if(isNaN(r))return NaN;let n=p6(this.name),[i,o,s,a,c,u,l]=n.formatToParts?g6(n,r):h6(n,r);a==="BC"&&(i=-Math.abs(i)+1);let A=Lp({year:i,month:o,day:s,hour:c===24?0:c,minute:u,second:l,millisecond:0}),p=+r,h=p%1e3;return p-=h>=0?h:1e3+h,(A-p)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}},_D={};function m6(t,e={}){let r=JSON.stringify([t,e]),n=_D[r];return n||(n=new Intl.ListFormat(t,e),_D[r]=n),n}var fI=new Map;function hI(t,e={}){let r=JSON.stringify([t,e]),n=fI.get(r);return n===void 0&&(n=new Intl.DateTimeFormat(t,e),fI.set(r,n)),n}var gI=new Map;function y6(t,e={}){let r=JSON.stringify([t,e]),n=gI.get(r);return n===void 0&&(n=new Intl.NumberFormat(t,e),gI.set(r,n)),n}var mI=new Map;function E6(t,e={}){let{base:r,...n}=e,i=JSON.stringify([t,n]),o=mI.get(i);return o===void 0&&(o=new Intl.RelativeTimeFormat(t,e),mI.set(i,o)),o}var wl=null;function I6(){return wl||(wl=new Intl.DateTimeFormat().resolvedOptions().locale,wl)}var yI=new Map;function ST(t){let e=yI.get(t);return e===void 0&&(e=new Intl.DateTimeFormat(t).resolvedOptions(),yI.set(t,e)),e}var EI=new Map;function C6(t){let e=EI.get(t);if(!e){let r=new Intl.Locale(t);e="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,"minimalDays"in e||(e={...wT,...e}),EI.set(t,e)}return e}function b6(t){let e=t.indexOf("-x-");e!==-1&&(t=t.substring(0,e));let r=t.indexOf("-u-");if(r===-1)return[t];{let n,i;try{n=hI(t).resolvedOptions(),i=t}catch{let c=t.substring(0,r);n=hI(c).resolvedOptions(),i=c}let{numberingSystem:o,calendar:s}=n;return[i,o,s]}}function S6(t,e,r){return(r||e)&&(t.includes("-u-")||(t+="-u"),r&&(t+=`-ca-${r}`),e&&(t+=`-nu-${e}`)),t}function w6(t){let e=[];for(let r=1;r<=12;r++){let n=tt.utc(2009,r,1);e.push(t(n))}return e}function B6(t){let e=[];for(let r=1;r<=7;r++){let n=tt.utc(2016,11,13+r);e.push(t(n))}return e}function Sp(t,e,r,n){let i=t.listingMode();return i==="error"?null:i==="en"?r(e):n(e)}function Q6(t){return t.numberingSystem&&t.numberingSystem!=="latn"?!1:t.numberingSystem==="latn"||!t.locale||t.locale.startsWith("en")||ST(t.locale).numberingSystem==="latn"}var II=class{constructor(e,r,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;let{padTo:i,floor:o,...s}=n;if(!r||Object.keys(s).length>0){let a={useGrouping:!1,...n};n.padTo>0&&(a.minimumIntegerDigits=n.padTo),this.inf=y6(e,a)}}format(e){if(this.inf){let r=this.floor?Math.floor(e):e;return this.inf.format(r)}else{let r=this.floor?Math.floor(e):RI(e,3);return Et(r,this.padTo)}}},CI=class{constructor(e,r,n){this.opts=n,this.originalZone=void 0;let i;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){let s=-1*(e.offset/60),a=s>=0?`Etc/GMT+${s}`:`Etc/GMT${s}`;e.offset!==0&&wo.create(a).valid?(i=a,this.dt=e):(i="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,i=e.zone.name):(i="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);let o={...this.opts};o.timeZone=o.timeZone||i,this.dtf=hI(r,o)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){let e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(r=>{if(r.type==="timeZoneName"){let n=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...r,value:n}}else return r}):e}resolvedOptions(){return this.dtf.resolvedOptions()}},bI=class{constructor(e,r,n){this.opts={style:"long",...n},!r&&RT()&&(this.rtf=E6(e,n))}format(e,r){return this.rtf?this.rtf.format(e,r):Y6(r,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,r){return this.rtf?this.rtf.formatToParts(e,r):[]}},wT={firstDay:1,minimalDays:4,weekend:[6,7]},Ve=class t{static fromOpts(e){return t.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,r,n,i,o=!1){let s=e||We.defaultLocale,a=s||(o?"en-US":I6()),c=r||We.defaultNumberingSystem,u=n||We.defaultOutputCalendar,l=wI(i)||We.defaultWeekSettings;return new t(a,c,u,l,s)}static resetCache(){wl=null,fI.clear(),gI.clear(),mI.clear(),yI.clear(),EI.clear()}static fromObject({locale:e,numberingSystem:r,outputCalendar:n,weekSettings:i}={}){return t.create(e,r,n,i)}constructor(e,r,n,i,o){let[s,a,c]=b6(e);this.locale=s,this.numberingSystem=r||a||null,this.outputCalendar=n||c||null,this.weekSettings=i,this.intl=S6(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=o,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=Q6(this)),this.fastNumbersCached}listingMode(){let e=this.isEnglish(),r=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&r?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:t.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,wI(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,r=!1){return Sp(this,e,MT,()=>{let n=this.intl==="ja"||this.intl.startsWith("ja-");r&=!n;let i=r?{month:e,day:"numeric"}:{month:e},o=r?"format":"standalone";if(!this.monthsCache[o][e]){let s=n?a=>this.dtFormatter(a,i).format():a=>this.extract(a,i,"month");this.monthsCache[o][e]=w6(s)}return this.monthsCache[o][e]})}weekdays(e,r=!1){return Sp(this,e,PT,()=>{let n=r?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},i=r?"format":"standalone";return this.weekdaysCache[i][e]||(this.weekdaysCache[i][e]=B6(o=>this.extract(o,n,"weekday"))),this.weekdaysCache[i][e]})}meridiems(){return Sp(this,void 0,()=>FT,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[tt.utc(2016,11,13,9),tt.utc(2016,11,13,19)].map(r=>this.extract(r,e,"dayperiod"))}return this.meridiemCache})}eras(e){return Sp(this,e,$T,()=>{let r={era:e};return this.eraCache[e]||(this.eraCache[e]=[tt.utc(-40,1,1),tt.utc(2017,1,1)].map(n=>this.extract(n,r,"era"))),this.eraCache[e]})}extract(e,r,n){let i=this.dtFormatter(e,r),o=i.formatToParts(),s=o.find(a=>a.type.toLowerCase()===n);return s?s.value:null}numberFormatter(e={}){return new II(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,r={}){return new CI(e,this.intl,r)}relFormatter(e={}){return new bI(this.intl,this.isEnglish(),e)}listFormatter(e={}){return m6(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||ST(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:kT()?C6(this.locale):wT}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}},nI=null,kr=class t extends as{static get utcInstance(){return nI===null&&(nI=new t(0)),nI}static instance(e){return e===0?t.utcInstance:new t(e)}static parseSpecifier(e){if(e){let r=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(r)return new t(Pp(r[1],r[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${vl(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${vl(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,r){return vl(this.fixed,r)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}},kp=class extends as{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}};function is(t,e){if(he(t)||t===null)return e;if(t instanceof as)return t;if(k6(t)){let r=t.toLowerCase();return r==="default"?e:r==="local"||r==="system"?_l.instance:r==="utc"||r==="gmt"?kr.utcInstance:kr.parseSpecifier(r)||wo.create(t)}else return ss(t)?kr.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new kp(t)}var vI={arab:"[\u0660-\u0669]",arabext:"[\u06F0-\u06F9]",bali:"[\u1B50-\u1B59]",beng:"[\u09E6-\u09EF]",deva:"[\u0966-\u096F]",fullwide:"[\uFF10-\uFF19]",gujr:"[\u0AE6-\u0AEF]",hanidec:"[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]",khmr:"[\u17E0-\u17E9]",knda:"[\u0CE6-\u0CEF]",laoo:"[\u0ED0-\u0ED9]",limb:"[\u1946-\u194F]",mlym:"[\u0D66-\u0D6F]",mong:"[\u1810-\u1819]",mymr:"[\u1040-\u1049]",orya:"[\u0B66-\u0B6F]",tamldec:"[\u0BE6-\u0BEF]",telu:"[\u0C66-\u0C6F]",thai:"[\u0E50-\u0E59]",tibt:"[\u0F20-\u0F29]",latn:"\\d"},DD={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},v6=vI.hanidec.replace(/[\[|\]]/g,"").split("");function _6(t){let e=parseInt(t,10);if(isNaN(e)){e="";for(let r=0;r<t.length;r++){let n=t.charCodeAt(r);if(t[r].search(vI.hanidec)!==-1)e+=v6.indexOf(t[r]);else for(let i in DD){let[o,s]=DD[i];n>=o&&n<=s&&(e+=n-o)}}return parseInt(e,10)}else return e}var SI=new Map;function D6(){SI.clear()}function Nn({numberingSystem:t},e=""){let r=t||"latn",n=SI.get(r);n===void 0&&(n=new Map,SI.set(r,n));let i=n.get(e);return i===void 0&&(i=new RegExp(`${vI[r]}${e}`),n.set(e,i)),i}var TD=()=>Date.now(),RD="system",kD=null,ND=null,OD=null,UD=60,MD,xD=null,We=class{static get now(){return TD}static set now(e){TD=e}static set defaultZone(e){RD=e}static get defaultZone(){return is(RD,_l.instance)}static get defaultLocale(){return kD}static set defaultLocale(e){kD=e}static get defaultNumberingSystem(){return ND}static set defaultNumberingSystem(e){ND=e}static get defaultOutputCalendar(){return OD}static set defaultOutputCalendar(e){OD=e}static get defaultWeekSettings(){return xD}static set defaultWeekSettings(e){xD=wI(e)}static get twoDigitCutoffYear(){return UD}static set twoDigitCutoffYear(e){UD=e%100}static get throwOnInvalid(){return MD}static set throwOnInvalid(e){MD=e}static resetCaches(){Ve.resetCache(),wo.resetCache(),tt.resetCache(),D6()}},Tr=class{constructor(e,r){this.reason=e,this.explanation=r}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}},BT=[0,31,59,90,120,151,181,212,243,273,304,334],QT=[0,31,60,91,121,152,182,213,244,274,305,335];function tn(t,e){return new Tr("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function _I(t,e,r){let n=new Date(Date.UTC(t,e-1,r));t<100&&t>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);let i=n.getUTCDay();return i===0?7:i}function vT(t,e,r){return r+(Tl(t)?QT:BT)[e-1]}function _T(t,e){let r=Tl(t)?QT:BT,n=r.findIndex(o=>o<e),i=e-r[n];return{month:n+1,day:i}}function DI(t,e){return(t-e+7)%7+1}function Np(t,e=4,r=1){let{year:n,month:i,day:o}=t,s=vT(n,i,o),a=DI(_I(n,i,o),r),c=Math.floor((s-a+14-e)/7),u;return c<1?(u=n-1,c=Dl(u,e,r)):c>Dl(n,e,r)?(u=n+1,c=1):u=n,{weekYear:u,weekNumber:c,weekday:a,...Fp(t)}}function LD(t,e=4,r=1){let{weekYear:n,weekNumber:i,weekday:o}=t,s=DI(_I(n,1,e),r),a=vc(n),c=i*7+o-s-7+e,u;c<1?(u=n-1,c+=vc(u)):c>a?(u=n+1,c-=vc(n)):u=n;let{month:l,day:d}=_T(u,c);return{year:u,month:l,day:d,...Fp(t)}}function iI(t){let{year:e,month:r,day:n}=t,i=vT(e,r,n);return{year:e,ordinal:i,...Fp(t)}}function PD(t){let{year:e,ordinal:r}=t,{month:n,day:i}=_T(e,r);return{year:e,month:n,day:i,...Fp(t)}}function FD(t,e){if(!he(t.localWeekday)||!he(t.localWeekNumber)||!he(t.localWeekYear)){if(!he(t.weekday)||!he(t.weekNumber)||!he(t.weekYear))throw new os("Cannot mix locale-based week fields with ISO-based week fields");return he(t.localWeekday)||(t.weekday=t.localWeekday),he(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),he(t.localWeekYear)||(t.weekYear=t.localWeekYear),delete t.localWeekday,delete t.localWeekNumber,delete t.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function T6(t,e=4,r=1){let n=xp(t.weekYear),i=rn(t.weekNumber,1,Dl(t.weekYear,e,r)),o=rn(t.weekday,1,7);return n?i?o?!1:tn("weekday",t.weekday):tn("week",t.weekNumber):tn("weekYear",t.weekYear)}function R6(t){let e=xp(t.year),r=rn(t.ordinal,1,vc(t.year));return e?r?!1:tn("ordinal",t.ordinal):tn("year",t.year)}function DT(t){let e=xp(t.year),r=rn(t.month,1,12),n=rn(t.day,1,Op(t.year,t.month));return e?r?n?!1:tn("day",t.day):tn("month",t.month):tn("year",t.year)}function TT(t){let{hour:e,minute:r,second:n,millisecond:i}=t,o=rn(e,0,23)||e===24&&r===0&&n===0&&i===0,s=rn(r,0,59),a=rn(n,0,59),c=rn(i,0,999);return o?s?a?c?!1:tn("millisecond",i):tn("second",n):tn("minute",r):tn("hour",e)}function he(t){return typeof t>"u"}function ss(t){return typeof t=="number"}function xp(t){return typeof t=="number"&&t%1===0}function k6(t){return typeof t=="string"}function N6(t){return Object.prototype.toString.call(t)==="[object Date]"}function RT(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function kT(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function O6(t){return Array.isArray(t)?t:[t]}function $D(t,e,r){if(t.length!==0)return t.reduce((n,i)=>{let o=[e(i),i];return n&&r(n[0],o[0])===n[0]?n:o},null)[1]}function U6(t,e){return e.reduce((r,n)=>(r[n]=t[n],r),{})}function Dc(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function wI(t){if(t==null)return null;if(typeof t!="object")throw new Tt("Week settings must be an object");if(!rn(t.firstDay,1,7)||!rn(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(e=>!rn(e,1,7)))throw new Tt("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function rn(t,e,r){return xp(t)&&t>=e&&t<=r}function M6(t,e){return t-e*Math.floor(t/e)}function Et(t,e=2){let r=t<0,n;return r?n="-"+(""+-t).padStart(e,"0"):n=(""+t).padStart(e,"0"),n}function ns(t){if(!(he(t)||t===null||t===""))return parseInt(t,10)}function sa(t){if(!(he(t)||t===null||t===""))return parseFloat(t)}function TI(t){if(!(he(t)||t===null||t==="")){let e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function RI(t,e,r="round"){let n=10**e;switch(r){case"expand":return t>0?Math.ceil(t*n)/n:Math.floor(t*n)/n;case"trunc":return Math.trunc(t*n)/n;case"round":return Math.round(t*n)/n;case"floor":return Math.floor(t*n)/n;case"ceil":return Math.ceil(t*n)/n;default:throw new RangeError(`Value rounding ${r} is out of range`)}}function Tl(t){return t%4===0&&(t%100!==0||t%400===0)}function vc(t){return Tl(t)?366:365}function Op(t,e){let r=M6(e-1,12)+1,n=t+(e-r)/12;return r===2?Tl(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function Lp(t){let e=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond);return t.year<100&&t.year>=0&&(e=new Date(e),e.setUTCFullYear(t.year,t.month-1,t.day)),+e}function jD(t,e,r){return-DI(_I(t,1,e),r)+e-1}function Dl(t,e=4,r=1){let n=jD(t,e,r),i=jD(t+1,e,r);return(vc(t)-n+i)/7}function BI(t){return t>99?t:t>We.twoDigitCutoffYear?1900+t:2e3+t}function NT(t,e,r,n=null){let i=new Date(t),o={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(o.timeZone=n);let s={timeZoneName:e,...o},a=new Intl.DateTimeFormat(r,s).formatToParts(i).find(c=>c.type.toLowerCase()==="timezonename");return a?a.value:null}function Pp(t,e){let r=parseInt(t,10);Number.isNaN(r)&&(r=0);let n=parseInt(e,10)||0,i=r<0||Object.is(r,-0)?-n:n;return r*60+i}function OT(t){let e=Number(t);if(typeof t=="boolean"||t===""||!Number.isFinite(e))throw new Tt(`Invalid unit value ${t}`);return e}function Up(t,e){let r={};for(let n in t)if(Dc(t,n)){let i=t[n];if(i==null)continue;r[e(n)]=OT(i)}return r}function vl(t,e){let r=Math.trunc(Math.abs(t/60)),n=Math.trunc(Math.abs(t%60)),i=t>=0?"+":"-";switch(e){case"short":return`${i}${Et(r,2)}:${Et(n,2)}`;case"narrow":return`${i}${r}${n>0?`:${n}`:""}`;case"techie":return`${i}${Et(r,2)}${Et(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Fp(t){return U6(t,["hour","minute","second","millisecond"])}var x6=["January","February","March","April","May","June","July","August","September","October","November","December"],UT=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],L6=["J","F","M","A","M","J","J","A","S","O","N","D"];function MT(t){switch(t){case"narrow":return[...L6];case"short":return[...UT];case"long":return[...x6];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}var xT=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],LT=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],P6=["M","T","W","T","F","S","S"];function PT(t){switch(t){case"narrow":return[...P6];case"short":return[...LT];case"long":return[...xT];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var FT=["AM","PM"],F6=["Before Christ","Anno Domini"],$6=["BC","AD"],j6=["B","A"];function $T(t){switch(t){case"narrow":return[...j6];case"short":return[...$6];case"long":return[...F6];default:return null}}function q6(t){return FT[t.hour<12?0:1]}function z6(t,e){return PT(e)[t.weekday-1]}function H6(t,e){return MT(e)[t.month-1]}function G6(t,e){return $T(e)[t.year<0?0:1]}function Y6(t,e,r="always",n=!1){let i={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},o=["hours","minutes","seconds"].indexOf(t)===-1;if(r==="auto"&&o){let d=t==="days";switch(e){case 1:return d?"tomorrow":`next ${i[t][0]}`;case-1:return d?"yesterday":`last ${i[t][0]}`;case 0:return d?"today":`this ${i[t][0]}`}}let s=Object.is(e,-0)||e<0,a=Math.abs(e),c=a===1,u=i[t],l=n?c?u[1]:u[2]||u[1]:c?i[t][0]:t;return s?`${a} ${l} ago`:`in ${a} ${l}`}function qD(t,e){let r="";for(let n of t)n.literal?r+=n.val:r+=e(n.val);return r}var V6={D:Rp,DD:iT,DDD:oT,DDDD:sT,t:aT,tt:cT,ttt:uT,tttt:lT,T:dT,TT:AT,TTT:pT,TTTT:fT,f:hT,ff:mT,fff:ET,ffff:CT,F:gT,FF:yT,FFF:IT,FFFF:bT},Dr=class t{static create(e,r={}){return new t(e,r)}static parseFormat(e){let r=null,n="",i=!1,o=[];for(let s=0;s<e.length;s++){let a=e.charAt(s);a==="'"?((n.length>0||i)&&o.push({literal:i||/^\s+$/.test(n),val:n===""?"'":n}),r=null,n="",i=!i):i||a===r?n+=a:(n.length>0&&o.push({literal:/^\s+$/.test(n),val:n}),n=a,r=a)}return n.length>0&&o.push({literal:i||/^\s+$/.test(n),val:n}),o}static macroTokenToFormatOpts(e){return V6[e]}constructor(e,r){this.opts=r,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,r){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...r}).format()}dtFormatter(e,r={}){return this.loc.dtFormatter(e,{...this.opts,...r})}formatDateTime(e,r){return this.dtFormatter(e,r).format()}formatDateTimeParts(e,r){return this.dtFormatter(e,r).formatToParts()}formatInterval(e,r){return this.dtFormatter(e.start,r).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,r){return this.dtFormatter(e,r).resolvedOptions()}num(e,r=0,n=void 0){if(this.opts.forceSimple)return Et(e,r);let i={...this.opts};return r>0&&(i.padTo=r),n&&(i.signDisplay=n),this.loc.numberFormatter(i).format(e)}formatDateTimeFromString(e,r){let n=this.loc.listingMode()==="en",i=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",o=(p,h)=>this.loc.extract(e,p,h),s=p=>e.isOffsetFixed&&e.offset===0&&p.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,p.format):"",a=()=>n?q6(e):o({hour:"numeric",hourCycle:"h12"},"dayperiod"),c=(p,h)=>n?H6(e,p):o(h?{month:p}:{month:p,day:"numeric"},"month"),u=(p,h)=>n?z6(e,p):o(h?{weekday:p}:{weekday:p,month:"long",day:"numeric"},"weekday"),l=p=>{let h=t.macroTokenToFormatOpts(p);return h?this.formatWithSystemDefault(e,h):p},d=p=>n?G6(e,p):o({era:p},"era"),A=p=>{switch(p){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return s({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return s({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return s({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return a();case"d":return i?o({day:"numeric"},"day"):this.num(e.day);case"dd":return i?o({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return u("short",!0);case"cccc":return u("long",!0);case"ccccc":return u("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return u("short",!1);case"EEEE":return u("long",!1);case"EEEEE":return u("narrow",!1);case"L":return i?o({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return i?o({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return c("short",!0);case"LLLL":return c("long",!0);case"LLLLL":return c("narrow",!0);case"M":return i?o({month:"numeric"},"month"):this.num(e.month);case"MM":return i?o({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return c("short",!1);case"MMMM":return c("long",!1);case"MMMMM":return c("narrow",!1);case"y":return i?o({year:"numeric"},"year"):this.num(e.year);case"yy":return i?o({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return i?o({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return i?o({year:"numeric"},"year"):this.num(e.year,6);case"G":return d("short");case"GG":return d("long");case"GGGGG":return d("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return l(p)}};return qD(t.parseFormat(r),A)}formatDurationFromString(e,r){let n=this.opts.signMode==="negativeLargestOnly"?-1:1,i=l=>{switch(l[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},o=(l,d)=>A=>{let p=i(A);if(p){let h=d.isNegativeDuration&&p!==d.largestUnit?n:1,g;return this.opts.signMode==="negativeLargestOnly"&&p!==d.largestUnit?g="never":this.opts.signMode==="all"?g="always":g="auto",this.num(l.get(p)*h,A.length,g)}else return A},s=t.parseFormat(r),a=s.reduce((l,{literal:d,val:A})=>d?l:l.concat(A),[]),c=e.shiftTo(...a.map(i).filter(l=>l)),u={isNegativeDuration:c<0,largestUnit:Object.keys(c.values)[0]};return qD(s,o(c,u))}},jT=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Tc(...t){let e=t.reduce((r,n)=>r+n.source,"");return RegExp(`^${e}$`)}function Rc(...t){return e=>t.reduce(([r,n,i],o)=>{let[s,a,c]=o(e,i);return[{...r,...s},a||n,c]},[{},null,1]).slice(0,2)}function kc(t,...e){if(t==null)return[null,null];for(let[r,n]of e){let i=r.exec(t);if(i)return n(i)}return[null,null]}function qT(...t){return(e,r)=>{let n={},i;for(i=0;i<t.length;i++)n[t[i]]=ns(e[r+i]);return[n,null,r+i]}}var zT=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,J6=`(?:${zT.source}?(?:\\[(${jT.source})\\])?)?`,kI=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,HT=RegExp(`${kI.source}${J6}`),NI=RegExp(`(?:[Tt]${HT.source})?`),W6=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Z6=/(\d{4})-?W(\d\d)(?:-?(\d))?/,K6=/(\d{4})-?(\d{3})/,X6=qT("weekYear","weekNumber","weekDay"),eK=qT("year","ordinal"),tK=/(\d{4})-(\d\d)-(\d\d)/,GT=RegExp(`${kI.source} ?(?:${zT.source}|(${jT.source}))?`),rK=RegExp(`(?: ${GT.source})?`);function _c(t,e,r){let n=t[e];return he(n)?r:ns(n)}function nK(t,e){return[{year:_c(t,e),month:_c(t,e+1,1),day:_c(t,e+2,1)},null,e+3]}function Nc(t,e){return[{hours:_c(t,e,0),minutes:_c(t,e+1,0),seconds:_c(t,e+2,0),milliseconds:TI(t[e+3])},null,e+4]}function Rl(t,e){let r=!t[e]&&!t[e+1],n=Pp(t[e+1],t[e+2]),i=r?null:kr.instance(n);return[{},i,e+3]}function kl(t,e){let r=t[e]?wo.create(t[e]):null;return[{},r,e+1]}var iK=RegExp(`^T?${kI.source}$`),oK=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function sK(t){let[e,r,n,i,o,s,a,c,u]=t,l=e[0]==="-",d=c&&c[0]==="-",A=(p,h=!1)=>p!==void 0&&(h||p&&l)?-p:p;return[{years:A(sa(r)),months:A(sa(n)),weeks:A(sa(i)),days:A(sa(o)),hours:A(sa(s)),minutes:A(sa(a)),seconds:A(sa(c),c==="-0"),milliseconds:A(TI(u),d)}]}var aK={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function OI(t,e,r,n,i,o,s){let a={year:e.length===2?BI(ns(e)):ns(e),month:UT.indexOf(r)+1,day:ns(n),hour:ns(i),minute:ns(o)};return s&&(a.second=ns(s)),t&&(a.weekday=t.length>3?xT.indexOf(t)+1:LT.indexOf(t)+1),a}var cK=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function uK(t){let[,e,r,n,i,o,s,a,c,u,l,d]=t,A=OI(e,i,n,r,o,s,a),p;return c?p=aK[c]:u?p=0:p=Pp(l,d),[A,new kr(p)]}function lK(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var dK=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,AK=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,pK=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function zD(t){let[,e,r,n,i,o,s,a]=t;return[OI(e,i,n,r,o,s,a),kr.utcInstance]}function fK(t){let[,e,r,n,i,o,s,a]=t;return[OI(e,a,r,n,i,o,s),kr.utcInstance]}var hK=Tc(W6,NI),gK=Tc(Z6,NI),mK=Tc(K6,NI),yK=Tc(HT),YT=Rc(nK,Nc,Rl,kl),EK=Rc(X6,Nc,Rl,kl),IK=Rc(eK,Nc,Rl,kl),CK=Rc(Nc,Rl,kl);function bK(t){return kc(t,[hK,YT],[gK,EK],[mK,IK],[yK,CK])}function SK(t){return kc(lK(t),[cK,uK])}function wK(t){return kc(t,[dK,zD],[AK,zD],[pK,fK])}function BK(t){return kc(t,[oK,sK])}var QK=Rc(Nc);function vK(t){return kc(t,[iK,QK])}var _K=Tc(tK,rK),DK=Tc(GT),TK=Rc(Nc,Rl,kl);function RK(t){return kc(t,[_K,YT],[DK,TK])}var HD="Invalid Duration",VT={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},kK={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...VT},en=146097/400,wc=146097/4800,NK={years:{quarters:4,months:12,weeks:en/7,days:en,hours:en*24,minutes:en*24*60,seconds:en*24*60*60,milliseconds:en*24*60*60*1e3},quarters:{months:3,weeks:en/28,days:en/4,hours:en*24/4,minutes:en*24*60/4,seconds:en*24*60*60/4,milliseconds:en*24*60*60*1e3/4},months:{weeks:wc/7,days:wc,hours:wc*24,minutes:wc*24*60,seconds:wc*24*60*60,milliseconds:wc*24*60*60*1e3},...VT},ca=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],OK=ca.slice(0).reverse();function bo(t,e,r=!1){let n={values:r?e.values:{...t.values,...e.values||{}},loc:t.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||t.conversionAccuracy,matrix:e.matrix||t.matrix};return new Bt(n)}function JT(t,e){var r;let n=(r=e.milliseconds)!=null?r:0;for(let i of OK.slice(1))e[i]&&(n+=e[i]*t[i].milliseconds);return n}function GD(t,e){let r=JT(t,e)<0?-1:1;ca.reduceRight((n,i)=>{if(he(e[i]))return n;if(n){let o=e[n]*r,s=t[i][n],a=Math.floor(o/s);e[i]+=a*r,e[n]-=a*s*r}return i},null),ca.reduce((n,i)=>{if(he(e[i]))return n;if(n){let o=e[n]%1;e[n]-=o,e[i]+=o*t[n][i]}return i},null)}function YD(t){let e={};for(let[r,n]of Object.entries(t))n!==0&&(e[r]=n);return e}var Bt=class t{constructor(e){let r=e.conversionAccuracy==="longterm"||!1,n=r?NK:kK;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||Ve.create(),this.conversionAccuracy=r?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,r){return t.fromObject({milliseconds:e},r)}static fromObject(e,r={}){if(e==null||typeof e!="object")throw new Tt(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new t({values:Up(e,t.normalizeUnit),loc:Ve.fromObject(r),conversionAccuracy:r.conversionAccuracy,matrix:r.matrix})}static fromDurationLike(e){if(ss(e))return t.fromMillis(e);if(t.isDuration(e))return e;if(typeof e=="object")return t.fromObject(e);throw new Tt(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,r){let[n]=BK(e);return n?t.fromObject(n,r):t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,r){let[n]=vK(e);return n?t.fromObject(n,r):t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,r=null){if(!e)throw new Tt("need to specify a reason the Duration is invalid");let n=e instanceof Tr?e:new Tr(e,r);if(We.throwOnInvalid)throw new AI(n);return new t({invalid:n})}static normalizeUnit(e){let r={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!r)throw new Tp(e);return r}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,r={}){let n={...r,floor:r.round!==!1&&r.floor!==!1};return this.isValid?Dr.create(this.loc,n).formatDurationFromString(this,e):HD}toHuman(e={}){if(!this.isValid)return HD;let r=e.showZeros!==!1,n=ca.map(i=>{let o=this.values[i];return he(o)||o===0&&!r?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:i.slice(0,-1)}).format(o)}).filter(i=>i);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(n)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=RI(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;let r=this.toMillis();return r<0||r>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},tt.fromMillis(r,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?JT(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;let r=t.fromDurationLike(e),n={};for(let i of ca)(Dc(r.values,i)||Dc(this.values,i))&&(n[i]=r.get(i)+this.get(i));return bo(this,{values:n},!0)}minus(e){if(!this.isValid)return this;let r=t.fromDurationLike(e);return this.plus(r.negate())}mapUnits(e){if(!this.isValid)return this;let r={};for(let n of Object.keys(this.values))r[n]=OT(e(this.values[n],n));return bo(this,{values:r},!0)}get(e){return this[t.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let r={...this.values,...Up(e,t.normalizeUnit)};return bo(this,{values:r})}reconfigure({locale:e,numberingSystem:r,conversionAccuracy:n,matrix:i}={}){let s={loc:this.loc.clone({locale:e,numberingSystem:r}),matrix:i,conversionAccuracy:n};return bo(this,s)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return GD(this.matrix,e),bo(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=YD(this.normalize().shiftToAll().toObject());return bo(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(s=>t.normalizeUnit(s));let r={},n={},i=this.toObject(),o;for(let s of ca)if(e.indexOf(s)>=0){o=s;let a=0;for(let u in n)a+=this.matrix[u][s]*n[u],n[u]=0;ss(i[s])&&(a+=i[s]);let c=Math.trunc(a);r[s]=c,n[s]=(a*1e3-c*1e3)/1e3}else ss(i[s])&&(n[s]=i[s]);for(let s in n)n[s]!==0&&(r[o]+=s===o?n[s]:n[s]/this.matrix[o][s]);return GD(this.matrix,r),bo(this,{values:r},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;let e={};for(let r of Object.keys(this.values))e[r]=this.values[r]===0?0:-this.values[r];return bo(this,{values:e},!0)}removeZeros(){if(!this.isValid)return this;let e=YD(this.values);return bo(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function r(n,i){return n===void 0||n===0?i===void 0||i===0:n===i}for(let n of ca)if(!r(this.values[n],e.values[n]))return!1;return!0}},Bc="Invalid Interval";function UK(t,e){return!t||!t.isValid?la.invalid("missing or invalid start"):!e||!e.isValid?la.invalid("missing or invalid end"):e<t?la.invalid("end before start",`The end of an interval must be after its start, but you had start=${t.toISO()} and end=${e.toISO()}`):null}var la=class t{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,r=null){if(!e)throw new Tt("need to specify a reason the Interval is invalid");let n=e instanceof Tr?e:new Tr(e,r);if(We.throwOnInvalid)throw new dI(n);return new t({invalid:n})}static fromDateTimes(e,r){let n=Sl(e),i=Sl(r),o=UK(n,i);return o??new t({start:n,end:i})}static after(e,r){let n=Bt.fromDurationLike(r),i=Sl(e);return t.fromDateTimes(i,i.plus(n))}static before(e,r){let n=Bt.fromDurationLike(r),i=Sl(e);return t.fromDateTimes(i.minus(n),i)}static fromISO(e,r){let[n,i]=(e||"").split("/",2);if(n&&i){let o,s;try{o=tt.fromISO(n,r),s=o.isValid}catch{s=!1}let a,c;try{a=tt.fromISO(i,r),c=a.isValid}catch{c=!1}if(s&&c)return t.fromDateTimes(o,a);if(s){let u=Bt.fromISO(i,r);if(u.isValid)return t.after(o,u)}else if(c){let u=Bt.fromISO(n,r);if(u.isValid)return t.before(a,u)}}return t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",r){if(!this.isValid)return NaN;let n=this.start.startOf(e,r),i;return r!=null&&r.useLocaleWeeks?i=this.end.reconfigure({locale:n.locale}):i=this.end,i=i.startOf(e,r),Math.floor(i.diff(n,e).get(e))+(i.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:r}={}){return this.isValid?t.fromDateTimes(e||this.s,r||this.e):this}splitAt(...e){if(!this.isValid)return[];let r=e.map(Sl).filter(s=>this.contains(s)).sort((s,a)=>s.toMillis()-a.toMillis()),n=[],{s:i}=this,o=0;for(;i<this.e;){let s=r[o]||this.e,a=+s>+this.e?this.e:s;n.push(t.fromDateTimes(i,a)),i=a,o+=1}return n}splitBy(e){let r=Bt.fromDurationLike(e);if(!this.isValid||!r.isValid||r.as("milliseconds")===0)return[];let{s:n}=this,i=1,o,s=[];for(;n<this.e;){let a=this.start.plus(r.mapUnits(c=>c*i));o=+a>+this.e?this.e:a,s.push(t.fromDateTimes(n,o)),n=o,i+=1}return s}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;let r=this.s>e.s?this.s:e.s,n=this.e<e.e?this.e:e.e;return r>=n?null:t.fromDateTimes(r,n)}union(e){if(!this.isValid)return this;let r=this.s<e.s?this.s:e.s,n=this.e>e.e?this.e:e.e;return t.fromDateTimes(r,n)}static merge(e){let[r,n]=e.sort((i,o)=>i.s-o.s).reduce(([i,o],s)=>o?o.overlaps(s)||o.abutsStart(s)?[i,o.union(s)]:[i.concat([o]),s]:[i,s],[[],null]);return n&&r.push(n),r}static xor(e){let r=null,n=0,i=[],o=e.map(c=>[{time:c.s,type:"s"},{time:c.e,type:"e"}]),s=Array.prototype.concat(...o),a=s.sort((c,u)=>c.time-u.time);for(let c of a)n+=c.type==="s"?1:-1,n===1?r=c.time:(r&&+r!=+c.time&&i.push(t.fromDateTimes(r,c.time)),r=null);return t.merge(i)}difference(...e){return t.xor([this].concat(e)).map(r=>this.intersection(r)).filter(r=>r&&!r.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:Bc}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=Rp,r={}){return this.isValid?Dr.create(this.s.loc.clone(r),e).formatInterval(this):Bc}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Bc}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Bc}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Bc}toFormat(e,{separator:r=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${r}${this.e.toFormat(e)}`:Bc}toDuration(e,r){return this.isValid?this.e.diff(this.s,e,r):Bt.invalid(this.invalidReason)}mapEndpoints(e){return t.fromDateTimes(e(this.s),e(this.e))}},ua=class{static hasDST(e=We.defaultZone){let r=tt.now().setZone(e).set({month:12});return!e.isUniversal&&r.offset!==r.set({month:6}).offset}static isValidIANAZone(e){return wo.isValidZone(e)}static normalizeZone(e){return is(e,We.defaultZone)}static getStartOfWeek({locale:e=null,locObj:r=null}={}){return(r||Ve.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:r=null}={}){return(r||Ve.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:r=null}={}){return(r||Ve.create(e)).getWeekendDays().slice()}static months(e="long",{locale:r=null,numberingSystem:n=null,locObj:i=null,outputCalendar:o="gregory"}={}){return(i||Ve.create(r,n,o)).months(e)}static monthsFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:i=null,outputCalendar:o="gregory"}={}){return(i||Ve.create(r,n,o)).months(e,!0)}static weekdays(e="long",{locale:r=null,numberingSystem:n=null,locObj:i=null}={}){return(i||Ve.create(r,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:i=null}={}){return(i||Ve.create(r,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Ve.create(e).meridiems()}static eras(e="short",{locale:r=null}={}){return Ve.create(r,null,"gregory").eras(e)}static features(){return{relative:RT(),localeWeek:kT()}}};function VD(t,e){let r=i=>i.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=r(e)-r(t);return Math.floor(Bt.fromMillis(n).as("days"))}function MK(t,e,r){let n=[["years",(c,u)=>u.year-c.year],["quarters",(c,u)=>u.quarter-c.quarter+(u.year-c.year)*4],["months",(c,u)=>u.month-c.month+(u.year-c.year)*12],["weeks",(c,u)=>{let l=VD(c,u);return(l-l%7)/7}],["days",VD]],i={},o=t,s,a;for(let[c,u]of n)r.indexOf(c)>=0&&(s=c,i[c]=u(t,e),a=o.plus(i),a>e?(i[c]--,t=o.plus(i),t>e&&(a=t,i[c]--,t=o.plus(i))):t=a);return[t,i,a,s]}function xK(t,e,r,n){let[i,o,s,a]=MK(t,e,r),c=e-i,u=r.filter(d=>["hours","minutes","seconds","milliseconds"].indexOf(d)>=0);u.length===0&&(s<e&&(s=i.plus({[a]:1})),s!==i&&(o[a]=(o[a]||0)+c/(s-i)));let l=Bt.fromObject(o,n);return u.length>0?Bt.fromMillis(c,n).shiftTo(...u).plus(l):l}var LK="missing Intl.DateTimeFormat.formatToParts support";function Ue(t,e=r=>r){return{regex:t,deser:([r])=>e(_6(r))}}var PK="\xA0",WT=`[ ${PK}]`,ZT=new RegExp(WT,"g");function FK(t){return t.replace(/\./g,"\\.?").replace(ZT,WT)}function JD(t){return t.replace(/\./g,"").replace(ZT," ").toLowerCase()}function On(t,e){return t===null?null:{regex:RegExp(t.map(FK).join("|")),deser:([r])=>t.findIndex(n=>JD(r)===JD(n))+e}}function WD(t,e){return{regex:t,deser:([,r,n])=>Pp(r,n),groups:e}}function wp(t){return{regex:t,deser:([e])=>e}}function $K(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function jK(t,e){let r=Nn(e),n=Nn(e,"{2}"),i=Nn(e,"{3}"),o=Nn(e,"{4}"),s=Nn(e,"{6}"),a=Nn(e,"{1,2}"),c=Nn(e,"{1,3}"),u=Nn(e,"{1,6}"),l=Nn(e,"{1,9}"),d=Nn(e,"{2,4}"),A=Nn(e,"{4,6}"),p=S=>({regex:RegExp($K(S.val)),deser:([B])=>B,literal:!0}),g=(S=>{if(t.literal)return p(S);switch(S.val){case"G":return On(e.eras("short"),0);case"GG":return On(e.eras("long"),0);case"y":return Ue(u);case"yy":return Ue(d,BI);case"yyyy":return Ue(o);case"yyyyy":return Ue(A);case"yyyyyy":return Ue(s);case"M":return Ue(a);case"MM":return Ue(n);case"MMM":return On(e.months("short",!0),1);case"MMMM":return On(e.months("long",!0),1);case"L":return Ue(a);case"LL":return Ue(n);case"LLL":return On(e.months("short",!1),1);case"LLLL":return On(e.months("long",!1),1);case"d":return Ue(a);case"dd":return Ue(n);case"o":return Ue(c);case"ooo":return Ue(i);case"HH":return Ue(n);case"H":return Ue(a);case"hh":return Ue(n);case"h":return Ue(a);case"mm":return Ue(n);case"m":return Ue(a);case"q":return Ue(a);case"qq":return Ue(n);case"s":return Ue(a);case"ss":return Ue(n);case"S":return Ue(c);case"SSS":return Ue(i);case"u":return wp(l);case"uu":return wp(a);case"uuu":return Ue(r);case"a":return On(e.meridiems(),0);case"kkkk":return Ue(o);case"kk":return Ue(d,BI);case"W":return Ue(a);case"WW":return Ue(n);case"E":case"c":return Ue(r);case"EEE":return On(e.weekdays("short",!1),1);case"EEEE":return On(e.weekdays("long",!1),1);case"ccc":return On(e.weekdays("short",!0),1);case"cccc":return On(e.weekdays("long",!0),1);case"Z":case"ZZ":return WD(new RegExp(`([+-]${a.source})(?::(${n.source}))?`),2);case"ZZZ":return WD(new RegExp(`([+-]${a.source})(${n.source})?`),2);case"z":return wp(/[a-z_+-/]{1,256}?/i);case" ":return wp(/[^\S\n\r]/);default:return p(S)}})(t)||{invalidReason:LK};return g.token=t,g}var qK={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function zK(t,e,r){let{type:n,value:i}=t;if(n==="literal"){let c=/^\s+$/.test(i);return{literal:!c,val:c?" ":i}}let o=e[n],s=n;n==="hour"&&(e.hour12!=null?s=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?s="hour12":s="hour24":s=r.hour12?"hour12":"hour24");let a=qK[s];if(typeof a=="object"&&(a=a[o]),a)return{literal:!1,val:a}}function HK(t){return[`^${t.map(r=>r.regex).reduce((r,n)=>`${r}(${n.source})`,"")}$`,t]}function GK(t,e,r){let n=t.match(e);if(n){let i={},o=1;for(let s in r)if(Dc(r,s)){let a=r[s],c=a.groups?a.groups+1:1;!a.literal&&a.token&&(i[a.token.val[0]]=a.deser(n.slice(o,o+c))),o+=c}return[n,i]}else return[n,{}]}function YK(t){let e=o=>{switch(o){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}},r=null,n;return he(t.z)||(r=wo.create(t.z)),he(t.Z)||(r||(r=new kr(t.Z)),n=t.Z),he(t.q)||(t.M=(t.q-1)*3+1),he(t.h)||(t.h<12&&t.a===1?t.h+=12:t.h===12&&t.a===0&&(t.h=0)),t.G===0&&t.y&&(t.y=-t.y),he(t.u)||(t.S=TI(t.u)),[Object.keys(t).reduce((o,s)=>{let a=e(s);return a&&(o[a]=t[s]),o},{}),r,n]}var oI=null;function VK(){return oI||(oI=tt.fromMillis(1555555555555)),oI}function JK(t,e){if(t.literal)return t;let r=Dr.macroTokenToFormatOpts(t.val),n=eR(r,e);return n==null||n.includes(void 0)?t:n}function KT(t,e){return Array.prototype.concat(...t.map(r=>JK(r,e)))}var Mp=class{constructor(e,r){if(this.locale=e,this.format=r,this.tokens=KT(Dr.parseFormat(r),e),this.units=this.tokens.map(n=>jK(n,e)),this.disqualifyingUnit=this.units.find(n=>n.invalidReason),!this.disqualifyingUnit){let[n,i]=HK(this.units);this.regex=RegExp(n,"i"),this.handlers=i}}explainFromTokens(e){if(this.isValid){let[r,n]=GK(e,this.regex,this.handlers),[i,o,s]=n?YK(n):[null,null,void 0];if(Dc(n,"a")&&Dc(n,"H"))throw new os("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:r,matches:n,result:i,zone:o,specificOffset:s}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}};function XT(t,e,r){return new Mp(t,r).explainFromTokens(e)}function WK(t,e,r){let{result:n,zone:i,specificOffset:o,invalidReason:s}=XT(t,e,r);return[n,i,o,s]}function eR(t,e){if(!t)return null;let n=Dr.create(e,t).dtFormatter(VK()),i=n.formatToParts(),o=n.resolvedOptions();return i.map(s=>zK(s,t,o))}var sI="Invalid DateTime",ZD=864e13;function Bl(t){return new Tr("unsupported zone",`the zone "${t.name}" is not supported`)}function aI(t){return t.weekData===null&&(t.weekData=Np(t.c)),t.weekData}function cI(t){return t.localWeekData===null&&(t.localWeekData=Np(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function aa(t,e){let r={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new tt({...r,...e,old:r})}function tR(t,e,r){let n=t-e*60*1e3,i=r.offset(n);if(e===i)return[n,e];n-=(i-e)*60*1e3;let o=r.offset(n);return i===o?[n,i]:[t-Math.min(i,o)*60*1e3,Math.max(i,o)]}function Bp(t,e){t+=e*60*1e3;let r=new Date(t);return{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),second:r.getUTCSeconds(),millisecond:r.getUTCMilliseconds()}}function vp(t,e,r){return tR(Lp(t),e,r)}function KD(t,e){let r=t.o,n=t.c.year+Math.trunc(e.years),i=t.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,o={...t.c,year:n,month:i,day:Math.min(t.c.day,Op(n,i))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},s=Bt.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),a=Lp(o),[c,u]=tR(a,r,t.zone);return s!==0&&(c+=s,u=t.zone.offset(c)),{ts:c,o:u}}function Qc(t,e,r,n,i,o){let{setZone:s,zone:a}=r;if(t&&Object.keys(t).length!==0||e){let c=e||a,u=tt.fromObject(t,{...r,zone:c,specificOffset:o});return s?u:u.setZone(a)}else return tt.invalid(new Tr("unparsable",`the input "${i}" can't be parsed as ${n}`))}function Qp(t,e,r=!0){return t.isValid?Dr.create(Ve.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(t,e):null}function uI(t,e,r){let n=t.c.year>9999||t.c.year<0,i="";if(n&&t.c.year>=0&&(i+="+"),i+=Et(t.c.year,n?6:4),r==="year")return i;if(e){if(i+="-",i+=Et(t.c.month),r==="month")return i;i+="-"}else if(i+=Et(t.c.month),r==="month")return i;return i+=Et(t.c.day),i}function XD(t,e,r,n,i,o,s){let a=!r||t.c.millisecond!==0||t.c.second!==0,c="";switch(s){case"day":case"month":case"year":break;default:if(c+=Et(t.c.hour),s==="hour")break;if(e){if(c+=":",c+=Et(t.c.minute),s==="minute")break;a&&(c+=":",c+=Et(t.c.second))}else{if(c+=Et(t.c.minute),s==="minute")break;a&&(c+=Et(t.c.second))}if(s==="second")break;a&&(!n||t.c.millisecond!==0)&&(c+=".",c+=Et(t.c.millisecond,3))}return i&&(t.isOffsetFixed&&t.offset===0&&!o?c+="Z":t.o<0?(c+="-",c+=Et(Math.trunc(-t.o/60)),c+=":",c+=Et(Math.trunc(-t.o%60))):(c+="+",c+=Et(Math.trunc(t.o/60)),c+=":",c+=Et(Math.trunc(t.o%60)))),o&&(c+="["+t.zone.ianaName+"]"),c}var rR={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},ZK={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},KK={ordinal:1,hour:0,minute:0,second:0,millisecond:0},_p=["year","month","day","hour","minute","second","millisecond"],XK=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],e3=["year","ordinal","hour","minute","second","millisecond"];function Dp(t){let e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[t.toLowerCase()];if(!e)throw new Tp(t);return e}function eT(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Dp(t)}}function t3(t){if(Ql===void 0&&(Ql=We.now()),t.type!=="iana")return t.offset(Ql);let e=t.name,r=QI.get(e);return r===void 0&&(r=t.offset(Ql),QI.set(e,r)),r}function tT(t,e){let r=is(e.zone,We.defaultZone);if(!r.isValid)return tt.invalid(Bl(r));let n=Ve.fromObject(e),i,o;if(he(t.year))i=We.now();else{for(let c of _p)he(t[c])&&(t[c]=rR[c]);let s=DT(t)||TT(t);if(s)return tt.invalid(s);let a=t3(r);[i,o]=vp(t,a,r)}return new tt({ts:i,zone:r,loc:n,o})}function rT(t,e,r){let n=he(r.round)?!0:r.round,i=he(r.rounding)?"trunc":r.rounding,o=(a,c)=>(a=RI(a,n||r.calendary?0:2,r.calendary?"round":i),e.loc.clone(r).relFormatter(r).format(a,c)),s=a=>r.calendary?e.hasSame(t,a)?0:e.startOf(a).diff(t.startOf(a),a).get(a):e.diff(t,a).get(a);if(r.unit)return o(s(r.unit),r.unit);for(let a of r.units){let c=s(a);if(Math.abs(c)>=1)return o(c,a)}return o(t>e?-0:0,r.units[r.units.length-1])}function nT(t){let e={},r;return t.length>0&&typeof t[t.length-1]=="object"?(e=t[t.length-1],r=Array.from(t).slice(0,t.length-1)):r=Array.from(t),[e,r]}var Ql,QI=new Map,tt=class t{constructor(e){let r=e.zone||We.defaultZone,n=e.invalid||(Number.isNaN(e.ts)?new Tr("invalid input"):null)||(r.isValid?null:Bl(r));this.ts=he(e.ts)?We.now():e.ts;let i=null,o=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(r))[i,o]=[e.old.c,e.old.o];else{let a=ss(e.o)&&!e.old?e.o:r.offset(this.ts);i=Bp(this.ts,a),n=Number.isNaN(i.year)?new Tr("invalid input"):null,i=n?null:i,o=n?null:a}this._zone=r,this.loc=e.loc||Ve.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=i,this.o=o,this.isLuxonDateTime=!0}static now(){return new t({})}static local(){let[e,r]=nT(arguments),[n,i,o,s,a,c,u]=r;return tT({year:n,month:i,day:o,hour:s,minute:a,second:c,millisecond:u},e)}static utc(){let[e,r]=nT(arguments),[n,i,o,s,a,c,u]=r;return e.zone=kr.utcInstance,tT({year:n,month:i,day:o,hour:s,minute:a,second:c,millisecond:u},e)}static fromJSDate(e,r={}){let n=N6(e)?e.valueOf():NaN;if(Number.isNaN(n))return t.invalid("invalid input");let i=is(r.zone,We.defaultZone);return i.isValid?new t({ts:n,zone:i,loc:Ve.fromObject(r)}):t.invalid(Bl(i))}static fromMillis(e,r={}){if(ss(e))return e<-ZD||e>ZD?t.invalid("Timestamp out of range"):new t({ts:e,zone:is(r.zone,We.defaultZone),loc:Ve.fromObject(r)});throw new Tt(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,r={}){if(ss(e))return new t({ts:e*1e3,zone:is(r.zone,We.defaultZone),loc:Ve.fromObject(r)});throw new Tt("fromSeconds requires a numerical input")}static fromObject(e,r={}){e=e||{};let n=is(r.zone,We.defaultZone);if(!n.isValid)return t.invalid(Bl(n));let i=Ve.fromObject(r),o=Up(e,eT),{minDaysInFirstWeek:s,startOfWeek:a}=FD(o,i),c=We.now(),u=he(r.specificOffset)?n.offset(c):r.specificOffset,l=!he(o.ordinal),d=!he(o.year),A=!he(o.month)||!he(o.day),p=d||A,h=o.weekYear||o.weekNumber;if((p||l)&&h)throw new os("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(A&&l)throw new os("Can't mix ordinal dates with month/day");let g=h||o.weekday&&!p,S,B,v=Bp(c,u);g?(S=XK,B=ZK,v=Np(v,s,a)):l?(S=e3,B=KK,v=iI(v)):(S=_p,B=rR);let Q=!1;for(let me of S){let Ae=o[me];he(Ae)?Q?o[me]=B[me]:o[me]=v[me]:Q=!0}let k=g?T6(o,s,a):l?R6(o):DT(o),M=k||TT(o);if(M)return t.invalid(M);let Y=g?LD(o,s,a):l?PD(o):o,[_e,Z]=vp(Y,u,n),$=new t({ts:_e,zone:n,o:Z,loc:i});return o.weekday&&p&&e.weekday!==$.weekday?t.invalid("mismatched weekday",`you can't specify both a weekday of ${o.weekday} and a date of ${$.toISO()}`):$.isValid?$:t.invalid($.invalid)}static fromISO(e,r={}){let[n,i]=bK(e);return Qc(n,i,r,"ISO 8601",e)}static fromRFC2822(e,r={}){let[n,i]=SK(e);return Qc(n,i,r,"RFC 2822",e)}static fromHTTP(e,r={}){let[n,i]=wK(e);return Qc(n,i,r,"HTTP",r)}static fromFormat(e,r,n={}){if(he(e)||he(r))throw new Tt("fromFormat requires an input string and a format");let{locale:i=null,numberingSystem:o=null}=n,s=Ve.fromOpts({locale:i,numberingSystem:o,defaultToEN:!0}),[a,c,u,l]=WK(s,e,r);return l?t.invalid(l):Qc(a,c,n,`format ${r}`,e,u)}static fromString(e,r,n={}){return t.fromFormat(e,r,n)}static fromSQL(e,r={}){let[n,i]=RK(e);return Qc(n,i,r,"SQL",e)}static invalid(e,r=null){if(!e)throw new Tt("need to specify a reason the DateTime is invalid");let n=e instanceof Tr?e:new Tr(e,r);if(We.throwOnInvalid)throw new lI(n);return new t({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,r={}){let n=eR(e,Ve.fromObject(r));return n?n.map(i=>i?i.val:null).join(""):null}static expandFormat(e,r={}){return KT(Dr.parseFormat(e),Ve.fromObject(r)).map(i=>i.val).join("")}static resetCache(){Ql=void 0,QI.clear()}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?aI(this).weekYear:NaN}get weekNumber(){return this.isValid?aI(this).weekNumber:NaN}get weekday(){return this.isValid?aI(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?cI(this).weekday:NaN}get localWeekNumber(){return this.isValid?cI(this).weekNumber:NaN}get localWeekYear(){return this.isValid?cI(this).weekYear:NaN}get ordinal(){return this.isValid?iI(this.c).ordinal:NaN}get monthShort(){return this.isValid?ua.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?ua.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?ua.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?ua.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];let e=864e5,r=6e4,n=Lp(this.c),i=this.zone.offset(n-e),o=this.zone.offset(n+e),s=this.zone.offset(n-i*r),a=this.zone.offset(n-o*r);if(s===a)return[this];let c=n-s*r,u=n-a*r,l=Bp(c,s),d=Bp(u,a);return l.hour===d.hour&&l.minute===d.minute&&l.second===d.second&&l.millisecond===d.millisecond?[aa(this,{ts:c}),aa(this,{ts:u})]:[this]}get isInLeapYear(){return Tl(this.year)}get daysInMonth(){return Op(this.year,this.month)}get daysInYear(){return this.isValid?vc(this.year):NaN}get weeksInWeekYear(){return this.isValid?Dl(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Dl(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:r,numberingSystem:n,calendar:i}=Dr.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:r,numberingSystem:n,outputCalendar:i}}toUTC(e=0,r={}){return this.setZone(kr.instance(e),r)}toLocal(){return this.setZone(We.defaultZone)}setZone(e,{keepLocalTime:r=!1,keepCalendarTime:n=!1}={}){if(e=is(e,We.defaultZone),e.equals(this.zone))return this;if(e.isValid){let i=this.ts;if(r||n){let o=e.offset(this.ts),s=this.toObject();[i]=vp(s,o,e)}return aa(this,{ts:i,zone:e})}else return t.invalid(Bl(e))}reconfigure({locale:e,numberingSystem:r,outputCalendar:n}={}){let i=this.loc.clone({locale:e,numberingSystem:r,outputCalendar:n});return aa(this,{loc:i})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let r=Up(e,eT),{minDaysInFirstWeek:n,startOfWeek:i}=FD(r,this.loc),o=!he(r.weekYear)||!he(r.weekNumber)||!he(r.weekday),s=!he(r.ordinal),a=!he(r.year),c=!he(r.month)||!he(r.day),u=a||c,l=r.weekYear||r.weekNumber;if((u||s)&&l)throw new os("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(c&&s)throw new os("Can't mix ordinal dates with month/day");let d;o?d=LD({...Np(this.c,n,i),...r},n,i):he(r.ordinal)?(d={...this.toObject(),...r},he(r.day)&&(d.day=Math.min(Op(d.year,d.month),d.day))):d=PD({...iI(this.c),...r});let[A,p]=vp(d,this.o,this.zone);return aa(this,{ts:A,o:p})}plus(e){if(!this.isValid)return this;let r=Bt.fromDurationLike(e);return aa(this,KD(this,r))}minus(e){if(!this.isValid)return this;let r=Bt.fromDurationLike(e).negate();return aa(this,KD(this,r))}startOf(e,{useLocaleWeeks:r=!1}={}){if(!this.isValid)return this;let n={},i=Bt.normalizeUnit(e);switch(i){case"years":n.month=1;case"quarters":case"months":n.day=1;case"weeks":case"days":n.hour=0;case"hours":n.minute=0;case"minutes":n.second=0;case"seconds":n.millisecond=0;break}if(i==="weeks")if(r){let o=this.loc.getStartOfWeek(),{weekday:s}=this;s<o&&(n.weekNumber=this.weekNumber-1),n.weekday=o}else n.weekday=1;if(i==="quarters"){let o=Math.ceil(this.month/3);n.month=(o-1)*3+1}return this.set(n)}endOf(e,r){return this.isValid?this.plus({[e]:1}).startOf(e,r).minus(1):this}toFormat(e,r={}){return this.isValid?Dr.create(this.loc.redefaultToEN(r)).formatDateTimeFromString(this,e):sI}toLocaleString(e=Rp,r={}){return this.isValid?Dr.create(this.loc.clone(r),e).formatDateTime(this):sI}toLocaleParts(e={}){return this.isValid?Dr.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:r=!1,suppressMilliseconds:n=!1,includeOffset:i=!0,extendedZone:o=!1,precision:s="milliseconds"}={}){if(!this.isValid)return null;s=Dp(s);let a=e==="extended",c=uI(this,a,s);return _p.indexOf(s)>=3&&(c+="T"),c+=XD(this,a,r,n,i,o,s),c}toISODate({format:e="extended",precision:r="day"}={}){return this.isValid?uI(this,e==="extended",Dp(r)):null}toISOWeekDate(){return Qp(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:r=!1,includeOffset:n=!0,includePrefix:i=!1,extendedZone:o=!1,format:s="extended",precision:a="milliseconds"}={}){return this.isValid?(a=Dp(a),(i&&_p.indexOf(a)>=3?"T":"")+XD(this,s==="extended",r,e,n,o,a)):null}toRFC2822(){return Qp(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Qp(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?uI(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:r=!1,includeOffsetSpace:n=!0}={}){let i="HH:mm:ss.SSS";return(r||e)&&(n&&(i+=" "),r?i+="z":e&&(i+="ZZ")),Qp(this,i,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():sI}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};let r={...this.c};return e.includeConfig&&(r.outputCalendar=this.outputCalendar,r.numberingSystem=this.loc.numberingSystem,r.locale=this.loc.locale),r}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,r="milliseconds",n={}){if(!this.isValid||!e.isValid)return Bt.invalid("created by diffing an invalid DateTime");let i={locale:this.locale,numberingSystem:this.numberingSystem,...n},o=O6(r).map(Bt.normalizeUnit),s=e.valueOf()>this.valueOf(),a=s?this:e,c=s?e:this,u=xK(a,c,o,i);return s?u.negate():u}diffNow(e="milliseconds",r={}){return this.diff(t.now(),e,r)}until(e){return this.isValid?la.fromDateTimes(this,e):this}hasSame(e,r,n){if(!this.isValid)return!1;let i=e.valueOf(),o=this.setZone(e.zone,{keepLocalTime:!0});return o.startOf(r,n)<=i&&i<=o.endOf(r,n)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;let r=e.base||t.fromObject({},{zone:this.zone}),n=e.padding?this<r?-e.padding:e.padding:0,i=["years","months","days","hours","minutes","seconds"],o=e.unit;return Array.isArray(e.unit)&&(i=e.unit,o=void 0),rT(r,this.plus(n),{...e,numeric:"always",units:i,unit:o})}toRelativeCalendar(e={}){return this.isValid?rT(e.base||t.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(t.isDateTime))throw new Tt("min requires all arguments be DateTimes");return $D(e,r=>r.valueOf(),Math.min)}static max(...e){if(!e.every(t.isDateTime))throw new Tt("max requires all arguments be DateTimes");return $D(e,r=>r.valueOf(),Math.max)}static fromFormatExplain(e,r,n={}){let{locale:i=null,numberingSystem:o=null}=n,s=Ve.fromOpts({locale:i,numberingSystem:o,defaultToEN:!0});return XT(s,e,r)}static fromStringExplain(e,r,n={}){return t.fromFormatExplain(e,r,n)}static buildFormatParser(e,r={}){let{locale:n=null,numberingSystem:i=null}=r,o=Ve.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0});return new Mp(o,e)}static fromFormatParser(e,r,n={}){if(he(e)||he(r))throw new Tt("fromFormatParser requires an input string and a format parser");let{locale:i=null,numberingSystem:o=null}=n,s=Ve.fromOpts({locale:i,numberingSystem:o,defaultToEN:!0});if(!s.equals(r.locale))throw new Tt(`fromFormatParser called with a locale of ${s}, but the format parser was created for ${r.locale}`);let{result:a,zone:c,specificOffset:u,invalidReason:l}=r.explainFromTokens(e);return l?t.invalid(l):Qc(a,c,n,`format ${r.format}`,e,u)}static get DATE_SHORT(){return Rp}static get DATE_MED(){return iT}static get DATE_MED_WITH_WEEKDAY(){return d6}static get DATE_FULL(){return oT}static get DATE_HUGE(){return sT}static get TIME_SIMPLE(){return aT}static get TIME_WITH_SECONDS(){return cT}static get TIME_WITH_SHORT_OFFSET(){return uT}static get TIME_WITH_LONG_OFFSET(){return lT}static get TIME_24_SIMPLE(){return dT}static get TIME_24_WITH_SECONDS(){return AT}static get TIME_24_WITH_SHORT_OFFSET(){return pT}static get TIME_24_WITH_LONG_OFFSET(){return fT}static get DATETIME_SHORT(){return hT}static get DATETIME_SHORT_WITH_SECONDS(){return gT}static get DATETIME_MED(){return mT}static get DATETIME_MED_WITH_SECONDS(){return yT}static get DATETIME_MED_WITH_WEEKDAY(){return A6}static get DATETIME_FULL(){return ET}static get DATETIME_FULL_WITH_SECONDS(){return IT}static get DATETIME_HUGE(){return CT}static get DATETIME_HUGE_WITH_SECONDS(){return bT}};function Sl(t){if(tt.isDateTime(t))return t;if(t&&t.valueOf&&ss(t.valueOf()))return tt.fromJSDate(t);if(t&&typeof t=="object")return tt.fromObject(t);throw new Tt(`Unknown datetime argument: ${t}, of type ${typeof t}`)}var r3="3.7.2";Nr.DateTime=tt;Nr.Duration=Bt;Nr.FixedOffsetZone=kr;Nr.IANAZone=wo;Nr.Info=ua;Nr.Interval=la;Nr.InvalidZone=kp;Nr.Settings=We;Nr.SystemZone=_l;Nr.VERSION=r3;Nr.Zone=as});var qp=m(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.CronDate=tr.DAYS_IN_MONTH=tr.DateMathOp=tr.TimeUnit=void 0;var da=nR(),jt;(function(t){t.Second="Second",t.Minute="Minute",t.Hour="Hour",t.Day="Day",t.Month="Month",t.Year="Year"})(jt||(tr.TimeUnit=jt={}));var $p;(function(t){t.Add="Add",t.Subtract="Subtract"})($p||(tr.DateMathOp=$p={}));tr.DAYS_IN_MONTH=Object.freeze([31,29,31,30,31,30,31,31,30,31,30,31]);var jp=class t{#e;#t=null;#n=null;#i={add:{[jt.Year]:this.addYear.bind(this),[jt.Month]:this.addMonth.bind(this),[jt.Day]:this.addDay.bind(this),[jt.Hour]:this.addHour.bind(this),[jt.Minute]:this.addMinute.bind(this),[jt.Second]:this.addSecond.bind(this)},subtract:{[jt.Year]:this.subtractYear.bind(this),[jt.Month]:this.subtractMonth.bind(this),[jt.Day]:this.subtractDay.bind(this),[jt.Hour]:this.subtractHour.bind(this),[jt.Minute]:this.subtractMinute.bind(this),[jt.Second]:this.subtractSecond.bind(this)}};constructor(e,r){let n={zone:r};if(e?e instanceof t?(this.#e=e.#e,this.#t=e.#t,this.#n=e.#n):e instanceof Date?this.#e=da.DateTime.fromJSDate(e,n):typeof e=="number"?this.#e=da.DateTime.fromMillis(e,n):(this.#e=da.DateTime.fromISO(e,n),this.#e.isValid||(this.#e=da.DateTime.fromRFC2822(e,n)),this.#e.isValid||(this.#e=da.DateTime.fromSQL(e,n)),this.#e.isValid||(this.#e=da.DateTime.fromFormat(e,"EEE, d MMM yyyy HH:mm:ss",n))):this.#e=da.DateTime.local(),!this.#e.isValid)throw new Error(`CronDate: unhandled timestamp: ${e}`);r&&r!==this.#e.zoneName&&(this.#e=this.#e.setZone(r))}static#o(e){return e%4===0&&e%100!==0||e%400===0}get dstStart(){return this.#t}set dstStart(e){this.#t=e}get dstEnd(){return this.#n}set dstEnd(e){this.#n=e}addYear(){this.#e=this.#e.plus({years:1})}addMonth(){this.#e=this.#e.plus({months:1}).startOf("month")}addDay(){this.#e=this.#e.plus({days:1}).startOf("day")}addHour(){this.#e=this.#e.plus({hours:1}).startOf("hour")}addMinute(){this.#e=this.#e.plus({minutes:1}).startOf("minute")}addSecond(){this.#e=this.#e.plus({seconds:1})}subtractYear(){this.#e=this.#e.minus({years:1})}subtractMonth(){this.#e=this.#e.minus({months:1}).endOf("month").startOf("second")}subtractDay(){this.#e=this.#e.minus({days:1}).endOf("day").startOf("second")}subtractHour(){this.#e=this.#e.minus({hours:1}).endOf("hour").startOf("second")}subtractMinute(){this.#e=this.#e.minus({minutes:1}).endOf("minute").startOf("second")}subtractSecond(){this.#e=this.#e.minus({seconds:1})}addUnit(e){this.#i.add[e]()}subtractUnit(e){this.#i.subtract[e]()}invokeDateOperation(e,r){if(e===$p.Add){this.addUnit(r);return}if(e===$p.Subtract){this.subtractUnit(r);return}throw new Error(`Invalid verb: ${e}`)}getDate(){return this.#e.day}getFullYear(){return this.#e.year}getDay(){let e=this.#e.weekday;return e===7?0:e}getMonth(){return this.#e.month-1}getHours(){return this.#e.hour}getMinutes(){return this.#e.minute}getSeconds(){return this.#e.second}getMilliseconds(){return this.#e.millisecond}getUTCOffset(){return this.#e.offset}setStartOfDay(){this.#e=this.#e.startOf("day")}setEndOfDay(){this.#e=this.#e.endOf("day")}getTime(){return this.#e.valueOf()}getUTCDate(){return this.#r().day}getUTCFullYear(){return this.#r().year}getUTCDay(){let e=this.#r().weekday;return e===7?0:e}getUTCMonth(){return this.#r().month-1}getUTCHours(){return this.#r().hour}getUTCMinutes(){return this.#r().minute}getUTCSeconds(){return this.#r().second}toISOString(){return this.#e.toUTC().toISO()}toJSON(){return this.#e.toJSON()}setDate(e){this.#e=this.#e.set({day:e})}setFullYear(e){this.#e=this.#e.set({year:e})}setDay(e){this.#e=this.#e.set({weekday:e})}setMonth(e){this.#e=this.#e.set({month:e+1})}setHours(e){this.#e=this.#e.set({hour:e})}setMinutes(e){this.#e=this.#e.set({minute:e})}setSeconds(e){this.#e=this.#e.set({second:e})}setMilliseconds(e){this.#e=this.#e.set({millisecond:e})}toString(){return this.toDate().toString()}toDate(){return this.#e.toJSDate()}isLastDayOfMonth(){let{day:e,month:r}=this.#e;if(r===2){let n=t.#o(this.#e.year);return e===tr.DAYS_IN_MONTH[r-1]-(n?0:1)}return e===tr.DAYS_IN_MONTH[r-1]}isLastWeekdayOfMonth(){let{day:e,month:r}=this.#e,n;return r===2?n=tr.DAYS_IN_MONTH[r-1]-(t.#o(this.#e.year)?0:1):n=tr.DAYS_IN_MONTH[r-1],e>n-7}applyDateOperation(e,r,n){if(r===jt.Month||r===jt.Day){this.invokeDateOperation(e,r);return}let i=this.getHours();this.invokeDateOperation(e,r);let o=this.getHours(),s=o-i;s===2?n!==24&&(this.dstStart=o):s===0&&this.getMinutes()===0&&this.getSeconds()===0&&n!==24&&(this.dstEnd=o)}#r(){return this.#e.toUTC()}};tr.CronDate=jp;tr.default=jp});var iR=m(zp=>{"use strict";Object.defineProperty(zp,"__esModule",{value:!0});zp.CronMonth=void 0;var n3=qp(),i3=rs(),o3=1,s3=12,a3=Object.freeze([]),UI=class extends i3.CronField{static get min(){return o3}static get max(){return s3}static get chars(){return a3}static get daysInMonth(){return n3.DAYS_IN_MONTH}constructor(e,r){super(e,r),this.validate()}get values(){return super.values}};zp.CronMonth=UI});var oR=m(Hp=>{"use strict";Object.defineProperty(Hp,"__esModule",{value:!0});Hp.CronSecond=void 0;var c3=rs(),u3=0,l3=59,d3=Object.freeze([]),MI=class extends c3.CronField{static get min(){return u3}static get max(){return l3}static get chars(){return d3}constructor(e,r){super(e,r),this.validate()}get values(){return super.values}};Hp.CronSecond=MI});var Gp=m(Ar=>{"use strict";var A3=Ar&&Ar.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),cs=Ar&&Ar.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&A3(e,t,r)};Object.defineProperty(Ar,"__esModule",{value:!0});cs(SD(),Ar);cs(wD(),Ar);cs(BD(),Ar);cs(rs(),Ar);cs(QD(),Ar);cs(vD(),Ar);cs(iR(),Ar);cs(oR(),Ar)});var LI=m(Yp=>{"use strict";Object.defineProperty(Yp,"__esModule",{value:!0});Yp.CronFieldCollection=void 0;var nn=Gp(),xI=class t{#e;#t;#n;#i;#o;#r;static from(e,r){return new t({second:this.resolveField(nn.CronSecond,e.second,r.second),minute:this.resolveField(nn.CronMinute,e.minute,r.minute),hour:this.resolveField(nn.CronHour,e.hour,r.hour),dayOfMonth:this.resolveField(nn.CronDayOfMonth,e.dayOfMonth,r.dayOfMonth),month:this.resolveField(nn.CronMonth,e.month,r.month),dayOfWeek:this.resolveField(nn.CronDayOfWeek,e.dayOfWeek,r.dayOfWeek)})}static resolveField(e,r,n){return n?n instanceof nn.CronField?n:new e(n):r}constructor({second:e,minute:r,hour:n,dayOfMonth:i,month:o,dayOfWeek:s}){if(!e)throw new Error("Validation error, Field second is missing");if(!r)throw new Error("Validation error, Field minute is missing");if(!n)throw new Error("Validation error, Field hour is missing");if(!i)throw new Error("Validation error, Field dayOfMonth is missing");if(!o)throw new Error("Validation error, Field month is missing");if(!s)throw new Error("Validation error, Field dayOfWeek is missing");if(o.values.length===1&&!i.hasLastChar&&!(parseInt(i.values[0],10)<=nn.CronMonth.daysInMonth[o.values[0]-1]))throw new Error("Invalid explicit day of month definition");this.#e=e,this.#t=r,this.#n=n,this.#o=o,this.#r=s,this.#i=i}get second(){return this.#e}get minute(){return this.#t}get hour(){return this.#n}get dayOfMonth(){return this.#i}get month(){return this.#o}get dayOfWeek(){return this.#r}static compactField(e){if(e.length===0)return[];let r=[],n;return e.forEach((i,o,s)=>{if(n===void 0){n={start:i,count:1};return}let a=s[o-1]||n.start,c=s[o+1];if(i==="L"||i==="W"){r.push(n),r.push({start:i,count:1}),n=void 0;return}if(n.step===void 0&&c!==void 0){let u=i-a,l=c-i;if(u<=l){n={...n,count:2,end:i,step:u};return}n.step=1}i-(n.end??0)===n.step?(n.count++,n.end=i):(n.count===1?r.push({start:n.start,count:1}):n.count===2?(r.push({start:n.start,count:1}),r.push({start:n.end??a,count:1})):r.push(n),n={start:i,count:1})}),n&&r.push(n),r}static#c(e,r,n){let i=r.step;return i?i===1&&r.start===e.min&&r.end&&r.end>=n?e.hasQuestionMarkChar?"?":"*":i!==1&&r.start===e.min&&r.end&&r.end>=n-i+1?`*/${i}`:null:null}static#s(e,r){let n=e.step;if(n===1)return`${e.start}-${e.end}`;let i=e.start===0?e.count-1:e.count;if(!n)throw new Error("Unexpected range step");if(!e.end)throw new Error("Unexpected range end");if(n*i>e.end){let o=(a,c)=>{if(typeof e.start!="number")throw new Error("Unexpected range start");return c%n===0?e.start+c:null};if(typeof e.start!="number")throw new Error("Unexpected range start");let s={length:e.end-e.start+1};return Array.from(s,o).filter(a=>a!==null).join(",")}return e.end===r-n+1?`${e.start}/${n}`:`${e.start}-${e.end}/${n}`}stringifyField(e){let r=e.max,n=e.values;if(e instanceof nn.CronDayOfWeek){r=6;let o=this.#r.values;n=o[o.length-1]===7?o.slice(0,-1):o}e instanceof nn.CronDayOfMonth&&(r=this.#o.values.length===1?nn.CronMonth.daysInMonth[this.#o.values[0]-1]:e.max);let i=t.compactField(n);if(i.length===1){let o=t.#c(e,i[0],r);if(o)return o}return i.map(o=>{let s=o.count===1?o.start.toString():t.#s(o,r);return e instanceof nn.CronDayOfWeek&&e.nthDay>0?`${s}#${e.nthDay}`:s}).join(",")}stringify(e=!1){let r=[];return e&&r.push(this.stringifyField(this.#e)),r.push(this.stringifyField(this.#t),this.stringifyField(this.#n),this.stringifyField(this.#i),this.stringifyField(this.#o),this.stringifyField(this.#r)),r.join(" ")}serialize(){return{second:this.#e.serialize(),minute:this.#t.serialize(),hour:this.#n.serialize(),dayOfMonth:this.#i.serialize(),month:this.#o.serialize(),dayOfWeek:this.#r.serialize()}}};Yp.CronFieldCollection=xI});var PI=m(on=>{"use strict";Object.defineProperty(on,"__esModule",{value:!0});on.CronExpression=on.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE=on.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE=void 0;var ct=qp();on.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE="Out of the time span range";on.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE="Invalid expression, loop limit exceeded";var sR=1e4,Vp=class t{#e;#t;#n;#i;#o;#r;#c=null;#s=!1;constructor(e,r){this.#e=r,this.#t=r.tz,this.#i=r.startDate?new ct.CronDate(r.startDate,this.#t):null,this.#o=r.endDate?new ct.CronDate(r.endDate,this.#t):null;let n=r.currentDate??r.startDate;if(n){let i=new ct.CronDate(n,this.#t);this.#i&&i.getTime()<this.#i.getTime()?n=this.#i:this.#o&&i.getTime()>this.#o.getTime()&&(n=this.#o)}this.#n=new ct.CronDate(n,this.#t),this.#r=e}get fields(){return this.#r}static fieldsToExpression(e,r){return new t(e,r||{})}static#a(e,r){return r.some(n=>n===e)}#u(e,r){return e[r?e.length-1:0]}#d(e){let r=`${e.getFullYear()}-${e.getMonth()+1}-${e.getDate()}`;if(this.#c===r)return this.#s;let n=new ct.CronDate(e);n.setStartOfDay();let i=new ct.CronDate(e);return i.setEndOfDay(),this.#c=r,this.#s=n.getUTCOffset()!==i.getUTCOffset(),this.#s}#A(e,r,n){let i=this.#r.second.values,o=e.getSeconds(),s=this.#r.second.findNearestValue(o,n);if(s!==null){e.setSeconds(s);return}e.applyDateOperation(r,ct.TimeUnit.Minute,this.#r.hour.values.length),e.setSeconds(this.#u(i,n))}#p(e,r,n){let i=this.#r.minute.values,o=this.#r.second.values,s=e.getMinutes(),a=this.#r.minute.findNearestValue(s,n);if(a!==null){e.setMinutes(a),e.setSeconds(this.#u(o,n));return}e.applyDateOperation(r,ct.TimeUnit.Hour,this.#r.hour.values.length),e.setMinutes(this.#u(i,n)),e.setSeconds(this.#u(o,n))}static#f(e,r){let n=r.isLastWeekdayOfMonth();return e.some(i=>{let o=parseInt(i.toString().charAt(0),10)%7;if(Number.isNaN(o))throw new Error(`Invalid last weekday of the month expression: ${i}`);return r.getDay()===o&&n})}next(){return this.#g()}prev(){return this.#g(!0)}hasNext(){let e=this.#n;try{return this.#g(),!0}catch{return!1}finally{this.#n=e}}hasPrev(){let e=this.#n;try{return this.#g(!0),!0}catch{return!1}finally{this.#n=e}}take(e){let r=[];if(e>=0)for(let n=0;n<e;n++)try{r.push(this.next())}catch{return r}else for(let n=0;n>e;n--)try{r.push(this.prev())}catch{return r}return r}reset(e){this.#n=new ct.CronDate(e||this.#e.currentDate)}stringify(e=!1){return this.#r.stringify(e)}includesDate(e){let{second:r,minute:n,hour:i,month:o}=this.#r,s=new ct.CronDate(e,this.#t);return!(!r.values.includes(s.getSeconds())||!n.values.includes(s.getMinutes())||!i.values.includes(s.getHours())||!o.values.includes(s.getMonth()+1)||!this.#l(s)||this.#r.dayOfWeek.nthDay>0&&Math.ceil(s.getDate()/7)!==this.#r.dayOfWeek.nthDay)}toString(){return this.#e.expression||this.stringify(!0)}#l(e){let r=this.#r.dayOfMonth.isWildcard,n=!r,i=this.#r.dayOfWeek.isWildcard,o=!i,s=t.#a(e.getDate(),this.#r.dayOfMonth.values)||this.#r.dayOfMonth.hasLastChar&&e.isLastDayOfMonth(),a=t.#a(e.getDay(),this.#r.dayOfWeek.values)||this.#r.dayOfWeek.hasLastChar&&t.#f(this.#r.dayOfWeek.values,e);return!!(n&&o&&(s||a)||s&&!o||r&&!i&&a)}#m(e,r,n){let i=this.#r.hour.values,o=i,s=e.getHours(),a=t.#a(s,i),c=e.dstStart===s,u=e.dstEnd===s;if(c)return t.#a(s-1,i)?!0:(e.invokeDateOperation(r,ct.TimeUnit.Hour),!1);if(u&&!n)return e.dstEnd=null,e.applyDateOperation(ct.DateMathOp.Add,ct.TimeUnit.Hour,o.length),!1;if(a)return!0;e.dstStart=null;let l=this.#r.hour.findNearestValue(s,n);if(l===null)return e.applyDateOperation(r,ct.TimeUnit.Day,o.length),!1;if(this.#d(e)){let d=n?s-l:l-s;for(let A=0;A<d;A++)e.applyDateOperation(r,ct.TimeUnit.Hour,o.length)}else e.setHours(l);return e.setMinutes(this.#u(this.#r.minute.values,n)),e.setSeconds(this.#u(this.#r.second.values,n)),!1}#h(e){if(!this.#i&&!this.#o)return;let r=e.getTime();if(this.#i&&r<this.#i.getTime())throw new Error(on.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE);if(this.#o&&r>this.#o.getTime())throw new Error(on.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE)}#g(e=!1){let r=e?ct.DateMathOp.Subtract:ct.DateMathOp.Add,n=new ct.CronDate(this.#n),i=n.getTime(),o=0;for(;++o<sR;){if(this.#h(n),!this.#l(n)){n.applyDateOperation(r,ct.TimeUnit.Day,this.#r.hour.values.length);continue}if(!(this.#r.dayOfWeek.nthDay<=0||Math.ceil(n.getDate()/7)===this.#r.dayOfWeek.nthDay)){n.applyDateOperation(r,ct.TimeUnit.Day,this.#r.hour.values.length);continue}if(!t.#a(n.getMonth()+1,this.#r.month.values)){n.applyDateOperation(r,ct.TimeUnit.Month,this.#r.hour.values.length);continue}if(this.#m(n,r,e)){if(!t.#a(n.getMinutes(),this.#r.minute.values)){this.#p(n,r,e);continue}if(!t.#a(n.getSeconds(),this.#r.second.values)){this.#A(n,r,e);continue}if(i===n.getTime()){(r==="Add"||n.getMilliseconds()===0)&&n.applyDateOperation(r,ct.TimeUnit.Second,this.#r.hour.values.length);continue}break}}if(o>sR)throw new Error(on.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE);return n.getMilliseconds()!==0&&n.setMilliseconds(0),this.#n=n,n}[Symbol.iterator](){return{next:()=>({value:this.#g(),done:!this.hasNext()})}}};on.CronExpression=Vp;on.default=Vp});var aR=m(FI=>{"use strict";Object.defineProperty(FI,"__esModule",{value:!0});FI.seededRandom=h3;function p3(t){let e=2166136261;for(let r=0;r<t.length;r++)e^=t.charCodeAt(r),e=Math.imul(e,16777619);return()=>e>>>0}function f3(t){return()=>{let e=t+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}function h3(t){let e=t?p3(t)():Math.floor(Math.random()*1e10);return f3(e)}});var Jp=m(cn=>{"use strict";Object.defineProperty(cn,"__esModule",{value:!0});cn.CronExpressionParser=cn.DayOfWeek=cn.Months=cn.CronUnit=cn.PredefinedExpressions=void 0;var g3=LI(),m3=PI(),y3=aR(),sn=Gp(),$I;(function(t){t["@yearly"]="0 0 0 1 1 *",t["@annually"]="0 0 0 1 1 *",t["@monthly"]="0 0 0 1 * *",t["@weekly"]="0 0 0 * * 0",t["@daily"]="0 0 0 * * *",t["@hourly"]="0 0 * * * *",t["@minutely"]="0 * * * * *",t["@secondly"]="* * * * * *",t["@weekdays"]="0 0 0 * * 1-5",t["@weekends"]="0 0 0 * * 0,6"})($I||(cn.PredefinedExpressions=$I={}));var an;(function(t){t.Second="Second",t.Minute="Minute",t.Hour="Hour",t.DayOfMonth="DayOfMonth",t.Month="Month",t.DayOfWeek="DayOfWeek"})(an||(cn.CronUnit=an={}));var jI;(function(t){t[t.jan=1]="jan",t[t.feb=2]="feb",t[t.mar=3]="mar",t[t.apr=4]="apr",t[t.may=5]="may",t[t.jun=6]="jun",t[t.jul=7]="jul",t[t.aug=8]="aug",t[t.sep=9]="sep",t[t.oct=10]="oct",t[t.nov=11]="nov",t[t.dec=12]="dec"})(jI||(cn.Months=jI={}));var qI;(function(t){t[t.sun=0]="sun",t[t.mon=1]="mon",t[t.tue=2]="tue",t[t.wed=3]="wed",t[t.thu=4]="thu",t[t.fri=5]="fri",t[t.sat=6]="sat"})(qI||(cn.DayOfWeek=qI={}));var zI=class t{static parse(e,r={}){let{strict:n=!1,hashSeed:i}=r,o=(0,y3.seededRandom)(i);e=$I[e]||e;let s=t.#e(e,n);if(!(s.dayOfMonth==="*"||s.dayOfWeek==="*"||!n))throw new Error("Cannot use both dayOfMonth and dayOfWeek together in strict mode!");let a=t.#t(an.Second,s.second,sn.CronSecond.constraints,o),c=t.#t(an.Minute,s.minute,sn.CronMinute.constraints,o),u=t.#t(an.Hour,s.hour,sn.CronHour.constraints,o),l=t.#t(an.Month,s.month,sn.CronMonth.constraints,o),d=t.#t(an.DayOfMonth,s.dayOfMonth,sn.CronDayOfMonth.constraints,o),{dayOfWeek:A,nthDayOfWeek:p}=t.#d(s.dayOfWeek),h=t.#t(an.DayOfWeek,A,sn.CronDayOfWeek.constraints,o),g=new g3.CronFieldCollection({second:new sn.CronSecond(a,{rawValue:s.second}),minute:new sn.CronMinute(c,{rawValue:s.minute}),hour:new sn.CronHour(u,{rawValue:s.hour}),dayOfMonth:new sn.CronDayOfMonth(d,{rawValue:s.dayOfMonth}),month:new sn.CronMonth(l,{rawValue:s.month}),dayOfWeek:new sn.CronDayOfWeek(h,{rawValue:s.dayOfWeek,nthDayOfWeek:p})});return new m3.CronExpression(g,{...r,expression:e})}static#e(e,r){if(r&&!e.length)throw new Error("Invalid cron expression");e=e||"0 * * * * *";let n=e.trim().split(/\s+/);if(r&&n.length<6)throw new Error("Invalid cron expression, expected 6 fields");if(n.length>6)throw new Error("Invalid cron expression, too many fields");let i=["*","*","*","*","*","0"];n.length<i.length&&n.unshift(...i.slice(n.length));let[o,s,a,c,u,l]=n;return{second:o,minute:s,hour:a,dayOfMonth:c,month:u,dayOfWeek:l}}static#t(e,r,n,i){if((e===an.Month||e===an.DayOfWeek)&&(r=r.replace(/[a-z]{3}/gi,o=>{o=o.toLowerCase();let s=jI[o]||qI[o];if(s===void 0)throw new Error(`Validation error, cannot resolve alias "${o}"`);return s.toString()})),!n.validChars.test(r))throw new Error(`Invalid characters, got value: ${r}`);return r=this.#n(r,n),r=this.#i(r,n,i),this.#o(e,r,n)}static#n(e,r){return e.replace(/[*?]/g,r.min+"-"+r.max)}static#i(e,r,n){let i=n();return e.replace(/H(?:\((\d+)-(\d+)\))?(?:\/(\d+))?/g,(o,s,a,c)=>{if(s&&a&&c){let u=parseInt(s,10),l=parseInt(a,10),d=parseInt(c,10);if(u>l)throw new Error(`Invalid range: ${u}-${l}, min > max`);if(d<=0)throw new Error(`Invalid step: ${d}, must be positive`);let A=Math.max(u,r.min),p=Math.floor(i*d),h=[];for(let g=Math.floor(A/d)*d+p;g<=l;g+=d)g>=A&&h.push(g);return h.join(",")}else if(s&&a){let u=parseInt(s,10),l=parseInt(a,10);if(u>l)throw new Error(`Invalid range: ${u}-${l}, min > max`);return String(Math.floor(i*(l-u+1))+u)}else if(c){let u=parseInt(c,10);if(u<=0)throw new Error(`Invalid step: ${u}, must be positive`);let l=Math.floor(i*u),d=[];for(let A=Math.floor(r.min/u)*u+l;A<=r.max;A+=u)A>=r.min&&d.push(A);return d.join(",")}else return String(Math.floor(i*(r.max-r.min+1)+r.min))})}static#o(e,r,n){let i=[];function o(a,c){if(Array.isArray(a))i.push(...a);else if(t.#A(c,a))i.push(a);else{let u=parseInt(a.toString(),10);if(!(u>=c.min&&u<=c.max))throw new Error(`Constraint error, got value ${a} expected range ${c.min}-${c.max}`);i.push(e===an.DayOfWeek?u%7:a)}}return r.split(",").forEach(a=>{if(!(a.length>0))throw new Error("Invalid list value format");o(t.#r(e,a,n),n)}),i}static#r(e,r,n){let i=r.split("/");if(i.length>2)throw new Error(`Invalid repeat: ${r}`);return i.length===2?(isNaN(parseInt(i[0],10))||(i[0]=`${i[0]}-${n.max}`),t.#u(e,i[0],parseInt(i[1],10),n)):t.#u(e,r,1,n)}static#c(e,r,n){if(!(!isNaN(e)&&!isNaN(r)&&e>=n.min&&r<=n.max))throw new Error(`Constraint error, got range ${e}-${r} expected range ${n.min}-${n.max}`);if(e>r)throw new Error(`Invalid range: ${e}-${r}, min(${e}) > max(${r})`)}static#s(e){if(!(!isNaN(e)&&e>0))throw new Error(`Constraint error, cannot repeat at every ${e} time.`)}static#a(e,r,n,i){let o=[];e===an.DayOfWeek&&n%7===0&&o.push(0);for(let s=r;s<=n;s+=i)o.indexOf(s)===-1&&o.push(s);return o}static#u(e,r,n,i){let o=r.split("-");if(o.length<=1)return isNaN(+r)?r:+r;let[s,a]=o.map(c=>parseInt(c,10));return this.#c(s,a,i),this.#s(n),this.#a(e,s,a,n)}static#d(e){let r=e.split("#");if(r.length<=1)return{dayOfWeek:r[0]};let n=+r[r.length-1],i=e.match(/([,-/])/);if(i!==null)throw new Error(`Constraint error, invalid dayOfWeek \`#\` and \`${i?.[0]}\` special characters are incompatible`);if(!(r.length<=2&&!isNaN(n)&&n>=1&&n<=5))throw new Error("Constraint error, invalid dayOfWeek occurrence number (#)");return{dayOfWeek:r[0],nthDayOfWeek:n}}static#A(e,r){return e.chars.some(n=>r.toString().includes(n))}};cn.CronExpressionParser=zI});var cR=m(Jn=>{"use strict";var E3=Jn&&Jn.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),I3=Jn&&Jn.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),C3=Jn&&Jn.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&E3(r,e,n[i]);return I3(r,e),r}})();Object.defineProperty(Jn,"__esModule",{value:!0});Jn.CronFileParser=void 0;var b3=Jp(),HI=class t{static async parseFile(e){let{readFile:r}=await Promise.resolve().then(()=>C3(require("fs/promises"))),n=await r(e,"utf8");return t.#e(n)}static parseFileSync(e){let{readFileSync:r}=require("fs"),n=r(e,"utf8");return t.#e(n)}static#e(e){let r=e.split(`
|
|
@@ -79,7 +79,7 @@ ${t.slice(t.length-n)}`}function HX(t){return t instanceof Error?t.message:typeo
|
|
|
79
79
|
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of t.seen.entries()){let a=s[1];if(e===s[0]){o(s);continue}if(t.external){let u=t.external.registry.get(s[0])?.id;if(e!==s[0]&&u){o(s);continue}}if(t.metadataRegistry.get(s[0])?.id){o(s);continue}if(a.cycle){o(s);continue}if(a.count>1&&t.reused==="ref"){o(s);continue}}}function jC(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let c=t.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},d=c.ref;if(c.ref=null,d){n(d);let p=t.seen.get(d),h=p.schema;if(h.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(h)):Object.assign(u,h),Object.assign(u,l),a._zod.parent===d)for(let S in u)S==="$ref"||S==="allOf"||S in l||delete u[S];if(h.$ref&&p.def)for(let S in u)S==="$ref"||S==="allOf"||S in p.def&&JSON.stringify(u[S])===JSON.stringify(p.def[S])&&delete u[S]}let A=a._zod.parent;if(A&&A!==d){n(A);let p=t.seen.get(A);if(p?.schema.$ref&&(u.$ref=p.schema.$ref,p.def))for(let h in u)h==="$ref"||h==="allOf"||h in p.def&&JSON.stringify(u[h])===JSON.stringify(p.def[h])&&delete u[h]}t.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};for(let a of[...t.seen.entries()].reverse())n(a[0]);let i={};if(t.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let a=t.external.registry.get(e)?.id;if(!a)throw new Error("Schema is missing an `id` property");i.$id=t.external.uri(a)}Object.assign(i,r.def??r.schema);let o=t.metadataRegistry.get(e)?.id;o!==void 0&&i.id===o&&delete i.id;let s=t.external?.defs??{};for(let a of t.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,s[c.defId]=c.def)}t.external||Object.keys(s).length>0&&(t.target==="draft-2020-12"?i.$defs=s:i.definitions=s);try{let a=JSON.parse(JSON.stringify(i));return Object.defineProperty(a,"~standard",{value:{...e["~standard"],jsonSchema:{input:(0,dn.createStandardJSONSchemaMethod)(e,"input",t.processors),output:(0,dn.createStandardJSONSchemaMethod)(e,"output",t.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function rr(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let n=t._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return rr(n.element,r);if(n.type==="set")return rr(n.valueType,r);if(n.type==="lazy")return rr(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return rr(n.innerType,r);if(n.type==="intersection")return rr(n.left,r)||rr(n.right,r);if(n.type==="record"||n.type==="map")return rr(n.keyType,r)||rr(n.valueType,r);if(n.type==="pipe")return t._zod.traits.has("$ZodCodec")?!0:rr(n.in,r)||rr(n.out,r);if(n.type==="object"){for(let i in n.shape)if(rr(n.shape[i],r))return!0;return!1}if(n.type==="union"){for(let i of n.options)if(rr(i,r))return!0;return!1}if(n.type==="tuple"){for(let i of n.items)if(rr(i,r))return!0;return!!(n.rest&&rr(n.rest,r))}return!1}var zae=(t,e={})=>r=>{let n=FC({...r,processors:e});return Dh(t,n),$C(n,t),jC(n,t)};dn.createToJSONSchemaMethod=zae;var Hae=(t,e,r={})=>n=>{let{libraryOptions:i,target:o}=n??{},s=FC({...i??{},target:o,io:e,processors:r});return Dh(t,s),$C(s,t),jC(s,t)};dn.createStandardJSONSchemaMethod=Hae});var ld=m(R=>{"use strict";Object.defineProperty(R,"__esModule",{value:!0});R.allProcessors=R.lazyProcessor=R.optionalProcessor=R.promiseProcessor=R.readonlyProcessor=R.pipeProcessor=R.catchProcessor=R.prefaultProcessor=R.defaultProcessor=R.nonoptionalProcessor=R.nullableProcessor=R.recordProcessor=R.tupleProcessor=R.intersectionProcessor=R.unionProcessor=R.objectProcessor=R.arrayProcessor=R.setProcessor=R.mapProcessor=R.transformProcessor=R.functionProcessor=R.customProcessor=R.successProcessor=R.fileProcessor=R.templateLiteralProcessor=R.nanProcessor=R.literalProcessor=R.enumProcessor=R.dateProcessor=R.unknownProcessor=R.anyProcessor=R.neverProcessor=R.voidProcessor=R.undefinedProcessor=R.nullProcessor=R.symbolProcessor=R.bigintProcessor=R.booleanProcessor=R.numberProcessor=R.stringProcessor=void 0;R.toJSONSchema=Nce;var Le=ud(),Gae=X(),Yae={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Vae=(t,e,r,n)=>{let i=r;i.type="string";let{minimum:o,maximum:s,format:a,patterns:c,contentEncoding:u}=t._zod.bag;if(typeof o=="number"&&(i.minLength=o),typeof s=="number"&&(i.maxLength=s),a&&(i.format=Yae[a]??a,i.format===""&&delete i.format,a==="time"&&delete i.format),u&&(i.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?i.pattern=l[0].source:l.length>1&&(i.allOf=[...l.map(d=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}};R.stringProcessor=Vae;var Jae=(t,e,r,n)=>{let i=r,{minimum:o,maximum:s,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=t._zod.bag;typeof a=="string"&&a.includes("int")?i.type="integer":i.type="number";let d=typeof l=="number"&&l>=(o??Number.NEGATIVE_INFINITY),A=typeof u=="number"&&u<=(s??Number.POSITIVE_INFINITY),p=e.target==="draft-04"||e.target==="openapi-3.0";d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof o=="number"&&(i.minimum=o),A?p?(i.maximum=u,i.exclusiveMaximum=!0):i.exclusiveMaximum=u:typeof s=="number"&&(i.maximum=s),typeof c=="number"&&(i.multipleOf=c)};R.numberProcessor=Jae;var Wae=(t,e,r,n)=>{r.type="boolean"};R.booleanProcessor=Wae;var Zae=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")};R.bigintProcessor=Zae;var Kae=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")};R.symbolProcessor=Kae;var Xae=(t,e,r,n)=>{e.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"};R.nullProcessor=Xae;var ece=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")};R.undefinedProcessor=ece;var tce=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")};R.voidProcessor=tce;var rce=(t,e,r,n)=>{r.not={}};R.neverProcessor=rce;var nce=(t,e,r,n)=>{};R.anyProcessor=nce;var ice=(t,e,r,n)=>{};R.unknownProcessor=ice;var oce=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")};R.dateProcessor=oce;var sce=(t,e,r,n)=>{let i=t._zod.def,o=(0,Gae.getEnumValues)(i.entries);o.every(s=>typeof s=="number")&&(r.type="number"),o.every(s=>typeof s=="string")&&(r.type="string"),r.enum=o};R.enumProcessor=sce;var ace=(t,e,r,n)=>{let i=t._zod.def,o=[];for(let s of i.values)if(s===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof s=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(s))}else o.push(s);if(o.length!==0)if(o.length===1){let s=o[0];r.type=s===null?"null":typeof s,e.target==="draft-04"||e.target==="openapi-3.0"?r.enum=[s]:r.const=s}else o.every(s=>typeof s=="number")&&(r.type="number"),o.every(s=>typeof s=="string")&&(r.type="string"),o.every(s=>typeof s=="boolean")&&(r.type="boolean"),o.every(s=>s===null)&&(r.type="null"),r.enum=o};R.literalProcessor=ace;var cce=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")};R.nanProcessor=cce;var uce=(t,e,r,n)=>{let i=r,o=t._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");i.type="string",i.pattern=o.source};R.templateLiteralProcessor=uce;var lce=(t,e,r,n)=>{let i=r,o={type:"string",format:"binary",contentEncoding:"binary"},{minimum:s,maximum:a,mime:c}=t._zod.bag;s!==void 0&&(o.minLength=s),a!==void 0&&(o.maxLength=a),c?c.length===1?(o.contentMediaType=c[0],Object.assign(i,o)):(Object.assign(i,o),i.anyOf=c.map(u=>({contentMediaType:u}))):Object.assign(i,o)};R.fileProcessor=lce;var dce=(t,e,r,n)=>{r.type="boolean"};R.successProcessor=dce;var Ace=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")};R.customProcessor=Ace;var pce=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")};R.functionProcessor=pce;var fce=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")};R.transformProcessor=fce;var hce=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")};R.mapProcessor=hce;var gce=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")};R.setProcessor=gce;var mce=(t,e,r,n)=>{let i=r,o=t._zod.def,{minimum:s,maximum:a}=t._zod.bag;typeof s=="number"&&(i.minItems=s),typeof a=="number"&&(i.maxItems=a),i.type="array",i.items=(0,Le.process)(o.element,e,{...n,path:[...n.path,"items"]})};R.arrayProcessor=mce;var yce=(t,e,r,n)=>{let i=r,o=t._zod.def;i.type="object",i.properties={};let s=o.shape;for(let u in s)i.properties[u]=(0,Le.process)(s[u],e,{...n,path:[...n.path,"properties",u]});let a=new Set(Object.keys(s)),c=new Set([...a].filter(u=>{let l=o.shape[u]._zod;return e.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(i.required=Array.from(c)),o.catchall?._zod.def.type==="never"?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=(0,Le.process)(o.catchall,e,{...n,path:[...n.path,"additionalProperties"]})):e.io==="output"&&(i.additionalProperties=!1)};R.objectProcessor=yce;var Ece=(t,e,r,n)=>{let i=t._zod.def,o=i.inclusive===!1,s=i.options.map((a,c)=>(0,Le.process)(a,e,{...n,path:[...n.path,o?"oneOf":"anyOf",c]}));o?r.oneOf=s:r.anyOf=s};R.unionProcessor=Ece;var Ice=(t,e,r,n)=>{let i=t._zod.def,o=(0,Le.process)(i.left,e,{...n,path:[...n.path,"allOf",0]}),s=(0,Le.process)(i.right,e,{...n,path:[...n.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]];r.allOf=c};R.intersectionProcessor=Ice;var Cce=(t,e,r,n)=>{let i=r,o=t._zod.def;i.type="array";let s=e.target==="draft-2020-12"?"prefixItems":"items",a=e.target==="draft-2020-12"||e.target==="openapi-3.0"?"items":"additionalItems",c=o.items.map((A,p)=>(0,Le.process)(A,e,{...n,path:[...n.path,s,p]})),u=o.rest?(0,Le.process)(o.rest,e,{...n,path:[...n.path,a,...e.target==="openapi-3.0"?[o.items.length]:[]]}):null;e.target==="draft-2020-12"?(i.prefixItems=c,u&&(i.items=u)):e.target==="openapi-3.0"?(i.items={anyOf:c},u&&i.items.anyOf.push(u),i.minItems=c.length,u||(i.maxItems=c.length)):(i.items=c,u&&(i.additionalItems=u));let{minimum:l,maximum:d}=t._zod.bag;typeof l=="number"&&(i.minItems=l),typeof d=="number"&&(i.maxItems=d)};R.tupleProcessor=Cce;var bce=(t,e,r,n)=>{let i=r,o=t._zod.def;i.type="object";let s=o.keyType,c=s._zod.bag?.patterns;if(o.mode==="loose"&&c&&c.size>0){let l=(0,Le.process)(o.valueType,e,{...n,path:[...n.path,"patternProperties","*"]});i.patternProperties={};for(let d of c)i.patternProperties[d.source]=l}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(i.propertyNames=(0,Le.process)(o.keyType,e,{...n,path:[...n.path,"propertyNames"]})),i.additionalProperties=(0,Le.process)(o.valueType,e,{...n,path:[...n.path,"additionalProperties"]});let u=s._zod.values;if(u){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(i.required=l)}};R.recordProcessor=bce;var Sce=(t,e,r,n)=>{let i=t._zod.def,o=(0,Le.process)(i.innerType,e,n),s=e.seen.get(t);e.target==="openapi-3.0"?(s.ref=i.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]};R.nullableProcessor=Sce;var wce=(t,e,r,n)=>{let i=t._zod.def;(0,Le.process)(i.innerType,e,n);let o=e.seen.get(t);o.ref=i.innerType};R.nonoptionalProcessor=wce;var Bce=(t,e,r,n)=>{let i=t._zod.def;(0,Le.process)(i.innerType,e,n);let o=e.seen.get(t);o.ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))};R.defaultProcessor=Bce;var Qce=(t,e,r,n)=>{let i=t._zod.def;(0,Le.process)(i.innerType,e,n);let o=e.seen.get(t);o.ref=i.innerType,e.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))};R.prefaultProcessor=Qce;var vce=(t,e,r,n)=>{let i=t._zod.def;(0,Le.process)(i.innerType,e,n);let o=e.seen.get(t);o.ref=i.innerType;let s;try{s=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=s};R.catchProcessor=vce;var _ce=(t,e,r,n)=>{let i=t._zod.def,o=i.in._zod.traits.has("$ZodTransform"),s=e.io==="input"?o?i.out:i.in:i.out;(0,Le.process)(s,e,n);let a=e.seen.get(t);a.ref=s};R.pipeProcessor=_ce;var Dce=(t,e,r,n)=>{let i=t._zod.def;(0,Le.process)(i.innerType,e,n);let o=e.seen.get(t);o.ref=i.innerType,r.readOnly=!0};R.readonlyProcessor=Dce;var Tce=(t,e,r,n)=>{let i=t._zod.def;(0,Le.process)(i.innerType,e,n);let o=e.seen.get(t);o.ref=i.innerType};R.promiseProcessor=Tce;var Rce=(t,e,r,n)=>{let i=t._zod.def;(0,Le.process)(i.innerType,e,n);let o=e.seen.get(t);o.ref=i.innerType};R.optionalProcessor=Rce;var kce=(t,e,r,n)=>{let i=t._zod.innerType;(0,Le.process)(i,e,n);let o=e.seen.get(t);o.ref=i};R.lazyProcessor=kce;R.allProcessors={string:R.stringProcessor,number:R.numberProcessor,boolean:R.booleanProcessor,bigint:R.bigintProcessor,symbol:R.symbolProcessor,null:R.nullProcessor,undefined:R.undefinedProcessor,void:R.voidProcessor,never:R.neverProcessor,any:R.anyProcessor,unknown:R.unknownProcessor,date:R.dateProcessor,enum:R.enumProcessor,literal:R.literalProcessor,nan:R.nanProcessor,template_literal:R.templateLiteralProcessor,file:R.fileProcessor,success:R.successProcessor,custom:R.customProcessor,function:R.functionProcessor,transform:R.transformProcessor,map:R.mapProcessor,set:R.setProcessor,array:R.arrayProcessor,object:R.objectProcessor,union:R.unionProcessor,intersection:R.intersectionProcessor,tuple:R.tupleProcessor,record:R.recordProcessor,nullable:R.nullableProcessor,nonoptional:R.nonoptionalProcessor,default:R.defaultProcessor,prefault:R.prefaultProcessor,catch:R.catchProcessor,pipe:R.pipeProcessor,readonly:R.readonlyProcessor,promise:R.promiseProcessor,optional:R.optionalProcessor,lazy:R.lazyProcessor};function Nce(t,e){if("_idmap"in t){let n=t,i=(0,Le.initializeContext)({...e,processors:R.allProcessors}),o={};for(let c of n._idmap.entries()){let[u,l]=c;(0,Le.process)(l,i)}let s={},a={registry:n,uri:e?.uri,defs:o};i.external=a;for(let c of n._idmap.entries()){let[u,l]=c;(0,Le.extractDefs)(i,l),s[u]=(0,Le.finalize)(i,l)}if(Object.keys(o).length>0){let c=i.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:o}}return{schemas:s}}let r=(0,Le.initializeContext)({...e,processors:R.allProcessors});return(0,Le.process)(t,r),(0,Le.extractDefs)(r,t),(0,Le.finalize)(r,t)}});var mU=m(Rh=>{"use strict";Object.defineProperty(Rh,"__esModule",{value:!0});Rh.JSONSchemaGenerator=void 0;var Oce=ld(),Th=ud(),qC=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(e){this.ctx.counter=e}get seen(){return this.ctx.seen}constructor(e){let r=e?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=(0,Th.initializeContext)({processors:Oce.allProcessors,target:r,...e?.metadata&&{metadata:e.metadata},...e?.unrepresentable&&{unrepresentable:e.unrepresentable},...e?.override&&{override:e.override},...e?.io&&{io:e.io}})}process(e,r={path:[],schemaPath:[]}){return(0,Th.process)(e,this.ctx,r)}emit(e,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),(0,Th.extractDefs)(this.ctx,e);let n=(0,Th.finalize)(this.ctx,e),{"~standard":i,...o}=n;return o}};Rh.JSONSchemaGenerator=qC});var EU=m(yU=>{"use strict";Object.defineProperty(yU,"__esModule",{value:!0})});var hr=m(ke=>{"use strict";var IU=ke&&ke.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Uce=ke&&ke.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Wi=ke&&ke.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&IU(e,t,r)},kh=ke&&ke.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&IU(e,t,r);return Uce(e,t),e};Object.defineProperty(ke,"__esModule",{value:!0});ke.JSONSchema=ke.JSONSchemaGenerator=ke.toJSONSchema=ke.locales=ke.regexes=ke.util=void 0;Wi(ya(),ke);Wi(vC(),ke);Wi(BC(),ke);Wi(UC(),ke);Wi(If(),ke);Wi(kC(),ke);ke.util=kh(X());ke.regexes=kh(Ef());ke.locales=kh(PC());Wi(sd(),ke);Wi(RC(),ke);Wi(gU(),ke);Wi(ud(),ke);var Mce=ld();Object.defineProperty(ke,"toJSONSchema",{enumerable:!0,get:function(){return Mce.toJSONSchema}});var xce=mU();Object.defineProperty(ke,"JSONSchemaGenerator",{enumerable:!0,get:function(){return xce.JSONSchemaGenerator}});ke.JSONSchema=kh(EU())});var Nh=m(ee=>{"use strict";Object.defineProperty(ee,"__esModule",{value:!0});ee.slugify=ee.toUpperCase=ee.toLowerCase=ee.trim=ee.normalize=ee.overwrite=ee.mime=ee.property=ee.endsWith=ee.startsWith=ee.includes=ee.uppercase=ee.lowercase=ee.regex=ee.length=ee.minLength=ee.maxLength=ee.size=ee.minSize=ee.maxSize=ee.multipleOf=ee.nonnegative=ee.nonpositive=ee.negative=ee.positive=ee.gte=ee.gt=ee.lte=ee.lt=void 0;var Pe=hr();Object.defineProperty(ee,"lt",{enumerable:!0,get:function(){return Pe._lt}});Object.defineProperty(ee,"lte",{enumerable:!0,get:function(){return Pe._lte}});Object.defineProperty(ee,"gt",{enumerable:!0,get:function(){return Pe._gt}});Object.defineProperty(ee,"gte",{enumerable:!0,get:function(){return Pe._gte}});Object.defineProperty(ee,"positive",{enumerable:!0,get:function(){return Pe._positive}});Object.defineProperty(ee,"negative",{enumerable:!0,get:function(){return Pe._negative}});Object.defineProperty(ee,"nonpositive",{enumerable:!0,get:function(){return Pe._nonpositive}});Object.defineProperty(ee,"nonnegative",{enumerable:!0,get:function(){return Pe._nonnegative}});Object.defineProperty(ee,"multipleOf",{enumerable:!0,get:function(){return Pe._multipleOf}});Object.defineProperty(ee,"maxSize",{enumerable:!0,get:function(){return Pe._maxSize}});Object.defineProperty(ee,"minSize",{enumerable:!0,get:function(){return Pe._minSize}});Object.defineProperty(ee,"size",{enumerable:!0,get:function(){return Pe._size}});Object.defineProperty(ee,"maxLength",{enumerable:!0,get:function(){return Pe._maxLength}});Object.defineProperty(ee,"minLength",{enumerable:!0,get:function(){return Pe._minLength}});Object.defineProperty(ee,"length",{enumerable:!0,get:function(){return Pe._length}});Object.defineProperty(ee,"regex",{enumerable:!0,get:function(){return Pe._regex}});Object.defineProperty(ee,"lowercase",{enumerable:!0,get:function(){return Pe._lowercase}});Object.defineProperty(ee,"uppercase",{enumerable:!0,get:function(){return Pe._uppercase}});Object.defineProperty(ee,"includes",{enumerable:!0,get:function(){return Pe._includes}});Object.defineProperty(ee,"startsWith",{enumerable:!0,get:function(){return Pe._startsWith}});Object.defineProperty(ee,"endsWith",{enumerable:!0,get:function(){return Pe._endsWith}});Object.defineProperty(ee,"property",{enumerable:!0,get:function(){return Pe._property}});Object.defineProperty(ee,"mime",{enumerable:!0,get:function(){return Pe._mime}});Object.defineProperty(ee,"overwrite",{enumerable:!0,get:function(){return Pe._overwrite}});Object.defineProperty(ee,"normalize",{enumerable:!0,get:function(){return Pe._normalize}});Object.defineProperty(ee,"trim",{enumerable:!0,get:function(){return Pe._trim}});Object.defineProperty(ee,"toLowerCase",{enumerable:!0,get:function(){return Pe._toLowerCase}});Object.defineProperty(ee,"toUpperCase",{enumerable:!0,get:function(){return Pe._toUpperCase}});Object.defineProperty(ee,"slugify",{enumerable:!0,get:function(){return Pe._slugify}})});var dd=m(rt=>{"use strict";var Lce=rt&&rt.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Pce=rt&&rt.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),CU=rt&&rt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Lce(e,t,r);return Pce(e,t),e};Object.defineProperty(rt,"__esModule",{value:!0});rt.ZodISODuration=rt.ZodISOTime=rt.ZodISODate=rt.ZodISODateTime=void 0;rt.datetime=Fce;rt.date=$ce;rt.time=jce;rt.duration=qce;var An=CU(hr()),Oh=CU(Ad());rt.ZodISODateTime=An.$constructor("ZodISODateTime",(t,e)=>{An.$ZodISODateTime.init(t,e),Oh.ZodStringFormat.init(t,e)});function Fce(t){return An._isoDateTime(rt.ZodISODateTime,t)}rt.ZodISODate=An.$constructor("ZodISODate",(t,e)=>{An.$ZodISODate.init(t,e),Oh.ZodStringFormat.init(t,e)});function $ce(t){return An._isoDate(rt.ZodISODate,t)}rt.ZodISOTime=An.$constructor("ZodISOTime",(t,e)=>{An.$ZodISOTime.init(t,e),Oh.ZodStringFormat.init(t,e)});function jce(t){return An._isoTime(rt.ZodISOTime,t)}rt.ZodISODuration=An.$constructor("ZodISODuration",(t,e)=>{An.$ZodISODuration.init(t,e),Oh.ZodStringFormat.init(t,e)});function qce(t){return An._isoDuration(rt.ZodISODuration,t)}});var zC=m(pn=>{"use strict";var zce=pn&&pn.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Hce=pn&&pn.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),SU=pn&&pn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zce(e,t,r);return Hce(e,t),e};Object.defineProperty(pn,"__esModule",{value:!0});pn.ZodRealError=pn.ZodError=void 0;var Uh=SU(hr()),Gce=hr(),bU=SU(X()),wU=(t,e)=>{Gce.$ZodError.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>Uh.formatError(t,r)},flatten:{value:r=>Uh.flattenError(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,bU.jsonStringifyReplacer,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,bU.jsonStringifyReplacer,2)}},isEmpty:{get(){return t.issues.length===0}}})};pn.ZodError=Uh.$constructor("ZodError",wU);pn.ZodRealError=Uh.$constructor("ZodError",wU,{Parent:Error})});var HC=m(Ne=>{"use strict";var Yce=Ne&&Ne.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Vce=Ne&&Ne.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Jce=Ne&&Ne.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Yce(e,t,r);return Vce(e,t),e};Object.defineProperty(Ne,"__esModule",{value:!0});Ne.safeDecodeAsync=Ne.safeEncodeAsync=Ne.safeDecode=Ne.safeEncode=Ne.decodeAsync=Ne.encodeAsync=Ne.decode=Ne.encode=Ne.safeParseAsync=Ne.safeParse=Ne.parseAsync=Ne.parse=void 0;var fn=Jce(hr()),hn=zC();Ne.parse=fn._parse(hn.ZodRealError);Ne.parseAsync=fn._parseAsync(hn.ZodRealError);Ne.safeParse=fn._safeParse(hn.ZodRealError);Ne.safeParseAsync=fn._safeParseAsync(hn.ZodRealError);Ne.encode=fn._encode(hn.ZodRealError);Ne.decode=fn._decode(hn.ZodRealError);Ne.encodeAsync=fn._encodeAsync(hn.ZodRealError);Ne.decodeAsync=fn._decodeAsync(hn.ZodRealError);Ne.safeEncode=fn._safeEncode(hn.ZodRealError);Ne.safeDecode=fn._safeDecode(hn.ZodRealError);Ne.safeEncodeAsync=fn._safeEncodeAsync(hn.ZodRealError);Ne.safeDecodeAsync=fn._safeDecodeAsync(hn.ZodRealError)});var Ad=m(f=>{"use strict";var Wce=f&&f.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Zce=f&&f.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),pd=f&&f.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Wce(e,t,r);return Zce(e,t),e};Object.defineProperty(f,"__esModule",{value:!0});f.ZodLiteral=f.ZodEnum=f.ZodSet=f.ZodMap=f.ZodRecord=f.ZodTuple=f.ZodIntersection=f.ZodDiscriminatedUnion=f.ZodXor=f.ZodUnion=f.ZodObject=f.ZodArray=f.ZodDate=f.ZodVoid=f.ZodNever=f.ZodUnknown=f.ZodAny=f.ZodNull=f.ZodUndefined=f.ZodSymbol=f.ZodBigIntFormat=f.ZodBigInt=f.ZodBoolean=f.ZodNumberFormat=f.ZodNumber=f.ZodCustomStringFormat=f.ZodJWT=f.ZodE164=f.ZodBase64URL=f.ZodBase64=f.ZodCIDRv6=f.ZodCIDRv4=f.ZodIPv6=f.ZodMAC=f.ZodIPv4=f.ZodKSUID=f.ZodXID=f.ZodULID=f.ZodCUID2=f.ZodCUID=f.ZodNanoID=f.ZodEmoji=f.ZodURL=f.ZodUUID=f.ZodGUID=f.ZodEmail=f.ZodStringFormat=f.ZodString=f._ZodString=f.ZodType=void 0;f.stringbool=f.meta=f.describe=f.ZodCustom=f.ZodFunction=f.ZodPromise=f.ZodLazy=f.ZodTemplateLiteral=f.ZodReadonly=f.ZodPreprocess=f.ZodCodec=f.ZodPipe=f.ZodNaN=f.ZodCatch=f.ZodSuccess=f.ZodNonOptional=f.ZodPrefault=f.ZodDefault=f.ZodNullable=f.ZodExactOptional=f.ZodOptional=f.ZodTransform=f.ZodFile=void 0;f.string=xh;f.email=Kce;f.guid=Xce;f.uuid=eue;f.uuidv4=tue;f.uuidv6=rue;f.uuidv7=nue;f.url=iue;f.httpUrl=oue;f.emoji=sue;f.nanoid=aue;f.cuid=cue;f.cuid2=uue;f.ulid=lue;f.xid=due;f.ksuid=Aue;f.ipv4=pue;f.mac=fue;f.ipv6=hue;f.cidrv4=gue;f.cidrv6=mue;f.base64=yue;f.base64url=Eue;f.e164=Iue;f.jwt=Cue;f.stringFormat=bue;f.hostname=Sue;f.hex=wue;f.hash=Bue;f.number=QU;f.int=YC;f.float32=Que;f.float64=vue;f.int32=_ue;f.uint32=Due;f.boolean=vU;f.bigint=Tue;f.int64=Rue;f.uint64=kue;f.symbol=Nue;f.undefined=Oue;f.null=_U;f.any=Uue;f.unknown=Jc;f.never=JC;f.void=Mue;f.date=xue;f.array=Fh;f.keyof=Lue;f.object=Pue;f.strictObject=Fue;f.looseObject=$ue;f.union=WC;f.xor=jue;f.discriminatedUnion=que;f.intersection=DU;f.tuple=TU;f.record=RU;f.partialRecord=zue;f.looseRecord=Hue;f.map=Gue;f.set=Yue;f.enum=ZC;f.nativeEnum=Vue;f.literal=Jue;f.file=Wue;f.transform=KC;f.optional=Lh;f.exactOptional=kU;f.nullable=Ph;f.nullish=Zue;f._default=NU;f.prefault=OU;f.nonoptional=UU;f.success=Kue;f.catch=MU;f.nan=Xue;f.pipe=VC;f.codec=ele;f.invertCodec=tle;f.readonly=xU;f.templateLiteral=rle;f.lazy=LU;f.promise=nle;f._function=$h;f.function=$h;f._function=$h;f.function=$h;f.check=ile;f.custom=ole;f.refine=PU;f.superRefine=FU;f.instanceof=sle;f.json=cle;f.preprocess=ule;var I=pd(hr()),Qe=hr(),be=pd(ld()),GC=ud(),ge=pd(Nh()),Mh=pd(dd()),gn=pd(HC()),BU=new WeakMap;function fd(t,e,r){let n=Object.getPrototypeOf(t),i=BU.get(n);if(i||(i=new Set,BU.set(n,i)),!i.has(e)){i.add(e);for(let o in r){let s=r[o];Object.defineProperty(n,o,{configurable:!0,enumerable:!1,get(){let a=s.bind(this);return Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}f.ZodType=I.$constructor("ZodType",(t,e)=>(I.$ZodType.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:(0,GC.createStandardJSONSchemaMethod)(t,"input"),output:(0,GC.createStandardJSONSchemaMethod)(t,"output")}}),t.toJSONSchema=(0,GC.createToJSONSchemaMethod)(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.parse=(r,n)=>gn.parse(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>gn.safeParse(t,r,n),t.parseAsync=async(r,n)=>gn.parseAsync(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>gn.safeParseAsync(t,r,n),t.spa=t.safeParseAsync,t.encode=(r,n)=>gn.encode(t,r,n),t.decode=(r,n)=>gn.decode(t,r,n),t.encodeAsync=async(r,n)=>gn.encodeAsync(t,r,n),t.decodeAsync=async(r,n)=>gn.decodeAsync(t,r,n),t.safeEncode=(r,n)=>gn.safeEncode(t,r,n),t.safeDecode=(r,n)=>gn.safeDecode(t,r,n),t.safeEncodeAsync=async(r,n)=>gn.safeEncodeAsync(t,r,n),t.safeDecodeAsync=async(r,n)=>gn.safeDecodeAsync(t,r,n),fd(t,"ZodType",{check(...r){let n=this.def;return this.clone(Qe.util.mergeDefs(n,{checks:[...n.checks??[],...r.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,n){return I.clone(this,r,n)},brand(){return this},register(r,n){return r.add(this,n),this},refine(r,n){return this.check(PU(r,n))},superRefine(r,n){return this.check(FU(r,n))},overwrite(r){return this.check(ge.overwrite(r))},optional(){return Lh(this)},exactOptional(){return kU(this)},nullable(){return Ph(this)},nullish(){return Lh(Ph(this))},nonoptional(r){return UU(this,r)},array(){return Fh(this)},or(r){return WC([this,r])},and(r){return DU(this,r)},transform(r){return VC(this,KC(r))},default(r){return NU(this,r)},prefault(r){return OU(this,r)},catch(r){return MU(this,r)},pipe(r){return VC(this,r)},readonly(){return xU(this)},describe(r){let n=this.clone();return I.globalRegistry.add(n,{description:r}),n},meta(...r){if(r.length===0)return I.globalRegistry.get(this);let n=this.clone();return I.globalRegistry.add(n,r[0]),n},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(t,"description",{get(){return I.globalRegistry.get(t)?.description},configurable:!0}),t));f._ZodString=I.$constructor("_ZodString",(t,e)=>{I.$ZodString.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(n,i,o)=>be.stringProcessor(t,n,i,o);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,fd(t,"_ZodString",{regex(...n){return this.check(ge.regex(...n))},includes(...n){return this.check(ge.includes(...n))},startsWith(...n){return this.check(ge.startsWith(...n))},endsWith(...n){return this.check(ge.endsWith(...n))},min(...n){return this.check(ge.minLength(...n))},max(...n){return this.check(ge.maxLength(...n))},length(...n){return this.check(ge.length(...n))},nonempty(...n){return this.check(ge.minLength(1,...n))},lowercase(n){return this.check(ge.lowercase(n))},uppercase(n){return this.check(ge.uppercase(n))},trim(){return this.check(ge.trim())},normalize(...n){return this.check(ge.normalize(...n))},toLowerCase(){return this.check(ge.toLowerCase())},toUpperCase(){return this.check(ge.toUpperCase())},slugify(){return this.check(ge.slugify())}})});f.ZodString=I.$constructor("ZodString",(t,e)=>{I.$ZodString.init(t,e),f._ZodString.init(t,e),t.email=r=>t.check(I._email(f.ZodEmail,r)),t.url=r=>t.check(I._url(f.ZodURL,r)),t.jwt=r=>t.check(I._jwt(f.ZodJWT,r)),t.emoji=r=>t.check(I._emoji(f.ZodEmoji,r)),t.guid=r=>t.check(I._guid(f.ZodGUID,r)),t.uuid=r=>t.check(I._uuid(f.ZodUUID,r)),t.uuidv4=r=>t.check(I._uuidv4(f.ZodUUID,r)),t.uuidv6=r=>t.check(I._uuidv6(f.ZodUUID,r)),t.uuidv7=r=>t.check(I._uuidv7(f.ZodUUID,r)),t.nanoid=r=>t.check(I._nanoid(f.ZodNanoID,r)),t.guid=r=>t.check(I._guid(f.ZodGUID,r)),t.cuid=r=>t.check(I._cuid(f.ZodCUID,r)),t.cuid2=r=>t.check(I._cuid2(f.ZodCUID2,r)),t.ulid=r=>t.check(I._ulid(f.ZodULID,r)),t.base64=r=>t.check(I._base64(f.ZodBase64,r)),t.base64url=r=>t.check(I._base64url(f.ZodBase64URL,r)),t.xid=r=>t.check(I._xid(f.ZodXID,r)),t.ksuid=r=>t.check(I._ksuid(f.ZodKSUID,r)),t.ipv4=r=>t.check(I._ipv4(f.ZodIPv4,r)),t.ipv6=r=>t.check(I._ipv6(f.ZodIPv6,r)),t.cidrv4=r=>t.check(I._cidrv4(f.ZodCIDRv4,r)),t.cidrv6=r=>t.check(I._cidrv6(f.ZodCIDRv6,r)),t.e164=r=>t.check(I._e164(f.ZodE164,r)),t.datetime=r=>t.check(Mh.datetime(r)),t.date=r=>t.check(Mh.date(r)),t.time=r=>t.check(Mh.time(r)),t.duration=r=>t.check(Mh.duration(r))});function xh(t){return I._string(f.ZodString,t)}f.ZodStringFormat=I.$constructor("ZodStringFormat",(t,e)=>{I.$ZodStringFormat.init(t,e),f._ZodString.init(t,e)});f.ZodEmail=I.$constructor("ZodEmail",(t,e)=>{I.$ZodEmail.init(t,e),f.ZodStringFormat.init(t,e)});function Kce(t){return I._email(f.ZodEmail,t)}f.ZodGUID=I.$constructor("ZodGUID",(t,e)=>{I.$ZodGUID.init(t,e),f.ZodStringFormat.init(t,e)});function Xce(t){return I._guid(f.ZodGUID,t)}f.ZodUUID=I.$constructor("ZodUUID",(t,e)=>{I.$ZodUUID.init(t,e),f.ZodStringFormat.init(t,e)});function eue(t){return I._uuid(f.ZodUUID,t)}function tue(t){return I._uuidv4(f.ZodUUID,t)}function rue(t){return I._uuidv6(f.ZodUUID,t)}function nue(t){return I._uuidv7(f.ZodUUID,t)}f.ZodURL=I.$constructor("ZodURL",(t,e)=>{I.$ZodURL.init(t,e),f.ZodStringFormat.init(t,e)});function iue(t){return I._url(f.ZodURL,t)}function oue(t){return I._url(f.ZodURL,{protocol:I.regexes.httpProtocol,hostname:I.regexes.domain,...Qe.util.normalizeParams(t)})}f.ZodEmoji=I.$constructor("ZodEmoji",(t,e)=>{I.$ZodEmoji.init(t,e),f.ZodStringFormat.init(t,e)});function sue(t){return I._emoji(f.ZodEmoji,t)}f.ZodNanoID=I.$constructor("ZodNanoID",(t,e)=>{I.$ZodNanoID.init(t,e),f.ZodStringFormat.init(t,e)});function aue(t){return I._nanoid(f.ZodNanoID,t)}f.ZodCUID=I.$constructor("ZodCUID",(t,e)=>{I.$ZodCUID.init(t,e),f.ZodStringFormat.init(t,e)});function cue(t){return I._cuid(f.ZodCUID,t)}f.ZodCUID2=I.$constructor("ZodCUID2",(t,e)=>{I.$ZodCUID2.init(t,e),f.ZodStringFormat.init(t,e)});function uue(t){return I._cuid2(f.ZodCUID2,t)}f.ZodULID=I.$constructor("ZodULID",(t,e)=>{I.$ZodULID.init(t,e),f.ZodStringFormat.init(t,e)});function lue(t){return I._ulid(f.ZodULID,t)}f.ZodXID=I.$constructor("ZodXID",(t,e)=>{I.$ZodXID.init(t,e),f.ZodStringFormat.init(t,e)});function due(t){return I._xid(f.ZodXID,t)}f.ZodKSUID=I.$constructor("ZodKSUID",(t,e)=>{I.$ZodKSUID.init(t,e),f.ZodStringFormat.init(t,e)});function Aue(t){return I._ksuid(f.ZodKSUID,t)}f.ZodIPv4=I.$constructor("ZodIPv4",(t,e)=>{I.$ZodIPv4.init(t,e),f.ZodStringFormat.init(t,e)});function pue(t){return I._ipv4(f.ZodIPv4,t)}f.ZodMAC=I.$constructor("ZodMAC",(t,e)=>{I.$ZodMAC.init(t,e),f.ZodStringFormat.init(t,e)});function fue(t){return I._mac(f.ZodMAC,t)}f.ZodIPv6=I.$constructor("ZodIPv6",(t,e)=>{I.$ZodIPv6.init(t,e),f.ZodStringFormat.init(t,e)});function hue(t){return I._ipv6(f.ZodIPv6,t)}f.ZodCIDRv4=I.$constructor("ZodCIDRv4",(t,e)=>{I.$ZodCIDRv4.init(t,e),f.ZodStringFormat.init(t,e)});function gue(t){return I._cidrv4(f.ZodCIDRv4,t)}f.ZodCIDRv6=I.$constructor("ZodCIDRv6",(t,e)=>{I.$ZodCIDRv6.init(t,e),f.ZodStringFormat.init(t,e)});function mue(t){return I._cidrv6(f.ZodCIDRv6,t)}f.ZodBase64=I.$constructor("ZodBase64",(t,e)=>{I.$ZodBase64.init(t,e),f.ZodStringFormat.init(t,e)});function yue(t){return I._base64(f.ZodBase64,t)}f.ZodBase64URL=I.$constructor("ZodBase64URL",(t,e)=>{I.$ZodBase64URL.init(t,e),f.ZodStringFormat.init(t,e)});function Eue(t){return I._base64url(f.ZodBase64URL,t)}f.ZodE164=I.$constructor("ZodE164",(t,e)=>{I.$ZodE164.init(t,e),f.ZodStringFormat.init(t,e)});function Iue(t){return I._e164(f.ZodE164,t)}f.ZodJWT=I.$constructor("ZodJWT",(t,e)=>{I.$ZodJWT.init(t,e),f.ZodStringFormat.init(t,e)});function Cue(t){return I._jwt(f.ZodJWT,t)}f.ZodCustomStringFormat=I.$constructor("ZodCustomStringFormat",(t,e)=>{I.$ZodCustomStringFormat.init(t,e),f.ZodStringFormat.init(t,e)});function bue(t,e,r={}){return I._stringFormat(f.ZodCustomStringFormat,t,e,r)}function Sue(t){return I._stringFormat(f.ZodCustomStringFormat,"hostname",I.regexes.hostname,t)}function wue(t){return I._stringFormat(f.ZodCustomStringFormat,"hex",I.regexes.hex,t)}function Bue(t,e){let r=e?.enc??"hex",n=`${t}_${r}`,i=I.regexes[n];if(!i)throw new Error(`Unrecognized hash format: ${n}`);return I._stringFormat(f.ZodCustomStringFormat,n,i,e)}f.ZodNumber=I.$constructor("ZodNumber",(t,e)=>{I.$ZodNumber.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(n,i,o)=>be.numberProcessor(t,n,i,o),fd(t,"ZodNumber",{gt(n,i){return this.check(ge.gt(n,i))},gte(n,i){return this.check(ge.gte(n,i))},min(n,i){return this.check(ge.gte(n,i))},lt(n,i){return this.check(ge.lt(n,i))},lte(n,i){return this.check(ge.lte(n,i))},max(n,i){return this.check(ge.lte(n,i))},int(n){return this.check(YC(n))},safe(n){return this.check(YC(n))},positive(n){return this.check(ge.gt(0,n))},nonnegative(n){return this.check(ge.gte(0,n))},negative(n){return this.check(ge.lt(0,n))},nonpositive(n){return this.check(ge.lte(0,n))},multipleOf(n,i){return this.check(ge.multipleOf(n,i))},step(n,i){return this.check(ge.multipleOf(n,i))},finite(){return this}});let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function QU(t){return I._number(f.ZodNumber,t)}f.ZodNumberFormat=I.$constructor("ZodNumberFormat",(t,e)=>{I.$ZodNumberFormat.init(t,e),f.ZodNumber.init(t,e)});function YC(t){return I._int(f.ZodNumberFormat,t)}function Que(t){return I._float32(f.ZodNumberFormat,t)}function vue(t){return I._float64(f.ZodNumberFormat,t)}function _ue(t){return I._int32(f.ZodNumberFormat,t)}function Due(t){return I._uint32(f.ZodNumberFormat,t)}f.ZodBoolean=I.$constructor("ZodBoolean",(t,e)=>{I.$ZodBoolean.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.booleanProcessor(t,r,n,i)});function vU(t){return I._boolean(f.ZodBoolean,t)}f.ZodBigInt=I.$constructor("ZodBigInt",(t,e)=>{I.$ZodBigInt.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(n,i,o)=>be.bigintProcessor(t,n,i,o),t.gte=(n,i)=>t.check(ge.gte(n,i)),t.min=(n,i)=>t.check(ge.gte(n,i)),t.gt=(n,i)=>t.check(ge.gt(n,i)),t.gte=(n,i)=>t.check(ge.gte(n,i)),t.min=(n,i)=>t.check(ge.gte(n,i)),t.lt=(n,i)=>t.check(ge.lt(n,i)),t.lte=(n,i)=>t.check(ge.lte(n,i)),t.max=(n,i)=>t.check(ge.lte(n,i)),t.positive=n=>t.check(ge.gt(BigInt(0),n)),t.negative=n=>t.check(ge.lt(BigInt(0),n)),t.nonpositive=n=>t.check(ge.lte(BigInt(0),n)),t.nonnegative=n=>t.check(ge.gte(BigInt(0),n)),t.multipleOf=(n,i)=>t.check(ge.multipleOf(n,i));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});function Tue(t){return I._bigint(f.ZodBigInt,t)}f.ZodBigIntFormat=I.$constructor("ZodBigIntFormat",(t,e)=>{I.$ZodBigIntFormat.init(t,e),f.ZodBigInt.init(t,e)});function Rue(t){return I._int64(f.ZodBigIntFormat,t)}function kue(t){return I._uint64(f.ZodBigIntFormat,t)}f.ZodSymbol=I.$constructor("ZodSymbol",(t,e)=>{I.$ZodSymbol.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.symbolProcessor(t,r,n,i)});function Nue(t){return I._symbol(f.ZodSymbol,t)}f.ZodUndefined=I.$constructor("ZodUndefined",(t,e)=>{I.$ZodUndefined.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.undefinedProcessor(t,r,n,i)});function Oue(t){return I._undefined(f.ZodUndefined,t)}f.ZodNull=I.$constructor("ZodNull",(t,e)=>{I.$ZodNull.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.nullProcessor(t,r,n,i)});function _U(t){return I._null(f.ZodNull,t)}f.ZodAny=I.$constructor("ZodAny",(t,e)=>{I.$ZodAny.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.anyProcessor(t,r,n,i)});function Uue(){return I._any(f.ZodAny)}f.ZodUnknown=I.$constructor("ZodUnknown",(t,e)=>{I.$ZodUnknown.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.unknownProcessor(t,r,n,i)});function Jc(){return I._unknown(f.ZodUnknown)}f.ZodNever=I.$constructor("ZodNever",(t,e)=>{I.$ZodNever.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.neverProcessor(t,r,n,i)});function JC(t){return I._never(f.ZodNever,t)}f.ZodVoid=I.$constructor("ZodVoid",(t,e)=>{I.$ZodVoid.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.voidProcessor(t,r,n,i)});function Mue(t){return I._void(f.ZodVoid,t)}f.ZodDate=I.$constructor("ZodDate",(t,e)=>{I.$ZodDate.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(n,i,o)=>be.dateProcessor(t,n,i,o),t.min=(n,i)=>t.check(ge.gte(n,i)),t.max=(n,i)=>t.check(ge.lte(n,i));let r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});function xue(t){return I._date(f.ZodDate,t)}f.ZodArray=I.$constructor("ZodArray",(t,e)=>{I.$ZodArray.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.arrayProcessor(t,r,n,i),t.element=e.element,fd(t,"ZodArray",{min(r,n){return this.check(ge.minLength(r,n))},nonempty(r){return this.check(ge.minLength(1,r))},max(r,n){return this.check(ge.maxLength(r,n))},length(r,n){return this.check(ge.length(r,n))},unwrap(){return this.element}})});function Fh(t,e){return I._array(f.ZodArray,t,e)}function Lue(t){let e=t._zod.def.shape;return ZC(Object.keys(e))}f.ZodObject=I.$constructor("ZodObject",(t,e)=>{I.$ZodObjectJIT.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.objectProcessor(t,r,n,i),Qe.util.defineLazy(t,"shape",()=>e.shape),fd(t,"ZodObject",{keyof(){return ZC(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:Jc()})},loose(){return this.clone({...this._zod.def,catchall:Jc()})},strict(){return this.clone({...this._zod.def,catchall:JC()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return Qe.util.extend(this,r)},safeExtend(r){return Qe.util.safeExtend(this,r)},merge(r){return Qe.util.merge(this,r)},pick(r){return Qe.util.pick(this,r)},omit(r){return Qe.util.omit(this,r)},partial(...r){return Qe.util.partial(f.ZodOptional,this,r[0])},required(...r){return Qe.util.required(f.ZodNonOptional,this,r[0])}})});function Pue(t,e){let r={type:"object",shape:t??{},...Qe.util.normalizeParams(e)};return new f.ZodObject(r)}function Fue(t,e){return new f.ZodObject({type:"object",shape:t,catchall:JC(),...Qe.util.normalizeParams(e)})}function $ue(t,e){return new f.ZodObject({type:"object",shape:t,catchall:Jc(),...Qe.util.normalizeParams(e)})}f.ZodUnion=I.$constructor("ZodUnion",(t,e)=>{I.$ZodUnion.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.unionProcessor(t,r,n,i),t.options=e.options});function WC(t,e){return new f.ZodUnion({type:"union",options:t,...Qe.util.normalizeParams(e)})}f.ZodXor=I.$constructor("ZodXor",(t,e)=>{f.ZodUnion.init(t,e),I.$ZodXor.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.unionProcessor(t,r,n,i),t.options=e.options});function jue(t,e){return new f.ZodXor({type:"union",options:t,inclusive:!1,...Qe.util.normalizeParams(e)})}f.ZodDiscriminatedUnion=I.$constructor("ZodDiscriminatedUnion",(t,e)=>{f.ZodUnion.init(t,e),I.$ZodDiscriminatedUnion.init(t,e)});function que(t,e,r){return new f.ZodDiscriminatedUnion({type:"union",options:e,discriminator:t,...Qe.util.normalizeParams(r)})}f.ZodIntersection=I.$constructor("ZodIntersection",(t,e)=>{I.$ZodIntersection.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.intersectionProcessor(t,r,n,i)});function DU(t,e){return new f.ZodIntersection({type:"intersection",left:t,right:e})}f.ZodTuple=I.$constructor("ZodTuple",(t,e)=>{I.$ZodTuple.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.tupleProcessor(t,r,n,i),t.rest=r=>t.clone({...t._zod.def,rest:r})});function TU(t,e,r){let n=e instanceof I.$ZodType,i=n?r:e,o=n?e:null;return new f.ZodTuple({type:"tuple",items:t,rest:o,...Qe.util.normalizeParams(i)})}f.ZodRecord=I.$constructor("ZodRecord",(t,e)=>{I.$ZodRecord.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.recordProcessor(t,r,n,i),t.keyType=e.keyType,t.valueType=e.valueType});function RU(t,e,r){return!e||!e._zod?new f.ZodRecord({type:"record",keyType:xh(),valueType:t,...Qe.util.normalizeParams(e)}):new f.ZodRecord({type:"record",keyType:t,valueType:e,...Qe.util.normalizeParams(r)})}function zue(t,e,r){let n=I.clone(t);return n._zod.values=void 0,new f.ZodRecord({type:"record",keyType:n,valueType:e,...Qe.util.normalizeParams(r)})}function Hue(t,e,r){return new f.ZodRecord({type:"record",keyType:t,valueType:e,mode:"loose",...Qe.util.normalizeParams(r)})}f.ZodMap=I.$constructor("ZodMap",(t,e)=>{I.$ZodMap.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.mapProcessor(t,r,n,i),t.keyType=e.keyType,t.valueType=e.valueType,t.min=(...r)=>t.check(I._minSize(...r)),t.nonempty=r=>t.check(I._minSize(1,r)),t.max=(...r)=>t.check(I._maxSize(...r)),t.size=(...r)=>t.check(I._size(...r))});function Gue(t,e,r){return new f.ZodMap({type:"map",keyType:t,valueType:e,...Qe.util.normalizeParams(r)})}f.ZodSet=I.$constructor("ZodSet",(t,e)=>{I.$ZodSet.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.setProcessor(t,r,n,i),t.min=(...r)=>t.check(I._minSize(...r)),t.nonempty=r=>t.check(I._minSize(1,r)),t.max=(...r)=>t.check(I._maxSize(...r)),t.size=(...r)=>t.check(I._size(...r))});function Yue(t,e){return new f.ZodSet({type:"set",valueType:t,...Qe.util.normalizeParams(e)})}f.ZodEnum=I.$constructor("ZodEnum",(t,e)=>{I.$ZodEnum.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(n,i,o)=>be.enumProcessor(t,n,i,o),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,i)=>{let o={};for(let s of n)if(r.has(s))o[s]=e.entries[s];else throw new Error(`Key ${s} not found in enum`);return new f.ZodEnum({...e,checks:[],...Qe.util.normalizeParams(i),entries:o})},t.exclude=(n,i)=>{let o={...e.entries};for(let s of n)if(r.has(s))delete o[s];else throw new Error(`Key ${s} not found in enum`);return new f.ZodEnum({...e,checks:[],...Qe.util.normalizeParams(i),entries:o})}});function ZC(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new f.ZodEnum({type:"enum",entries:r,...Qe.util.normalizeParams(e)})}function Vue(t,e){return new f.ZodEnum({type:"enum",entries:t,...Qe.util.normalizeParams(e)})}f.ZodLiteral=I.$constructor("ZodLiteral",(t,e)=>{I.$ZodLiteral.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.literalProcessor(t,r,n,i),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function Jue(t,e){return new f.ZodLiteral({type:"literal",values:Array.isArray(t)?t:[t],...Qe.util.normalizeParams(e)})}f.ZodFile=I.$constructor("ZodFile",(t,e)=>{I.$ZodFile.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.fileProcessor(t,r,n,i),t.min=(r,n)=>t.check(I._minSize(r,n)),t.max=(r,n)=>t.check(I._maxSize(r,n)),t.mime=(r,n)=>t.check(I._mime(Array.isArray(r)?r:[r],n))});function Wue(t){return I._file(f.ZodFile,t)}f.ZodTransform=I.$constructor("ZodTransform",(t,e)=>{I.$ZodTransform.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.transformProcessor(t,r,n,i),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new I.$ZodEncodeError(t.constructor.name);r.addIssue=o=>{if(typeof o=="string")r.issues.push(Qe.util.issue(o,r.value,e));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=t),r.issues.push(Qe.util.issue(s))}};let i=e.transform(r.value,r);return i instanceof Promise?i.then(o=>(r.value=o,r.fallback=!0,r)):(r.value=i,r.fallback=!0,r)}});function KC(t){return new f.ZodTransform({type:"transform",transform:t})}f.ZodOptional=I.$constructor("ZodOptional",(t,e)=>{I.$ZodOptional.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.optionalProcessor(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});function Lh(t){return new f.ZodOptional({type:"optional",innerType:t})}f.ZodExactOptional=I.$constructor("ZodExactOptional",(t,e)=>{I.$ZodExactOptional.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.optionalProcessor(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});function kU(t){return new f.ZodExactOptional({type:"optional",innerType:t})}f.ZodNullable=I.$constructor("ZodNullable",(t,e)=>{I.$ZodNullable.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.nullableProcessor(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});function Ph(t){return new f.ZodNullable({type:"nullable",innerType:t})}function Zue(t){return Lh(Ph(t))}f.ZodDefault=I.$constructor("ZodDefault",(t,e)=>{I.$ZodDefault.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.defaultProcessor(t,r,n,i),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function NU(t,e){return new f.ZodDefault({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():Qe.util.shallowClone(e)}})}f.ZodPrefault=I.$constructor("ZodPrefault",(t,e)=>{I.$ZodPrefault.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.prefaultProcessor(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});function OU(t,e){return new f.ZodPrefault({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():Qe.util.shallowClone(e)}})}f.ZodNonOptional=I.$constructor("ZodNonOptional",(t,e)=>{I.$ZodNonOptional.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.nonoptionalProcessor(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});function UU(t,e){return new f.ZodNonOptional({type:"nonoptional",innerType:t,...Qe.util.normalizeParams(e)})}f.ZodSuccess=I.$constructor("ZodSuccess",(t,e)=>{I.$ZodSuccess.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.successProcessor(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});function Kue(t){return new f.ZodSuccess({type:"success",innerType:t})}f.ZodCatch=I.$constructor("ZodCatch",(t,e)=>{I.$ZodCatch.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.catchProcessor(t,r,n,i),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function MU(t,e){return new f.ZodCatch({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}f.ZodNaN=I.$constructor("ZodNaN",(t,e)=>{I.$ZodNaN.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.nanProcessor(t,r,n,i)});function Xue(t){return I._nan(f.ZodNaN,t)}f.ZodPipe=I.$constructor("ZodPipe",(t,e)=>{I.$ZodPipe.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.pipeProcessor(t,r,n,i),t.in=e.in,t.out=e.out});function VC(t,e){return new f.ZodPipe({type:"pipe",in:t,out:e})}f.ZodCodec=I.$constructor("ZodCodec",(t,e)=>{f.ZodPipe.init(t,e),I.$ZodCodec.init(t,e)});function ele(t,e,r){return new f.ZodCodec({type:"pipe",in:t,out:e,transform:r.decode,reverseTransform:r.encode})}function tle(t){let e=t._zod.def;return new f.ZodCodec({type:"pipe",in:e.out,out:e.in,transform:e.reverseTransform,reverseTransform:e.transform})}f.ZodPreprocess=I.$constructor("ZodPreprocess",(t,e)=>{f.ZodPipe.init(t,e),I.$ZodPreprocess.init(t,e)});f.ZodReadonly=I.$constructor("ZodReadonly",(t,e)=>{I.$ZodReadonly.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.readonlyProcessor(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});function xU(t){return new f.ZodReadonly({type:"readonly",innerType:t})}f.ZodTemplateLiteral=I.$constructor("ZodTemplateLiteral",(t,e)=>{I.$ZodTemplateLiteral.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.templateLiteralProcessor(t,r,n,i)});function rle(t,e){return new f.ZodTemplateLiteral({type:"template_literal",parts:t,...Qe.util.normalizeParams(e)})}f.ZodLazy=I.$constructor("ZodLazy",(t,e)=>{I.$ZodLazy.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.lazyProcessor(t,r,n,i),t.unwrap=()=>t._zod.def.getter()});function LU(t){return new f.ZodLazy({type:"lazy",getter:t})}f.ZodPromise=I.$constructor("ZodPromise",(t,e)=>{I.$ZodPromise.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.promiseProcessor(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});function nle(t){return new f.ZodPromise({type:"promise",innerType:t})}f.ZodFunction=I.$constructor("ZodFunction",(t,e)=>{I.$ZodFunction.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.functionProcessor(t,r,n,i)});function $h(t){return new f.ZodFunction({type:"function",input:Array.isArray(t?.input)?TU(t?.input):t?.input??Fh(Jc()),output:t?.output??Jc()})}f.ZodCustom=I.$constructor("ZodCustom",(t,e)=>{I.$ZodCustom.init(t,e),f.ZodType.init(t,e),t._zod.processJSONSchema=(r,n,i)=>be.customProcessor(t,r,n,i)});function ile(t){let e=new I.$ZodCheck({check:"custom"});return e._zod.check=t,e}function ole(t,e){return I._custom(f.ZodCustom,t??(()=>!0),e)}function PU(t,e={}){return I._refine(f.ZodCustom,t,e)}function FU(t,e){return I._superRefine(t,e)}f.describe=I.describe;f.meta=I.meta;function sle(t,e={}){let r=new f.ZodCustom({type:"custom",check:"custom",fn:n=>n instanceof t,abort:!0,...Qe.util.normalizeParams(e)});return r._zod.bag.Class=t,r._zod.check=n=>{n.value instanceof t||n.issues.push({code:"invalid_type",expected:t.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}var ale=(...t)=>I._stringbool({Codec:f.ZodCodec,Boolean:f.ZodBoolean,String:f.ZodString},...t);f.stringbool=ale;function cle(t){let e=LU(()=>WC([xh(t),QU(),vU(),_U(),Fh(e),RU(xh(),e)]));return e}function ule(t,e){return new f.ZodPreprocess({type:"pipe",in:KC(t),out:e})}});var zU=m(Nt=>{"use strict";var lle=Nt&&Nt.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),dle=Nt&&Nt.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Ale=Nt&&Nt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lle(e,t,r);return dle(e,t),e};Object.defineProperty(Nt,"__esModule",{value:!0});Nt.ZodFirstPartyTypeKind=Nt.config=Nt.$brand=Nt.ZodIssueCode=void 0;Nt.setErrorMap=ple;Nt.getErrorMap=fle;var jU=Ale(hr());Nt.ZodIssueCode={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var qU=hr();Object.defineProperty(Nt,"$brand",{enumerable:!0,get:function(){return qU.$brand}});Object.defineProperty(Nt,"config",{enumerable:!0,get:function(){return qU.config}});function ple(t){jU.config({customError:t})}function fle(){return jU.config().customError}var $U;$U||(Nt.ZodFirstPartyTypeKind=$U={})});var GU=m(vo=>{"use strict";var hle=vo&&vo.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),gle=vo&&vo.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),XC=vo&&vo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&hle(e,t,r);return gle(e,t),e};Object.defineProperty(vo,"__esModule",{value:!0});vo.fromJSONSchema=wle;var mle=sd(),yle=XC(Nh()),Ele=XC(dd()),Ile=XC(Ad()),z={...Ile,...yle,iso:Ele},Cle=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function ble(t,e){let r=t.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":e??"draft-2020-12"}function Sle(t,e){if(!t.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=t.slice(1).split("/").filter(Boolean);if(r.length===0)return e.rootSchema;let n=e.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===n){let i=r[1];if(!i||!e.defs[i])throw new Error(`Reference not found: ${t}`);return e.defs[i]}throw new Error(`Reference not found: ${t}`)}function HU(t,e){if(t.not!==void 0){if(typeof t.not=="object"&&Object.keys(t.not).length===0)return z.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(t.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(t.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(t.if!==void 0||t.then!==void 0||t.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(t.dependentSchemas!==void 0||t.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(t.$ref){let i=t.$ref;if(e.refs.has(i))return e.refs.get(i);if(e.processing.has(i))return z.lazy(()=>{if(!e.refs.has(i))throw new Error(`Circular reference not resolved: ${i}`);return e.refs.get(i)});e.processing.add(i);let o=Sle(i,e),s=Ht(o,e);return e.refs.set(i,s),e.processing.delete(i),s}if(t.enum!==void 0){let i=t.enum;if(e.version==="openapi-3.0"&&t.nullable===!0&&i.length===1&&i[0]===null)return z.null();if(i.length===0)return z.never();if(i.length===1)return z.literal(i[0]);if(i.every(s=>typeof s=="string"))return z.enum(i);let o=i.map(s=>z.literal(s));return o.length<2?o[0]:z.union([o[0],o[1],...o.slice(2)])}if(t.const!==void 0)return z.literal(t.const);let r=t.type;if(Array.isArray(r)){let i=r.map(o=>{let s={...t,type:o};return HU(s,e)});return i.length===0?z.never():i.length===1?i[0]:z.union(i)}if(!r)return z.any();let n;switch(r){case"string":{let i=z.string();if(t.format){let o=t.format;o==="email"?i=i.check(z.email()):o==="uri"||o==="uri-reference"?i=i.check(z.url()):o==="uuid"||o==="guid"?i=i.check(z.uuid()):o==="date-time"?i=i.check(z.iso.datetime()):o==="date"?i=i.check(z.iso.date()):o==="time"?i=i.check(z.iso.time()):o==="duration"?i=i.check(z.iso.duration()):o==="ipv4"?i=i.check(z.ipv4()):o==="ipv6"?i=i.check(z.ipv6()):o==="mac"?i=i.check(z.mac()):o==="cidr"?i=i.check(z.cidrv4()):o==="cidr-v6"?i=i.check(z.cidrv6()):o==="base64"?i=i.check(z.base64()):o==="base64url"?i=i.check(z.base64url()):o==="e164"?i=i.check(z.e164()):o==="jwt"?i=i.check(z.jwt()):o==="emoji"?i=i.check(z.emoji()):o==="nanoid"?i=i.check(z.nanoid()):o==="cuid"?i=i.check(z.cuid()):o==="cuid2"?i=i.check(z.cuid2()):o==="ulid"?i=i.check(z.ulid()):o==="xid"?i=i.check(z.xid()):o==="ksuid"&&(i=i.check(z.ksuid()))}typeof t.minLength=="number"&&(i=i.min(t.minLength)),typeof t.maxLength=="number"&&(i=i.max(t.maxLength)),t.pattern&&(i=i.regex(new RegExp(t.pattern))),n=i;break}case"number":case"integer":{let i=r==="integer"?z.number().int():z.number();typeof t.minimum=="number"&&(i=i.min(t.minimum)),typeof t.maximum=="number"&&(i=i.max(t.maximum)),typeof t.exclusiveMinimum=="number"?i=i.gt(t.exclusiveMinimum):t.exclusiveMinimum===!0&&typeof t.minimum=="number"&&(i=i.gt(t.minimum)),typeof t.exclusiveMaximum=="number"?i=i.lt(t.exclusiveMaximum):t.exclusiveMaximum===!0&&typeof t.maximum=="number"&&(i=i.lt(t.maximum)),typeof t.multipleOf=="number"&&(i=i.multipleOf(t.multipleOf)),n=i;break}case"boolean":{n=z.boolean();break}case"null":{n=z.null();break}case"object":{let i={},o=t.properties||{},s=new Set(t.required||[]);for(let[c,u]of Object.entries(o)){let l=Ht(u,e);i[c]=s.has(c)?l:l.optional()}if(t.propertyNames){let c=Ht(t.propertyNames,e),u=t.additionalProperties&&typeof t.additionalProperties=="object"?Ht(t.additionalProperties,e):z.any();if(Object.keys(i).length===0){n=z.record(c,u);break}let l=z.object(i).passthrough(),d=z.looseRecord(c,u);n=z.intersection(l,d);break}if(t.patternProperties){let c=t.patternProperties,u=Object.keys(c),l=[];for(let A of u){let p=Ht(c[A],e),h=z.string().regex(new RegExp(A));l.push(z.looseRecord(h,p))}let d=[];if(Object.keys(i).length>0&&d.push(z.object(i).passthrough()),d.push(...l),d.length===0)n=z.object({}).passthrough();else if(d.length===1)n=d[0];else{let A=z.intersection(d[0],d[1]);for(let p=2;p<d.length;p++)A=z.intersection(A,d[p]);n=A}break}let a=z.object(i);t.additionalProperties===!1?n=a.strict():typeof t.additionalProperties=="object"?n=a.catchall(Ht(t.additionalProperties,e)):n=a.passthrough();break}case"array":{let i=t.prefixItems,o=t.items;if(i&&Array.isArray(i)){let s=i.map(c=>Ht(c,e)),a=o&&typeof o=="object"&&!Array.isArray(o)?Ht(o,e):void 0;a?n=z.tuple(s).rest(a):n=z.tuple(s),typeof t.minItems=="number"&&(n=n.check(z.minLength(t.minItems))),typeof t.maxItems=="number"&&(n=n.check(z.maxLength(t.maxItems)))}else if(Array.isArray(o)){let s=o.map(c=>Ht(c,e)),a=t.additionalItems&&typeof t.additionalItems=="object"?Ht(t.additionalItems,e):void 0;a?n=z.tuple(s).rest(a):n=z.tuple(s),typeof t.minItems=="number"&&(n=n.check(z.minLength(t.minItems))),typeof t.maxItems=="number"&&(n=n.check(z.maxLength(t.maxItems)))}else if(o!==void 0){let s=Ht(o,e),a=z.array(s);typeof t.minItems=="number"&&(a=a.min(t.minItems)),typeof t.maxItems=="number"&&(a=a.max(t.maxItems)),n=a}else n=z.array(z.any());break}default:throw new Error(`Unsupported type: ${r}`)}return n}function Ht(t,e){if(typeof t=="boolean")return t?z.any():z.never();let r=HU(t,e),n=t.type||t.enum!==void 0||t.const!==void 0;if(t.anyOf&&Array.isArray(t.anyOf)){let a=t.anyOf.map(u=>Ht(u,e)),c=z.union(a);r=n?z.intersection(r,c):c}if(t.oneOf&&Array.isArray(t.oneOf)){let a=t.oneOf.map(u=>Ht(u,e)),c=z.xor(a);r=n?z.intersection(r,c):c}if(t.allOf&&Array.isArray(t.allOf))if(t.allOf.length===0)r=n?r:z.any();else{let a=n?r:Ht(t.allOf[0],e),c=n?0:1;for(let u=c;u<t.allOf.length;u++)a=z.intersection(a,Ht(t.allOf[u],e));r=a}t.nullable===!0&&e.version==="openapi-3.0"&&(r=z.nullable(r)),t.readOnly===!0&&(r=z.readonly(r)),t.default!==void 0&&(r=r.default(t.default));let i={},o=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of o)a in t&&(i[a]=t[a]);let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)a in t&&(i[a]=t[a]);for(let a of Object.keys(t))Cle.has(a)||(i[a]=t[a]);return Object.keys(i).length>0&&e.registry.add(r,i),t.description&&(r=r.describe(t.description)),r}function wle(t,e){if(typeof t=="boolean")return t?z.any():z.never();let r;try{r=JSON.parse(JSON.stringify(t))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let n=ble(r,e?.defaultTarget),i=r.$defs||r.definitions||{},o={version:n,defs:i,refs:new Map,processing:new Set,rootSchema:r,registry:e?.registry??mle.globalRegistry};return Ht(r,o)}});var VU=m(Ur=>{"use strict";var Ble=Ur&&Ur.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Qle=Ur&&Ur.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),YU=Ur&&Ur.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ble(e,t,r);return Qle(e,t),e};Object.defineProperty(Ur,"__esModule",{value:!0});Ur.string=vle;Ur.number=_le;Ur.boolean=Dle;Ur.bigint=Tle;Ur.date=Rle;var hd=YU(hr()),gd=YU(Ad());function vle(t){return hd._coercedString(gd.ZodString,t)}function _le(t){return hd._coercedNumber(gd.ZodNumber,t)}function Dle(t){return hd._coercedBoolean(gd.ZodBoolean,t)}function Tle(t){return hd._coercedBigint(gd.ZodBigInt,t)}function Rle(t){return hd._coercedDate(gd.ZodDate,t)}});var eb=m(J=>{"use strict";var JU=J&&J.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),kle=J&&J.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),jh=J&&J.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&JU(e,t,r);return kle(e,t),e},md=J&&J.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&JU(e,t,r)},Nle=J&&J.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(J,"__esModule",{value:!0});J.coerce=J.iso=J.ZodISODuration=J.ZodISOTime=J.ZodISODate=J.ZodISODateTime=J.locales=J.fromJSONSchema=J.toJSONSchema=J.NEVER=J.util=J.TimePrecision=J.flattenError=J.formatError=J.prettifyError=J.treeifyError=J.regexes=J.clone=J.$brand=J.$input=J.$output=J.config=J.registry=J.globalRegistry=J.core=void 0;J.core=jh(hr());md(Ad(),J);md(Nh(),J);md(zC(),J);md(HC(),J);md(zU(),J);var Ole=hr(),Ule=Nle(MC());(0,Ole.config)((0,Ule.default)());var nr=hr();Object.defineProperty(J,"globalRegistry",{enumerable:!0,get:function(){return nr.globalRegistry}});Object.defineProperty(J,"registry",{enumerable:!0,get:function(){return nr.registry}});Object.defineProperty(J,"config",{enumerable:!0,get:function(){return nr.config}});Object.defineProperty(J,"$output",{enumerable:!0,get:function(){return nr.$output}});Object.defineProperty(J,"$input",{enumerable:!0,get:function(){return nr.$input}});Object.defineProperty(J,"$brand",{enumerable:!0,get:function(){return nr.$brand}});Object.defineProperty(J,"clone",{enumerable:!0,get:function(){return nr.clone}});Object.defineProperty(J,"regexes",{enumerable:!0,get:function(){return nr.regexes}});Object.defineProperty(J,"treeifyError",{enumerable:!0,get:function(){return nr.treeifyError}});Object.defineProperty(J,"prettifyError",{enumerable:!0,get:function(){return nr.prettifyError}});Object.defineProperty(J,"formatError",{enumerable:!0,get:function(){return nr.formatError}});Object.defineProperty(J,"flattenError",{enumerable:!0,get:function(){return nr.flattenError}});Object.defineProperty(J,"TimePrecision",{enumerable:!0,get:function(){return nr.TimePrecision}});Object.defineProperty(J,"util",{enumerable:!0,get:function(){return nr.util}});Object.defineProperty(J,"NEVER",{enumerable:!0,get:function(){return nr.NEVER}});var Mle=ld();Object.defineProperty(J,"toJSONSchema",{enumerable:!0,get:function(){return Mle.toJSONSchema}});var xle=GU();Object.defineProperty(J,"fromJSONSchema",{enumerable:!0,get:function(){return xle.fromJSONSchema}});J.locales=jh(PC());var qh=dd();Object.defineProperty(J,"ZodISODateTime",{enumerable:!0,get:function(){return qh.ZodISODateTime}});Object.defineProperty(J,"ZodISODate",{enumerable:!0,get:function(){return qh.ZodISODate}});Object.defineProperty(J,"ZodISOTime",{enumerable:!0,get:function(){return qh.ZodISOTime}});Object.defineProperty(J,"ZodISODuration",{enumerable:!0,get:function(){return qh.ZodISODuration}});J.iso=jh(dd());J.coerce=jh(VU())});var tb=m(gr=>{"use strict";var WU=gr&&gr.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Lle=gr&&gr.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Ple=gr&&gr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&WU(e,t,r);return Lle(e,t),e},Fle=gr&&gr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&WU(e,t,r)};Object.defineProperty(gr,"__esModule",{value:!0});gr.z=void 0;var ZU=Ple(eb());gr.z=ZU;Fle(eb(),gr);gr.default=ZU});var rb=m(_o=>{"use strict";Object.defineProperty(_o,"__esModule",{value:!0});_o.PROJECT_LIMITS=_o.PROJECT_TASK_STATUSES=_o.PROJECT_RESOURCE_TYPES=void 0;_o.projectResourceKey=$le;_o.PROJECT_RESOURCE_TYPES=["system","playbook","artifact","file","tool"];_o.PROJECT_TASK_STATUSES=["not_started","in_progress","waiting","done"];_o.PROJECT_LIMITS={name:80,description:500,taskName:120,taskDescription:1e4,taskResources:100};function $le(t){return`${t.type}:${t.id}`}});var zh=m(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.RESOURCE_KINDS=Mr.RESOURCE_DEFINITIONS=void 0;Mr.isResourceKind=jle;Mr.getResourceDefinition=qle;Mr.getResourceAppPath=zle;Mr.RESOURCE_DEFINITIONS={tool:{label:"Tool",pluralLabel:"Tools",collectionKey:"tools",appPath:"/tools",hasDetailPage:!0,memberDefaultPermission:"editor",pickerDefaultPermission:"editor"},system:{label:"System",pluralLabel:"Systems",collectionKey:"systems",appPath:"/systems",hasDetailPage:!0,memberDefaultPermission:"editor",pickerDefaultPermission:"editor"},credential:{label:"Credential",pluralLabel:"Credentials",collectionKey:"credentials",appPath:"/credentials",hasDetailPage:!1,pickerDefaultPermission:"viewer"},playbook:{label:"Playbook",pluralLabel:"Playbooks",collectionKey:"playbooks",appPath:"/playbooks",hasDetailPage:!0,pickerDefaultPermission:"editor"},artifact:{label:"Artifact",pluralLabel:"Artifacts",collectionKey:"artifacts",appPath:"/artifacts",hasDetailPage:!0,pickerDefaultPermission:"editor"},file:{label:"File",pluralLabel:"Files",collectionKey:"files",appPath:"/files",hasDetailPage:!1,pickerDefaultPermission:"viewer"},project:{label:"Project",pluralLabel:"Projects",collectionKey:"projects",appPath:"/projects",hasDetailPage:!0,pickerDefaultPermission:"viewer"}};Mr.RESOURCE_KINDS=Object.keys(Mr.RESOURCE_DEFINITIONS);function jle(t){return typeof t=="string"&&Object.prototype.hasOwnProperty.call(Mr.RESOURCE_DEFINITIONS,t)}function qle(t){return Mr.RESOURCE_DEFINITIONS[t]}function zle(t,e){let r=Mr.RESOURCE_DEFINITIONS[t];return r.hasDetailPage?`${r.appPath}/${encodeURIComponent(e)}`:r.appPath}});var tM=m(Ea=>{"use strict";Object.defineProperty(Ea,"__esModule",{value:!0});Ea.SDK_ERROR_DETAILS_SCHEMA=Ea.SDK_OUTPUT_CONTRACTS=void 0;Ea.toSdkJsonSchema=Vle;var b=tb(),Hle=rb(),Gle=zh(),Yle=dr();function Vle({schema:t}){return b.z.toJSONSchema(t,{target:"draft-7",io:"output",unrepresentable:"any"})}var KU=b.z.looseObject({statusCode:b.z.number(),headers:b.z.record(b.z.string(),b.z.union([b.z.string(),b.z.array(b.z.string())])),omittedHeaderCount:b.z.number().optional()}),XU=b.z.looseObject({vfsPath:b.z.string(),storedBytes:b.z.number(),originalOutputBytes:b.z.number(),storageTruncated:b.z.boolean()}),eM=b.z.object({action:b.z.enum(["approve","reject","oauth_success","oauth_failure"]),source:b.z.enum(["user","automatic"])});function ps(t){return b.z.looseObject({toolCallId:b.z.string(),toolName:b.z.string(),outcome:b.z.literal("success"),confirmation:eM.optional(),data:t})}var nb={http:KU.optional(),credential:b.z.looseObject({id:b.z.string(),name:b.z.string(),isOwner:b.z.boolean()}).optional().describe("The credential the call ran with."),auth:b.z.looseObject({applied:b.z.enum(["bearer","basic","explicit","none","unavailable"]),header:b.z.string().optional(),placeholders:b.z.array(b.z.string()),reason:b.z.string().optional()}).optional().describe("How authentication was sent: a default Bearer or Basic header, the request's own explicit placeholders, none, or unavailable with the reason. placeholders lists the credential's <<systemId_secretName>> strings."),credentialPlaceholders:b.z.looseObject({keys:b.z.array(b.z.string()),resolved:b.z.boolean()}).optional()},Jle=b.z.discriminatedUnion("protocol",[b.z.looseObject({protocol:b.z.enum(["postgres","odbc"]),data:b.z.array(b.z.record(b.z.string(),b.z.unknown())).describe("Returned database rows."),...nb}),b.z.looseObject({protocol:b.z.literal("mssql"),data:b.z.union([b.z.array(b.z.record(b.z.string(),b.z.unknown())),b.z.array(b.z.array(b.z.record(b.z.string(),b.z.unknown()))),b.z.looseObject({rowsAffected:b.z.array(b.z.number())})]).describe("One recordset, multiple recordsets, or affected row counts."),...nb}),b.z.looseObject({protocol:b.z.enum(Yle.CONNECTION_PROTOCOLS.filter(t=>t!=="postgres"&&t!=="mssql"&&t!=="odbc")),data:b.z.unknown().describe("Complete protocol response payload. Preserve sibling fields, including files and metadata; do not unwrap a nested data field."),...nb})]),Wle=b.z.union([b.z.looseObject({tools:b.z.array(b.z.unknown()).describe("All tools from every tools/list page, each with name and inputSchema.")}),b.z.looseObject({result:b.z.looseObject({content:b.z.array(b.z.unknown()).optional(),structuredContent:b.z.unknown().optional(),isError:b.z.boolean().optional()}).describe("The tools/call result with content blocks and optional structuredContent.")})]),Zle=b.z.looseObject({stepId:b.z.string(),success:b.z.boolean(),data:b.z.unknown().optional(),error:b.z.string().nullable().optional(),http:KU.optional(),stepFileKeys:b.z.array(b.z.string()).optional()}),Kle=b.z.looseObject({toolId:b.z.string(),success:b.z.boolean(),run:b.z.looseObject({id:b.z.string()}).optional(),data:b.z.unknown().optional().describe("Tool output, determined by its output transform."),error:b.z.string().optional(),stepResults:b.z.array(Zle),fileArtifacts:b.z.array(b.z.looseObject({fileKey:b.z.string(),filename:b.z.string(),contentType:b.z.string(),size:b.z.number(),downloadUrl:b.z.string().optional()})).optional(),warnings:b.z.array(b.z.string()).optional(),inputSchema:b.z.unknown().optional(),resultMetadata:XU.optional()}),Xle=ps(b.z.looseObject({resource:b.z.looseObject({id:b.z.string(),name:b.z.string().optional(),version:b.z.union([b.z.number(),b.z.string()]).optional()}),created:b.z.boolean(),projectId:b.z.string().optional(),addedFiles:b.z.array(b.z.looseObject({id:b.z.string(),fileName:b.z.string()})).optional(),projectAttribution:b.z.looseObject({attached:b.z.boolean(),projectId:b.z.string(),projectName:b.z.string().optional(),resource:b.z.looseObject({type:b.z.enum(Hle.PROJECT_RESOURCE_TYPES),id:b.z.string()}),error:b.z.string().optional()}).optional()}));Ea.SDK_OUTPUT_CONTRACTS={assignSessionToProject:{name:"SuperglueSessionProjectResult",schema:ps(b.z.object({sessionId:b.z.string(),projectId:b.z.string().nullable()})),description:"Returns the saved session ID and project ID, or null when unassigned. Throws SuperglueError on failure."},callSystem:{name:"SuperglueCallSystemResult",schema:Jle,description:"Returns the complete protocol payload in data, available HTTP metadata, the credential used, and how authentication was sent. Throws SuperglueError on failure; details contains the canonical result and unprojected execution output."},callMcp:{name:"SuperglueCallMcpResult",schema:Wle,description:"Returns { tools } when tool is omitted, or { result } from tools/call. Throws SuperglueError on HTTP, JSON-RPC, or result.isError failures; details.result.data contains statusCode, rpcError, or the failed result."},runTool:{name:"SuperglueRunToolResult",schema:Kle,description:"Returns successful tool output, step results, files, and available result reference. Throws SuperglueError on failure; details.result.data preserves this result shape with success: false, the error, and available run and step results. details.resultMetadata references the saved failed result when available."},writeResource:{name:"SuperglueWriteResult",schema:Xle,description:"Returns saved resource identity, creation status, and available project attribution or added files. Throws SuperglueError on failure."},installBundle:{name:"SuperglueBundleInstallResult",schema:ps(b.z.looseObject({bundleId:b.z.string(),system:b.z.looseObject({id:b.z.string(),name:b.z.string(),requiredCredentialKeys:b.z.array(b.z.string()),hasUserCredentials:b.z.boolean()}),tools:b.z.array(b.z.looseObject({id:b.z.string(),name:b.z.string().optional()})),mcpServer:b.z.looseObject({id:b.z.string(),name:b.z.string()}).optional(),playbook:b.z.looseObject({id:b.z.string(),name:b.z.string()}).optional()})),description:"Returns the installed system, tool, MCP server, and playbook identities, the secret names the user must supply, and whether the user has a complete credential. Throws SuperglueError on failure."},setToolState:{name:"SuperglueToolStateResult",schema:ps(b.z.looseObject({resource:b.z.looseObject({id:b.z.string()}),action:b.z.enum(["set","reset"])})),description:"Returns the saved tool identity and state action. Throws SuperglueError on failure."},shareResource:{name:"SuperglueShareResult",schema:ps(b.z.looseObject({resource:b.z.looseObject({kind:b.z.enum(Gle.RESOURCE_KINDS),id:b.z.string()})})),description:"Returns the shared resource identity. Throws SuperglueError on failure."},notifyUser:{name:"SuperglueNotifyResult",schema:ps(b.z.looseObject({actionCount:b.z.number()})),description:"Returns the notification action count. Throws SuperglueError on failure."},writeOrgSettings:{name:"SuperglueOrgSettingsResult",schema:ps(b.z.looseObject({updated:b.z.array(b.z.enum(["name","logo","brandGuidelines","preferences","notifications"])),notificationTest:b.z.looseObject({channel:b.z.enum(["slack","email"]),sent:b.z.boolean(),error:b.z.string().optional()}).optional()})),description:"Returns updated settings and any notification test result. Throws SuperglueError on failure."},readQbm:{name:"SuperglueReadQbmResult",schema:ps(b.z.looseObject({folder:b.z.string(),objects:b.z.array(b.z.looseObject({type:b.z.string(),files:b.z.array(b.z.string()),records:b.z.number()})),rawTables:b.z.array(b.z.looseObject({table:b.z.string(),files:b.z.array(b.z.string()),rows:b.z.number()})),encryptedValues:b.z.array(b.z.looseObject({table:b.z.string(),column:b.z.string(),values:b.z.number()})),unmappedCodes:b.z.array(b.z.looseObject({field:b.z.string(),code:b.z.string(),records:b.z.number()})).optional(),attachments:b.z.looseObject({documents:b.z.number(),note:b.z.string()}).optional(),rejectedRows:b.z.array(b.z.looseObject({table:b.z.string(),rows:b.z.number()})).optional()})),description:"Returns the folder that holds the extracted files, record counts per object type and raw table, encrypted columns, codes the reader cannot decode, and expected attachments. The folder also holds coverage.json.raw with the same summary plus the mapped source tables. Throws SuperglueError on failure."},previewArtifact:{name:"SuperglueArtifactPreviewResult",schema:b.z.looseObject({draftId:b.z.string(),bytes:b.z.number()}),description:"Returns the artifact draft identity and byte count. Throws SuperglueError on failure."}};var ede=b.z.looseObject({code:b.z.string(),path:b.z.array(b.z.union([b.z.string(),b.z.number(),b.z.symbol()])),message:b.z.string()});Ea.SDK_ERROR_DETAILS_SCHEMA=b.z.discriminatedUnion("kind",[b.z.looseObject({kind:b.z.literal("tool_result"),resultMetadata:XU.optional(),result:b.z.looseObject({toolCallId:b.z.string(),toolName:b.z.string(),outcome:b.z.enum(["success","failure","rejected","aborted"]),confirmation:eM.optional(),error:b.z.looseObject({message:b.z.string()}).optional(),data:b.z.unknown().optional()}),output:b.z.unknown().describe("Unprojected execution output, including the original error and any available response data or metadata.")}),b.z.looseObject({kind:b.z.enum(["input_validation","output_validation"]),toolName:b.z.string(),issues:b.z.array(ede),output:b.z.unknown().optional()})])});var pM=m(Ee=>{"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});Ee.SERVER_OWNED_SESSION_RESOURCE_KINDS=Ee.AgentRequestValidationError=Ee.AGENT_TOOL_CONTINUATION_ACTION_BY_CONFIRMATION_STATE=Ee.AGENT_TOOL_CONTINUATION_ACTIONS=Ee.AGENT_IDENTIFIER_PATTERN=Ee.AGENT_REQUEST_LIMITS=void 0;Ee.validateAgentRequestPayload=cM;Ee.validateResourceBinding=uM;Ee.validateClientResourceBinding=lM;Ee.validateAgentSessionIdentity=dM;Ee.validateAgentSessionTarget=AM;Ee.validateAgentRequestSubmission=sde;Ee.isAgentMessagePayload=ade;Ee.isAgentToolContinuationPayload=cde;var Do=dr();Ee.AGENT_REQUEST_LIMITS={messageContentChars:5e4,identifierChars:256,attachedFiles:20,toolContinuations:20,continuationInputChars:1e5,frontendDraftsChars:2e6,accessRulesContextChars:2e6};Ee.AGENT_IDENTIFIER_PATTERN=/^[A-Za-z0-9._-]+$/;Ee.AGENT_TOOL_CONTINUATION_ACTIONS=["approve","reject","oauth_success","oauth_failure"];Ee.AGENT_TOOL_CONTINUATION_ACTION_BY_CONFIRMATION_STATE={[Do.ConfirmationAction.CONFIRMED]:"approve",[Do.ConfirmationAction.DECLINED]:"reject",[Do.ConfirmationAction.OAUTH_SUCCESS]:"oauth_success",[Do.ConfirmationAction.OAUTH_FAILURE]:"oauth_failure"};var Hh=class extends Error{constructor(e){super(e),this.name="AgentRequestValidationError"}};Ee.AgentRequestValidationError=Hh;function Ge(t){throw new Hh(t)}function Zi(t,e){return(!t||typeof t!="object"||Array.isArray(t))&&Ge(`${e} must be an object`),t}function Ia(t,e){(typeof t!="string"||!t.trim())&&Ge(`${e} must be a non-empty string`);let r=t.trim();return r.length>Ee.AGENT_REQUEST_LIMITS.identifierChars&&Ge(`${e} exceeds ${Ee.AGENT_REQUEST_LIMITS.identifierChars} characters`),Ee.AGENT_IDENTIFIER_PATTERN.test(r)||Ge(`${e} may only contain letters, numbers, dots, underscores, and hyphens`),r}function tde(t,e){return typeof t!="boolean"&&Ge(`${e} must be a boolean`),t}function ib(t,e){try{return JSON.stringify(t).length}catch{return Ge(`${e} must be JSON-serializable`)}}function rde(t,e){if(t!==void 0)return Array.isArray(t)||Ge(`${e} must be an array`),t.length>Ee.AGENT_REQUEST_LIMITS.attachedFiles&&Ge(`${e} exceeds ${Ee.AGENT_REQUEST_LIMITS.attachedFiles} entries`),t.map((r,n)=>{let i=Zi(r,`${e}[${n}]`);return{...i,key:Ia(i.key,`${e}[${n}].key`)}})}function rM({value:t,label:e,requireHidden:r}){let n=Zi(t,e),i=Ia(n.id,`${e}.id`);typeof n.content!="string"&&Ge(`${e}.content must be a string`);let o=n.content;o.length>Ee.AGENT_REQUEST_LIMITS.messageContentChars&&Ge(`${e}.content exceeds ${Ee.AGENT_REQUEST_LIMITS.messageContentChars} characters`);let s=tde(n.isHidden,`${e}.isHidden`);r&&!s&&Ge(`${e}.isHidden must be true`);let a=rde(n.attachedFiles,`${e}.attachedFiles`);return!o.trim()&&!a?.length&&Ge(`${e}.content may only be empty when an attachment is present`),{id:i,content:o,isHidden:s,...a?{attachedFiles:a}:{}}}function iM(t){if(t===void 0)return;let e=Zi(t,"frontendDrafts");return ib(e,"frontendDrafts")>Ee.AGENT_REQUEST_LIMITS.frontendDraftsChars&&Ge(`frontendDrafts exceeds ${Ee.AGENT_REQUEST_LIMITS.frontendDraftsChars} characters`),e}function oM(t){if(t===void 0)return;let e=Zi(t,"accessRulesContext");return ib(e,"accessRulesContext")>Ee.AGENT_REQUEST_LIMITS.accessRulesContextChars&&Ge(`accessRulesContext exceeds ${Ee.AGENT_REQUEST_LIMITS.accessRulesContextChars} characters`),e}function sM(t){if(t!==void 0)return(typeof t!="string"||!Do.AGENT_APPROVAL_MODES.includes(t))&&Ge(`request.approvalMode must be one of: ${Do.AGENT_APPROVAL_MODES.join(", ")}`),t}function aM(t,e){let r=Zi(t,e),n=Ia(r.toolCallId,`${e}.toolCallId`);return(typeof r.action!="string"||!Ee.AGENT_TOOL_CONTINUATION_ACTIONS.includes(r.action))&&Ge(`${e}.action must be one of: ${Ee.AGENT_TOOL_CONTINUATION_ACTIONS.join(", ")}`),r.input!==void 0&&ib(r.input,`${e}.input`)>Ee.AGENT_REQUEST_LIMITS.continuationInputChars&&Ge(`${e}.input exceeds ${Ee.AGENT_REQUEST_LIMITS.continuationInputChars} characters`),{toolCallId:n,action:r.action,...r.input!==void 0?{input:r.input}:{}}}function nde(t){if(t===void 0)return;(!Array.isArray(t)||t.length===0)&&Ge("request.toolContinuations must be a non-empty array"),t.length>Ee.AGENT_REQUEST_LIMITS.toolContinuations&&Ge(`request.toolContinuations exceeds ${Ee.AGENT_REQUEST_LIMITS.toolContinuations} entries`);let e=t.map((r,n)=>aM(r,`request.toolContinuations[${n}]`));return new Set(e.map(({toolCallId:r})=>r)).size!==e.length&&Ge("request.toolContinuations must not contain duplicate toolCallId values"),e}function nM(t,e){if(t===void 0)return;(typeof t!="string"||!t.trim())&&Ge(`${e} must be a non-empty string`);let r=t.trim();return r.length>Ee.AGENT_REQUEST_LIMITS.messageContentChars&&Ge(`${e} exceeds ${Ee.AGENT_REQUEST_LIMITS.messageContentChars} characters`),r}function ide(t){let e=rM({value:t.message,label:"request.message"}),r=nM(t.title,"request.title"),n=nM(t.titleInput,"request.titleInput"),i=t.hiddenSteeringMessage===void 0?void 0:rM({value:t.hiddenSteeringMessage,label:"request.hiddenSteeringMessage",requireHidden:!0});i&&i.id===e.id&&Ge("request.hiddenSteeringMessage.id must differ from request.message.id");let o=nde(t.toolContinuations),s=sM(t.approvalMode),a=iM(t.frontendDrafts),c=oM(t.accessRulesContext);return{kind:"message",message:e,...i?{hiddenSteeringMessage:i}:{},...r?{title:r}:{},...n?{titleInput:n}:{},...o?{toolContinuations:o}:{},...s?{approvalMode:s}:{},...a?{frontendDrafts:a}:{},...c?{accessRulesContext:c}:{}}}function ode(t){let e=aM(t,"request"),r=sM(t.approvalMode),n=iM(t.frontendDrafts),i=oM(t.accessRulesContext);return{kind:"tool_continuation",...e,...r?{approvalMode:r}:{},...n?{frontendDrafts:n}:{},...i?{accessRulesContext:i}:{}}}function cM(t){let e=Zi(t,"request");return e.kind==="message"?ide(e):e.kind==="tool_continuation"?ode(e):Ge('request.kind must be "message" or "tool_continuation"')}function uM(t,e){let r=Zi(t,e);return(typeof r.kind!="string"||!Do.AGENT_SESSION_RESOURCE_KINDS.includes(r.kind))&&Ge(`${e}.kind must be one of: ${Do.AGENT_SESSION_RESOURCE_KINDS.join(", ")}`),{kind:r.kind,id:Ia(r.id,`${e}.id`)}}Ee.SERVER_OWNED_SESSION_RESOURCE_KINDS=["briefing"];function lM(t,e){let r=uM(t,e);return Ee.SERVER_OWNED_SESSION_RESOURCE_KINDS.includes(r.kind)&&Ge(`${e}.kind "${r.kind}" is assigned by the server`),r}function dM(t,e="session.createIfMissing"){let r=Zi(t,e),n=r.projectId===void 0?void 0:Ia(r.projectId,`${e}.projectId`),i=r.taskId===void 0?void 0:Ia(r.taskId,`${e}.taskId`);i&&!n&&Ge(`${e}.taskId requires ${e}.projectId`);let o=Object.values(Do.AgentType);(typeof r.agentId!="string"||!o.includes(r.agentId))&&Ge(`${e}.agentId must be one of: ${o.join(", ")}`);let s=r.resourceBinding===void 0?void 0:lM(r.resourceBinding,`${e}.resourceBinding`);return{agentId:r.agentId,...n?{projectId:n}:{},...i?{taskId:i}:{},...s?{resourceBinding:s}:{}}}function AM(t){let e=Zi(t,"session"),r=e.createIfMissing===void 0?void 0:dM(e.createIfMissing);return{id:Ia(e.id,"session.id"),...r?{createIfMissing:r}:{}}}function sde(t){let e=Zi(t,"body");return{session:AM(e.session),request:cM(e.request)}}function ade(t){return t.kind==="message"}function cde(t){return t.kind==="tool_continuation"}});var hM=m(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.ARTIFACT_EXPORT_FORMATS=Fe.ARTIFACT_RESPONSE_RESERVED_FIELD_NAMES=Fe.ARTIFACT_RESPONSE_PATCH_DEBOUNCE_MS=Fe.MAX_SPREADSHEET_ARTIFACT_BYTES=Fe.MAX_HTML_ARTIFACT_IMAGE_BYTES=Fe.MAX_HTML_ARTIFACT_BYTES=Fe.MAX_SPREADSHEET_CELL_TEXT_LENGTH=Fe.MAX_SPREADSHEET_SHEET_NAME_LENGTH=Fe.MAX_SPREADSHEET_GRID_CELLS=Fe.MAX_SPREADSHEET_SHEETS=Fe.SPREADSHEET_CELL_TYPES=void 0;Fe.isValidSpreadsheetCell=dde;Fe.isArtifactExportFormat=Ade;Fe.isArtifactExportFormatForKind=pde;var fM=tb();Fe.SPREADSHEET_CELL_TYPES=["text","integer","number","percent","currency","boolean","date","datetime"];Fe.MAX_SPREADSHEET_SHEETS=20;Fe.MAX_SPREADSHEET_GRID_CELLS=1e6;Fe.MAX_SPREADSHEET_SHEET_NAME_LENGTH=31;Fe.MAX_SPREADSHEET_CELL_TEXT_LENGTH=32767;var ude=fM.z.iso.date(),lde=fM.z.iso.datetime({offset:!0});function dde(t,e){return t===null?!0:e==="text"?typeof t=="string"&&t.length<=Fe.MAX_SPREADSHEET_CELL_TEXT_LENGTH:e==="boolean"?typeof t=="boolean":["integer","number","percent","currency"].includes(e)?typeof t=="number"&&Number.isFinite(t)&&(e!=="integer"||Number.isInteger(t)):typeof t!="string"?!1:(e==="datetime"?lde:ude).safeParse(t).success}Fe.MAX_HTML_ARTIFACT_BYTES=1024*1024;Fe.MAX_HTML_ARTIFACT_IMAGE_BYTES=12*1024*1024;Fe.MAX_SPREADSHEET_ARTIFACT_BYTES=10*1024*1024;Fe.ARTIFACT_RESPONSE_PATCH_DEBOUNCE_MS=300;Fe.ARTIFACT_RESPONSE_RESERVED_FIELD_NAMES=new Set(["__proto__","constructor","prototype"]);Fe.ARTIFACT_EXPORT_FORMATS=["html","pdf","docx","xlsx"];function Ade(t){return Fe.ARTIFACT_EXPORT_FORMATS.some(e=>e===t)}function pde(t,e){return t==="html"||e==="xlsx"}});var IM=m(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.API_KEY_ACTION_LABELS=Me.API_KEY_SURFACE_LABELS=Me.API_KEY_SCOPES=Me.API_KEY_SURFACE_ACTIONS=Me.API_KEY_ACTIONS=Me.API_KEY_SURFACES=void 0;Me.getApiKeySurface=mM;Me.getApiKeyAction=yM;Me.getApiKeySurfaceActions=ob;Me.parseApiKeyScopes=EM;Me.validateApiKeyScopesInput=mde;Me.isApiKeyScopeAllowed=yde;Me.formatApiKeyScopes=Ede;Me.API_KEY_SURFACES=["api","mcp"];Me.API_KEY_ACTIONS=["read","write","execute"];Me.API_KEY_SURFACE_ACTIONS={api:Me.API_KEY_ACTIONS,mcp:["execute"]};Me.API_KEY_SCOPES=Me.API_KEY_SURFACES.flatMap(t=>Me.API_KEY_SURFACE_ACTIONS[t].map(e=>`${t}:${e}`));Me.API_KEY_SURFACE_LABELS={api:"API & CLI",mcp:"MCP"};Me.API_KEY_ACTION_LABELS={read:"Read",write:"Write",execute:"Execute"};var gM=new Set(Me.API_KEY_SCOPES),fde={"/v1/tools":["read"],"/v1/tools/:toolId/run":["execute"],"/v1/authenticate":["write"],"/v1/memory-notes":["read","write"]},hde=new Set(["/v1/api-keys","/v1/api-keys/:id","/v1/api-keys/:id/reveal"]),gde=new Set(["/v1/me"]);function mM(t){let e=t.split("?")[0];return e==="/mcp"||e.startsWith("/mcp/")?"mcp":"api"}function yM(t){return t==="read"?"read":t==="execute"?"execute":"write"}function ob(t,e){return Me.API_KEY_SURFACE_ACTIONS[e].filter(r=>(t||[]).includes(`${e}:${r}`))}function EM(t){if(!Array.isArray(t))return null;let e=[...new Set(t.filter(r=>gM.has(r)))];return e.length>0?e:null}function mde(t){if(t==null)return{scopes:null};let e=`Valid scopes: ${Me.API_KEY_SCOPES.join(", ")}. Use null for full access.`;if(!Array.isArray(t)||t.length===0)return{error:`scopes must be a non-empty array of API key scopes. ${e}`};let r=t.filter(n=>!gM.has(n));return r.length>0?{error:`Unknown API key scope(s): ${r.map(String).join(", ")}. ${e}`}:{scopes:EM(t)}}function yde({scopes:t,path:e,type:r}){if(!t||t.length===0)return!0;let n=e.split("?")[0];if(hde.has(n))return!1;if(gde.has(n))return!0;let i=yM(r),o=mM(n);return o==="api"&&fde[n]?.some(s=>s===r)&&ob(t,"mcp").length>0?!0:t.includes(`${o}:${i}`)}function Ede(t){return!t||t.length===0?"Full access":Me.API_KEY_SURFACES.map(e=>({surface:e,actions:ob(t,e)})).filter(e=>e.actions.length>0).map(e=>Me.API_KEY_SURFACE_ACTIONS[e.surface].length===1?Me.API_KEY_SURFACE_LABELS[e.surface]:`${Me.API_KEY_SURFACE_LABELS[e.surface]} ${e.actions.join("/")}`).join(", ")}});var CM=m(sb=>{"use strict";Object.defineProperty(sb,"__esModule",{value:!0});sb.isValidEmail=Ide;function Ide(t){return/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?)*\.[a-zA-Z]{1,}$/.test(t)}});var SM=m(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.GATEWAY_UNINSTALL_COMMANDS=dt.GATEWAY_API_KEY_NAME_PREFIX=dt.GATEWAY_TARGET_NAME_PATTERN=dt.GATEWAY_SETUP_GUIDE_URL=dt.GATEWAY_DOWNLOAD_BASE_URL=dt.GATEWAY_INSTALL_TOKEN_PREFIX=void 0;dt.getGatewayServerUrl=bM;dt.buildGatewayInstallToken=bde;dt.buildGatewayInstallCommand=Sde;dt.getGatewayApiKeyName=wde;dt.GATEWAY_INSTALL_TOKEN_PREFIX="sgi1.";dt.GATEWAY_DOWNLOAD_BASE_URL="https://downloads.superglue.cloud";dt.GATEWAY_SETUP_GUIDE_URL="https://superglue.ai/docs/guides/secure-gateway/";dt.GATEWAY_TARGET_NAME_PATTERN=/^[a-z0-9]([a-z0-9_-]{0,61}[a-z0-9])?$/;function bM(t){let e=new URL(t);return e.protocol=e.protocol==="http:"?"ws:":"wss:",e.pathname=`${e.pathname.replace(/\/+$/,"")}/ws/tunnels`,e.search="",e.hash="",e.toString()}function Cde(t){let e=new TextEncoder().encode(t),r="";for(let n of e)r+=String.fromCharCode(n);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function bde(t){let e={v:1,serverUrl:bM(t.apiEndpoint),tunnelId:t.tunnelId,apiKey:t.apiKey,targets:t.targets,enableScriptRunner:t.enableScriptRunner};return dt.GATEWAY_INSTALL_TOKEN_PREFIX+Cde(JSON.stringify(e))}function Sde(t,e){return t==="windows"?['$ErrorActionPreference = "Stop"',"[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor 3072",'$ProgressPreference = "SilentlyContinue"','$gateway = "$env:TEMP\\superglue-gateway.exe"',"Remove-Item $gateway -Force -ErrorAction SilentlyContinue",`Invoke-WebRequest -UseBasicParsing "${dt.GATEWAY_DOWNLOAD_BASE_URL}/superglue-gateway-windows.exe" -OutFile $gateway`,`"${e}" | & $gateway install -`].join("; "):["d=$(mktemp -d)",`u="${dt.GATEWAY_DOWNLOAD_BASE_URL}/superglue-gateway-linux-$(uname -m | sed 's/aarch64/arm64/')"`,'s=$([ "$(id -u)" -eq 0 ] || echo sudo)','{ if command -v curl >/dev/null; then curl -fsSL -o "$d/superglue-gateway" "$u"; else wget -qO "$d/superglue-gateway" "$u"; fi; }','$s install -m 0755 "$d/superglue-gateway" /usr/local/bin/superglue-gateway',`echo '${e}' | $s /usr/local/bin/superglue-gateway install -`].join(" && ")}dt.GATEWAY_API_KEY_NAME_PREFIX="Gateway: ";function wde(t){return dt.GATEWAY_API_KEY_NAME_PREFIX+t}dt.GATEWAY_UNINSTALL_COMMANDS={windows:'& "C:\\Program Files\\superglue Gateway\\superglue-gateway.exe" uninstall',linux:"sudo /usr/local/bin/superglue-gateway uninstall"}});var bd=m(de=>{"use strict";Object.defineProperty(de,"__esModule",{value:!0});de.OAUTH_CONFIG_CREDENTIAL_KEYS=void 0;de.hasMeaningfulValue=At;de.stringValue=Pt;de.validateOAuthConnection=Ude;de.formatOAuthConnectionDisabledReason=xde;de.objectValue=Ro;de.parseScopes=Id;de.normalizeGrantType=Cd;de.normalizeOAuthClientMode=ub;de.normalizeSystemAuthentication=Gt;de.resolveOAuthClientMode=Pde;de.flattenSystemAuthentication=_M;de.maskedFlatSystemAuthentication=Fde;de.isMaskedSecretValue=DM;de.pickAgentAuthInputFields=$de;de.maskSystemAuthenticationForResponse=jde;de.restoreMaskedClientSecret=qde;de.mapAgentAuthInput=TM;de.mergeAgentAuthInput=eAe;de.getAuthenticationConfigCredentialKeys=RM;de.buildAuthenticationEditorModel=tAe;de.getCredentialRequirements=rAe;de.isCredentialRequirementSatisfied=kM;de.hasUnsatisfiedCredentialRequirements=nAe;de.updateAuthenticationEditorField=iAe;de.validateOAuthAuthenticationConfigPlacement=NM;de.authenticationToLegacyCredentials=OM;de.isRuntimeCredentialMetadataKey=oAe;de.resolveCredentialAuthentication=sAe;de.getCredentialAuthenticationStorageError=aAe;de.buildRuntimeCredentialsFromAuthentication=cAe;de.resolveOAuthConfigFromAuthentication=uAe;de.toCredentialInputValue=lb;de.getCredentialEntries=lAe;de.getCredentialInputValues=dAe;de.getCredentialDisplayHiddenKeys=AAe;de.hasOAuthTokenCredentials=pAe;de.getOAuthExpiryText=fAe;de.hasRuntimeCredentialValues=hAe;de.validateCredentialObjectKeys=UM;de.validateCredentialKeyList=MM;de.normalizeAskForUserInputs=xM;de.validateSystemInputCollection=gAe;de.mapOAuthMissingFieldsForAgent=mAe;de.validateOAuthAuthenticationAndCredentialInputs=yAe;var It=ln(),Bde=Lc();de.OAUTH_CONFIG_CREDENTIAL_KEYS=["auth_url","authUrl","token_url","tokenUrl","token_uri","scopes","scope","grant_type","grantType","oauthClientMode","client_id","clientId","client_secret","clientSecret","tokenAuthMethod","tokenContentType","usePKCE","extraHeaders","extraBodyParams"];var Gh=["host","port","database","path","homeDirectory"],vM=["type","oauthClientMode","grantType","authUrl","tokenUrl","scopes","clientId","clientSecret","tokenAuthMethod","tokenContentType","usePKCE","extraHeaders","extraBodyParams","protocol",...Gh],Qde=new Set(vM),vde="type, oauthClientMode, grantType, authUrl, tokenUrl, scopes, clientId, clientSecret, tokenAuthMethod, tokenContentType, usePKCE, extraHeaders, extraBodyParams, protocol, host, port, database, path, homeDirectory",_de=["grantType","authUrl","tokenUrl","scopes","clientId","clientSecret"],Dde={grantType:["grantType","grant_type"],authUrl:["authUrl","auth_url"],tokenUrl:["tokenUrl","token_url","token_uri"],scopes:["scopes","scope"],clientId:["clientId","client_id"],clientSecret:["clientSecret","client_secret"]},Ed=["tokenAuthMethod","tokenContentType","usePKCE","extraHeaders","extraBodyParams"],Tde=new Set(_de),Rde=new Set(["access_token","accessToken","refresh_token","refreshToken","expires_at","expiresAt","expires_in","expiresIn","expiry","token_type","tokenType"]),kde=["access_token","refresh_token","api_key","bearer_token","token","client_id","client_secret","auth_url","token_url","scopes","grant_type","token_type","expires_at","expiry","expires_in","host","hostname","port","database","dbname","db","username","password"],wM=new Map(kde.map((t,e)=>[(0,It.normalizeCredentialKey)(t),e]));function Ca(t){return Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0))}function ab({config:t,key:e,value:r}){let n={...t||{}};return At(r)?n[e]=r:delete n[e],Object.keys(n).length>0?n:void 0}function At(t){return(0,It.hasCredentialValue)(t)}function Pt(t){if(At(t))return typeof t=="string"?t:String(t)}var Nde={"grant_type authorization_code or client_credentials":"authorization_code or client_credentials",client_id:"client ID",token_url:"token URL",auth_url:"authorization URL","client_secret or usePKCE":"client secret or PKCE","client_secret or oauth_cert + oauth_key":"client secret or OAuth certificate and key"};function To(...t){return t.find(e=>At(e))}function Ode(t){return t===!0||t==="true"}function Ude(t){let e=t||{},r=Pt(To(e.grant_type,e.grantType)),n=r==="client_credentials"?"client_credentials":"authorization_code",i=r&&r!=="authorization_code"&&r!=="client_credentials",o=To(e.client_id,e.clientId),s=To(e.client_secret,e.clientSecret),a=To(e.auth_url,e.authUrl),c=To(e.token_url,e.tokenUrl,e.token_uri),u=To(e.oauth_cert,e.oauthCert),l=To(e.oauth_key,e.oauthKey),d=At(u)&&At(l)||e.hasServerSideCertificateCredentials===!0,A=e.hasServerSideClientSecret===!0,p=At(s)||A,h=Ode(To(e.usePKCE,e.usePkce)),g=[];return i&&g.push("grant_type authorization_code or client_credentials"),At(o)||g.push("client_id"),At(c)||g.push("token_url"),n==="client_credentials"?!p&&!d&&g.push("client_secret or oauth_cert + oauth_key"):(At(a)||g.push("auth_url"),!p&&!h&&g.push("client_secret or usePKCE")),{grantType:n,hasAccessToken:At(To(e.access_token,e.accessToken)),hasCertificateCredentials:d,isReadyToConnect:g.length===0,missingFields:g,usePKCE:h}}function Mde(t){return t.length<=1?t[0]||"":t.length===2?`${t[0]} and ${t[1]}`:`${t.slice(0,-1).join(", ")}, and ${t[t.length-1]}`}function xde(t){if(!t||t.isReadyToConnect)return null;let e=t.missingFields.map(r=>Nde[r]||r);return`OAuth connection is disabled because ${Mde(e)} ${e.length===1?"is":"are"} missing.`}function Ro(t){if(!(!t||typeof t!="object"||Array.isArray(t)))return t}function Ki(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Id(t){if(At(t)){if(Array.isArray(t))return t.map(String).filter(Boolean);if(typeof t=="string"){let e=t.trim().split(/[,\s]+/).map(r=>r.trim()).filter(Boolean);return e.length>0?e:void 0}return[String(t)]}}function Cd(t){let e=Pt(t);if(e==="authorization_code"||e==="client_credentials"||e==="password"||e==="service_account"||e==="custom")return e;if(e)return"custom"}function ub(t){return t==="managed"||t==="dynamic"||t==="custom"?t:void 0}function Lde(t){let e=Object.entries(t).filter(([r])=>!Tde.has(r));return e.length>0?Object.fromEntries(e):void 0}function Wc(t,e,r){for(let i of Dde[r])if(At(t[i]))return t[i];let n=Ro(t.client);return r==="clientId"&&At(n?.id)?n.id:r==="clientSecret"&&At(n?.secret)?n.secret:e[r]}function Gt(t){if(!t)return;let e=t;if(e.type==="oauth2"){let r=Ro(e.config)||{},n=Lde(r)||{};return Ca({type:"oauth2",oauthClientMode:ub(e.oauthClientMode),grantType:Cd(Wc(e,r,"grantType")),authUrl:Pt(Wc(e,r,"authUrl")),tokenUrl:Pt(Wc(e,r,"tokenUrl")),scopes:Id(Wc(e,r,"scopes")),clientId:Pt(Wc(e,r,"clientId")),clientSecret:Pt(Wc(e,r,"clientSecret")),config:Object.keys(n).length>0?n:void 0})}return e.type==="connection_string"?Ca({type:"connection_string",protocol:e.protocol,config:Ro(e.config??e.components)}):e.type==="api_key"||e.type==="basic_auth"||e.type==="none"?Ca({type:e.type,config:Ro(e.config)}):{type:"none"}}function Pde({authentication:t,templateManaged:e,templateRegistrationUrl:r}){let n=Gt(t);if(n?.type!=="oauth2")return"custom";let i=n.oauthClientMode;return i?i==="managed"&&!e?"custom":i:r?"dynamic":e&&!n.clientSecret?"managed":"custom"}function _M(t){let e=Gt(t);if(!e)return;let{config:r,scopes:n,...i}=e,o={};return r&&typeof r=="object"&&Object.assign(o,r),Object.assign(o,i),Array.isArray(n)?o.scopes=n.join(" "):n!==void 0&&(o.scopes=n),o}function cb(t,e=""){return t==null?t:Array.isArray(t)?t.map(r=>cb(r)):typeof t=="object"?Object.fromEntries(Object.entries(t).map(([r,n])=>[r,cb(n,r)])):e&&(0,It.isSensitiveCredentialKey)(e)?(0,It.maskCredentialValue)(e,t):t}function Fde(t){let e=_M(t);if(e)return cb(e)}function DM(t){return(0,It.isMaskedValue)(t)||(0,It.isFullyMaskedCredentialValue)(t)}function $de(t){let e=Ro(t);if(!e)return;let r={};for(let n of vM){if(!Ki(e,n))continue;let i=e[n];i!==void 0&&(r[n]=i)}return r}function jde(t){return!t||t.type!=="oauth2"||!At(t.clientSecret)?t:{...t,clientSecret:It.FULLY_MASKED_CREDENTIAL_VALUE}}function qde({incoming:t,existing:e}){if(!t||t.type!=="oauth2"||!DM(t.clientSecret))return t;let r=e?.type==="oauth2"?e.clientSecret:void 0;return{...t,clientSecret:r}}function zde(t){if(t==="none"||t==="api_key"||t==="basic_auth"||t==="oauth2"||t==="connection_string")return t}function Hde(t){return Object.entries(t||{})}function Gde(t){let e=Gh.flatMap(r=>{if(!Ki(t,r))return[];let n=t[r];return At(n)?[[r,n]]:[]});return e.length>0?Object.fromEntries(e):void 0}function Yde(t){return Gh.filter(e=>Ki(t,e))}function Vde(t){let e=Gh.flatMap(r=>Ki(t,r)?[[r,t[r]]]:[]);return e.length>0?Object.fromEntries(e):void 0}function Jde(t){let e=new Set(["oauthClientMode","grantType","authUrl","tokenUrl","scopes","clientId","clientSecret",...Ed]);return Object.keys(t).filter(r=>e.has(r))}function TM(t){if(t==null)return{};let e=Ro(t);if(!e)return{error:"auth must be an object."};let r=zde(e.type);if(!r)return{error:"auth.type is required."};let n=Object.keys(e).filter(a=>!Qde.has(a));if(n.length>0)return{error:`Unknown auth field(s): ${n.join(", ")}. Accepted: ${vde}.`};let i=Yde(e);if(r!=="connection_string"&&i.length>0)return{error:`Connection auth field(s) require auth.type 'connection_string': ${i.join(", ")}.`};let o=Jde(e);if(r!=="oauth2"&&o.length>0)return{error:`OAuth auth field(s) require auth.type 'oauth2': ${o.join(", ")}.`};if(r!=="oauth2"){let a=Gde(e);return{authentication:Ca({type:r,protocol:r==="connection_string"?e.protocol:void 0,config:a})}}let s={...Object.fromEntries(Ed.flatMap(a=>{if(!Ki(e,a))return[];let c=e[a];return At(c)?[[a,c]]:[]}))};return{authentication:Ca({type:"oauth2",oauthClientMode:ub(e.oauthClientMode),grantType:Cd(e.grantType),authUrl:Pt(e.authUrl),tokenUrl:Pt(e.tokenUrl),scopes:Id(e.scopes),clientId:Pt(e.clientId),clientSecret:Pt(e.clientSecret),config:Object.keys(s).length>0?s:void 0})}}function ba(t){return t===""||t===null||t===void 0}function yd(t,e,r,n){if(Ki(e,r)){if(ba(e[r])){delete t[n];return}t[n]=Pt(e[r])}}function Wde(t,e){if(Ki(e,"scopes")){if(ba(e.scopes)){delete t.scopes;return}t.scopes=Id(e.scopes)}}function Zde(t,e){if(Ki(e,"grantType")){if(ba(e.grantType)){delete t.grantType;return}t.grantType=Cd(e.grantType)}}function Kde(t,e,r){if(Ki(e,r)){if(ba(e[r])){delete t[r];return}t[r]=e[r]}}function Xde(t,e){if(ba(e))return;let r=Ro(e);if(!r)return t;let n={...t||{}};for(let[i,o]of Object.entries(r))ba(o)?delete n[i]:n[i]=o;return Object.keys(n).length>0?n:void 0}function eAe(t,e){let r=TM(e);if(r.error)return Gt(t)||{type:"none"};let n=r.authentication||{type:"none"},i=Ro(e)||{},o=Gt(t),s=o?.type===n.type;if(n.type!=="oauth2"){let d=Vde(i),A=s&&o?{...o}:{type:n.type};return n.type==="connection_string"&&Ki(i,"protocol")&&(ba(i.protocol)?delete A.protocol:A.protocol=i.protocol),d&&(A.config=Xde(o?.config,d)),Gt(A)||{type:n.type}}let c={...s&&o?.type==="oauth2"?{...o,config:{...o.config||{}}}:{type:"oauth2",config:{}}};yd(c,i,"oauthClientMode","oauthClientMode"),Zde(c,i),yd(c,i,"authUrl","authUrl"),yd(c,i,"tokenUrl","tokenUrl"),Wde(c,i),yd(c,i,"clientId","clientId"),yd(c,i,"clientSecret","clientSecret");let l={...c.config||{}};for(let d of Ed)Kde(l,i,d);return c.config=Object.keys(l).length>0?l:void 0,Gt(c)||{type:"oauth2"}}function RM(t){let e=Gt(t);if(!e)return[];let r=new Set;for(let n of Object.keys(e.config||{}))r.add(n);return e.type==="oauth2"&&(e.grantType&&(r.add("grant_type"),r.add("grantType")),e.authUrl&&(r.add("auth_url"),r.add("authUrl")),e.tokenUrl&&(r.add("token_url"),r.add("tokenUrl"),r.add("token_uri")),e.scopes&&(r.add("scopes"),r.add("scope")),e.clientId&&(r.add("client_id"),r.add("clientId")),e.clientSecret&&(r.add("client_secret"),r.add("clientSecret"))),[...r]}function BM(t,e,r){if(r)for(let[n,i]of Object.entries(r))t.push({path:`${e}.${n}`,label:n,value:i})}function tAe({authentication:t}){let e=Gt(t)||{type:"none"},r=[];if(e.type==="oauth2"){r.push({path:"oauth2.clientId",label:"clientId",value:e.clientId},{path:"oauth2.clientSecret",label:"clientSecret",value:e.clientSecret},{path:"oauth2.grantType",label:"grantType",value:e.grantType||"authorization_code"},{path:"oauth2.authUrl",label:"authUrl",value:e.authUrl},{path:"oauth2.tokenUrl",label:"tokenUrl",value:e.tokenUrl},{path:"oauth2.scopes",label:"scopes",value:e.scopes?.join(" ")});for(let n of Ed)r.push({path:`oauth2.config.${n}`,label:n,value:e.config?.[n]});for(let[n,i]of Object.entries(e.config||{}))Ed.includes(n)||r.push({path:`oauth2.config.${n}`,label:n,value:i})}else e.type==="connection_string"?(e.protocol&&r.push({path:"connection.protocol",label:"protocol",value:e.protocol}),BM(r,"connection.config",e.config)):BM(r,`${e.type}.config`,e.config);return{type:e.type,authentication:e,configFields:r,hiddenCredentialKeys:RM(e)}}function rAe(t){let e=Gt(t);if(!e||e.type!=="connection_string")return[];let r={type:"field",field:{key:"username",aliases:["user"]}},n={type:"field",field:{key:"password"}};switch(e.protocol){case"sftp":return[r,{type:"oneOf",fields:[{key:"password"},{key:"privateKey"}]},{type:"field",field:{key:"passphrase"},optional:!0}];case"smb":return[r,n,{type:"field",field:{key:"domain"},optional:!0}];case"sqlserver":return[{type:"field",field:{key:"user",aliases:["username"]}},n];default:return[r,n]}}function QM(t,e){return(0,It.hasCredentialValue)(e[t.key])?!0:(t.aliases??[]).some(r=>(0,It.hasCredentialValue)(e[r]))}function kM(t,e){return t.optional?!0:t.type==="field"?QM(t.field,e):t.fields.some(r=>QM(r,e))}function nAe(t,e){let r=e||{};return t.some(n=>!kM(n,r))}function iAe({authentication:t,path:e,value:r}){let n=Gt(t)||{type:"none"};if(n.type==="oauth2"){if(e==="oauth2.grantType")return{...n,grantType:Cd(r)};if(e==="oauth2.authUrl")return{...n,authUrl:Pt(r)};if(e==="oauth2.tokenUrl")return{...n,tokenUrl:Pt(r)};if(e==="oauth2.scopes")return{...n,scopes:Id(r)};if(e==="oauth2.clientId")return{...n,clientId:Pt(r)};if(e==="oauth2.clientSecret")return{...n,clientSecret:Pt(r)};if(e.startsWith("oauth2.config.")){let o=e.slice(14);return{...n,config:ab({config:n.config,key:o,value:r})}}}if(n.type==="connection_string"){if(e==="connection.protocol")return{...n,protocol:Pt(r)};if(e.startsWith("connection.config.")){let o=e.slice(18);return{...n,config:ab({config:n.config,key:o,value:r})}}}let i=`${n.type}.config.`;if(e.startsWith(i)){let o=e.slice(i.length);return{...n,config:ab({config:n.config,key:o,value:r})}}return n}function NM({authentication:t,credentials:e}){if(Gt(t)?.type!=="oauth2"||!e||typeof e!="object"||Array.isArray(e))return null;let n=Object.keys(e).filter(i=>de.OAUTH_CONFIG_CREDENTIAL_KEYS.includes(i));return n.length===0?null:`OAuth configuration keys belong in auth, not credentials: ${n.join(", ")}. Move OAuth client ID to auth.clientId, client secret to auth.clientSecret, auth URL to auth.authUrl, token URL to auth.tokenUrl, scopes to auth.scopes, grant type to auth.grantType, and token request settings to auth fields such as tokenAuthMethod/usePKCE/extraHeaders. Runtime OAuth access and refresh tokens are created by authenticate_oauth.`}function OM(t){let e=Gt(t);return e?e.type==="oauth2"?Ca({...e.config||{},grant_type:e.grantType,auth_url:e.authUrl,token_url:e.tokenUrl,scopes:e.scopes?.join(" "),client_id:e.clientId,client_secret:e.clientSecret}):e.type==="connection_string"?e.config||{}:e.config||{}:{}}function oAe(t){return Rde.has(t.trim())}function sAe({credential:t,system:e}){return t?.authentication??e?.authentication??void 0}function aAe(t){let e=Gt(t);return e?.type==="oauth2"&&e.oauthClientMode==="managed"&&e.clientSecret?"Managed OAuth client secrets cannot be stored on credentials":null}function cAe({authentication:t,credentials:e}){let r=OM(t);return Gt(t)?.type==="oauth2"?{...e||{},...r}:{...r,...e||{}}}function uAe({input:t,authentication:e,templateOAuth:r}){let n=Gt(e),i=n?.type==="oauth2"?n:void 0,o=i?.config||{},s=t||{},a=(...c)=>c.find(u=>u!=null);return Ca({grant_type:a(s.grantType,s.grant_type,i?.grantType,r?.grant_type)||"authorization_code",scopes:a(s.scopes,i?.scopes?.join(" "),r?.scopes),client_id:a(s.clientId,s.client_id,i?.clientId),client_secret:a(s.clientSecret,s.client_secret,i?.clientSecret),auth_url:a(s.authUrl,s.auth_url,i?.authUrl,r?.authUrl),token_url:a(s.tokenUrl,s.token_url,i?.tokenUrl,r?.tokenUrl),resource:a(s.resource,o.resource,r?.resource),tokenAuthMethod:a(s.tokenAuthMethod,o.tokenAuthMethod,r?.tokenAuthMethod),tokenContentType:a(s.tokenContentType,o.tokenContentType,r?.tokenContentType),usePKCE:a(s.usePKCE,o.usePKCE,r?.usePKCE),extraHeaders:a(s.extraHeaders,o.extraHeaders,r?.extraHeaders),extraBodyParams:a(s.extraBodyParams,o.extraBodyParams,r?.extraBodyParams)})}function lb(t){if(t==null)return"";if(typeof t=="string")return t;let e=JSON.stringify(t);return e===void 0?String(t):e}function lAe(t,e={}){let r=new Set((e.hiddenKeys||[]).map(It.normalizeCredentialKey));return Object.entries(t).filter(([n])=>!r.has((0,It.normalizeCredentialKey)(n))).sort(([n],[i])=>{let o=wM.get((0,It.normalizeCredentialKey)(n))??Number.MAX_SAFE_INTEGER,s=wM.get((0,It.normalizeCredentialKey)(i))??Number.MAX_SAFE_INTEGER;if(o!==s)return o-s;let a=(0,It.isSensitiveCredentialKey)(n),c=(0,It.isSensitiveCredentialKey)(i);return a!==c?a?-1:1:n.localeCompare(i)}).map(([n,i])=>({key:n,value:lb(i),isReservedMasked:e.maskAll||(0,It.isSensitiveCredentialKey)(n)}))}function dAe(t){return Object.fromEntries(Object.entries(t).map(([e,r])=>[e,lb(r)]))}function AAe({hideOAuthFiles:t=!1,configKeys:e=[]}){return[...e,...t?["oauth_cert","oauth_key"]:[]]}function pAe(t){return At(t.access_token)||At(t.refresh_token)}function fAe(t){let e=t.expires_at??t.expiry;if(e){let n=(0,Bde.parseUTCDate)(e);if(n)return`Expires ${n.toLocaleString()}`}let r=t.expires_in;return At(r)?`Expires in ${r} seconds`:null}function hAe(t){return!!(t&&typeof t=="object"&&!Array.isArray(t)&&Object.values(t).some(e=>At(e)))}function UM(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let e=(0,It.getInvalidCredentialKeyNames)(Object.keys(t));return e.length===0?null:`${It.CREDENTIAL_KEY_VALIDATION_DESCRIPTION} Invalid keys: ${e.join(", ")}`}function MM(t){let e=(0,It.getInvalidCredentialKeyNames)(t);return e.length===0?null:`${It.CREDENTIAL_KEY_VALIDATION_DESCRIPTION} Invalid keys: ${e.join(", ")}`}function xM(t){return Array.isArray(t)?[...new Set(t.map(e=>String(e||"").trim()).filter(Boolean))]:[]}function gAe({credentials:t,askForUserInputs:e}){let r=UM(t);if(r)return r;let n=xM(e),i=MM(n);if(i)return i;if(t&&typeof t=="object"&&!Array.isArray(t))for(let[o,s]of Hde(t)){if(s===""||s===null)return"Blank secret values are not allowed; list secret names to collect from the user in askForUserInputs.";if(n.includes(o))return`Secret name '${o}' cannot be in both credentials and askForUserInputs.`}return null}function mAe(t){let e={"grant_type authorization_code or client_credentials":"grantType authorization_code or client_credentials",client_id:"clientId",token_url:"tokenUrl",auth_url:"authUrl","client_secret or usePKCE":"clientSecret or usePKCE","client_secret or oauth_cert + oauth_key":"clientSecret or oauth_cert + oauth_key"};return t.map(r=>e[r]||r)}function yAe({authentication:t,credentials:e}){return NM({authentication:t,credentials:e})}});var nx=m(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.bundles=void 0;Fn.buildBundleAgentLaunch=RAe;Fn.getBundle=kAe;Fn.listBundles=NAe;Fn.rewriteBundleToolSystemId=OAe;var EAe=dr(),IAe="https://sandbox.api.sap.com/s4hanacloud/sap/opu/odata/sap",CAe="<<(p) => { const value = p['sage_intacct_entity_id']; if (!value) return ''; const escaped = String(value).replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>').replaceAll('\"', '"').replaceAll(\"'\", '''); return `<locationid>${escaped}</locationid>`; }>>",LM="<<() => crypto.randomUUID()>>";function pt(t){return`<?xml version="1.0" encoding="UTF-8"?><request><control><senderid><<sage_intacct_sender_id>></senderid><password><<sage_intacct_sender_password>></password><controlid>${LM}</controlid><uniqueid>false</uniqueid><dtdversion>3.0</dtdversion></control><operation><authentication><login><userid><<sage_intacct_user_id>></userid><companyid><<sage_intacct_company_id>></companyid><password><<sage_intacct_user_password>></password>${CAe}</login></authentication><content><function controlid="${LM}">${t}</function></content></operation></request>`}function fs({stepId:t,objectNameExpression:e,collectionName:r,mapExpression:n,includeTotalCount:i=!1}){let o=i?"Number(data && data.TOTALCOUNT ? data.TOTALCOUNT : rows.length)":"rows.length",s=n?`rows.map(${n})`:"rows";return`(sourceData) => { const response = sourceData.${t} && sourceData.${t}.data ? sourceData.${t}.data.RESPONSE : undefined; const control = response ? response.CONTROL : undefined; const operation = response ? response.OPERATION : undefined; const authentication = operation ? operation.AUTHENTICATION : undefined; const result = operation ? operation.RESULT : undefined; const statuses = [control && control.STATUS, authentication && authentication.STATUS, result && result.STATUS].filter(Boolean).map((value) => String(value).toLowerCase()); if (statuses.includes('failure')) { const message = (result && result.ERRORMESSAGE) || (authentication && authentication.ERR ? authentication.ERR.ERRORMESSAGE : undefined) || (control && control.ERR ? control.ERR.ERRORMESSAGE : undefined); const rawErrors = message ? message.ERROR : undefined; const errors = Array.isArray(rawErrors) ? rawErrors : (rawErrors ? [rawErrors] : []); const details = errors.map((error) => [error.ERRORNO, error.DESCRIPTION2 || error.DESCRIPTION, error.CORRECTION].filter(Boolean).join(' - ')).filter(Boolean); const supportIds = errors.map((error) => error.SUPPORTID).filter(Boolean); const suffix = supportIds.length ? \` Sage support ID: \${supportIds.join(', ')}.\` : ''; throw new Error(\`Sage Intacct request failed\${details.length ? \`: \${details.join('; ')}\` : '.'}\${suffix}\`); } const data = result ? result.DATA : undefined; const objectName = ${e}; const raw = data ? data[objectName] : undefined; const rows = (Array.isArray(raw) ? raw : (raw ? [raw] : [])).slice(0, (sourceData && sourceData.maxResults) ?? ${i?"1000":"200"}); return { total: ${o}, ${r}: ${s} }; }`}var hs=`const esc = (value) => String(value).replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>').replaceAll('"', '"').replaceAll("'", ''');`,PM="const toIntacctDate = (value) => { const match = String(value).match(/^(\\d{4})-(\\d{2})-(\\d{2})/); if (!match) throw new Error('Dates must be in YYYY-MM-DD format.'); return match[2] + '/' + match[3] + '/' + match[1]; };",FM="const assertBalanced = (lines) => { const balance = lines.reduce((sum, line) => sum + (line.type === 'credit' ? -1 : 1) * Math.abs(Number(line.amount)), 0); if (Math.abs(balance) > 0.005) throw new Error('Journal lines must balance: debits minus credits is ' + balance.toFixed(2) + '.'); };",$M=`const lineXml = (line) => { const amount = Number(line.amount); if (!Number.isFinite(amount) || amount <= 0) throw new Error('Every journal line needs a positive amount.'); const type = line.type === 'credit' ? -1 : line.type === 'debit' ? 1 : null; if (type === null) throw new Error("Every journal line needs type 'debit' or 'credit'."); if (!line.accountNo) throw new Error('Every journal line needs accountNo.'); let xml = '<GLENTRY><ACCOUNTNO>' + esc(line.accountNo) + '</ACCOUNTNO><TR_TYPE>' + type + '</TR_TYPE><TRX_AMOUNT>' + amount + '</TRX_AMOUNT>'; if (line.department) xml += '<DEPARTMENT>' + esc(line.department) + '</DEPARTMENT>'; if (line.location) xml += '<LOCATION>' + esc(line.location) + '</LOCATION>'; if (line.memo) xml += '<DESCRIPTION>' + esc(line.memo) + '</DESCRIPTION>'; return xml + '</GLENTRY>'; };`;function Zc({stepId:t,objectName:e}){return`(sourceData) => { const response = sourceData.${t} && sourceData.${t}.data ? sourceData.${t}.data.RESPONSE : undefined; const control = response ? response.CONTROL : undefined; const operation = response ? response.OPERATION : undefined; const authentication = operation ? operation.AUTHENTICATION : undefined; const result = operation ? operation.RESULT : undefined; const statuses = [control && control.STATUS, authentication && authentication.STATUS, result && result.STATUS].filter(Boolean).map((value) => String(value).toLowerCase()); if (statuses.includes('failure')) { const message = (result && result.ERRORMESSAGE) || (authentication && authentication.ERR ? authentication.ERR.ERRORMESSAGE : undefined) || (control && control.ERR ? control.ERR.ERRORMESSAGE : undefined); const rawErrors = message ? message.ERROR : undefined; const errors = Array.isArray(rawErrors) ? rawErrors : (rawErrors ? [rawErrors] : []); const details = errors.map((error) => [error.ERRORNO, error.DESCRIPTION2 || error.DESCRIPTION, error.CORRECTION].filter(Boolean).join(' - ')).filter(Boolean); const supportIds = errors.map((error) => error.SUPPORTID).filter(Boolean); const suffix = supportIds.length ? \` Sage support ID: \${supportIds.join(', ')}.\` : ''; throw new Error(\`Sage Intacct request failed\${details.length ? \`: \${details.join('; ')}\` : '.'}\${suffix}\`); } const data = result ? result.DATA : undefined; const raw = data ? (data.${e} || data.${e.toLowerCase()}) : undefined; const record = Array.isArray(raw) ? raw[0] : raw; return { recordNo: record && record.RECORDNO ? Number(record.RECORDNO) : undefined, record }; }`}var Qd="netsuite",pb=100,Bd=1e4,Xh=String.raw`<<(p) => { const url = String(p['netsuite_url'] || ''); if (!url || url.includes('{accountId}')) throw new Error('NetSuite is not connected yet: set the account ID so the system URL is https://<account>.suitetalk.api.netsuite.com/services/rest'); return url.replace(/\/+$/, ''); }>>`,eg={Authorization:"Bearer <<netsuite_access_token>>",Accept:"application/json"},fb=String.raw`const has = (value) => value !== undefined && value !== null && value !== ''; const nsId = (value, name) => { const text = String(value ?? '').trim(); if (!/^-?\d+$/.test(text)) throw new Error(name + ' must be a NetSuite internal ID.'); return text; }; const nsDate = (value, name) => { const text = String(value ?? '').trim(); if (!/^\d{4}-\d{2}-\d{2}$/.test(text)) throw new Error(name + ' must be a date in YYYY-MM-DD format.'); return text; }; const ref = (value, name) => ({ id: nsId(value, name) });`,bAe=String.raw`const str = (value) => (value === undefined || value === null || value === '' ? null : String(value)); const num = (value) => (value === undefined || value === null || value === '' ? null : Number(value)); const bool = (value) => value === 'T' || value === true; const ids = (value) => (value === undefined || value === null || value === '' ? [] : String(value).split(',').map((part) => part.trim()).filter(Boolean)); const status = (value) => (value ? String(value).replace(/^[^:]*:\s*/, '') : null);`,jM=String.raw`const stripLinks = (value) => { if (Array.isArray(value)) return value.map(stripLinks); if (value && typeof value === 'object') { const result = {}; for (const [key, entry] of Object.entries(value)) { if (key !== 'links') result[key] = stripLinks(entry); } return result; } return value; };`,SAe={type:"integer",minimum:1,maximum:Bd,description:`Maximum number of records to return (max ${Bd}). Defaults to ${pb}. The result always reports the full match count in total, so use maxResults 1 to count. Prefer filters over large values: big results can exceed an AI client's tool output limit.`},wAe={type:"boolean",description:"Only return active records. Defaults to false (inactive records are included)."},BAe={type:"string",description:"Optional subsidiary internal ID to filter by."},QAe={type:"string",description:"Optional earliest transaction date as YYYY-MM-DD."},vAe={type:"string",description:"Optional latest transaction date as YYYY-MM-DD."},_Ae={type:"object",description:"Optional extra NetSuite REST field values merged into the record body as-is, e.g. custom fields like { custentity_region: 'EMEA' } or references like { terms: { id: '2' } }. Fields that this tool's own inputs set are rejected; use those inputs instead.",properties:{},additionalProperties:!0},Sd=t=>({input:"activeOnly",kind:"flag",clause:`${t}.isinactive = 'F'`,schema:wAe}),wd=t=>({input:"subsidiaryId",kind:"id",clause:`${t}.subsidiary = $`,schema:BAe}),db=[{input:"fromDate",kind:"date",clause:"t.trandate >= TO_DATE('$', 'YYYY-MM-DD')",schema:QAe},{input:"toDate",kind:"date",clause:"t.trandate <= TO_DATE('$', 'YYYY-MM-DD')",schema:vAe}];function DAe(t){let e=`p[${JSON.stringify(t.input)}]`;if(t.kind==="flag")return`if (${e} === true || ${e} === 'true') where.push(${JSON.stringify(t.clause)});`;let[r,n]=t.clause.split("$");if(t.kind==="enum")return`if (has(${e})) { const allowed = ${JSON.stringify(t.values)}; if (!allowed.includes(String(${e}))) throw new Error(${JSON.stringify(`${t.input} must be one of: ${t.values.join(", ")}.`)}); where.push(${JSON.stringify(r)} + String(${e}) + ${JSON.stringify(n)}); }`;if(t.kind==="prefix")return`if (has(${e})) { const text = String(${e}).trim(); if (!/^[A-Za-z0-9._-]{1,40}$/.test(text)) throw new Error(${JSON.stringify(`${t.input} may only contain letters, digits, dots, underscores and hyphens.`)}); where.push(${JSON.stringify(r)} + text + ${JSON.stringify(n)}); }`;let i=t.kind==="id"?"nsId":"nsDate";return`if (has(${e})) where.push(${JSON.stringify(r)} + ${i}(${e}, ${JSON.stringify(t.input)}) + ${JSON.stringify(n)});`}function gs({id:t,name:e,shortName:r,instruction:n,stepId:i,collection:o,select:s,baseWhere:a=[],orderBy:c,filters:u=[],properties:l={},required:d=[],mapRow:A}){let p=typeof s=="string"?JSON.stringify(s):s.js,h=`<<(p) => { ${fb} const where = ${JSON.stringify(a)}; ${u.map(DAe).join(" ")} return JSON.stringify({ q: ${p} + (where.length ? ' WHERE ' + where.join(' AND ') : '') + ${JSON.stringify(` ORDER BY ${c}`)} }); }>>`;return{id:t,name:e,shortName:r,instruction:`${n} Rows are ordered by internal ID. If more than ${Bd} rows match, narrow with the filters or page with the SuiteQL query tool (ORDER BY id, WHERE id > last id).`,inputSchema:{type:"object",properties:{...l,maxResults:SAe,...Object.fromEntries(u.map(g=>[g.input,g.schema]))},...d.length>0?{required:d}:{},additionalProperties:!1},steps:[{id:i,instruction:"Run the SuiteQL query page by page.",config:{type:"request",systemId:Qd,url:`${Xh}/query/v1/suiteql`,method:"POST",headers:{...eg,"Content-Type":"application/json",Prefer:"transient"},queryParams:{limit:"1000",offset:"<<offset>>"},body:h,pagination:{type:"offsetBased",pageSize:"1000",stopCondition:`(response, pageInfo, sourceData) => { if (sourceData && ["offset", "limit", "page"].some((key) => sourceData[key] !== undefined)) throw new Error("offset, limit and page are not inputs of this tool: use maxResults and the filters."); const page = response && response.data ? response.data : {}; const merged = pageInfo && pageInfo.mergedResult && Array.isArray(pageInfo.mergedResult.items) ? pageInfo.mergedResult.items.length : 0; const max = Math.min(Math.max(Math.floor(Number(sourceData && sourceData.maxResults)) || ${pb}, 1), ${Bd}); return page.hasMore !== true || merged >= max; }`}}}],outputTransform:`(sourceData) => { ${bAe} const raw = sourceData.${i} ? sourceData.${i}.data : undefined; const pages = Array.isArray(raw) ? raw : (raw ? [raw] : []); const items = pages.flatMap((page) => (page && Array.isArray(page.items) ? page.items : [])); const last = pages.length ? pages[pages.length - 1] : {}; const max = Math.min(Math.max(Math.floor(Number(sourceData.maxResults)) || ${pb}, 1), ${Bd}); const rows = items.slice(0, max).map(${A}).map((row) => Object.fromEntries(Object.entries(row).filter((entry) => entry[1] !== null))); const total = last && last.totalResults !== undefined ? Number(last.totalResults) : items.length; return { total, returned: rows.length, hasMore: total > rows.length, ${o}: rows }; }`}}function mr({id:t,name:e,shortName:r,instruction:n,stepId:i,recordType:o,mode:s,properties:a,required:c,body:u,replaceSublist:l}){let d=[...new Set(Array.from(u.matchAll(/record\.([A-Za-z0-9_]+)\s*=/g)).map(p=>p[1]))],A=s==="create"?`/record/v1/${o}`:`/record/v1/${o}/<<(p) => { ${fb} return nsId(p.internalId, 'internalId'); }>>`;return{id:t,name:e,shortName:r,instruction:n,inputSchema:{type:"object",properties:{...s==="update"?{internalId:{type:"string",description:`Internal ID of the ${o} to update.`}}:{},...a,fields:_Ae},required:s==="update"?["internalId",...c]:c,additionalProperties:!1},steps:[{id:i,instruction:`${s==="create"?"Create":"Update"} the ${o} record.`,modify:!0,config:{type:"request",systemId:Qd,url:`${Xh}${A}`,method:s==="create"?"POST":"PATCH",headers:{...eg,"Content-Type":"application/json","X-NetSuite-idempotency-key":"<<() => crypto.randomUUID()>>"},...l?{queryParams:{replace:`<<(p) => (Array.isArray(p[${JSON.stringify(l.input)}]) && p[${JSON.stringify(l.input)}].length > 0 ? ${JSON.stringify(l.sublist)} : undefined)>>`}}:{},body:`<<(p) => { ${fb} const record = {}; ${u} if (p.fields && typeof p.fields === 'object' && !Array.isArray(p.fields)) { const managed = ${JSON.stringify(d)}; const reserved = Object.keys(p.fields).filter((key) => managed.includes(key)); if (reserved.length > 0) throw new Error('fields may not set ' + reserved.join(', ') + ': use this tool\\'s own inputs for them.'); Object.assign(record, p.fields); } if (Object.keys(record).length === 0) throw new Error('Provide at least one field to ${s}.'); return JSON.stringify(record); }>>`,captureHttpResponse:!0}}],outputTransform:s==="create"?`(sourceData) => { const step = sourceData.${i} || {}; const location = step.http && step.http.headers ? String(step.http.headers.location || '') : ''; const match = location.match(/\\/record\\/v1\\/[^/]+\\/([^/?#]+)/); if (!match) throw new Error('NetSuite did not return the location of the new ${o}.'); return { id: decodeURIComponent(match[1]), recordType: '${o}' }; }`:`(sourceData) => ({ id: String(sourceData.internalId).trim(), recordType: '${o}', updated: true })`}}var qM=String.raw`const lines = Array.isArray(p.lines) ? p.lines : []; let balance = 0; const items = lines.map((line, index) => { const amount = Number(line && line.amount); if (!Number.isFinite(amount) || amount <= 0) throw new Error('lines[' + index + '].amount must be a positive number.'); if (line.type !== 'debit' && line.type !== 'credit') throw new Error("lines[" + index + "].type must be 'debit' or 'credit'."); balance += line.type === 'debit' ? amount : -amount; const item = { account: ref(line.accountId, 'lines[' + index + '].accountId') }; item[line.type] = amount; if (has(line.memo)) item.memo = String(line.memo); if (has(line.departmentId)) item.department = ref(line.departmentId, 'lines[' + index + '].departmentId'); if (has(line.classId)) item.class = ref(line.classId, 'lines[' + index + '].classId'); if (has(line.locationId)) item.location = ref(line.locationId, 'lines[' + index + '].locationId'); if (has(line.entityId)) item.entity = ref(line.entityId, 'lines[' + index + '].entityId'); return item; }); if (lines.length > 0 && Math.abs(balance) > 0.005) throw new Error('Journal lines must balance: debits minus credits is ' + balance.toFixed(2) + '.'); if (items.length > 0) record.line = { items };`,zM=String.raw`if (has(p.subsidiaryId)) record.subsidiary = ref(p.subsidiaryId, 'subsidiaryId'); if (has(p.date)) record.tranDate = nsDate(p.date, 'date'); if (has(p.memo)) record.memo = String(p.memo); if (has(p.currencyId)) record.currency = ref(p.currencyId, 'currencyId'); if (has(p.externalId)) record.externalId = String(p.externalId);`,HM={type:"object",properties:{accountId:{type:"string",description:"GL account internal ID."},type:{type:"string",enum:["debit","credit"]},amount:{type:"number",description:"Positive amount."},memo:{type:"string",description:"Optional line memo."},departmentId:{type:"string",description:"Optional department internal ID."},classId:{type:"string",description:"Optional class internal ID."},locationId:{type:"string",description:"Optional location internal ID."},entityId:{type:"string",description:"Optional customer, vendor or employee internal ID for the line."}},required:["accountId","type","amount"],additionalProperties:!1},GM=t=>({subsidiaryId:{type:"string",description:t==="create"?"Subsidiary internal ID. Required in OneWorld accounts.":"Optional new subsidiary internal ID."},date:{type:"string",description:t==="create"?"Transaction date as YYYY-MM-DD.":"Optional new transaction date as YYYY-MM-DD."},memo:{type:"string",description:"Journal entry memo."},currencyId:{type:"string",description:"Optional currency internal ID."},externalId:{type:"string",description:"Optional external ID."}}),Yh=String.raw`if (p.isPerson === true || p.isPerson === 'true') record.isPerson = true; if (p.isPerson === false || p.isPerson === 'false') record.isPerson = false; if (has(p.entityId)) record.entityId = String(p.entityId); if (has(p.companyName)) record.companyName = String(p.companyName); if (has(p.firstName)) record.firstName = String(p.firstName); if (has(p.lastName)) record.lastName = String(p.lastName); if (has(p.subsidiaryId)) record.subsidiary = ref(p.subsidiaryId, 'subsidiaryId'); if (has(p.email)) record.email = String(p.email); if (has(p.phone)) record.phone = String(p.phone); if (has(p.currencyId)) record.currency = ref(p.currencyId, 'currencyId'); if (has(p.externalId)) record.externalId = String(p.externalId); if (p.isInactive === true || p.isInactive === 'true') record.isInactive = true; if (p.isInactive === false || p.isInactive === 'false') record.isInactive = false;`;function Vh(t){return{companyName:{type:"string",description:`Company name of the ${t}.`},isPerson:{type:"boolean",description:`True when the ${t} is an individual; then set firstName and lastName.`},firstName:{type:"string",description:"First name for an individual."},lastName:{type:"string",description:"Last name for an individual."},entityId:{type:"string",description:`${t==="customer"?"Customer":"Vendor"} ID. Omit when auto-numbering assigns it.`},subsidiaryId:{type:"string",description:"Primary subsidiary internal ID. Required on create in OneWorld accounts."},email:{type:"string",description:"Email address."},phone:{type:"string",description:"Phone number."},currencyId:{type:"string",description:"Primary currency internal ID."},externalId:{type:"string",description:"Optional external ID."}}}var Jh={isInactive:{type:"boolean",description:"Set true to inactivate, false to reactivate."}},Wh=String.raw`if (Array.isArray(p.subsidiaryIds) && p.subsidiaryIds.length > 0) record.subsidiary = { items: p.subsidiaryIds.map((value, index) => ref(value, 'subsidiaryIds[' + index + ']')) }; if (p.includeChildren === true || p.includeChildren === 'true') record.includeChildren = true; if (p.includeChildren === false || p.includeChildren === 'false') record.includeChildren = false;`,tx={subsidiaryIds:{type:"array",items:{type:"string"},description:"Subsidiary internal IDs the record is available in. On update the list replaces the current subsidiaries."},includeChildren:{type:"boolean",description:"Also make the record available to child subsidiaries."}},hb=["AcctPay","AcctRec","Bank","COGS","CredCard","DeferExpense","DeferRevenue","Equity","Expense","FixedAsset","Income","LongTermLiab","NonPosting","OthAsset","OthCurrAsset","OthCurrLiab","OthExpense","OthIncome","Stat","UnbilledRec"],YM=String.raw`if (has(p.acctNumber)) record.acctNumber = String(p.acctNumber); if (has(p.acctName)) record.acctName = String(p.acctName); if (has(p.acctType)) record.acctType = { id: String(p.acctType) }; if (has(p.parentId)) record.parent = ref(p.parentId, 'parentId'); if (has(p.description)) record.description = String(p.description); if (has(p.currencyId)) record.currency = ref(p.currencyId, 'currencyId'); if (has(p.externalId)) record.externalId = String(p.externalId); if (p.isInactive === true || p.isInactive === 'true') record.isInactive = true; if (p.isInactive === false || p.isInactive === 'false') record.isInactive = false;`,VM={acctNumber:{type:"string",description:"Account number."},acctName:{type:"string",description:"Account name."},acctType:{type:"string",enum:hb,description:"NetSuite account type."},parentId:{type:"string",description:"Optional parent account internal ID."},description:{type:"string",description:"Optional description."},currencyId:{type:"string",description:"Optional currency internal ID (bank and credit card accounts)."},externalId:{type:"string",description:"Optional external ID."},...tx},JM=String.raw`if (has(p.name)) record.name = String(p.name); if (has(p.parentId)) record.parent = ref(p.parentId, 'parentId'); if (has(p.externalId)) record.externalId = String(p.externalId); if (p.isInactive === true || p.isInactive === 'true') record.isInactive = true; if (p.isInactive === false || p.isInactive === 'false') record.isInactive = false;`,WM={name:{type:"string",description:"Department name."},parentId:{type:"string",description:"Optional parent department internal ID."},externalId:{type:"string",description:"Optional external ID."},...tx},Zh=t=>String.raw`if (has(p.${t})) record.entity = ref(p.${t}, '${t}'); if (has(p.subsidiaryId)) record.subsidiary = ref(p.subsidiaryId, 'subsidiaryId'); if (has(p.date)) record.tranDate = nsDate(p.date, 'date'); if (has(p.dueDate)) record.dueDate = nsDate(p.dueDate, 'dueDate'); if (has(p.memo)) record.memo = String(p.memo); if (has(p.currencyId)) record.currency = ref(p.currencyId, 'currencyId'); if (has(p.termsId)) record.terms = ref(p.termsId, 'termsId'); if (has(p.departmentId)) record.department = ref(p.departmentId, 'departmentId'); if (has(p.classId)) record.class = ref(p.classId, 'classId'); if (has(p.locationId)) record.location = ref(p.locationId, 'locationId'); if (has(p.externalId)) record.externalId = String(p.externalId);`,Kh=t=>({subsidiaryId:{type:"string",description:t==="create"?"Optional subsidiary internal ID; defaults to the entity's subsidiary.":"Optional new subsidiary internal ID."},date:{type:"string",description:t==="create"?"Transaction date as YYYY-MM-DD.":"Optional new transaction date as YYYY-MM-DD."},dueDate:{type:"string",description:"Optional due date as YYYY-MM-DD."},memo:{type:"string",description:"Optional memo."},currencyId:{type:"string",description:"Optional currency internal ID."},termsId:{type:"string",description:"Optional payment terms internal ID."},departmentId:{type:"string",description:"Optional header department internal ID."},classId:{type:"string",description:"Optional header class internal ID."},locationId:{type:"string",description:"Optional header location internal ID."},externalId:{type:"string",description:"Optional external ID."}}),rx=String.raw`if (has(line.departmentId)) item.department = ref(line.departmentId, 'lines[' + index + '].departmentId'); if (has(line.classId)) item.class = ref(line.classId, 'lines[' + index + '].classId'); if (has(line.locationId)) item.location = ref(line.locationId, 'lines[' + index + '].locationId');`,ZM=String.raw`if (Array.isArray(p.lines) && p.lines.length > 0) record.item = { items: p.lines.map((line, index) => { const item = { item: ref(line && line.itemId, 'lines[' + index + '].itemId') }; if (has(line.quantity)) { const quantity = Number(line.quantity); if (!Number.isFinite(quantity)) throw new Error('lines[' + index + '].quantity must be a number.'); item.quantity = quantity; } if (has(line.rate)) { const rate = Number(line.rate); if (!Number.isFinite(rate)) throw new Error('lines[' + index + '].rate must be a number.'); item.rate = rate; } if (has(line.amount)) { const amount = Number(line.amount); if (!Number.isFinite(amount)) throw new Error('lines[' + index + '].amount must be a number.'); item.amount = amount; } if (has(line.description)) item.description = String(line.description); if (has(line.taxCodeId)) item.taxCode = ref(line.taxCodeId, 'lines[' + index + '].taxCodeId'); ${rx} return item; }) };`,KM={type:"object",properties:{itemId:{type:"string",description:"Item internal ID."},quantity:{type:"number",description:"Optional quantity. Defaults to 1."},rate:{type:"number",description:"Optional unit price; defaults to the item price."},amount:{type:"number",description:"Optional line amount."},description:{type:"string",description:"Optional line description."},taxCodeId:{type:"string",description:"Optional tax code internal ID."},departmentId:{type:"string",description:"Optional department internal ID."},classId:{type:"string",description:"Optional class internal ID. Some accounts ignore line classes on invoices; check the saved record."},locationId:{type:"string",description:"Optional location internal ID."}},required:["itemId"],additionalProperties:!1},XM=String.raw`if (Array.isArray(p.lines) && p.lines.length > 0) record.expense = { items: p.lines.map((line, index) => { const amount = Number(line && line.amount); if (!Number.isFinite(amount) || amount <= 0) throw new Error('lines[' + index + '].amount must be a positive number.'); const item = { account: ref(line.accountId, 'lines[' + index + '].accountId'), amount }; if (has(line.memo)) item.memo = String(line.memo); ${rx} return item; }) };`,ex={type:"object",properties:{accountId:{type:"string",description:"Expense account internal ID."},amount:{type:"number",description:"Positive amount."},memo:{type:"string",description:"Optional line memo."},departmentId:{type:"string",description:"Optional department internal ID."},classId:{type:"string",description:"Optional class internal ID."},locationId:{type:"string",description:"Optional location internal ID."}},required:["accountId","amount"],additionalProperties:!1},Sa="Re-running this tool creates another record; it is not idempotent.",TAe=[gs({id:"netsuite-list-accounts",name:"List NetSuite chart of accounts",shortName:"Chart of accounts",instruction:"Lists general ledger accounts (the chart of accounts) from NetSuite with number, name, type, parent and subsidiaries. Useful for validating an imported chart of accounts.",stepId:"queryAccounts",collection:"accounts",select:"SELECT a.id, a.acctnumber, a.accountsearchdisplaynamecopy AS name, a.fullname, a.accttype, a.parent, a.subsidiary, cur.symbol AS currency, a.description, a.issummary, a.isinactive FROM account a LEFT JOIN currency cur ON cur.id = a.currency",orderBy:"a.id",filters:[Sd("a"),{input:"accountType",kind:"enum",values:hb,clause:"a.accttype = '$'",schema:{type:"string",enum:hb,description:"Only accounts of this NetSuite account type, e.g. Bank or Expense."}},{input:"numberPrefix",kind:"prefix",clause:"a.acctnumber LIKE '$%'",schema:{type:"string",description:"Only accounts whose number starts with this value, e.g. 1000 or 60."}}],mapRow:"(row) => ({ id: row.id, number: str(row.acctnumber), name: str(row.name), fullName: str(row.fullname), type: str(row.accttype), parentId: str(row.parent), subsidiaryIds: ids(row.subsidiary), currency: str(row.currency), description: str(row.description), isSummary: bool(row.issummary), isInactive: bool(row.isinactive) })"}),gs({id:"netsuite-list-customers",name:"List NetSuite customers",shortName:"Customers",instruction:"Lists customer records from NetSuite with subsidiary, currency and open balance. Useful for verifying migrated AR master data.",stepId:"queryCustomers",collection:"customers",select:"SELECT c.id, c.entityid, c.companyname, c.isperson, c.firstname, c.lastname, c.email, c.phone, c.subsidiary, BUILTIN.DF(c.subsidiary) AS subsidiaryname, cur.symbol AS currency, c.balancesearch, c.overduebalancesearch, c.isinactive, TO_CHAR(c.datecreated, 'YYYY-MM-DD') AS datecreated, TO_CHAR(c.lastmodifieddate, 'YYYY-MM-DD') AS lastmodified FROM customer c LEFT JOIN currency cur ON cur.id = c.currency",orderBy:"c.id",filters:[Sd("c"),wd("c")],mapRow:"(row) => ({ id: row.id, entityId: str(row.entityid), companyName: str(row.companyname), isPerson: bool(row.isperson), firstName: str(row.firstname), lastName: str(row.lastname), email: str(row.email), phone: str(row.phone), subsidiaryId: str(row.subsidiary), subsidiary: str(row.subsidiaryname), currency: str(row.currency), balance: num(row.balancesearch), overdueBalance: num(row.overduebalancesearch), isInactive: bool(row.isinactive), createdOn: str(row.datecreated), modifiedOn: str(row.lastmodified) })"}),gs({id:"netsuite-list-vendors",name:"List NetSuite vendors",shortName:"Vendors",instruction:"Lists vendor records from NetSuite with subsidiary, currency and balance. Useful for verifying migrated AP master data.",stepId:"queryVendors",collection:"vendors",select:"SELECT v.id, v.entityid, v.companyname, v.isperson, v.firstname, v.lastname, v.email, v.phone, v.subsidiary, BUILTIN.DF(v.subsidiary) AS subsidiaryname, cur.symbol AS currency, v.balance, v.isinactive, TO_CHAR(v.datecreated, 'YYYY-MM-DD') AS datecreated, TO_CHAR(v.lastmodifieddate, 'YYYY-MM-DD') AS lastmodified FROM vendor v LEFT JOIN currency cur ON cur.id = v.currency",orderBy:"v.id",filters:[Sd("v"),wd("v")],mapRow:"(row) => ({ id: row.id, entityId: str(row.entityid), companyName: str(row.companyname), isPerson: bool(row.isperson), firstName: str(row.firstname), lastName: str(row.lastname), email: str(row.email), phone: str(row.phone), subsidiaryId: str(row.subsidiary), subsidiary: str(row.subsidiaryname), currency: str(row.currency), balance: num(row.balance), isInactive: bool(row.isinactive), createdOn: str(row.datecreated), modifiedOn: str(row.lastmodified) })"}),gs({id:"netsuite-list-journal-entries",name:"List NetSuite journal entries",shortName:"Journal entries",instruction:"Lists journal entry lines from NetSuite, one row per GL line and accounting book with journal, date, period, account, debit, credit and dimensions. Useful for verifying opening balances and postings at cutover.",stepId:"queryJournalLines",collection:"journalLines",select:"SELECT t.id AS journalid, t.tranid, TO_CHAR(t.trandate, 'YYYY-MM-DD') AS trandate, BUILTIN.DF(t.postingperiod) AS period, t.subsidiary, BUILTIN.DF(t.status) AS status, t.posting, t.memo AS journalmemo, cur.symbol AS currency, tl.id AS lineid, tal.accountingbook, tal.account, a.acctnumber, a.accountsearchdisplaynamecopy AS accountname, tal.debit, tal.credit, tl.memo, tl.department, tl.class, tl.location, tl.entity FROM transaction t JOIN transactionline tl ON tl.transaction = t.id JOIN transactionaccountingline tal ON tal.transaction = tl.transaction AND tal.transactionline = tl.id JOIN account a ON a.id = tal.account LEFT JOIN currency cur ON cur.id = t.currency",baseWhere:["t.type = 'Journal'"],orderBy:"t.id, tl.id, tal.accountingbook",filters:[...db,wd("t")],mapRow:"(row) => ({ journalId: row.journalid, tranId: str(row.tranid), date: str(row.trandate), period: str(row.period), subsidiaryId: str(row.subsidiary), status: status(row.status), posting: bool(row.posting), journalMemo: str(row.journalmemo), currency: str(row.currency), line: num(row.lineid), accountingBookId: str(row.accountingbook), accountId: str(row.account), accountNumber: str(row.acctnumber), accountName: str(row.accountname), debit: num(row.debit), credit: num(row.credit), memo: str(row.memo), departmentId: str(row.department), classId: str(row.class), locationId: str(row.location), entityId: str(row.entity) })"}),gs({id:"netsuite-list-invoices",name:"List NetSuite invoices",shortName:"Invoices",instruction:"Lists customer invoices from NetSuite with customer, dates, status, total and amount due. Useful for verifying migrated open AR at go-live.",stepId:"queryInvoices",collection:"invoices",select:"SELECT t.id, t.tranid, t.entity, BUILTIN.DF(t.entity) AS customername, TO_CHAR(t.trandate, 'YYYY-MM-DD') AS trandate, TO_CHAR(t.duedate, 'YYYY-MM-DD') AS duedate, BUILTIN.DF(t.status) AS status, cur.symbol AS currency, t.foreigntotal, t.foreignamountunpaid, t.subsidiary, t.memo FROM transaction t LEFT JOIN currency cur ON cur.id = t.currency",baseWhere:["t.type = 'CustInvc'"],orderBy:"t.id",filters:[...db,wd("t"),{input:"openOnly",kind:"flag",clause:"t.status = 'A'",schema:{type:"boolean",description:"Only return open (unpaid) invoices."}}],mapRow:"(row) => ({ id: row.id, tranId: str(row.tranid), customerId: str(row.entity), customer: str(row.customername), date: str(row.trandate), dueDate: str(row.duedate), status: status(row.status), currency: str(row.currency), total: num(row.foreigntotal), amountDue: num(row.foreignamountunpaid), subsidiaryId: str(row.subsidiary), memo: str(row.memo) })"}),gs({id:"netsuite-list-vendor-bills",name:"List NetSuite vendor bills",shortName:"Vendor bills",instruction:"Lists vendor bills from NetSuite with vendor, dates, status, approval status, total and amount due. Useful for verifying migrated open AP at go-live.",stepId:"queryBills",collection:"bills",select:"SELECT t.id, t.tranid, t.entity, BUILTIN.DF(t.entity) AS vendorname, TO_CHAR(t.trandate, 'YYYY-MM-DD') AS trandate, TO_CHAR(t.duedate, 'YYYY-MM-DD') AS duedate, BUILTIN.DF(t.status) AS status, BUILTIN.DF(t.approvalstatus) AS approvalstatus, cur.symbol AS currency, t.foreigntotal, t.foreignamountunpaid, t.subsidiary, t.memo FROM transaction t LEFT JOIN currency cur ON cur.id = t.currency",baseWhere:["t.type = 'VendBill'"],orderBy:"t.id",filters:[...db,wd("t"),{input:"openOnly",kind:"flag",clause:"t.status = 'A'",schema:{type:"boolean",description:"Only return open bills (approved and not fully paid)."}}],mapRow:"(row) => ({ id: row.id, referenceNo: str(row.tranid), vendorId: str(row.entity), vendor: str(row.vendorname), date: str(row.trandate), dueDate: str(row.duedate), status: status(row.status), approvalStatus: str(row.approvalstatus), currency: str(row.currency), total: row.foreigntotal === undefined ? null : Math.abs(Number(row.foreigntotal)), amountDue: num(row.foreignamountunpaid), subsidiaryId: str(row.subsidiary), memo: str(row.memo) })"}),gs({id:"netsuite-list-dimensions",name:"List NetSuite departments, classes or locations",shortName:"Departments, classes, locations",instruction:"Lists department, class or location records from NetSuite with hierarchy and subsidiaries. Useful for validating the dimension setup after an implementation and for finding the internal IDs the write tools need.",stepId:"queryDimensions",collection:"records",properties:{dimension:{type:"string",enum:["department","class","location"],description:"Which dimension to list."}},required:["dimension"],select:{js:String.raw`'SELECT d.id, d.name, d.fullname, d.parent, d.subsidiary, d.includechildren, d.isinactive FROM ' + (() => { const table = { department: 'department', class: 'classification', location: 'location' }[String(p.dimension || '')]; if (!table) throw new Error("dimension must be 'department', 'class' or 'location'."); return table; })() + ' d'`},orderBy:"d.id",filters:[Sd("d")],mapRow:"(row) => ({ id: row.id, name: str(row.name), fullName: str(row.fullname), parentId: str(row.parent), subsidiaryIds: ids(row.subsidiary), includeChildren: bool(row.includechildren), isInactive: bool(row.isinactive) })"}),gs({id:"netsuite-list-subsidiaries",name:"List NetSuite subsidiaries",shortName:"Subsidiaries",instruction:"Lists subsidiaries from NetSuite with hierarchy, country, base currency and elimination flag. Most create tools need a subsidiary ID from this list in OneWorld accounts.",stepId:"querySubsidiaries",collection:"subsidiaries",select:"SELECT s.id, s.name, s.fullname, s.parent, s.country, cur.symbol AS currency, s.iselimination, s.isinactive FROM subsidiary s LEFT JOIN currency cur ON cur.id = s.currency",orderBy:"s.id",filters:[Sd("s")],mapRow:"(row) => ({ id: row.id, name: str(row.name), fullName: str(row.fullname), parentId: str(row.parent), country: str(row.country), currency: str(row.currency), isElimination: bool(row.iselimination), isInactive: bool(row.isinactive) })"}),{id:"netsuite-suiteql-query",name:"Run a NetSuite SuiteQL query",shortName:"SuiteQL query",instruction:"Runs a read-only SuiteQL SELECT query against NetSuite, for any record type, join or aggregate outside the prebuilt lists (for example items, employees, transaction lines or custom records). The workhorse tool for migration validation. Returns up to 1000 rows in one call with the total row count and hasMore; values are strings as NetSuite returns them.",inputSchema:{type:"object",properties:{query:{type:"string",description:`SuiteQL SELECT statement, e.g. "SELECT id, itemid, displayname FROM item WHERE isinactive = 'F' ORDER BY id". Dates come back in the user's date format; use TO_CHAR(field, 'YYYY-MM-DD') for ISO dates and BUILTIN.DF(field) for display names. For more than 1000 rows, page by key: ORDER BY id and add WHERE id > <last id>. Common columns: account (id, acctnumber, accountsearchdisplaynamecopy as the name, fullname, accttype, isinactive; there is no acctname column), customer (id, entityid, companyname, email, subsidiary, balancesearch, isinactive), vendor (id, entityid, companyname, email, subsidiary, balance, isinactive), transaction (id, tranid, type, trandate, entity, status, foreigntotal, foreignamountunpaid, subsidiary). Alias tables and qualify columns: FROM transaction t ... t.subsidiary works, an unqualified subsidiary fails.`},maxResults:{type:"integer",minimum:1,maximum:1e3,description:"Maximum number of rows to return (max 1000). Defaults to 100."}},required:["query"],additionalProperties:!1},steps:[{id:"runSuiteQl",instruction:"Run the SuiteQL query.",config:{type:"request",systemId:Qd,url:`${Xh}/query/v1/suiteql`,method:"POST",headers:{...eg,"Content-Type":"application/json",Prefer:"transient"},queryParams:{limit:"<<(p) => Math.min(Math.max(Math.floor(Number(p.maxResults)) || 100, 2), 1000)>>",offset:"0"},body:String.raw`<<(p) => { const query = String(p.query || '').trim(); if (!/^(select|with)\b/i.test(query)) throw new Error('query must be a SuiteQL SELECT statement.'); return JSON.stringify({ q: query }); }>>`}}],outputTransform:`(sourceData) => { ${jM} const data = sourceData.runSuiteQl && sourceData.runSuiteQl.data ? sourceData.runSuiteQl.data : {}; const items = Array.isArray(data.items) ? data.items : []; const max = Math.min(Math.max(Math.floor(Number(sourceData.maxResults)) || 100, 1), 1000); const records = stripLinks(items.slice(0, max)); const total = data.totalResults !== undefined ? Number(data.totalResults) : items.length; return { total, returned: records.length, hasMore: total > records.length, records }; }`},{id:"netsuite-get-record",name:"Get a NetSuite record",shortName:"Get record",instruction:"Fetches one NetSuite record of any type by internal ID or external ID through the REST record API, including its sublists such as transaction lines. Useful for inspecting a record in full before or after a write.",inputSchema:{type:"object",properties:{recordType:{type:"string",description:'REST record type, e.g. "customer", "vendor", "invoice", "vendorbill", "journalentry", "account", "department" or a custom record like "customrecord_x".'},internalId:{type:"string",description:"Internal ID of the record."},externalId:{type:"string",description:"External ID of the record, used when internalId is not set."},expandSubResources:{type:"boolean",description:"Include sublists and subrecords inline. Defaults to true."}},required:["recordType"],additionalProperties:!1},steps:[{id:"getRecord",instruction:"Fetch the record from the REST record API.",config:{type:"request",systemId:Qd,url:`${Xh}/record/v1/<<(p) => { const type = String(p.recordType || '').trim().toLowerCase(); if (!/^[a-z][a-z0-9_]*$/.test(type)) throw new Error('recordType must contain only letters, numbers and underscores.'); return type; }>>/<<(p) => { if (p.internalId !== undefined && p.internalId !== null && p.internalId !== '') { const id = String(p.internalId).trim(); if (!/^-?\\d+$/.test(id)) throw new Error('internalId must be a NetSuite internal ID.'); return id; } if (p.externalId !== undefined && p.externalId !== null && p.externalId !== '') return 'eid:' + encodeURIComponent(String(p.externalId)); throw new Error('Provide internalId or externalId.'); }>>`,method:"GET",headers:eg,queryParams:{expandSubResources:"<<(p) => (p.expandSubResources === false || p.expandSubResources === 'false' ? 'false' : 'true')>>"}}}],outputTransform:`(sourceData) => { ${jM} const record = sourceData.getRecord ? sourceData.getRecord.data : undefined; if (!record || typeof record !== 'object') throw new Error('NetSuite returned no record.'); return { record: stripLinks(record) }; }`},mr({id:"netsuite-create-journal-entry",name:"Create NetSuite journal entry",shortName:"Create journal entry",instruction:`Creates a journal entry in NetSuite through the REST record API. Debit and credit lines must balance. Returns the new internal ID. ${Sa}`,stepId:"createJournalEntry",recordType:"journalentry",mode:"create",properties:{...GM("create"),lines:{type:"array",description:"Journal lines. Debit and credit totals must balance.",items:HM}},required:["date","lines"],body:`${zM} if (!Array.isArray(p.lines) || p.lines.length < 2) throw new Error('lines must contain at least two journal lines.'); ${qM}`}),mr({id:"netsuite-update-journal-entry",name:"Update NetSuite journal entry",shortName:"Update journal entry",instruction:"Updates an existing NetSuite journal entry by internal ID. Only the provided fields change. When lines are provided they replace all existing lines and must balance. Entries in closed periods refuse updates.",stepId:"updateJournalEntry",recordType:"journalentry",mode:"update",properties:{...GM("update"),lines:{type:"array",description:"Optional replacement lines. When set, they replace every existing line and must balance.",items:HM}},required:[],body:`${zM} if (Array.isArray(p.lines) && p.lines.length < 2) throw new Error('lines must contain at least two journal lines; omit lines to keep the current ones.'); ${qM}`,replaceSublist:{input:"lines",sublist:"line"}}),mr({id:"netsuite-create-vendor",name:"Create NetSuite vendor",shortName:"Create vendor",instruction:`Creates a vendor record in NetSuite. OneWorld accounts need a subsidiaryId. Omit entityId when auto-numbering assigns it. ${Sa}`,stepId:"createVendor",recordType:"vendor",mode:"create",properties:Vh("vendor"),required:[],body:`if (!has(p.companyName) && !((p.isPerson === true || p.isPerson === 'true') && has(p.lastName))) throw new Error('Provide companyName, or isPerson with lastName.'); ${Yh}`}),mr({id:"netsuite-update-vendor",name:"Update NetSuite vendor",shortName:"Update vendor",instruction:"Updates an existing NetSuite vendor by internal ID. Only the provided fields change; set isInactive to inactivate or reactivate it.",stepId:"updateVendor",recordType:"vendor",mode:"update",properties:{...Vh("vendor"),...Jh},required:[],body:Yh}),mr({id:"netsuite-create-customer",name:"Create NetSuite customer",shortName:"Create customer",instruction:`Creates a customer record in NetSuite. OneWorld accounts need a subsidiaryId. Omit entityId when auto-numbering assigns it. ${Sa}`,stepId:"createCustomer",recordType:"customer",mode:"create",properties:Vh("customer"),required:[],body:`if (!has(p.companyName) && !((p.isPerson === true || p.isPerson === 'true') && has(p.lastName))) throw new Error('Provide companyName, or isPerson with lastName.'); ${Yh}`}),mr({id:"netsuite-update-customer",name:"Update NetSuite customer",shortName:"Update customer",instruction:"Updates an existing NetSuite customer by internal ID. Only the provided fields change; set isInactive to inactivate or reactivate it.",stepId:"updateCustomer",recordType:"customer",mode:"update",properties:{...Vh("customer"),...Jh},required:[],body:Yh}),mr({id:"netsuite-create-account",name:"Create NetSuite GL account",shortName:"Create GL account",instruction:`Creates a general ledger account in NetSuite's chart of accounts. ${Sa}`,stepId:"createAccount",recordType:"account",mode:"create",properties:VM,required:["acctName","acctType"],body:`if (!has(p.acctName) || !has(p.acctType)) throw new Error('acctName and acctType are required.'); ${YM} ${Wh}`}),mr({id:"netsuite-update-account",name:"Update NetSuite GL account",shortName:"Update GL account",instruction:"Updates an existing NetSuite GL account by internal ID. Only the provided fields change; set isInactive to inactivate or reactivate it. Accounts with transactions may refuse a type change.",stepId:"updateAccount",recordType:"account",mode:"update",properties:{...VM,...Jh},required:[],body:`${YM} ${Wh}`}),mr({id:"netsuite-create-invoice",name:"Create NetSuite invoice",shortName:"Create invoice",instruction:`Creates a customer invoice in NetSuite with item lines. Item, tax and posting rules of the account apply. ${Sa}`,stepId:"createInvoice",recordType:"invoice",mode:"create",properties:{customerId:{type:"string",description:"Customer internal ID."},...Kh("create"),lines:{type:"array",description:"Item lines.",items:KM}},required:["customerId","lines"],body:`if (!Array.isArray(p.lines) || p.lines.length === 0) throw new Error('lines must contain at least one item line.'); ${Zh("customerId")} ${ZM}`}),mr({id:"netsuite-update-invoice",name:"Update NetSuite invoice",shortName:"Update invoice",instruction:"Updates an existing NetSuite invoice by internal ID. Only the provided fields change. When lines are provided they replace all existing item lines. Paid invoices and closed periods may refuse updates.",stepId:"updateInvoice",recordType:"invoice",mode:"update",properties:{customerId:{type:"string",description:"Optional new customer internal ID."},...Kh("update"),lines:{type:"array",description:"Optional replacement item lines; they replace every existing item line.",items:KM}},required:[],body:`if (Array.isArray(p.lines) && p.lines.length === 0) throw new Error('lines must contain at least one item line; omit lines to keep the current ones.'); ${Zh("customerId")} ${ZM}`,replaceSublist:{input:"lines",sublist:"item"}}),mr({id:"netsuite-create-vendor-bill",name:"Create NetSuite vendor bill",shortName:"Create vendor bill",instruction:`Creates a vendor bill in NetSuite with expense lines. Approval routing of the account applies. ${Sa}`,stepId:"createVendorBill",recordType:"vendorbill",mode:"create",properties:{vendorId:{type:"string",description:"Vendor internal ID."},referenceNo:{type:"string",description:"Optional vendor invoice reference number."},...Kh("create"),lines:{type:"array",description:"Expense lines.",items:ex}},required:["vendorId","lines"],body:`if (!Array.isArray(p.lines) || p.lines.length === 0) throw new Error('lines must contain at least one expense line.'); ${Zh("vendorId")} if (has(p.referenceNo)) record.tranId = String(p.referenceNo); ${XM}`}),mr({id:"netsuite-update-vendor-bill",name:"Update NetSuite vendor bill",shortName:"Update vendor bill",instruction:"Updates an existing NetSuite vendor bill by internal ID. Only the provided fields change. When lines are provided they replace all existing expense lines. Paid bills and closed periods may refuse updates.",stepId:"updateVendorBill",recordType:"vendorbill",mode:"update",properties:{vendorId:{type:"string",description:"Optional new vendor internal ID."},referenceNo:{type:"string",description:"Optional vendor invoice reference number."},...Kh("update"),lines:{type:"array",description:"Optional replacement expense lines; they replace every existing expense line.",items:ex}},required:[],body:`if (Array.isArray(p.lines) && p.lines.length === 0) throw new Error('lines must contain at least one expense line; omit lines to keep the current ones.'); ${Zh("vendorId")} if (has(p.referenceNo)) record.tranId = String(p.referenceNo); ${XM}`,replaceSublist:{input:"lines",sublist:"expense"}}),mr({id:"netsuite-create-department",name:"Create NetSuite department",shortName:"Create department",instruction:`Creates a department in NetSuite. Without subsidiaryIds NetSuite assigns the parent subsidiary. ${Sa}`,stepId:"createDepartment",recordType:"department",mode:"create",properties:WM,required:["name"],body:`if (!has(p.name)) throw new Error('name is required.'); ${JM} ${Wh}`}),mr({id:"netsuite-update-department",name:"Update NetSuite department",shortName:"Update department",instruction:"Updates an existing NetSuite department by internal ID. Only the provided fields change; set isInactive to inactivate or reactivate it.",stepId:"updateDepartment",recordType:"department",mode:"update",properties:{...WM,...Jh},required:[],body:`${JM} ${Wh}`})],Ab={sap_s4hana:{bundleId:"sap_s4hana",templateId:"sap_s4hana",systemId:"sap_s4hana",displayName:"SAP S/4HANA",description:"Read business partners, sales orders, products and purchase orders from SAP.",systemUrl:IAe,credentialHint:"Works instantly with SAP's demo data. Add your own key later for your live system.",requiredCredentialKeys:["api_key"],demoCredentials:{api_key:"K8reTgiKCCaqvAPWC4cOjqqiLdLE8dqz"},mcpServer:{name:"sap",displayName:"SAP S/4HANA",description:"Business partners, sales orders, products and purchase orders from SAP."},installMcpServer:!0,agentLaunch:{userPrompt:"I just installed the SAP S/4HANA bundle. What can I do with it?",nextSteps:"Your first reply must be short: SAP is connected to free demo data and works right now, so offer to run one tool immediately as proof. No credential collection is needed to start. If they want their own data: their own free key comes from https://api.sap.com (SAP Business Accelerator Hub), collected with set_credentials, never as chat text and never via the Credentials page; the system URL can then be switched to their own SAP host. Do not list the installed tools, do not add tips or explain SAP concepts unless asked."},tools:[{id:"sap-list-business-partners",name:"List SAP business partners",shortName:"Business partners",instruction:"Lists business partners (customers, suppliers, contacts) from SAP S/4HANA. Supports an optional OData $filter.",inputSchema:{type:"object",properties:{filter:{type:"string",description:`Optional OData $filter expression, e.g. "BusinessPartnerCategory eq '2'" for organizations.`},maxResults:{type:"integer",description:"Maximum number of business partners to return. Defaults to 200."}},additionalProperties:!0},steps:[{id:"fetchBusinessPartners",instruction:"Fetch business partners, paging through results with $skip.",config:{type:"request",systemId:"sap_s4hana",url:"<<sap_s4hana_url>>/API_BUSINESS_PARTNER/A_BusinessPartner",method:"GET",headers:{APIKey:"<<sap_s4hana_api_key>>",Accept:"application/json"},queryParams:{$format:"json",$top:"<<pageSize>>",$skip:"<<offset>>",$filter:"<<filter>>",$select:"BusinessPartner,BusinessPartnerFullName,BusinessPartnerCategory,BusinessPartnerGrouping,CreationDate"},pagination:{type:"offsetBased",pageSize:"100",stopCondition:"(response, pageInfo, sourceData) => { const rows = response?.data?.d?.results ?? []; const fetched = pageInfo?.mergedResult?.d?.results?.length ?? 0; const max = sourceData?.maxResults ?? 200; return rows.length === 0 || fetched >= max; }"}}}],outputTransform:"(sourceData) => { const d = (v) => { if (typeof v !== 'string' || !v.startsWith('/Date(')) return v; const n = parseInt(v.slice(6), 10); return Number.isFinite(n) ? new Date(n).toISOString().slice(0, 10) : v; }; const rows = (sourceData.fetchBusinessPartners?.data?.d?.results ?? []).slice(0, sourceData.maxResults ?? 200); return { total: rows.length, businessPartners: rows.map((r) => ({ id: r.BusinessPartner, name: r.BusinessPartnerFullName, category: r.BusinessPartnerCategory, grouping: r.BusinessPartnerGrouping, createdOn: d(r.CreationDate) })) }; }"},{id:"sap-list-sales-orders",name:"List SAP sales orders",shortName:"Sales orders",instruction:"Lists sales orders from SAP S/4HANA with their net amount, currency and sold-to party. Supports an optional OData $filter.",inputSchema:{type:"object",properties:{filter:{type:"string",description:`Optional OData $filter expression, e.g. "SalesOrderType eq 'OR'" or "TotalNetAmount gt 1000".`},maxResults:{type:"integer",description:"Maximum number of sales orders to return. Defaults to 200."}},additionalProperties:!0},steps:[{id:"fetchSalesOrders",instruction:"Fetch sales orders, paging through results with $skip.",config:{type:"request",systemId:"sap_s4hana",url:"<<sap_s4hana_url>>/API_SALES_ORDER_SRV/A_SalesOrder",method:"GET",headers:{APIKey:"<<sap_s4hana_api_key>>",Accept:"application/json"},queryParams:{$format:"json",$top:"<<pageSize>>",$skip:"<<offset>>",$filter:"<<filter>>",$select:"SalesOrder,SalesOrderType,SoldToParty,TotalNetAmount,TransactionCurrency,SalesOrderDate,OverallSDProcessStatus"},pagination:{type:"offsetBased",pageSize:"100",stopCondition:"(response, pageInfo, sourceData) => { const rows = response?.data?.d?.results ?? []; const fetched = pageInfo?.mergedResult?.d?.results?.length ?? 0; const max = sourceData?.maxResults ?? 200; return rows.length === 0 || fetched >= max; }"}}}],outputTransform:"(sourceData) => { const d = (v) => { if (typeof v !== 'string' || !v.startsWith('/Date(')) return v; const n = parseInt(v.slice(6), 10); return Number.isFinite(n) ? new Date(n).toISOString().slice(0, 10) : v; }; const rows = (sourceData.fetchSalesOrders?.data?.d?.results ?? []).slice(0, sourceData.maxResults ?? 200); return { total: rows.length, salesOrders: rows.map((r) => ({ id: r.SalesOrder, type: r.SalesOrderType, soldToParty: r.SoldToParty, netAmount: Number(r.TotalNetAmount), currency: r.TransactionCurrency, orderDate: d(r.SalesOrderDate), status: r.OverallSDProcessStatus })) }; }"},{id:"sap-list-products",name:"List SAP products",shortName:"Products",instruction:"Lists products (materials) from SAP S/4HANA with their type, group and base unit. Supports an optional OData $filter.",inputSchema:{type:"object",properties:{filter:{type:"string",description:`Optional OData $filter expression, e.g. "ProductType eq 'FERT'" for finished goods.`},maxResults:{type:"integer",description:"Maximum number of products to return. Defaults to 200."}},additionalProperties:!0},steps:[{id:"fetchProducts",instruction:"Fetch products, paging through results with $skip.",config:{type:"request",systemId:"sap_s4hana",url:"<<sap_s4hana_url>>/API_PRODUCT_SRV/A_Product",method:"GET",headers:{APIKey:"<<sap_s4hana_api_key>>",Accept:"application/json"},queryParams:{$format:"json",$top:"<<pageSize>>",$skip:"<<offset>>",$filter:"<<filter>>",$expand:"to_Description",$select:"Product,ProductType,ProductGroup,BaseUnit,GrossWeight,WeightUnit,CreationDate,to_Description/Language,to_Description/ProductDescription"},pagination:{type:"offsetBased",pageSize:"100",stopCondition:"(response, pageInfo, sourceData) => { const rows = response?.data?.d?.results ?? []; const fetched = pageInfo?.mergedResult?.d?.results?.length ?? 0; const max = sourceData?.maxResults ?? 200; return rows.length === 0 || fetched >= max; }"}}}],outputTransform:"(sourceData) => { const d = (v) => { if (typeof v !== 'string' || !v.startsWith('/Date(')) return v; const n = parseInt(v.slice(6), 10); return Number.isFinite(n) ? new Date(n).toISOString().slice(0, 10) : v; }; const nameOf = (r) => { const list = r.to_Description?.results ?? []; const hit = list.find((x) => x.Language === 'EN') ?? list[0]; return hit?.ProductDescription; }; const rows = (sourceData.fetchProducts?.data?.d?.results ?? []).slice(0, sourceData.maxResults ?? 200); return { total: rows.length, products: rows.map((r) => ({ id: r.Product, name: nameOf(r), type: r.ProductType, group: r.ProductGroup, baseUnit: r.BaseUnit, grossWeight: Number(r.GrossWeight), weightUnit: r.WeightUnit, createdOn: d(r.CreationDate) })) }; }"},{id:"sap-list-purchase-orders",name:"List SAP purchase orders",shortName:"Purchase orders",instruction:"Lists purchase orders from SAP S/4HANA with their supplier, currency and creation date. Supports an optional OData $filter.",inputSchema:{type:"object",properties:{filter:{type:"string",description:`Optional OData $filter expression, e.g. "PurchaseOrderType eq 'NB'" for standard orders.`},maxResults:{type:"integer",description:"Maximum number of purchase orders to return. Defaults to 200."}},additionalProperties:!0},steps:[{id:"fetchPurchaseOrders",instruction:"Fetch purchase orders, paging through results with $skip.",config:{type:"request",systemId:"sap_s4hana",url:"<<sap_s4hana_url>>/API_PURCHASEORDER_PROCESS_SRV/A_PurchaseOrder",method:"GET",headers:{APIKey:"<<sap_s4hana_api_key>>",Accept:"application/json"},queryParams:{$format:"json",$top:"<<pageSize>>",$skip:"<<offset>>",$filter:"<<filter>>",$select:"PurchaseOrder,PurchaseOrderType,Supplier,PurchaseOrderDate,DocumentCurrency,CreatedByUser"},pagination:{type:"offsetBased",pageSize:"100",stopCondition:"(response, pageInfo, sourceData) => { const rows = response?.data?.d?.results ?? []; const fetched = pageInfo?.mergedResult?.d?.results?.length ?? 0; const max = sourceData?.maxResults ?? 200; return rows.length === 0 || fetched >= max; }"}}}],outputTransform:"(sourceData) => { const d = (v) => { if (typeof v !== 'string' || !v.startsWith('/Date(')) return v; const n = parseInt(v.slice(6), 10); return Number.isFinite(n) ? new Date(n).toISOString().slice(0, 10) : v; }; const rows = (sourceData.fetchPurchaseOrders?.data?.d?.results ?? []).slice(0, sourceData.maxResults ?? 200); return { total: rows.length, purchaseOrders: rows.map((r) => ({ id: r.PurchaseOrder, type: r.PurchaseOrderType, supplier: r.Supplier, orderDate: d(r.PurchaseOrderDate), currency: r.DocumentCurrency, createdBy: r.CreatedByUser })) }; }"},{id:"sap-list-gl-accounts",name:"List SAP chart of accounts",shortName:"Chart of accounts",instruction:"Lists general ledger accounts (the chart of accounts) from SAP S/4HANA. Supports an optional OData $filter, e.g. by ChartOfAccounts.",inputSchema:{type:"object",properties:{filter:{type:"string",description:`Optional OData $filter expression, e.g. "ChartOfAccounts eq 'YCOA'" or "GLAccountType eq 'X'".`},maxResults:{type:"integer",description:"Maximum number of accounts to return. Defaults to 200."}},additionalProperties:!0},steps:[{id:"fetchGLAccounts",instruction:"Fetch GL accounts, paging through results with $skip.",config:{type:"request",systemId:"sap_s4hana",url:"<<sap_s4hana_url>>/API_GLACCOUNTINCHARTOFACCOUNTS_SRV/A_GLAccountInChartOfAccounts",method:"GET",headers:{APIKey:"<<sap_s4hana_api_key>>",Accept:"application/json"},queryParams:{$format:"json",$top:"<<pageSize>>",$skip:"<<offset>>",$filter:`<<(p) => p.filter ? "ChartOfAccounts ne '' and (" + p.filter + ")" : "ChartOfAccounts ne ''">>`,$expand:"to_Text",$select:"GLAccount,ChartOfAccounts,GLAccountType,GLAccountGroup,IsBalanceSheetAccount,AccountIsBlockedForPosting,to_Text/Language,to_Text/GLAccountName"},pagination:{type:"offsetBased",pageSize:"100",stopCondition:"(response, pageInfo, sourceData) => { const rows = response?.data?.d?.results ?? []; const fetched = pageInfo?.mergedResult?.d?.results?.length ?? 0; const max = sourceData?.maxResults ?? 200; return rows.length === 0 || fetched >= max; }"}}}],outputTransform:"(sourceData) => { const nameOf = (r) => { const list = r.to_Text?.results ?? []; const hit = list.find((x) => x.Language === 'EN') ?? list[0]; return hit?.GLAccountName; }; const rows = (sourceData.fetchGLAccounts?.data?.d?.results ?? []).slice(0, sourceData.maxResults ?? 200); return { total: rows.length, accounts: rows.map((r) => ({ account: r.GLAccount, name: nameOf(r), chartOfAccounts: r.ChartOfAccounts, type: r.GLAccountType, group: r.GLAccountGroup, isBalanceSheet: r.IsBalanceSheetAccount, blockedForPosting: r.AccountIsBlockedForPosting })) }; }"},{id:"sap-list-billing-documents",name:"List SAP billing documents",shortName:"Billing documents",instruction:"Lists billing documents (invoices, credit memos) from SAP S/4HANA with amount, currency and sold-to party. Supports an optional OData $filter.",inputSchema:{type:"object",properties:{filter:{type:"string",description:`Optional OData $filter expression, e.g. "BillingDocumentType eq 'F2'" or "TotalNetAmount gt 1000".`},maxResults:{type:"integer",description:"Maximum number of billing documents to return. Defaults to 200."}},additionalProperties:!0},steps:[{id:"fetchBillingDocuments",instruction:"Fetch billing documents, paging through results with $skip.",config:{type:"request",systemId:"sap_s4hana",url:"<<sap_s4hana_url>>/API_BILLING_DOCUMENT_SRV/A_BillingDocument",method:"GET",headers:{APIKey:"<<sap_s4hana_api_key>>",Accept:"application/json"},queryParams:{$format:"json",$top:"<<pageSize>>",$skip:"<<offset>>",$filter:"<<filter>>",$select:"BillingDocument,BillingDocumentType,SoldToParty,TotalNetAmount,TransactionCurrency,BillingDocumentDate"},pagination:{type:"offsetBased",pageSize:"100",stopCondition:"(response, pageInfo, sourceData) => { const rows = response?.data?.d?.results ?? []; const fetched = pageInfo?.mergedResult?.d?.results?.length ?? 0; const max = sourceData?.maxResults ?? 200; return rows.length === 0 || fetched >= max; }"}}}],outputTransform:"(sourceData) => { const d = (v) => { if (typeof v !== 'string' || !v.startsWith('/Date(')) return v; const n = parseInt(v.slice(6), 10); return Number.isFinite(n) ? new Date(n).toISOString().slice(0, 10) : v; }; const rows = (sourceData.fetchBillingDocuments?.data?.d?.results ?? []).slice(0, sourceData.maxResults ?? 200); return { total: rows.length, billingDocuments: rows.map((r) => ({ id: r.BillingDocument, type: r.BillingDocumentType, soldToParty: r.SoldToParty, netAmount: Number(r.TotalNetAmount), currency: r.TransactionCurrency, date: d(r.BillingDocumentDate) })) }; }"},{id:"sap-list-journal-entry-items",name:"List SAP journal entry line items",shortName:"Journal entries",instruction:"Lists journal entry line items (accounting document items) from SAP S/4HANA with company code, GL account, amount and posting date. Filter by CompanyCode, FiscalYear or PostingDate to keep results focused. Useful for verifying opening balances at cutover.",inputSchema:{type:"object",properties:{filter:{type:"string",description:`Optional OData $filter expression, e.g. "CompanyCode eq '1010' and FiscalYear eq '2026'".`},maxResults:{type:"integer",description:"Maximum number of line items to return. Defaults to 200."}},additionalProperties:!0},steps:[{id:"fetchJournalItems",instruction:"Fetch accounting document line items, paging through results with $skip.",config:{type:"request",systemId:"sap_s4hana",url:"<<sap_s4hana_url>>/API_OPLACCTGDOCITEMCUBE_SRV/A_OperationalAcctgDocItemCube",method:"GET",headers:{APIKey:"<<sap_s4hana_api_key>>",Accept:"application/json"},queryParams:{$format:"json",$top:"<<pageSize>>",$skip:"<<offset>>",$filter:"<<filter>>",$select:"AccountingDocument,CompanyCode,FiscalYear,GLAccount,AmountInCompanyCodeCurrency,PostingDate"},pagination:{type:"offsetBased",pageSize:"100",stopCondition:"(response, pageInfo, sourceData) => { const rows = response?.data?.d?.results ?? []; const fetched = pageInfo?.mergedResult?.d?.results?.length ?? 0; const max = sourceData?.maxResults ?? 200; return rows.length === 0 || fetched >= max; }"}}}],outputTransform:"(sourceData) => { const d = (v) => { if (typeof v !== 'string' || !v.startsWith('/Date(')) return v; const n = parseInt(v.slice(6), 10); return Number.isFinite(n) ? new Date(n).toISOString().slice(0, 10) : v; }; const rows = (sourceData.fetchJournalItems?.data?.d?.results ?? []).slice(0, sourceData.maxResults ?? 200); return { total: rows.length, journalItems: rows.map((r) => ({ document: r.AccountingDocument, companyCode: r.CompanyCode, fiscalYear: r.FiscalYear, account: r.GLAccount, amount: Number(r.AmountInCompanyCodeCurrency), postingDate: d(r.PostingDate) })) }; }"},{id:"sap-query-odata",name:"Query any SAP OData service",shortName:"Query any service",instruction:"Queries any SAP S/4HANA OData service and entity set (for example API_PRODUCT_SRV/A_ProductDescription or API_SALES_ORDER_SRV/A_SalesOrderItem) with optional $select and $filter. The workhorse tool for data checks beyond the prebuilt lists.",inputSchema:{type:"object",properties:{servicePath:{type:"string",description:'Service and entity set in SERVICE/EntitySet form, e.g. "API_SALES_ORDER_SRV/A_SalesOrderItem".'},select:{type:"string",description:"Comma-separated OData $select field list. Omit for all fields."},filter:{type:"string",description:"Optional OData $filter expression."},maxResults:{type:"integer",description:"Maximum number of records to return. Defaults to 100."}},required:["servicePath"],additionalProperties:!0},steps:[{id:"queryService",instruction:"Query the requested OData service and entity set.",config:{type:"request",systemId:"sap_s4hana",url:"<<sap_s4hana_url>>/<<servicePath>>",method:"GET",headers:{APIKey:"<<sap_s4hana_api_key>>",Accept:"application/json"},queryParams:{$format:"json",$select:"<<select>>",$filter:"<<filter>>",$top:"<<pageSize>>",$skip:"<<offset>>"},pagination:{type:"offsetBased",pageSize:"100",stopCondition:"(response, pageInfo, sourceData) => { const rows = response?.data?.d?.results ?? []; const fetched = pageInfo?.mergedResult?.d?.results?.length ?? 0; const max = sourceData?.maxResults ?? 100; return rows.length === 0 || fetched >= max; }"}}}],outputTransform:"(sourceData) => { const rows = (sourceData.queryService?.data?.d?.results ?? []).slice(0, sourceData.maxResults ?? 100); return { total: rows.length, records: rows.map((r) => { const { __metadata, ...rest } = r; return rest; }) }; }"}]},sage100:{bundleId:"sage100",templateId:"sage100",systemId:"sage100",displayName:"Sage 100",description:"Connect on-premises Sage 100 through the superglue Secure Gateway, with a guided setup playbook and a connection test against the Business Object Interface.",systemUrl:"script://runner/vbs32",credentialHint:"Your assistant first helps you connect a Secure Gateway on your Sage 100 server, then collects your Sage company and user details.",requiredCredentialKeys:["sage_home","sage_company","sage_user","sage_password"],mcpServer:{name:"sage-100",displayName:"Sage 100",description:"Sage 100 Business Object Interface access through the Secure Gateway."},installMcpServer:!1,playbook:{id:"sage100-native-integration",name:"Sage 100 Native Integration (BOI)",whenToRun:"Use when connecting a Sage 100 installation to superglue, testing that connection, or building tools that read or write Sage 100 data through the Business Object Interface.",inputs:"A Sage 100 installation on a Windows machine the user can access; a superglue API key for the gateway; the Sage company code, a Sage user with module access, and the path to the MAS90\\Home directory; the business outcome once connected.",instructions:"First check /org/tunnels for a connected gateway with a runner target. If none is connected, call setup_gateway with os windows and enableScriptRunner true (no targets are needed); the user runs the install command in PowerShell opened with 'Run as administrator' on the machine where Sage 100 and Workstation Setup are installed (the gateway must run there, ProvideX.Script is a local 32-bit COM class). The command installs the gateway as a Windows service and the call completes when it connects; never ask for the command or its key in chat. The same setup is in Systems \u2192 Connect system \u2192 Private System \u2192 Set up a gateway. The script runner option is required: it opts the gateway into running Sage scripts (it is code execution on their machine, so it is off by default), and it is what registers the built-in runner target. Only if the user cannot use that page, fall back to the manual setup: download https://downloads.superglue.cloud/superglue-gateway-windows.exe, create a config.yaml next to it with a tunnel_id, the server_url ending in /ws/tunnels (wss://api.superglue.cloud/ws/tunnels for hosted superglue), an API key from the API Keys page, and the line enable_script_runner: true, then run the executable. If a tunnel is connected but has no runner target, the gateway was set up without the script runner or is an outdated build; have the user set up the gateway again with the option selected, or add the flag and restart. The service runs as the Windows system account: if Sage data is on a mapped drive or a network share that account cannot reach, the connection test fails with a path or access error. When the tunnel with the runner target appears, attach it to this Sage 100 system with tools.writeSystem from superglue/approved (tunnel with that tunnelId) and keep the URL script://runner/vbs32. Collect sage_home (full path to the MAS90\\Home directory, for example C:\\Sage\\Sage100\\MAS90\\Home, not the MAS90 directory itself), sage_company, sage_user and sage_password through the secure credential form, never as chat text. Then run the Test Sage 100 connection tool once and interpret the result: retVal 0 failures carry the Sage reason in sLastErrorMsg (wrong credentials, missing role access, wrong company code); COM error 0x80040154 means the gateway is not running on a machine with Sage 100 Workstation Setup; a no-license message means all Sage user seats are in use. For new capabilities, build tools whose steps use the script protocol with VBScript in the body: log on with SY_Session, set module context before touching data (nSetDate with YYYYMMDD dates, nSetModule, nLookupTask, nSetProgram), use _svc service objects for reads and _bus business objects for writes, and always release the session with nCleanup and DropObject so the license seat frees up. For reads, set each key segment with nSetKeyValue then nFind for a single record, or browse with nMoveFirst and nMoveNext, and read each field with nGetValue passing a variable that receives the value. To write a document that has lines, such as a sales order, get the header _bus object, set the header fields, get its oLines object, call nAddLine, set the line fields, then call nWrite on the header to commit the header and its lines together. A write fails with a lock error if the record is open in the Sage desktop or held by another session, so report the lock message instead of retrying. Each running script briefly consumes a Sage user seat. Ask for explicit approval before any script that writes to Sage, and warn that records open in the Sage desktop UI cause lock errors.",completionCriteria:"The gateway is connected, the installed Sage 100 system has the tunnel attached and credentials saved, and the connection test returned company data from Sage 100. Any additional requested capability works end to end, with writes explicitly approved before they ran."},agentLaunch:{userPrompt:"I just installed the Sage 100 integration. Help me connect my Sage 100 server.",nextSteps:'Your first reply must be short: one line confirming the Sage 100 integration and setup playbook are installed, then start the connection flow. Check /org/tunnels for a connected gateway with a runner target first. If none exists, call setup_gateway with os windows and enableScriptRunner true (no targets are needed), and tell the user to run the install command in PowerShell opened with "Run as administrator" on the Windows machine where Sage 100 is installed and Workstation Setup has run. The call completes when the gateway connects; never ask for the command or its key in chat. The script runner option is required: it opts the gateway into running scripts on their machine (off by default because it is code execution) and is what registers the runner target. If a tunnel is connected but has no runner target, the gateway was set up without the script runner or is an outdated build: have the user set up the gateway again with the option selected. When setup_gateway completes, check that the returned targets include runner, then attach that tunnel to this Sage 100 system with tools.writeSystem from superglue/approved, keeping the URL script://runner/vbs32. Use set_credentials to collect sage_home (full path to the MAS90\\Home directory, for example C:\\Sage\\Sage100\\MAS90\\Home, not MAS90 itself), sage_company (for example ABC for the demo company), sage_user and sage_password. Never send the user to the Credentials page and never accept secrets as chat text. Then run the Test Sage 100 connection tool once. If it fails, explain the specific cause in plain language before retrying. Mention that each test briefly uses one Sage user license seat. Do not list tools or add tips unless asked.'},tools:[{id:"sage100-test-connection",name:"Test Sage 100 connection",shortName:"Connection test",instruction:"Logs on to Sage 100 through the Secure Gateway, opens the configured company, and reads the first customer record to verify the Business Object Interface end to end. Briefly consumes one Sage user license seat.",steps:[{id:"testConnection",instruction:"Run a VBScript through the gateway script runner that logs on via SY_Session, sets A/R module context, and reads the first customer.",config:{type:"request",systemId:"sage100",url:"<<sage100_url>>",method:"POST",body:["Option Explicit","On Error Resume Next","Dim oScript, oSS, oCust, retVal, custNo, custName, today",'Set oScript = CreateObject("ProvideX.Script")','FailOnErr "CREATE", " (Sage 100 Workstation Setup has not registered ProvideX.Script on this machine; the gateway must run on a prepared Sage 100 machine)"','oScript.Init "<<sage100_sage_home>>"','FailOnErr "INIT", " (sage_home must be the full path to the MAS90\\Home directory, not MAS90 itself)"','Set oSS = oScript.NewObject("SY_Session")','FailOnErr "SESSION", ""','retVal = oSS.nSetUser("<<sage100_sage_user>>", "<<sage100_sage_password>>")','FailOnErr "LOGON", ""',"If retVal = 0 Then",' WScript.Echo "LOGON FAILED: " & oSS.sLastErrorMsg'," WScript.Quit 1","End If",'retVal = oSS.nSetCompany("<<sage100_sage_company>>")','FailOnErr "COMPANY", ""',"If retVal = 0 Then",' WScript.Echo "COMPANY FAILED: " & oSS.sLastErrorMsg'," oSS.nCleanup"," oSS.DropObject"," WScript.Quit 1","End If",'today = Year(Date) & Right("0" & Month(Date), 2) & Right("0" & Day(Date), 2)','retVal = oSS.nSetDate("A/R", today)','FailOnErr "DATE", ""','retVal = oSS.nSetModule("A/R")','FailOnErr "MODULE", ""','retVal = oSS.nSetProgram(oSS.nLookupTask("AR_Customer_ui"))','FailOnErr "TASK", ""',"If retVal = 0 Then",' WScript.Echo "TASK FAILED: " & oSS.sLastErrorMsg'," oSS.nCleanup"," oSS.DropObject"," WScript.Quit 1","End If",'Set oCust = oScript.NewObject("AR_Customer_svc", oSS)','FailOnErr "CUSTOMER OBJECT", ""',"retVal = oCust.nMoveFirst()",'FailOnErr "READ", ""',"If retVal = 0 Then",' WScript.Echo "READ FAILED: " & oCust.sLastErrorMsg',"Else",' custNo = "" : custName = ""',' retVal = oCust.nGetValue("CustomerNo$", custNo)',' retVal = oCust.nGetValue("CustomerName$", custName)',' FailOnErr "READ VALUE", " (ByRef value marshalling failed)"',' WScript.Echo "CONNECTED - company <<sage100_sage_company>>, first customer: " & custNo & " / " & custName',"End If","oCust.DropObject","oSS.nCleanup","oSS.DropObject","If retVal = 0 Then WScript.Quit 1","","Sub FailOnErr(stage, hint)"," If Err.Number <> 0 Then",' WScript.Echo stage & " FAILED: [0x" & Hex(Err.Number) & "] " & Err.Description & hint'," WScript.Quit 1"," End If","End Sub"].join(`
|
|
80
80
|
`)}}]}]},sage_intacct:{bundleId:"sage_intacct",templateId:"sage_intacct",systemId:"sage_intacct",displayName:"Sage Intacct",description:"Install a Sage Intacct system, eight read/query tools, fourteen write tools and a native integration playbook.",systemUrl:"https://api.intacct.com/ia/xml/xmlgw.phtml",credentialHint:"Works instantly with a Sage Intacct demo company. Enter your company ID and API user credentials to use your own company. Web Services sender credentials are preconfigured.",requiredCredentialKeys:["sender_id","sender_password","user_id","user_password","company_id"],demoCredentials:{company_id:"IndexCommerceMPP-DEV",user_id:"superglue",user_password:"Linux123___"},mcpServer:{name:"sage-intacct",displayName:"Sage Intacct",description:"Chart of accounts, customers, vendors, journal entries and ad-hoc object queries from Sage Intacct, plus create and update tools for GL accounts, journal entries, invoices, bills, departments, vendors and customers."},installMcpServer:!1,playbook:{id:"sage-intacct-native-integration",name:"Sage Intacct Native Integration",whenToRun:"Use when connecting, validating, querying or extending a Sage Intacct integration through XML Web Services.",inputs:"A configured Sage Intacct system; the object or business process to work with; optional Location/Entity ID for multi-entity companies; validation criteria and desired output.",instructions:"Use the installed read-only tools for chart of accounts, customers, vendors, journal entries, invoices, bills and departments. Use Query any Sage Intacct object for supported objects outside the named library. Use the installed create and update tools for GL accounts, journal entries, invoices, bills, departments, vendors and customers only after the user explicitly confirms the exact records to write; the create tools are not idempotent and re-running them duplicates records. Apply the configured Location/Entity ID when present. Verify every XML Web Services response at control, authentication and function-result level, and preserve Sage support IDs in failures. For other objects or operations, inspect Sage object documentation, create separate least-privilege tools, validate them in a development company and require explicit user confirmation before modifying Sage data.",completionCriteria:"The requested Sage data, write result or validation result is returned; entity scope is correct; Sage XML failures are surfaced as failures with support IDs; no Sage data is modified unless the user explicitly requested and confirmed the write."},agentLaunch:{userPrompt:"I just installed the Sage Intacct integration. What can I do with it?",nextSteps:"Your first reply must be short: one line confirming the Sage Intacct integration and native integration playbook are installed, then offer one read-only test run. If the user entered no company credentials during install, the system uses a shared Sage Intacct demo company and works right now. Other users share the demo company, so run create or update tools against it only when the user explicitly asks and confirms the exact records. For their own company, use set_credentials for this system to collect user_id, user_password and company_id, plus optional entity_id when the user wants to target one entity in a multi-entity company. The Web Services sender credentials are already configured. Never send the user to the Credentials page and never accept secrets as chat text. The user id and password are an API user login in the company; company id is the Intacct company id. Do not list the installed tools or add tips unless asked. The query tool accepts other supported Intacct object names, and additional read or write tools can be built beyond the default library. The installed create and update tools modify Sage data; run them only after the user confirms the exact records to write."},tools:[{id:"sage-intacct-list-accounts",name:"List Sage Intacct chart of accounts",shortName:"Chart of accounts",instruction:"Lists general ledger accounts (the chart of accounts) from Sage Intacct via the XML Web Services API. Useful for validating an imported chart of accounts after a migration.",inputSchema:{type:"object",properties:{maxResults:{type:"integer",description:"Maximum number of records to return. Defaults to 200."}},additionalProperties:!0},steps:[{id:"queryAccounts",instruction:"Query GLACCOUNT records via readByQuery-style paging.",config:{type:"request",systemId:"sage_intacct",url:"<<sage_intacct_url>>",method:"POST",headers:{"Content-Type":"application/xml",Accept:"application/xml"},body:pt("<query><object>GLACCOUNT</object><select><field>RECORDNO</field><field>ACCOUNTNO</field><field>TITLE</field><field>ACCOUNTTYPE</field><field>NORMALBALANCE</field><field>STATUS</field></select><pagesize><<pageSize>></pagesize><offset><<offset>></offset></query>"),pagination:{type:"offsetBased",pageSize:"100",stopCondition:"(response, pageInfo, sourceData) => { const dig = (o) => o && o.RESPONSE && o.RESPONSE.OPERATION && o.RESPONSE.OPERATION.RESULT ? o.RESPONSE.OPERATION.RESULT.DATA : undefined; const cur = dig(response && response.data); const cr = cur ? cur.GLACCOUNT : undefined; const rows = Array.isArray(cr) ? cr : (cr ? [cr] : []); const mr = dig(pageInfo && pageInfo.mergedResult); const mraw = mr ? mr.GLACCOUNT : undefined; const fetched = Array.isArray(mraw) ? mraw.length : (mraw ? 1 : 0); const max = (sourceData && sourceData.maxResults) ?? 200; return rows.length === 0 || fetched >= max; }"}}}],outputTransform:fs({stepId:"queryAccounts",objectNameExpression:"'GLACCOUNT'",collectionName:"accounts",mapExpression:"(record) => ({ recordNo: record.RECORDNO, account: record.ACCOUNTNO, name: record.TITLE, type: record.ACCOUNTTYPE, normalBalance: record.NORMALBALANCE, status: record.STATUS })"})},{id:"sage-intacct-list-customers",name:"List Sage Intacct customers",shortName:"Customers",instruction:"Lists customer master records from Sage Intacct accounts receivable. Useful for verifying migrated AR master data.",inputSchema:{type:"object",properties:{maxResults:{type:"integer",description:"Maximum number of records to return. Defaults to 200."}},additionalProperties:!0},steps:[{id:"queryCustomers",instruction:"Query CUSTOMER records.",config:{type:"request",systemId:"sage_intacct",url:"<<sage_intacct_url>>",method:"POST",headers:{"Content-Type":"application/xml",Accept:"application/xml"},body:pt("<query><object>CUSTOMER</object><select><field>RECORDNO</field><field>CUSTOMERID</field><field>NAME</field><field>STATUS</field><field>WHENCREATED</field></select><pagesize><<pageSize>></pagesize><offset><<offset>></offset></query>"),pagination:{type:"offsetBased",pageSize:"100",stopCondition:"(response, pageInfo, sourceData) => { const dig = (o) => o && o.RESPONSE && o.RESPONSE.OPERATION && o.RESPONSE.OPERATION.RESULT ? o.RESPONSE.OPERATION.RESULT.DATA : undefined; const cur = dig(response && response.data); const cr = cur ? cur.CUSTOMER : undefined; const rows = Array.isArray(cr) ? cr : (cr ? [cr] : []); const mr = dig(pageInfo && pageInfo.mergedResult); const mraw = mr ? mr.CUSTOMER : undefined; const fetched = Array.isArray(mraw) ? mraw.length : (mraw ? 1 : 0); const max = (sourceData && sourceData.maxResults) ?? 200; return rows.length === 0 || fetched >= max; }"}}}],outputTransform:fs({stepId:"queryCustomers",objectNameExpression:"'CUSTOMER'",collectionName:"customers",mapExpression:"(record) => ({ recordNo: record.RECORDNO, customerId: record.CUSTOMERID, name: record.NAME, status: record.STATUS, createdOn: record.WHENCREATED })"})},{id:"sage-intacct-list-vendors",name:"List Sage Intacct vendors",shortName:"Vendors",instruction:"Lists vendor master records from Sage Intacct accounts payable. Useful for verifying migrated AP master data.",inputSchema:{type:"object",properties:{maxResults:{type:"integer",description:"Maximum number of records to return. Defaults to 200."}},additionalProperties:!0},steps:[{id:"queryVendors",instruction:"Query VENDOR records.",config:{type:"request",systemId:"sage_intacct",url:"<<sage_intacct_url>>",method:"POST",headers:{"Content-Type":"application/xml",Accept:"application/xml"},body:pt("<query><object>VENDOR</object><select><field>RECORDNO</field><field>VENDORID</field><field>NAME</field><field>STATUS</field><field>WHENCREATED</field></select><pagesize><<pageSize>></pagesize><offset><<offset>></offset></query>"),pagination:{type:"offsetBased",pageSize:"100",stopCondition:"(response, pageInfo, sourceData) => { const dig = (o) => o && o.RESPONSE && o.RESPONSE.OPERATION && o.RESPONSE.OPERATION.RESULT ? o.RESPONSE.OPERATION.RESULT.DATA : undefined; const cur = dig(response && response.data); const cr = cur ? cur.VENDOR : undefined; const rows = Array.isArray(cr) ? cr : (cr ? [cr] : []); const mr = dig(pageInfo && pageInfo.mergedResult); const mraw = mr ? mr.VENDOR : undefined; const fetched = Array.isArray(mraw) ? mraw.length : (mraw ? 1 : 0); const max = (sourceData && sourceData.maxResults) ?? 200; return rows.length === 0 || fetched >= max; }"}}}],outputTransform:fs({stepId:"queryVendors",objectNameExpression:"'VENDOR'",collectionName:"vendors",mapExpression:"(record) => ({ recordNo: record.RECORDNO, vendorId: record.VENDORID, name: record.NAME, status: record.STATUS, createdOn: record.WHENCREATED })"})},{id:"sage-intacct-list-journal-entries",name:"List Sage Intacct journal entries",shortName:"Journal entries",instruction:"Lists general ledger entries from Sage Intacct with account, type and amount. Useful for verifying opening balances and postings at cutover.",inputSchema:{type:"object",properties:{maxResults:{type:"integer",description:"Maximum number of records to return. Defaults to 200."}},additionalProperties:!0},steps:[{id:"queryJournalEntries",instruction:"Query GLENTRY records.",config:{type:"request",systemId:"sage_intacct",url:"<<sage_intacct_url>>",method:"POST",headers:{"Content-Type":"application/xml",Accept:"application/xml"},body:pt("<query><object>GLENTRY</object><select><field>RECORDNO</field><field>BATCHNO</field><field>ACCOUNTNO</field><field>TR_TYPE</field><field>AMOUNT</field><field>ENTRY_DATE</field></select><pagesize><<pageSize>></pagesize><offset><<offset>></offset></query>"),pagination:{type:"offsetBased",pageSize:"100",stopCondition:"(response, pageInfo, sourceData) => { const dig = (o) => o && o.RESPONSE && o.RESPONSE.OPERATION && o.RESPONSE.OPERATION.RESULT ? o.RESPONSE.OPERATION.RESULT.DATA : undefined; const cur = dig(response && response.data); const cr = cur ? cur.GLENTRY : undefined; const rows = Array.isArray(cr) ? cr : (cr ? [cr] : []); const mr = dig(pageInfo && pageInfo.mergedResult); const mraw = mr ? mr.GLENTRY : undefined; const fetched = Array.isArray(mraw) ? mraw.length : (mraw ? 1 : 0); const max = (sourceData && sourceData.maxResults) ?? 200; return rows.length === 0 || fetched >= max; }"}}}],outputTransform:fs({stepId:"queryJournalEntries",objectNameExpression:"'GLENTRY'",collectionName:"journalEntries",mapExpression:"(record) => ({ recordNo: record.RECORDNO, batch: record.BATCHNO, account: record.ACCOUNTNO, type: record.TR_TYPE, amount: Number(record.AMOUNT), date: record.ENTRY_DATE })"})},{id:"sage-intacct-list-invoices",name:"List Sage Intacct invoices",shortName:"Invoices",instruction:"Lists accounts receivable invoices from Sage Intacct. Useful for verifying migrated open AR at go-live.",inputSchema:{type:"object",properties:{maxResults:{type:"integer",description:"Maximum number of records to return. Defaults to 200."}},additionalProperties:!0},steps:[{id:"queryInvoices",instruction:"Query ARINVOICE records.",config:{type:"request",systemId:"sage_intacct",url:"<<sage_intacct_url>>",method:"POST",headers:{"Content-Type":"application/xml",Accept:"application/xml"},body:pt("<query><object>ARINVOICE</object><select><field>RECORDNO</field><field>RECORDID</field><field>CUSTOMERID</field><field>TOTALDUE</field><field>WHENCREATED</field><field>STATE</field></select><pagesize><<pageSize>></pagesize><offset><<offset>></offset></query>"),pagination:{type:"offsetBased",pageSize:"100",stopCondition:"(response, pageInfo, sourceData) => { const dig = (o) => o && o.RESPONSE && o.RESPONSE.OPERATION && o.RESPONSE.OPERATION.RESULT ? o.RESPONSE.OPERATION.RESULT.DATA : undefined; const cur = dig(response && response.data); const cr = cur ? cur.ARINVOICE : undefined; const rows = Array.isArray(cr) ? cr : (cr ? [cr] : []); const mr = dig(pageInfo && pageInfo.mergedResult); const mraw = mr ? mr.ARINVOICE : undefined; const fetched = Array.isArray(mraw) ? mraw.length : (mraw ? 1 : 0); const max = (sourceData && sourceData.maxResults) ?? 200; return rows.length === 0 || fetched >= max; }"}}}],outputTransform:fs({stepId:"queryInvoices",objectNameExpression:"'ARINVOICE'",collectionName:"invoices",mapExpression:"(record) => ({ recordNo: record.RECORDNO, invoiceId: record.RECORDID, customerId: record.CUSTOMERID, totalDue: Number(record.TOTALDUE), createdOn: record.WHENCREATED, state: record.STATE })"})},{id:"sage-intacct-list-bills",name:"List Sage Intacct bills",shortName:"Bills",instruction:"Lists accounts payable bills from Sage Intacct. Useful for verifying migrated open AP at go-live.",inputSchema:{type:"object",properties:{maxResults:{type:"integer",description:"Maximum number of records to return. Defaults to 200."}},additionalProperties:!0},steps:[{id:"queryBills",instruction:"Query APBILL records.",config:{type:"request",systemId:"sage_intacct",url:"<<sage_intacct_url>>",method:"POST",headers:{"Content-Type":"application/xml",Accept:"application/xml"},body:pt("<query><object>APBILL</object><select><field>RECORDNO</field><field>RECORDID</field><field>VENDORID</field><field>TOTALDUE</field><field>WHENCREATED</field><field>STATE</field></select><pagesize><<pageSize>></pagesize><offset><<offset>></offset></query>"),pagination:{type:"offsetBased",pageSize:"100",stopCondition:"(response, pageInfo, sourceData) => { const dig = (o) => o && o.RESPONSE && o.RESPONSE.OPERATION && o.RESPONSE.OPERATION.RESULT ? o.RESPONSE.OPERATION.RESULT.DATA : undefined; const cur = dig(response && response.data); const cr = cur ? cur.APBILL : undefined; const rows = Array.isArray(cr) ? cr : (cr ? [cr] : []); const mr = dig(pageInfo && pageInfo.mergedResult); const mraw = mr ? mr.APBILL : undefined; const fetched = Array.isArray(mraw) ? mraw.length : (mraw ? 1 : 0); const max = (sourceData && sourceData.maxResults) ?? 200; return rows.length === 0 || fetched >= max; }"}}}],outputTransform:fs({stepId:"queryBills",objectNameExpression:"'APBILL'",collectionName:"bills",mapExpression:"(record) => ({ recordNo: record.RECORDNO, billId: record.RECORDID, vendorId: record.VENDORID, totalDue: Number(record.TOTALDUE), createdOn: record.WHENCREATED, state: record.STATE })"})},{id:"sage-intacct-list-departments",name:"List Sage Intacct departments",shortName:"Departments",instruction:"Lists department dimensions from Sage Intacct. Useful for validating the dimension setup after an implementation.",inputSchema:{type:"object",properties:{maxResults:{type:"integer",description:"Maximum number of records to return. Defaults to 200."}},additionalProperties:!0},steps:[{id:"queryDepartments",instruction:"Query DEPARTMENT records.",config:{type:"request",systemId:"sage_intacct",url:"<<sage_intacct_url>>",method:"POST",headers:{"Content-Type":"application/xml",Accept:"application/xml"},body:pt("<query><object>DEPARTMENT</object><select><field>RECORDNO</field><field>DEPARTMENTID</field><field>TITLE</field><field>STATUS</field></select><pagesize><<pageSize>></pagesize><offset><<offset>></offset></query>"),pagination:{type:"offsetBased",pageSize:"100",stopCondition:"(response, pageInfo, sourceData) => { const dig = (o) => o && o.RESPONSE && o.RESPONSE.OPERATION && o.RESPONSE.OPERATION.RESULT ? o.RESPONSE.OPERATION.RESULT.DATA : undefined; const cur = dig(response && response.data); const cr = cur ? cur.DEPARTMENT : undefined; const rows = Array.isArray(cr) ? cr : (cr ? [cr] : []); const mr = dig(pageInfo && pageInfo.mergedResult); const mraw = mr ? mr.DEPARTMENT : undefined; const fetched = Array.isArray(mraw) ? mraw.length : (mraw ? 1 : 0); const max = (sourceData && sourceData.maxResults) ?? 200; return rows.length === 0 || fetched >= max; }"}}}],outputTransform:fs({stepId:"queryDepartments",objectNameExpression:"'DEPARTMENT'",collectionName:"departments",mapExpression:"(record) => ({ recordNo: record.RECORDNO, departmentId: record.DEPARTMENTID, name: record.TITLE, status: record.STATUS })"})},{id:"sage-intacct-query-object",name:"Query any Sage Intacct object",shortName:"Query any object",instruction:"Queries any Sage Intacct object by name (for example GLACCOUNT, PROJECT, GLENTRY, ARINVOICE) using the XML Web Services readByQuery, with an optional Intacct query filter. The workhorse tool for migration validation beyond the prebuilt lists. Returns up to 1000 records in one call.",inputSchema:{type:"object",properties:{object:{type:"string",description:'Intacct object name, e.g. "GLACCOUNT", "PROJECT", "GLENTRY", "ARINVOICE".'},query:{type:"string",description:`Optional Intacct query filter, e.g. "STATUS = 'active'". Leave empty to return all records.`},maxResults:{type:"integer",description:"Maximum number of records to return (max 1000). Defaults to 100."}},required:["object"],additionalProperties:!0},steps:[{id:"queryObject",instruction:"Run readByQuery for the requested object.",config:{type:"request",systemId:"sage_intacct",url:"<<sage_intacct_url>>",method:"POST",headers:{"Content-Type":"application/xml",Accept:"application/xml"},body:pt("<readByQuery><object><<(p) => { const value = String(p.object || '').toUpperCase(); if (!/^[A-Z][A-Z0-9_]*$/.test(value)) throw new Error('Sage Intacct object must contain only letters, numbers, and underscores.'); return value; }>></object><fields>*</fields><query><<(p) => String(p.query || '').replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>')>></query><pagesize><<(p) => Math.min(Math.max(Number(p.maxResults) || 100, 1), 1000)>></pagesize></readByQuery>")}}],outputTransform:fs({stepId:"queryObject",objectNameExpression:"(sourceData && sourceData.object ? String(sourceData.object) : '').toUpperCase()",collectionName:"records",includeTotalCount:!0})},{id:"sage-intacct-create-journal-entry",name:"Create Sage Intacct journal entry",shortName:"Create journal entry",instruction:"Creates a journal entry (GLBATCH with GLENTRY lines) in Sage Intacct via the XML Web Services API. Debits and credits must balance. Re-running this tool creates another journal entry; it is not idempotent.",inputSchema:{type:"object",properties:{journal:{type:"string",description:'Journal symbol, e.g. "GJ". Defaults to GJ.'},date:{type:"string",description:"Posting date as YYYY-MM-DD."},title:{type:"string",description:"Journal entry description."},lines:{type:"array",description:"Journal lines. Debit and credit totals must balance.",items:{type:"object",properties:{accountNo:{type:"string",description:"GL account number."},type:{type:"string",enum:["debit","credit"]},amount:{type:"number",description:"Positive amount."},department:{type:"string",description:"Optional department ID."},location:{type:"string",description:"Optional location ID."},memo:{type:"string",description:"Optional line description."}},required:["accountNo","type","amount"],additionalProperties:!0}}},required:["date","title","lines"],additionalProperties:!0},steps:[{id:"createJournalEntry",instruction:"Create the GLBATCH record.",modify:!0,config:{type:"request",systemId:"sage_intacct",url:"<<sage_intacct_url>>",method:"POST",headers:{"Content-Type":"application/xml",Accept:"application/xml"},body:pt(`<create><GLBATCH><JOURNAL><<(sourceData) => { ${hs} return esc(sourceData.journal || 'GJ'); }>></JOURNAL><BATCH_DATE><<(sourceData) => { ${PM} return toIntacctDate(sourceData.date); }>></BATCH_DATE><BATCH_TITLE><<(sourceData) => { ${hs} return esc(sourceData.title); }>></BATCH_TITLE><ENTRIES><<(sourceData) => { ${hs} ${$M} ${FM} const lines = Array.isArray(sourceData.lines) ? sourceData.lines : []; if (lines.length === 0) throw new Error('lines must contain at least one journal line.'); assertBalanced(lines); return lines.map(lineXml).join(''); }>></ENTRIES></GLBATCH></create>`)}}],outputTransform:Zc({stepId:"createJournalEntry",objectName:"GLBATCH"})},{id:"sage-intacct-update-journal-entry",name:"Update Sage Intacct journal entry",shortName:"Update journal entry",instruction:"Updates an existing journal entry (GLBATCH) in Sage Intacct by record number. Posted or locked entries may refuse updates. When lines are provided they replace all existing lines of the entry.",inputSchema:{type:"object",properties:{recordNo:{type:"integer",description:"RECORDNO of the journal entry to update."},journal:{type:"string",description:"Optional new journal symbol."},date:{type:"string",description:"Optional new posting date as YYYY-MM-DD."},title:{type:"string",description:"Optional new description."},lines:{type:"array",description:"Optional replacement lines. When set, they replace every existing line and must balance.",items:{type:"object",properties:{accountNo:{type:"string",description:"GL account number."},type:{type:"string",enum:["debit","credit"]},amount:{type:"number",description:"Positive amount."},department:{type:"string",description:"Optional department ID."},location:{type:"string",description:"Optional location ID."},memo:{type:"string",description:"Optional line description."}},required:["accountNo","type","amount"],additionalProperties:!0}}},required:["recordNo"],additionalProperties:!0},steps:[{id:"updateJournalEntry",instruction:"Update the GLBATCH record.",modify:!0,config:{type:"request",systemId:"sage_intacct",url:"<<sage_intacct_url>>",method:"POST",headers:{"Content-Type":"application/xml",Accept:"application/xml"},body:pt(`<update><GLBATCH><RECORDNO><<(sourceData) => { const recordNo = Number(sourceData.recordNo); if (!Number.isInteger(recordNo) || recordNo <= 0) throw new Error('recordNo must be a positive integer.'); return recordNo; }>></RECORDNO><<(sourceData) => { ${hs} ${PM} ${$M} ${FM} let xml = ''; if (sourceData.journal) xml += '<JOURNAL>' + esc(sourceData.journal) + '</JOURNAL>'; if (sourceData.date) xml += '<BATCH_DATE>' + toIntacctDate(sourceData.date) + '</BATCH_DATE>'; if (sourceData.title) xml += '<BATCH_TITLE>' + esc(sourceData.title) + '</BATCH_TITLE>'; if (Array.isArray(sourceData.lines) && sourceData.lines.length > 0) { assertBalanced(sourceData.lines); xml += '<ENTRIES>' + sourceData.lines.map(lineXml).join('') + '</ENTRIES>'; } if (!xml) throw new Error('Provide at least one field to update.'); return xml; }>></GLBATCH></update>`)}}],outputTransform:Zc({stepId:"updateJournalEntry",objectName:"GLBATCH"})},{id:"sage-intacct-create-vendor",name:"Create Sage Intacct vendor",shortName:"Create vendor",instruction:"Creates a vendor master record in Sage Intacct via the XML Web Services API. Omit vendorId when the company uses vendor auto-numbering. Re-running this tool creates another vendor; it is not idempotent.",inputSchema:{type:"object",properties:{vendorId:{type:"string",description:"Vendor ID. Omit when auto-numbering assigns it."},name:{type:"string",description:"Vendor name."},taxId:{type:"string",description:"Optional tax ID."}},required:["name"],additionalProperties:!0},steps:[{id:"createVendor",instruction:"Create the VENDOR record.",modify:!0,config:{type:"request",systemId:"sage_intacct",url:"<<sage_intacct_url>>",method:"POST",headers:{"Content-Type":"application/xml",Accept:"application/xml"},body:pt(`<create><VENDOR><<(sourceData) => { ${hs} if (!sourceData.name) throw new Error('name is required.'); let xml = ''; if (sourceData.vendorId) xml += '<VENDORID>' + esc(sourceData.vendorId) + '</VENDORID>'; xml += '<NAME>' + esc(sourceData.name) + '</NAME>'; if (sourceData.taxId) xml += '<TAXID>' + esc(sourceData.taxId) + '</TAXID>'; return xml; }>></VENDOR></create>`)}}],outputTransform:Zc({stepId:"createVendor",objectName:"VENDOR"})},{id:"sage-intacct-update-vendor",name:"Update Sage Intacct vendor",shortName:"Update vendor",instruction:"Updates an existing vendor master record in Sage Intacct by record number. Only the provided fields change.",inputSchema:{type:"object",properties:{recordNo:{type:"integer",description:"RECORDNO of the vendor to update."},name:{type:"string",description:"Optional new vendor name."},status:{type:"string",enum:["active","inactive"]},taxId:{type:"string",description:"Optional new tax ID."}},required:["recordNo"],additionalProperties:!0},steps:[{id:"updateVendor",instruction:"Update the VENDOR record.",modify:!0,config:{type:"request",systemId:"sage_intacct",url:"<<sage_intacct_url>>",method:"POST",headers:{"Content-Type":"application/xml",Accept:"application/xml"},body:pt(`<update><VENDOR><RECORDNO><<(sourceData) => { const recordNo = Number(sourceData.recordNo); if (!Number.isInteger(recordNo) || recordNo <= 0) throw new Error('recordNo must be a positive integer.'); return recordNo; }>></RECORDNO><<(sourceData) => { ${hs} let xml = ''; if (sourceData.name) xml += '<NAME>' + esc(sourceData.name) + '</NAME>'; if (sourceData.status) xml += '<STATUS>' + esc(sourceData.status) + '</STATUS>'; if (sourceData.taxId) xml += '<TAXID>' + esc(sourceData.taxId) + '</TAXID>'; if (!xml) throw new Error('Provide at least one field to update.'); return xml; }>></VENDOR></update>`)}}],outputTransform:Zc({stepId:"updateVendor",objectName:"VENDOR"})},{id:"sage-intacct-create-customer",name:"Create Sage Intacct customer",shortName:"Create customer",instruction:"Creates a customer master record in Sage Intacct via the XML Web Services API. Omit customerId when the company uses customer auto-numbering. Re-running this tool creates another customer; it is not idempotent.",inputSchema:{type:"object",properties:{customerId:{type:"string",description:"Customer ID. Omit when auto-numbering assigns it."},name:{type:"string",description:"Customer name."},taxId:{type:"string",description:"Optional tax ID."}},required:["name"],additionalProperties:!0},steps:[{id:"createCustomer",instruction:"Create the CUSTOMER record.",modify:!0,config:{type:"request",systemId:"sage_intacct",url:"<<sage_intacct_url>>",method:"POST",headers:{"Content-Type":"application/xml",Accept:"application/xml"},body:pt(`<create><CUSTOMER><<(sourceData) => { ${hs} if (!sourceData.name) throw new Error('name is required.'); let xml = ''; if (sourceData.customerId) xml += '<CUSTOMERID>' + esc(sourceData.customerId) + '</CUSTOMERID>'; xml += '<NAME>' + esc(sourceData.name) + '</NAME>'; if (sourceData.taxId) xml += '<TAXID>' + esc(sourceData.taxId) + '</TAXID>'; return xml; }>></CUSTOMER></create>`)}}],outputTransform:Zc({stepId:"createCustomer",objectName:"CUSTOMER"})},{id:"sage-intacct-update-customer",name:"Update Sage Intacct customer",shortName:"Update customer",instruction:"Updates an existing customer master record in Sage Intacct by record number. Only the provided fields change.",inputSchema:{type:"object",properties:{recordNo:{type:"integer",description:"RECORDNO of the customer to update."},name:{type:"string",description:"Optional new customer name."},status:{type:"string",enum:["active","inactive"]},taxId:{type:"string",description:"Optional new tax ID."}},required:["recordNo"],additionalProperties:!0},steps:[{id:"updateCustomer",instruction:"Update the CUSTOMER record.",modify:!0,config:{type:"request",systemId:"sage_intacct",url:"<<sage_intacct_url>>",method:"POST",headers:{"Content-Type":"application/xml",Accept:"application/xml"},body:pt(`<update><CUSTOMER><RECORDNO><<(sourceData) => { const recordNo = Number(sourceData.recordNo); if (!Number.isInteger(recordNo) || recordNo <= 0) throw new Error('recordNo must be a positive integer.'); return recordNo; }>></RECORDNO><<(sourceData) => { ${hs} let xml = ''; if (sourceData.name) xml += '<NAME>' + esc(sourceData.name) + '</NAME>'; if (sourceData.status) xml += '<STATUS>' + esc(sourceData.status) + '</STATUS>'; if (sourceData.taxId) xml += '<TAXID>' + esc(sourceData.taxId) + '</TAXID>'; if (!xml) throw new Error('Provide at least one field to update.'); return xml; }>></CUSTOMER></update>`)}}],outputTransform:Zc({stepId:"updateCustomer",objectName:"CUSTOMER"})},{id:"sage-intacct-create-account",name:"Create Sage Intacct GL account",shortName:"Create GL account",instruction:"Creates a general ledger account in Sage Intacct via the XML Web Services API. Re-running this tool creates another account; it is not idempotent.",inputSchema:{type:"object",required:["accountNo","title","normalBalance","accountType"],properties:{title:{type:"string"},accountNo:{type:"string"},accountType:{type:"string",enum:["balancesheet","incomestatement"]},normalBalance:{type:"string",enum:["debit","credit"]},closingType:{type:"string",enum:["non-closing account","closing account"],description:"Period-end closing type. Defaults to non-closing account."},closingAccountNo:{type:"string",description:"Account to close into. Sage requires it when closingType is closing account."}}},steps:[{id:"createAccount",instruction:"Create the GLACCOUNT record via the Sage Intacct XML API.",modify:!0,config:{type:"request",systemId:"sage_intacct",url:"<<sage_intacct_url>>",method:"POST",headers:{"Content-Type":"application/xml",Accept:"application/xml"},body:pt(`<create><GLACCOUNT><<(sourceData) => { const esc = (value) => String(value).replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>').replaceAll('"', '"').replaceAll("'", '''); if (!sourceData.accountNo) throw new Error('accountNo is required.'); if (!sourceData.title) throw new Error('title is required.'); let xml = '<ACCOUNTNO>' + esc(sourceData.accountNo) + '</ACCOUNTNO>'; xml += '<TITLE>' + esc(sourceData.title) + '</TITLE>'; xml += '<NORMALBALANCE>' + esc(sourceData.normalBalance || 'debit') + '</NORMALBALANCE>'; xml += '<ACCOUNTTYPE>' + esc(sourceData.accountType || 'balancesheet') + '</ACCOUNTTYPE>'; xml += '<CLOSINGTYPE>' + esc(sourceData.closingType || 'non-closing account') + '</CLOSINGTYPE>'; if (sourceData.closingAccountNo) xml += '<CLOSINGACCOUNTNO>' + esc(sourceData.closingAccountNo) + '</CLOSINGACCOUNTNO>'; return xml; }>></GLACCOUNT></create>`)}}],outputTransform:"(sourceData) => { const response = sourceData.createAccount && sourceData.createAccount.data ? sourceData.createAccount.data.RESPONSE : undefined; const control = response ? response.CONTROL : undefined; const operation = response ? response.OPERATION : undefined; const authentication = operation ? operation.AUTHENTICATION : undefined; const result = operation ? operation.RESULT : undefined; const statuses = [control && control.STATUS, authentication && authentication.STATUS, result && result.STATUS].filter(Boolean).map((value) => String(value).toLowerCase()); if (statuses.includes('failure')) { const message = (result && result.ERRORMESSAGE) || (authentication && authentication.ERR ? authentication.ERR.ERRORMESSAGE : undefined) || (control && control.ERR ? control.ERR.ERRORMESSAGE : undefined); const rawErrors = message ? message.ERROR : undefined; const errors = Array.isArray(rawErrors) ? rawErrors : (rawErrors ? [rawErrors] : []); const details = errors.map((error) => [error.ERRORNO, error.DESCRIPTION2 || error.DESCRIPTION, error.CORRECTION].filter(Boolean).join(' - ')).filter(Boolean); const supportIds = errors.map((error) => error.SUPPORTID).filter(Boolean); const suffix = supportIds.length ? ` Sage support ID: ${supportIds.join(', ')}.` : ''; throw new Error(`Sage Intacct request failed${details.length ? `: ${details.join('; ')}` : '.'}${suffix}`); } const data = result ? result.DATA : undefined; const raw = data ? (data.GLACCOUNT || data.glaccount) : undefined; const record = Array.isArray(raw) ? raw[0] : raw; return { recordNo: record && record.RECORDNO ? Number(record.RECORDNO) : undefined, record }; }"},{id:"sage-intacct-update-account",name:"Update Sage Intacct GL account",shortName:"Update GL account",instruction:"Updates an existing general ledger account in Sage Intacct by account number. Only the provided fields change.",inputSchema:{type:"object",required:["accountNo"],properties:{title:{type:"string"},accountNo:{type:"string"},accountType:{type:"string",enum:["balancesheet","incomestatement"]},normalBalance:{type:"string",enum:["debit","credit"]},status:{type:"string",enum:["active","inactive"]}}},steps:[{id:"updateAccount",instruction:"Update the GLACCOUNT record by account number.",modify:!0,config:{type:"request",systemId:"sage_intacct",url:"<<sage_intacct_url>>",method:"POST",headers:{"Content-Type":"application/xml",Accept:"application/xml"},body:pt(`<update><GLACCOUNT><ACCOUNTNO><<(sourceData) => { const esc = (value) => String(value).replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>').replaceAll('"', '"').replaceAll("'", '''); if (!sourceData.accountNo) throw new Error('accountNo is required.'); return esc(sourceData.accountNo); }>></ACCOUNTNO><<(sourceData) => { const esc = (value) => String(value).replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>').replaceAll('"', '"').replaceAll("'", '''); let xml = ''; if (sourceData.title) xml += '<TITLE>' + esc(sourceData.title) + '</TITLE>'; if (sourceData.normalBalance) xml += '<NORMALBALANCE>' + esc(sourceData.normalBalance) + '</NORMALBALANCE>'; if (sourceData.accountType) xml += '<ACCOUNTTYPE>' + esc(sourceData.accountType) + '</ACCOUNTTYPE>'; if (sourceData.status) xml += '<STATUS>' + esc(sourceData.status) + '</STATUS>'; if (!xml) throw new Error('Provide at least one field to update.'); return xml; }>></GLACCOUNT></update>`)}}],outputTransform:"(sourceData) => { const response = sourceData.updateAccount && sourceData.updateAccount.data ? sourceData.updateAccount.data.RESPONSE : undefined; const control = response ? response.CONTROL : undefined; const operation = response ? response.OPERATION : undefined; const authentication = operation ? operation.AUTHENTICATION : undefined; const result = operation ? operation.RESULT : undefined; const statuses = [control && control.STATUS, authentication && authentication.STATUS, result && result.STATUS].filter(Boolean).map((value) => String(value).toLowerCase()); if (statuses.includes('failure')) { const message = (result && result.ERRORMESSAGE) || (authentication && authentication.ERR ? authentication.ERR.ERRORMESSAGE : undefined) || (control && control.ERR ? control.ERR.ERRORMESSAGE : undefined); const rawErrors = message ? message.ERROR : undefined; const errors = Array.isArray(rawErrors) ? rawErrors : (rawErrors ? [rawErrors] : []); const details = errors.map((error) => [error.ERRORNO, error.DESCRIPTION2 || error.DESCRIPTION, error.CORRECTION].filter(Boolean).join(' - ')).filter(Boolean); const supportIds = errors.map((error) => error.SUPPORTID).filter(Boolean); const suffix = supportIds.length ? ` Sage support ID: ${supportIds.join(', ')}.` : ''; throw new Error(`Sage Intacct request failed${details.length ? `: ${details.join('; ')}` : '.'}${suffix}`); } const data = result ? result.DATA : undefined; const raw = data ? (data.GLACCOUNT || data.glaccount) : undefined; const record = Array.isArray(raw) ? raw[0] : raw; return { accountNo: sourceData.accountNo, record }; }"},{id:"sage-intacct-create-invoice",name:"Create Sage Intacct AR invoice",shortName:"Create invoice",instruction:"Creates an AR invoice in Sage Intacct via the XML Web Services API. Requires a customer ID, transaction date, and at least one line item with a GL account and amount. Re-running creates another invoice; it is not idempotent.",inputSchema:{type:"object",required:["customerId","dateCreated","dateDue","lines"],properties:{lines:{type:"array",items:{type:"object",required:["glAccountNo","amount"],properties:{memo:{type:"string"},amount:{type:"number"},glAccountNo:{type:"string"},departmentId:{type:"string"},locationId:{type:"string"},vendorId:{type:"string"},customerId:{type:"string"},projectId:{type:"string"}}}},dateDue:{type:"string"},customerId:{type:"string"},dateCreated:{type:"string"},datePosted:{type:"string"},termName:{type:"string"},description:{type:"string"}}},steps:[{id:"createInvoice",instruction:"Create the ARINVOICE record with line items.",modify:!0,config:{type:"request",systemId:"sage_intacct",url:"<<sage_intacct_url>>",method:"POST",headers:{"Content-Type":"application/xml",Accept:"application/xml"},body:pt("<create><ARINVOICE><<(sourceData) => { const esc = (value) => String(value).replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>').replaceAll('\"', '"').replaceAll(\"'\", '''); if (!sourceData.customerId) throw new Error('customerId is required.'); if (!sourceData.dateCreated) throw new Error('dateCreated is required (YYYY-MM-DD).'); const lines = Array.isArray(sourceData.lines) ? sourceData.lines : []; if (lines.length === 0) throw new Error('lines must contain at least one invoice line.'); const match = String(sourceData.dateCreated).match(/^(\\d{4})-(\\d{2})-(\\d{2})/); const dateXml = match ? `<WHENCREATED><YEAR>${match[1]}</YEAR><MONTH>${match[2]}</MONTH><DAY>${match[3]}</DAY></WHENCREATED>` : `<WHENCREATED>${esc(sourceData.dateCreated)}</WHENCREATED>`; let xml = '<CUSTOMERID>' + esc(sourceData.customerId) + '</CUSTOMERID>'; xml += dateXml; if (sourceData.datePosted) { const mp = String(sourceData.datePosted).match(/^(\\d{4})-(\\d{2})-(\\d{2})/); if (mp) xml += `<WHENPOSTED><YEAR>${mp[1]}</YEAR><MONTH>${mp[2]}</MONTH><DAY>${mp[3]}</DAY></WHENPOSTED>`; } if (sourceData.dateDue) { const md = String(sourceData.dateDue).match(/^(\\d{4})-(\\d{2})-(\\d{2})/); if (md) xml += `<WHENDUE><YEAR>${md[1]}</YEAR><MONTH>${md[2]}</MONTH><DAY>${md[3]}</DAY></WHENDUE>`; } else if (sourceData.termName) { xml += '<TERMNAME>' + esc(sourceData.termName) + '</TERMNAME>'; } if (sourceData.description) xml += '<DESCRIPTION>' + esc(sourceData.description) + '</DESCRIPTION>'; xml += '<ARINVOICEITEMS>'; lines.forEach((line) => { if (!line.glAccountNo) throw new Error('Each line requires glAccountNo.'); if (line.amount == null) throw new Error('Each line requires amount.'); xml += '<ARINVOICEITEM>'; xml += '<ACCOUNTNO>' + esc(line.glAccountNo) + '</ACCOUNTNO>'; xml += '<AMOUNT>' + Number(line.amount) + '</AMOUNT>'; if (line.memo) xml += '<MEMO>' + esc(line.memo) + '</MEMO>'; if (line.departmentId) xml += '<DEPARTMENTID>' + esc(line.departmentId) + '</DEPARTMENTID>'; if (line.locationId) xml += '<LOCATIONID>' + esc(line.locationId) + '</LOCATIONID>'; if (line.vendorId) xml += '<VENDORID>' + esc(line.vendorId) + '</VENDORID>'; if (line.customerId) xml += '<CUSTOMERID>' + esc(line.customerId) + '</CUSTOMERID>'; if (line.projectId) xml += '<PROJECTID>' + esc(line.projectId) + '</PROJECTID>'; xml += '</ARINVOICEITEM>'; }); xml += '</ARINVOICEITEMS>'; return xml; }>></ARINVOICE></create>")}}],outputTransform:"(sourceData) => { const response = sourceData.createInvoice && sourceData.createInvoice.data ? sourceData.createInvoice.data.RESPONSE : undefined; const control = response ? response.CONTROL : undefined; const operation = response ? response.OPERATION : undefined; const authentication = operation ? operation.AUTHENTICATION : undefined; const result = operation ? operation.RESULT : undefined; const statuses = [control && control.STATUS, authentication && authentication.STATUS, result && result.STATUS].filter(Boolean).map((value) => String(value).toLowerCase()); if (statuses.includes('failure')) { const message = (result && result.ERRORMESSAGE) || (authentication && authentication.ERR ? authentication.ERR.ERRORMESSAGE : undefined) || (control && control.ERR ? control.ERR.ERRORMESSAGE : undefined); const rawErrors = message ? message.ERROR : undefined; const errors = Array.isArray(rawErrors) ? rawErrors : (rawErrors ? [rawErrors] : []); const details = errors.map((error) => [error.ERRORNO, error.DESCRIPTION2 || error.DESCRIPTION, error.CORRECTION].filter(Boolean).join(' - ')).filter(Boolean); const supportIds = errors.map((error) => error.SUPPORTID).filter(Boolean); const suffix = supportIds.length ? ` Sage support ID: ${supportIds.join(', ')}.` : ''; throw new Error(`Sage Intacct request failed${details.length ? `: ${details.join('; ')}` : '.'}${suffix}`); } const data = result ? result.DATA : undefined; const raw = data ? (data.ARINVOICE || data.arinvoice) : undefined; const record = Array.isArray(raw) ? raw[0] : raw; return { recordNo: record && record.RECORDNO ? Number(record.RECORDNO) : undefined, record }; }"},{id:"sage-intacct-update-invoice",name:"Update Sage Intacct AR invoice",shortName:"Update invoice",instruction:"Updates an existing AR invoice in Sage Intacct by record number. Only the provided fields change. Line items can be added or updated by line number.",inputSchema:{type:"object",required:["recordNo"],properties:{recordNo:{type:"integer"},description:{type:"string"},customerId:{type:"string"},dateCreated:{type:"string"},dateDue:{type:"string"},termName:{type:"string"},lines:{type:"array",items:{type:"object",properties:{lineNo:{type:"integer"},memo:{type:"string"},amount:{type:"number"},glAccountNo:{type:"string"},departmentId:{type:"string"},locationId:{type:"string"},vendorId:{type:"string"},customerId:{type:"string"},projectId:{type:"string"}}}}}},steps:[{id:"updateInvoice",instruction:"Update the ARINVOICE record by RECORDNO.",modify:!0,config:{type:"request",systemId:"sage_intacct",url:"<<sage_intacct_url>>",method:"POST",headers:{"Content-Type":"application/xml",Accept:"application/xml"},body:pt("<update><ARINVOICE><RECORDNO><<(sourceData) => { const recordNo = Number(sourceData.recordNo); if (!Number.isInteger(recordNo) || recordNo <= 0) throw new Error('recordNo must be a positive integer.'); return recordNo; }>></RECORDNO><<(sourceData) => { const esc = (value) => String(value).replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>').replaceAll('\"', '"').replaceAll(\"'\", '''); let xml = ''; if (sourceData.customerId) xml += '<CUSTOMERID>' + esc(sourceData.customerId) + '</CUSTOMERID>'; if (sourceData.dateCreated) { const match = String(sourceData.dateCreated).match(/^(\\d{4})-(\\d{2})-(\\d{2})/); if (match) xml += `<WHENCREATED><YEAR>${match[1]}</YEAR><MONTH>${match[2]}</MONTH><DAY>${match[3]}</DAY></WHENCREATED>`; } if (sourceData.dateDue) { const md = String(sourceData.dateDue).match(/^(\\d{4})-(\\d{2})-(\\d{2})/); if (md) xml += `<WHENDUE><YEAR>${md[1]}</YEAR><MONTH>${md[2]}</MONTH><DAY>${md[3]}</DAY></WHENDUE>`; } if (sourceData.termName) xml += '<TERMNAME>' + esc(sourceData.termName) + '</TERMNAME>'; if (sourceData.description) xml += '<DESCRIPTION>' + esc(sourceData.description) + '</DESCRIPTION>'; const lines = Array.isArray(sourceData.lines) ? sourceData.lines : []; if (lines.length > 0) { xml += '<ARINVOICEITEMS>'; lines.forEach((line) => { xml += '<ARINVOICEITEM>'; if (line.lineNo) xml += '<LINE_NO>' + Number(line.lineNo) + '</LINE_NO>'; if (line.glAccountNo) xml += '<ACCOUNTNO>' + esc(line.glAccountNo) + '</ACCOUNTNO>'; if (line.amount != null) xml += '<AMOUNT>' + Number(line.amount) + '</AMOUNT>'; if (line.memo) xml += '<MEMO>' + esc(line.memo) + '</MEMO>'; if (line.departmentId) xml += '<DEPARTMENTID>' + esc(line.departmentId) + '</DEPARTMENTID>'; if (line.locationId) xml += '<LOCATIONID>' + esc(line.locationId) + '</LOCATIONID>'; if (line.vendorId) xml += '<VENDORID>' + esc(line.vendorId) + '</VENDORID>'; if (line.customerId) xml += '<CUSTOMERID>' + esc(line.customerId) + '</CUSTOMERID>'; if (line.projectId) xml += '<PROJECTID>' + esc(line.projectId) + '</PROJECTID>'; xml += '</ARINVOICEITEM>'; }); xml += '</ARINVOICEITEMS>'; } if (!xml && lines.length === 0) throw new Error('Provide at least one field to update.'); return xml; }>></ARINVOICE></update>")}}],outputTransform:"(sourceData) => { const response = sourceData.updateInvoice && sourceData.updateInvoice.data ? sourceData.updateInvoice.data.RESPONSE : undefined; const control = response ? response.CONTROL : undefined; const operation = response ? response.OPERATION : undefined; const authentication = operation ? operation.AUTHENTICATION : undefined; const result = operation ? operation.RESULT : undefined; const statuses = [control && control.STATUS, authentication && authentication.STATUS, result && result.STATUS].filter(Boolean).map((value) => String(value).toLowerCase()); if (statuses.includes('failure')) { const message = (result && result.ERRORMESSAGE) || (authentication && authentication.ERR ? authentication.ERR.ERRORMESSAGE : undefined) || (control && control.ERR ? control.ERR.ERRORMESSAGE : undefined); const rawErrors = message ? message.ERROR : undefined; const errors = Array.isArray(rawErrors) ? rawErrors : (rawErrors ? [rawErrors] : []); const details = errors.map((error) => [error.ERRORNO, error.DESCRIPTION2 || error.DESCRIPTION, error.CORRECTION].filter(Boolean).join(' - ')).filter(Boolean); const supportIds = errors.map((error) => error.SUPPORTID).filter(Boolean); const suffix = supportIds.length ? ` Sage support ID: ${supportIds.join(', ')}.` : ''; throw new Error(`Sage Intacct request failed${details.length ? `: ${details.join('; ')}` : '.'}${suffix}`); } const data = result ? result.DATA : undefined; const raw = data ? (data.ARINVOICE || data.arinvoice) : undefined; const record = Array.isArray(raw) ? raw[0] : raw; return { recordNo: sourceData.recordNo, record }; }"},{id:"sage-intacct-create-bill",name:"Create Sage Intacct AP bill",shortName:"Create bill",instruction:"Creates an AP bill in Sage Intacct via the XML Web Services API. Requires a vendor ID, transaction date, and at least one line item with a GL account and amount. Re-running creates another bill; it is not idempotent.",inputSchema:{type:"object",required:["lines","dateDue","vendorId","dateCreated"],properties:{lines:{type:"array",items:{type:"object",required:["glAccountNo","amount"],properties:{memo:{type:"string"},amount:{type:"number"},glAccountNo:{type:"string"},departmentId:{type:"string"},locationId:{type:"string"},vendorId:{type:"string"},customerId:{type:"string"},projectId:{type:"string"}}}},dateDue:{type:"string"},vendorId:{type:"string"},dateCreated:{type:"string"},datePosted:{type:"string"},termName:{type:"string"},description:{type:"string"}}},steps:[{id:"createBill",instruction:"Create the APBILL record with line items.",modify:!0,config:{type:"request",systemId:"sage_intacct",url:"<<sage_intacct_url>>",method:"POST",headers:{"Content-Type":"application/xml",Accept:"application/xml"},body:pt(`<create><APBILL><<(sourceData) => { const esc = (value) => String(value).replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>').replaceAll('"', '"').replaceAll("'", '''); if (!sourceData.vendorId) throw new Error('vendorId is required.'); if (!sourceData.dateCreated) throw new Error('dateCreated is required (YYYY-MM-DD).'); const lines = Array.isArray(sourceData.lines) ? sourceData.lines : []; if (lines.length === 0) throw new Error('lines must contain at least one bill line.'); const match = String(sourceData.dateCreated).match(/^(\\d{4})-(\\d{2})-(\\d{2})/); const dateStr = match ? match[2] + '/' + match[3] + '/' + match[1] : sourceData.dateCreated; let xml = '<VENDORID>' + esc(sourceData.vendorId) + '</VENDORID>'; xml += '<WHENCREATED>' + esc(dateStr) + '</WHENCREATED>'; if (sourceData.datePosted) { const mp = String(sourceData.datePosted).match(/^(\\d{4})-(\\d{2})-(\\d{2})/); xml += '<WHENPOSTED>' + esc(mp ? mp[2] + '/' + mp[3] + '/' + mp[1] : sourceData.datePosted) + '</WHENPOSTED>'; } if (sourceData.dateDue) { const md = String(sourceData.dateDue).match(/^(\\d{4})-(\\d{2})-(\\d{2})/); xml += '<WHENDUE>' + esc(md ? md[2] + '/' + md[3] + '/' + md[1] : sourceData.dateDue) + '</WHENDUE>'; } else if (sourceData.termName) { xml += '<TERMNAME>' + esc(sourceData.termName) + '</TERMNAME>'; } if (sourceData.description) xml += '<DESCRIPTION>' + esc(sourceData.description) + '</DESCRIPTION>'; xml += '<APBILLITEMS>'; lines.forEach((line) => { if (!line.glAccountNo) throw new Error('Each line requires glAccountNo.'); if (line.amount == null) throw new Error('Each line requires amount.'); xml += '<APBILLITEM>'; xml += '<ACCOUNTNO>' + esc(line.glAccountNo) + '</ACCOUNTNO>'; xml += '<AMOUNT>' + Number(line.amount) + '</AMOUNT>'; if (line.memo) xml += '<MEMO>' + esc(line.memo) + '</MEMO>'; if (line.departmentId) xml += '<DEPARTMENTID>' + esc(line.departmentId) + '</DEPARTMENTID>'; if (line.locationId) xml += '<LOCATIONID>' + esc(line.locationId) + '</LOCATIONID>'; if (line.vendorId) xml += '<VENDORID>' + esc(line.vendorId) + '</VENDORID>'; if (line.customerId) xml += '<CUSTOMERID>' + esc(line.customerId) + '</CUSTOMERID>'; if (line.projectId) xml += '<PROJECTID>' + esc(line.projectId) + '</PROJECTID>'; xml += '</APBILLITEM>'; }); xml += '</APBILLITEMS>'; return xml; }>></APBILL></create>`)}}],outputTransform:"(sourceData) => { const response = sourceData.createBill && sourceData.createBill.data ? sourceData.createBill.data.RESPONSE : undefined; const control = response ? response.CONTROL : undefined; const operation = response ? response.OPERATION : undefined; const authentication = operation ? operation.AUTHENTICATION : undefined; const result = operation ? operation.RESULT : undefined; const statuses = [control && control.STATUS, authentication && authentication.STATUS, result && result.STATUS].filter(Boolean).map((value) => String(value).toLowerCase()); if (statuses.includes('failure')) { const message = (result && result.ERRORMESSAGE) || (authentication && authentication.ERR ? authentication.ERR.ERRORMESSAGE : undefined) || (control && control.ERR ? control.ERR.ERRORMESSAGE : undefined); const rawErrors = message ? message.ERROR : undefined; const errors = Array.isArray(rawErrors) ? rawErrors : (rawErrors ? [rawErrors] : []); const details = errors.map((error) => [error.ERRORNO, error.DESCRIPTION2 || error.DESCRIPTION, error.CORRECTION].filter(Boolean).join(' - ')).filter(Boolean); const supportIds = errors.map((error) => error.SUPPORTID).filter(Boolean); const suffix = supportIds.length ? ` Sage support ID: ${supportIds.join(', ')}.` : ''; throw new Error(`Sage Intacct request failed${details.length ? `: ${details.join('; ')}` : '.'}${suffix}`); } const data = result ? result.DATA : undefined; const raw = data ? (data.APBILL || data.apbill) : undefined; const record = Array.isArray(raw) ? raw[0] : raw; return { recordNo: record && record.RECORDNO ? Number(record.RECORDNO) : undefined, record }; }"},{id:"sage-intacct-update-bill",name:"Update Sage Intacct AP bill",shortName:"Update bill",instruction:"Updates an existing AP bill in Sage Intacct by record number. Only the provided fields change. Line items can be added or updated by line number.",inputSchema:{type:"object",required:["recordNo"],properties:{recordNo:{type:"integer"},description:{type:"string"},vendorId:{type:"string"},dateCreated:{type:"string"},dateDue:{type:"string"},termName:{type:"string"},lines:{type:"array",items:{type:"object",properties:{lineNo:{type:"integer"},memo:{type:"string"},amount:{type:"number"},glAccountNo:{type:"string"},departmentId:{type:"string"},locationId:{type:"string"},vendorId:{type:"string"},customerId:{type:"string"},projectId:{type:"string"}}}}}},steps:[{id:"updateBill",instruction:"Update the APBILL record by RECORDNO.",modify:!0,config:{type:"request",systemId:"sage_intacct",url:"<<sage_intacct_url>>",method:"POST",headers:{"Content-Type":"application/xml",Accept:"application/xml"},body:pt(`<update><APBILL><RECORDNO><<(sourceData) => { const recordNo = Number(sourceData.recordNo); if (!Number.isInteger(recordNo) || recordNo <= 0) throw new Error('recordNo must be a positive integer.'); return recordNo; }>></RECORDNO><<(sourceData) => { const esc = (value) => String(value).replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>').replaceAll('"', '"').replaceAll("'", '''); let xml = ''; if (sourceData.vendorId) xml += '<VENDORID>' + esc(sourceData.vendorId) + '</VENDORID>'; if (sourceData.dateCreated) { const match = String(sourceData.dateCreated).match(/^(\\d{4})-(\\d{2})-(\\d{2})/); xml += '<WHENCREATED>' + esc(match ? match[2] + '/' + match[3] + '/' + match[1] : sourceData.dateCreated) + '</WHENCREATED>'; } if (sourceData.dateDue) { const md = String(sourceData.dateDue).match(/^(\\d{4})-(\\d{2})-(\\d{2})/); xml += '<WHENDUE>' + esc(md ? md[2] + '/' + md[3] + '/' + md[1] : sourceData.dateDue) + '</WHENDUE>'; } if (sourceData.termName) xml += '<TERMNAME>' + esc(sourceData.termName) + '</TERMNAME>'; if (sourceData.description) xml += '<DESCRIPTION>' + esc(sourceData.description) + '</DESCRIPTION>'; const lines = Array.isArray(sourceData.lines) ? sourceData.lines : []; if (lines.length > 0) { xml += '<APBILLITEMS>'; lines.forEach((line) => { xml += '<APBILLITEM>'; if (line.lineNo) xml += '<LINE_NO>' + Number(line.lineNo) + '</LINE_NO>'; if (line.glAccountNo) xml += '<ACCOUNTNO>' + esc(line.glAccountNo) + '</ACCOUNTNO>'; if (line.amount != null) xml += '<AMOUNT>' + Number(line.amount) + '</AMOUNT>'; if (line.memo) xml += '<MEMO>' + esc(line.memo) + '</MEMO>'; if (line.departmentId) xml += '<DEPARTMENTID>' + esc(line.departmentId) + '</DEPARTMENTID>'; if (line.locationId) xml += '<LOCATIONID>' + esc(line.locationId) + '</LOCATIONID>'; if (line.vendorId) xml += '<VENDORID>' + esc(line.vendorId) + '</VENDORID>'; if (line.customerId) xml += '<CUSTOMERID>' + esc(line.customerId) + '</CUSTOMERID>'; if (line.projectId) xml += '<PROJECTID>' + esc(line.projectId) + '</PROJECTID>'; xml += '</APBILLITEM>'; }); xml += '</APBILLITEMS>'; } if (!xml && lines.length === 0) throw new Error('Provide at least one field to update.'); return xml; }>></APBILL></update>`)}}],outputTransform:"(sourceData) => { const response = sourceData.updateBill && sourceData.updateBill.data ? sourceData.updateBill.data.RESPONSE : undefined; const control = response ? response.CONTROL : undefined; const operation = response ? response.OPERATION : undefined; const authentication = operation ? operation.AUTHENTICATION : undefined; const result = operation ? operation.RESULT : undefined; const statuses = [control && control.STATUS, authentication && authentication.STATUS, result && result.STATUS].filter(Boolean).map((value) => String(value).toLowerCase()); if (statuses.includes('failure')) { const message = (result && result.ERRORMESSAGE) || (authentication && authentication.ERR ? authentication.ERR.ERRORMESSAGE : undefined) || (control && control.ERR ? control.ERR.ERRORMESSAGE : undefined); const rawErrors = message ? message.ERROR : undefined; const errors = Array.isArray(rawErrors) ? rawErrors : (rawErrors ? [rawErrors] : []); const details = errors.map((error) => [error.ERRORNO, error.DESCRIPTION2 || error.DESCRIPTION, error.CORRECTION].filter(Boolean).join(' - ')).filter(Boolean); const supportIds = errors.map((error) => error.SUPPORTID).filter(Boolean); const suffix = supportIds.length ? ` Sage support ID: ${supportIds.join(', ')}.` : ''; throw new Error(`Sage Intacct request failed${details.length ? `: ${details.join('; ')}` : '.'}${suffix}`); } const data = result ? result.DATA : undefined; const raw = data ? (data.APBILL || data.apbill) : undefined; const record = Array.isArray(raw) ? raw[0] : raw; return { recordNo: sourceData.recordNo, record }; }"},{id:"sage-intacct-create-department",name:"Create Sage Intacct department",shortName:"Create department",instruction:"Creates a department in Sage Intacct via the XML Web Services API. Requires a department ID and title. Re-running creates another department; it is not idempotent.",inputSchema:{type:"object",required:["departmentId","title"],properties:{title:{type:"string"},departmentId:{type:"string"}}},steps:[{id:"createDepartment",instruction:"Create the DEPARTMENT record.",modify:!0,config:{type:"request",systemId:"sage_intacct",url:"<<sage_intacct_url>>",method:"POST",headers:{"Content-Type":"application/xml",Accept:"application/xml"},body:pt(`<create><DEPARTMENT><<(sourceData) => { const esc = (value) => String(value).replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>').replaceAll('"', '"').replaceAll("'", '''); if (!sourceData.departmentId) throw new Error('departmentId is required.'); if (!sourceData.title) throw new Error('title is required.'); let xml = '<DEPARTMENTID>' + esc(sourceData.departmentId) + '</DEPARTMENTID>'; xml += '<TITLE>' + esc(sourceData.title) + '</TITLE>'; if (sourceData.parentId) xml += '<PARENTID>' + esc(sourceData.parentId) + '</PARENTID>'; if (sourceData.status) xml += '<STATUS>' + esc(sourceData.status) + '</STATUS>'; return xml; }>></DEPARTMENT></create>`)}}],outputTransform:"(sourceData) => { const response = sourceData.createDepartment && sourceData.createDepartment.data ? sourceData.createDepartment.data.RESPONSE : undefined; const control = response ? response.CONTROL : undefined; const operation = response ? response.OPERATION : undefined; const authentication = operation ? operation.AUTHENTICATION : undefined; const result = operation ? operation.RESULT : undefined; const statuses = [control && control.STATUS, authentication && authentication.STATUS, result && result.STATUS].filter(Boolean).map((value) => String(value).toLowerCase()); if (statuses.includes('failure')) { const message = (result && result.ERRORMESSAGE) || (authentication && authentication.ERR ? authentication.ERR.ERRORMESSAGE : undefined) || (control && control.ERR ? control.ERR.ERRORMESSAGE : undefined); const rawErrors = message ? message.ERROR : undefined; const errors = Array.isArray(rawErrors) ? rawErrors : (rawErrors ? [rawErrors] : []); const details = errors.map((error) => [error.ERRORNO, error.DESCRIPTION2 || error.DESCRIPTION, error.CORRECTION].filter(Boolean).join(' - ')).filter(Boolean); const supportIds = errors.map((error) => error.SUPPORTID).filter(Boolean); const suffix = supportIds.length ? ` Sage support ID: ${supportIds.join(', ')}.` : ''; throw new Error(`Sage Intacct request failed${details.length ? `: ${details.join('; ')}` : '.'}${suffix}`); } const data = result ? result.DATA : undefined; const raw = data ? (data.DEPARTMENT || data.department) : undefined; const record = Array.isArray(raw) ? raw[0] : raw; return { recordNo: record && record.RECORDNO ? Number(record.RECORDNO) : undefined, record }; }"},{id:"sage-intacct-update-department",name:"Update Sage Intacct department",shortName:"Update department",instruction:"Updates an existing department in Sage Intacct by record number. Only the provided fields change.",inputSchema:{type:"object",required:["recordNo"],properties:{title:{type:"string"},recordNo:{type:"integer"},parentId:{type:"string"},status:{type:"string",enum:["active","inactive"]}}},steps:[{id:"updateDepartment",instruction:"Update the DEPARTMENT record by RECORDNO.",modify:!0,config:{type:"request",systemId:"sage_intacct",url:"<<sage_intacct_url>>",method:"POST",headers:{"Content-Type":"application/xml",Accept:"application/xml"},body:pt(`<update><DEPARTMENT><RECORDNO><<(sourceData) => { const recordNo = Number(sourceData.recordNo); if (!Number.isInteger(recordNo) || recordNo <= 0) throw new Error('recordNo must be a positive integer.'); return recordNo; }>></RECORDNO><<(sourceData) => { const esc = (value) => String(value).replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>').replaceAll('"', '"').replaceAll("'", '''); let xml = ''; if (sourceData.title) xml += '<TITLE>' + esc(sourceData.title) + '</TITLE>'; if (sourceData.parentId) xml += '<PARENTID>' + esc(sourceData.parentId) + '</PARENTID>'; if (sourceData.status) xml += '<STATUS>' + esc(sourceData.status) + '</STATUS>'; if (!xml) throw new Error('Provide at least one field to update.'); return xml; }>></DEPARTMENT></update>`)}}],outputTransform:"(sourceData) => { const response = sourceData.updateDepartment && sourceData.updateDepartment.data ? sourceData.updateDepartment.data.RESPONSE : undefined; const control = response ? response.CONTROL : undefined; const operation = response ? response.OPERATION : undefined; const authentication = operation ? operation.AUTHENTICATION : undefined; const result = operation ? operation.RESULT : undefined; const statuses = [control && control.STATUS, authentication && authentication.STATUS, result && result.STATUS].filter(Boolean).map((value) => String(value).toLowerCase()); if (statuses.includes('failure')) { const message = (result && result.ERRORMESSAGE) || (authentication && authentication.ERR ? authentication.ERR.ERRORMESSAGE : undefined) || (control && control.ERR ? control.ERR.ERRORMESSAGE : undefined); const rawErrors = message ? message.ERROR : undefined; const errors = Array.isArray(rawErrors) ? rawErrors : (rawErrors ? [rawErrors] : []); const details = errors.map((error) => [error.ERRORNO, error.DESCRIPTION2 || error.DESCRIPTION, error.CORRECTION].filter(Boolean).join(' - ')).filter(Boolean); const supportIds = errors.map((error) => error.SUPPORTID).filter(Boolean); const suffix = supportIds.length ? ` Sage support ID: ${supportIds.join(', ')}.` : ''; throw new Error(`Sage Intacct request failed${details.length ? `: ${details.join('; ')}` : '.'}${suffix}`); } const data = result ? result.DATA : undefined; const raw = data ? (data.DEPARTMENT || data.department) : undefined; const record = Array.isArray(raw) ? raw[0] : raw; return { recordNo: sourceData.recordNo, record }; }"}]},dynamics365_sales:{bundleId:"dynamics365_sales",templateId:"dynamics365_sales",systemId:"dynamics365_sales",displayName:"Dynamics 365 Sales",description:"Read accounts, contacts and the sales pipeline from Dynamics 365 Sales.",systemUrl:"https://<<api_host>>/api/data/v9.2",credentialHint:"Set api_host to your environment host, then connect with Microsoft OAuth. Your assistant walks you through it.",requiredCredentialKeys:["api_host","access_token"],mcpServer:{name:"dynamics-sales",displayName:"Dynamics 365 Sales",description:"Accounts, contacts, opportunity pipeline and ad-hoc Dataverse queries from Dynamics 365 Sales."},installMcpServer:!0,agentLaunch:{userPrompt:"I just installed the Dynamics 365 Sales bundle. What can I do with it?",nextSteps:'Your first reply must be short: one line confirming the Dynamics MCP server is installed, then ask for their environment host in chat (like contoso.crm.dynamics.com \u2014 it is not a secret, so never collect it through a secure form; form values are redacted and you cannot read them back). When they reply, save it with set_credentials passing credentials: { api_host: "<their host>" } directly, without askForUserInputs. Then start Microsoft OAuth with authenticate_oauth and substitute the same host into the scopes yourself \u2014 send "https://<host>/user_impersonation offline_access", never the <<api_host>> placeholder, which Microsoft rejects. OAuth fills access_token automatically; never send the user to the Credentials page, never ask for a token as chat text, and never suggest the az CLI. Once connected, the MCP server is ready; offer one test run. Do not list the installed tools, do not add tips unless asked. If asked later: OAuth refresh is automatic, the query tool accepts any Dataverse entity set, and record totals above 5000 are reported as capped by Dataverse rather than exact.'},tools:[{id:"dynamics-list-accounts",name:"List Dynamics 365 accounts",shortName:"Accounts",instruction:"Lists account records from Dynamics 365 with name, account number and creation date. Supports an optional OData $filter. Useful for validating migrated accounts.",inputSchema:{type:"object",properties:{filter:{type:"string",description:`Optional OData $filter expression, e.g. "createdon gt 2026-01-01T00:00:00Z" or "contains(name,'GmbH')".`},maxResults:{type:"integer",description:"Maximum number of accounts to return in one call. Defaults to 100."}},additionalProperties:!0},steps:[{id:"fetchAccounts",instruction:"Fetch accounts from the Dataverse Web API.",config:{type:"request",systemId:"dynamics365_sales",url:"https://<<dynamics365_sales_api_host>>/api/data/v9.2/accounts",method:"GET",headers:{Authorization:"Bearer <<dynamics365_sales_access_token>>",Accept:"application/json","OData-MaxVersion":"4.0","OData-Version":"4.0","If-None-Match":"null"},queryParams:{$select:"name,accountnumber,telephone1,websiteurl,createdon,modifiedon",$filter:"<<filter>>",$top:"<<(p) => p.maxResults ?? 100>>",$count:"true"}}}],outputTransform:'(sourceData) => { const data = sourceData.fetchAccounts?.data ?? {}; const rows = data.value ?? []; const capped = data["@Microsoft.Dynamics.CRM.totalrecordcountlimitexceeded"] === true; return { total: capped ? null : (data["@odata.count"] ?? rows.length), totalCapped: capped, returned: rows.length, accounts: rows.map((r) => ({ id: r.accountid, name: r.name, accountNumber: r.accountnumber, phone: r.telephone1, website: r.websiteurl, createdOn: r.createdon, modifiedOn: r.modifiedon })) }; }'},{id:"dynamics-list-contacts",name:"List Dynamics 365 contacts",shortName:"Contacts",instruction:"Lists contact records from Dynamics 365 with name, email and creation date. Supports an optional OData $filter. Useful for validating migrated contacts.",inputSchema:{type:"object",properties:{filter:{type:"string",description:'Optional OData $filter expression, e.g. "emailaddress1 eq null" to find contacts missing an email.'},maxResults:{type:"integer",description:"Maximum number of contacts to return in one call. Defaults to 100."}},additionalProperties:!0},steps:[{id:"fetchContacts",instruction:"Fetch contacts from the Dataverse Web API.",config:{type:"request",systemId:"dynamics365_sales",url:"https://<<dynamics365_sales_api_host>>/api/data/v9.2/contacts",method:"GET",headers:{Authorization:"Bearer <<dynamics365_sales_access_token>>",Accept:"application/json","OData-MaxVersion":"4.0","OData-Version":"4.0","If-None-Match":"null"},queryParams:{$select:"fullname,emailaddress1,telephone1,jobtitle,createdon,modifiedon",$filter:"<<filter>>",$top:"<<(p) => p.maxResults ?? 100>>",$count:"true"}}}],outputTransform:'(sourceData) => { const data = sourceData.fetchContacts?.data ?? {}; const rows = data.value ?? []; const capped = data["@Microsoft.Dynamics.CRM.totalrecordcountlimitexceeded"] === true; return { total: capped ? null : (data["@odata.count"] ?? rows.length), totalCapped: capped, returned: rows.length, contacts: rows.map((r) => ({ id: r.contactid, name: r.fullname, email: r.emailaddress1, phone: r.telephone1, jobTitle: r.jobtitle, createdOn: r.createdon, modifiedOn: r.modifiedon })) }; }'},{id:"dynamics-open-opportunities",name:"List Dynamics 365 open opportunities",shortName:"Open opportunities",instruction:"Lists open opportunities from Dynamics 365 with estimated value and close date. Supports an optional additional OData $filter. Useful for pipeline verification during UAT.",inputSchema:{type:"object",properties:{filter:{type:"string",description:'Optional additional OData $filter combined with the open-state filter, e.g. "estimatedvalue gt 10000".'},maxResults:{type:"integer",description:"Maximum number of opportunities to return in one call. Defaults to 100."}},additionalProperties:!0},steps:[{id:"fetchOpportunities",instruction:"Fetch open opportunities from the Dataverse Web API.",config:{type:"request",systemId:"dynamics365_sales",url:"https://<<dynamics365_sales_api_host>>/api/data/v9.2/opportunities",method:"GET",headers:{Authorization:"Bearer <<dynamics365_sales_access_token>>",Accept:"application/json","OData-MaxVersion":"4.0","OData-Version":"4.0","If-None-Match":"null"},queryParams:{$select:"name,estimatedvalue,estimatedclosedate,createdon,statecode,_parentaccountid_value",$filter:'<<(p) => p.filter ? "statecode eq 0 and (" + p.filter + ")" : "statecode eq 0">>',$top:"<<(p) => p.maxResults ?? 100>>",$count:"true"}}}],outputTransform:'(sourceData) => { const data = sourceData.fetchOpportunities?.data ?? {}; const rows = data.value ?? []; const capped = data["@Microsoft.Dynamics.CRM.totalrecordcountlimitexceeded"] === true; return { total: capped ? null : (data["@odata.count"] ?? rows.length), totalCapped: capped, returned: rows.length, opportunities: rows.map((r) => ({ id: r.opportunityid, name: r.name, estimatedValue: r.estimatedvalue, estimatedCloseDate: r.estimatedclosedate, accountId: r._parentaccountid_value, createdOn: r.createdon })) }; }'},{id:"dynamics-list-leads",name:"List Dynamics 365 leads",shortName:"Leads",instruction:"Lists lead records from Dynamics 365 with subject, name and company. Supports an optional OData $filter. Useful for validating migrated leads.",inputSchema:{type:"object",properties:{filter:{type:"string",description:'Optional OData $filter expression, e.g. "statecode eq 0" for open leads.'},maxResults:{type:"integer",description:"Maximum number of records to return in one call. Defaults to 100."}},additionalProperties:!0},steps:[{id:"fetchLeads",instruction:"Fetch leads from the Dataverse Web API.",config:{type:"request",systemId:"dynamics365_sales",url:"https://<<dynamics365_sales_api_host>>/api/data/v9.2/leads",method:"GET",headers:{Authorization:"Bearer <<dynamics365_sales_access_token>>",Accept:"application/json","OData-MaxVersion":"4.0","OData-Version":"4.0","If-None-Match":"null"},queryParams:{$select:"subject,fullname,companyname,statecode,createdon,modifiedon",$filter:"<<filter>>",$top:"<<(p) => p.maxResults ?? 100>>",$count:"true"}}}],outputTransform:'(sourceData) => { const data = sourceData.fetchLeads?.data ?? {}; const rows = data.value ?? []; const capped = data["@Microsoft.Dynamics.CRM.totalrecordcountlimitexceeded"] === true; return { total: capped ? null : (data["@odata.count"] ?? rows.length), totalCapped: capped, returned: rows.length, records: rows.map((r) => ({ id: r.leadid, subject: r.subject, name: r.fullname, company: r.companyname, state: r.statecode, createdOn: r.createdon, modifiedOn: r.modifiedon })) }; }'},{id:"dynamics-list-cases",name:"List Dynamics 365 cases",shortName:"Cases",instruction:"Lists case (incident) records from Dynamics 365 with title, ticket number and status. Supports an optional OData $filter.",inputSchema:{type:"object",properties:{filter:{type:"string",description:'Optional OData $filter expression, e.g. "statecode eq 0" for active cases.'},maxResults:{type:"integer",description:"Maximum number of records to return in one call. Defaults to 100."}},additionalProperties:!0},steps:[{id:"fetchCases",instruction:"Fetch incidents from the Dataverse Web API.",config:{type:"request",systemId:"dynamics365_sales",url:"https://<<dynamics365_sales_api_host>>/api/data/v9.2/incidents",method:"GET",headers:{Authorization:"Bearer <<dynamics365_sales_access_token>>",Accept:"application/json","OData-MaxVersion":"4.0","OData-Version":"4.0","If-None-Match":"null"},queryParams:{$select:"title,ticketnumber,statecode,createdon,_customerid_value",$filter:"<<filter>>",$top:"<<(p) => p.maxResults ?? 100>>",$count:"true"}}}],outputTransform:'(sourceData) => { const data = sourceData.fetchCases?.data ?? {}; const rows = data.value ?? []; const capped = data["@Microsoft.Dynamics.CRM.totalrecordcountlimitexceeded"] === true; return { total: capped ? null : (data["@odata.count"] ?? rows.length), totalCapped: capped, returned: rows.length, records: rows.map((r) => ({ id: r.incidentid, title: r.title, ticketNumber: r.ticketnumber, state: r.statecode, customerId: r._customerid_value, createdOn: r.createdon })) }; }'},{id:"dynamics-list-users",name:"List Dynamics 365 users",shortName:"Users",instruction:"Lists system users from Dynamics 365 with name, email and disabled state. Useful for owner-mapping checks during migrations.",inputSchema:{type:"object",properties:{filter:{type:"string",description:'Optional OData $filter expression, e.g. "isdisabled eq false" for active users.'},maxResults:{type:"integer",description:"Maximum number of records to return in one call. Defaults to 100."}},additionalProperties:!0},steps:[{id:"fetchUsers",instruction:"Fetch systemusers from the Dataverse Web API.",config:{type:"request",systemId:"dynamics365_sales",url:"https://<<dynamics365_sales_api_host>>/api/data/v9.2/systemusers",method:"GET",headers:{Authorization:"Bearer <<dynamics365_sales_access_token>>",Accept:"application/json","OData-MaxVersion":"4.0","OData-Version":"4.0","If-None-Match":"null"},queryParams:{$select:"fullname,internalemailaddress,isdisabled,createdon",$filter:"<<filter>>",$top:"<<(p) => p.maxResults ?? 100>>",$count:"true"}}}],outputTransform:'(sourceData) => { const data = sourceData.fetchUsers?.data ?? {}; const rows = data.value ?? []; const capped = data["@Microsoft.Dynamics.CRM.totalrecordcountlimitexceeded"] === true; return { total: capped ? null : (data["@odata.count"] ?? rows.length), totalCapped: capped, returned: rows.length, records: rows.map((r) => ({ id: r.systemuserid, name: r.fullname, email: r.internalemailaddress, disabled: r.isdisabled, createdOn: r.createdon })) }; }'},{id:"dynamics-list-products",name:"List Dynamics 365 products",shortName:"Products",instruction:"Lists product catalog records from Dynamics 365 with name, number and state. Supports an optional OData $filter.",inputSchema:{type:"object",properties:{filter:{type:"string",description:'Optional OData $filter expression, e.g. "statecode eq 0" for active products.'},maxResults:{type:"integer",description:"Maximum number of records to return in one call. Defaults to 100."}},additionalProperties:!0},steps:[{id:"fetchProducts",instruction:"Fetch products from the Dataverse Web API.",config:{type:"request",systemId:"dynamics365_sales",url:"https://<<dynamics365_sales_api_host>>/api/data/v9.2/products",method:"GET",headers:{Authorization:"Bearer <<dynamics365_sales_access_token>>",Accept:"application/json","OData-MaxVersion":"4.0","OData-Version":"4.0","If-None-Match":"null"},queryParams:{$select:"name,productnumber,statecode,createdon",$filter:"<<filter>>",$top:"<<(p) => p.maxResults ?? 100>>",$count:"true"}}}],outputTransform:'(sourceData) => { const data = sourceData.fetchProducts?.data ?? {}; const rows = data.value ?? []; const capped = data["@Microsoft.Dynamics.CRM.totalrecordcountlimitexceeded"] === true; return { total: capped ? null : (data["@odata.count"] ?? rows.length), totalCapped: capped, returned: rows.length, records: rows.map((r) => ({ id: r.productid, name: r.name, number: r.productnumber, state: r.statecode, createdOn: r.createdon })) }; }'},{id:"dynamics-query-dataverse",name:"Query any Dynamics 365 entity",shortName:"Query any entity",instruction:'Queries any Dataverse entity set. Required input: entitySet \u2014 the plural entity set name, e.g. "leads", "systemusers", "incidents". Optional inputs: select (OData $select field list), filter (OData $filter expression), maxResults (record cap, default 100). The workhorse tool for CRM migration validation and data quality checks beyond the prebuilt lists.',inputSchema:{type:"object",properties:{entitySet:{type:"string",description:'Dataverse entity set name (plural), e.g. "leads", "systemusers", "incidents".'},select:{type:"string",description:'Comma-separated OData $select field list, e.g. "subject,createdon". Omit for all fields.'},filter:{type:"string",description:"Optional OData $filter expression."},maxResults:{type:"integer",description:"Maximum number of records to return in one call. Defaults to 100."}},required:["entitySet"],additionalProperties:!0},steps:[{id:"queryEntity",instruction:"Query the requested Dataverse entity set.",config:{type:"request",systemId:"dynamics365_sales",url:"https://<<dynamics365_sales_api_host>>/api/data/v9.2/<<entitySet>>",method:"GET",headers:{Authorization:"Bearer <<dynamics365_sales_access_token>>",Accept:"application/json","OData-MaxVersion":"4.0","OData-Version":"4.0","If-None-Match":"null"},queryParams:{$select:"<<select>>",$filter:"<<filter>>",$top:"<<(p) => p.maxResults ?? 100>>",$count:"true"}}}],outputTransform:'(sourceData) => { const data = sourceData.queryEntity?.data ?? {}; const rows = data.value ?? []; const capped = data["@Microsoft.Dynamics.CRM.totalrecordcountlimitexceeded"] === true; return { total: capped ? null : (data["@odata.count"] ?? rows.length), totalCapped: capped, returned: rows.length, records: rows }; }'}]},dynamics365_business_central:{bundleId:"dynamics365_business_central",templateId:"dynamics365_business_central",systemId:"dynamics365_business_central",displayName:"Dynamics 365 Business Central",description:"Read companies, customers, vendors and the chart of accounts from Business Central.",systemUrl:"https://api.businesscentral.dynamics.com/v2.0/<<environment>>/api/v2.0",credentialHint:"Connect your Business Central environment. Your assistant walks you through it.",requiredCredentialKeys:["environment","access_token"],mcpServer:{name:"business-central",displayName:"Dynamics 365 Business Central",description:"Companies, customers, vendors, chart of accounts and ad-hoc entity queries from Business Central."},installMcpServer:!0,agentLaunch:{userPrompt:"I just installed the Dynamics 365 Business Central bundle. What can I do with it?",nextSteps:"Your first reply must be short: one line confirming the Business Central MCP server is installed, then collect the credentials. Use set_credentials for this system to collect environment (their BC environment name, usually production or sandbox) and access_token; never send the user to the Credentials page and never accept secrets as chat text. Fastest token: az account get-access-token --resource https://api.businesscentral.dynamics.com. Once saved, the MCP server is ready; run the companies tool as the test, because its result contains the company id every other tool needs. Do not list the installed tools, do not add tips unless asked. If asked later: tokens expire after about an hour, so a 401 means refresh access_token; the query tool accepts any Business Central entity set like items or salesInvoices."},tools:[{id:"business-central-list-companies",name:"List Business Central companies",shortName:"Companies",instruction:"Lists the companies in the Business Central environment. Run this first: every other Business Central tool needs a companyId from this list.",inputSchema:{type:"object",properties:{},additionalProperties:!0},steps:[{id:"fetchCompanies",instruction:"Fetch the companies in this environment.",config:{type:"request",systemId:"dynamics365_business_central",url:"https://api.businesscentral.dynamics.com/v2.0/<<dynamics365_business_central_environment>>/api/v2.0/companies",method:"GET",headers:{Authorization:"Bearer <<dynamics365_business_central_access_token>>",Accept:"application/json","Data-Access-Intent":"ReadOnly"}}}],outputTransform:"(sourceData) => { const rows = sourceData.fetchCompanies?.data?.value ?? []; return { total: rows.length, companies: rows.map((r) => ({ companyId: r.id, name: r.name, displayName: r.displayName })) }; }"},{id:"business-central-list-customers",name:"List Business Central customers",shortName:"Customers",instruction:"Lists customer master records from a Business Central company. Requires a companyId from the companies tool. Supports an optional OData $filter.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company id (GUID) from the companies tool."},filter:{type:"string",description:`Optional OData $filter expression, e.g. "blocked ne ''" or "contains(displayName,'GmbH')".`},maxResults:{type:"integer",description:"Maximum number of customers to return in one call. Defaults to 100."}},required:["companyId"],additionalProperties:!0},steps:[{id:"fetchCustomers",instruction:"Fetch customers for the given company.",config:{type:"request",systemId:"dynamics365_business_central",url:"https://api.businesscentral.dynamics.com/v2.0/<<dynamics365_business_central_environment>>/api/v2.0/companies(<<companyId>>)/customers",method:"GET",headers:{Authorization:"Bearer <<dynamics365_business_central_access_token>>",Accept:"application/json","Data-Access-Intent":"ReadOnly"},queryParams:{$select:"id,number,displayName,email,phoneNumber,blocked,lastModifiedDateTime",$filter:"<<filter>>",$top:"<<(p) => p.maxResults ?? 100>>",$count:"true"}}}],outputTransform:'(sourceData) => { const data = sourceData.fetchCustomers?.data ?? {}; const rows = data.value ?? []; return { total: data["@odata.count"] ?? rows.length, customers: rows.map((r) => ({ id: r.id, number: r.number, name: r.displayName, email: r.email, phone: r.phoneNumber, blocked: r.blocked, lastModified: r.lastModifiedDateTime })) }; }'},{id:"business-central-list-vendors",name:"List Business Central vendors",shortName:"Vendors",instruction:"Lists vendor master records from a Business Central company. Requires a companyId from the companies tool. Supports an optional OData $filter.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company id (GUID) from the companies tool."},filter:{type:"string",description:"Optional OData $filter expression."},maxResults:{type:"integer",description:"Maximum number of vendors to return in one call. Defaults to 100."}},required:["companyId"],additionalProperties:!0},steps:[{id:"fetchVendors",instruction:"Fetch vendors for the given company.",config:{type:"request",systemId:"dynamics365_business_central",url:"https://api.businesscentral.dynamics.com/v2.0/<<dynamics365_business_central_environment>>/api/v2.0/companies(<<companyId>>)/vendors",method:"GET",headers:{Authorization:"Bearer <<dynamics365_business_central_access_token>>",Accept:"application/json","Data-Access-Intent":"ReadOnly"},queryParams:{$select:"id,number,displayName,email,phoneNumber,blocked,lastModifiedDateTime",$filter:"<<filter>>",$top:"<<(p) => p.maxResults ?? 100>>",$count:"true"}}}],outputTransform:'(sourceData) => { const data = sourceData.fetchVendors?.data ?? {}; const rows = data.value ?? []; return { total: data["@odata.count"] ?? rows.length, vendors: rows.map((r) => ({ id: r.id, number: r.number, name: r.displayName, email: r.email, phone: r.phoneNumber, blocked: r.blocked, lastModified: r.lastModifiedDateTime })) }; }'},{id:"business-central-list-accounts",name:"List Business Central chart of accounts",shortName:"Chart of accounts",instruction:"Lists general ledger accounts (the chart of accounts) from a Business Central company. Requires a companyId from the companies tool. Supports an optional OData $filter.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company id (GUID) from the companies tool."},filter:{type:"string",description:`Optional OData $filter expression, e.g. "category eq 'Assets'".`},maxResults:{type:"integer",description:"Maximum number of accounts to return in one call. Defaults to 200."}},required:["companyId"],additionalProperties:!0},steps:[{id:"fetchAccounts",instruction:"Fetch general ledger accounts for the given company.",config:{type:"request",systemId:"dynamics365_business_central",url:"https://api.businesscentral.dynamics.com/v2.0/<<dynamics365_business_central_environment>>/api/v2.0/companies(<<companyId>>)/accounts",method:"GET",headers:{Authorization:"Bearer <<dynamics365_business_central_access_token>>",Accept:"application/json","Data-Access-Intent":"ReadOnly"},queryParams:{$select:"id,number,displayName,category,subCategory,blocked,accountType",$filter:"<<filter>>",$top:"<<(p) => p.maxResults ?? 200>>",$count:"true"}}}],outputTransform:'(sourceData) => { const data = sourceData.fetchAccounts?.data ?? {}; const rows = data.value ?? []; return { total: data["@odata.count"] ?? rows.length, accounts: rows.map((r) => ({ id: r.id, number: r.number, name: r.displayName, category: r.category, subCategory: r.subCategory, type: r.accountType, blocked: r.blocked })) }; }'},{id:"business-central-list-items",name:"List Business Central items",shortName:"Items",instruction:"Lists item (product) master records from a Business Central company. Requires a companyId from the companies tool. Supports an optional OData $filter.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company id (GUID) from the companies tool."},filter:{type:"string",description:`Optional OData $filter expression, e.g. "type eq 'Inventory'".`},maxResults:{type:"integer",description:"Maximum number of items to return in one call. Defaults to 100."}},required:["companyId"],additionalProperties:!0},steps:[{id:"fetchItems",instruction:"Fetch items for the given company.",config:{type:"request",systemId:"dynamics365_business_central",url:"https://api.businesscentral.dynamics.com/v2.0/<<dynamics365_business_central_environment>>/api/v2.0/companies(<<companyId>>)/items",method:"GET",headers:{Authorization:"Bearer <<dynamics365_business_central_access_token>>",Accept:"application/json","Data-Access-Intent":"ReadOnly"},queryParams:{$select:"id,number,displayName,type,unitPrice,inventory,blocked,lastModifiedDateTime",$filter:"<<filter>>",$top:"<<(p) => p.maxResults ?? 100>>",$count:"true"}}}],outputTransform:'(sourceData) => { const data = sourceData.fetchItems?.data ?? {}; const rows = data.value ?? []; return { total: data["@odata.count"] ?? rows.length, items: rows.map((r) => ({ id: r.id, number: r.number, name: r.displayName, type: r.type, unitPrice: r.unitPrice, inventory: r.inventory, blocked: r.blocked })) }; }'},{id:"business-central-list-sales-invoices",name:"List Business Central sales invoices",shortName:"Sales invoices",instruction:"Lists sales invoices from a Business Central company with customer, total and status. Requires a companyId from the companies tool. Supports an optional OData $filter.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company id (GUID) from the companies tool."},filter:{type:"string",description:`Optional OData $filter expression, e.g. "status eq 'Open'".`},maxResults:{type:"integer",description:"Maximum number of invoices to return in one call. Defaults to 100."}},required:["companyId"],additionalProperties:!0},steps:[{id:"fetchSalesInvoices",instruction:"Fetch sales invoices for the given company.",config:{type:"request",systemId:"dynamics365_business_central",url:"https://api.businesscentral.dynamics.com/v2.0/<<dynamics365_business_central_environment>>/api/v2.0/companies(<<companyId>>)/salesInvoices",method:"GET",headers:{Authorization:"Bearer <<dynamics365_business_central_access_token>>",Accept:"application/json","Data-Access-Intent":"ReadOnly"},queryParams:{$select:"id,number,customerName,invoiceDate,totalAmountIncludingTax,currencyCode,status",$filter:"<<filter>>",$top:"<<(p) => p.maxResults ?? 100>>",$count:"true"}}}],outputTransform:'(sourceData) => { const data = sourceData.fetchSalesInvoices?.data ?? {}; const rows = data.value ?? []; return { total: data["@odata.count"] ?? rows.length, invoices: rows.map((r) => ({ id: r.id, number: r.number, customer: r.customerName, date: r.invoiceDate, total: r.totalAmountIncludingTax, currency: r.currencyCode, status: r.status })) }; }'},{id:"business-central-list-gl-entries",name:"List Business Central general ledger entries",shortName:"GL entries",instruction:"Lists general ledger entries from a Business Central company with account, amounts and posting date. Requires a companyId from the companies tool. Filter by postingDate to verify opening balances at cutover.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company id (GUID) from the companies tool."},filter:{type:"string",description:'Optional OData $filter expression, e.g. "postingDate ge 2026-01-01".'},maxResults:{type:"integer",description:"Maximum number of entries to return in one call. Defaults to 200."}},required:["companyId"],additionalProperties:!0},steps:[{id:"fetchGLEntries",instruction:"Fetch general ledger entries for the given company.",config:{type:"request",systemId:"dynamics365_business_central",url:"https://api.businesscentral.dynamics.com/v2.0/<<dynamics365_business_central_environment>>/api/v2.0/companies(<<companyId>>)/generalLedgerEntries",method:"GET",headers:{Authorization:"Bearer <<dynamics365_business_central_access_token>>",Accept:"application/json","Data-Access-Intent":"ReadOnly"},queryParams:{$select:"id,entryNumber,postingDate,documentNumber,accountNumber,description,debitAmount,creditAmount",$filter:"<<filter>>",$top:"<<(p) => p.maxResults ?? 200>>",$count:"true"}}}],outputTransform:'(sourceData) => { const data = sourceData.fetchGLEntries?.data ?? {}; const rows = data.value ?? []; return { total: data["@odata.count"] ?? rows.length, entries: rows.map((r) => ({ entryNumber: r.entryNumber, postingDate: r.postingDate, document: r.documentNumber, account: r.accountNumber, description: r.description, debit: r.debitAmount, credit: r.creditAmount })) }; }'},{id:"business-central-query-entity",name:"Query any Business Central entity",shortName:"Query any entity",instruction:"Queries any Business Central entity set by name (for example items, salesInvoices, generalLedgerEntries) within a company, with optional OData $select and $filter. The workhorse tool for migration validation beyond the prebuilt lists.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company id (GUID) from the companies tool."},entitySet:{type:"string",description:'Business Central entity set name, e.g. "items", "salesInvoices", "generalLedgerEntries".'},select:{type:"string",description:"Comma-separated OData $select field list. Omit for all fields."},filter:{type:"string",description:"Optional OData $filter expression."},maxResults:{type:"integer",description:"Maximum number of records to return in one call. Defaults to 100."}},required:["companyId","entitySet"],additionalProperties:!0},steps:[{id:"queryEntity",instruction:"Query the requested entity set for the given company.",config:{type:"request",systemId:"dynamics365_business_central",url:"https://api.businesscentral.dynamics.com/v2.0/<<dynamics365_business_central_environment>>/api/v2.0/companies(<<companyId>>)/<<entitySet>>",method:"GET",headers:{Authorization:"Bearer <<dynamics365_business_central_access_token>>",Accept:"application/json","Data-Access-Intent":"ReadOnly"},queryParams:{$select:"<<select>>",$filter:"<<filter>>",$top:"<<(p) => p.maxResults ?? 100>>",$count:"true"}}}],outputTransform:'(sourceData) => { const data = sourceData.queryEntity?.data ?? {}; const rows = data.value ?? []; return { total: data["@odata.count"] ?? rows.length, records: rows }; }'}]},netsuite:{bundleId:"netsuite",templateId:"netsuite",systemId:Qd,displayName:"NetSuite",description:"Install a NetSuite system, ten read/query tools, fourteen write tools and a native integration playbook.",systemUrl:"https://{accountId}.suitetalk.api.netsuite.com/services/rest",credentialHint:"Connects through your own NetSuite integration record with OAuth 2.0. Your assistant asks for the account ID and the integration record's client ID and secret, then opens the NetSuite sign-in.",requiredCredentialKeys:["access_token"],oauthSignIn:!0,mcpServer:{name:"netsuite",displayName:"NetSuite",description:"Chart of accounts, customers, vendors, journal entries, invoices, vendor bills, subsidiaries and dimensions from NetSuite, SuiteQL queries and record lookups, plus create and update tools for journal entries, vendors, customers, GL accounts, invoices, vendor bills and departments."},installMcpServer:!1,playbook:{id:"netsuite-native-integration",name:"NetSuite Native Integration",whenToRun:"Use when connecting, validating, querying or extending a NetSuite integration through REST Web Services and SuiteQL.",inputs:"A configured NetSuite system with an OAuth sign-in; the record type or business process to work with; subsidiary scope for OneWorld accounts; validation criteria and desired output.",instructions:"Use the installed read-only tools for the chart of accounts, customers, vendors, journal entry lines, invoices, vendor bills, departments, subsidiaries, classes and locations. Use the SuiteQL query tool for any other record type, join or aggregate, and the get-record tool to inspect one record in full. Use the installed create and update tools for journal entries, vendors, customers, GL accounts, invoices, vendor bills and departments only after the user explicitly confirms the exact records to write; the create tools are not idempotent and re-running them duplicates records. Reference other records by internal ID from the list tools, and pass a subsidiary on OneWorld accounts. Surface NetSuite error details (o:errorDetails) as failures. For other record types or operations, inspect the account's metadata catalog, create separate least-privilege tools, validate them in a sandbox account and require explicit user confirmation before modifying NetSuite data.",completionCriteria:"The requested NetSuite data, write result or validation result is returned; subsidiary scope is correct; NetSuite errors are surfaced as failures with their details; no NetSuite data is modified unless the user explicitly requested and confirmed the write."},agentLaunch:{userPrompt:"I just installed the NetSuite integration. What can I do with it?",nextSteps:'Your first reply must be short: one line confirming the NetSuite integration and native integration playbook are installed. If the system already has a NetSuite sign-in for this user, offer one read-only test run and stop. Otherwise connect it in this order. 1) Ask in chat for the NetSuite account ID (Setup > Company > Company Information, like 1234567 or 1234567_SB1 for a sandbox; it is not a secret). 2) Build the host from it in lowercase with "_" replaced by "-" (1234567_SB1 becomes 1234567-sb1) and edit the system: url https://<host>.suitetalk.api.netsuite.com/services/rest, authentication type oauth2 with oauthClientMode custom, authUrl https://<host>.app.netsuite.com/app/login/oauth2/authorize.nl and tokenUrl https://<host>.suitetalk.api.netsuite.com/services/rest/auth/oauth2/v1/token. Read the system back and confirm no {accountId} remains; never start OAuth while it does. 3) Ask for the client ID and client secret of their NetSuite integration record in chat and store them in the system authentication. If they have no integration record yet, explain: Setup > Integration > Manage Integrations > New, enable Authorization Code Grant with the REST Web Services and RESTlets scopes, set the redirect URI to the superglue OAuth callback URL exactly, and copy the client ID and secret shown once after saving; the NetSuite role needs REST Web Services and Log in using OAuth 2.0 Access Tokens permissions. 4) Run authenticate_oauth for this system. OAuth fills access_token; never ask for a token as chat text and never send the user to the Credentials page. Once connected, the integration is ready; offer one read-only test run. Do not list the installed tools or add tips unless asked. If asked later: the sign-in lasts seven days and a 401 means signing in again; the SuiteQL tool reads any record type; the installed create and update tools modify NetSuite data, so run them only after the user confirms the exact records to write.'},tools:TAe}};Fn.bundles={...Ab,sage_intacct_mcp:{...Ab.sage_intacct,bundleId:"sage_intacct_mcp",description:"Install the Sage Intacct integration and an OAuth-protected MCP server for its read/query and write tools.",installMcpServer:!0},netsuite_mcp:{...Ab.netsuite,bundleId:"netsuite_mcp",description:"Install the NetSuite integration and an OAuth-protected MCP server for its read/query and write tools.",installMcpServer:!0}};function RAe({bundle:t,install:e}){let r=e.tools.map(s=>` - ${s.id}${s.name?` (${s.name})`:""}`).join(`
|
|
81
81
|
`),n=e.system.requiredCredentialKeys.join(", "),i=e.mcpServer?[` - MCP server: ${e.mcpServer.name} (id: ${e.mcpServer.id})`,"","Silently load the systems and tool-deployment skills before replying. Do not narrate the skill loads.","","The MCP server card is already visible in this conversation with the server URL, its tools, and the client export options for Claude, Cursor, Langdock and curl. Do not describe or reproduce client setup in prose; point at the card."]:["","Silently load the systems skill before replying. Do not narrate the skill load."],o=[`The user just installed the "${t.displayName}" ${e.mcpServer?"MCP server and integration":"integration"} from the superglue website. Everything below already exists. Do not create, rebuild or duplicate any of it.`,"","Installed:",` - System: ${e.system.id} (${e.system.name}) at ${t.systemUrl}`," - Tools:",r,e.playbook?` - Playbook: ${e.playbook.name} (id: ${e.playbook.id})`:void 0,...i,"",e.system.hasUserCredentials?t.demoCredentials?"The system is preloaded with a shared demo credential, so every tool works right now without any setup.":"The system already has credentials for this user.":`The system does not have a complete credential set yet, so no tool will run until the user adds the missing values. Required credential keys: ${n}. ${t.credentialHint}`,t.agentLaunch.nextSteps,"","The user already saw this inventory on the install screen. Do not repeat it back to them."];return{userPrompt:t.agentLaunch.userPrompt,hiddenStarterMessage:o.filter(s=>s!==void 0).join(`
|
|
82
|
-
`)}}function kAe(t){return typeof t!="string"||!Object.prototype.hasOwnProperty.call(Fn.bundles,t)?null:Fn.bundles[t]}function NAe(){return Object.values(Fn.bundles)}function OAe({tool:t,fromSystemId:e,toSystemId:r}){if(e===r)return t;let n=i=>typeof i=="string"?i.split(`${e}_`).join(`${r}_`):Array.isArray(i)?i.map(n):i&&typeof i=="object"?Object.fromEntries(Object.entries(i).map(([o,s])=>[o,n(s)])):i;return{...t,steps:t.steps.map(i=>{let o=n(i.config);return(0,EAe.isRequestConfig)(o)&&o.systemId===e&&(o.systemId=r),{...i,config:o}}),outputTransform:n(t.outputTransform)}}});var ix=m(ko=>{"use strict";var UAe=ko&&ko.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),MAe=ko&&ko.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),xAe=ko&&ko.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&UAe(r,e,n[i]);return MAe(r,e),r}})();Object.defineProperty(ko,"__esModule",{value:!0});ko.applyDiffsToConfig=$Ae;var LAe=xAe(require("fast-json-patch")),PAe=cp(),FAe=ln();function $Ae(t,e){if(!e?.length)return t;let r=JSON.parse(JSON.stringify(t)),n=(0,PAe.normalizeToolSchemas)(r),i=(0,FAe.normalizeToolDiffs)(e);return LAe.applyPatch(n,i,!0,!0).newDocument||n}});var ox=m(Xi=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});Xi.MCP_TOOL_GRANT_PARAM=Xi.MCP_TOOL_GRANT_SCOPE=Xi.MCP_OAUTH_REFRESH_TOKEN_EXPIRES_IN_SECONDS=Xi.MCP_OAUTH_ACCESS_TOKEN_EXPIRES_IN_SECONDS=void 0;Xi.MCP_OAUTH_ACCESS_TOKEN_EXPIRES_IN_SECONDS=3600;Xi.MCP_OAUTH_REFRESH_TOKEN_EXPIRES_IN_SECONDS=3600*24*365;Xi.MCP_TOOL_GRANT_SCOPE="superglue:mcp:new";Xi.MCP_TOOL_GRANT_PARAM="mcp_tool_grant"});var sx=m(nt=>{"use strict";Object.defineProperty(nt,"__esModule",{value:!0});nt.MAX_LOGO_SIZE_BYTES=nt.MAX_API_REQUEST_BODY_BYTES=nt.MAX_SESSION_ARTIFACT_BYTES=nt.MAX_TOOL_RESULT_BYTES=nt.MAX_UPLOAD_FILES_PER_BATCH=nt.MAX_QBM_UPLOAD_FILE_BYTES=nt.MAX_UPLOAD_FILE_BYTES=nt.MAX_INLINE_FILE_BASE64_BYTES=nt.V8_MAX_STRING_CHARS=void 0;nt.
|
|
82
|
+
`)}}function kAe(t){return typeof t!="string"||!Object.prototype.hasOwnProperty.call(Fn.bundles,t)?null:Fn.bundles[t]}function NAe(){return Object.values(Fn.bundles)}function OAe({tool:t,fromSystemId:e,toSystemId:r}){if(e===r)return t;let n=i=>typeof i=="string"?i.split(`${e}_`).join(`${r}_`):Array.isArray(i)?i.map(n):i&&typeof i=="object"?Object.fromEntries(Object.entries(i).map(([o,s])=>[o,n(s)])):i;return{...t,steps:t.steps.map(i=>{let o=n(i.config);return(0,EAe.isRequestConfig)(o)&&o.systemId===e&&(o.systemId=r),{...i,config:o}}),outputTransform:n(t.outputTransform)}}});var ix=m(ko=>{"use strict";var UAe=ko&&ko.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),MAe=ko&&ko.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),xAe=ko&&ko.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),i=0;i<n.length;i++)n[i]!=="default"&&UAe(r,e,n[i]);return MAe(r,e),r}})();Object.defineProperty(ko,"__esModule",{value:!0});ko.applyDiffsToConfig=$Ae;var LAe=xAe(require("fast-json-patch")),PAe=cp(),FAe=ln();function $Ae(t,e){if(!e?.length)return t;let r=JSON.parse(JSON.stringify(t)),n=(0,PAe.normalizeToolSchemas)(r),i=(0,FAe.normalizeToolDiffs)(e);return LAe.applyPatch(n,i,!0,!0).newDocument||n}});var ox=m(Xi=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});Xi.MCP_TOOL_GRANT_PARAM=Xi.MCP_TOOL_GRANT_SCOPE=Xi.MCP_OAUTH_REFRESH_TOKEN_EXPIRES_IN_SECONDS=Xi.MCP_OAUTH_ACCESS_TOKEN_EXPIRES_IN_SECONDS=void 0;Xi.MCP_OAUTH_ACCESS_TOKEN_EXPIRES_IN_SECONDS=3600;Xi.MCP_OAUTH_REFRESH_TOKEN_EXPIRES_IN_SECONDS=3600*24*365;Xi.MCP_TOOL_GRANT_SCOPE="superglue:mcp:new";Xi.MCP_TOOL_GRANT_PARAM="mcp_tool_grant"});var sx=m(nt=>{"use strict";Object.defineProperty(nt,"__esModule",{value:!0});nt.MAX_LOGO_SIZE_BYTES=nt.MAX_API_REQUEST_BODY_BYTES=nt.MAX_SESSION_ARTIFACT_BYTES=nt.MAX_TOOL_RESULT_BYTES=nt.MAX_UPLOAD_FILES_PER_BATCH=nt.MAX_QBM_UPLOAD_FILE_BYTES=nt.MAX_UPLOAD_FILE_BYTES=nt.MAX_INLINE_FILE_BASE64_BYTES=nt.V8_MAX_STRING_CHARS=void 0;nt.maxUploadFileBytes=jAe;nt.V8_MAX_STRING_CHARS=536870888;nt.MAX_INLINE_FILE_BASE64_BYTES=375*1024*1024;nt.MAX_UPLOAD_FILE_BYTES=50*1024*1024;nt.MAX_QBM_UPLOAD_FILE_BYTES=200*1024*1024;function jAe(t){return/\.qbm$/i.test(t)?nt.MAX_QBM_UPLOAD_FILE_BYTES:nt.MAX_UPLOAD_FILE_BYTES}nt.MAX_UPLOAD_FILES_PER_BATCH=10;nt.MAX_TOOL_RESULT_BYTES=500*1024*1024;nt.MAX_SESSION_ARTIFACT_BYTES=nt.MAX_TOOL_RESULT_BYTES;nt.MAX_API_REQUEST_BODY_BYTES=500*1024*1024;nt.MAX_LOGO_SIZE_BYTES=10*1024*1024});var mb=m(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.RUN_LIST_EXECUTION_KINDS=ft.RUN_LIST_STATUSES=ft.FILE_RESOURCE_SOURCES=ft.LIST_MAX_SEARCH_LENGTH=ft.LIST_MAX_LIMIT=ft.LIST_DEFAULT_LIMIT=ft.LIST_DEFAULT_PAGE=void 0;ft.createListQueryParams=ax;ft.createSearchListQueryParams=qAe;ft.listAllPages=zAe;ft.fileResourceSource=HAe;ft.createListResponse=GAe;var gb=dr();ft.LIST_DEFAULT_PAGE=1;ft.LIST_DEFAULT_LIMIT=1e3;ft.LIST_MAX_LIMIT=1e3;ft.LIST_MAX_SEARCH_LENGTH=200;function ax(t){let e=new URLSearchParams;return t.page!==void 0&&e.set("page",String(t.page)),t.limit!==void 0&&e.set("limit",String(t.limit)),e}function qAe(t){let e=ax(t);return t.search!==void 0&&e.set("search",t.search),e}async function zAe(t){let e=[];for(let r=1;;r+=1){let n=await t(r,ft.LIST_MAX_LIMIT);if(e.push(...n.data),!n.hasMore||n.data.length===0)return e}}ft.FILE_RESOURCE_SOURCES=["upload","task","system","playbook"];function HAe(t){return t.origin?t.origin.type:t.tasks.length>0?"task":"upload"}ft.RUN_LIST_STATUSES=["running","success","failed","aborted"];ft.RUN_LIST_EXECUTION_KINDS=[gb.RunExecutionKind.FULL,gb.RunExecutionKind.DRAFT,gb.RunExecutionKind.SINGLE_STEP];function GAe({data:t,page:e,limit:r,total:n}){return{data:t,page:e,limit:r,total:n,hasMore:(e-1)*r+t.length<n}}});var cx=m(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.AGENT_SESSION_EMAIL_LOGO_CID=void 0;mn.emailTemplate=wa;mn.buildPasswordResetEmail=VAe;mn.buildOrgInvitationEmail=JAe;mn.buildOrgLoginEmail=WAe;mn.buildAgentSessionEmail=KAe;mn.buildArtifactSubmissionEmail=XAe;mn.buildResourceShareEmail=epe;var YAe="https://superglue.cloud/logos/sg_logo.png";function Ze(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function wa({body:t}){return`<!doctype html>
|
|
83
83
|
<html lang="en">
|
|
84
84
|
<body style="margin:0;padding:0;background:#f6f6f6;font-family:Inter,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif;color:#111111;">
|
|
85
85
|
<table role="presentation" width="100%" cellspacing="0" cellpadding="0" style="background:#f6f6f6;padding:28px 16px;">
|
|
@@ -1008,7 +1008,9 @@ qbXML rules: QuickBooks validates element order strictly against Intuit's onscre
|
|
|
1008
1008
|
|
|
1009
1009
|
Run one request at a time: parallel sessions hung and crashed QuickBooks in testing, so never run tools in parallel or schedule overlapping runs. Page with iterator="Start" and then iterator="Continue" with the returned iteratorID until iteratorRemainingCount is 0, all inside one script; an iteratorID from an earlier script fails with 3391. AccountQuery and EmployeeQuery reject iterators; query them without paging or MaxReturned. Line items require IncludeLineItems true, inactive list records require ActiveStatus All, and custom fields require OwnerID 0 (returned as DataExtRet). Use IncludeRetElement to limit fields. Filter transactions with TxnDateRangeFilter or ModifiedDateRangeFilter and lists with FromModifiedDate. Jobs use the full name "Customer:Job". Times are in the host's local time zone, so add an overlap for incremental syncs on TimeModified. Amounts are strings. Reports return ReportRet rows and columns that need flattening. Responses above 50 MB exceed the per-call limit; split by date range or type.
|
|
1010
1010
|
|
|
1011
|
-
Status codes: 1 means no matching records (normal). 500 means an invalid ListID or TxnID. 1000 often means the feature is off in that company; check PreferencesQuery. 3250 means the feature is not enabled. 80040423 means an unsupported qbXML version. 80040414 (a dialog is open in QuickBooks) and 80040421 (a stray QuickBooks process holds another file) need someone at the host to close the dialog or end QBW, QBDBMgrN or cscript processes; report them and do not retry in a loop. After a plain timeout, verify whether each write committed before retrying it; retry read-only requests once. Writes need the record's current EditSequence for modifies and explicit user approval before they run.`},sage_intacct:{name:"sage_intacct",apiUrl:"https://api.intacct.com/ia/xml/xmlgw.phtml",regex:"^.*(intacct|sage.*intacct).*$",icon:"sage",docsUrl:"https://developer.intacct.com/web-services/",preferredAuthType:"api_key",oauth:{authUrl:"https://api.intacct.com/ia/api/v1/oauth2/authorize",tokenUrl:"https://api.intacct.com/ia/api/v1/oauth2/token",scopes:"offline_access",grant_type:"authorization_code",tokenAuthMethod:"body",tokenContentType:"form"},keywords:["accounting","erp","general ledger","accounts payable","accounts receivable","invoices","bills","vendors","customers","journal entries","cash management","purchasing","order entry","projects","contracts","financial reports","dimensions","budgets","consolidation","multi-entity"],systemSpecificInstructions:`
|
|
1011
|
+
Status codes: 1 means no matching records (normal). 500 means an invalid ListID or TxnID. 1000 often means the feature is off in that company; check PreferencesQuery. 3250 means the feature is not enabled. 80040423 means an unsupported qbXML version. 80040414 (a dialog is open in QuickBooks) and 80040421 (a stray QuickBooks process holds another file) need someone at the host to close the dialog or end QBW, QBDBMgrN or cscript processes; report them and do not retry in a loop. After a plain timeout, verify whether each write committed before retrying it; retry read-only requests once. Writes need the record's current EditSequence for modifies and explicit user approval before they run.`},sage_intacct:{name:"sage_intacct",apiUrl:"https://api.intacct.com/ia/xml/xmlgw.phtml",regex:"^.*(intacct|sage.*intacct).*$",icon:"sage",docsUrl:"https://developer.intacct.com/web-services/",preferredAuthType:"api_key",oauth:{authUrl:"https://api.intacct.com/ia/api/v1/oauth2/authorize",tokenUrl:"https://api.intacct.com/ia/api/v1/oauth2/token",scopes:"offline_access",grant_type:"authorization_code",tokenAuthMethod:"body",tokenContentType:"form"},keywords:["accounting","erp","general ledger","accounts payable","accounts receivable","invoices","bills","vendors","customers","journal entries","cash management","purchasing","order entry","projects","contracts","financial reports","dimensions","budgets","consolidation","multi-entity"],systemSpecificInstructions:`Load the sage-intacct skill before working with this system.
|
|
1012
|
+
|
|
1013
|
+
Sage Intacct has two API surfaces:
|
|
1012
1014
|
- REST API: newer JSON API, base URL https://api.intacct.com/ia/api/v1, OAuth 2.0 bearer auth (authorize/token endpoints under /oauth2/, scope offline_access for refresh tokens). REST docs: https://developer.sage.com/intacct/apis/intacct/1/intacct-openapi
|
|
1013
1015
|
- XML Web Services API: older but still required for many finance and legacy/object-specific operations. All requests are XML POST bodies to https://api.intacct.com/ia/xml/xmlgw.phtml
|
|
1014
1016
|
- Coverage differs: prefer REST when it exposes the needed objects, use XML when it does not.
|
|
@@ -1152,7 +1154,9 @@ REQUEST BODY STRUCTURE:
|
|
|
1152
1154
|
}
|
|
1153
1155
|
}
|
|
1154
1156
|
|
|
1155
|
-
Multiple actions can be batched in a single request. No OpenAPI spec is publicly available \u2014 all endpoints are documented at https://apidoc.onoffice.de/.`},acumatica:{name:"acumatica",apiUrl:"https://{host}/{tenant}/entity/Default/{endpointVersion}",regex:"^.*(acumatica|/entity/[A-Za-z0-9_]+/\\d{2}\\.\\d{3}\\.\\d{3}(/|$)).*$",icon:"/logos/acumatica.svg",docsUrl:"https://help.acumatica.com/",preferredAuthType:"oauth2",oauth:{authUrl:"https://{host}/{tenant}/identity/connect/authorize",tokenUrl:"https://{host}/{tenant}/identity/connect/token",scopes:"openid offline_access api",grant_type:"authorization_code",tokenAuthMethod:"body",tokenContentType:"form",usePKCE:!0},keywords:["records","sales orders","purchase orders","invoices","customers","vendors","inventory items","stock items","journal entries","accounts","employees","shipments","opportunities","cases"],systemSpecificInstructions:`
|
|
1157
|
+
Multiple actions can be batched in a single request. No OpenAPI spec is publicly available \u2014 all endpoints are documented at https://apidoc.onoffice.de/.`},acumatica:{name:"acumatica",apiUrl:"https://{host}/{tenant}/entity/Default/{endpointVersion}",regex:"^.*(acumatica|/entity/[A-Za-z0-9_]+/\\d{2}\\.\\d{3}\\.\\d{3}(/|$)).*$",icon:"/logos/acumatica.svg",docsUrl:"https://help.acumatica.com/",preferredAuthType:"oauth2",oauth:{authUrl:"https://{host}/{tenant}/identity/connect/authorize",tokenUrl:"https://{host}/{tenant}/identity/connect/token",scopes:"openid offline_access api",grant_type:"authorization_code",tokenAuthMethod:"body",tokenContentType:"form",usePKCE:!0},keywords:["records","sales orders","purchase orders","invoices","customers","vendors","inventory items","stock items","journal entries","accounts","employees","shipments","opportunities","cases"],systemSpecificInstructions:`Load the acumatica skill before working with this system.
|
|
1158
|
+
|
|
1159
|
+
Acumatica is multi-tenant and self-hosted by resellers/VARs, so {host} and {tenant} (the instance name in the URL path) vary per customer \u2014 get both from the customer's Acumatica login URL. Many cloud sites, such as https://client.acumatica.com, have no instance name; then drop the {tenant} path segment from every URL. {endpointVersion} is the contract version enabled on that specific instance (e.g. "25.200.001"); it is not a fixed superglue-side constant and must be confirmed per tenant, typically via the Web Service Endpoints screen (SM207060) or by calling /entity with no version to list available endpoints.
|
|
1156
1160
|
|
|
1157
1161
|
Prefer OAuth with the Authorization Code flow, signed in by a dedicated API user. It requires a "Connected Application" registered in Acumatica (screen SM303010, HTTPS only) with the superglue redirect URI, plus a dedicated API user with an "API" or "Unrestricted" login type user role \u2014 OAuth registration alone is not sufficient. superglue does not support the Resource Owner Password flow, so do not offer it.
|
|
1158
1162
|
|
|
@@ -1164,13 +1168,15 @@ Branch access is role-based: each branch names an access role (Branches screen C
|
|
|
1164
1168
|
|
|
1165
1169
|
CRITICAL \u2014 the concurrent API user limit is the most common Acumatica integration failure and it presents as an authentication error when it is not one. The instance licence caps concurrent web-services sessions via "Maximum Number of Web Services API Users" on the License Monitoring Console (SM604000), frequently as low as 3 to 6. Two behaviours exhaust it: any request that does not carry the existing session cookie opens a NEW session and consumes another slot, so a client that re-authenticates per request burns the entire licence within a handful of calls; and a session never closed with POST /entity/auth/logout stays open until it times out on its own (roughly 20 minutes), so a crashed run leaves orphaned sessions holding slots. The failure surfaces as "API login limit exceeded". Do NOT treat it as bad credentials and do NOT retry the login \u2014 retrying consumes more slots and deepens the outage. Diagnose it as seat exhaustion, reuse one session for the whole run, and always log out. The concurrent_access scope permits multiple simultaneous sessions on one token but still requires closing them.
|
|
1166
1170
|
|
|
1167
|
-
Two further cautions. Client secrets on a Connected Application can carry expiry dates, so a previously working integration can fail on an expired secret rather than a revoked grant \u2014 check the secret expiry before re-registering. And contract-based writes use PUT with upsert semantics matched on the entity's natural keys rather than a separate create endpoint, so an incomplete payload can silently create a second record instead of updating the intended one; confirm the key fields before writing, and get explicit user approval before any write or action call.`},netsuite:{name:"netsuite",apiUrl:"https://{accountId}.suitetalk.api.netsuite.com/services/rest",regex:"^.*(netsuite|suitetalk\\.api\\.netsuite\\.com|app\\.netsuite\\.com).*$",icon:"/logos/netsuite.svg",docsUrl:"https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/book_1559132836.html",preferredAuthType:"oauth2",oauth:{authUrl:"https://{accountId}.app.netsuite.com/app/login/oauth2/authorize.nl",tokenUrl:"https://{accountId}.suitetalk.api.netsuite.com/services/rest/auth/oauth2/v1/token",scopes:"rest_webservices restlets",grant_type:"authorization_code",tokenAuthMethod:"basic_auth",tokenContentType:"form",usePKCE:!0},keywords:["records","customers","sales orders","invoices","items","vendors","purchase orders","employees","accounts","journal entries","payments","suiteql","datasets","metadata catalog","custom records"],systemSpecificInstructions:`
|
|
1171
|
+
Two further cautions. Client secrets on a Connected Application can carry expiry dates, so a previously working integration can fail on an expired secret rather than a revoked grant \u2014 check the secret expiry before re-registering. And contract-based writes use PUT with upsert semantics matched on the entity's natural keys rather than a separate create endpoint, so an incomplete payload can silently create a second record instead of updating the intended one; confirm the key fields before writing, and get explicit user approval before any write or action call.`},netsuite:{name:"netsuite",apiUrl:"https://{accountId}.suitetalk.api.netsuite.com/services/rest",regex:"^.*(netsuite|suitetalk\\.api\\.netsuite\\.com|app\\.netsuite\\.com).*$",icon:"/logos/netsuite.svg",docsUrl:"https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/book_1559132836.html",preferredAuthType:"oauth2",oauth:{authUrl:"https://{accountId}.app.netsuite.com/app/login/oauth2/authorize.nl",tokenUrl:"https://{accountId}.suitetalk.api.netsuite.com/services/rest/auth/oauth2/v1/token",scopes:"rest_webservices restlets",grant_type:"authorization_code",tokenAuthMethod:"basic_auth",tokenContentType:"form",usePKCE:!0},keywords:["records","customers","sales orders","invoices","items","vendors","purchase orders","employees","accounts","journal entries","payments","suiteql","datasets","metadata catalog","custom records"],systemSpecificInstructions:`Load the netsuite skill before working with this system.
|
|
1172
|
+
|
|
1173
|
+
NetSuite REST Web Services are account-specific: replace {accountId} in apiUrl, authUrl, and tokenUrl with the account ID from Setup > Company > Company Information > Company URLs. Every REST request needs the full URL: <<systemId_url>>/record/v1/<recordType> for records and <<systemId_url>>/query/v1/suiteql for SuiteQL; a relative path such as /record/v1/customer fails with Invalid URL. Do not copy the demo123 examples from Oracle docs.
|
|
1168
1174
|
|
|
1169
1175
|
Before OAuth works, enable REST Web Services and OAuth 2.0 in NetSuite, then create an integration record with Authorization Code Grant, REST Web Services, and RESTlets enabled. The redirect URI must exactly match the superglue OAuth callback, and NetSuite only shows the client ID/secret on first save. Request scopes rest_webservices and restlets and send client credentials as HTTP Basic to the form-encoded token endpoint. Metadata/OpenAPI is account-specific at /record/v1/metadata-catalog with Accept: application/swagger+json, so no public openApiUrl is configured. The sign-in lasts seven days; when a step gets 401 INVALID_LOGIN, the user reconnects NetSuite in superglue.
|
|
1170
1176
|
|
|
1171
1177
|
SuiteQL runs as POST /query/v1/suiteql with the header Prefer: transient and a body like {"q": "SELECT id, companyname FROM customer WHERE isinactive = 'F'"}; page with ?limit=1000&offset=N and read hasMore in the response (100,000 rows per query at most). The offset must be a multiple of the limit, and the limit must be at least 2. SuiteQL returns every value as a string and dates in the user's date format: select TO_CHAR(field, 'YYYY-MM-DD') for ISO dates and BUILTIN.DF(field) for display names. For open amounts use transaction.foreignamountunpaid; the amountremaining columns can fail with UNEXPECTED_ERROR. Record list endpoints return 100 items by default and up to 1,000 with ?limit=1000. A record create answers 204 with the new record URL in the Location header, so set captureHttpResponse: true to read the ID. PATCH with ?replace=<sublist> (line, item, expense) replaces that sublist; without it, sent lines are added to the existing ones. Send X-NetSuite-idempotency-key with a fresh UUID on write requests so a retry is safe. The account allows 15 concurrent requests by default, shared by REST and RESTlets, and answers 429 CONCURRENCY_LIMIT_EXCEEDED instead of queuing: run NetSuite steps in sequence and retry after a short wait.
|
|
1172
1178
|
|
|
1173
|
-
The REST API reads and writes records only. It cannot create or change account structure: custom fields, custom record types, custom lists, forms, workflows, saved searches, roles, or scripts. Use the suitecloud protocol on this same system for structure. Step URL: suitecloud://{accountId}.app.netsuite.com, with the same {accountId} host prefix as apiUrl. The body is a JSON object with an operation (validate, preview, deploy, listObjects, importObjects, callRestlet); see the suitecloud reference for the project file format. It uses the same OAuth sign-in as the REST steps, so it runs as the connected user and role. The role needs the SuiteCloud Development Framework permissions; the standard Developer role has them. Setup guide: https://superglue.ai/docs/guides/netsuite-suitecloud/. Always run validate and preview and show the planned changes before deploy. A deploy step must set modify to true. Tell the user before the deploy when a change cannot be undone, such as enabling a feature.`},spotify:{name:"spotify",apiUrl:"https://api.spotify.com/v1",regex:"^.*(spotify|api\\.spotify\\.com).*$",icon:"spotify",docsUrl:"https://developer.spotify.com/documentation/web-api",openApiUrl:"https://developer.spotify.com/reference/web-api/open-api-schema.yaml",preferredAuthType:"oauth2",oauth:{authUrl:"https://accounts.spotify.com/authorize",tokenUrl:"https://accounts.spotify.com/api/token",scopes:"user-read-private user-read-email",grant_type:"authorization_code",tokenAuthMethod:"basic_auth",tokenContentType:"form",usePKCE:!1},keywords:["albums","artists","tracks","playlists","users","shows","episodes","audiobooks","player","playback","search","recommendations","library","markets"],systemSpecificInstructions:`Register your app at https://developer.spotify.com/dashboard to obtain client_id and client_secret. The redirect URI must be added exactly in the dashboard \u2014 any mismatch causes an auth error.
|
|
1179
|
+
The REST API reads and writes records only. It cannot create or change account structure: custom fields, custom record types, custom lists, forms, workflows, saved searches, roles, or scripts. Use the suitecloud protocol on this same system for structure. Step URL: suitecloud://{accountId}.app.netsuite.com, with the same {accountId} host prefix as apiUrl. The body is a JSON object with an operation (validate, preview, deploy, listObjects, importObjects, listFiles, importFiles, callRestlet); see the suitecloud reference for the project file format. It uses the same OAuth sign-in as the REST steps, so it runs as the connected user and role. The role needs the SuiteCloud Development Framework permissions; the standard Developer role has them. Setup guide: https://superglue.ai/docs/guides/netsuite-suitecloud/. Always run validate and preview and show the planned changes before deploy. A deploy step must set modify to true. Tell the user before the deploy when a change cannot be undone, such as enabling a feature.`},spotify:{name:"spotify",apiUrl:"https://api.spotify.com/v1",regex:"^.*(spotify|api\\.spotify\\.com).*$",icon:"spotify",docsUrl:"https://developer.spotify.com/documentation/web-api",openApiUrl:"https://developer.spotify.com/reference/web-api/open-api-schema.yaml",preferredAuthType:"oauth2",oauth:{authUrl:"https://accounts.spotify.com/authorize",tokenUrl:"https://accounts.spotify.com/api/token",scopes:"user-read-private user-read-email",grant_type:"authorization_code",tokenAuthMethod:"basic_auth",tokenContentType:"form",usePKCE:!1},keywords:["albums","artists","tracks","playlists","users","shows","episodes","audiobooks","player","playback","search","recommendations","library","markets"],systemSpecificInstructions:`Register your app at https://developer.spotify.com/dashboard to obtain client_id and client_secret. The redirect URI must be added exactly in the dashboard \u2014 any mismatch causes an auth error.
|
|
1174
1180
|
|
|
1175
1181
|
Token endpoint uses form-encoded body (not JSON) with client credentials in the Authorization: Basic base64(client_id:client_secret) header. Client Credentials flow (no user context) does not issue refresh tokens. PKCE is supported for public clients (no client_secret) \u2014 use usePKCE: true for SPA/mobile flows.`},spaceship:{name:"spaceship",apiUrl:"https://spaceship.dev/api/v1",regex:"^.*(spaceship\\.dev|\\bspaceship\\b).*$",icon:"spaceship",docsUrl:"https://docs.spaceship.dev",preferredAuthType:"api_key",keywords:["domains","dns","records","nameservers","contacts","registrar","whois","transfers","registration"],systemSpecificInstructions:"Authentication requires two headers on every request: X-Api-Key (your API key) and X-Api-Secret (your API secret). Generate both at https://spaceship.com/application/api-manager/."},promptwatch:{name:"promptwatch",apiUrl:"https://server.promptwatch.com/api/v2",regex:"^.*(promptwatch).*$",icon:"promptwatch",docsUrl:"https://promptwatch.com/docs",openApiUrl:"https://promptwatch.com/docs/v2/openapi.json",preferredAuthType:"api_key",keywords:["monitors","prompts","projects","responses","citations","brands","rank analysis","content gaps","sitemap","brand mentions","visibility","analytics","ai visibility"],systemSpecificInstructions:`Promptwatch API authentication:
|
|
1176
1182
|
|
|
@@ -1762,9 +1768,9 @@ ${e.format(r)}`.trim())}};hj.exports=pQ});var hQ=m((_xe,Ej)=>{"use strict";var{I
|
|
|
1762
1768
|
${s}`;return}if(Cy(e,i,KTe)){XTe(e,o)&&(r.retry=e.toString("utf8",o));return}if(Cy(e,i,ZTe)){eRe(e,o)&&(r.id=e.toString("utf8",o));return}if(Cy(e,i,WTe)){let s=e.toString("utf8",o);s.length>0&&(r.event=s)}}processEvent(e){e.retry&&HTe(e.retry)&&(this.state.reconnectionTime=parseInt(e.retry,10)),e.id!==void 0&>e(e.id)&&(this.state.lastEventId=e.id),e.data!==void 0&&this.push({type:e.event||"message",options:{data:e.data,lastEventId:this.state.lastEventId,origin:this.state.origin}})}clearEvent(){this.event.data=void 0,this.event.event=void 0,this.event.id=void 0,this.event.retry=void 0}hasPendingEvent(){return this.event.data!==void 0||this.event.event!==void 0||this.event.id!==void 0||this.event.retry!==void 0}hasCurrentByte(){return this.chunkIndex<this.chunks.length&&this.pos<this.chunks[this.chunkIndex].length}currentByte(){return this.chunks[this.chunkIndex][this.pos]}consumeCurrentByte(){this.advanceCursor(),this.syncLineStartToCursor()}advanceCursor(){for(this.pos++;this.chunkIndex<this.chunks.length&&this.pos>=this.chunks[this.chunkIndex].length;)this.chunkIndex++,this.pos=0}syncLineStartToCursor(){this.lineChunkIndex=this.chunkIndex,this.linePos=this.pos,this.dropConsumedChunks()}dropConsumedChunks(){for(;this.lineChunkIndex>0;)this.chunks.shift(),this.lineChunkIndex--,this.chunkIndex--;this.chunkIndex===this.chunks.length&&(this.chunks.length=0,this.chunkIndex=0,this.pos=0,this.lineChunkIndex=0,this.linePos=0)}readLine(){if(this.lineChunkIndex===this.chunkIndex)return this.chunks[this.chunkIndex].subarray(this.linePos,this.pos);let e=[],r=0;for(let n=this.lineChunkIndex;n<=this.chunkIndex;n++){let i=this.chunks[n],o=n===this.lineChunkIndex?this.linePos:0,s=n===this.chunkIndex?this.pos:i.length,a=i.subarray(o,s);r+=a.length,e.push(a)}return Buffer.concat(e,r)}peekBufferedByte(e){let r=this.lineChunkIndex,n=this.linePos;for(;r<this.chunks.length;){let i=this.chunks[r],o=i.length-n;if(e<o)return i[n+e];e-=o,r++,n=0}}discardLeadingBytes(e){for(;e>0&&this.lineChunkIndex<this.chunks.length;){let n=this.chunks[this.lineChunkIndex].length-this.linePos;e<n?(this.linePos+=e,e=0):(e-=n,this.lineChunkIndex++,this.linePos=0)}this.chunkIndex=this.lineChunkIndex,this.pos=this.linePos,this.dropConsumedChunks()}handleBOM(){let e=this.peekBufferedByte(0),r=this.peekBufferedByte(1),n=this.peekBufferedByte(2);return r===void 0?(e===Hu[0]||(this.checkBOM=!1),!0):n===void 0?e===Hu[0]&&r===Hu[1]?!0:(this.checkBOM=!1,!1):(e===Hu[0]&&r===Hu[1]&&n===Hu[2]&&this.discardLeadingBytes(3),this.checkBOM=!1,!this.hasCurrentByte())}};nG.exports={EventSourceStream:Mv}});var AG=m((bLe,dG)=>{"use strict";var{pipeline:tRe}=require("stream"),{fetching:rRe}=OA(),{makeRequest:nRe}=Uu(),{webidl:cr}=Ft(),{EventSourceStream:iRe}=iG(),{parseMIMEType:oRe}=In(),{createFastMessageEvent:sRe}=uy(),{isNetworkError:oG}=RA(),{kEnumerableProperty:pc}=ye(),{environmentSettingsObject:sG}=jr(),aG=!1,cG=3e3,$A=0,uG=1,jA=2,aRe="anonymous",cRe="use-credentials",Gu=class t extends EventTarget{#e={open:null,error:null,message:null};#t;#n=!1;#i=$A;#o=null;#r=null;#c;#s;constructor(e,r={}){super(),cr.util.markAsUncloneable(this);let n="EventSource constructor";cr.argumentLengthCheck(arguments,1,n),aG||(aG=!0,process.emitWarning("EventSource is experimental, expect them to change at any time.",{code:"UNDICI-ES"})),e=cr.converters.USVString(e),r=cr.converters.EventSourceInitDict(r,n,"eventSourceInitDict"),this.#c=r.node.dispatcher||r.dispatcher,this.#s={lastEventId:"",reconnectionTime:r.node.reconnectionTime};let i=sG,o;try{o=new URL(e,i.settingsObject.baseUrl),this.#s.origin=o.origin}catch(c){throw new DOMException(c,"SyntaxError")}this.#t=o.href;let s=aRe;r.withCredentials===!0&&(s=cRe,this.#n=!0);let a={redirect:"follow",keepalive:!0,mode:"cors",credentials:s==="anonymous"?"same-origin":"omit",referrer:"no-referrer"};a.client=sG.settingsObject,a.headersList=[["accept",{name:"accept",value:"text/event-stream"}]],a.cache="no-store",a.initiator="other",a.urlList=[new URL(this.#t)],this.#o=nRe(a),this.#a()}get readyState(){return this.#i}get url(){return this.#t}get withCredentials(){return this.#n}#a(){if(this.#i===jA)return;this.#i=$A;let e={request:this.#o,dispatcher:this.#c},r=n=>{if(!oG(n))return this.#u()};e.processResponseEndOfBody=r,e.processResponse=n=>{if(oG(n))if(n.aborted){this.close(),this.dispatchEvent(new Event("error"));return}else{this.#u();return}let i=n.headersList.get("content-type",!0),o=i!==null?oRe(i):"failure",s=o!=="failure"&&o.essence==="text/event-stream";if(n.status!==200||s===!1){this.close(),this.dispatchEvent(new Event("error"));return}this.#i=uG,this.dispatchEvent(new Event("open")),this.#s.origin=n.urlList[n.urlList.length-1].origin;let a=new iRe({eventSourceSettings:this.#s,push:c=>{this.dispatchEvent(sRe(c.type,c.options))}});tRe(n.body.stream,a,c=>{c?.aborted===!1&&(this.close(),this.dispatchEvent(new Event("error")))})},this.#r=rRe(e)}#u(){this.#i!==jA&&(this.#i=$A,this.dispatchEvent(new Event("error")),setTimeout(()=>{this.#i===$A&&(this.#s.lastEventId.length&&this.#o.headersList.set("last-event-id",this.#s.lastEventId,!0),this.#a())},this.#s.reconnectionTime)?.unref())}close(){cr.brandCheck(this,t),this.#i!==jA&&(this.#i=jA,this.#r.abort(),this.#o=null)}get onopen(){return this.#e.open}set onopen(e){this.#e.open&&this.removeEventListener("open",this.#e.open);let r=cr.converters.EventHandlerNonNull(e);r!==null?(this.addEventListener("open",r),this.#e.open=e):this.#e.open=null}get onmessage(){return this.#e.message}set onmessage(e){this.#e.message&&this.removeEventListener("message",this.#e.message);let r=cr.converters.EventHandlerNonNull(e);r!==null?(this.addEventListener("message",r),this.#e.message=e):this.#e.message=null}get onerror(){return this.#e.error}set onerror(e){this.#e.error&&this.removeEventListener("error",this.#e.error);let r=cr.converters.EventHandlerNonNull(e);r!==null?(this.addEventListener("error",r),this.#e.error=e):this.#e.error=null}},lG={CONNECTING:{__proto__:null,configurable:!1,enumerable:!0,value:$A,writable:!1},OPEN:{__proto__:null,configurable:!1,enumerable:!0,value:uG,writable:!1},CLOSED:{__proto__:null,configurable:!1,enumerable:!0,value:jA,writable:!1}};Object.defineProperties(Gu,lG);Object.defineProperties(Gu.prototype,lG);Object.defineProperties(Gu.prototype,{close:pc,onerror:pc,onmessage:pc,onopen:pc,readyState:pc,url:pc,withCredentials:pc});cr.converters.EventSourceInitDict=cr.dictionaryConverter([{key:"withCredentials",converter:cr.converters.boolean,defaultValue:()=>!1},{key:"dispatcher",converter:cr.converters.any},{key:"node",converter:cr.dictionaryConverter([{key:"reconnectionTime",converter:cr.converters["unsigned long"],defaultValue:()=>cG},{key:"dispatcher",converter:cr.converters.any}]),defaultValue:()=>({})}]);dG.exports={EventSource:Gu,defaultReconnectionTime:cG}});var yG=m((SLe,V)=>{"use strict";var uRe=Rs(),fG=Pd(),lRe=Fa(),dRe=K$(),ARe=r1(),pRe=qa(),fRe=gB(),hRe=AB(),gRe=$1(),mRe=V1(),yRe=Z1(),hG=fe(),Sy=ye(),{InvalidArgumentError:by}=hG,Yu=k2(),ERe=Da(),IRe=rQ(),{MockCallHistory:CRe,MockCallHistoryLog:bRe}=oQ(),SRe=fQ(),wRe=uQ(),BRe=Rj(),QRe=PB(),vRe=gm(),{getGlobalDispatcher:gG,setGlobalDispatcher:_Re}=Rm(),DRe=Du(),TRe=bQ();Object.assign(fG.prototype,Yu);V.exports.Dispatcher=fG;V.exports.Client=uRe;V.exports.Pool=lRe;V.exports.BalancedPool=dRe;V.exports.RoundRobinPool=ARe;V.exports.Agent=pRe;V.exports.ProxyAgent=fRe;V.exports.Socks5ProxyAgent=hRe;V.exports.EnvHttpProxyAgent=gRe;V.exports.RetryAgent=mRe;V.exports.H2CClient=yRe;V.exports.RetryHandler=vRe;V.exports.DecoratorHandler=DRe;V.exports.RedirectHandler=TRe;V.exports.interceptors={redirect:jj(),responseError:zj(),retry:Gj(),dump:Jj(),dns:Xj(),cache:Rq(),decompress:xq(),deduplicate:jq()};V.exports.cacheStores={MemoryCacheStore:MQ()};var RRe=Hq();V.exports.cacheStores.SqliteCacheStore=RRe;V.exports.buildConnector=ERe;V.exports.errors=hG;V.exports.util={parseHeaders:Sy.parseHeaders,headerNameToString:Sy.headerNameToString};function qA(t){return(e,r,n)=>{if(typeof r=="function"&&(n=r,r=null),!e||typeof e!="string"&&typeof e!="object"&&!(e instanceof URL))throw new by("invalid url");if(r!=null&&typeof r!="object")throw new by("invalid opts");if(r&&r.path!=null){if(typeof r.path!="string")throw new by("invalid opts.path");let s=r.path;r.path.startsWith("/")||(s=`/${s}`),e=new URL(Sy.parseOrigin(e).origin+s)}else r||(r=typeof e=="object"?e:{}),e=Sy.parseURL(e);let{agent:i,dispatcher:o=gG()}=r;if(i)throw new by("unsupported opts.agent. Did you mean opts.client?");return t.call(o,{...r,origin:e.origin,path:e.search?`${e.pathname}${e.search}`:e.pathname,method:r.method||(r.body?"PUT":"GET")},n)}}V.exports.setGlobalDispatcher=_Re;V.exports.getGlobalDispatcher=gG;var kRe=OA().fetch,pG=typeof __filename<"u"?__filename:void 0;function mG(t,e){if(!t||typeof t!="object")return;let r=typeof t.stack=="string"?t.stack:"",n=e.replace(/\\/g,"/");if(r&&(r.includes(e)||r.includes(n)))return;let i={};if(Error.captureStackTrace(i,mG),!i.stack)return;let o=i.stack.split(`
|
|
1763
1769
|
`).slice(1).join(`
|
|
1764
1770
|
`);t.stack=r?`${r}
|
|
1765
|
-
${o}`:i.stack}V.exports.fetch=function(e,r=void 0){return kRe(e,r).catch(n=>{throw pG?mG(n,pG):n&&typeof n=="object"&&Error.captureStackTrace(n,V.exports.fetch),n})};V.exports.Headers=oc().Headers;V.exports.Response=RA().Response;V.exports.Request=Uu().Request;V.exports.FormData=zg().FormData;var{setGlobalOrigin:NRe,getGlobalOrigin:ORe}=ZS();V.exports.setGlobalOrigin=NRe;V.exports.getGlobalOrigin=ORe;var{CacheStorage:URe}=tH(),{kConstruct:MRe}=$e();V.exports.caches=new URe(MRe);var{deleteCookie:xRe,getCookies:LRe,getSetCookies:PRe,setCookie:FRe,parseCookie:$Re}=pH();V.exports.deleteCookie=xRe;V.exports.getCookies=LRe;V.exports.getSetCookies=PRe;V.exports.setCookie=FRe;V.exports.parseCookie=$Re;var{parseMIMEType:jRe,serializeAMimeType:qRe}=In();V.exports.parseMIMEType=jRe;V.exports.serializeAMimeType=qRe;var{CloseEvent:zRe,ErrorEvent:HRe,MessageEvent:GRe}=uy(),{WebSocket:YRe,ping:VRe}=GH();V.exports.WebSocket=YRe;V.exports.CloseEvent=zRe;V.exports.ErrorEvent=HRe;V.exports.MessageEvent=GRe;V.exports.ping=VRe;V.exports.WebSocketStream=eG().WebSocketStream;V.exports.WebSocketError=Rv().WebSocketError;V.exports.request=qA(Yu.request);V.exports.stream=qA(Yu.stream);V.exports.pipeline=qA(Yu.pipeline);V.exports.connect=qA(Yu.connect);V.exports.upgrade=qA(Yu.upgrade);V.exports.MockClient=IRe;V.exports.MockCallHistory=CRe;V.exports.MockCallHistoryLog=bRe;V.exports.MockPool=wRe;V.exports.MockAgent=SRe;V.exports.SnapshotAgent=BRe;V.exports.mockErrors=QRe;var{EventSource:JRe}=AG();V.exports.EventSource=JRe;function WRe(){globalThis.fetch=V.exports.fetch,globalThis.Headers=V.exports.Headers,globalThis.Response=V.exports.Response,globalThis.Request=V.exports.Request,globalThis.FormData=V.exports.FormData,globalThis.WebSocket=V.exports.WebSocket,globalThis.CloseEvent=V.exports.CloseEvent,globalThis.ErrorEvent=V.exports.ErrorEvent,globalThis.MessageEvent=V.exports.MessageEvent,globalThis.EventSource=V.exports.EventSource}V.exports.install=WRe});var IG=m(Ju=>{"use strict";Object.defineProperty(Ju,"__esModule",{value:!0});Ju.SuperglueClient=Ju.SuperglueHttpError=void 0;var Vu=dr(),Dn=mb(),ZRe=Yb(),KRe=RL(),XRe=ln(),Vo=Lc(),eke=Xl(),HA=14400*1e3,zA;if(typeof globalThis.process<"u"&&globalThis.process.versions?.node)try{let{Agent:t}=yG();zA=new t({headersTimeout:HA,bodyTimeout:HA})}catch{}function EG(t){if(t?.aborted)throw t.reason??new DOMException("Aborted","AbortError")}var wy=class extends Error{constructor(e,r,n,i){super(e),this.status=r,this.code=n,this.details=i,this.name="SuperglueHttpError"}};Ju.SuperglueHttpError=wy;var xv=class{constructor({apiKey:e,apiEndpoint:r,onInfrastructureError:n,refreshToken:i,sseTokenProvider:o,tokenProvider:s}){if(!e&&!s)throw new Error("SuperglueClient requires either apiKey or tokenProvider");this.tokenProvider=s??(async()=>e),this.apiEndpoint=r??"https://api.superglue.cloud",this.sseManager=new ZRe.SSELogSubscriptionManager(this.apiEndpoint,o??this.tokenProvider,i),this.onInfrastructureError=n,this.refreshToken=i}async getApiKey(){return this.tokenProvider()}async fetchWithAuthRetry(e,r){let n=await this.getApiKey(),i=await e(n);if(i.status!==401||!this.refreshToken)return i;EG(r);let o=await this.refreshToken();return EG(r),!o||o===n?i:(i.body?.cancel(),e(o))}isInfrastructureError(e){return(0,XRe.isAbortError)(e)?!1:!!(e instanceof TypeError&&e.message.toLowerCase().includes("fetch")||e instanceof Error&&e.name==="TimeoutError")}async restRequest(e,r,n,i,o){let a=await(await this.restResponse({method:e,path:r,body:n,extraHeaders:i,requestInit:o})).text();if(a)return JSON.parse(a)}async restResponse({method:e,path:r,body:n,extraHeaders:i,requestInit:o}){let s=`${this.apiEndpoint.replace(/\/$/,"")}${r}`,a=n!=null,c=typeof FormData<"u"&&n instanceof FormData,u=d=>{let A={Authorization:`Bearer ${d}`,...i};return a&&!c&&e!=="GET"&&(A["Content-Type"]="application/json"),fetch(s,{...o,method:e,headers:A,body:a?c?n:JSON.stringify(n):void 0,signal:o?.signal??AbortSignal.timeout(HA),...zA?{dispatcher:zA}:{}})},l;try{l=await this.fetchWithAuthRetry(u,o?.signal)}catch(d){throw this.isInfrastructureError(d)&&this.onInfrastructureError?.(),d}if(!l.ok)throw await this.buildHttpError(l);return l}async uploadFiles(e,r){if(typeof r?.process!="boolean")throw new Error("process must be a boolean");if(e.length===0)return[];let n=e.map(l=>({...l,contentLength:l.contentLength??this.getUploadContentLength(l.content)})),o=(await this.restRequest("POST","/v1/files/uploads",{process:r.process,files:n.map(({fileName:l,contentType:d,contentLength:A})=>({fileName:l,contentLength:A,...d?{contentType:d}:{}}))})).data.files;if(o.length!==n.length)throw await Promise.all(o.map(l=>this.deleteFileUpload(l.id).catch(()=>{}))),new Error("Upload response did not match the selected files");let s=await Promise.allSettled(o.map(async(l,d)=>{let A=n[d],p=await fetch(l.uploadUrl,{method:"PUT",body:A.content,headers:A.contentType?{"Content-Type":A.contentType}:void 0,signal:AbortSignal.timeout(Math.min(HA,l.expiresIn*1e3))});if(!p.ok)throw new Error(`Upload failed for ${A.fileName}: ${p.status} ${p.statusText}`);return l.id})),a=s.flatMap(l=>l.status==="fulfilled"?[l.value]:[]),c=new Map;if(a.length>0)try{let l=await this.restRequest("POST","/v1/files/uploads/complete",{fileIds:a});c=new Map(l.data.files.map(d=>[d.id,d]))}catch(l){c=new Map(a.map(d=>[d,{id:d,fileName:n[o.findIndex(A=>A.id===d)]?.fileName||d,contentLength:n[o.findIndex(A=>A.id===d)]?.contentLength||0,status:"failed",error:l instanceof Error?l.message:String(l)}]))}let u=o.map((l,d)=>{let A=s[d],p=n[d];return A.status==="rejected"?{id:l.id,fileName:p.fileName,contentLength:p.contentLength,status:"failed",error:A.reason instanceof Error?A.reason.message:String(A.reason)}:c.get(l.id)||{id:l.id,fileName:p.fileName,contentLength:p.contentLength,status:"failed",error:"Upload completion returned no result"}});return await Promise.all(u.filter(l=>l.status==="failed").map(l=>this.deleteFileUpload(l.id).catch(()=>{}))),u}async deleteFileUpload(e){await this.restRequest("DELETE",`/v1/files/uploads/${encodeURIComponent(e)}`)}getUploadContentLength(e){return typeof e=="string"?new TextEncoder().encode(e).byteLength:e instanceof Uint8Array?e.byteLength:e.size}async buildHttpError(e){e.status>=500&&this.onInfrastructureError?.();let r=await e.text(),n=`HTTP ${e.status}: ${r}`,i,o;try{let s=JSON.parse(r);s&&typeof s=="object"&&!Array.isArray(s)&&(o=s),typeof s?.code=="string"&&(i=s.code);let a=s.error;typeof a=="string"?n=a:a&&typeof a=="object"&&(n=a.message||JSON.stringify(a))}catch{}return new wy(n,e.status,i,o)}async streamRequest(e,r,n){let i=e.includes("?")?"&":"?",o=`${this.apiEndpoint.replace(/\/$/,"")}${e}${i}stream=true`,s=u=>fetch(o,{method:"POST",headers:{Authorization:`Bearer ${u}`,Accept:"text/event-stream","Content-Type":"application/json"},body:JSON.stringify(r),signal:n??AbortSignal.timeout(HA),...zA?{dispatcher:zA}:{}}),a;try{a=await this.fetchWithAuthRetry(s,n)}catch(u){throw this.isInfrastructureError(u)&&this.onInfrastructureError?.(),u}if(!a.ok)throw await this.buildHttpError(a);if(!(a.headers.get("content-type")||"").includes("text/event-stream")){let u=await a.text();return u?JSON.parse(u):void 0}try{return await(0,KRe.consumeEventStreamResult)(a)}catch(u){throw this.isInfrastructureError(u)&&this.onInfrastructureError?.(),u}}async subscribeToLogsSSE(e={}){return this.sseManager.subscribeToLogs(e)}async disconnect(){await this.sseManager.disconnect()}async listMemoryNotes(e={}){let r=new URLSearchParams;e.scope&&r.set("scope",e.scope),e.query&&r.set("query",e.query);let n=r.toString();return(await this.restRequest("GET",`/v1/memory-notes${n?`?${n}`:""}`)).data}async createMemoryNote(e){return(await this.restRequest("POST","/v1/memory-notes",e)).data}async updateMemoryNote(e,r){return(await this.restRequest("PATCH",`/v1/memory-notes/${encodeURIComponent(e)}`,r)).data}async deleteMemoryNote(e){await this.restRequest("DELETE",`/v1/memory-notes/${encodeURIComponent(e)}`)}async clearMemoryNotes(e){return(await this.restRequest("DELETE",`/v1/memory-notes?scope=${e}`)).data.deleted}async getMe(){return this.restRequest("GET","/v1/me")}async completeOnboarding(){return this.restRequest("POST","/v1/me/onboarding/complete")}async runTool(e){let r=await this.restRequest("POST",`/v1/tools/${encodeURIComponent(e.toolId)}/run`,{inputs:e.payload,files:e.files,credentials:e.credentials,includeStepResultData:e.includeStepResultData,options:e.options,runId:e.runId,stateFixture:e.stateFixture},void 0,e.signal?{signal:e.signal}:void 0);return{success:r.status==="success",data:r.data,error:r.error,tool:r.tool,stepResults:r.stepResults?.map(n=>({...n}))||[],...r.fileArtifacts&&r.fileArtifacts.length>0?{fileArtifacts:r.fileArtifacts}:{},...r.metadata?.warnings?.length?{warnings:r.metadata.warnings}:{}}}async runToolConfig(e){let r=e.createRun?"/v1/tools/run?createRun=true":"/v1/tools/run",n=await this.restRequest("POST",r,{tool:e.tool,payload:e.payload,files:e.files,credentials:e.credentials,includeStepResultData:e.includeStepResultData,options:e.options,runId:e.runId,stateFixture:e.stateFixture,executionKind:e.executionKind,parentToolId:e.parentToolId,draftId:e.draftId},e.traceId?{"X-Trace-Id":e.traceId}:void 0,e.signal?{signal:e.signal}:void 0);return{success:n.status?n.status==="success":n.success??!1,data:n.data,error:n.error,tool:n.tool||e.tool,stepResults:n.stepResults?.map(o=>({...o}))||[],...n.fileArtifacts&&n.fileArtifacts.length>0?{fileArtifacts:n.fileArtifacts}:{},...n.metadata?.warnings?.length?{warnings:n.metadata.warnings}:{}}}async abortToolExecution(e){return{success:!0,runId:(await this.restRequest("POST",`/v1/runs/${encodeURIComponent(e)}/cancel`)).runId}}async executeStep({step:e,payload:r,files:n,previousResults:i,credentials:o,options:s,runId:a,systemIds:c,credentialId:u,systemAuth:l,createRun:d,parentToolId:A,stepIndex:p,stepId:h,signal:g,stream:S}){let B={step:e,payload:r,files:n,previousResults:i,credentials:o,options:s,runId:a,systemIds:c,credentialId:u,systemAuth:l,createRun:d,parentToolId:A,stepIndex:p,stepId:h};return S?this.streamRequest("/v1/tools/step/run",B,g):this.restRequest("POST","/v1/tools/step/run",B,void 0,g?{signal:g}:void 0)}async abortStep(e){return this.restRequest("POST","/v1/tools/step/abort",{runId:e})}async executeTransformOnly({outputTransform:e,outputSchema:r,inputSchema:n,payload:i,files:o,stepResults:s,options:a,runId:c,createRun:u,parentToolId:l,stepId:d,signal:A,stream:p}){let h={outputTransform:e,outputSchema:r,inputSchema:n,payload:i,files:o,stepResults:s,options:a,runId:c,createRun:u,parentToolId:l,stepId:d};return p?this.streamRequest("/v1/tools/transform/run",h,A):this.restRequest("POST","/v1/tools/transform/run",h,void 0,A?{signal:A}:void 0)}async createRun({toolId:e,toolConfig:r,toolResult:n,stepResults:i,toolPayload:o,status:s,error:a,startedAt:c,completedAt:u,executionKind:l,parentToolId:d,draftId:A}){return this.restRequest("POST","/v1/runs",{toolId:e,toolConfig:r,toolResult:n,stepResults:i,toolPayload:o,status:s,error:a,startedAt:(0,Vo.toUTCISOString)(c,"run.startedAt"),completedAt:(0,Vo.toUTCISOString)(u,"run.completedAt"),executionKind:l,parentToolId:d,draftId:A})}async checkRunLimit(){return(await this.restRequest("POST","/v1/runs/check-limit")).data}async extract({file:e,envelope:r}){if(!e)throw new Error("File must be provided for extract.");let n=new FormData;n.append("file",e);let i=r?"/v1/extract?envelope=true":"/v1/extract";return this.restRequest("POST",i,n)}mapOpenAPIRunToRun(e){let r={running:Vu.RunStatus.RUNNING,success:Vu.RunStatus.SUCCESS,failed:Vu.RunStatus.FAILED,aborted:Vu.RunStatus.ABORTED};return{runId:e.runId??e.id,toolId:e.toolId,tool:e.tool,systemIds:e.systemIds,status:r[e.status]??Vu.RunStatus.FAILED,toolPayload:e.toolPayload,data:e.data,toolResult:e.data,error:e.error,stepResults:e.stepResults,options:e.options,requestSource:e.requestSource,traceId:e.traceId,resultStorageUri:e.resultStorageUri,userId:e.userId,userEmail:e.userEmail,userName:e.userName,metadata:{...e.metadata,executionKind:e.metadata?.executionKind??Vu.RunExecutionKind.FULL},fileArtifacts:e.fileArtifacts}}mapOpenAPIScheduleToToolSchedule(e){return{...e,lastRunAt:e.lastRunAt?(0,Vo.requireUTCDate)(e.lastRunAt,"schedule.lastRunAt"):void 0,nextRunAt:(0,Vo.requireUTCDate)(e.nextRunAt,"schedule.nextRunAt"),createdAt:(0,Vo.requireUTCDate)(e.createdAt,"schedule.createdAt"),updatedAt:(0,Vo.requireUTCDate)(e.updatedAt,"schedule.updatedAt")}}async listRuns(e={}){let r=(0,Dn.createSearchListQueryParams)(e);e.toolId!==void 0&&r.set("toolId",e.toolId),e.searchUserIds?.length&&r.set("searchUserIds",e.searchUserIds.join(",")),e.includeTotal!==void 0&&r.set("includeTotal",String(e.includeTotal)),e.startedAfter!==void 0&&r.set("startedAfter",e.startedAfter instanceof Date?(0,Vo.toUTCISOString)(e.startedAfter,"run.startedAfter"):e.startedAfter),e.statuses!==void 0?r.set("status",e.statuses.join(",")):e.status!==void 0&&r.set("status",e.status),e.requestSources!==void 0&&r.set("requestSources",e.requestSources.join(",")),e.executionKinds!==void 0&&r.set("executionKinds",e.executionKinds.join(",")),e.userId!==void 0&&r.set("userId",e.userId),e.systemId!==void 0&&r.set("systemId",e.systemId),e.systemIds!==void 0&&r.set("systemIds",e.systemIds.join(","));let n=r.size>0?`?${r.toString()}`:"",i=await this.restRequest("GET",`/v1/runs${n}`,void 0,void 0,{signal:e.signal});return{data:i.data.map(o=>this.mapOpenAPIRunToRun(o)),total:i.total,page:i.page,limit:i.limit,hasMore:i.hasMore}}async getActivityCounts(e){let r=new URLSearchParams;e?.from&&r.set("from",e.from instanceof Date?(0,Vo.toUTCISOString)(e.from,"activity.from"):e.from),e?.to&&r.set("to",e.to instanceof Date?(0,Vo.toUTCISOString)(e.to,"activity.to"):e.to);let n=r.toString();return(await this.restRequest("GET",`/v1/activity/counts${n?`?${n}`:""}`,void 0,void 0,{signal:e?.signal})).counts}async getRun(e){try{let r=await this.restRequest("GET",`/v1/runs/${encodeURIComponent(e)}`);return this.mapOpenAPIRunToRun(r)}catch(r){if(r.message?.includes("404")||r.message?.includes("not found"))return null;throw r}}async getTool(e){try{return await this.restRequest("GET",`/v1/tools/${encodeURIComponent(e)}`)}catch(r){if(r.message?.includes("404")||r.message?.includes("not found")||r.message?.includes("403")||r.message?.includes("not allowed"))return null;throw r}}async getToolState(e){return(await this.restRequest("GET",`/v1/tools/${encodeURIComponent(e)}/state`)).state}async setToolState(e,r){await this.restRequest("PUT",`/v1/tools/${encodeURIComponent(e)}/state`,{state:r})}async deleteToolState(e){return(await this.restRequest("DELETE",`/v1/tools/${encodeURIComponent(e)}/state`)).deletedKeys}async archiveTool(e,r=!0){return this.updateTool(e,{archived:r})}async bulkArchiveTools(e,r=!0){return this.restRequest("POST","/v1/tools/bulk/archive",{ids:e,archived:r})}async bulkDeleteTools(e){return this.restRequest("POST","/v1/tools/bulk/delete",{ids:e})}async listTools(e={}){let r=(0,Dn.createListQueryParams)(e);e.includeArchived!==void 0&&r.set("includeArchived",String(e.includeArchived));let n=r.size>0?`?${r.toString()}`:"";return this.restRequest("GET",`/v1/tools${n}`)}async listAllTools(e={}){return(0,Dn.listAllPages)((r,n)=>this.listTools({...e,page:r,limit:n}))}async createTool(e,r){return this.restRequest("POST","/v1/tools",{...r,id:e})}async updateTool(e,r){return this.restRequest("PUT",`/v1/tools/${encodeURIComponent(e)}`,r)}async deleteTool(e){try{return await this.restRequest("DELETE",`/v1/tools/${encodeURIComponent(e)}`),!0}catch(r){if(r.message?.includes("404"))return!1;throw r}}async renameTool(e,r){return this.restRequest("POST",`/v1/tools/${encodeURIComponent(e)}/rename`,{newId:r})}async getWorkflow(e){return this.getTool(e)}async archiveWorkflow(e,r=!0){return this.upsertWorkflow(e,{archived:r})}async createWorkflow(e,r){return this.createTool(e,r)}async updateWorkflow(e,r){return this.updateTool(e,r)}async upsertWorkflow(e,r){return await this.getTool(e)?this.updateTool(e,r):this.createTool(e,r)}async deleteWorkflow(e){return this.deleteTool(e)}async renameWorkflow(e,r){return this.renameTool(e,r)}async listProjectSummaries(e={}){let r=(0,Dn.createSearchListQueryParams)(e);return r.set("includeResources","false"),e.includeArchived!==void 0&&r.set("includeArchived",String(e.includeArchived)),this.restRequest("GET",`/v1/projects?${r.toString()}`)}async listAllProjectSummaries({includeArchived:e}={}){return(0,Dn.listAllPages)((r,n)=>this.listProjectSummaries({page:r,limit:n,...e!==void 0?{includeArchived:e}:{}}))}async listAllProjectTasks(e){return(0,Dn.listAllPages)((r,n)=>this.restRequest("GET",`/v1/projects/${encodeURIComponent(e)}/tasks?page=${r}&limit=${n}`))}async saveProjectTask({projectId:e,taskId:r,input:n}){let i=`/v1/projects/${encodeURIComponent(e)}/tasks${r?`/${encodeURIComponent(r)}`:""}`;return(await this.restRequest(r?"PATCH":"POST",i,n)).data}async listSchedules(e={}){let r=(0,Dn.createListQueryParams)(e),n=r.size>0?`?${r.toString()}`:"",i=e.toolId?`/v1/tools/${encodeURIComponent(e.toolId)}/schedules${n}`:`/v1/schedules${n}`,o=await this.restRequest("GET",i);return{...o,data:o.data.map(s=>this.mapOpenAPIScheduleToToolSchedule(s))}}async listAllSchedules(e={}){return(0,Dn.listAllPages)((r,n)=>this.listSchedules({...e,page:r,limit:n}))}async getToolSchedule(e,r){try{let n=await this.restRequest("GET",`/v1/tools/${encodeURIComponent(e)}/schedules/${encodeURIComponent(r)}`);return this.mapOpenAPIScheduleToToolSchedule(n)}catch(n){if(n.message?.includes("404")||n.message?.includes("not found"))return null;throw n}}async createToolSchedule(e,r){let n=await this.restRequest("POST",`/v1/tools/${encodeURIComponent(e)}/schedules`,{...r,timezone:r.timezone||(0,eke.getRuntimeTimezone)()});return this.mapOpenAPIScheduleToToolSchedule(n)}async updateToolSchedule(e,r,n){let i=await this.restRequest("PUT",`/v1/tools/${encodeURIComponent(e)}/schedules/${encodeURIComponent(r)}`,n);return this.mapOpenAPIScheduleToToolSchedule(i)}async deleteToolSchedule(e,r){return await this.restRequest("DELETE",`/v1/tools/${encodeURIComponent(e)}/schedules/${encodeURIComponent(r)}`),!0}async bulkSetSchedulesEnabled(e,r){return this.restRequest("POST","/v1/schedules/bulk/enable",{ids:e,enabled:r})}async bulkDeleteSchedules(e){return this.restRequest("POST","/v1/schedules/bulk/delete",{ids:e})}async listCredentials(e={}){let r=(0,Dn.createListQueryParams)(e);e.systemId!==void 0&&r.set("systemId",e.systemId);let n=r.size>0?`?${r.toString()}`:"";return this.restRequest("GET",`/v1/credentials${n}`)}async listAllCredentials(e={}){return(0,Dn.listAllPages)((r,n)=>this.listCredentials({...e,page:r,limit:n}))}async createCredentials(e){return(await this.restRequest("POST","/v1/credentials",e)).data}async replaceCredentials(e,r){return(await this.restRequest("PUT",`/v1/credentials/${encodeURIComponent(e)}`,{credentials:r})).data}async updateCredentials(e,r){return(await this.restRequest("PATCH",`/v1/credentials/${encodeURIComponent(e)}`,r)).data}async deleteCredentials(e){await this.restRequest("DELETE",`/v1/credentials/${encodeURIComponent(e)}`)}async setDefaultCredentials(e){await this.restRequest("POST",`/v1/credentials/${encodeURIComponent(e)}/default`)}async listSystems(e={}){let r=(0,Dn.createListQueryParams)(e),n=r.size>0?`?${r.toString()}`:"";return this.restRequest("GET",`/v1/systems${n}`)}async listAllSystems(e={}){return(0,Dn.listAllPages)((r,n)=>this.listSystems({...e,page:r,limit:n}))}async getSystem(e){return(await this.restRequest("GET",`/v1/systems/${encodeURIComponent(e)}`)).data}async createSystem(e){return(await this.restRequest("POST","/v1/systems",e)).data}async updateSystem(e,r){return(await this.restRequest("PATCH",`/v1/systems/${encodeURIComponent(e)}`,r)).data}async deleteSystem(e){return await this.restRequest("DELETE",`/v1/systems/${encodeURIComponent(e)}`),!0}async bulkDeleteSystems(e){return this.restRequest("POST","/v1/systems/bulk/delete",{ids:e})}async listManagedOAuthTemplateIds(){return(await this.restRequest("GET","/v1/oauth2/managed-apps")).data.templateIds}async createOAuthExchange(e){return(await this.restRequest("POST","/v1/oauth/exchanges",e)).data}async completeOAuthExchange(e,r){return(await this.restRequest("POST",`/v1/oauth/exchanges/${encodeURIComponent(e)}/complete`,r)).data}async searchSystemDocumentation(e,r){return(await this.restRequest("POST",`/v1/systems/${encodeURIComponent(e)}/documentation/search`,{keywords:r})).data}async triggerSystemDocumentationScrapeJob(e,r){return(await this.restRequest("POST",`/v1/systems/${encodeURIComponent(e)}/documentation/scrape`,r)).data}async fetchOpenApiSpec(e,r,n){return(await this.restRequest("POST",`/v1/systems/${encodeURIComponent(e)}/documentation/openapi`,{url:r,link:n?.link})).data}async uploadSystemDocumentationFiles(e,r,n){let i=await this.uploadFiles(r,{process:!0}),o=i.flatMap(s=>s.status==="uploaded"?[s.id]:[]);if(o.length>0)try{await this.restRequest("POST",`/v1/systems/${encodeURIComponent(e)}/documentation/files`,{fileIds:o,link:n?.link!==!1})}catch(s){throw await Promise.all(o.map(a=>this.deleteFileUpload(a).catch(()=>{}))),s}if(!n?.settle){let s=i.filter(a=>a.status==="failed");if(s.length>0)throw new Error(s.map(a=>a.error).join("; "))}return i}async listSystemDocumentationFiles(e,r){let n=new URLSearchParams;r?.length&&n.set("fileIds",r.join(","));let i=n.size>0?`?${n.toString()}`:"";return(await this.restRequest("GET",`/v1/systems/${encodeURIComponent(e)}/documentation/files${i}`)).data}async getSystemDocumentationFileContent(e,r,n){return(await this.restRequest("GET",`/v1/systems/${encodeURIComponent(e)}/documentation/files/${encodeURIComponent(r)}/content?processed=${n.processed}`)).data}async deleteSystemDocumentationFile(e,r){await this.restRequest("DELETE",`/v1/systems/${encodeURIComponent(e)}/documentation/files/${encodeURIComponent(r)}`)}async generateCredentialsLink(e){try{return{success:!0,credentialsUrl:(await this.restRequest("POST","/v1/authenticate",e||{})).data.credentialsUrl}}catch(r){return{success:!1,error:r.message}}}};Ju.SuperglueClient=xv});var bG=m(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.UnquotedKeyStrategy=at.TripleQuoteStrategy=at.TrailingCommaStrategy=at.SingleQuoteStrategy=at.PythonLiteralStrategy=at.CommentStrategy=at.ResilientJsonParser=at.RepairStrategy=void 0;at.parseJsonResilient=tke;at.parseJSON=rke;at.isValidJson=nke;at.prettyPrintJson=ike;at.minifyJson=oke;var Yn=class{validate(e){try{return JSON.parse(e),!0}catch{return!1}}};at.RepairStrategy=Yn;var By=class extends Yn{constructor(){super(...arguments),this.name="TripleQuoteRepair",this.description="Converts triple-quoted strings to proper JSON, parsing nested JSON content"}canApply(e){return/"""/.test(e)}apply(e){return e.replace(/"""([\s\S]*?)"""/g,(r,n)=>{let i=n.trim();if(i.startsWith("{")&&i.endsWith("}")||i.startsWith("[")&&i.endsWith("]"))try{let s=JSON.parse(i);return JSON.stringify(s)}catch{return`"${n.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}"`}return`"${n.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}"`})}};at.TripleQuoteStrategy=By;var Qy=class extends Yn{constructor(){super(...arguments),this.name="PythonLiteralRepair",this.description="Converts Python literals to JavaScript equivalents"}canApply(e){return/\b(None|True|False)\b/.test(e)}apply(e){return e.replace(/\bNone\b/g,"null").replace(/\bTrue\b/g,"true").replace(/\bFalse\b/g,"false")}};at.PythonLiteralStrategy=Qy;var vy=class extends Yn{constructor(){super(...arguments),this.name="TrailingCommaRepair",this.description="Removes trailing commas from objects and arrays"}canApply(e){return/,\s*[}\]]/.test(e)}apply(e){return e.replace(/,(\s*[}\]])/g,"$1")}};at.TrailingCommaStrategy=vy;var _y=class extends Yn{constructor(){super(...arguments),this.name="SingleQuoteRepair",this.description="Converts single quotes to double quotes"}canApply(e){return/[{,]\s*'[^']*'\s*:/.test(e)||/:\s*'[^']*'/.test(e)}apply(e){let r=e.replace(/([{,]\s*)'([^']+)'(\s*:)/g,'$1"$2"$3');return r=r.replace(/(:\s*)'([^']+)'(\s*[,}])/g,'$1"$2"$3'),r}};at.SingleQuoteStrategy=_y;var Dy=class extends Yn{constructor(){super(...arguments),this.name="UnquotedKeyRepair",this.description="Adds quotes to unquoted object keys"}canApply(e){return/[{,]\s*[a-zA-Z_$][a-zA-Z0-9_$]*\s*:/.test(e)}apply(e){return e.replace(/([{,]\s*)([a-zA-Z_$][a-zA-Z0-9_$]*)(\s*:)/g,'$1"$2"$3')}};at.UnquotedKeyStrategy=Dy;var Ty=class extends Yn{constructor(){super(...arguments),this.name="CommentRemoval",this.description="Removes JavaScript-style comments"}canApply(e){return/\/\/.*$|\/\*[\s\S]*?\*\//m.test(e)}apply(e){let r=e.replace(/\/\/.*$/gm,"");return r=r.replace(/\/\*[\s\S]*?\*\//g,""),r}};at.CommentStrategy=Ty;var Lv=class extends Yn{constructor(){super(...arguments),this.name="UnescapedControlCharactersRepair",this.description="Escapes unescaped control characters (newlines, tabs, etc.) in JSON strings"}canApply(e){try{return JSON.parse(e),!1}catch(r){let n=r.message||"";return n.includes("control character")||n.includes("Bad control")||n.includes("Unexpected token")&&/[\n\r\t]/.test(e)}}apply(e){let r="",n=!1,i=!1;for(let o=0;o<e.length;o++){let s=e[o],a=o>0?e[o-1]:"";if(i){r+=s,i=!1;continue}if(s==="\\"&&n){r+=s,i=!0;continue}if(s==='"'&&a!=="\\"){n=!n,r+=s;continue}if(n)switch(s){case`
|
|
1771
|
+
${o}`:i.stack}V.exports.fetch=function(e,r=void 0){return kRe(e,r).catch(n=>{throw pG?mG(n,pG):n&&typeof n=="object"&&Error.captureStackTrace(n,V.exports.fetch),n})};V.exports.Headers=oc().Headers;V.exports.Response=RA().Response;V.exports.Request=Uu().Request;V.exports.FormData=zg().FormData;var{setGlobalOrigin:NRe,getGlobalOrigin:ORe}=ZS();V.exports.setGlobalOrigin=NRe;V.exports.getGlobalOrigin=ORe;var{CacheStorage:URe}=tH(),{kConstruct:MRe}=$e();V.exports.caches=new URe(MRe);var{deleteCookie:xRe,getCookies:LRe,getSetCookies:PRe,setCookie:FRe,parseCookie:$Re}=pH();V.exports.deleteCookie=xRe;V.exports.getCookies=LRe;V.exports.getSetCookies=PRe;V.exports.setCookie=FRe;V.exports.parseCookie=$Re;var{parseMIMEType:jRe,serializeAMimeType:qRe}=In();V.exports.parseMIMEType=jRe;V.exports.serializeAMimeType=qRe;var{CloseEvent:zRe,ErrorEvent:HRe,MessageEvent:GRe}=uy(),{WebSocket:YRe,ping:VRe}=GH();V.exports.WebSocket=YRe;V.exports.CloseEvent=zRe;V.exports.ErrorEvent=HRe;V.exports.MessageEvent=GRe;V.exports.ping=VRe;V.exports.WebSocketStream=eG().WebSocketStream;V.exports.WebSocketError=Rv().WebSocketError;V.exports.request=qA(Yu.request);V.exports.stream=qA(Yu.stream);V.exports.pipeline=qA(Yu.pipeline);V.exports.connect=qA(Yu.connect);V.exports.upgrade=qA(Yu.upgrade);V.exports.MockClient=IRe;V.exports.MockCallHistory=CRe;V.exports.MockCallHistoryLog=bRe;V.exports.MockPool=wRe;V.exports.MockAgent=SRe;V.exports.SnapshotAgent=BRe;V.exports.mockErrors=QRe;var{EventSource:JRe}=AG();V.exports.EventSource=JRe;function WRe(){globalThis.fetch=V.exports.fetch,globalThis.Headers=V.exports.Headers,globalThis.Response=V.exports.Response,globalThis.Request=V.exports.Request,globalThis.FormData=V.exports.FormData,globalThis.WebSocket=V.exports.WebSocket,globalThis.CloseEvent=V.exports.CloseEvent,globalThis.ErrorEvent=V.exports.ErrorEvent,globalThis.MessageEvent=V.exports.MessageEvent,globalThis.EventSource=V.exports.EventSource}V.exports.install=WRe});var IG=m(Ju=>{"use strict";Object.defineProperty(Ju,"__esModule",{value:!0});Ju.SuperglueClient=Ju.SuperglueHttpError=void 0;var Vu=dr(),Dn=mb(),ZRe=Yb(),KRe=RL(),XRe=ln(),Vo=Lc(),eke=Xl(),HA=14400*1e3,zA;if(typeof globalThis.process<"u"&&globalThis.process.versions?.node)try{let{Agent:t}=yG();zA=new t({headersTimeout:HA,bodyTimeout:HA})}catch{}function EG(t){if(t?.aborted)throw t.reason??new DOMException("Aborted","AbortError")}var wy=class extends Error{constructor(e,r,n,i){super(e),this.status=r,this.code=n,this.details=i,this.name="SuperglueHttpError"}};Ju.SuperglueHttpError=wy;var xv=class{constructor({apiKey:e,apiEndpoint:r,onInfrastructureError:n,refreshToken:i,sseTokenProvider:o,tokenProvider:s}){if(!e&&!s)throw new Error("SuperglueClient requires either apiKey or tokenProvider");this.tokenProvider=s??(async()=>e),this.apiEndpoint=r??"https://api.superglue.cloud",this.sseManager=new ZRe.SSELogSubscriptionManager(this.apiEndpoint,o??this.tokenProvider,i),this.onInfrastructureError=n,this.refreshToken=i}async getApiKey(){return this.tokenProvider()}async fetchWithAuthRetry(e,r){let n=await this.getApiKey(),i=await e(n);if(i.status!==401||!this.refreshToken)return i;EG(r);let o=await this.refreshToken();return EG(r),!o||o===n?i:(i.body?.cancel(),e(o))}isInfrastructureError(e){return(0,XRe.isAbortError)(e)?!1:!!(e instanceof TypeError&&e.message.toLowerCase().includes("fetch")||e instanceof Error&&e.name==="TimeoutError")}async restRequest(e,r,n,i,o){let a=await(await this.restResponse({method:e,path:r,body:n,extraHeaders:i,requestInit:o})).text();if(a)return JSON.parse(a)}async restResponse({method:e,path:r,body:n,extraHeaders:i,requestInit:o}){let s=`${this.apiEndpoint.replace(/\/$/,"")}${r}`,a=n!=null,c=typeof FormData<"u"&&n instanceof FormData,u=d=>{let A={Authorization:`Bearer ${d}`,...i};return a&&!c&&e!=="GET"&&(A["Content-Type"]="application/json"),fetch(s,{...o,method:e,headers:A,body:a?c?n:JSON.stringify(n):void 0,signal:o?.signal??AbortSignal.timeout(HA),...zA?{dispatcher:zA}:{}})},l;try{l=await this.fetchWithAuthRetry(u,o?.signal)}catch(d){throw this.isInfrastructureError(d)&&this.onInfrastructureError?.(),d}if(!l.ok)throw await this.buildHttpError(l);return l}async uploadFiles(e,r){if(typeof r?.process!="boolean")throw new Error("process must be a boolean");if(e.length===0)return[];let n=e.map(l=>({...l,contentLength:l.contentLength??this.getUploadContentLength(l.content)})),o=(await this.restRequest("POST","/v1/files/uploads",{process:r.process,...r.allowUnprocessed?{allowUnprocessed:!0}:{},files:n.map(({fileName:l,contentType:d,contentLength:A})=>({fileName:l,contentLength:A,...d?{contentType:d}:{}}))})).data.files;if(o.length!==n.length)throw await Promise.all(o.map(l=>this.deleteFileUpload(l.id).catch(()=>{}))),new Error("Upload response did not match the selected files");let s=await Promise.allSettled(o.map(async(l,d)=>{let A=n[d],p=await fetch(l.uploadUrl,{method:"PUT",body:A.content,headers:A.contentType?{"Content-Type":A.contentType}:void 0,signal:AbortSignal.timeout(Math.min(HA,l.expiresIn*1e3))});if(!p.ok)throw new Error(`Upload failed for ${A.fileName}: ${p.status} ${p.statusText}`);return l.id})),a=s.flatMap(l=>l.status==="fulfilled"?[l.value]:[]),c=new Map;if(a.length>0)try{let l=await this.restRequest("POST","/v1/files/uploads/complete",{fileIds:a});c=new Map(l.data.files.map(d=>[d.id,d]))}catch(l){c=new Map(a.map(d=>[d,{id:d,fileName:n[o.findIndex(A=>A.id===d)]?.fileName||d,contentLength:n[o.findIndex(A=>A.id===d)]?.contentLength||0,status:"failed",error:l instanceof Error?l.message:String(l)}]))}let u=o.map((l,d)=>{let A=s[d],p=n[d];return A.status==="rejected"?{id:l.id,fileName:p.fileName,contentLength:p.contentLength,status:"failed",error:A.reason instanceof Error?A.reason.message:String(A.reason)}:c.get(l.id)||{id:l.id,fileName:p.fileName,contentLength:p.contentLength,status:"failed",error:"Upload completion returned no result"}});return await Promise.all(u.filter(l=>l.status==="failed").map(l=>this.deleteFileUpload(l.id).catch(()=>{}))),u}async deleteFileUpload(e){await this.restRequest("DELETE",`/v1/files/uploads/${encodeURIComponent(e)}`)}getUploadContentLength(e){return typeof e=="string"?new TextEncoder().encode(e).byteLength:e instanceof Uint8Array?e.byteLength:e.size}async buildHttpError(e){e.status>=500&&this.onInfrastructureError?.();let r=await e.text(),n=`HTTP ${e.status}: ${r}`,i,o;try{let s=JSON.parse(r);s&&typeof s=="object"&&!Array.isArray(s)&&(o=s),typeof s?.code=="string"&&(i=s.code);let a=s.error;typeof a=="string"?n=a:a&&typeof a=="object"&&(n=a.message||JSON.stringify(a))}catch{}return new wy(n,e.status,i,o)}async streamRequest(e,r,n){let i=e.includes("?")?"&":"?",o=`${this.apiEndpoint.replace(/\/$/,"")}${e}${i}stream=true`,s=u=>fetch(o,{method:"POST",headers:{Authorization:`Bearer ${u}`,Accept:"text/event-stream","Content-Type":"application/json"},body:JSON.stringify(r),signal:n??AbortSignal.timeout(HA),...zA?{dispatcher:zA}:{}}),a;try{a=await this.fetchWithAuthRetry(s,n)}catch(u){throw this.isInfrastructureError(u)&&this.onInfrastructureError?.(),u}if(!a.ok)throw await this.buildHttpError(a);if(!(a.headers.get("content-type")||"").includes("text/event-stream")){let u=await a.text();return u?JSON.parse(u):void 0}try{return await(0,KRe.consumeEventStreamResult)(a)}catch(u){throw this.isInfrastructureError(u)&&this.onInfrastructureError?.(),u}}async subscribeToLogsSSE(e={}){return this.sseManager.subscribeToLogs(e)}async disconnect(){await this.sseManager.disconnect()}async listMemoryNotes(e={}){let r=new URLSearchParams;e.scope&&r.set("scope",e.scope),e.query&&r.set("query",e.query);let n=r.toString();return(await this.restRequest("GET",`/v1/memory-notes${n?`?${n}`:""}`)).data}async createMemoryNote(e){return(await this.restRequest("POST","/v1/memory-notes",e)).data}async updateMemoryNote(e,r){return(await this.restRequest("PATCH",`/v1/memory-notes/${encodeURIComponent(e)}`,r)).data}async deleteMemoryNote(e){await this.restRequest("DELETE",`/v1/memory-notes/${encodeURIComponent(e)}`)}async clearMemoryNotes(e){return(await this.restRequest("DELETE",`/v1/memory-notes?scope=${e}`)).data.deleted}async getMe(){return this.restRequest("GET","/v1/me")}async completeOnboarding(){return this.restRequest("POST","/v1/me/onboarding/complete")}async runTool(e){let r=await this.restRequest("POST",`/v1/tools/${encodeURIComponent(e.toolId)}/run`,{inputs:e.payload,files:e.files,credentials:e.credentials,includeStepResultData:e.includeStepResultData,options:e.options,runId:e.runId,stateFixture:e.stateFixture},void 0,e.signal?{signal:e.signal}:void 0);return{success:r.status==="success",data:r.data,error:r.error,tool:r.tool,stepResults:r.stepResults?.map(n=>({...n}))||[],...r.fileArtifacts&&r.fileArtifacts.length>0?{fileArtifacts:r.fileArtifacts}:{},...r.metadata?.warnings?.length?{warnings:r.metadata.warnings}:{}}}async runToolConfig(e){let r=e.createRun?"/v1/tools/run?createRun=true":"/v1/tools/run",n=await this.restRequest("POST",r,{tool:e.tool,payload:e.payload,files:e.files,credentials:e.credentials,includeStepResultData:e.includeStepResultData,options:e.options,runId:e.runId,stateFixture:e.stateFixture,executionKind:e.executionKind,parentToolId:e.parentToolId,draftId:e.draftId},e.traceId?{"X-Trace-Id":e.traceId}:void 0,e.signal?{signal:e.signal}:void 0);return{success:n.status?n.status==="success":n.success??!1,data:n.data,error:n.error,tool:n.tool||e.tool,stepResults:n.stepResults?.map(o=>({...o}))||[],...n.fileArtifacts&&n.fileArtifacts.length>0?{fileArtifacts:n.fileArtifacts}:{},...n.metadata?.warnings?.length?{warnings:n.metadata.warnings}:{}}}async abortToolExecution(e){return{success:!0,runId:(await this.restRequest("POST",`/v1/runs/${encodeURIComponent(e)}/cancel`)).runId}}async executeStep({step:e,payload:r,files:n,previousResults:i,credentials:o,options:s,runId:a,systemIds:c,credentialId:u,systemAuth:l,createRun:d,parentToolId:A,stepIndex:p,stepId:h,signal:g,stream:S}){let B={step:e,payload:r,files:n,previousResults:i,credentials:o,options:s,runId:a,systemIds:c,credentialId:u,systemAuth:l,createRun:d,parentToolId:A,stepIndex:p,stepId:h};return S?this.streamRequest("/v1/tools/step/run",B,g):this.restRequest("POST","/v1/tools/step/run",B,void 0,g?{signal:g}:void 0)}async abortStep(e){return this.restRequest("POST","/v1/tools/step/abort",{runId:e})}async executeTransformOnly({outputTransform:e,outputSchema:r,inputSchema:n,payload:i,files:o,stepResults:s,options:a,runId:c,createRun:u,parentToolId:l,stepId:d,signal:A,stream:p}){let h={outputTransform:e,outputSchema:r,inputSchema:n,payload:i,files:o,stepResults:s,options:a,runId:c,createRun:u,parentToolId:l,stepId:d};return p?this.streamRequest("/v1/tools/transform/run",h,A):this.restRequest("POST","/v1/tools/transform/run",h,void 0,A?{signal:A}:void 0)}async createRun({toolId:e,toolConfig:r,toolResult:n,stepResults:i,toolPayload:o,status:s,error:a,startedAt:c,completedAt:u,executionKind:l,parentToolId:d,draftId:A}){return this.restRequest("POST","/v1/runs",{toolId:e,toolConfig:r,toolResult:n,stepResults:i,toolPayload:o,status:s,error:a,startedAt:(0,Vo.toUTCISOString)(c,"run.startedAt"),completedAt:(0,Vo.toUTCISOString)(u,"run.completedAt"),executionKind:l,parentToolId:d,draftId:A})}async checkRunLimit(){return(await this.restRequest("POST","/v1/runs/check-limit")).data}async extract({file:e,envelope:r}){if(!e)throw new Error("File must be provided for extract.");let n=new FormData;n.append("file",e);let i=r?"/v1/extract?envelope=true":"/v1/extract";return this.restRequest("POST",i,n)}mapOpenAPIRunToRun(e){let r={running:Vu.RunStatus.RUNNING,success:Vu.RunStatus.SUCCESS,failed:Vu.RunStatus.FAILED,aborted:Vu.RunStatus.ABORTED};return{runId:e.runId??e.id,toolId:e.toolId,tool:e.tool,systemIds:e.systemIds,status:r[e.status]??Vu.RunStatus.FAILED,toolPayload:e.toolPayload,data:e.data,toolResult:e.data,error:e.error,stepResults:e.stepResults,options:e.options,requestSource:e.requestSource,traceId:e.traceId,resultStorageUri:e.resultStorageUri,userId:e.userId,userEmail:e.userEmail,userName:e.userName,metadata:{...e.metadata,executionKind:e.metadata?.executionKind??Vu.RunExecutionKind.FULL},fileArtifacts:e.fileArtifacts}}mapOpenAPIScheduleToToolSchedule(e){return{...e,lastRunAt:e.lastRunAt?(0,Vo.requireUTCDate)(e.lastRunAt,"schedule.lastRunAt"):void 0,nextRunAt:(0,Vo.requireUTCDate)(e.nextRunAt,"schedule.nextRunAt"),createdAt:(0,Vo.requireUTCDate)(e.createdAt,"schedule.createdAt"),updatedAt:(0,Vo.requireUTCDate)(e.updatedAt,"schedule.updatedAt")}}async listRuns(e={}){let r=(0,Dn.createSearchListQueryParams)(e);e.toolId!==void 0&&r.set("toolId",e.toolId),e.searchUserIds?.length&&r.set("searchUserIds",e.searchUserIds.join(",")),e.includeTotal!==void 0&&r.set("includeTotal",String(e.includeTotal)),e.startedAfter!==void 0&&r.set("startedAfter",e.startedAfter instanceof Date?(0,Vo.toUTCISOString)(e.startedAfter,"run.startedAfter"):e.startedAfter),e.statuses!==void 0?r.set("status",e.statuses.join(",")):e.status!==void 0&&r.set("status",e.status),e.requestSources!==void 0&&r.set("requestSources",e.requestSources.join(",")),e.executionKinds!==void 0&&r.set("executionKinds",e.executionKinds.join(",")),e.userId!==void 0&&r.set("userId",e.userId),e.systemId!==void 0&&r.set("systemId",e.systemId),e.systemIds!==void 0&&r.set("systemIds",e.systemIds.join(","));let n=r.size>0?`?${r.toString()}`:"",i=await this.restRequest("GET",`/v1/runs${n}`,void 0,void 0,{signal:e.signal});return{data:i.data.map(o=>this.mapOpenAPIRunToRun(o)),total:i.total,page:i.page,limit:i.limit,hasMore:i.hasMore}}async getActivityCounts(e){let r=new URLSearchParams;e?.from&&r.set("from",e.from instanceof Date?(0,Vo.toUTCISOString)(e.from,"activity.from"):e.from),e?.to&&r.set("to",e.to instanceof Date?(0,Vo.toUTCISOString)(e.to,"activity.to"):e.to);let n=r.toString();return(await this.restRequest("GET",`/v1/activity/counts${n?`?${n}`:""}`,void 0,void 0,{signal:e?.signal})).counts}async getRun(e){try{let r=await this.restRequest("GET",`/v1/runs/${encodeURIComponent(e)}`);return this.mapOpenAPIRunToRun(r)}catch(r){if(r.message?.includes("404")||r.message?.includes("not found"))return null;throw r}}async getTool(e){try{return await this.restRequest("GET",`/v1/tools/${encodeURIComponent(e)}`)}catch(r){if(r.message?.includes("404")||r.message?.includes("not found")||r.message?.includes("403")||r.message?.includes("not allowed"))return null;throw r}}async getToolState(e){return(await this.restRequest("GET",`/v1/tools/${encodeURIComponent(e)}/state`)).state}async setToolState(e,r){await this.restRequest("PUT",`/v1/tools/${encodeURIComponent(e)}/state`,{state:r})}async deleteToolState(e){return(await this.restRequest("DELETE",`/v1/tools/${encodeURIComponent(e)}/state`)).deletedKeys}async archiveTool(e,r=!0){return this.updateTool(e,{archived:r})}async bulkArchiveTools(e,r=!0){return this.restRequest("POST","/v1/tools/bulk/archive",{ids:e,archived:r})}async bulkDeleteTools(e){return this.restRequest("POST","/v1/tools/bulk/delete",{ids:e})}async listTools(e={}){let r=(0,Dn.createListQueryParams)(e);e.includeArchived!==void 0&&r.set("includeArchived",String(e.includeArchived));let n=r.size>0?`?${r.toString()}`:"";return this.restRequest("GET",`/v1/tools${n}`)}async listAllTools(e={}){return(0,Dn.listAllPages)((r,n)=>this.listTools({...e,page:r,limit:n}))}async createTool(e,r){return this.restRequest("POST","/v1/tools",{...r,id:e})}async updateTool(e,r){return this.restRequest("PUT",`/v1/tools/${encodeURIComponent(e)}`,r)}async deleteTool(e){try{return await this.restRequest("DELETE",`/v1/tools/${encodeURIComponent(e)}`),!0}catch(r){if(r.message?.includes("404"))return!1;throw r}}async renameTool(e,r){return this.restRequest("POST",`/v1/tools/${encodeURIComponent(e)}/rename`,{newId:r})}async getWorkflow(e){return this.getTool(e)}async archiveWorkflow(e,r=!0){return this.upsertWorkflow(e,{archived:r})}async createWorkflow(e,r){return this.createTool(e,r)}async updateWorkflow(e,r){return this.updateTool(e,r)}async upsertWorkflow(e,r){return await this.getTool(e)?this.updateTool(e,r):this.createTool(e,r)}async deleteWorkflow(e){return this.deleteTool(e)}async renameWorkflow(e,r){return this.renameTool(e,r)}async listProjectSummaries(e={}){let r=(0,Dn.createSearchListQueryParams)(e);return r.set("includeResources","false"),e.includeArchived!==void 0&&r.set("includeArchived",String(e.includeArchived)),this.restRequest("GET",`/v1/projects?${r.toString()}`)}async listAllProjectSummaries({includeArchived:e}={}){return(0,Dn.listAllPages)((r,n)=>this.listProjectSummaries({page:r,limit:n,...e!==void 0?{includeArchived:e}:{}}))}async listAllProjectTasks(e){return(0,Dn.listAllPages)((r,n)=>this.restRequest("GET",`/v1/projects/${encodeURIComponent(e)}/tasks?page=${r}&limit=${n}`))}async saveProjectTask({projectId:e,taskId:r,input:n}){let i=`/v1/projects/${encodeURIComponent(e)}/tasks${r?`/${encodeURIComponent(r)}`:""}`;return(await this.restRequest(r?"PATCH":"POST",i,n)).data}async listSchedules(e={}){let r=(0,Dn.createListQueryParams)(e),n=r.size>0?`?${r.toString()}`:"",i=e.toolId?`/v1/tools/${encodeURIComponent(e.toolId)}/schedules${n}`:`/v1/schedules${n}`,o=await this.restRequest("GET",i);return{...o,data:o.data.map(s=>this.mapOpenAPIScheduleToToolSchedule(s))}}async listAllSchedules(e={}){return(0,Dn.listAllPages)((r,n)=>this.listSchedules({...e,page:r,limit:n}))}async getToolSchedule(e,r){try{let n=await this.restRequest("GET",`/v1/tools/${encodeURIComponent(e)}/schedules/${encodeURIComponent(r)}`);return this.mapOpenAPIScheduleToToolSchedule(n)}catch(n){if(n.message?.includes("404")||n.message?.includes("not found"))return null;throw n}}async createToolSchedule(e,r){let n=await this.restRequest("POST",`/v1/tools/${encodeURIComponent(e)}/schedules`,{...r,timezone:r.timezone||(0,eke.getRuntimeTimezone)()});return this.mapOpenAPIScheduleToToolSchedule(n)}async updateToolSchedule(e,r,n){let i=await this.restRequest("PUT",`/v1/tools/${encodeURIComponent(e)}/schedules/${encodeURIComponent(r)}`,n);return this.mapOpenAPIScheduleToToolSchedule(i)}async deleteToolSchedule(e,r){return await this.restRequest("DELETE",`/v1/tools/${encodeURIComponent(e)}/schedules/${encodeURIComponent(r)}`),!0}async bulkSetSchedulesEnabled(e,r){return this.restRequest("POST","/v1/schedules/bulk/enable",{ids:e,enabled:r})}async bulkDeleteSchedules(e){return this.restRequest("POST","/v1/schedules/bulk/delete",{ids:e})}async listCredentials(e={}){let r=(0,Dn.createListQueryParams)(e);e.systemId!==void 0&&r.set("systemId",e.systemId);let n=r.size>0?`?${r.toString()}`:"";return this.restRequest("GET",`/v1/credentials${n}`)}async listAllCredentials(e={}){return(0,Dn.listAllPages)((r,n)=>this.listCredentials({...e,page:r,limit:n}))}async createCredentials(e){return(await this.restRequest("POST","/v1/credentials",e)).data}async replaceCredentials(e,r){return(await this.restRequest("PUT",`/v1/credentials/${encodeURIComponent(e)}`,{credentials:r})).data}async updateCredentials(e,r){return(await this.restRequest("PATCH",`/v1/credentials/${encodeURIComponent(e)}`,r)).data}async deleteCredentials(e){await this.restRequest("DELETE",`/v1/credentials/${encodeURIComponent(e)}`)}async setDefaultCredentials(e){await this.restRequest("POST",`/v1/credentials/${encodeURIComponent(e)}/default`)}async listSystems(e={}){let r=(0,Dn.createListQueryParams)(e),n=r.size>0?`?${r.toString()}`:"";return this.restRequest("GET",`/v1/systems${n}`)}async listAllSystems(e={}){return(0,Dn.listAllPages)((r,n)=>this.listSystems({...e,page:r,limit:n}))}async getSystem(e){return(await this.restRequest("GET",`/v1/systems/${encodeURIComponent(e)}`)).data}async createSystem(e){return(await this.restRequest("POST","/v1/systems",e)).data}async updateSystem(e,r){return(await this.restRequest("PATCH",`/v1/systems/${encodeURIComponent(e)}`,r)).data}async deleteSystem(e){return await this.restRequest("DELETE",`/v1/systems/${encodeURIComponent(e)}`),!0}async bulkDeleteSystems(e){return this.restRequest("POST","/v1/systems/bulk/delete",{ids:e})}async listManagedOAuthTemplateIds(){return(await this.restRequest("GET","/v1/oauth2/managed-apps")).data.templateIds}async createOAuthExchange(e){return(await this.restRequest("POST","/v1/oauth/exchanges",e)).data}async completeOAuthExchange(e,r){return(await this.restRequest("POST",`/v1/oauth/exchanges/${encodeURIComponent(e)}/complete`,r)).data}async searchSystemDocumentation(e,r){return(await this.restRequest("POST",`/v1/systems/${encodeURIComponent(e)}/documentation/search`,{keywords:r})).data}async triggerSystemDocumentationScrapeJob(e,r){return(await this.restRequest("POST",`/v1/systems/${encodeURIComponent(e)}/documentation/scrape`,r)).data}async fetchOpenApiSpec(e,r,n){return(await this.restRequest("POST",`/v1/systems/${encodeURIComponent(e)}/documentation/openapi`,{url:r,link:n?.link})).data}async uploadSystemDocumentationFiles(e,r,n){let i=await this.uploadFiles(r,{process:!0}),o=i.flatMap(s=>s.status==="uploaded"?[s.id]:[]);if(o.length>0)try{await this.restRequest("POST",`/v1/systems/${encodeURIComponent(e)}/documentation/files`,{fileIds:o,link:n?.link!==!1})}catch(s){throw await Promise.all(o.map(a=>this.deleteFileUpload(a).catch(()=>{}))),s}if(!n?.settle){let s=i.filter(a=>a.status==="failed");if(s.length>0)throw new Error(s.map(a=>a.error).join("; "))}return i}async listSystemDocumentationFiles(e,r){let n=new URLSearchParams;r?.length&&n.set("fileIds",r.join(","));let i=n.size>0?`?${n.toString()}`:"";return(await this.restRequest("GET",`/v1/systems/${encodeURIComponent(e)}/documentation/files${i}`)).data}async getSystemDocumentationFileContent(e,r,n){return(await this.restRequest("GET",`/v1/systems/${encodeURIComponent(e)}/documentation/files/${encodeURIComponent(r)}/content?processed=${n.processed}`)).data}async deleteSystemDocumentationFile(e,r){await this.restRequest("DELETE",`/v1/systems/${encodeURIComponent(e)}/documentation/files/${encodeURIComponent(r)}`)}async generateCredentialsLink(e){try{return{success:!0,credentialsUrl:(await this.restRequest("POST","/v1/authenticate",e||{})).data.credentialsUrl}}catch(r){return{success:!1,error:r.message}}}};Ju.SuperglueClient=xv});var bG=m(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.UnquotedKeyStrategy=at.TripleQuoteStrategy=at.TrailingCommaStrategy=at.SingleQuoteStrategy=at.PythonLiteralStrategy=at.CommentStrategy=at.ResilientJsonParser=at.RepairStrategy=void 0;at.parseJsonResilient=tke;at.parseJSON=rke;at.isValidJson=nke;at.prettyPrintJson=ike;at.minifyJson=oke;var Yn=class{validate(e){try{return JSON.parse(e),!0}catch{return!1}}};at.RepairStrategy=Yn;var By=class extends Yn{constructor(){super(...arguments),this.name="TripleQuoteRepair",this.description="Converts triple-quoted strings to proper JSON, parsing nested JSON content"}canApply(e){return/"""/.test(e)}apply(e){return e.replace(/"""([\s\S]*?)"""/g,(r,n)=>{let i=n.trim();if(i.startsWith("{")&&i.endsWith("}")||i.startsWith("[")&&i.endsWith("]"))try{let s=JSON.parse(i);return JSON.stringify(s)}catch{return`"${n.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}"`}return`"${n.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}"`})}};at.TripleQuoteStrategy=By;var Qy=class extends Yn{constructor(){super(...arguments),this.name="PythonLiteralRepair",this.description="Converts Python literals to JavaScript equivalents"}canApply(e){return/\b(None|True|False)\b/.test(e)}apply(e){return e.replace(/\bNone\b/g,"null").replace(/\bTrue\b/g,"true").replace(/\bFalse\b/g,"false")}};at.PythonLiteralStrategy=Qy;var vy=class extends Yn{constructor(){super(...arguments),this.name="TrailingCommaRepair",this.description="Removes trailing commas from objects and arrays"}canApply(e){return/,\s*[}\]]/.test(e)}apply(e){return e.replace(/,(\s*[}\]])/g,"$1")}};at.TrailingCommaStrategy=vy;var _y=class extends Yn{constructor(){super(...arguments),this.name="SingleQuoteRepair",this.description="Converts single quotes to double quotes"}canApply(e){return/[{,]\s*'[^']*'\s*:/.test(e)||/:\s*'[^']*'/.test(e)}apply(e){let r=e.replace(/([{,]\s*)'([^']+)'(\s*:)/g,'$1"$2"$3');return r=r.replace(/(:\s*)'([^']+)'(\s*[,}])/g,'$1"$2"$3'),r}};at.SingleQuoteStrategy=_y;var Dy=class extends Yn{constructor(){super(...arguments),this.name="UnquotedKeyRepair",this.description="Adds quotes to unquoted object keys"}canApply(e){return/[{,]\s*[a-zA-Z_$][a-zA-Z0-9_$]*\s*:/.test(e)}apply(e){return e.replace(/([{,]\s*)([a-zA-Z_$][a-zA-Z0-9_$]*)(\s*:)/g,'$1"$2"$3')}};at.UnquotedKeyStrategy=Dy;var Ty=class extends Yn{constructor(){super(...arguments),this.name="CommentRemoval",this.description="Removes JavaScript-style comments"}canApply(e){return/\/\/.*$|\/\*[\s\S]*?\*\//m.test(e)}apply(e){let r=e.replace(/\/\/.*$/gm,"");return r=r.replace(/\/\*[\s\S]*?\*\//g,""),r}};at.CommentStrategy=Ty;var Lv=class extends Yn{constructor(){super(...arguments),this.name="UnescapedControlCharactersRepair",this.description="Escapes unescaped control characters (newlines, tabs, etc.) in JSON strings"}canApply(e){try{return JSON.parse(e),!1}catch(r){let n=r.message||"";return n.includes("control character")||n.includes("Bad control")||n.includes("Unexpected token")&&/[\n\r\t]/.test(e)}}apply(e){let r="",n=!1,i=!1;for(let o=0;o<e.length;o++){let s=e[o],a=o>0?e[o-1]:"";if(i){r+=s,i=!1;continue}if(s==="\\"&&n){r+=s,i=!0;continue}if(s==='"'&&a!=="\\"){n=!n,r+=s;continue}if(n)switch(s){case`
|
|
1766
1772
|
`:r+="\\n";break;case"\r":r+="\\r";break;case" ":r+="\\t";break;case"\b":r+="\\b";break;case"\f":r+="\\f";break;default:let c=s.charCodeAt(0);c<32?r+="\\u"+("0000"+c.toString(16)).slice(-4):r+=s}else r+=s}return r}},Pv=class extends Yn{constructor(){super(...arguments),this.name="TrailingCharactersRepair",this.description="Removes trailing characters after valid JSON structure"}canApply(e){let r=e.trim();if(!r.startsWith("{")&&!r.startsWith("["))return!1;let n=0,i=0,o=!1,s=!1;for(let a=0;a<r.length;a++){let c=r[a];if(o)s?s=!1:c==="\\"?s=!0:c==='"'&&(o=!1);else if(c==='"')o=!0;else if(c==="{")n++;else if(c==="}"){if(n--,n===0&&i===0&&a>0&&a<r.length-1)return!0}else if(c==="[")i++;else if(c==="]"&&(i--,i===0&&n===0&&a>0&&a<r.length-1))return!0}return!1}apply(e){let r=e.trim(),n=0,i=0,o=!1,s=!1,a=-1;for(let c=0;c<r.length;c++){let u=r[c];if(o)s?s=!1:u==="\\"?s=!0:u==='"'&&(o=!1);else if(u==='"')o=!0;else if(u==="{")n++;else if(u==="}"){if(n--,n===0&&i===0&&c>0){a=c;break}}else if(u==="[")i++;else if(u==="]"&&(i--,i===0&&n===0&&c>0)){a=c;break}}return a>0&&a<r.length-1?r.substring(0,a+1):e}},Wu=class{constructor(e={}){this.strategies=[],this.repairLog=[],this.options={attemptRepair:!0,maxDepth:10,preserveStringsOnFailure:!1,logRepairs:!1,...e},this.initializeDefaultStrategies(),e.customStrategies&&this.strategies.push(...e.customStrategies)}initializeDefaultStrategies(){this.strategies=[new By,new _y,new Lv,new Pv,new Qy,new vy,new Dy,new Ty]}parse(e){let r=Date.now();this.repairLog=[];let n=e instanceof Buffer?e.toString("utf8"):String(e);try{return{success:!0,data:JSON.parse(n),metadata:{parseTime:Date.now()-r,strategiesApplied:[]}}}catch(s){if(!this.options.attemptRepair)return{success:!1,error:`JSON parse error: ${s}`,metadata:{parseTime:Date.now()-r}}}let i=n,o=[];for(let s of this.strategies)if(s.canApply(i)){let a=i;if(i=s.apply(i),a!==i){o.push(s.name),this.repairLog.push(s.description),this.options.logRepairs&&console.log(`Applied ${s.name}: ${s.description}`);try{return{success:!0,data:JSON.parse(i),repairs:this.repairLog,metadata:{parseTime:Date.now()-r,strategiesApplied:o}}}catch{}}}try{return{success:!0,data:JSON.parse(i),repairs:this.repairLog,metadata:{parseTime:Date.now()-r,strategiesApplied:o}}}catch(s){let a=this.aggressiveFallback(i);return a.success?{...a,repairs:[...this.repairLog,"Applied aggressive fallback"],metadata:{parseTime:Date.now()-r,strategiesApplied:[...o,"AggressiveFallback"]}}:{success:!1,error:`Failed to parse JSON after applying ${o.length} strategies: ${s}`,repairs:this.repairLog,metadata:{parseTime:Date.now()-r,strategiesApplied:o}}}}aggressiveFallback(e){try{let r=e.indexOf("{"),n=e.indexOf("[");if(r===-1&&n===-1)return{success:!1,error:"No JSON-like structure found"};let i=r===-1?n:n===-1?r:Math.min(r,n),o=e.substring(i);for(let a of this.strategies)a.canApply(o)&&(o=a.apply(o));return{success:!0,data:JSON.parse(o)}}catch(r){return{success:!1,error:`Aggressive fallback failed: ${r}`}}}addStrategy(e){this.strategies.push(e)}removeStrategy(e){this.strategies=this.strategies.filter(r=>r.name!==e)}getStrategies(){return this.strategies.map(e=>e.name)}};at.ResilientJsonParser=Wu;var CG=new Wu;function tke(t,e){return(e?new Wu(e):CG).parse(t)}function rke(t){let e=CG.parse(t);if(e.success)return e.repairs&&e.repairs.length>0&&console.log("JSON parsed with repairs:",e.repairs),e.data;throw new Error(`Failed to parse JSON: ${e.error}`)}function nke(t){try{return JSON.parse(t),!0}catch{return!1}}function ike(t,e=2){return JSON.stringify(t,null,e)}function oke(t){let r=new Wu().parse(t);if(r.success)return JSON.stringify(r.data);throw new Error("Cannot minify invalid JSON")}});var ur=m(K=>{"use strict";var ske=K&&K.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),le=K&&K.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ske(e,t,r)};Object.defineProperty(K,"__esModule",{value:!0});K.SSELogSubscriptionManager=K.SuperglueHttpError=K.SuperglueClient=void 0;le(Mk(),K);le(tM(),K);le(pM(),K);le(hM(),K);le(IM(),K);le(CM(),K);le(SM(),K);le(bd(),K);le(nx(),K);le(ix(),K);le(ox(),K);le(sx(),K);le(mb(),K);le(cx(),K);le(dx(),K);le(Ax(),K);le(px(),K);le(Eb(),K);le(hx(),K);le(mx(),K);le(yx(),K);le(Ix(),K);le(cp(),K);le(bx(),K);le(Sx(),K);le(Bx(),K);le(Qx(),K);le(Dx(),K);le(Tx(),K);le(Ux(),K);le(xx(),K);le(Px(),K);le(rb(),K);le(Jx(),K);le(Zx(),K);le(zh(),K);le(lL(),K);le(gL(),K);le(mL(),K);le(qb(),K);le(CL(),K);le(bL(),K);le(QL(),K);le(_L(),K);le(dr(),K);le(ln(),K);le(DL(),K);le(TL(),K);le(og(),K);le(Lc(),K);le(Xl(),K);var SG=IG();Object.defineProperty(K,"SuperglueClient",{enumerable:!0,get:function(){return SG.SuperglueClient}});Object.defineProperty(K,"SuperglueHttpError",{enumerable:!0,get:function(){return SG.SuperglueHttpError}});var ake=Yb();Object.defineProperty(K,"SSELogSubscriptionManager",{enumerable:!0,get:function(){return ake.SSELogSubscriptionManager}});le(bG(),K)});var fE=require("commander");var Br=pe(require("fs")),QG=pe(require("os")),Jo=pe(require("path")),GA=pe(ur()),wG=new Set(["runner","builder","admin"]),BG={output:{mode:"stdout",directory:".superglue/output"},preset:"admin"};function Wo(t){let e=Jo.join(process.cwd(),".superglue"),r=QG.homedir();if(!r)return e;let n=Jo.join(r,".superglue");return t===!0?e:t===!1?n:Br.existsSync(Jo.join(e,"config.json"))?e:n}function Fv(t){return Jo.join(Wo(t),"config.json")}function Ry(t){let e=Fv(t);if(!Br.existsSync(e))return{};try{return JSON.parse(Br.readFileSync(e,"utf-8"))}catch{return{}}}function Zu(t){let e=Ry(),r=t.apiKey||(0,GA.readProcessEnvironmentValue)("SUPERGLUE_API_KEY")||e.apiKey||"",n=t.endpoint||(0,GA.readProcessEnvironmentValue)("SUPERGLUE_API_ENDPOINT")||e.endpoint||"https://api.superglue.cloud",i=(0,GA.readProcessEnvironmentValue)("SUPERGLUE_WEB_ENDPOINT")||e.webEndpoint||n.replace(/:3002\b/,":3001").replace(/api\.superglue/,"app.superglue"),o=(0,GA.readProcessEnvironmentValue)("SUPERGLUE_CLI_PRESET"),s=o&&wG.has(o)?o:e.preset&&wG.has(e.preset)?e.preset:"admin";return{...BG,...e,apiKey:r,endpoint:n,webEndpoint:i,preset:s,output:{...BG.output,...e.output}}}function ky(t,e){let r=Wo(e);Br.existsSync(r)||Br.mkdirSync(r,{recursive:!0}),Br.writeFileSync(Jo.join(r,"config.json"),JSON.stringify(t,null,2)+`
|
|
1767
|
-
`,{mode:384})}function Ny(t,e){let r=Jo.join(Wo(e),"drafts");if(Br.existsSync(r)||Br.mkdirSync(r,{recursive:!0}),t.output.mode==="stdout+file"){let n=Jo.resolve(t.output.directory);Br.existsSync(n)||Br.mkdirSync(n,{recursive:!0})}}var Yv=pe(ur());var $v=pe(require("readline"));var DG=require("child_process"),TG=require("util");var vG={name:"@superglue/cli",version:"1.1.
|
|
1773
|
+
`,{mode:384})}function Ny(t,e){let r=Jo.join(Wo(e),"drafts");if(Br.existsSync(r)||Br.mkdirSync(r,{recursive:!0}),t.output.mode==="stdout+file"){let n=Jo.resolve(t.output.directory);Br.existsSync(n)||Br.mkdirSync(n,{recursive:!0})}}var Yv=pe(ur());var $v=pe(require("readline"));var DG=require("child_process"),TG=require("util");var vG={name:"@superglue/cli",version:"1.1.177",bin:{sg:"./dist/cli.js"},files:[".claude-plugin/","dist/","skills/","LICENSE"],dependencies:{commander:"15.0.0-0","fast-json-patch":"3.1.1"},devDependencies:{"@superglue/shared":"file:../shared","@types/node":"25.5.0",tsup:"8.5.1",typescript:"5.8.3"},scripts:{build:"tsup && (cp -r skills dist/ 2>/dev/null || true)",dev:"tsup --watch","type-check":"tsc --noEmit",prepublishOnly:"npm run build"},publishConfig:{access:"public"}};var uke=(0,TG.promisify)(DG.exec),lr=vG.version;function _G(t){let e=t.match(/^(\d+)(?:-(.+))?$/);return e?{numeric:parseInt(e[1],10),prerelease:e[2]||null}:{numeric:0,prerelease:t}}function Uy(t,e){let r=t.split("."),n=e.split("."),i=Math.max(r.length,n.length);for(let o=0;o<i;o++){let s=_G(r[o]||"0"),a=_G(n[o]||"0");if(s.numeric<a.numeric)return-1;if(s.numeric>a.numeric||s.prerelease===null&&a.prerelease!==null)return 1;if(s.prerelease!==null&&a.prerelease===null)return-1;if(s.prerelease!==null&&a.prerelease!==null){if(s.prerelease<a.prerelease)return-1;if(s.prerelease>a.prerelease)return 1}}return 0}async function My(){try{let t=await fetch("https://registry.npmjs.org/@superglue/cli/latest",{signal:AbortSignal.timeout(5e3)});return t.ok&&(await t.json()).version||null}catch{return null}}var Oy=null;function RG(){re()&&(Oy=My())}async function kG(){if(!(!re()||!Oy)){try{let t=new Promise(r=>{setTimeout(()=>r(null),2e3).unref()}),e=await Promise.race([Oy,t]);e&&Uy(lr,e)<0&&(console.error(""),console.error(`${y.cyan}${y.bold} Update available: ${lr} \u2192 ${e}${y.reset}`),console.error(`${y.cyan} Run ${y.bold}sg update${y.reset}${y.cyan} to upgrade${y.reset}`),console.error(""))}catch{}Oy=null}}async function NG(){let t=await My();if(!t)return{success:!1,message:"Could not fetch latest version from npm"};if(Uy(lr,t)>=0)return{success:!0,message:`Already on latest version (${lr})`};try{return await uke("npm install -g @superglue/cli@latest"),{success:!0,message:`Updated from ${lr} to ${t}`}}catch(e){return{success:!1,message:`Update failed: ${e.message}. Try manually: npm install -g @superglue/cli@latest`}}}var re=()=>process.argv.includes("--table")&&process.stdout.isTTY,Qr=()=>process.argv.includes("--full"),y={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m"};function OG(t,e){let r=e||t;return`\x1B]8;;${t}\x07${y.underline}${y.cyan}${r}${y.reset}\x1B]8;;\x07`}function UG(){if(!re())return;let t=y.reset,e=y.dim,r="\x1B[47;30m",n=[" #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@- "," =@@@- @@@@ "," @@@ @@% "," -@@ @@@@= @@@ @@@ @@@@@#@ @@@@@@@ @@@@@@@ @@@@@@ @@@ @@@ @@@ @@@@@@* %@@ "," @@ @@@ *@ @@@ @@@ @@@ :@@ @@@ @@@ -@@ @@@ @% @@@ @@@ @@@ @@* @@# "," #@@ @@@# @@@ @@@ @@@ :@@ @@@ @@@ -@@ @@@ @@@ @@@ @@@ @@* @@ "," @@- @@@@= @@@ @@@ @@@@@@@ @@@@@@ @@@@@@@ @@@ @@% @@@ @@@ @@@ @@@@@. @@."," #@% .@@@@ @@@ @@@ @@@ @@@ @@@ -@@ @@@ @@% @@@ @@@ @@@ @@* @@ "," @@ @ @@@ @@@ @@@ @@@ @@@ @@@ -@@ @@@ @@% @@@ @@@ @@@ @@* *@@ "," -@@ @@@@= @@@@@@ @@@ @@@@@@@ @@@ -@@ @@@@@@ @@@@@@% @@@@@@. @@@@@@* #@@ "," :@@* @@@ "," %@@@ =@@@. "," :@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@% "];console.log(""),n.forEach(i=>{let o=i.search(/\S/),s=i.length-[...i].reverse().join("").search(/\S/)-1;if(o===-1)return console.log(" "+i);let a=i.slice(0,o),c=i.slice(o,s+1).split("").map(l=>l===" "?" ":"\u2588").join(""),u=i.slice(s+1);console.log(` ${a}${r}${c}${t}${u}`)}),console.log(` ${e} CLI v${lr}${t}`),console.log("")}function it(t){if(!re())return{stop:()=>{},update:()=>{},log:()=>{}};let e=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],r=0,n=t,i=()=>process.stdout.write("\r\x1B[2K"),o=()=>{process.stdout.write(`\r ${y.cyan}${e[r++%e.length]}${y.reset} ${n}`)},s=setInterval(o,80);return{update:a=>{n=a},log:a=>{i(),console.log(` ${y.dim}\u2502${y.reset} ${a}`),o()},stop:a=>{clearInterval(s),i(),a&&console.log(` ${a}`)}}}function W(t){re()?xy(t):console.log(JSON.stringify(t,null,2))}function we(t,e){re()?(console.log(` ${y.green}\u2713${y.reset} ${t}`),e&&xy(e,4)):console.log(JSON.stringify({success:!0,message:t,...e&&typeof e=="object"?e:{data:e}}))}function _(t,e){re()?(console.error(` ${y.red}\u2717${y.reset} ${t}`),e&&xy(e,4)):console.error(JSON.stringify({success:!1,error:t,details:e}))}function MG(t){re()&&console.log(` ${y.yellow}\u26A0${y.reset} ${t}`)}function Xt(t){re()&&console.log(` ${y.dim}${t}${y.reset}`)}function Zo(t){re()&&(console.log(`
|
|
1768
1774
|
${y.bold}${y.cyan}${t}${y.reset}`),console.log(` ${y.dim}${"\u2500".repeat(t.length)}${y.reset}`))}function vr(t,e,r){if(!re()){console.log(JSON.stringify({success:!0,total:r?.total??t.length,items:t}));return}if(t.length===0){console.log(`
|
|
1769
1775
|
${y.dim}0 results${y.reset}
|
|
1770
1776
|
`);return}let n=e||Object.keys(t[0]),i=Qr()?1/0:60,o=n.map(l=>Math.min(i,Math.max(l.length,...t.map(d=>String(d[l]??"").replace(/[\n\r]+/g," ").trim().length))));console.log("");let s=n.map((l,d)=>`${y.bold}${y.cyan}${l.toUpperCase().padEnd(o[d])}${y.reset}`).join(" ");console.log(` ${s}`);let a=o.map(l=>`${y.dim}${"\u2500".repeat(l)}${y.reset}`).join(`${y.dim}\u2500\u2500${y.reset}`);console.log(` ${a}`);for(let l of t){let d=n.map((A,p)=>{let h=String(l[A]??"").replace(/[\n\r]+/g," ").trim();if(h.length>i){let S=`\u2026 (${h.length})`;h=h.slice(0,Math.max(0,i-S.length))+`${y.dim}${S}${y.reset}`}return A==="status"?`${{success:y.green,running:y.yellow,failed:y.red,aborted:y.red,error:y.red,pending:y.dim}[h.toLowerCase()]||""}${h.padEnd(o[p])}${y.reset}`:h.padEnd(o[p])}).join(" ");console.log(` ${d}`)}let c=r?.total??t.length,u=c===t.length?`${t.length} result${t.length===1?"":"s"}`:`${t.length} of ${c} result${c===1?"":"s"}`;console.log(`
|