@langgraph-js/ui 5.4.0 → 5.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{arc-DQUrjEml.js → arc-C7vMWMZO.js} +1 -1
- package/dist/assets/architectureDiagram-VXUJARFQ-KtfX36pw.js +36 -0
- package/dist/assets/blockDiagram-VD42YOAC-BlrV4_0w.js +122 -0
- package/dist/assets/c4Diagram-YG6GDRKO-AMYk1qYx.js +10 -0
- package/dist/assets/channel-aNvW8Gsa.js +1 -0
- package/dist/assets/chunk-4BX2VUAB-TwKwjmZd.js +1 -0
- package/dist/assets/{chunk-55IACEB6-CDCucU6U.js → chunk-55IACEB6-C7lUh2is.js} +1 -1
- package/dist/assets/{chunk-B4BG7PRW-B_bvOmJU.js → chunk-B4BG7PRW-IbwY5FbU.js} +6 -6
- package/dist/assets/chunk-DI55MBZ5-DEjzg2ZG.js +220 -0
- package/dist/assets/{chunk-FMBD7UC4-C54-XKR7.js → chunk-FMBD7UC4-C6hxzrsQ.js} +1 -1
- package/dist/assets/chunk-QN33PNHL-Yrg5RjXO.js +1 -0
- package/dist/assets/{chunk-QZHKN3VN-WNR9TOch.js → chunk-QZHKN3VN-Ba9nUK7B.js} +1 -1
- package/dist/assets/{chunk-TZMSLE5B-7H_0y6Jq.js → chunk-TZMSLE5B-Bn2dCGYE.js} +1 -1
- package/dist/assets/classDiagram-2ON5EDUG-D8udSpBf.js +1 -0
- package/dist/assets/classDiagram-v2-WZHVMYZB-D8udSpBf.js +1 -0
- package/dist/assets/clone-Bg-QuoUw.js +1 -0
- package/dist/assets/cose-bilkent-S5V4N54A-BqmwzEGu.js +1 -0
- package/dist/assets/cytoscape.esm-CyJtwmzi.js +331 -0
- package/dist/assets/dagre-6UL2VRFP-B_NVSG2k.js +4 -0
- package/dist/assets/diagram-PSM6KHXK-BpyYnmEs.js +24 -0
- package/dist/assets/diagram-QEK2KX5R-C7HCtzX0.js +43 -0
- package/dist/assets/diagram-S2PKOQOG-DU2kmWnz.js +24 -0
- package/dist/assets/{erDiagram-Q2GNP2WA-tT_ZIA6k.js → erDiagram-Q2GNP2WA-BudcYXYN.js} +4 -4
- package/dist/assets/flowDiagram-NV44I4VS-jLX0sPg6.js +162 -0
- package/dist/assets/{ganttDiagram-LVOFAZNH-D8dtKJe7.js → ganttDiagram-LVOFAZNH-BvM-BjRk.js} +1 -1
- package/dist/assets/gitGraphDiagram-NY62KEGX-CeK1oQiU.js +65 -0
- package/dist/assets/{graph-BuzEybDF.js → graph-BDYO4Vh7.js} +1 -1
- package/dist/assets/index-CGXfejr1.js +910 -0
- package/dist/assets/index-z3jA17TL.css +1 -0
- package/dist/assets/{infoDiagram-F6ZHWCRC-DxSSCHjJ.js → infoDiagram-F6ZHWCRC-d2LjnxEL.js} +1 -1
- package/dist/assets/{isUndefined-CMHFQ84G.js → isUndefined-DAOIMO73.js} +1 -1
- package/dist/assets/{journeyDiagram-XKPGCS4Q-BevCzXS0.js → journeyDiagram-XKPGCS4Q-D7WAK1ea.js} +1 -1
- package/dist/assets/kanban-definition-3W4ZIXB7-BadVT-MR.js +89 -0
- package/dist/assets/{layout-CRoaNhL7.js → layout-DR15A61G.js} +1 -1
- package/dist/assets/{linear-CZCbyP3Y.js → linear-CJFGeLoQ.js} +1 -1
- package/dist/assets/mermaid.core-uMRr7BgD.js +197 -0
- package/dist/assets/min-CFeOpnpX.js +1 -0
- package/dist/assets/mindmap-definition-VGOIOE7T-GqZJXq7I.js +68 -0
- package/dist/assets/pieDiagram-ADFJNKIX-CxqGw6Kc.js +30 -0
- package/dist/assets/quadrantDiagram-AYHSOK5B-q-yYDsJe.js +7 -0
- package/dist/assets/{requirementDiagram-UZGBJVZJ-DsXoYXUv.js → requirementDiagram-UZGBJVZJ-Cg2IAu3S.js} +7 -7
- package/dist/assets/{sankeyDiagram-TZEHDZUN-BR0Y-EwJ.js → sankeyDiagram-TZEHDZUN-B6rjJSCB.js} +7 -7
- package/dist/assets/{sequenceDiagram-WL72ISMW-DI7AT-qP.js → sequenceDiagram-WL72ISMW-DCsELG7P.js} +16 -16
- package/dist/assets/{stateDiagram-FKZM4ZOC-oxL9LRWa.js → stateDiagram-FKZM4ZOC-BebmGJR9.js} +1 -1
- package/dist/assets/stateDiagram-v2-4FDKWEC3-B_r-CBlU.js +1 -0
- package/dist/assets/timeline-definition-IT6M3QCI-CCyBrK8t.js +61 -0
- package/dist/assets/treemap-KMMF4GRG-BFX2z4EH.js +128 -0
- package/dist/assets/{xychartDiagram-PRI3JC2R-tBcCr-MQ.js → xychartDiagram-PRI3JC2R-BhKifO0c.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +5 -3
- package/src/chat/Chat.tsx +14 -1
- package/src/chat/components/MessageAI.tsx +3 -1
- package/src/chat/components/MessageTool.tsx +60 -14
- package/src/chat/components/Reasoning.tsx +21 -0
- package/src/components/ai-elements/chain-of-thought.tsx +228 -0
- package/src/components/ui/badge.tsx +46 -0
- package/src/components/ui/collapsible.tsx +31 -0
- package/dist/assets/architectureDiagram-VXUJARFQ-HbPzZrlH.js +0 -36
- package/dist/assets/blockDiagram-VD42YOAC-D_Idys33.js +0 -122
- package/dist/assets/c4Diagram-YG6GDRKO-Cz8lYf2-.js +0 -10
- package/dist/assets/channel-B6KFe5Ui.js +0 -1
- package/dist/assets/chunk-4BX2VUAB-B-hX18OI.js +0 -1
- package/dist/assets/chunk-DI55MBZ5-BqSop0cW.js +0 -220
- package/dist/assets/chunk-QN33PNHL-BPnnBJ3E.js +0 -1
- package/dist/assets/classDiagram-2ON5EDUG-By_JhIEM.js +0 -1
- package/dist/assets/classDiagram-v2-WZHVMYZB-By_JhIEM.js +0 -1
- package/dist/assets/clone-BuF8XBFq.js +0 -1
- package/dist/assets/cose-bilkent-S5V4N54A-DYYnco-F.js +0 -1
- package/dist/assets/cytoscape.esm-TTflUzRS.js +0 -321
- package/dist/assets/dagre-6UL2VRFP-BuN5tYoM.js +0 -4
- package/dist/assets/diagram-PSM6KHXK-BqLZHOD_.js +0 -24
- package/dist/assets/diagram-QEK2KX5R-D6ihm09C.js +0 -43
- package/dist/assets/diagram-S2PKOQOG-Z4kDGPqZ.js +0 -24
- package/dist/assets/flowDiagram-NV44I4VS-DP4XZFAl.js +0 -162
- package/dist/assets/gitGraphDiagram-NY62KEGX-CHTqjWSe.js +0 -65
- package/dist/assets/index-C2dvtkqk.css +0 -1
- package/dist/assets/index-C7NPwb1W.js +0 -623
- package/dist/assets/index-CRO3NlHm.js +0 -1
- package/dist/assets/kanban-definition-3W4ZIXB7-Datdpuzc.js +0 -89
- package/dist/assets/mermaid.core-oWlc3CvG.js +0 -191
- package/dist/assets/min-B-Brdcc-.js +0 -1
- package/dist/assets/mindmap-definition-VGOIOE7T-C2cLH6vf.js +0 -68
- package/dist/assets/pieDiagram-ADFJNKIX-lHSlzymq.js +0 -30
- package/dist/assets/quadrantDiagram-AYHSOK5B-Cu4iHHyE.js +0 -7
- package/dist/assets/stateDiagram-v2-4FDKWEC3-C9dX-PKL.js +0 -1
- package/dist/assets/timeline-definition-IT6M3QCI-Dj8UUbRz.js +0 -61
- package/dist/assets/treemap-KMMF4GRG-oIIgGlOX.js +0 -128
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{P as p,p as O}from"./index-C7NPwb1W.js";const C=(...e)=>fetch(...e),$=Symbol.for("lg:fetch_implementation"),A=()=>globalThis[$]??C,j=[400,401,402,403,404,405,406,407,408,409,422];function P(e){return e==null||typeof e!="object"?!1:"status"in e&&"statusText"in e&&"text"in e}var x=class g extends Error{status;text;response;constructor(s,t,r){super(`HTTP ${s}: ${t}`),this.status=s,this.text=t,this.response=r}static async fromResponse(s,t){try{return new g(s.status,await s.text(),t?.includeResponse?s:void 0)}catch{return new g(s.status,s.statusText,t?.includeResponse?s:void 0)}}},y=class{maxConcurrency;maxRetries;queue;onFailedResponseHook;customFetch;constructor(e){this.maxConcurrency=e.maxConcurrency??1/0,this.maxRetries=e.maxRetries??4,"default"in p?this.queue=new p.default({concurrency:this.maxConcurrency}):this.queue=new p({concurrency:this.maxConcurrency}),this.onFailedResponseHook=e?.onFailedResponseHook,this.customFetch=e.fetch}call(e,...s){const{onFailedResponseHook:t}=this;return this.queue.add(()=>O(()=>e(...s).catch(async r=>{throw r instanceof Error?r:P(r)?await x.fromResponse(r,{includeResponse:!!t}):new Error(r)}),{async onFailedAttempt(r){if(r.message.startsWith("Cancel")||r.message.startsWith("TimeoutError")||r.message.startsWith("AbortError")||r?.code==="ECONNABORTED")throw r;if(r instanceof x){if(j.includes(r.status))throw r;t&&r.response&&await t(r.response)}},retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0})}callWithOptions(e,s,...t){return e.signal?Promise.race([this.call(s,...t),new Promise((r,n)=>{e.signal?.addEventListener("abort",()=>{n(new Error("AbortError"))})})]):this.call(s,...t)}fetch(...e){const s=this.customFetch??A();return this.call(()=>s(...e).then(t=>t.ok?t:Promise.reject(t)))}},I={};function N(e){try{return typeof process<"u"?I?.[e]:void 0}catch{return}}function H(...e){const s=e.filter(r=>r!=null);if(s.length===0)return;if(s.length===1)return s[0];const t=new AbortController;for(const r of e){if(r?.aborted)return t.abort(r.reason),t.signal;r?.addEventListener("abort",()=>t.abort(r.reason),{once:!0})}return t.signal}const d=13,b=10,L=0,S=58,M=32,D=[d,b];function w(){let e=[],s=!1;return new TransformStream({start(){e=[],s=!1},transform(t,r){let n=t;if(s&&(n=m([[d],n]),s=!1),n.length>0&&n.at(-1)===d&&(s=!0,n=n.subarray(0,-1)),!n.length)return;const i=D.includes(n.at(-1)),a=n.length-1,{lines:o}=n.reduce((c,u,h)=>(c.from>h||((u===d||u===b)&&(c.lines.push(n.subarray(c.from,h)),u===d&&n[h+1]===b?c.from=h+2:c.from=h+1),h===a&&c.from<=a&&c.lines.push(n.subarray(c.from))),c),{lines:[],from:0});if(o.length===1&&!i){e.push(o[0]);return}e.length&&(e.push(o[0]),o[0]=m(e),e=[]),i||o.length&&(e=[o.pop()]);for(const c of o)r.enqueue(c)},flush(t){e.length&&t.enqueue(m(e))}})}function v(){let e="",s=[],t="",r=null;const n=new TextDecoder;return new TransformStream({transform(i,a){if(!i.length){if(!e&&!s.length&&!t&&r==null)return;const h={id:t||void 0,event:e,data:s.length?R(n,s):null};e="",s=[],r=null,a.enqueue(h);return}if(i[0]===S)return;const o=i.indexOf(S);if(o===-1)return;const c=n.decode(i.subarray(0,o));let u=i.subarray(o+1);if(u[0]===M&&(u=u.subarray(1)),c==="event")e=n.decode(u);else if(c==="data")s.push(u);else if(c==="id")u.indexOf(L)===-1&&(t=n.decode(u));else if(c==="retry"){const h=Number.parseInt(n.decode(u),10);Number.isNaN(h)||(r=h)}},flush(i){e&&i.enqueue({id:t||void 0,event:e,data:s.length?R(n,s):null})}})}function m(e){const s=e.reduce((n,i)=>n+i.length,0),t=new Uint8Array(s);let r=0;for(const n of e)t.set(n,r),r+=n.length;return t}function R(e,s){return JSON.parse(e.decode(m(s)))}var T=class E extends ReadableStream{reader;ensureReader(){this.reader||(this.reader=this.getReader())}async next(){this.ensureReader();try{const s=await this.reader.read();return s.done?(this.reader.releaseLock(),{done:!0,value:void 0}):{done:!1,value:s.value}}catch(s){throw this.reader.releaseLock(),s}}async return(){if(this.ensureReader(),this.locked){const s=this.reader.cancel();this.reader.releaseLock(),await s}return{done:!0,value:void 0}}async throw(s){if(this.ensureReader(),this.locked){const t=this.reader.cancel();this.reader.releaseLock(),await t}throw s}async[Symbol.asyncDispose](){await this.return()}[Symbol.asyncIterator](){return this}static fromReadableStream(s){const t=s.getReader();return new E({start(r){return n();function n(){return t.read().then(({done:i,value:a})=>{if(i){r.close();return}return r.enqueue(a),n()})}},cancel(){t.releaseLock()}})}static fromAsyncGenerator(s){return new E({async pull(t){const{value:r,done:n}=await s.next();n&&t.close(),t.enqueue(r)},async cancel(t){await s.return(t)}})}};function*F(e){let s,t=!1;if(e instanceof Headers){const r=[];e.forEach((n,i)=>{r.push([i,n])}),s=r}else Array.isArray(e)?s=e:(t=!0,s=Object.entries(e??{}));for(const r of s){const n=r[0];if(typeof n!="string")throw new TypeError(`Expected header name to be a string, got ${typeof n}`);const i=Array.isArray(r[1])?r[1]:[r[1]];let a=!1;for(const o of i)o!==void 0&&(t&&!a&&(a=!0,yield[n,null]),yield[n,o])}}function k(...e){const s=new Headers;for(const r of e)if(r)for(const[n,i]of F(r))i===null?s.delete(n):s.append(n,i);const t=[];return s.forEach((r,n)=>{t.push([n,r])}),Object.fromEntries(t)}function U(e){if(e)return e;const s=["LANGGRAPH","LANGSMITH","LANGCHAIN"];for(const t of s){const r=N(`${t}_API_KEY`);if(r)return r.trim().replace(/^["']|["']$/g,"")}}const B=/(\/threads\/(?<thread_id>.+))?\/runs\/(?<run_id>.+)/;function _(e){const s=e.headers.get("Content-Location");if(!s)return;const t=B.exec(s);if(t?.groups?.run_id)return{run_id:t.groups.run_id,thread_id:t.groups.thread_id||void 0}}var l=class{asyncCaller;timeoutMs;apiUrl;defaultHeaders;onRequest;constructor(e){const s={maxRetries:4,maxConcurrency:4,...e?.callerOptions};let t="http://localhost:8123";if(!e?.apiUrl&&typeof globalThis=="object"&&globalThis!=null){const n=Symbol.for("langgraph_api:fetch"),i=Symbol.for("langgraph_api:url"),a=globalThis;a[n]&&(s.fetch??=a[n]),a[i]&&(t=a[i])}this.asyncCaller=new y(s),this.timeoutMs=e?.timeoutMs,this.apiUrl=e?.apiUrl?.replace(/\/$/,"")||t,this.defaultHeaders=e?.defaultHeaders||{},this.onRequest=e?.onRequest;const r=U(e?.apiKey);r&&(this.defaultHeaders["x-api-key"]=r)}prepareFetchOptions(e,s){const t={...s,headers:k(this.defaultHeaders,s?.headers)};t.json&&(t.body=JSON.stringify(t.json),t.headers=k(t.headers,{"content-type":"application/json"}),delete t.json),t.withResponse&&delete t.withResponse;let r=null;typeof s?.timeoutMs<"u"?s.timeoutMs!=null&&(r=AbortSignal.timeout(s.timeoutMs)):this.timeoutMs!=null&&(r=AbortSignal.timeout(this.timeoutMs)),t.signal=H(r,t.signal);const n=new URL(`${this.apiUrl}${e}`);if(t.params){for(const[i,a]of Object.entries(t.params)){if(a==null)continue;const o=typeof a=="string"||typeof a=="number"?a.toString():JSON.stringify(a);n.searchParams.append(i,o)}delete t.params}return[n,t]}async fetch(e,s){const[t,r]=this.prepareFetchOptions(e,s);let n=r;this.onRequest&&(n=await this.onRequest(t,r));const i=await this.asyncCaller.fetch(t,n),a=(()=>{if(!(i.status===202||i.status===204))return i.json()})();return s?.withResponse?[await a,i]:a}},G=class extends l{async createForThread(e,s,t){const r={schedule:t?.schedule,input:t?.input,config:t?.config,context:t?.context,metadata:t?.metadata,assistant_id:s,interrupt_before:t?.interruptBefore,interrupt_after:t?.interruptAfter,webhook:t?.webhook,multitask_strategy:t?.multitaskStrategy,if_not_exists:t?.ifNotExists,checkpoint_during:t?.checkpointDuring,durability:t?.durability};return this.fetch(`/threads/${e}/runs/crons`,{method:"POST",json:r})}async create(e,s){const t={schedule:s?.schedule,input:s?.input,config:s?.config,context:s?.context,metadata:s?.metadata,assistant_id:e,interrupt_before:s?.interruptBefore,interrupt_after:s?.interruptAfter,webhook:s?.webhook,multitask_strategy:s?.multitaskStrategy,if_not_exists:s?.ifNotExists,checkpoint_during:s?.checkpointDuring,durability:s?.durability};return this.fetch("/runs/crons",{method:"POST",json:t})}async delete(e){await this.fetch(`/runs/crons/${e}`,{method:"DELETE"})}async search(e){return this.fetch("/runs/crons/search",{method:"POST",json:{assistant_id:e?.assistantId??void 0,thread_id:e?.threadId??void 0,limit:e?.limit??10,offset:e?.offset??0,sort_by:e?.sortBy??void 0,sort_order:e?.sortOrder??void 0,select:e?.select??void 0}})}async count(e){return this.fetch("/runs/crons/count",{method:"POST",json:{assistant_id:e?.assistantId??void 0,thread_id:e?.threadId??void 0}})}},K=class extends l{async get(e){return this.fetch(`/assistants/${e}`)}async getGraph(e,s){return this.fetch(`/assistants/${e}/graph`,{params:{xray:s?.xray}})}async getSchemas(e){return this.fetch(`/assistants/${e}/schemas`)}async getSubgraphs(e,s){return s?.namespace?this.fetch(`/assistants/${e}/subgraphs/${s.namespace}`,{params:{recurse:s?.recurse}}):this.fetch(`/assistants/${e}/subgraphs`,{params:{recurse:s?.recurse}})}async create(e){return this.fetch("/assistants",{method:"POST",json:{graph_id:e.graphId,config:e.config,context:e.context,metadata:e.metadata,assistant_id:e.assistantId,if_exists:e.ifExists,name:e.name,description:e.description}})}async update(e,s){return this.fetch(`/assistants/${e}`,{method:"PATCH",json:{graph_id:s.graphId,config:s.config,context:s.context,metadata:s.metadata,name:s.name,description:s.description}})}async delete(e){return this.fetch(`/assistants/${e}`,{method:"DELETE"})}async search(e){return this.fetch("/assistants/search",{method:"POST",json:{graph_id:e?.graphId??void 0,metadata:e?.metadata??void 0,limit:e?.limit??10,offset:e?.offset??0,sort_by:e?.sortBy??void 0,sort_order:e?.sortOrder??void 0,select:e?.select??void 0}})}async count(e){return this.fetch("/assistants/count",{method:"POST",json:{metadata:e?.metadata??void 0,graph_id:e?.graphId??void 0}})}async getVersions(e,s){return this.fetch(`/assistants/${e}/versions`,{method:"POST",json:{metadata:s?.metadata??void 0,limit:s?.limit??10,offset:s?.offset??0}})}async setLatest(e,s){return this.fetch(`/assistants/${e}/latest`,{method:"POST",json:{version:s}})}},q=class extends l{async get(e){return this.fetch(`/threads/${e}`)}async create(e){const s=typeof e?.ttl=="number"?{ttl:e.ttl,strategy:"delete"}:e?.ttl;return this.fetch("/threads",{method:"POST",json:{metadata:{...e?.metadata,graph_id:e?.graphId},thread_id:e?.threadId,if_exists:e?.ifExists,supersteps:e?.supersteps?.map(t=>({updates:t.updates.map(r=>({values:r.values,command:r.command,as_node:r.asNode}))})),ttl:s}})}async copy(e){return this.fetch(`/threads/${e}/copy`,{method:"POST"})}async update(e,s){const t=typeof s?.ttl=="number"?{ttl:s.ttl,strategy:"delete"}:s?.ttl;return this.fetch(`/threads/${e}`,{method:"PATCH",json:{metadata:s?.metadata,ttl:t}})}async delete(e){return this.fetch(`/threads/${e}`,{method:"DELETE"})}async search(e){return this.fetch("/threads/search",{method:"POST",json:{metadata:e?.metadata??void 0,ids:e?.ids??void 0,limit:e?.limit??10,offset:e?.offset??0,status:e?.status,sort_by:e?.sortBy,sort_order:e?.sortOrder,select:e?.select??void 0}})}async count(e){return this.fetch("/threads/count",{method:"POST",json:{metadata:e?.metadata??void 0,values:e?.values??void 0,status:e?.status??void 0}})}async getState(e,s,t){return s!=null?typeof s!="string"?this.fetch(`/threads/${e}/state/checkpoint`,{method:"POST",json:{checkpoint:s,subgraphs:t?.subgraphs}}):this.fetch(`/threads/${e}/state/${s}`,{params:{subgraphs:t?.subgraphs}}):this.fetch(`/threads/${e}/state`,{params:{subgraphs:t?.subgraphs}})}async updateState(e,s){return this.fetch(`/threads/${e}/state`,{method:"POST",json:{values:s.values,checkpoint_id:s.checkpointId,checkpoint:s.checkpoint,as_node:s?.asNode}})}async patchState(e,s){let t;if(typeof e!="string"){if(typeof e.configurable?.thread_id!="string")throw new Error("Thread ID is required when updating state with a config.");t=e.configurable.thread_id}else t=e;return this.fetch(`/threads/${t}/state`,{method:"PATCH",json:{metadata:s}})}async getHistory(e,s){return this.fetch(`/threads/${e}/history`,{method:"POST",json:{limit:s?.limit??10,before:s?.before,metadata:s?.metadata,checkpoint:s?.checkpoint}})}async*joinStream(e,s){let[t,r]=this.prepareFetchOptions(`/threads/${e}/stream`,{method:"GET",headers:s?.lastEventId?{"Last-Event-ID":s.lastEventId}:void 0,params:s?.streamMode?{stream_mode:s.streamMode}:void 0});this.onRequest!=null&&(r=await this.onRequest(t,r));const i=((await this.asyncCaller.fetch(t,r)).body||new ReadableStream({start:a=>a.close()})).pipeThrough(w()).pipeThrough(v());yield*T.fromReadableStream(i)}},J=class extends l{async*stream(e,s,t){const r={input:t?.input,command:t?.command,config:t?.config,context:t?.context,metadata:t?.metadata,stream_mode:t?.streamMode,stream_subgraphs:t?.streamSubgraphs,stream_resumable:t?.streamResumable,feedback_keys:t?.feedbackKeys,assistant_id:s,interrupt_before:t?.interruptBefore,interrupt_after:t?.interruptAfter,checkpoint:t?.checkpoint,checkpoint_id:t?.checkpointId,webhook:t?.webhook,multitask_strategy:t?.multitaskStrategy,on_completion:t?.onCompletion,on_disconnect:t?.onDisconnect,after_seconds:t?.afterSeconds,if_not_exists:t?.ifNotExists,checkpoint_during:t?.checkpointDuring,durability:t?.durability},n=e==null?"/runs/stream":`/threads/${e}/runs/stream`;let[i,a]=this.prepareFetchOptions(n,{method:"POST",json:r,timeoutMs:null,signal:t?.signal});this.onRequest!=null&&(a=await this.onRequest(i,a));const o=await this.asyncCaller.fetch(i,a),c=_(o);c&&t?.onRunCreated?.(c);const u=(o.body||new ReadableStream({start:h=>h.close()})).pipeThrough(w()).pipeThrough(v());yield*T.fromReadableStream(u)}async create(e,s,t){const r={input:t?.input,command:t?.command,config:t?.config,context:t?.context,metadata:t?.metadata,stream_mode:t?.streamMode,stream_subgraphs:t?.streamSubgraphs,stream_resumable:t?.streamResumable,assistant_id:s,interrupt_before:t?.interruptBefore,interrupt_after:t?.interruptAfter,webhook:t?.webhook,checkpoint:t?.checkpoint,checkpoint_id:t?.checkpointId,multitask_strategy:t?.multitaskStrategy,after_seconds:t?.afterSeconds,if_not_exists:t?.ifNotExists,checkpoint_during:t?.checkpointDuring,durability:t?.durability,langsmith_tracer:t?._langsmithTracer?{project_name:t?._langsmithTracer?.projectName,example_id:t?._langsmithTracer?.exampleId}:void 0},n=e===null?"/runs":`/threads/${e}/runs`,[i,a]=await this.fetch(n,{method:"POST",json:r,signal:t?.signal,withResponse:!0}),o=_(a);return o&&t?.onRunCreated?.(o),i}async createBatch(e){const s=e.map(t=>({...t,assistant_id:t.assistantId})).map(t=>Object.fromEntries(Object.entries(t).filter(([r,n])=>n!==void 0)));return this.fetch("/runs/batch",{method:"POST",json:s})}async wait(e,s,t){const r={input:t?.input,command:t?.command,config:t?.config,context:t?.context,metadata:t?.metadata,assistant_id:s,interrupt_before:t?.interruptBefore,interrupt_after:t?.interruptAfter,checkpoint:t?.checkpoint,checkpoint_id:t?.checkpointId,webhook:t?.webhook,multitask_strategy:t?.multitaskStrategy,on_completion:t?.onCompletion,on_disconnect:t?.onDisconnect,after_seconds:t?.afterSeconds,if_not_exists:t?.ifNotExists,checkpoint_during:t?.checkpointDuring,durability:t?.durability,langsmith_tracer:t?._langsmithTracer?{project_name:t?._langsmithTracer?.projectName,example_id:t?._langsmithTracer?.exampleId}:void 0},n=e==null?"/runs/wait":`/threads/${e}/runs/wait`,[i,a]=await this.fetch(n,{method:"POST",json:r,timeoutMs:null,signal:t?.signal,withResponse:!0}),o=_(a);if(o&&t?.onRunCreated?.(o),(t?.raiseError!==void 0?t.raiseError:!0)&&"__error__"in i&&typeof i.__error__=="object"&&i.__error__&&"error"in i.__error__&&"message"in i.__error__)throw new Error(`${i.__error__?.error}: ${i.__error__?.message}`);return i}async list(e,s){return this.fetch(`/threads/${e}/runs`,{params:{limit:s?.limit??10,offset:s?.offset??0,status:s?.status??void 0,select:s?.select??void 0}})}async get(e,s){return this.fetch(`/threads/${e}/runs/${s}`)}async cancel(e,s,t=!1,r="interrupt"){return this.fetch(`/threads/${e}/runs/${s}/cancel`,{method:"POST",params:{wait:t?"1":"0",action:r}})}async join(e,s,t){return this.fetch(`/threads/${e}/runs/${s}/join`,{timeoutMs:null,signal:t?.signal})}async*joinStream(e,s,t){const r=typeof t=="object"&&t!=null&&t instanceof AbortSignal?{signal:t}:t;let[n,i]=this.prepareFetchOptions(e!=null?`/threads/${e}/runs/${s}/stream`:`/runs/${s}/stream`,{method:"GET",timeoutMs:null,signal:r?.signal,headers:r?.lastEventId?{"Last-Event-ID":r.lastEventId}:void 0,params:{cancel_on_disconnect:r?.cancelOnDisconnect?"1":"0",stream_mode:r?.streamMode}});this.onRequest!=null&&(i=await this.onRequest(n,i));const o=((await this.asyncCaller.fetch(n,i)).body||new ReadableStream({start:c=>c.close()})).pipeThrough(w()).pipeThrough(v());yield*T.fromReadableStream(o)}async delete(e,s){return this.fetch(`/threads/${e}/runs/${s}`,{method:"DELETE"})}},W=class extends l{async putItem(e,s,t,r){e.forEach(i=>{if(i.includes("."))throw new Error(`Invalid namespace label '${i}'. Namespace labels cannot contain periods ('.')`)});const n={namespace:e,key:s,value:t,index:r?.index,ttl:r?.ttl};return this.fetch("/store/items",{method:"PUT",json:n})}async getItem(e,s,t){e.forEach(i=>{if(i.includes("."))throw new Error(`Invalid namespace label '${i}'. Namespace labels cannot contain periods ('.')`)});const r={namespace:e.join("."),key:s};t?.refreshTtl!==void 0&&(r.refresh_ttl=t.refreshTtl);const n=await this.fetch("/store/items",{params:r});return n?{...n,createdAt:n.created_at,updatedAt:n.updated_at}:null}async deleteItem(e,s){return e.forEach(t=>{if(t.includes("."))throw new Error(`Invalid namespace label '${t}'. Namespace labels cannot contain periods ('.')`)}),this.fetch("/store/items",{method:"DELETE",json:{namespace:e,key:s}})}async searchItems(e,s){const t={namespace_prefix:e,filter:s?.filter,limit:s?.limit??10,offset:s?.offset??0,query:s?.query,refresh_ttl:s?.refreshTtl};return{items:(await this.fetch("/store/items/search",{method:"POST",json:t})).items.map(n=>({...n,createdAt:n.created_at,updatedAt:n.updated_at}))}}async listNamespaces(e){const s={prefix:e?.prefix,suffix:e?.suffix,max_depth:e?.maxDepth,limit:e?.limit??100,offset:e?.offset??0};return this.fetch("/store/namespaces",{method:"POST",json:s})}},V=class f extends l{static promiseCache={};static getOrCached(s,t){if(f.promiseCache[s]!=null)return f.promiseCache[s];const r=t();return f.promiseCache[s]=r,r}async getComponent(s,t){return f.getOrCached(`${this.apiUrl}-${s}-${t}`,async()=>{let[r,n]=this.prepareFetchOptions(`/ui/${s}`,{headers:{Accept:"text/html","Content-Type":"application/json"},method:"POST",json:{name:t}});return this.onRequest!=null&&(n=await this.onRequest(r,n)),(await this.asyncCaller.fetch(r,n)).text()})}},z=class{assistants;threads;runs;crons;store;"~ui";"~configHash";constructor(e){this["~configHash"]=JSON.stringify({apiUrl:e?.apiUrl,apiKey:e?.apiKey,timeoutMs:e?.timeoutMs,defaultHeaders:e?.defaultHeaders,maxConcurrency:e?.callerOptions?.maxConcurrency,maxRetries:e?.callerOptions?.maxRetries,callbacks:{onFailedResponseHook:e?.callerOptions?.onFailedResponseHook!=null,onRequest:e?.onRequest!=null,fetch:e?.callerOptions?.fetch!=null}}),this.assistants=new K(e),this.threads=new q(e),this.runs=new J(e),this.crons=new G(e),this.store=new W(e),this["~ui"]=new V(e)}};export{z as Client,U as getApiKey};
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import{_ as o,l as te,c as H,I as fe,ag as ye,ah as be,ai as me,ab as _e,G as K,h as j,t as Ee,J as ke,ac as Se,ad as ce,ae as le}from"./mermaid.core-oWlc3CvG.js";import{g as Ne}from"./chunk-FMBD7UC4-C54-XKR7.js";import"./index-C7NPwb1W.js";var $=function(){var e=o(function(O,i,n,r){for(n=n||{},r=O.length;r--;n[O[r]]=i);return n},"o"),u=[1,4],p=[1,13],s=[1,12],d=[1,15],E=[1,16],b=[1,20],l=[1,19],D=[6,7,8],I=[1,26],g=[1,24],w=[1,25],_=[6,7,11],F=[1,31],N=[6,7,11,24],V=[1,6,13,16,17,20,23],m=[1,35],A=[1,36],L=[1,6,7,11,13,16,17,20,23],M=[1,38],T={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:o(function(i,n,r,a,h,t,U){var c=t.length-1;switch(h){case 6:case 7:return a;case 8:a.getLogger().trace("Stop NL ");break;case 9:a.getLogger().trace("Stop EOF ");break;case 11:a.getLogger().trace("Stop NL2 ");break;case 12:a.getLogger().trace("Stop EOF2 ");break;case 15:a.getLogger().info("Node: ",t[c-1].id),a.addNode(t[c-2].length,t[c-1].id,t[c-1].descr,t[c-1].type,t[c]);break;case 16:a.getLogger().info("Node: ",t[c].id),a.addNode(t[c-1].length,t[c].id,t[c].descr,t[c].type);break;case 17:a.getLogger().trace("Icon: ",t[c]),a.decorateNode({icon:t[c]});break;case 18:case 23:a.decorateNode({class:t[c]});break;case 19:a.getLogger().trace("SPACELIST");break;case 20:a.getLogger().trace("Node: ",t[c-1].id),a.addNode(0,t[c-1].id,t[c-1].descr,t[c-1].type,t[c]);break;case 21:a.getLogger().trace("Node: ",t[c].id),a.addNode(0,t[c].id,t[c].descr,t[c].type);break;case 22:a.decorateNode({icon:t[c]});break;case 27:a.getLogger().trace("node found ..",t[c-2]),this.$={id:t[c-1],descr:t[c-1],type:a.getType(t[c-2],t[c])};break;case 28:this.$={id:t[c],descr:t[c],type:0};break;case 29:a.getLogger().trace("node found ..",t[c-3]),this.$={id:t[c-3],descr:t[c-1],type:a.getType(t[c-2],t[c])};break;case 30:this.$=t[c-1]+t[c];break;case 31:this.$=t[c];break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:u},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:u},{6:p,7:[1,10],9:9,12:11,13:s,14:14,16:d,17:E,18:17,19:18,20:b,23:l},e(D,[2,3]),{1:[2,2]},e(D,[2,4]),e(D,[2,5]),{1:[2,6],6:p,12:21,13:s,14:14,16:d,17:E,18:17,19:18,20:b,23:l},{6:p,9:22,12:11,13:s,14:14,16:d,17:E,18:17,19:18,20:b,23:l},{6:I,7:g,10:23,11:w},e(_,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:b,23:l}),e(_,[2,19]),e(_,[2,21],{15:30,24:F}),e(_,[2,22]),e(_,[2,23]),e(N,[2,25]),e(N,[2,26]),e(N,[2,28],{20:[1,32]}),{21:[1,33]},{6:I,7:g,10:34,11:w},{1:[2,7],6:p,12:21,13:s,14:14,16:d,17:E,18:17,19:18,20:b,23:l},e(V,[2,14],{7:m,11:A}),e(L,[2,8]),e(L,[2,9]),e(L,[2,10]),e(_,[2,16],{15:37,24:F}),e(_,[2,17]),e(_,[2,18]),e(_,[2,20],{24:M}),e(N,[2,31]),{21:[1,39]},{22:[1,40]},e(V,[2,13],{7:m,11:A}),e(L,[2,11]),e(L,[2,12]),e(_,[2,15],{24:M}),e(N,[2,30]),{22:[1,41]},e(N,[2,27]),e(N,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:o(function(i,n){if(n.recoverable)this.trace(i);else{var r=new Error(i);throw r.hash=n,r}},"parseError"),parse:o(function(i){var n=this,r=[0],a=[],h=[null],t=[],U=this.table,c="",W=0,se=0,ue=2,re=1,ge=t.slice.call(arguments,1),y=Object.create(this.lexer),R={yy:{}};for(var J in this.yy)Object.prototype.hasOwnProperty.call(this.yy,J)&&(R.yy[J]=this.yy[J]);y.setInput(i,R.yy),R.yy.lexer=y,R.yy.parser=this,typeof y.yylloc>"u"&&(y.yylloc={});var q=y.yylloc;t.push(q);var de=y.options&&y.options.ranges;typeof R.yy.parseError=="function"?this.parseError=R.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pe(S){r.length=r.length-2*S,h.length=h.length-S,t.length=t.length-S}o(pe,"popStack");function ae(){var S;return S=a.pop()||y.lex()||re,typeof S!="number"&&(S instanceof Array&&(a=S,S=a.pop()),S=n.symbols_[S]||S),S}o(ae,"lex");for(var k,P,x,Q,G={},z,C,oe,X;;){if(P=r[r.length-1],this.defaultActions[P]?x=this.defaultActions[P]:((k===null||typeof k>"u")&&(k=ae()),x=U[P]&&U[P][k]),typeof x>"u"||!x.length||!x[0]){var Z="";X=[];for(z in U[P])this.terminals_[z]&&z>ue&&X.push("'"+this.terminals_[z]+"'");y.showPosition?Z="Parse error on line "+(W+1)+`:
|
|
2
|
-
`+y.showPosition()+`
|
|
3
|
-
Expecting `+X.join(", ")+", got '"+(this.terminals_[k]||k)+"'":Z="Parse error on line "+(W+1)+": Unexpected "+(k==re?"end of input":"'"+(this.terminals_[k]||k)+"'"),this.parseError(Z,{text:y.match,token:this.terminals_[k]||k,line:y.yylineno,loc:q,expected:X})}if(x[0]instanceof Array&&x.length>1)throw new Error("Parse Error: multiple actions possible at state: "+P+", token: "+k);switch(x[0]){case 1:r.push(k),h.push(y.yytext),t.push(y.yylloc),r.push(x[1]),k=null,se=y.yyleng,c=y.yytext,W=y.yylineno,q=y.yylloc;break;case 2:if(C=this.productions_[x[1]][1],G.$=h[h.length-C],G._$={first_line:t[t.length-(C||1)].first_line,last_line:t[t.length-1].last_line,first_column:t[t.length-(C||1)].first_column,last_column:t[t.length-1].last_column},de&&(G._$.range=[t[t.length-(C||1)].range[0],t[t.length-1].range[1]]),Q=this.performAction.apply(G,[c,se,W,R.yy,x[1],h,t].concat(ge)),typeof Q<"u")return Q;C&&(r=r.slice(0,-1*C*2),h=h.slice(0,-1*C),t=t.slice(0,-1*C)),r.push(this.productions_[x[1]][0]),h.push(G.$),t.push(G._$),oe=U[r[r.length-2]][r[r.length-1]],r.push(oe);break;case 3:return!0}}return!0},"parse")},Y=function(){var O={EOF:1,parseError:o(function(n,r){if(this.yy.parser)this.yy.parser.parseError(n,r);else throw new Error(n)},"parseError"),setInput:o(function(i,n){return this.yy=n||this.yy||{},this._input=i,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var i=this._input[0];this.yytext+=i,this.yyleng++,this.offset++,this.match+=i,this.matched+=i;var n=i.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),i},"input"),unput:o(function(i){var n=i.length,r=i.split(/(?:\r\n?|\n)/g);this._input=i+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var a=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),r.length-1&&(this.yylineno-=r.length-1);var h=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:r?(r.length===a.length?this.yylloc.first_column:0)+a[a.length-r.length].length-r[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[h[0],h[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
|
-
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(i){this.unput(this.match.slice(i))},"less"),pastInput:o(function(){var i=this.matched.substr(0,this.matched.length-this.match.length);return(i.length>20?"...":"")+i.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var i=this.match;return i.length<20&&(i+=this._input.substr(0,20-i.length)),(i.substr(0,20)+(i.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var i=this.pastInput(),n=new Array(i.length+1).join("-");return i+this.upcomingInput()+`
|
|
5
|
-
`+n+"^"},"showPosition"),test_match:o(function(i,n){var r,a,h;if(this.options.backtrack_lexer&&(h={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(h.yylloc.range=this.yylloc.range.slice(0))),a=i[0].match(/(?:\r\n?|\n).*/g),a&&(this.yylineno+=a.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:a?a[a.length-1].length-a[a.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+i[0].length},this.yytext+=i[0],this.match+=i[0],this.matches=i,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(i[0].length),this.matched+=i[0],r=this.performAction.call(this,this.yy,this,n,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),r)return r;if(this._backtrack){for(var t in h)this[t]=h[t];return!1}return!1},"test_match"),next:o(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var i,n,r,a;this._more||(this.yytext="",this.match="");for(var h=this._currentRules(),t=0;t<h.length;t++)if(r=this._input.match(this.rules[h[t]]),r&&(!n||r[0].length>n[0].length)){if(n=r,a=t,this.options.backtrack_lexer){if(i=this.test_match(r,h[t]),i!==!1)return i;if(this._backtrack){n=!1;continue}else return!1}else if(!this.options.flex)break}return n?(i=this.test_match(n,h[a]),i!==!1?i:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
6
|
-
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:o(function(){var n=this.next();return n||this.lex()},"lex"),begin:o(function(n){this.conditionStack.push(n)},"begin"),popState:o(function(){var n=this.conditionStack.length-1;return n>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:o(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:o(function(n){return n=this.conditionStack.length-1-Math.abs(n||0),n>=0?this.conditionStack[n]:"INITIAL"},"topState"),pushState:o(function(n){this.begin(n)},"pushState"),stateStackSize:o(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:o(function(n,r,a,h){switch(a){case 0:return this.pushState("shapeData"),r.yytext="",24;case 1:return this.pushState("shapeDataStr"),24;case 2:return this.popState(),24;case 3:const t=/\n\s*/g;return r.yytext=r.yytext.replace(t,"<br/>"),24;case 4:return 24;case 5:this.popState();break;case 6:return n.getLogger().trace("Found comment",r.yytext),6;case 7:return 8;case 8:this.begin("CLASS");break;case 9:return this.popState(),17;case 10:this.popState();break;case 11:n.getLogger().trace("Begin icon"),this.begin("ICON");break;case 12:return n.getLogger().trace("SPACELINE"),6;case 13:return 7;case 14:return 16;case 15:n.getLogger().trace("end icon"),this.popState();break;case 16:return n.getLogger().trace("Exploding node"),this.begin("NODE"),20;case 17:return n.getLogger().trace("Cloud"),this.begin("NODE"),20;case 18:return n.getLogger().trace("Explosion Bang"),this.begin("NODE"),20;case 19:return n.getLogger().trace("Cloud Bang"),this.begin("NODE"),20;case 20:return this.begin("NODE"),20;case 21:return this.begin("NODE"),20;case 22:return this.begin("NODE"),20;case 23:return this.begin("NODE"),20;case 24:return 13;case 25:return 23;case 26:return 11;case 27:this.begin("NSTR2");break;case 28:return"NODE_DESCR";case 29:this.popState();break;case 30:n.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 31:return n.getLogger().trace("description:",r.yytext),"NODE_DESCR";case 32:this.popState();break;case 33:return this.popState(),n.getLogger().trace("node end ))"),"NODE_DEND";case 34:return this.popState(),n.getLogger().trace("node end )"),"NODE_DEND";case 35:return this.popState(),n.getLogger().trace("node end ...",r.yytext),"NODE_DEND";case 36:return this.popState(),n.getLogger().trace("node end (("),"NODE_DEND";case 37:return this.popState(),n.getLogger().trace("node end (-"),"NODE_DEND";case 38:return this.popState(),n.getLogger().trace("node end (-"),"NODE_DEND";case 39:return this.popState(),n.getLogger().trace("node end (("),"NODE_DEND";case 40:return this.popState(),n.getLogger().trace("node end (("),"NODE_DEND";case 41:return n.getLogger().trace("Long description:",r.yytext),21;case 42:return n.getLogger().trace("Long description:",r.yytext),21}},"anonymous"),rules:[/^(?:@\{)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^\"]+)/i,/^(?:[^}^"]+)/i,/^(?:\})/i,/^(?:\s*%%.*)/i,/^(?:kanban\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\)\{\}@]+)/i,/^(?:$)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{shapeDataEndBracket:{rules:[],inclusive:!1},shapeDataStr:{rules:[2,3],inclusive:!1},shapeData:{rules:[1,4,5],inclusive:!1},CLASS:{rules:[9,10],inclusive:!1},ICON:{rules:[14,15],inclusive:!1},NSTR2:{rules:[28,29],inclusive:!1},NSTR:{rules:[31,32],inclusive:!1},NODE:{rules:[27,30,33,34,35,36,37,38,39,40,41,42],inclusive:!1},INITIAL:{rules:[0,6,7,8,11,12,13,16,17,18,19,20,21,22,23,24,25,26],inclusive:!0}}};return O}();T.lexer=Y;function B(){this.yy={}}return o(B,"Parser"),B.prototype=T,T.Parser=B,new B}();$.parser=$;var xe=$,v=[],ne=[],ee=0,ie={},ve=o(()=>{v=[],ne=[],ee=0,ie={}},"clear"),De=o(e=>{if(v.length===0)return null;const u=v[0].level;let p=null;for(let s=v.length-1;s>=0;s--)if(v[s].level===u&&!p&&(p=v[s]),v[s].level<u)throw new Error('Items without section detected, found section ("'+v[s].label+'")');return e===p?.level?null:p},"getSection"),he=o(function(){return ne},"getSections"),Le=o(function(){const e=[],u=[],p=he(),s=H();for(const d of p){const E={id:d.id,label:j(d.label??"",s),isGroup:!0,ticket:d.ticket,shape:"kanbanSection",level:d.level,look:s.look};u.push(E);const b=v.filter(l=>l.parentId===d.id);for(const l of b){const D={id:l.id,parentId:d.id,label:j(l.label??"",s),isGroup:!1,ticket:l?.ticket,priority:l?.priority,assigned:l?.assigned,icon:l?.icon,shape:"kanbanItem",level:l.level,rx:5,ry:5,cssStyles:["text-align: left"]};u.push(D)}}return{nodes:u,edges:e,other:{},config:H()}},"getData"),Oe=o((e,u,p,s,d)=>{const E=H();let b=E.mindmap?.padding??K.mindmap.padding;switch(s){case f.ROUNDED_RECT:case f.RECT:case f.HEXAGON:b*=2}const l={id:j(u,E)||"kbn"+ee++,level:e,label:j(p,E),width:E.mindmap?.maxNodeWidth??K.mindmap.maxNodeWidth,padding:b,isGroup:!1};if(d!==void 0){let I;d.includes(`
|
|
7
|
-
`)?I=d+`
|
|
8
|
-
`:I=`{
|
|
9
|
-
`+d+`
|
|
10
|
-
}`;const g=Ee(I,{schema:ke});if(g.shape&&(g.shape!==g.shape.toLowerCase()||g.shape.includes("_")))throw new Error(`No such shape: ${g.shape}. Shape names should be lowercase.`);g?.shape&&g.shape==="kanbanItem"&&(l.shape=g?.shape),g?.label&&(l.label=g?.label),g?.icon&&(l.icon=g?.icon.toString()),g?.assigned&&(l.assigned=g?.assigned.toString()),g?.ticket&&(l.ticket=g?.ticket.toString()),g?.priority&&(l.priority=g?.priority)}const D=De(e);D?l.parentId=D.id||"kbn"+ee++:ne.push(l),v.push(l)},"addNode"),f={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},Ie=o((e,u)=>{switch(te.debug("In get type",e,u),e){case"[":return f.RECT;case"(":return u===")"?f.ROUNDED_RECT:f.CLOUD;case"((":return f.CIRCLE;case")":return f.CLOUD;case"))":return f.BANG;case"{{":return f.HEXAGON;default:return f.DEFAULT}},"getType"),Ce=o((e,u)=>{ie[e]=u},"setElementForId"),we=o(e=>{if(!e)return;const u=H(),p=v[v.length-1];e.icon&&(p.icon=j(e.icon,u)),e.class&&(p.cssClasses=j(e.class,u))},"decorateNode"),Ae=o(e=>{switch(e){case f.DEFAULT:return"no-border";case f.RECT:return"rect";case f.ROUNDED_RECT:return"rounded-rect";case f.CIRCLE:return"circle";case f.CLOUD:return"cloud";case f.BANG:return"bang";case f.HEXAGON:return"hexgon";default:return"no-border"}},"type2Str"),Te=o(()=>te,"getLogger"),Re=o(e=>ie[e],"getElementById"),Pe={clear:ve,addNode:Oe,getSections:he,getData:Le,nodeType:f,getType:Ie,setElementForId:Ce,decorateNode:we,type2Str:Ae,getLogger:Te,getElementById:Re},Ve=Pe,Be=o(async(e,u,p,s)=>{te.debug(`Rendering kanban diagram
|
|
11
|
-
`+e);const E=s.db.getData(),b=H();b.htmlLabels=!1;const l=fe(u),D=l.append("g");D.attr("class","sections");const I=l.append("g");I.attr("class","items");const g=E.nodes.filter(m=>m.isGroup);let w=0;const _=10,F=[];let N=25;for(const m of g){const A=b?.kanban?.sectionWidth||200;w=w+1,m.x=A*w+(w-1)*_/2,m.width=A,m.y=0,m.height=A*3,m.rx=5,m.ry=5,m.cssClasses=m.cssClasses+" section-"+w;const L=await ye(D,m);N=Math.max(N,L?.labelBBox?.height),F.push(L)}let V=0;for(const m of g){const A=F[V];V=V+1;const L=b?.kanban?.sectionWidth||200,M=-L*3/2+N;let T=M;const Y=E.nodes.filter(i=>i.parentId===m.id);for(const i of Y){if(i.isGroup)throw new Error("Groups within groups are not allowed in Kanban diagrams");i.x=m.x,i.width=L-1.5*_;const r=(await be(I,i,{config:b})).node().getBBox();i.y=T+r.height/2,await me(i),T=i.y+r.height/2+_/2}const B=A.cluster.select("rect"),O=Math.max(T-M+3*_,50)+(N-25);B.attr("height",O)}_e(void 0,l,b.mindmap?.padding??K.kanban.padding,b.mindmap?.useMaxWidth??K.kanban.useMaxWidth)},"draw"),Ge={draw:Be},je=o(e=>{let u="";for(let s=0;s<e.THEME_COLOR_LIMIT;s++)e["lineColor"+s]=e["lineColor"+s]||e["cScaleInv"+s],Se(e["lineColor"+s])?e["lineColor"+s]=ce(e["lineColor"+s],20):e["lineColor"+s]=le(e["lineColor"+s],20);const p=o((s,d)=>e.darkMode?le(s,d):ce(s,d),"adjuster");for(let s=0;s<e.THEME_COLOR_LIMIT;s++){const d=""+(17-3*s);u+=`
|
|
12
|
-
.section-${s-1} rect, .section-${s-1} path, .section-${s-1} circle, .section-${s-1} polygon, .section-${s-1} path {
|
|
13
|
-
fill: ${p(e["cScale"+s],10)};
|
|
14
|
-
stroke: ${p(e["cScale"+s],10)};
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
.section-${s-1} text {
|
|
18
|
-
fill: ${e["cScaleLabel"+s]};
|
|
19
|
-
}
|
|
20
|
-
.node-icon-${s-1} {
|
|
21
|
-
font-size: 40px;
|
|
22
|
-
color: ${e["cScaleLabel"+s]};
|
|
23
|
-
}
|
|
24
|
-
.section-edge-${s-1}{
|
|
25
|
-
stroke: ${e["cScale"+s]};
|
|
26
|
-
}
|
|
27
|
-
.edge-depth-${s-1}{
|
|
28
|
-
stroke-width: ${d};
|
|
29
|
-
}
|
|
30
|
-
.section-${s-1} line {
|
|
31
|
-
stroke: ${e["cScaleInv"+s]} ;
|
|
32
|
-
stroke-width: 3;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.disabled, .disabled circle, .disabled text {
|
|
36
|
-
fill: lightgray;
|
|
37
|
-
}
|
|
38
|
-
.disabled text {
|
|
39
|
-
fill: #efefef;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.node rect,
|
|
43
|
-
.node circle,
|
|
44
|
-
.node ellipse,
|
|
45
|
-
.node polygon,
|
|
46
|
-
.node path {
|
|
47
|
-
fill: ${e.background};
|
|
48
|
-
stroke: ${e.nodeBorder};
|
|
49
|
-
stroke-width: 1px;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.kanban-ticket-link {
|
|
53
|
-
fill: ${e.background};
|
|
54
|
-
stroke: ${e.nodeBorder};
|
|
55
|
-
text-decoration: underline;
|
|
56
|
-
}
|
|
57
|
-
`}return u},"genSections"),Fe=o(e=>`
|
|
58
|
-
.edge {
|
|
59
|
-
stroke-width: 3;
|
|
60
|
-
}
|
|
61
|
-
${je(e)}
|
|
62
|
-
.section-root rect, .section-root path, .section-root circle, .section-root polygon {
|
|
63
|
-
fill: ${e.git0};
|
|
64
|
-
}
|
|
65
|
-
.section-root text {
|
|
66
|
-
fill: ${e.gitBranchLabel0};
|
|
67
|
-
}
|
|
68
|
-
.icon-container {
|
|
69
|
-
height:100%;
|
|
70
|
-
display: flex;
|
|
71
|
-
justify-content: center;
|
|
72
|
-
align-items: center;
|
|
73
|
-
}
|
|
74
|
-
.edge {
|
|
75
|
-
fill: none;
|
|
76
|
-
}
|
|
77
|
-
.cluster-label, .label {
|
|
78
|
-
color: ${e.textColor};
|
|
79
|
-
fill: ${e.textColor};
|
|
80
|
-
}
|
|
81
|
-
.kanban-label {
|
|
82
|
-
dy: 1em;
|
|
83
|
-
alignment-baseline: middle;
|
|
84
|
-
text-anchor: middle;
|
|
85
|
-
dominant-baseline: middle;
|
|
86
|
-
text-align: center;
|
|
87
|
-
}
|
|
88
|
-
${Ne()}
|
|
89
|
-
`,"getStyles"),Me=Fe,ze={db:Ve,renderer:Ge,parser:xe,styles:Me};export{ze as diagram};
|