qtype 0.1.3__py3-none-any.whl → 0.1.9__py3-none-any.whl
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.
- qtype/base/types.py +1 -9
- qtype/base/ui_shapes.py +38 -0
- qtype/dsl/model.py +45 -19
- qtype/dsl/parser.py +3 -3
- qtype/interpreter/base/base_step_executor.py +10 -10
- qtype/interpreter/base/factory.py +6 -0
- qtype/interpreter/base/step_cache.py +3 -3
- qtype/interpreter/conversions.py +32 -7
- qtype/interpreter/executors/agent_executor.py +1 -2
- qtype/interpreter/executors/bedrock_reranker_executor.py +1 -2
- qtype/interpreter/executors/collect_executor.py +76 -0
- qtype/interpreter/executors/construct_executor.py +68 -0
- qtype/interpreter/executors/decoder_executor.py +1 -2
- qtype/interpreter/executors/doc_to_text_executor.py +1 -2
- qtype/interpreter/executors/document_embedder_executor.py +19 -4
- qtype/interpreter/executors/document_search_executor.py +1 -2
- qtype/interpreter/executors/document_source_executor.py +1 -2
- qtype/interpreter/executors/document_splitter_executor.py +1 -2
- qtype/interpreter/executors/echo_executor.py +1 -2
- qtype/interpreter/executors/explode_executor.py +49 -0
- qtype/interpreter/executors/field_extractor_executor.py +1 -2
- qtype/interpreter/executors/file_writer_executor.py +12 -13
- qtype/interpreter/executors/index_upsert_executor.py +3 -4
- qtype/interpreter/executors/invoke_embedding_executor.py +37 -26
- qtype/interpreter/executors/invoke_tool_executor.py +1 -2
- qtype/interpreter/executors/llm_inference_executor.py +1 -2
- qtype/interpreter/executors/prompt_template_executor.py +1 -2
- qtype/interpreter/executors/sql_source_executor.py +1 -2
- qtype/interpreter/executors/vector_search_executor.py +1 -2
- qtype/interpreter/flow.py +6 -4
- qtype/interpreter/types.py +18 -10
- qtype/interpreter/typing.py +53 -4
- qtype/interpreter/ui/404/index.html +1 -1
- qtype/interpreter/ui/404.html +1 -1
- qtype/interpreter/ui/_next/static/{20HoJN6otZ_LyHLHpCPE6 → YR7FgQl_Kpwjcqho0ogG4}/_buildManifest.js +1 -1
- qtype/interpreter/ui/_next/static/chunks/230-e22a519211de9624.js +33 -0
- qtype/interpreter/ui/_next/static/chunks/255-268261a96ffee0a9.js +1 -0
- qtype/interpreter/ui/_next/static/chunks/4bd1b696-c023c6e3521b1417.js +1 -0
- qtype/interpreter/ui/_next/static/chunks/app/_not-found/page-8f0e059659d8afd7.js +1 -0
- qtype/interpreter/ui/_next/static/chunks/app/layout-1615bcffa82ff884.js +1 -0
- qtype/interpreter/ui/_next/static/chunks/app/page-bfbb263eb356c6eb.js +1 -0
- qtype/interpreter/ui/_next/static/chunks/ba12c10f-8d3b3efcaddd4728.js +1 -0
- qtype/interpreter/ui/_next/static/chunks/framework-d7de93249215fb06.js +1 -0
- qtype/interpreter/ui/_next/static/chunks/main-090112344d9a19ce.js +1 -0
- qtype/interpreter/ui/_next/static/chunks/main-app-a5425c8070223ccc.js +1 -0
- qtype/interpreter/ui/_next/static/chunks/pages/{_app-0a0020ddd67f79cf.js → _app-7d307437aca18ad4.js} +1 -1
- qtype/interpreter/ui/_next/static/chunks/pages/{_error-03529f2c21436739.js → _error-cb2a52f75f2162e2.js} +1 -1
- qtype/interpreter/ui/_next/static/chunks/webpack-bd0771cb30dd12fa.js +1 -0
- qtype/interpreter/ui/_next/static/css/7906798f56607e8f.css +3 -0
- qtype/interpreter/ui/assets/video-sample.mp4 +0 -0
- qtype/interpreter/ui/index.html +1 -1
- qtype/interpreter/ui/index.txt +12 -12
- qtype/semantic/checker.py +83 -0
- qtype/semantic/generate.py +0 -1
- qtype/semantic/model.py +25 -18
- {qtype-0.1.3.dist-info → qtype-0.1.9.dist-info}/METADATA +2 -2
- {qtype-0.1.3.dist-info → qtype-0.1.9.dist-info}/RECORD +62 -57
- qtype/interpreter/ui/_next/static/chunks/434-b2112d19f25c44ff.js +0 -36
- qtype/interpreter/ui/_next/static/chunks/4bd1b696-cf72ae8a39fa05aa.js +0 -1
- qtype/interpreter/ui/_next/static/chunks/964-2b041321a01cbf56.js +0 -1
- qtype/interpreter/ui/_next/static/chunks/app/_not-found/page-e110d2a9d0a83d82.js +0 -1
- qtype/interpreter/ui/_next/static/chunks/app/layout-a05273ead5de2c41.js +0 -1
- qtype/interpreter/ui/_next/static/chunks/app/page-8c67d16ac90d23cb.js +0 -1
- qtype/interpreter/ui/_next/static/chunks/ba12c10f-546f2714ff8abc66.js +0 -1
- qtype/interpreter/ui/_next/static/chunks/framework-7c95b8e5103c9e90.js +0 -1
- qtype/interpreter/ui/_next/static/chunks/main-app-6fc6346bc8f7f163.js +0 -1
- qtype/interpreter/ui/_next/static/chunks/main-e26b9cb206da2cac.js +0 -1
- qtype/interpreter/ui/_next/static/chunks/webpack-08642e441b39b6c2.js +0 -1
- qtype/interpreter/ui/_next/static/css/8a8d1269e362fef7.css +0 -3
- /qtype/interpreter/ui/_next/static/{20HoJN6otZ_LyHLHpCPE6 → YR7FgQl_Kpwjcqho0ogG4}/_ssgManifest.js +0 -0
- {qtype-0.1.3.dist-info → qtype-0.1.9.dist-info}/WHEEL +0 -0
- {qtype-0.1.3.dist-info → qtype-0.1.9.dist-info}/entry_points.txt +0 -0
- {qtype-0.1.3.dist-info → qtype-0.1.9.dist-info}/licenses/LICENSE +0 -0
- {qtype-0.1.3.dist-info → qtype-0.1.9.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{2941:(e,t,a)=>{Promise.resolve().then(a.bind(a,5551))},5551:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>te});var r=a(5155),s=a(2115),n=a(6132),l=a(3101),i=a(2821),o=a(5889);function d(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];return(0,o.QP)((0,i.$)(t))}let c=(0,l.F)("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function u(e){let{className:t,variant:a,...s}=e;return(0,r.jsx)("div",{"data-slot":"alert",role:"alert",className:d(c({variant:a}),t),...s})}function x(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"alert-title",className:d("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",t),...a})}function m(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"alert-description",className:d("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",t),...a})}var g=a(1330);function h(e){let{className:t,...a}=e;return(0,r.jsx)(g.bL,{"data-slot":"tabs",className:d("flex flex-col gap-2",t),...a})}function p(e){let{className:t,...a}=e;return(0,r.jsx)(g.B8,{"data-slot":"tabs-list",className:d("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",t),...a})}function f(e){let{className:t,...a}=e;return(0,r.jsx)(g.l9,{"data-slot":"tabs-trigger",className:d("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...a})}function b(e){let{className:t,...a}=e;return(0,r.jsx)(g.UC,{"data-slot":"tabs-content",className:d("flex-1 outline-none",t),...a})}var y=a(3903),v=a(5704);class j extends Error{constructor(e,t,a){super(e),this.name="ApiClientError",this.status=t,this.detail=a}}class N{async fetchWithTimeout(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=new AbortController,r=setTimeout(()=>a.abort(),this.config.timeout);try{let s=await fetch(e,{...t,signal:a.signal,headers:{"Content-Type":"application/json",...t.headers}});if(clearTimeout(r),!s.ok){let e;try{e=await s.json()}catch(t){e={message:s.statusText}}let t="API request failed: ".concat(s.status," ").concat(s.statusText);if(null==e?void 0:e.detail){let a="string"==typeof e.detail?e.detail:JSON.stringify(e.detail,null,2);t+="\n".concat(a)}throw new j(t,s.status,e)}return s}catch(e){if(clearTimeout(r),e instanceof j)throw e;if(e instanceof Error&&"AbortError"===e.name)throw new j("Request timeout",408);throw new j("Network error: ".concat(e instanceof Error?e.message:"Unknown error"),0)}}getUrl(e){let t=this.config.baseUrl.endsWith("/")?this.config.baseUrl.slice(0,-1):this.config.baseUrl,a=e.startsWith("/")?e:"/".concat(e);return"".concat(t).concat(a)}async get(e){return(await this.fetchWithTimeout(this.getUrl(e),{method:"GET"})).json()}async post(e,t){return(await this.fetchWithTimeout(this.getUrl(e),{method:"POST",body:t?JSON.stringify(t):void 0})).json()}async executeFlow(e,t){return this.post(e,t)}async getOpenApiSpec(){return this.get("/openapi.json")}async getFlows(){return this.get("/flows")}async healthCheck(){try{return await this.getFlows(),{status:"healthy",timestamp:new Date().toISOString()}}catch(e){throw new j("Health check failed: ".concat(e instanceof Error?e.message:"Unknown error"),500,e)}}getBaseUrl(){return this.config.baseUrl}setBaseUrl(e){this.config.baseUrl=e}constructor(e){this.config={baseUrl:v.env.NEXT_PUBLIC_QTYPE_HOST||"../",timeout:5e5,...e}}}let w=new N,k=()=>w.getOpenApiSpec();var S=a(674),C=a(6524),_=a(2467);let z=(0,l.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function U(e){let{className:t,variant:a,size:s,asChild:n=!1,...l}=e,i=n?_.DX:"button";return(0,r.jsx)(i,{"data-slot":"button",className:d(z({variant:a,size:s,className:t})),...l})}var R=a(1895);function A(e){let{className:t,...a}=e;return(0,r.jsx)(R.bL,{"data-slot":"switch",className:d("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...a,children:(0,r.jsx)(R.zi,{"data-slot":"switch-thumb",className:d("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}function O(e){let{name:t,property:a,required:s,value:n=!1,onChange:l}=e;return(0,r.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,r.jsx)(A,{checked:!!n,onCheckedChange:e=>{null==l||l(t,e)},required:s}),(0,r.jsx)("div",{className:"flex-1",children:(0,r.jsx)("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:n?"Enabled":"Disabled"})})]})}var L=a(1163),E=a(6485),T=a(3648),F=a(368),B=a(7937),M=a(4033),D=a(4854),q=a(7367);function I(){let e=(0,T._)(["rtl:**:[.rdp-button_next>svg]:rotate-180"],["rtl:**:[.rdp-button\\_next>svg]:rotate-180"]);return I=function(){return e},e}function P(){let e=(0,T._)(["rtl:**:[.rdp-button_previous>svg]:rotate-180"],["rtl:**:[.rdp-button\\_previous>svg]:rotate-180"]);return P=function(){return e},e}function W(e){let{className:t,classNames:a,showOutsideDays:s=!0,captionLayout:n="label",buttonVariant:l="ghost",formatters:i,components:o,...c}=e,u=(0,D.a)();return(0,r.jsx)(q.h,{showOutsideDays:s,className:d("bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw(I()),String.raw(P()),t),captionLayout:n,formatters:{formatMonthDropdown:e=>e.toLocaleString("default",{month:"short"}),...i},classNames:{root:d("w-fit",u.root),months:d("flex gap-4 flex-col md:flex-row relative",u.months),month:d("flex flex-col w-full gap-4",u.month),nav:d("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",u.nav),button_previous:d(z({variant:l}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",u.button_previous),button_next:d(z({variant:l}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",u.button_next),month_caption:d("flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",u.month_caption),dropdowns:d("w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",u.dropdowns),dropdown_root:d("relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",u.dropdown_root),dropdown:d("absolute bg-popover inset-0 opacity-0",u.dropdown),caption_label:d("select-none font-medium","label"===n?"text-sm":"rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",u.caption_label),table:"w-full border-collapse",weekdays:d("flex",u.weekdays),weekday:d("text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",u.weekday),week:d("flex w-full mt-2",u.week),week_number_header:d("select-none w-(--cell-size)",u.week_number_header),week_number:d("text-[0.8rem] select-none text-muted-foreground",u.week_number),day:d("relative w-full h-full p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",u.day),range_start:d("rounded-l-md bg-accent",u.range_start),range_middle:d("rounded-none",u.range_middle),range_end:d("rounded-r-md bg-accent",u.range_end),today:d("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",u.today),outside:d("text-muted-foreground aria-selected:text-muted-foreground",u.outside),disabled:d("text-muted-foreground opacity-50",u.disabled),hidden:d("invisible",u.hidden),...a},components:{Root:e=>{let{className:t,rootRef:a,...s}=e;return(0,r.jsx)("div",{"data-slot":"calendar",ref:a,className:d(t),...s})},Chevron:e=>{let{className:t,orientation:a,...s}=e;return"left"===a?(0,r.jsx)(F.A,{className:d("size-4",t),...s}):"right"===a?(0,r.jsx)(B.A,{className:d("size-4",t),...s}):(0,r.jsx)(M.A,{className:d("size-4",t),...s})},DayButton:H,WeekNumber:e=>{let{children:t,...a}=e;return(0,r.jsx)("td",{...a,children:(0,r.jsx)("div",{className:"flex size-(--cell-size) items-center justify-center text-center",children:t})})},...o},...c})}function H(e){let{className:t,day:a,modifiers:n,...l}=e,i=(0,D.a)(),o=s.useRef(null);return s.useEffect(()=>{var e;n.focused&&(null==(e=o.current)||e.focus())},[n.focused]),(0,r.jsx)(U,{ref:o,variant:"ghost",size:"icon","data-day":a.date.toLocaleDateString(),"data-selected-single":n.selected&&!n.range_start&&!n.range_end&&!n.range_middle,"data-range-start":n.range_start,"data-range-end":n.range_end,"data-range-middle":n.range_middle,className:d("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",i.day,t),...l})}var J=a(4696);function K(e){let{...t}=e;return(0,r.jsx)(J.bL,{"data-slot":"popover",...t})}function V(e){let{...t}=e;return(0,r.jsx)(J.l9,{"data-slot":"popover-trigger",...t})}function G(e){let{className:t,align:a="center",sideOffset:s=4,...n}=e;return(0,r.jsx)(J.ZL,{children:(0,r.jsx)(J.UC,{"data-slot":"popover-content",align:a,sideOffset:s,className:d("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",t),...n})})}function $(e){let{name:t,property:a,value:n,onChange:l,required:i}=e,[o,c]=s.useState(n&&"string"==typeof n?new Date(n):void 0);return(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("label",{className:"text-sm font-medium",children:[a.title||"Date"," ",i&&(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsxs)(K,{children:[(0,r.jsx)(V,{asChild:!0,children:(0,r.jsxs)(U,{variant:"outline",className:d("w-full justify-start text-left font-normal",!o&&"text-muted-foreground"),children:[(0,r.jsx)(E.A,{className:"mr-2 h-4 w-4"}),o?(0,L.GP)(o,"PPP"):"Select a date"]})}),(0,r.jsx)(G,{className:"w-auto p-0",children:(0,r.jsx)(W,{mode:"single",selected:o,onSelect:e=>{if(c(e),e){let a=(0,L.GP)(e,"yyyy-MM-dd");null==l||l(t,a)}},initialFocus:!0})})]}),a.description&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:a.description})]})}function Q(e){let{className:t,type:a,...s}=e;return(0,r.jsx)("input",{type:a,"data-slot":"input",className:d("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",t),...s})}function Z(e){let{name:t,property:a,value:n,onChange:l,required:i}=e,{date:o,time:c}=(e=>{var t;if(!e)return{date:void 0,time:""};let a=new Date(e);return isNaN(a.getTime())?{date:void 0,time:""}:{date:a,time:e.includes("T")&&(null==(t=e.split("T")[1])?void 0:t.split(".")[0])||""}})("string"==typeof n?n:void 0),[u,x]=s.useState(o),[m,g]=s.useState(c),h=(e,a)=>{if(!e)return;let r=(0,L.GP)(e,"yyyy-MM-dd"),s="".concat(r,"T").concat(a||"00:00:00");null==l||l(t,s)};return(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("label",{className:"text-sm font-medium",children:[a.title||"Date & Time"," ",i&&(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsxs)("div",{className:"flex flex-col space-y-2",children:[(0,r.jsxs)(K,{children:[(0,r.jsx)(V,{asChild:!0,children:(0,r.jsxs)(U,{variant:"outline",className:d("w-full justify-start text-left font-normal",!u&&"text-muted-foreground"),children:[(0,r.jsx)(E.A,{className:"mr-2 h-4 w-4"}),u?(0,r.jsxs)("span",{children:[(0,L.GP)(u,"PPP"),m&&(0,r.jsxs)("span",{className:"text-muted-foreground ml-2",children:["at ",m]})]}):"Select date and time"]})}),(0,r.jsx)(G,{className:"w-auto p-0",children:(0,r.jsx)(W,{mode:"single",selected:u,onSelect:e=>{x(e),h(e,m)},initialFocus:!0})})]}),(0,r.jsx)(Q,{type:"time",value:m,onChange:e=>{var t;g(t=e.target.value),h(u,t)},step:"1",placeholder:"HH:MM:SS",className:"w-full"})]}),a.description&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:a.description})]})}var X=a(1636);let Y=new Set(["bytes","file","image","audio","video"]);function ee(e){var t;let{name:a,property:n,required:l,value:i,onChange:o}=e,[d,c]=(0,s.useState)(null),[u,x]=(0,s.useState)(null),[m,g]=(0,s.useState)(!1),[h,p]=(0,s.useState)(null),f=(0,s.useRef)(null),b=n.qtype_type||"file",y=null!=(t=({image:{"image/*":[]},video:{"video/*":[]},audio:{"audio/*":[]},file:{"*/*":[]},bytes:{"*/*":[]}})[b])?t:{"*/*":[]};async function v(e){x(null);let t=e[0];if(!t)return;let r=t.type||"application/octet-stream";if(p({name:t.name,size:t.size,type:r}),n.maxLength&&t.size>n.maxLength)return void x("File exceeds max size (".concat(n.maxLength," bytes). Got ").concat(t.size,"."));if(d&&URL.revokeObjectURL(d),r.startsWith("image/")||r.startsWith("video/")?c(URL.createObjectURL(t)):c(null),Y.has(b)){try{g(!0);let e=await t.arrayBuffer(),s=function(e){let t=new Uint8Array(e),a="";for(let e=0;e<t.length;e+=32768)a+=String.fromCharCode(...t.subarray(e,e+32768));return btoa(a)}(e),n=JSON.stringify({filename:t.name,mime:r,bytes_base64:s});null==o||o(a,n)}catch(e){x(e instanceof Error?"Failed to read file: ".concat(e.message):"Failed to read file")}finally{g(!1)}return}}(0,s.useEffect)(()=>()=>{d&&URL.revokeObjectURL(d)},[d]);let{getRootProps:j,getInputProps:N,isDragActive:w}=(0,X.VB)({onDrop:v,multiple:!1,accept:y}),k=i&&"string"==typeof i&&Y.has(b);return(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{...j(),className:"flex flex-col items-center justify-center rounded border border-dashed p-4 text-center cursor-pointer transition ".concat(w?"border-blue-500 bg-blue-50 dark:border-blue-400 dark:bg-blue-950":"border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-900"),children:[(0,r.jsx)("input",{...N(),"aria-required":l}),(0,r.jsx)("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:w?"Drop file here...":"Drag & drop or click to select a ".concat(b," file")}),m&&(0,r.jsx)("p",{className:"mt-2 text-xs text-blue-600 dark:text-blue-400",children:"Reading file..."}),k&&(0,r.jsxs)("p",{className:"mt-2 text-xs text-gray-700 dark:text-gray-300",children:["Bytes (base64) length: ",String(i).length]})]}),d&&h&&(0,r.jsxs)("div",{className:"group relative w-full max-w-sm overflow-hidden rounded-lg border bg-black/5 dark:bg-white/5 shadow-sm",children:[(0,r.jsxs)("div",{className:"aspect-video w-full bg-black/30 flex items-center justify-center overflow-hidden",children:["image"===b&&(0,r.jsx)("img",{src:d,alt:h.name,className:"h-full w-full object-cover transition group-hover:scale-[1.02]"}),"video"===b&&(0,r.jsx)("video",{ref:f,src:d,className:"h-full w-full object-cover",muted:!0,playsInline:!0,preload:"metadata"}),"image"!==b&&"video"!==b&&(0,r.jsx)("div",{className:"text-xs text-gray-300",children:h.type.split("/")[0].toUpperCase()}),(0,r.jsx)("div",{className:"pointer-events-none absolute inset-0 bg-gradient-to-b from-transparent via-black/30 to-black/70"})]}),(0,r.jsxs)("div",{className:"absolute top-2 right-2 flex gap-1 opacity-0 group-hover:opacity-100 transition",children:[(0,r.jsx)("button",{type:"button",onClick:()=>{d&&URL.revokeObjectURL(d),c(null),p(null),null==o||o(a,null)},className:"rounded bg-black/60 px-2 py-1 text-[10px] font-medium text-white hover:bg-black/80",children:"Remove"}),"video"===b&&(0,r.jsx)("button",{type:"button",onClick:()=>{var e;return null==(e=f.current)?void 0:e.play()},className:"rounded bg-black/60 px-2 py-1 text-[10px] font-medium text-white hover:bg-black/80",children:"Play"})]}),(0,r.jsxs)("div",{className:"absolute bottom-0 left-0 right-0 px-3 py-2 flex flex-col gap-0.5",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{className:"truncate text-[11px] font-medium text-white",children:h.name}),(0,r.jsx)("span",{className:"text-[10px] text-gray-200",children:function(e){let t=["B","KB","MB","GB","TB"],a=e,r=0;for(;a>=1024&&r<t.length-1;)a/=1024,r+=1;return 0===r?"".concat(a," ").concat(t[r]):"".concat(a.toFixed(1)," ").concat(t[r])}(h.size)})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"rounded bg-white/15 px-1.5 py-0.5 text-[10px] text-gray-100 backdrop-blur",children:b}),(0,r.jsx)("span",{className:"truncate text-[10px] text-gray-300",children:h.type})]})]})]}),u&&(0,r.jsx)("p",{className:"text-xs text-red-600 dark:text-red-400",children:u})]})}function et(e){let{name:t,property:a,required:s,value:n,onChange:l}=e,i="integer"===a.type||"int32"===a.format||"int64"===a.format?1:"any";return(0,r.jsx)(Q,{type:"number",placeholder:a.description||"Enter ".concat(a.title||t),value:String(n||""),onChange:e=>{let r,s=e.target.value;if(""===s){null==l||l(t,0);return}isNaN(r="integer"===a.type||"int32"===a.format||"int64"===a.format?parseInt(s,10):parseFloat(s))||null==l||l(t,r)},required:s,step:i,min:a.minimum,max:a.maximum,className:"w-full"})}function ea(e){let{className:t,...a}=e;return(0,r.jsx)("textarea",{"data-slot":"textarea",className:d("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm resize-y",t),...a})}function er(e){let{name:t,property:a,required:s,value:n="",onChange:l}=e,i=e=>{null==l||l(t,e.target.value)},o=a["x-ui"];return"textarea"===(null==o?void 0:o.widget)?(0,r.jsx)(ea,{placeholder:a.description||"Enter ".concat(a.title||t),value:String(n||""),onChange:i,required:s,className:"w-full",rows:(null==o?void 0:o.rows)||5}):(0,r.jsx)(Q,{type:"text",placeholder:a.description||"Enter ".concat(a.title||t),value:String(n||""),onChange:i,required:s,className:"w-full"})}function es(e){let{name:t,property:a,value:n,onChange:l,required:i}=e,[o,d]=s.useState(String(n||""));return(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("label",{className:"text-sm font-medium",children:[a.title||"Time"," ",i&&(0,r.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,r.jsx)(Q,{type:"time",value:o,onChange:e=>{var a;d(a=e.target.value),null==l||l(t,a)},step:"1",className:"w-full",placeholder:"HH:MM:SS"}),a.description&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:a.description})]})}function en(e){let{name:t,property:a,required:s,value:n,onChange:l}=e;return(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:[a.title||t,s&&(0,r.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),a.description&&(0,r.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:a.description}),(()=>{switch(a.qtype_type){case"text":case"thinking":case"citation_url":return(0,r.jsx)(er,{name:t,property:a,required:s,value:n,onChange:l});case"date":return(0,r.jsx)($,{name:t,property:a,required:s,value:n,onChange:l});case"time":return(0,r.jsx)(es,{name:t,property:a,required:s,value:n,onChange:l});case"datetime":return(0,r.jsx)(Z,{name:t,property:a,required:s,value:n,onChange:l});case"boolean":return(0,r.jsx)(O,{name:t,property:a,required:s,value:n,onChange:l});case"number":case"int":case"float":return(0,r.jsx)(et,{name:t,property:a,required:s,value:n,onChange:l});case"bytes":case"file":case"citation_document":case"image":case"audio":case"video":return(0,r.jsx)(ee,{name:t,property:a,required:s,value:n,onChange:l});default:return(0,r.jsx)(u,{variant:"destructive",children:(0,r.jsxs)(m,{children:["Unknown input type:"," ",(0,r.jsx)("code",{className:"font-mono text-sm",children:a.type})]})})}})()]})}function el(e){let{requestSchema:t,onInputChange:a}=e,[n,l]=(0,s.useState)({});if(!t)return(0,r.jsx)("div",{className:"text-gray-500 dark:text-gray-400 text-sm",children:"No input parameters required for this flow."});let i=t.properties||{},o=t.required||[],d=(e,t)=>{let r={...n,[e]:t};l(r),null==a||a(r)};return 0===Object.keys(i).length?(0,r.jsx)("div",{className:"text-gray-500 dark:text-gray-400 text-sm",children:"No input parameters defined for this flow."}):(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("h5",{className:"font-medium text-gray-900 dark:text-white",children:"Inputs"}),(0,r.jsx)("div",{className:"space-y-4",children:Object.entries(i).map(e=>{let[t,a]=e;return(0,r.jsx)(en,{name:t,property:a,required:o.includes(t),value:n[t],onChange:d},t)})})]})}var ei=a(6504),eo=a(4514);function ed(e){let{children:t,theme:a="light",chatBubble:s=!1,className:n}=e,l="".concat("dark"===a?"dark ":"").concat(null!=n?n:"").trim();return(0,r.jsx)("div",{className:"".concat(s?"dark"===a?"bg-primary":"bg-muted":"bg-transparent"," rounded-lg px-3 py-2"),children:(0,r.jsx)("div",{className:l,children:(0,r.jsx)(ei.oz,{remarkPlugins:[eo.A],components:ec,children:t})})})}let ec={code:e=>{let{children:t,...a}=e;return a.className?(0,r.jsx)("pre",{className:"bg-gray-100 dark:bg-gray-800 p-2 pb-0 rounded text-xs overflow-x-auto last:mb-0 last:pb-0",children:(0,r.jsx)("code",{...a,children:t})}):(0,r.jsx)("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 py-0.5 rounded text-xs",...a,children:t})},table:e=>{let{children:t}=e;return(0,r.jsx)("div",{className:"overflow-x-auto mb-4 last:mb-0",children:(0,r.jsx)("table",{className:"min-w-full border-collapse border border-gray-300 dark:border-gray-600",children:t})})},thead:e=>{let{children:t}=e;return(0,r.jsx)("thead",{className:"bg-gray-100 dark:bg-gray-800",children:t})},tbody:e=>{let{children:t}=e;return(0,r.jsx)("tbody",{children:t})},tr:e=>{let{children:t}=e;return(0,r.jsx)("tr",{className:"border-b border-gray-200 dark:border-gray-700",children:t})},th:e=>{let{children:t}=e;return(0,r.jsx)("th",{className:"px-3 py-2 text-left text-xs font-medium text-gray-700 dark:text-gray-300 border-r border-gray-300 dark:border-gray-600 last:border-r-0",children:t})},td:e=>{let{children:t}=e;return(0,r.jsx)("td",{className:"px-3 py-2 text-xs text-gray-600 dark:text-gray-400 border-r border-gray-300 dark:border-gray-600 last:border-r-0",children:t})},h1:e=>{let{children:t}=e;return(0,r.jsx)("h1",{className:"text-xl font-bold mb-4 mt-6 text-gray-900 dark:text-gray-100 border-b border-gray-200 dark:border-gray-700 pb-2 last:mb-0 last:pb-0",children:t})},h2:e=>{let{children:t}=e;return(0,r.jsx)("h2",{className:"text-lg font-semibold mb-3 mt-5 text-gray-900 dark:text-gray-100 last:mb-0",children:t})},h3:e=>{let{children:t}=e;return(0,r.jsx)("h3",{className:"text-base font-semibold mb-2 mt-4 text-gray-800 dark:text-gray-200 last:mb-0",children:t})},h4:e=>{let{children:t}=e;return(0,r.jsx)("h4",{className:"text-sm font-medium mb-2 mt-3 text-gray-700 dark:text-gray-300 last:mb-0",children:t})},ul:e=>{let{children:t}=e;return(0,r.jsx)("ul",{className:"mb-3 pl-0 space-y-1 text-gray-800 dark:text-gray-200 last:mb-0",children:t})},ol:e=>{let{children:t}=e;return(0,r.jsx)("ol",{className:"mb-3 pl-0 space-y-1 text-gray-800 dark:text-gray-200 last:mb-0",children:t})},li:e=>{let{children:t}=e;return(0,r.jsxs)("li",{className:"flex items-start ml-4",children:[(0,r.jsx)("span",{className:"mr-2 text-gray-500 dark:text-gray-400 select-none",children:"•"}),(0,r.jsx)("span",{className:"flex-1",children:t})]})},p:e=>{let{children:t}=e;return(0,r.jsx)("p",{className:"mb-3 text-gray-800 dark:text-gray-200 leading-relaxed last:mb-0",children:t})},strong:e=>{let{children:t}=e;return(0,r.jsx)("strong",{className:"font-semibold text-gray-900 dark:text-gray-100",children:t})},blockquote:e=>{let{children:t}=e;return(0,r.jsx)("blockquote",{className:"border-l-4 border-gray-300 dark:border-gray-600 pl-4 italic mb-3 text-gray-700 dark:text-gray-300 last:mb-0",children:t})}};function eu(e){var t;let{flow:a}=e,n=a.endpoints.stream,l=e7(a.id),i=a.description,o=a.input_schema,[d,c]=(0,s.useState)({}),[x,g]=(0,s.useState)(null),h="".concat(w.getBaseUrl().replace(/\/$/,"")).concat(n),{completion:p,complete:f,isLoading:b,error:y}=(0,S.sQ)({api:h}),v=(0,s.useCallback)(()=>{var e,t;if("question"in d)return String(null!=(e=d.question)?e:"");let a=Object.keys(d);return 1===a.length?String(null!=(t=d[a[0]])?t:""):""},[d]),N=async()=>{g(null);let e=v().trim();if(!e)return void g("Provide a 'question' input (or a single input field).");try{await f(e)}catch(e){g(e instanceof j||e instanceof Error?e.message:"Streaming failed")}};return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"border-b pb-4",children:[(0,r.jsx)("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:l}),(0,r.jsxs)("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:[h," • POST (stream)"]}),i&&(0,r.jsx)("p",{className:"text-gray-600 dark:text-gray-300 mt-2",children:i})]}),(0,r.jsx)(el,{requestSchema:o||null,onInputChange:e=>{c(e)}}),(0,r.jsxs)("div",{children:[(x||y)&&(0,r.jsx)(u,{variant:"destructive",className:"mb-4",children:(0,r.jsx)(m,{className:"whitespace-pre-line",children:null!=(t=x||(null==y?void 0:y.message))?t:"Error"})}),p&&(0,r.jsx)(C.FK,{className:"flex-1 min-h-0",children:(0,r.jsx)(ed,{chatBubble:!0,children:p})})]}),(0,r.jsx)("div",{className:"mt-6 pt-4 border-t flex gap-2",children:(0,r.jsx)(U,{disabled:b,onClick:N,children:b?"Streaming...":"Execute Flow"})})]})}var ex=a(2507),em=a(5071),eg=a(8192),eh=a(4309),ep=a(4285),ef=a(5299),eb=a(8085),ey=a(508),ev=a(5700);function ej(e){let{className:t,...a}=e;return(0,r.jsx)(ev.bL,{"data-slot":"avatar",className:d("relative flex size-8 shrink-0 overflow-hidden rounded-full",t),...a})}function eN(e){let{className:t,...a}=e;return(0,r.jsx)(ev.H4,{"data-slot":"avatar-fallback",className:d("bg-muted flex size-full items-center justify-center rounded-full",t),...a})}function ew(e){let{mime:t,bytesBase64:a}=e,[n,l]=(0,s.useState)(null);return((0,s.useEffect)(()=>{if(!a)return void l(null);try{let e=function(e,t){let a=atob(e),r=a.length,s=new Uint8Array(r);for(let e=0;e<r;e++)s[e]=a.charCodeAt(e);return new Blob([s],{type:t})}(a,t),r=URL.createObjectURL(e);return l(r),()=>{URL.revokeObjectURL(r)}}catch(e){l(null)}},[a]),n)?(0,r.jsx)("div",{children:(0,r.jsx)("audio",{controls:!0,src:n,preload:"metadata"})}):(0,r.jsx)("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"No audio data"})}function ek(e){let{mime:t,fileName:a,bytesBase64:n}=e,[l,i]=(0,s.useState)(null);return(0,s.useEffect)(()=>{try{let e=atob(n),a=e.length,r=new Uint8Array(a);for(let t=0;t<a;t+=1)r[t]=e.charCodeAt(t);let s=new Blob([r],{type:t}),l=URL.createObjectURL(s);return i(l),()=>URL.revokeObjectURL(l)}catch(e){i(null)}},[t,n]),(0,r.jsxs)("div",{className:"group relative flex w-full max-w-sm flex-col overflow-hidden rounded-lg border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-900",children:[l?t.startsWith("image/")?(0,r.jsx)("img",{src:l,alt:a,className:"h-48 w-full object-cover",loading:"lazy"}):t.startsWith("video/")?(0,r.jsx)("video",{src:l,controls:!0,className:"h-48 w-full bg-black object-contain"}):"application/pdf"===t||t.startsWith("text/")?(0,r.jsx)("iframe",{title:a,src:l,className:"h-48 w-full",loading:"lazy"}):(0,r.jsxs)("div",{className:"flex h-48 w-full items-center justify-center text-xs text-gray-500 dark:text-gray-400",children:["No inline preview for ",t]}):(0,r.jsx)("div",{className:"p-4 text-sm text-gray-500 dark:text-gray-400",children:"Unable to preview file."}),(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2 px-3 py-2",children:[(0,r.jsx)("span",{className:"truncate text-xs font-medium text-gray-700 dark:text-gray-300",children:a}),l&&(0,r.jsx)("a",{href:l,download:a,className:"rounded bg-blue-600 px-2 py-1 text-xs font-semibold text-white hover:bg-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-400","aria-label":"Download ".concat(a),children:"Download"})]})]})}function eS(e){let{mime:t,bytesBase64:a}=e,[n,l]=(0,s.useState)(null);return((0,s.useEffect)(()=>{if(!a||!a)return void l(null);let e=function(e,t){let a=atob(e),r=a.length,s=new Uint8Array(r);for(let e=0;e<r;e++)s[e]=a.charCodeAt(e);return new Blob([s],{type:t})}(a,t),r=URL.createObjectURL(e);return l(r),()=>{URL.revokeObjectURL(r)}},[a,t]),n)?(0,r.jsx)("video",{controls:!0,src:n,preload:"metadata"}):(0,r.jsx)("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"No video data"})}var eC=a(5740),e_=a(2108);function ez(e){let{reasoningContent:t,isOpen:a=!1}=e,[n,l]=(0,s.useState)(a);return((0,s.useEffect)(()=>{l(a)},[a]),t&&""!==t.trim())?(0,r.jsxs)("div",{className:"text-sm",children:[(0,r.jsxs)("button",{type:"button",role:"button",onClick:()=>l(e=>!e),className:"flex items-center gap-1 py-2 text-left hover:cursor-pointer hover:opacity-90 transition-colors focus:outline-none active:opacity-80","aria-expanded":n,"aria-controls":"thinking-panel-content",children:[(0,r.jsx)(eC.A,{className:"h-4 w-4 text-primary","aria-hidden":"true"}),(0,r.jsx)("span",{className:"font-medium select-none",children:n?"Hide thinking":"Show thinking"}),n?(0,r.jsx)(e_.A,{className:"h-4 w-4 opacity-70","aria-hidden":"true"}):(0,r.jsx)(M.A,{className:"h-4 w-4 opacity-70","aria-hidden":"true"})]}),n&&(0,r.jsxs)("div",{className:"flex pb-3 pt-1 pr-3",id:"thinking-panel-content",children:[(0,r.jsx)("div",{"aria-hidden":"true",className:"w-px bg-neutral-400/40 rounded-sm"}),(0,r.jsx)("div",{className:"flex-1",children:(0,r.jsx)(ed,{children:t})})]})]}):null}function eU(e){let{url:t}=e;return t?(0,r.jsx)("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"text-sm underline underline-offset-4 text-primary hover:text-primary/80 focus:outline-none focus:ring-2 focus:ring-ring rounded-sm","aria-label":"Citation source: ".concat(t),children:t}):(0,r.jsx)("span",{className:"text-sm text-muted-foreground italic","aria-label":"No citation URL provided",children:"No citation URL"})}let eR={date:new Intl.DateTimeFormat(void 0,{year:"numeric",month:"short",day:"2-digit"}),weekday:new Intl.DateTimeFormat(void 0,{weekday:"short"}),time:new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})};function eA(e){let{value:t,time:a,date:s}=e,n=!!a&&!s&&/^\d{2}:\d{2}(:\d{2})?$/.test(t),l=n?/^\d{2}:\d{2}$/.test(t)?"".concat(t,":00"):t:/T\d{2}:\d{2}$/.test(t)?"".concat(t,":00"):t,i=n?null:new Date(l);return(0,r.jsxs)("div",{className:"group inline-flex items-baseline gap-2 rounded-md border border-neutral-200 bg-neutral-50 px-3 py-2 text-sm text-neutral-700 shadow-sm transition hover:bg-neutral-100 dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-200 dark:hover:bg-neutral-700","aria-label":"Date time iso",children:[!n&&s&&i&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"font-semibold tracking-wide text-neutral-900 dark:text-neutral-100",children:eR.weekday.format(i)}),(0,r.jsx)("span",{className:"text-neutral-600 dark:text-neutral-300",children:eR.date.format(i)})]}),a&&(0,r.jsxs)("span",{className:"text-neutral-500 dark:text-neutral-400",children:["@ ",n?l:eR.time.format(i)]})]})}function eO(e){let{fileName:t,mime:a,bytesBase64:s}=e,n=s.replace(/^data:[^;]+;base64,/,"").replace(/\s+/g,"").replace(/[^A-Za-z0-9+/=]/g,""),l=0===n.length||n.length%4!=0,i=n.endsWith("==")?2:+!!n.endsWith("="),o=l?0:3*n.length/4-i,d=l?"Invalid":o<1024?"".concat(o," B"):o<1048576?"".concat((o/1024).toFixed(1)," KB"):"".concat((o/1048576).toFixed(2)," MB");return(0,r.jsxs)("div",{className:"group rounded border border-neutral-200 dark:border-neutral-700 bg-neutral-50 dark:bg-neutral-900 p-3 text-xs flex flex-col gap-2",title:"".concat(t," (").concat(d,")"),"aria-label":"Bytes content ".concat(t," size ").concat(d),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{className:"font-medium text-neutral-700 dark:text-neutral-300",children:t}),(0,r.jsx)("button",{type:"button",onClick:()=>{if(!l)try{let e=atob(n),r=Array(e.length);for(let t=0;t<e.length;t+=1)r[t]=e.charCodeAt(t);let s=new Blob([new Uint8Array(r)],{type:a}),l=URL.createObjectURL(s),i=document.createElement("a");i.href=l,i.download=t||"data.bin",i.click(),URL.revokeObjectURL(l)}catch(e){}},disabled:l,className:"px-2 py-1 rounded transition text-neutral-800 dark:text-neutral-100 ".concat(l?"cursor-not-allowed opacity-50 bg-neutral-200 dark:bg-neutral-700":"bg-neutral-200 dark:bg-neutral-700 hover:bg-neutral-300 dark:hover:bg-neutral-600"),"aria-label":l?"Invalid base64":"Download bytes file",children:l?"Invalid":"Download"})]}),(0,r.jsxs)("div",{className:"font-mono text-neutral-600 dark:text-neutral-400 break-all",children:[n.slice(0,80),n.length>80?"…":""]}),(0,r.jsxs)("div",{className:"text-neutral-500 dark:text-neutral-400",children:["MIME: ",a]}),(0,r.jsxs)("div",{className:"text-neutral-500 dark:text-neutral-400",children:["Size: ",d]})]})}function eL(e){let{fileName:t,mime:a,bytesBase64:s}=e,n=("string"==typeof s?s:"").replace(/^data:[^;]+;base64,/,"").replace(/\s+/g,"").replace(/[^A-Za-z0-9+/=]/g,""),l=/^image\//.test(a),i=(n.match(/=/g)||[]).length,o=n.length>0?3*n.length/4-i:0,d=o<1024?"".concat(o," B"):o<1048576?"".concat((o/1024).toFixed(1)," KB"):"".concat((o/1048576).toFixed(2)," MB"),c=!l||0===n.length||n.length%4!=0,u=c?"":"data:".concat(a,";base64,").concat(n);return c?(0,r.jsxs)("div",{className:"inline-flex flex-col gap-1 rounded border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700","aria-label":"Invalid image data",children:[(0,r.jsx)("span",{className:"font-semibold",children:"Invalid image"}),(0,r.jsxs)("span",{children:["MIME: ",a||"(none)"]})]}):(0,r.jsxs)("div",{className:'group relative flex w-full max-w-xs flex-col items-center gap-2 rounded-md border border-neutral-200 bg-white p-3 shadow-sm transition hover:shadow-md dark:border-neutral-700 dark:bg-neutral-900"',"aria-label":"Image ".concat(t," size ").concat(d),title:"".concat(t," (").concat(d,")"),children:[(0,r.jsx)("div",{className:"relative flex items-center justify-center w-full",children:(0,r.jsx)("img",{src:u,alt:t||"image",className:"h-auto max-h-64 w-auto max-w-full rounded-md object-contain",loading:"lazy"})}),(0,r.jsxs)("div",{className:"flex w-full items-center justify-between text-[11px] text-neutral-600 dark:text-neutral-400",children:[(0,r.jsx)("span",{className:"truncate max-w-[60%]",title:t,children:t}),(0,r.jsx)("span",{children:d})]}),(0,r.jsx)("button",{type:"button",onClick:()=>{if(!c)try{let e=atob(n),r=new Uint8Array(e.length);for(let t=0;t<e.length;t+=1)r[t]=e.charCodeAt(t);let s=new Blob([r],{type:a}),l=URL.createObjectURL(s),i=document.createElement("a");i.href=l,i.download=t||"image",i.click(),URL.revokeObjectURL(l)}catch(e){}},className:"mt-1 w-full rounded bg-neutral-200 px-2 py-1 text-xs font-medium text-neutral-800 transition hover:bg-neutral-300 dark:bg-neutral-700 dark:text-neutral-100 dark:hover:bg-neutral-600","aria-label":"Download image",children:"Download"})]})}var eE=function(e){return e.Text="text",e.Reasoning="reasoning",e}(eE||{});function eT(e){var t,a,s,n;let{message:l,isStreaming:i=!1}=e,o="user"===l.role,d=eF(l,eE.Reasoning),c=eF(l,eE.Text),u=l.files||l.experimental_attachments||(null!=(s=null==(t=l.parts)?void 0:t.filter(e=>"file"===e.type))?s:[]),x=new Set(["file"]),m=function(e,t,a){if(!a)return null;if(null==t?void 0:t.statusMessage)return t.statusMessage;if(!e||0===e.length)return"Processing...";let r="Processing...";for(let t of e)switch(t.type){case"step-start":r="Starting ... ";break;case"finish-step":r="Step completed";break;case"reasoning":r="Thinking...";break;case"text":r="Generating response...";break;default:if(t.type.startsWith("tool-")){let e=t.type.replace("tool-","");if("state"in t)switch(t.state){case"input-available":r="Calling ".concat(e,"...");break;case"output-available":r="Tool ".concat(e," returned successfully");break;default:r="Using ".concat(e,"...")}else r="Using ".concat(e,"...")}}return r}((null!=(n=l.parts)?n:[]).filter(e=>!x.has(e.type)),l.metadata,i);return(0,r.jsxs)("div",{className:"flex gap-3 w-full ".concat(o?"justify-end":"justify-start"),children:[!o&&(0,r.jsx)(ej,{className:"h-8 w-8 flex-shrink-0",children:(0,r.jsx)(eN,{children:(0,r.jsx)(eg.A,{className:"h-4 w-4"})})}),(0,r.jsxs)("div",{className:"flex-1 max-w-[75%] space-y-2",children:[(0,r.jsx)("div",{className:"min-h-[1.5rem] flex items-center",children:m&&(0,r.jsxs)("div",{className:"text-xs italic text-muted-foreground bg-muted/30 px-2 py-1 rounded transition-all duration-200",children:[m,(null==(a=l.metadata)?void 0:a.step_id)&&(0,r.jsxs)("span",{className:"opacity-70 ml-2",children:["(Step: ",l.metadata.step_id,")"]})]})}),d&&(0,r.jsx)(ez,{reasoningContent:d,isOpen:!c}),c&&(0,r.jsx)(ed,{chatBubble:!0,theme:o?"dark":"light",children:c}),u.map((e,t)=>(0,r.jsx)(eB,{mediaType:e.mediaType,filename:e.filename,url:e.url,size:e.size},"".concat(e.filename,"-").concat(t)))]}),o&&(0,r.jsx)(ej,{className:"h-8 w-8 flex-shrink-0",children:(0,r.jsx)(eN,{children:(0,r.jsx)(ey.A,{className:"h-4 w-4"})})})]})}function eF(e,t){let{content:a,parts:r}=e;if(!(null==r?void 0:r.length))return a||"";let s=r.filter(e=>e.type===t);return 0===s.length&&a?a:s.map(e=>e.text).join("")}function eB(e){let{mediaType:t,filename:a,url:s,size:n}=e;if(!s)return null;let l=null==t?void 0:t.startsWith("image/");return(0,r.jsx)("div",{className:"border rounded p-2 bg-background",children:l?(0,r.jsx)("img",{src:s,alt:a||"Attached image",className:"max-w-full h-auto rounded",style:{maxHeight:"200px"}}):(0,r.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,r.jsx)(ep.A,{className:"h-4 w-4"}),(0,r.jsx)("span",{children:a||"Attachment"}),t&&(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",t,")"]}),n&&(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:["- ",eM(n)]})]})})}let eM=e=>"".concat((e/1048576).toFixed(1)," MB");var eD=a(5229);function eq(e){let{files:t,onRemoveFile:a,onClearAll:s}=e;return(0,r.jsxs)("div",{className:"mb-3 p-2 bg-muted rounded",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,r.jsxs)("span",{className:"text-sm font-medium",children:["Attachments (",t.length,")"]}),(0,r.jsx)(U,{type:"button",variant:"ghost",size:"sm",onClick:s,className:"h-6 px-2",children:"Clear all"})]}),(0,r.jsx)("div",{className:"space-y-1",children:t.map((e,t)=>{let s;return(0,r.jsxs)("div",{className:"flex items-center justify-between bg-background rounded p-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,r.jsx)(ep.A,{className:"h-4 w-4 flex-shrink-0"}),(0,r.jsx)("span",{className:"text-sm truncate",children:e.filename}),(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",(s=e.size||0,"".concat((s/1048576).toFixed(1)," MB")),")"]})]}),(0,r.jsx)(U,{type:"button",variant:"ghost",size:"sm",onClick:()=>a(t),className:"h-6 w-6 p-0 flex-shrink-0","aria-label":"Remove ".concat(e.filename),children:(0,r.jsx)(eD.A,{className:"h-3 w-3"})})]},"".concat(e.filename,"-").concat(t))})})]})}function eI(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"card",className:d("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",t),...a})}function eP(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"card-header",className:d("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...a})}function eW(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"card-title",className:d("leading-none font-semibold",t),...a})}function eH(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"card-description",className:d("text-muted-foreground text-sm",t),...a})}function eJ(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"card-content",className:d("px-6",t),...a})}function eK(e){let{className:t,children:a,...s}=e;return(0,r.jsxs)(C.bL,{"data-slot":"scroll-area",className:d("relative",t),...s,children:[(0,r.jsx)(C.LM,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:a}),(0,r.jsx)(eV,{}),(0,r.jsx)(C.OK,{})]})}function eV(e){let{className:t,orientation:a="vertical",...s}=e;return(0,r.jsx)(C.VM,{"data-slot":"scroll-area-scrollbar",orientation:a,className:d("flex touch-none p-px transition-colors select-none","vertical"===a&&"h-full w-2.5 border-l border-l-transparent","horizontal"===a&&"h-2.5 flex-col border-t border-t-transparent",t),...s,children:(0,r.jsx)(C.lr,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}function eG(e){let{flow:t}=e,a=t.endpoints.stream,n=e7(t.id),l=t.description,[i,o]=(0,s.useState)(()=>(0,em.$C)()),[d,c]=(0,s.useState)(""),{files:u,fileError:x,handleFileSelect:m,removeFile:g,clearFiles:h,reset:p,fileInputRef:f}=function(){let[e,t]=(0,s.useState)([]),[a,r]=(0,s.useState)(null),n=(0,s.useRef)(null),l=(0,s.useCallback)(async e=>{let a=e.target.files;if(a){r(null);try{let e=await Promise.all(Array.from(a).map(async e=>{let t=await new Promise((t,a)=>{let r=new FileReader;r.onload=()=>t(r.result),r.onerror=()=>a(Error("File read error")),r.readAsDataURL(e)});return{type:"file",mediaType:e.type||"application/octet-stream",filename:e.name,url:t,size:e.size}}));t(t=>[...t,...e])}catch(t){let e=t instanceof Error?t.message:"Unknown error";r("Failed to process files: ".concat(e))}}},[]),i=(0,s.useCallback)(e=>{t(t=>t.filter((t,a)=>a!==e))},[]),o=(0,s.useCallback)(()=>{t([]),n.current&&(n.current.value="")},[]),d=(0,s.useCallback)(()=>{o(),r(null)},[o]);return{files:e,fileError:a,handleFileSelect:l,removeFile:i,clearFiles:o,reset:d,fileInputRef:n}}(),[b,y]=(0,s.useState)(null),v=(0,s.useRef)(null),j=(0,s.useRef)(null),N=(0,s.useMemo)(()=>new ex.rL({api:"".concat(w.getBaseUrl().replace(/\/$/,"")).concat(a)}),[a]),{messages:k,sendMessage:C,status:_,error:z,setMessages:R}=(0,S.Y_)({id:i,transport:N,onFinish:()=>{y(null)}}),A="streaming"===_||"submitted"===_,O=("ready"===_||"error"===_)&&(d.trim()||u.length>0),L=(0,s.useCallback)(()=>{var e;null==(e=j.current)||e.scrollIntoView({behavior:"smooth"})},[]);(0,s.useEffect)(()=>{L()},[k,L]),(0,s.useEffect)(()=>{z&&b&&(c(b.input),y(null),R(e=>((e=e.filter(e=>e.parts.length>0)).length>0&&e.pop(),e)))},[z,b]),(0,s.useEffect)(()=>{var e;"ready"===_&&(null==(e=v.current)||e.focus())},[_]);let E=(0,s.useCallback)(()=>{c(""),p()},[p]),T=(0,s.useCallback)(()=>{o((0,em.$C)()),R([]),y(null),E()},[R,E]),F=(0,s.useCallback)(async e=>{if(e.preventDefault(),!O)return;let t=d.trim(),a=[...u];y({input:t,files:a}),E(),a.length>0?await C({role:"user",parts:[{type:"text",text:t||"[Files attached]"},...a.map(e=>({type:"file",mediaType:e.mediaType,filename:e.filename,url:e.url,size:e.size}))]}):await C({text:t})},[O,d,u,C,E]);return(0,r.jsxs)(eI,{className:"w-full max-w-4xl mx-auto h-[calc(100vh-12rem)] flex flex-col",children:[(0,r.jsx)(eP,{className:"flex-shrink-0",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)(eW,{className:"flex items-center gap-2",children:[(0,r.jsx)(eg.A,{className:"h-5 w-5"}),n]}),l&&(0,r.jsx)(eH,{children:l})]}),(0,r.jsxs)(U,{variant:"outline",size:"sm",onClick:T,disabled:A,className:"flex items-center gap-2",children:[(0,r.jsx)(eh.A,{className:"h-4 w-4"}),"New Conversation"]})]})}),(0,r.jsxs)(eJ,{className:"flex-1 flex flex-col p-0 min-h-0",children:[(0,r.jsx)(eK,{className:"flex-1 min-h-0",children:(0,r.jsxs)("div",{className:"space-y-4 p-4",children:[0===k.length?(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center min-h-[400px] text-center text-muted-foreground",children:[(0,r.jsx)(eg.A,{className:"h-12 w-12 mb-4 opacity-50"}),(0,r.jsx)("p",{children:"Start a conversation!"})]}):k.map((e,t)=>(0,r.jsx)(eT,{message:e,isStreaming:"streaming"===_&&t===k.length-1},e.id)),(0,r.jsx)("div",{ref:j})]})}),(0,r.jsxs)("div",{className:"border-t p-4",children:[z&&(0,r.jsxs)("div",{className:"mb-3 p-2 bg-destructive/10 text-destructive text-sm rounded",children:["Error: ",z.message]}),x&&(0,r.jsx)("div",{className:"mb-3 p-2 bg-destructive/10 text-destructive text-sm rounded",children:x}),u.length>0&&(0,r.jsx)(eq,{files:u,onRemoveFile:g,onClearAll:h}),(0,r.jsxs)("form",{onSubmit:F,className:"flex gap-2",children:[(0,r.jsx)("input",{ref:f,type:"file",multiple:!0,onChange:m,className:"hidden",accept:"*"}),(0,r.jsx)(U,{type:"button",variant:"outline",size:"icon",onClick:()=>{var e;return null==(e=f.current)?void 0:e.click()},disabled:A,"aria-label":"Attach file",children:(0,r.jsx)(ep.A,{className:"h-4 w-4"})}),(0,r.jsx)(Q,{ref:v,value:d,onChange:e=>c(e.target.value),onKeyDown:e=>{"Enter"===e.key&&!e.shiftKey&&O&&(e.preventDefault(),F(e))},disabled:A,placeholder:"Type your message... (Enter to send, Shift+Enter for new line)",className:"flex-1",autoFocus:!0}),(0,r.jsx)(U,{type:"submit",disabled:!O,size:"icon","aria-label":"Send message",children:A?(0,r.jsx)(ef.A,{className:"h-4 w-4 animate-spin"}):(0,r.jsx)(eb.A,{className:"h-4 w-4"})})]})]})]})]})}var e$=a(1456),eQ=a(1669);function eZ(e){let{name:t,property:a,value:s}=e;return(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:a.title||t}),a.description&&(0,r.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:a.description}),(()=>{switch(a.qtype_type){case"text":return(0,r.jsx)(ed,{chatBubble:!0,children:String(s)});case"boolean":return(0,r.jsx)("div",{className:"bg-gray-50 dark:bg-gray-900 p-3 rounded",children:(0,r.jsx)("p",{className:"text-gray-800 dark:text-gray-200",children:String(s)})});case"number":case"int":case"float":return(0,r.jsx)("div",{className:"bg-gray-50 dark:bg-gray-900 p-3 rounded",children:(0,r.jsx)("p",{className:"text-gray-800 dark:text-gray-200 font-mono",children:String(s)})});case"video":{let{mime:e,bytes_base64:t}=JSON.parse(String(s));return(0,r.jsx)(eS,{mime:e,bytesBase64:t})}case"image":{let{mime:e,filename:t,bytes_base64:a}=JSON.parse(String(s));return(0,r.jsx)(eL,{mime:e,fileName:t,bytesBase64:a})}case"audio":{let{mime:e,bytes_base64:t}=JSON.parse(String(s));return(0,r.jsx)(ew,{mime:e,bytesBase64:t})}case"file":case"citation_document":{let{mime:e,filename:t,bytes_base64:a}=JSON.parse(String(s));return(0,r.jsx)(ek,{fileName:t,mime:e,bytesBase64:a})}case"thinking":return(0,r.jsx)(ez,{reasoningContent:String(s)});case"citation_url":return(0,r.jsx)(eU,{url:String(s)});case"datetime":return(0,r.jsx)(eA,{value:String(s),date:!0,time:!0});case"date":return(0,r.jsx)(eA,{value:String(s),date:!0});case"time":return(0,r.jsx)(eA,{value:String(s),time:!0});case"bytes":{let{mime:e,filename:t,bytes_base64:a}=JSON.parse(String(s));return(0,r.jsx)(eO,{fileName:t,mime:e,bytesBase64:a})}default:return(0,r.jsx)(u,{variant:"destructive",children:(0,r.jsxs)(m,{children:["Unsupported response type:"," ",(0,r.jsx)("code",{className:"font-mono text-sm",children:a.qtype_type||a.type})]})})}})()]})}function eX(e){let{responseSchema:t,responseData:a}=e;if(!a)return(0,r.jsx)("div",{className:"text-gray-500 dark:text-gray-400 text-sm",children:"No response data to display"});if(!(null==t?void 0:t.properties))return(0,r.jsx)("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded",children:(0,r.jsx)("pre",{className:"text-xs text-gray-800 dark:text-gray-200 overflow-x-auto whitespace-pre-wrap",children:JSON.stringify(a,null,2)})});let s=a&&"object"==typeof a?a.outputs||a:a||{};return(0,r.jsx)("div",{className:"space-y-4",children:t.properties&&Object.entries(t.properties).map(e=>{let[t,a]=e,n=s[t];return null==n?null:(0,r.jsx)(eZ,{name:t,property:a,value:n},t)})})}var eY=a(2944),e0=a(2273),e4=a(9867),e1=a(9349),e2=a.n(e1);function e5(e,t){if(null==e)return"";try{if(t&&["image","video","audio","file","citation_document","bytes"].includes(t))return JSON.parse(String(e)).filename||"[".concat(t,"]")}catch(e){}return"object"==typeof e?JSON.stringify(e):String(e)}function e3(e){let{responseSchema:t,outputs:a}=e,[n,l]=(0,s.useState)(""),[i,o]=(0,s.useState)([]),d=(0,s.useMemo)(()=>a.map(e=>e&&"object"==typeof e?e.outputs||e:e||{}),[a]),c=(0,s.useMemo)(()=>(null==t?void 0:t.properties)?Object.entries(t.properties).map(e=>{let[t,a]=e;return{accessorKey:t,header:a.title||t,cell:e=>{let{row:r}=e;return e5(r.original[t],a.qtype_type)}}}):[],[t]),u=(0,eY.N4)({data:d,columns:c,state:{sorting:i,globalFilter:n},onSortingChange:o,onGlobalFilterChange:l,getCoreRowModel:(0,e0.HT)(),getSortedRowModel:(0,e0.h5)(),getFilteredRowModel:(0,e0.hM)()});return a&&0!==a.length?(null==t?void 0:t.properties)&&0!==c.length?(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,r.jsx)(Q,{placeholder:"Search all columns...",value:n,onChange:e=>l(e.target.value),className:"max-w-sm"}),(0,r.jsxs)(U,{onClick:()=>{let e=u.getFilteredRowModel().rows.map(e=>{let a={};return c.forEach(r=>{var s;let n=r.accessorKey,l=null==t||null==(s=t.properties)?void 0:s[n];a[String(r.header)]=e5(e.original[n],null==l?void 0:l.qtype_type)}),a}),a=new Blob([e2().unparse(e)],{type:"text/csv;charset=utf-8;"}),r=document.createElement("a"),s=URL.createObjectURL(a),n=new Date().toISOString().split("T")[0];r.setAttribute("href",s),r.setAttribute("download","flow-results-".concat(n,".csv")),r.style.visibility="hidden",document.body.appendChild(r),r.click(),document.body.removeChild(r)},variant:"outline",size:"sm",children:[(0,r.jsx)(e4.A,{className:"mr-2 h-4 w-4"}),"Download CSV"]})]}),(0,r.jsx)("div",{className:"border rounded-lg overflow-hidden",children:(0,r.jsx)("div",{className:"overflow-auto",style:{maxHeight:"400px"},children:(0,r.jsxs)("table",{className:"w-full text-sm",children:[(0,r.jsx)("thead",{className:"bg-gray-50 dark:bg-gray-900 sticky top-0",children:u.getHeaderGroups().map(e=>(0,r.jsx)("tr",{children:e.headers.map(e=>{var t;return(0,r.jsx)("th",{className:"px-4 py-2 text-left font-medium cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800",onClick:e.column.getToggleSortingHandler(),children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,eY.Kv)(e.column.columnDef.header,e.getContext()),null!=(t=({asc:" \uD83D\uDD3C",desc:" \uD83D\uDD3D"})[e.column.getIsSorted()])?t:null]})},e.id)})},e.id))}),(0,r.jsx)("tbody",{children:u.getRowModel().rows.map(e=>(0,r.jsx)("tr",{className:"border-t hover:bg-gray-50 dark:hover:bg-gray-900",children:e.getVisibleCells().map(e=>(0,r.jsx)("td",{className:"px-4 py-2",children:(0,eY.Kv)(e.column.columnDef.cell,e.getContext())},e.id))},e.id))})]})})}),(0,r.jsxs)("div",{className:"text-sm text-muted-foreground",children:[u.getFilteredRowModel().rows.length," row(s) total"]})]}):(0,r.jsx)("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded",children:(0,r.jsx)("pre",{className:"text-xs text-gray-800 dark:text-gray-200 overflow-x-auto whitespace-pre-wrap",children:JSON.stringify(a,null,2)})}):(0,r.jsx)("div",{className:"text-gray-500 dark:text-gray-400 text-sm",children:"No response data to display"})}function e6(e){let{flow:t}=e,a=t.endpoints.rest,n=e7(t.id),l=t.description,i=t.input_schema,[o,d]=(0,s.useState)({}),[c,x]=(0,s.useState)(!1),[g,h]=(0,s.useState)(null),[p,f]=(0,s.useState)(null),[b,y]=(0,s.useState)(!0),[v,N]=(0,s.useState)(()=>"table"===localStorage.getItem("flowResponseViewMode")?"table":"card");(0,s.useEffect)(()=>{(null==g?void 0:g.outputs)&&(localStorage.getItem("flowResponseViewMode")||N(g.outputs.length>5?"table":"card"))},[null==g?void 0:g.outputs]);let k=e=>{N(e),localStorage.setItem("flowResponseViewMode",e)},S=e=>{d(e)},C=async()=>{y(!1),x(!0),f(null),h(null);try{let e=await w.executeFlow(a,o);h(e)}catch(e){e instanceof j?f(e.message):f(e instanceof Error?e.message:"An unknown error occurred")}finally{x(!1)}};return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"border-b pb-4",children:[(0,r.jsx)("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:n}),(0,r.jsxs)("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:[a," • POST"]}),l&&(0,r.jsx)("p",{className:"text-gray-600 dark:text-gray-300 mt-2",children:l})]}),b&&(0,r.jsx)(el,{requestSchema:i||null,onInputChange:S}),b&&(0,r.jsx)("div",{className:"mt-6 pt-4 border-t",children:(0,r.jsx)(U,{disabled:c||!Object.keys(o).length,onClick:C,children:"Execute Flow"})}),(0,r.jsxs)("div",{children:[c&&!b&&(0,r.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,r.jsx)("div",{className:"text-gray-500 dark:text-gray-400",children:"Executing..."})}),p&&(0,r.jsx)(u,{variant:"destructive",className:"mb-4",children:(0,r.jsx)(m,{children:(0,r.jsxs)("div",{className:"whitespace-pre-line",children:[(0,r.jsx)("span",{className:"font-medium",children:"Error:"}),(0,r.jsx)("br",{}),p]})})}),g&&(0,r.jsxs)("div",{className:"space-y-4",children:[g.errors&&g.errors.length>0&&(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("h4",{className:"text-sm font-semibold text-red-600 dark:text-red-400",children:["Errors (",g.errors.length,")"]}),g.errors.map((e,t)=>(0,r.jsx)(u,{variant:"destructive",children:(0,r.jsx)(m,{children:(0,r.jsx)("pre",{className:"text-xs whitespace-pre-wrap",children:JSON.stringify(e,null,2)})})},t))]}),g.outputs&&g.outputs.length>0&&!b&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("h4",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300",children:["Outputs (",g.outputs.length,")"]}),(0,r.jsxs)("div",{className:"inline-flex rounded-md shadow-sm",role:"group",children:[(0,r.jsxs)(U,{variant:"card"===v?"default":"outline",size:"sm",onClick:()=>k("card"),className:"rounded-r-none",children:[(0,r.jsx)(e$.A,{className:"h-4 w-4 mr-2"}),"Cards"]}),(0,r.jsxs)(U,{variant:"table"===v?"default":"outline",size:"sm",onClick:()=>k("table"),className:"rounded-l-none",children:[(0,r.jsx)(eQ.A,{className:"h-4 w-4 mr-2"}),"Table"]})]})]}),"card"===v?(0,r.jsx)("div",{className:"space-y-4",children:g.outputs.map((e,a)=>(0,r.jsxs)("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[g.outputs.length>1&&(0,r.jsxs)("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-2",children:["Result ",a+1]}),(0,r.jsx)(eX,{responseSchema:t.output_schema,responseData:e})]},a))}):(0,r.jsx)(e3,{responseSchema:t.output_schema,outputs:g.outputs})]}),(!g.outputs||0===g.outputs.length)&&(!g.errors||0===g.errors.length)&&(0,r.jsx)("div",{className:"text-gray-500 dark:text-gray-400 text-sm",children:"No results returned"})]})]}),!b&&(0,r.jsx)("div",{className:"mt-6 pt-4 border-t",children:(0,r.jsx)(U,{disabled:c,onClick:()=>{y(!0),S({})},children:"Reset"})})]})}function e8(e){let{flows:t}=e;return(0,r.jsx)(p,{className:"grid w-full",style:{gridTemplateColumns:"repeat(".concat(t.length,", minmax(0, 1fr))")},children:t.map(e=>{let{id:t}=e;return(0,r.jsx)(f,{value:t,className:"text-sm",children:e7(t)},t)})})}function e7(e){return e.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function e9(){var e;let{flows:t,isLoading:a,error:s}=function(){let{data:e,error:t,isLoading:a,mutate:r}=(0,y.Ay)("/flows",()=>w.getFlows(),{refreshInterval:3e5,revalidateOnFocus:!1,errorRetryCount:3,errorRetryInterval:5e3});return{flows:e,isLoading:a,error:t,refresh:r}}();return a?(0,r.jsx)("p",{className:"text-muted-foreground text-sm",children:"Loading flows..."}):s?(0,r.jsxs)(u,{variant:"destructive",children:[(0,r.jsx)(n.A,{className:"h-4 w-4"}),(0,r.jsx)(x,{children:"Failed to load flows"}),(0,r.jsx)(m,{children:s.message})]}):t&&t.length?(0,r.jsxs)(h,{defaultValue:null==(e=t[0])?void 0:e.id,className:"w-full",children:[t.length>1&&(0,r.jsx)(e8,{flows:t}),t.map(e=>(0,r.jsxs)(b,{value:e.id,className:"mt-6",children:["Conversational"===e.interface_type&&(0,r.jsx)(eG,{flow:e}),"Complete"===e.interface_type&&(0,r.jsx)(eu,{flow:e}),!e.interface_type&&(0,r.jsx)(e6,{flow:e})]},e.id))]}):(0,r.jsxs)(u,{children:[(0,r.jsx)(n.A,{className:"h-4 w-4"}),(0,r.jsx)(x,{children:"No flows found"}),(0,r.jsx)(m,{children:"No flows were found in the API. Make sure your QType application has flows defined."})]})}function te(){var e,t;let{spec:a,isLoading:n}=function(){let{data:e,error:t,isLoading:a,mutate:r}=(0,y.Ay)("/openapi.json",k,{refreshInterval:3e5,revalidateOnFocus:!1,errorRetryCount:3,errorRetryInterval:5e3});return{spec:e,isLoading:a,error:t,refresh:r}}(),l=(null==a||null==(e=a.info)?void 0:e.title)||"QType Frontend";return(0,s.useEffect)(()=>{n||(document.title=l)},[l,n]),(0,r.jsx)("div",{className:"font-sans min-h-screen p-6 sm:p-8",children:(0,r.jsxs)("main",{className:"max-w-6xl mx-auto space-y-6",children:[(0,r.jsxs)("div",{className:"text-center border-b pb-4",children:[(0,r.jsx)("h1",{className:"text-4xl font-bold text-gray-900 dark:text-white mb-2",children:l}),(null==a||null==(t=a.info)?void 0:t.description)&&(0,r.jsx)("p",{className:"text-gray-600 dark:text-gray-400 text-lg",children:a.info.description})]}),(0,r.jsx)(e9,{})]})})}}},e=>{e.O(0,[803,230,441,255,358],()=>e(e.s=2941)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[803],{2507:(t,e,a)=>{a.d(e,{$L:()=>L,rL:()=>U,vl:()=>J});var r,o=a(5071),s=a(4876),i=a(6767);a(5704);var l=Object.defineProperty,n=Symbol.for("vercel.ai.error.AI_NoOutputSpecifiedError");s.bD;Symbol.for("vercel.ai.error.AI_InvalidArgumentError");s.bD;Symbol.for("vercel.ai.error.AI_InvalidStreamPartError");s.bD;Symbol.for("vercel.ai.error.AI_InvalidToolInputError");s.bD;Symbol.for("vercel.ai.error.AI_NoImageGeneratedError");s.bD;var p="AI_NoObjectGeneratedError",d=`vercel.ai.error.${p}`,u=Symbol.for(d),c=class extends s.bD{constructor({message:t="No object generated.",cause:e,text:a,response:o,usage:s,finishReason:i}){super({name:p,message:t,cause:e}),this[r]=!0,this.text=a,this.response=o,this.usage=s,this.finishReason=i}static isInstance(t){return s.bD.hasMarker(t,d)}};r=u;Symbol.for("vercel.ai.error.AI_NoOutputGeneratedError");s.bD,s.bD;Symbol.for("vercel.ai.error.AI_NoSuchToolError");s.bD;Symbol.for("vercel.ai.error.AI_ToolCallRepairError");s.bD,s.bD;Symbol.for("vercel.ai.error.AI_InvalidDataContentError");s.bD;Symbol.for("vercel.ai.error.AI_InvalidMessageRoleError");s.bD;Symbol.for("vercel.ai.error.AI_MessageConversionError");s.bD;Symbol.for("vercel.ai.error.AI_DownloadError");s.bD;Symbol.for("vercel.ai.error.AI_RetryError");s.bD;var h="5.0.115",m=i.z.union([i.z.string(),i.z.instanceof(Uint8Array),i.z.instanceof(ArrayBuffer),i.z.custom(t=>{var e,a;return null!=(a=null==(e=globalThis.Buffer)?void 0:e.isBuffer(t))&&a},{message:"Must be a Buffer"})]),g=i.z.lazy(()=>i.z.union([i.z.null(),i.z.string(),i.z.number(),i.z.boolean(),i.z.record(i.z.string(),g),i.z.array(g)])),z=i.z.record(i.z.string(),i.z.record(i.z.string(),g)),v=i.z.object({type:i.z.literal("text"),text:i.z.string(),providerOptions:z.optional()}),b=i.z.object({type:i.z.literal("image"),image:i.z.union([m,i.z.instanceof(URL)]),mediaType:i.z.string().optional(),providerOptions:z.optional()}),y=i.z.object({type:i.z.literal("file"),data:i.z.union([m,i.z.instanceof(URL)]),filename:i.z.string().optional(),mediaType:i.z.string(),providerOptions:z.optional()}),I=i.z.object({type:i.z.literal("reasoning"),text:i.z.string(),providerOptions:z.optional()}),E=i.z.object({type:i.z.literal("tool-call"),toolCallId:i.z.string(),toolName:i.z.string(),input:i.z.unknown(),providerOptions:z.optional(),providerExecuted:i.z.boolean().optional()}),f=i.z.discriminatedUnion("type",[i.z.object({type:i.z.literal("text"),value:i.z.string()}),i.z.object({type:i.z.literal("json"),value:g}),i.z.object({type:i.z.literal("error-text"),value:i.z.string()}),i.z.object({type:i.z.literal("error-json"),value:g}),i.z.object({type:i.z.literal("content"),value:i.z.array(i.z.union([i.z.object({type:i.z.literal("text"),text:i.z.string()}),i.z.object({type:i.z.literal("media"),data:i.z.string(),mediaType:i.z.string()})]))})]),T=i.z.object({type:i.z.literal("tool-result"),toolCallId:i.z.string(),toolName:i.z.string(),output:f,providerOptions:z.optional()}),x=i.z.object({role:i.z.literal("system"),content:i.z.string(),providerOptions:z.optional()}),w=i.z.object({role:i.z.literal("user"),content:i.z.union([i.z.string(),i.z.array(i.z.union([v,b,y]))]),providerOptions:z.optional()}),_=i.z.object({role:i.z.literal("assistant"),content:i.z.union([i.z.string(),i.z.array(i.z.union([v,y,I,E,T]))]),providerOptions:z.optional()}),R=i.z.object({role:i.z.literal("tool"),content:i.z.array(T),providerOptions:z.optional()});i.z.union([x,w,_,R]),(0,o.hK)({prefix:"aitxt",size:24}),TransformStream;var M=(0,o.fE)(()=>(0,o.jN)(i.z.union([i.z.strictObject({type:i.z.literal("text-start"),id:i.z.string(),providerMetadata:z.optional()}),i.z.strictObject({type:i.z.literal("text-delta"),id:i.z.string(),delta:i.z.string(),providerMetadata:z.optional()}),i.z.strictObject({type:i.z.literal("text-end"),id:i.z.string(),providerMetadata:z.optional()}),i.z.strictObject({type:i.z.literal("error"),errorText:i.z.string()}),i.z.strictObject({type:i.z.literal("tool-input-start"),toolCallId:i.z.string(),toolName:i.z.string(),providerExecuted:i.z.boolean().optional(),dynamic:i.z.boolean().optional()}),i.z.strictObject({type:i.z.literal("tool-input-delta"),toolCallId:i.z.string(),inputTextDelta:i.z.string()}),i.z.strictObject({type:i.z.literal("tool-input-available"),toolCallId:i.z.string(),toolName:i.z.string(),input:i.z.unknown(),providerExecuted:i.z.boolean().optional(),providerMetadata:z.optional(),dynamic:i.z.boolean().optional()}),i.z.strictObject({type:i.z.literal("tool-input-error"),toolCallId:i.z.string(),toolName:i.z.string(),input:i.z.unknown(),providerExecuted:i.z.boolean().optional(),providerMetadata:z.optional(),dynamic:i.z.boolean().optional(),errorText:i.z.string()}),i.z.strictObject({type:i.z.literal("tool-output-available"),toolCallId:i.z.string(),output:i.z.unknown(),providerExecuted:i.z.boolean().optional(),dynamic:i.z.boolean().optional(),preliminary:i.z.boolean().optional()}),i.z.strictObject({type:i.z.literal("tool-output-error"),toolCallId:i.z.string(),errorText:i.z.string(),providerExecuted:i.z.boolean().optional(),dynamic:i.z.boolean().optional()}),i.z.strictObject({type:i.z.literal("reasoning-start"),id:i.z.string(),providerMetadata:z.optional()}),i.z.strictObject({type:i.z.literal("reasoning-delta"),id:i.z.string(),delta:i.z.string(),providerMetadata:z.optional()}),i.z.strictObject({type:i.z.literal("reasoning-end"),id:i.z.string(),providerMetadata:z.optional()}),i.z.strictObject({type:i.z.literal("source-url"),sourceId:i.z.string(),url:i.z.string(),title:i.z.string().optional(),providerMetadata:z.optional()}),i.z.strictObject({type:i.z.literal("source-document"),sourceId:i.z.string(),mediaType:i.z.string(),title:i.z.string(),filename:i.z.string().optional(),providerMetadata:z.optional()}),i.z.strictObject({type:i.z.literal("file"),url:i.z.string(),mediaType:i.z.string(),providerMetadata:z.optional()}),i.z.strictObject({type:i.z.custom(t=>"string"==typeof t&&t.startsWith("data-"),{message:'Type must start with "data-"'}),id:i.z.string().optional(),data:i.z.unknown(),transient:i.z.boolean().optional()}),i.z.strictObject({type:i.z.literal("start-step")}),i.z.strictObject({type:i.z.literal("finish-step")}),i.z.strictObject({type:i.z.literal("start"),messageId:i.z.string().optional(),messageMetadata:i.z.unknown().optional()}),i.z.strictObject({type:i.z.literal("finish"),finishReason:i.z.enum(["stop","length","content-filter","tool-calls","error","other","unknown"]).optional(),messageMetadata:i.z.unknown().optional()}),i.z.strictObject({type:i.z.literal("abort")}),i.z.strictObject({type:i.z.literal("message-metadata"),messageMetadata:i.z.unknown()})])));async function A(t){if(void 0===t)return{value:void 0,state:"undefined-input"};let e=await (0,o.N8)({text:t});return e.success?{value:e.value,state:"successful-parse"}:(e=await (0,o.N8)({text:function(t){let e=["ROOT"],a=-1,r=null;function o(t,o,s){switch(t){case'"':a=o,e.pop(),e.push(s),e.push("INSIDE_STRING");break;case"f":case"t":case"n":a=o,r=o,e.pop(),e.push(s),e.push("INSIDE_LITERAL");break;case"-":e.pop(),e.push(s),e.push("INSIDE_NUMBER");break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":a=o,e.pop(),e.push(s),e.push("INSIDE_NUMBER");break;case"{":a=o,e.pop(),e.push(s),e.push("INSIDE_OBJECT_START");break;case"[":a=o,e.pop(),e.push(s),e.push("INSIDE_ARRAY_START")}}function s(t,r){switch(t){case",":e.pop(),e.push("INSIDE_OBJECT_AFTER_COMMA");break;case"}":a=r,e.pop()}}function i(t,r){switch(t){case",":e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break;case"]":a=r,e.pop()}}for(let l=0;l<t.length;l++){let n=t[l];switch(e[e.length-1]){case"ROOT":o(n,l,"FINISH");break;case"INSIDE_OBJECT_START":switch(n){case'"':e.pop(),e.push("INSIDE_OBJECT_KEY");break;case"}":a=l,e.pop()}break;case"INSIDE_OBJECT_AFTER_COMMA":'"'===n&&(e.pop(),e.push("INSIDE_OBJECT_KEY"));break;case"INSIDE_OBJECT_KEY":'"'===n&&(e.pop(),e.push("INSIDE_OBJECT_AFTER_KEY"));break;case"INSIDE_OBJECT_AFTER_KEY":":"===n&&(e.pop(),e.push("INSIDE_OBJECT_BEFORE_VALUE"));break;case"INSIDE_OBJECT_BEFORE_VALUE":o(n,l,"INSIDE_OBJECT_AFTER_VALUE");break;case"INSIDE_OBJECT_AFTER_VALUE":s(n,l);break;case"INSIDE_STRING":switch(n){case'"':e.pop(),a=l;break;case"\\":e.push("INSIDE_STRING_ESCAPE");break;default:a=l}break;case"INSIDE_ARRAY_START":"]"===n?(a=l,e.pop()):(a=l,o(n,l,"INSIDE_ARRAY_AFTER_VALUE"));break;case"INSIDE_ARRAY_AFTER_VALUE":switch(n){case",":e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break;case"]":a=l,e.pop();break;default:a=l}break;case"INSIDE_ARRAY_AFTER_COMMA":o(n,l,"INSIDE_ARRAY_AFTER_VALUE");break;case"INSIDE_STRING_ESCAPE":e.pop(),a=l;break;case"INSIDE_NUMBER":switch(n){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":a=l;break;case"e":case"E":case"-":case".":break;case",":e.pop(),"INSIDE_ARRAY_AFTER_VALUE"===e[e.length-1]&&i(n,l),"INSIDE_OBJECT_AFTER_VALUE"===e[e.length-1]&&s(n,l);break;case"}":e.pop(),"INSIDE_OBJECT_AFTER_VALUE"===e[e.length-1]&&s(n,l);break;case"]":e.pop(),"INSIDE_ARRAY_AFTER_VALUE"===e[e.length-1]&&i(n,l);break;default:e.pop()}break;case"INSIDE_LITERAL":{let o=t.substring(r,l+1);"false".startsWith(o)||"true".startsWith(o)||"null".startsWith(o)?a=l:(e.pop(),"INSIDE_OBJECT_AFTER_VALUE"===e[e.length-1]?s(n,l):"INSIDE_ARRAY_AFTER_VALUE"===e[e.length-1]&&i(n,l))}}}let l=t.slice(0,a+1);for(let a=e.length-1;a>=0;a--)switch(e[a]){case"INSIDE_STRING":l+='"';break;case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":l+="}";break;case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":l+="]";break;case"INSIDE_LITERAL":{let e=t.substring(r,t.length);"true".startsWith(e)?l+="true".slice(e.length):"false".startsWith(e)?l+="false".slice(e.length):"null".startsWith(e)&&(l+="null".slice(e.length))}}return l}(t)})).success?{value:e.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"}}function C(t){return t.type.startsWith("tool-")}function S(t){return C(t)||"dynamic-tool"===t.type}function N(t){return t.type.split("-").slice(1).join("-")}async function k({stream:t,onError:e}){let a=t.getReader();try{for(;;){let{done:t}=await a.read();if(t)break}}catch(t){null==e||e(t)}finally{a.releaseLock()}}(0,o.hK)({prefix:"aitxt",size:24}),(0,o.hK)({prefix:"aiobj",size:24});var j=class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0;)await this.queue[0](),this.queue.shift();this.isProcessing=!1}}async run(t){return new Promise((e,a)=>{this.queue.push(async()=>{try{await t(),e()}catch(t){a(t)}}),this.processQueue()})}};(0,o.hK)({prefix:"aiobj",size:24}),((t,e)=>{for(var a in e)l(t,a,{get:e[a],enumerable:!0})})({},{object:()=>D,text:()=>O});var O=()=>({type:"text",responseFormat:{type:"text"},parsePartial:async({text:t})=>({partial:t}),parseOutput:async({text:t})=>t}),D=({schema:t})=>{let e=(0,o.mD)(t);return{type:"object",responseFormat:{type:"json",schema:e.jsonSchema},async parsePartial({text:t}){let e=await A(t);switch(e.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:e.value};default:{let t=e.state;throw Error(`Unsupported parse state: ${t}`)}}},async parseOutput({text:t},a){let r=await (0,o.N8)({text:t});if(!r.success)throw new c({message:"No object generated: could not parse the response.",cause:r.error,text:t,response:a.response,usage:a.usage,finishReason:a.finishReason});let s=await (0,o.ZZ)({value:r.value,schema:e});if(!s.success)throw new c({message:"No object generated: response did not match schema.",cause:s.error,text:t,response:a.response,usage:a.usage,finishReason:a.finishReason});return s.value}}},P=Symbol.for("vercel.ai.error.AI_NoSuchProviderError");async function F({stream:t,onTextPart:e}){let a=t.pipeThrough(new TextDecoderStream).getReader();for(;;){let{done:t,value:r}=await a.read();if(t)break;await e(r)}}async function L({api:t,prompt:e,credentials:a,headers:r,body:s,streamProtocol:i="data",setCompletion:l,setLoading:n,setError:p,setAbortController:d,onFinish:u,onError:c,fetch:m=fetch}){var g;try{n(!0),p(void 0);let c=new AbortController;d(c),l("");let z=await m(t,{method:"POST",body:JSON.stringify({prompt:e,...s}),credentials:a,headers:(0,o.WZ)({"Content-Type":"application/json",...r},`ai-sdk/${h}`,(0,o.G1)()),signal:c.signal}).catch(t=>{throw t});if(!z.ok)throw Error(null!=(g=await z.text())?g:"Failed to fetch the chat response.");if(!z.body)throw Error("The response body is empty.");let v="";switch(i){case"text":await F({stream:z.body,onTextPart:t=>{v+=t,l(v)}});break;case"data":await k({stream:(0,o._Z)({stream:z.body,schema:M}).pipeThrough(new TransformStream({async transform(t){if(!t.success)throw t.error;let e=t.value;if("text-delta"===e.type)v+=e.delta,l(v);else if("error"===e.type)throw Error(e.errorText)}})),onError:t=>{throw t}});break;default:throw Error(`Unknown stream protocol: ${i}`)}return u&&u(e,v),d(null),v}catch(t){if("AbortError"===t.name)return d(null),null;t instanceof Error&&c&&c(t),p(t)}finally{n(!1)}}async function B(t){if(null==t)return[];if(!globalThis.FileList||!(t instanceof globalThis.FileList))throw Error("FileList is not supported in the current environment");return Promise.all(Array.from(t).map(async t=>{let{name:e,type:a}=t;return{type:"file",mediaType:a,filename:e,url:await new Promise((e,a)=>{let r=new FileReader;r.onload=t=>{var a;e(null==(a=t.target)?void 0:a.result)},r.onerror=t=>a(t),r.readAsDataURL(t)})}}))}s.eM,s.bD;var q=class{constructor({api:t="/api/chat",credentials:e,headers:a,body:r,fetch:o,prepareSendMessagesRequest:s,prepareReconnectToStreamRequest:i}){this.api=t,this.credentials=e,this.headers=a,this.body=r,this.fetch=o,this.prepareSendMessagesRequest=s,this.prepareReconnectToStreamRequest=i}async sendMessages({abortSignal:t,...e}){var a,r,s,i,l;let n=await (0,o.hd)(this.body),p=await (0,o.hd)(this.headers),d=await (0,o.hd)(this.credentials),u={...(0,o.qx)(p),...(0,o.qx)(e.headers)},c=await (null==(a=this.prepareSendMessagesRequest)?void 0:a.call(this,{api:this.api,id:e.chatId,messages:e.messages,body:{...n,...e.body},headers:u,credentials:d,requestMetadata:e.metadata,trigger:e.trigger,messageId:e.messageId})),m=null!=(r=null==c?void 0:c.api)?r:this.api,g=(null==c?void 0:c.headers)!==void 0?(0,o.qx)(c.headers):u,z=(null==c?void 0:c.body)!==void 0?c.body:{...n,...e.body,id:e.chatId,messages:e.messages,trigger:e.trigger,messageId:e.messageId},v=null!=(s=null==c?void 0:c.credentials)?s:d,b=null!=(i=this.fetch)?i:globalThis.fetch,y=await b(m,{method:"POST",headers:(0,o.WZ)({"Content-Type":"application/json",...g},`ai-sdk/${h}`,(0,o.G1)()),body:JSON.stringify(z),credentials:v,signal:t});if(!y.ok)throw Error(null!=(l=await y.text())?l:"Failed to fetch the chat response.");if(!y.body)throw Error("The response body is empty.");return this.processResponseStream(y.body)}async reconnectToStream(t){var e,a,r,s,i;let l=await (0,o.hd)(this.body),n=await (0,o.hd)(this.headers),p=await (0,o.hd)(this.credentials),d={...(0,o.qx)(n),...(0,o.qx)(t.headers)},u=await (null==(e=this.prepareReconnectToStreamRequest)?void 0:e.call(this,{api:this.api,id:t.chatId,body:{...l,...t.body},headers:d,credentials:p,requestMetadata:t.metadata})),c=null!=(a=null==u?void 0:u.api)?a:`${this.api}/${t.chatId}/stream`,m=(null==u?void 0:u.headers)!==void 0?(0,o.qx)(u.headers):d,g=null!=(r=null==u?void 0:u.credentials)?r:p,z=null!=(s=this.fetch)?s:globalThis.fetch,v=await z(c,{method:"GET",headers:(0,o.WZ)(m,`ai-sdk/${h}`,(0,o.G1)()),credentials:g});if(204===v.status)return null;if(!v.ok)throw Error(null!=(i=await v.text())?i:"Failed to fetch the chat response.");if(!v.body)throw Error("The response body is empty.");return this.processResponseStream(v.body)}},U=class extends q{constructor(t={}){super(t)}processResponseStream(t){return(0,o._Z)({stream:t,schema:M}).pipeThrough(new TransformStream({async transform(t,e){if(!t.success)throw t.error;e.enqueue(t.value)}}))}},J=class{constructor({generateId:t=o.$C,id:e=t(),transport:a=new U,messageMetadataSchema:r,dataPartSchemas:s,state:i,onError:l,onToolCall:n,onFinish:p,onData:d,sendAutomaticallyWhen:u}){this.activeResponse=void 0,this.jobExecutor=new j,this.sendMessage=async(t,e)=>{var a,r,o,s;let i;if(null==t)return void await this.makeRequest({trigger:"submit-message",messageId:null==(a=this.lastMessage)?void 0:a.id,...e});if(i="text"in t||"files"in t?{parts:[...Array.isArray(t.files)?t.files:await B(t.files),..."text"in t&&null!=t.text?[{type:"text",text:t.text}]:[]]}:t,null!=t.messageId){let e=this.state.messages.findIndex(e=>e.id===t.messageId);if(-1===e)throw Error(`message with id ${t.messageId} not found`);if("user"!==this.state.messages[e].role)throw Error(`message with id ${t.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,e+1),this.state.replaceMessage(e,{...i,id:t.messageId,role:null!=(r=i.role)?r:"user",metadata:t.metadata})}else this.state.pushMessage({...i,id:null!=(o=i.id)?o:this.generateId(),role:null!=(s=i.role)?s:"user",metadata:t.metadata});await this.makeRequest({trigger:"submit-message",messageId:t.messageId,...e})},this.regenerate=async({messageId:t,...e}={})=>{let a=null==t?this.state.messages.length-1:this.state.messages.findIndex(e=>e.id===t);if(-1===a)throw Error(`message ${t} not found`);this.state.messages=this.state.messages.slice(0,"assistant"===this.messages[a].role?a:a+1),await this.makeRequest({trigger:"regenerate-message",messageId:t,...e})},this.resumeStream=async(t={})=>{await this.makeRequest({trigger:"resume-stream",...t})},this.clearError=()=>{"error"===this.status&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolOutput=async({state:t="output-available",tool:e,toolCallId:a,output:r,errorText:o})=>this.jobExecutor.run(async()=>{var e,s;let i=this.state.messages,l=i[i.length-1];this.state.replaceMessage(i.length-1,{...l,parts:l.parts.map(e=>S(e)&&e.toolCallId===a?{...e,state:t,output:r,errorText:o}:e)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(e=>S(e)&&e.toolCallId===a?{...e,state:t,output:r,errorText:o}:e)),"streaming"!==this.status&&"submitted"!==this.status&&(null==(e=this.sendAutomaticallyWhen)?void 0:e.call(this,{messages:this.state.messages}))&&this.makeRequest({trigger:"submit-message",messageId:null==(s=this.lastMessage)?void 0:s.id})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{var t;("streaming"===this.status||"submitted"===this.status)&&(null==(t=this.activeResponse)?void 0:t.abortController)&&this.activeResponse.abortController.abort()},this.id=e,this.transport=a,this.generateId=t,this.messageMetadataSchema=r,this.dataPartSchemas=s,this.state=i,this.onError=l,this.onToolCall=n,this.onFinish=p,this.onData=d,this.sendAutomaticallyWhen=u}get status(){return this.state.status}setStatus({status:t,error:e}){this.status!==t&&(this.state.status=t,this.state.error=e)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(t){this.state.messages=t}async makeRequest({trigger:t,metadata:e,headers:a,body:r,messageId:s}){var i,l,n,p;this.setStatus({status:"submitted",error:void 0});let d=this.lastMessage,u=!1,c=!1,h=!1;try{let i,l={state:function({lastMessage:t,messageId:e}){return{message:(null==t?void 0:t.role)==="assistant"?t:{id:e,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}({lastMessage:this.state.snapshot(d),messageId:this.generateId()}),abortController:new AbortController};if(l.abortController.signal.addEventListener("abort",()=>{u=!0}),this.activeResponse=l,"resume-stream"===t){let t=await this.transport.reconnectToStream({chatId:this.id,metadata:e,headers:a,body:r});if(null==t)return void this.setStatus({status:"ready"});i=t}else i=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:l.abortController.signal,metadata:e,headers:a,body:r,trigger:t,messageId:s});let n=t=>this.jobExecutor.run(()=>t({state:l.state,write:()=>{var t;this.setStatus({status:"streaming"}),l.state.message.id===(null==(t=this.lastMessage)?void 0:t.id)?this.state.replaceMessage(this.state.messages.length-1,l.state.message):this.state.pushMessage(l.state.message)}}));await k({stream:function({stream:t,messageMetadataSchema:e,dataPartSchemas:a,runUpdateMessageJob:r,onError:s,onToolCall:i,onData:l}){return t.pipeThrough(new TransformStream({async transform(t,n){await r(async({state:r,write:p})=>{var d,u,c,h;function m(t){let e=r.message.parts.filter(C).find(e=>e.toolCallId===t);if(null==e)throw Error("tool-output-error must be preceded by a tool-input-available");return e}function g(t){let e=r.message.parts.filter(t=>"dynamic-tool"===t.type).find(e=>e.toolCallId===t);if(null==e)throw Error("tool-output-error must be preceded by a tool-input-available");return e}function z(t){var e;let a=r.message.parts.find(e=>C(e)&&e.toolCallId===t.toolCallId);null!=a?(a.state=t.state,a.input=t.input,a.output=t.output,a.errorText=t.errorText,a.rawInput=t.rawInput,a.preliminary=t.preliminary,a.providerExecuted=null!=(e=t.providerExecuted)?e:a.providerExecuted,null!=t.providerMetadata&&"input-available"===a.state&&(a.callProviderMetadata=t.providerMetadata)):r.message.parts.push({type:`tool-${t.toolName}`,toolCallId:t.toolCallId,state:t.state,input:t.input,output:t.output,rawInput:t.rawInput,errorText:t.errorText,providerExecuted:t.providerExecuted,preliminary:t.preliminary,...null!=t.providerMetadata?{callProviderMetadata:t.providerMetadata}:{}})}function v(t){var e,a;let o=r.message.parts.find(e=>"dynamic-tool"===e.type&&e.toolCallId===t.toolCallId);null!=o?(o.state=t.state,o.toolName=t.toolName,o.input=t.input,o.output=t.output,o.errorText=t.errorText,o.rawInput=null!=(e=t.rawInput)?e:o.rawInput,o.preliminary=t.preliminary,o.providerExecuted=null!=(a=t.providerExecuted)?a:o.providerExecuted,null!=t.providerMetadata&&"input-available"===o.state&&(o.callProviderMetadata=t.providerMetadata)):r.message.parts.push({type:"dynamic-tool",toolName:t.toolName,toolCallId:t.toolCallId,state:t.state,input:t.input,output:t.output,errorText:t.errorText,preliminary:t.preliminary,providerExecuted:t.providerExecuted,...null!=t.providerMetadata?{callProviderMetadata:t.providerMetadata}:{}})}async function b(t){if(null!=t){let a=null!=r.message.metadata?function t(e,a){if(void 0===e&&void 0===a)return;if(void 0===e)return a;if(void 0===a)return e;let r={...e};for(let o in a)if(Object.prototype.hasOwnProperty.call(a,o)){let s=a[o];if(void 0===s)continue;let i=o in e?e[o]:void 0,l=null!==s&&"object"==typeof s&&!Array.isArray(s)&&!(s instanceof Date)&&!(s instanceof RegExp),n=null!=i&&"object"==typeof i&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof RegExp);l&&n?r[o]=t(i,s):r[o]=s}return r}(r.message.metadata,t):t;null!=e&&await (0,o.k5)({value:a,schema:e}),r.message.metadata=a}}switch(t.type){case"text-start":{let e={type:"text",text:"",providerMetadata:t.providerMetadata,state:"streaming"};r.activeTextParts[t.id]=e,r.message.parts.push(e),p();break}case"text-delta":{let e=r.activeTextParts[t.id];e.text+=t.delta,e.providerMetadata=null!=(d=t.providerMetadata)?d:e.providerMetadata,p();break}case"text-end":{let e=r.activeTextParts[t.id];e.state="done",e.providerMetadata=null!=(u=t.providerMetadata)?u:e.providerMetadata,delete r.activeTextParts[t.id],p();break}case"reasoning-start":{let e={type:"reasoning",text:"",providerMetadata:t.providerMetadata,state:"streaming"};r.activeReasoningParts[t.id]=e,r.message.parts.push(e),p();break}case"reasoning-delta":{let e=r.activeReasoningParts[t.id];e.text+=t.delta,e.providerMetadata=null!=(c=t.providerMetadata)?c:e.providerMetadata,p();break}case"reasoning-end":{let e=r.activeReasoningParts[t.id];e.providerMetadata=null!=(h=t.providerMetadata)?h:e.providerMetadata,e.state="done",delete r.activeReasoningParts[t.id],p();break}case"file":r.message.parts.push({type:"file",mediaType:t.mediaType,url:t.url}),p();break;case"source-url":r.message.parts.push({type:"source-url",sourceId:t.sourceId,url:t.url,title:t.title,providerMetadata:t.providerMetadata}),p();break;case"source-document":r.message.parts.push({type:"source-document",sourceId:t.sourceId,mediaType:t.mediaType,title:t.title,filename:t.filename,providerMetadata:t.providerMetadata}),p();break;case"tool-input-start":{let e=r.message.parts.filter(C);r.partialToolCalls[t.toolCallId]={text:"",toolName:t.toolName,index:e.length,dynamic:t.dynamic},t.dynamic?v({toolCallId:t.toolCallId,toolName:t.toolName,state:"input-streaming",input:void 0,providerExecuted:t.providerExecuted}):z({toolCallId:t.toolCallId,toolName:t.toolName,state:"input-streaming",input:void 0,providerExecuted:t.providerExecuted}),p();break}case"tool-input-delta":{let e=r.partialToolCalls[t.toolCallId];e.text+=t.inputTextDelta;let{value:a}=await A(e.text);e.dynamic?v({toolCallId:t.toolCallId,toolName:e.toolName,state:"input-streaming",input:a}):z({toolCallId:t.toolCallId,toolName:e.toolName,state:"input-streaming",input:a}),p();break}case"tool-input-available":t.dynamic?v({toolCallId:t.toolCallId,toolName:t.toolName,state:"input-available",input:t.input,providerExecuted:t.providerExecuted,providerMetadata:t.providerMetadata}):z({toolCallId:t.toolCallId,toolName:t.toolName,state:"input-available",input:t.input,providerExecuted:t.providerExecuted,providerMetadata:t.providerMetadata}),p(),i&&!t.providerExecuted&&await i({toolCall:t});break;case"tool-input-error":t.dynamic?v({toolCallId:t.toolCallId,toolName:t.toolName,state:"output-error",input:t.input,errorText:t.errorText,providerExecuted:t.providerExecuted,providerMetadata:t.providerMetadata}):z({toolCallId:t.toolCallId,toolName:t.toolName,state:"output-error",input:void 0,rawInput:t.input,errorText:t.errorText,providerExecuted:t.providerExecuted,providerMetadata:t.providerMetadata}),p();break;case"tool-output-available":if(t.dynamic){let e=g(t.toolCallId);v({toolCallId:t.toolCallId,toolName:e.toolName,state:"output-available",input:e.input,output:t.output,preliminary:t.preliminary})}else{let e=m(t.toolCallId);z({toolCallId:t.toolCallId,toolName:N(e),state:"output-available",input:e.input,output:t.output,providerExecuted:t.providerExecuted,preliminary:t.preliminary})}p();break;case"tool-output-error":if(t.dynamic){let e=g(t.toolCallId);v({toolCallId:t.toolCallId,toolName:e.toolName,state:"output-error",input:e.input,errorText:t.errorText,providerExecuted:t.providerExecuted})}else{let e=m(t.toolCallId);z({toolCallId:t.toolCallId,toolName:N(e),state:"output-error",input:e.input,rawInput:e.rawInput,errorText:t.errorText,providerExecuted:t.providerExecuted})}p();break;case"start-step":r.message.parts.push({type:"step-start"});break;case"finish-step":r.activeTextParts={},r.activeReasoningParts={};break;case"start":null!=t.messageId&&(r.message.id=t.messageId),await b(t.messageMetadata),(null!=t.messageId||null!=t.messageMetadata)&&p();break;case"finish":null!=t.finishReason&&(r.finishReason=t.finishReason),await b(t.messageMetadata),null!=t.messageMetadata&&p();break;case"message-metadata":await b(t.messageMetadata),null!=t.messageMetadata&&p();break;case"error":null==s||s(Error(t.errorText));break;default:if(t.type.startsWith("data-")){if((null==a?void 0:a[t.type])!=null&&await (0,o.k5)({value:t.data,schema:a[t.type]}),t.transient){null==l||l(t);break}let e=null!=t.id?r.message.parts.find(e=>t.type===e.type&&t.id===e.id):void 0;null!=e?e.data=t.data:r.message.parts.push(t),null==l||l(t),p()}}n.enqueue(t)})}}))}({stream:i,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:n,onError:t=>{throw t}}),onError:t=>{throw t}}),this.setStatus({status:"ready"})}catch(t){if(u||"AbortError"===t.name)return u=!0,this.setStatus({status:"ready"}),null;h=!0,t instanceof TypeError&&(t.message.toLowerCase().includes("fetch")||t.message.toLowerCase().includes("network"))&&(c=!0),this.onError&&t instanceof Error&&this.onError(t),this.setStatus({status:"error",error:t})}finally{try{null==(l=this.onFinish)||l.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:u,isDisconnect:c,isError:h,finishReason:null==(i=this.activeResponse)?void 0:i.state.finishReason})}catch(t){console.error(t)}this.activeResponse=void 0}(null==(n=this.sendAutomaticallyWhen)?void 0:n.call(this,{messages:this.state.messages}))&&!h&&await this.makeRequest({trigger:"submit-message",messageId:null==(p=this.lastMessage)?void 0:p.id,metadata:e,headers:a,body:r})}};(0,o.fE)(()=>(0,o.jN)(i.z.array(i.z.object({id:i.z.string(),role:i.z.enum(["system","user","assistant"]),metadata:i.z.unknown().optional(),parts:i.z.array(i.z.union([i.z.object({type:i.z.literal("text"),text:i.z.string(),state:i.z.enum(["streaming","done"]).optional(),providerMetadata:z.optional()}),i.z.object({type:i.z.literal("reasoning"),text:i.z.string(),state:i.z.enum(["streaming","done"]).optional(),providerMetadata:z.optional()}),i.z.object({type:i.z.literal("source-url"),sourceId:i.z.string(),url:i.z.string(),title:i.z.string().optional(),providerMetadata:z.optional()}),i.z.object({type:i.z.literal("source-document"),sourceId:i.z.string(),mediaType:i.z.string(),title:i.z.string(),filename:i.z.string().optional(),providerMetadata:z.optional()}),i.z.object({type:i.z.literal("file"),mediaType:i.z.string(),filename:i.z.string().optional(),url:i.z.string(),providerMetadata:z.optional()}),i.z.object({type:i.z.literal("step-start")}),i.z.object({type:i.z.string().startsWith("data-"),id:i.z.string().optional(),data:i.z.unknown()}),i.z.object({type:i.z.literal("dynamic-tool"),toolName:i.z.string(),toolCallId:i.z.string(),state:i.z.literal("input-streaming"),input:i.z.unknown().optional(),providerExecuted:i.z.boolean().optional(),output:i.z.never().optional(),errorText:i.z.never().optional()}),i.z.object({type:i.z.literal("dynamic-tool"),toolName:i.z.string(),toolCallId:i.z.string(),state:i.z.literal("input-available"),input:i.z.unknown(),providerExecuted:i.z.boolean().optional(),output:i.z.never().optional(),errorText:i.z.never().optional(),callProviderMetadata:z.optional()}),i.z.object({type:i.z.literal("dynamic-tool"),toolName:i.z.string(),toolCallId:i.z.string(),state:i.z.literal("output-available"),input:i.z.unknown(),providerExecuted:i.z.boolean().optional(),output:i.z.unknown(),errorText:i.z.never().optional(),callProviderMetadata:z.optional(),preliminary:i.z.boolean().optional()}),i.z.object({type:i.z.literal("dynamic-tool"),toolName:i.z.string(),toolCallId:i.z.string(),state:i.z.literal("output-error"),input:i.z.unknown(),providerExecuted:i.z.boolean().optional(),output:i.z.never().optional(),errorText:i.z.string(),callProviderMetadata:z.optional()}),i.z.object({type:i.z.string().startsWith("tool-"),toolCallId:i.z.string(),state:i.z.literal("input-streaming"),providerExecuted:i.z.boolean().optional(),input:i.z.unknown().optional(),output:i.z.never().optional(),errorText:i.z.never().optional(),approval:i.z.never().optional()}),i.z.object({type:i.z.string().startsWith("tool-"),toolCallId:i.z.string(),state:i.z.literal("input-available"),providerExecuted:i.z.boolean().optional(),input:i.z.unknown(),output:i.z.never().optional(),errorText:i.z.never().optional(),callProviderMetadata:z.optional(),approval:i.z.never().optional()}),i.z.object({type:i.z.string().startsWith("tool-"),toolCallId:i.z.string(),state:i.z.literal("approval-requested"),input:i.z.unknown(),providerExecuted:i.z.boolean().optional(),output:i.z.never().optional(),errorText:i.z.never().optional(),callProviderMetadata:z.optional(),approval:i.z.object({id:i.z.string(),approved:i.z.never().optional(),reason:i.z.never().optional()})}),i.z.object({type:i.z.string().startsWith("tool-"),toolCallId:i.z.string(),state:i.z.literal("approval-responded"),input:i.z.unknown(),providerExecuted:i.z.boolean().optional(),output:i.z.never().optional(),errorText:i.z.never().optional(),callProviderMetadata:z.optional(),approval:i.z.object({id:i.z.string(),approved:i.z.boolean(),reason:i.z.string().optional()})}),i.z.object({type:i.z.string().startsWith("tool-"),toolCallId:i.z.string(),state:i.z.literal("output-available"),providerExecuted:i.z.boolean().optional(),input:i.z.unknown(),output:i.z.unknown(),errorText:i.z.never().optional(),callProviderMetadata:z.optional(),preliminary:i.z.boolean().optional(),approval:i.z.object({id:i.z.string(),approved:i.z.literal(!0),reason:i.z.string().optional()}).optional()}),i.z.object({type:i.z.string().startsWith("tool-"),toolCallId:i.z.string(),state:i.z.literal("output-error"),providerExecuted:i.z.boolean().optional(),input:i.z.unknown(),output:i.z.never().optional(),errorText:i.z.string(),callProviderMetadata:z.optional(),approval:i.z.object({id:i.z.string(),approved:i.z.literal(!0),reason:i.z.string().optional()}).optional()}),i.z.object({type:i.z.string().startsWith("tool-"),toolCallId:i.z.string(),state:i.z.literal("output-denied"),providerExecuted:i.z.boolean().optional(),input:i.z.unknown(),output:i.z.never().optional(),errorText:i.z.never().optional(),callProviderMetadata:z.optional(),approval:i.z.object({id:i.z.string(),approved:i.z.literal(!1),reason:i.z.string().optional()})})])).nonempty("Message must contain at least one part")})).nonempty("Messages array must not be empty")))}}]);
|