likec4 1.55.1 → 1.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__app__/chunks/AIChat2.mjs +2 -0
- package/__app__/chunks/DiagramActorProvider.mjs +10 -0
- package/__app__/chunks/EmbedPage.mjs +1 -0
- package/__app__/chunks/ExportPage.mjs +2 -0
- package/__app__/chunks/LikeC4Diagram.mjs +19 -0
- package/__app__/chunks/LikeC4Styles.mjs +48 -0
- package/__app__/chunks/Markdown.mjs +1 -0
- package/__app__/chunks/NavigationPanel.mjs +1 -0
- package/__app__/chunks/ViewReact.mjs +1 -0
- package/__app__/chunks/adhoc-editor.mjs +1 -0
- package/__app__/chunks/aichat.mjs +1 -0
- package/__app__/chunks/box.mjs +1 -0
- package/__app__/chunks/create-style-context.mjs +1 -0
- package/__app__/chunks/css.mjs +1 -0
- package/__app__/chunks/factory.mjs +1 -0
- package/__app__/chunks/hooks.mjs +1 -0
- package/__app__/chunks/hstack.mjs +1 -0
- package/__app__/chunks/libs/@dagrejs/dagre.mjs +1 -0
- package/__app__/chunks/libs/@floating-ui/core.mjs +1 -0
- package/__app__/chunks/libs/@floating-ui/dom.mjs +1 -0
- package/__app__/chunks/libs/@floating-ui/react.mjs +1 -0
- package/__app__/chunks/libs/@mantine/core.mjs +41 -0
- package/__app__/chunks/libs/@mantine/hooks.mjs +1 -0
- package/__app__/chunks/libs/@nanostores/react.mjs +1 -0
- package/__app__/chunks/libs/@react-hookz/web.mjs +1 -0
- package/__app__/chunks/libs/@tabler/icons-react.mjs +358 -0
- package/__app__/chunks/libs/@tanstack/ai-client.mjs +2 -0
- package/__app__/chunks/libs/@tanstack/ai-react-ui.mjs +1 -0
- package/__app__/chunks/libs/@tanstack/ai-react.mjs +1 -0
- package/__app__/chunks/libs/@tanstack/ai.mjs +2 -0
- package/__app__/chunks/libs/@tanstack/history.mjs +1 -0
- package/__app__/chunks/libs/@tanstack/react-router.mjs +3 -0
- package/__app__/chunks/libs/@tanstack/router-core.mjs +1 -0
- package/__app__/chunks/libs/@xstate/react.mjs +1 -0
- package/__app__/chunks/libs/@xstate/store.mjs +1 -0
- package/__app__/chunks/libs/@xyflow/react.mjs +7 -0
- package/__app__/chunks/libs/@zag-js/anatomy.mjs +1 -0
- package/__app__/chunks/libs/@zag-js/collection.mjs +1 -0
- package/__app__/chunks/libs/@zag-js/core.mjs +1 -0
- package/__app__/chunks/libs/@zag-js/react.mjs +1 -0
- package/__app__/chunks/libs/@zag-js/tree-view.mjs +1 -0
- package/__app__/chunks/libs/bezier-js.mjs +1 -0
- package/__app__/chunks/libs/copy-anything.mjs +1 -0
- package/__app__/chunks/libs/d3-path.mjs +1 -0
- package/__app__/chunks/libs/d3-shape.mjs +1 -0
- package/__app__/chunks/libs/fast-equals.mjs +1 -0
- package/__app__/chunks/libs/framer-motion.mjs +9 -0
- package/__app__/chunks/libs/html-to-image.mjs +2 -0
- package/__app__/chunks/libs/motion-dom.mjs +1 -0
- package/__app__/chunks/libs/nanostores.mjs +1 -0
- package/__app__/chunks/libs/react-error-boundary.mjs +1 -0
- package/__app__/chunks/libs/react-resizable-panels.mjs +1 -0
- package/__app__/chunks/libs/remeda.mjs +1 -0
- package/__app__/chunks/libs/superjson.mjs +1 -0
- package/__app__/chunks/libs/zod.mjs +64 -0
- package/__app__/chunks/rolldown-runtime.mjs +1 -0
- package/__app__/chunks/styles.css.mjs +1 -0
- package/__app__/chunks/txt.mjs +1 -0
- package/__app__/chunks/useLikeC4Project.mjs +1 -0
- package/__app__/codegen/react.mjs +11 -0
- package/__app__/codegen/webcomponent.mjs +942 -0
- package/__app__/src/aichat/index.mjs +1 -0
- package/__app__/src/fonts.css +1 -1
- package/__app__/src/main.mjs +45 -0
- package/__app__/src/pages/AdHocViewEditor.mjs +1 -0
- package/__app__/src/pages/EmbedPage.mjs +1 -0
- package/__app__/src/pages/ExportPage.mjs +1 -0
- package/__app__/src/pages/ProjectsOverview.mjs +1 -0
- package/__app__/src/pages/ViewAsD2.mjs +1 -0
- package/__app__/src/pages/ViewAsDot.mjs +1 -0
- package/__app__/src/pages/ViewAsMmd.mjs +1 -0
- package/__app__/src/pages/ViewAsPuml.mjs +1 -0
- package/__app__/src/pages/ViewEditor.mjs +1 -0
- package/__app__/src/pages/ViewReact.mjs +1 -0
- package/__app__/src/style.css +1 -1
- package/config/schema.json +14 -41
- package/dist/chunks/enableServer.mjs +1 -0
- package/dist/chunks/filenames.mjs +17 -0
- package/dist/{_chunks → chunks}/index.d.mts +2 -1
- package/dist/{_chunks → chunks}/index2.d.mts +639 -388
- package/dist/chunks/libs/@chevrotain/gast.mjs +1 -0
- package/dist/chunks/libs/@chevrotain/regexp-to-ast.mjs +9 -0
- package/dist/chunks/libs/@chevrotain/utils.mjs +1 -0
- package/dist/chunks/libs/@hono/mcp.mjs +70 -0
- package/dist/chunks/libs/@hono/node-server.mjs +1 -0
- package/dist/{_chunks → chunks}/libs/@logtape/logtape.d.mts +2 -0
- package/dist/chunks/libs/@logtape/logtape.mjs +4 -0
- package/dist/chunks/libs/@lume/kiwi.mjs +1 -0
- package/dist/chunks/libs/@modelcontextprotocol/sdk.mjs +12 -0
- package/dist/chunks/libs/@ts-graphviz/ast.mjs +3 -0
- package/dist/chunks/libs/@ts-graphviz/common.d.mts +9 -0
- package/dist/chunks/libs/@ts-graphviz/core.mjs +1 -0
- package/dist/chunks/libs/ajv.mjs +1 -0
- package/dist/chunks/libs/ansi-align.mjs +2 -0
- package/dist/chunks/libs/ansi-regex.mjs +1 -0
- package/dist/chunks/libs/ansi-styles.mjs +1 -0
- package/dist/chunks/libs/atomically.mjs +1 -0
- package/dist/chunks/libs/birpc.mjs +1 -0
- package/dist/chunks/libs/boxen.mjs +22 -0
- package/dist/chunks/libs/chevrotain-allstar.mjs +2 -0
- package/dist/chunks/libs/chevrotain.mjs +58 -0
- package/dist/chunks/libs/conf.mjs +1 -0
- package/dist/chunks/libs/defu.mjs +1 -0
- package/dist/chunks/libs/destr.mjs +1 -0
- package/dist/chunks/libs/eventemitter3.mjs +1 -0
- package/dist/chunks/libs/find-up-simple.mjs +1 -0
- package/dist/chunks/libs/get-port.mjs +1 -0
- package/dist/chunks/libs/hono.mjs +1 -0
- package/dist/chunks/libs/is-docker.mjs +1 -0
- package/dist/chunks/libs/is-error-instance.mjs +1 -0
- package/dist/chunks/libs/is-inside-container.mjs +1 -0
- package/dist/chunks/libs/is-plain-obj.mjs +1 -0
- package/dist/chunks/libs/isexe.mjs +1 -0
- package/dist/chunks/libs/json5.mjs +14 -0
- package/dist/chunks/libs/khroma.mjs +1 -0
- package/dist/chunks/libs/ky.mjs +3 -0
- package/dist/{_chunks → chunks}/libs/langium.d.mts +9 -9
- package/dist/chunks/libs/langium.mjs +32 -0
- package/dist/chunks/libs/merge-error-cause.mjs +2 -0
- package/dist/chunks/libs/p-debounce.mjs +1 -0
- package/dist/chunks/libs/p-limit.mjs +1 -0
- package/dist/chunks/libs/p-queue.mjs +1 -0
- package/dist/chunks/libs/p-timeout.mjs +1 -0
- package/dist/chunks/libs/package-manager-detector.mjs +1 -0
- package/dist/chunks/libs/package-up.mjs +1 -0
- package/dist/chunks/libs/pako.mjs +3 -0
- package/dist/chunks/libs/parse-ms.mjs +1 -0
- package/dist/chunks/libs/pathe.mjs +1 -0
- package/dist/chunks/libs/picomatch.mjs +1 -0
- package/dist/chunks/libs/pretty-ms.mjs +1 -0
- package/dist/chunks/libs/remeda.mjs +1 -0
- package/dist/chunks/libs/safe-stringify.mjs +1 -0
- package/dist/chunks/libs/strip-indent.mjs +1 -0
- package/dist/chunks/libs/tinyrainbow.mjs +1 -0
- package/dist/chunks/libs/ts-graphviz.mjs +1 -0
- package/dist/chunks/libs/ufo.mjs +1 -0
- package/dist/chunks/libs/unctx.mjs +1 -0
- package/dist/chunks/libs/unstorage.mjs +1 -0
- package/dist/chunks/libs/vscode-languageserver.mjs +1 -0
- package/dist/chunks/libs/which.mjs +1 -0
- package/dist/chunks/libs/word-wrap.mjs +12 -0
- package/dist/{_chunks → chunks}/libs/zod.d.mts +62 -25
- package/dist/chunks/node.mjs +93 -0
- package/dist/chunks/plugin.mjs +593 -0
- package/dist/chunks/rolldown-runtime.mjs +1 -0
- package/dist/chunks/sequence-view.mjs +1 -0
- package/dist/cli/index.mjs +188 -59
- package/dist/config/index.d.mts +1 -2
- package/dist/config/index.mjs +1 -1
- package/dist/index.d.mts +2 -135
- package/dist/index.mjs +1 -1
- package/dist/model/index.d.mts +3 -2
- package/dist/model/index.mjs +1 -1
- package/dist/vite-plugin/index.d.mts +90 -9
- package/dist/vite-plugin/index.mjs +1 -1
- package/dist/vite-plugin/internal/chunks/libs/@nanostores/react.mjs +1 -0
- package/dist/vite-plugin/internal/chunks/libs/birpc.mjs +1 -0
- package/dist/vite-plugin/internal/chunks/libs/fast-equals.mjs +1 -0
- package/dist/vite-plugin/internal/chunks/libs/nanostores.mjs +1 -0
- package/dist/vite-plugin/internal/chunks/libs/remeda.mjs +1 -0
- package/dist/vite-plugin/internal/chunks/rolldown-runtime.mjs +1 -0
- package/dist/{_chunks/libs/@nanostores/react.d.mts → vite-plugin/internal/index.d.mts} +103 -45
- package/dist/vite-plugin/internal/index.mjs +1 -0
- package/package.json +74 -80
- package/react/index.d.mts +84 -78
- package/react/index.mjs +51954 -53701
- package/vite-plugin/internal/package.json +2 -2
- package/vite-plugin-modules.d.ts +18 -0
- package/__app__/react/likec4.tsx +0 -25
- package/__app__/src/ProjectsOverview.js +0 -16
- package/__app__/src/const.js +0 -19
- package/__app__/src/likec4.js +0 -21254
- package/__app__/src/main.js +0 -7
- package/__app__/src/routes/index.js +0 -324
- package/__app__/src/routes/projects.js +0 -193
- package/__app__/src/routes/single.js +0 -1983
- package/__app__/src/vendors.js +0 -52683
- package/__app__/src/webcomponent.js +0 -68
- package/dist/THIRD-PARTY-LICENSES.md +0 -1609
- package/dist/_chunks/libs/@chevrotain/cst-dts-gen.mjs +0 -30
- package/dist/_chunks/libs/@chevrotain/regexp-to-ast.mjs +0 -9
- package/dist/_chunks/libs/@chevrotain/types.d.mts +0 -1
- package/dist/_chunks/libs/@chevrotain/utils.mjs +0 -1
- package/dist/_chunks/libs/@hono/mcp.mjs +0 -45
- package/dist/_chunks/libs/@hono/node-server.mjs +0 -1
- package/dist/_chunks/libs/@logtape/logtape.mjs +0 -4
- package/dist/_chunks/libs/@lume/kiwi.mjs +0 -1
- package/dist/_chunks/libs/@modelcontextprotocol/sdk.mjs +0 -12
- package/dist/_chunks/libs/@nanostores/react.mjs +0 -1
- package/dist/_chunks/libs/ajv.mjs +0 -1
- package/dist/_chunks/libs/ansi-align.mjs +0 -2
- package/dist/_chunks/libs/ansi-regex.mjs +0 -1
- package/dist/_chunks/libs/ansi-styles.mjs +0 -1
- package/dist/_chunks/libs/atomically.mjs +0 -1
- package/dist/_chunks/libs/birpc.mjs +0 -1
- package/dist/_chunks/libs/boxen.mjs +0 -22
- package/dist/_chunks/libs/chevrotain-allstar.mjs +0 -2
- package/dist/_chunks/libs/chevrotain.mjs +0 -58
- package/dist/_chunks/libs/conf.mjs +0 -1
- package/dist/_chunks/libs/defu.mjs +0 -1
- package/dist/_chunks/libs/destr.mjs +0 -1
- package/dist/_chunks/libs/esm-env.mjs +0 -1
- package/dist/_chunks/libs/eventemitter3.mjs +0 -1
- package/dist/_chunks/libs/fast-equals.mjs +0 -1
- package/dist/_chunks/libs/find-up-simple.mjs +0 -1
- package/dist/_chunks/libs/get-port.mjs +0 -1
- package/dist/_chunks/libs/is-docker.mjs +0 -1
- package/dist/_chunks/libs/is-error-instance.mjs +0 -1
- package/dist/_chunks/libs/is-inside-container.mjs +0 -1
- package/dist/_chunks/libs/is-plain-obj.mjs +0 -1
- package/dist/_chunks/libs/isexe.mjs +0 -1
- package/dist/_chunks/libs/json5.mjs +0 -14
- package/dist/_chunks/libs/khroma.mjs +0 -1
- package/dist/_chunks/libs/ky.mjs +0 -3
- package/dist/_chunks/libs/langium.mjs +0 -33
- package/dist/_chunks/libs/merge-error-cause.mjs +0 -2
- package/dist/_chunks/libs/p-limit.mjs +0 -1
- package/dist/_chunks/libs/p-queue.mjs +0 -1
- package/dist/_chunks/libs/p-timeout.mjs +0 -1
- package/dist/_chunks/libs/package-manager-detector.mjs +0 -1
- package/dist/_chunks/libs/package-up.mjs +0 -1
- package/dist/_chunks/libs/pako.mjs +0 -1
- package/dist/_chunks/libs/parse-ms.mjs +0 -1
- package/dist/_chunks/libs/pathe.mjs +0 -1
- package/dist/_chunks/libs/picomatch.mjs +0 -1
- package/dist/_chunks/libs/pretty-ms.mjs +0 -1
- package/dist/_chunks/libs/remeda.mjs +0 -2
- package/dist/_chunks/libs/safe-stringify.mjs +0 -1
- package/dist/_chunks/libs/strip-indent.mjs +0 -1
- package/dist/_chunks/libs/tinyrainbow.mjs +0 -1
- package/dist/_chunks/libs/ts-graphviz.d.mts +0 -10
- package/dist/_chunks/libs/ts-graphviz.mjs +0 -4
- package/dist/_chunks/libs/ufo.mjs +0 -1
- package/dist/_chunks/libs/unstorage.mjs +0 -1
- package/dist/_chunks/libs/vscode-languageserver.mjs +0 -1
- package/dist/_chunks/libs/which.mjs +0 -1
- package/dist/_chunks/libs/word-wrap.mjs +0 -12
- package/dist/_chunks/node.mjs +0 -76
- package/dist/_chunks/rolldown-runtime.mjs +0 -1
- package/dist/_chunks/sequence.mjs +0 -1
- package/dist/_chunks/src.mjs +0 -17
- package/dist/_chunks/src2.mjs +0 -499
- package/dist/vite-plugin/internal.d.mts +0 -44
- package/dist/vite-plugin/internal.mjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Bt as e,Ut as t,qt as n}from"./core.mjs";import{useCallback as r,useEffect as i,useEffectEvent as a,useMemo as o,useRef as s,useState as c}from"react";function l(e,t,n={leading:!1}){let[a,o]=c(e),l=s(null),u=s(!0),d=()=>window.clearTimeout(l.current);return i(()=>d,[]),[a,r(e=>{d(),u.current&&n.leading?o(e):l.current=window.setTimeout(()=>{u.current=!0,o(e)},t),u.current=!1},[n.leading,t])]}function u(e,t,n={leading:!1}){let[a,o]=c(e),l=s(!1),u=s(null),d=s(!1),f=s(e);f.current=e;let p=r(()=>{window.clearTimeout(u.current),u.current=null,d.current=!1},[]),m=r(()=>{u.current&&(p(),d.current=!1,o(f.current))},[]);return i(()=>{l.current&&(!d.current&&n.leading?(d.current=!0,o(e),u.current=window.setTimeout(()=>{d.current=!1},t)):(p(),u.current=window.setTimeout(()=>{d.current=!1,o(e)},t)))},[e,n.leading,t]),i(()=>(l.current=!0,p),[]),[a,p,{cancel:p,flush:m}]}function d(e){t(()=>{typeof e==`string`&&e.trim().length>0&&(document.title=e.trim())},[e])}function f(e,t=`use-local-storage`){try{return JSON.stringify(e)}catch{throw Error(`@mantine/hooks ${t}: Failed to serialize the value`)}}function p(e){try{return e&&JSON.parse(e)}catch{return e}}function m(e){return{getItem:t=>{try{return window[e].getItem(t)}catch{return console.warn(`use-local-storage: Failed to get value from storage, localStorage is blocked`),null}},setItem:(t,n)=>{try{window[e].setItem(t,n)}catch{console.warn(`use-local-storage: Failed to set value to storage, localStorage is blocked`)}},removeItem:t=>{try{window[e].removeItem(t)}catch{console.warn(`use-local-storage: Failed to remove value from storage, localStorage is blocked`)}}}}function h(t,n){let a=t===`localStorage`?`mantine-local-storage`:`mantine-session-storage`,{getItem:o,setItem:s,removeItem:l}=m(t);return function({key:u,defaultValue:d,getInitialValueInEffect:m=!0,sync:h=!0,deserialize:g=p,serialize:_=e=>f(e,n)}){let v=r(e=>{let n;try{n=typeof window>`u`||!(t in window)||window[t]===null||!!e}catch{n=!0}if(n)return d;let r=o(u);return r===null?d:g(r)},[u,d]),[y,b]=c(v(m)),x=r(e=>{e instanceof Function?b(t=>{let n=e(t);return s(u,_(n)),queueMicrotask(()=>{window.dispatchEvent(new CustomEvent(a,{detail:{key:u,value:n}}))}),n}):(s(u,_(e)),window.dispatchEvent(new CustomEvent(a,{detail:{key:u,value:e}})),b(e))},[u]),S=r(()=>{l(u),b(d),window.dispatchEvent(new CustomEvent(a,{detail:{key:u,value:d}}))},[u,d]);return e(`storage`,e=>{h&&e.storageArea===window[t]&&e.key===u&&b(g(e.newValue??void 0))}),e(a,e=>{h&&e.detail.key===u&&b(e.detail.value)}),i(()=>{d!==void 0&&y===void 0&&x(d)},[d,y,x]),i(()=>{let e=v();e!==void 0&&x(e)},[u]),[y===void 0?d:y,x,S]}}function g(e){let{getItem:t}=m(e);return function({key:n,defaultValue:r,deserialize:i=p}){let a;try{a=typeof window>`u`||!(e in window)||window[e]===null}catch{a=!0}if(a)return r;let o=t(n);return o===null?r:i(o)}}function _(e){return h(`localStorage`,`use-local-storage`)(e)}g(`localStorage`);function v(e){return h(`sessionStorage`,`use-session-storage`)(e)}g(`sessionStorage`);const y={passive:!0};function b(){let[t,n]=c({width:0,height:0}),a=r(()=>{n({width:window.innerWidth||0,height:window.innerHeight||0})},[]);return e(`resize`,a,y),e(`orientationchange`,a,y),i(a,[]),t}const x={" ":`space`,ArrowLeft:`arrowleft`,ArrowRight:`arrowright`,ArrowUp:`arrowup`,ArrowDown:`arrowdown`,Escape:`escape`,Esc:`escape`,esc:`escape`,Enter:`enter`,Tab:`tab`,Backspace:`backspace`,Delete:`delete`,Insert:`insert`,Home:`home`,End:`end`,PageUp:`pageup`,PageDown:`pagedown`,"+":`plus`,"-":`minus`,"*":`asterisk`,"/":`slash`};function S(e){let t=e.replace(`Key`,``).toLowerCase();return x[e]||t}function C(e){let t=e.toLowerCase().split(`+`).map(e=>e.trim()),n={alt:t.includes(`alt`),ctrl:t.includes(`ctrl`),meta:t.includes(`meta`),mod:t.includes(`mod`),shift:t.includes(`shift`)},r=[`alt`,`ctrl`,`meta`,`shift`,`mod`],i=t.find(e=>!r.includes(e));return{...n,key:i===`[plus]`?`+`:i}}function w(e,t,n){let{alt:r,ctrl:i,meta:a,mod:o,shift:s,key:c}=e,{altKey:l,ctrlKey:u,metaKey:d,shiftKey:f,key:p,code:m}=t;if(r!==l)return!1;if(o){if(!u&&!d)return!1}else if(i!==u||a!==d)return!1;return s===f?!!(c&&(n?S(m)===S(c):S(p??m)===S(c))):!1}function T(e,t){return n=>w(C(e),n,t)}function E(e){return t=>{let n=`nativeEvent`in t?t.nativeEvent:t;e.forEach(([e,r,i={preventDefault:!0,usePhysicalKeys:!1}])=>{T(e,i.usePhysicalKeys)(n)&&(i.preventDefault&&t.preventDefault(),r(n))})}}function D(e,t,n=!1){return e.target instanceof HTMLElement?(n||!e.target.isContentEditable)&&!t.includes(e.target.tagName):!0}function O(e,t=[`INPUT`,`TEXTAREA`,`SELECT`],n=!1){let r=a(r=>{e.forEach(([e,i,a={preventDefault:!0,usePhysicalKeys:!1}])=>{T(e,a.usePhysicalKeys)(r)&&D(r,t,n)&&(a.preventDefault&&r.preventDefault(),i(r))})});i(()=>(document.documentElement.addEventListener(`keydown`,r),()=>document.documentElement.removeEventListener(`keydown`,r)),[])}function k(){let[e,t]=c(!1),n=s(null),i=r(()=>{t(!0)},[]),a=r(()=>{t(!1)},[]);return{ref:r(e=>(n.current&&(n.current.removeEventListener(`mouseenter`,i),n.current.removeEventListener(`mouseleave`,a)),e&&(e.addEventListener(`mouseenter`,i),e.addEventListener(`mouseleave`,a)),n.current=e,()=>{n.current=null,t(!1)}),[i,a]),hovered:e}}function A(e){return e.currentTarget instanceof HTMLElement&&e.relatedTarget instanceof HTMLElement?e.currentTarget.contains(e.relatedTarget):!1}function j({onBlur:e,onFocus:t}={}){let[a,o]=c(!1),l=s(!1),u=s(null),d=n(t),f=n(e),p=r(e=>{o(e),l.current=e},[]),m=r(e=>{l.current||(p(!0),d(e))},[]),h=r(e=>{l.current&&!A(e)&&(p(!1),f(e))},[]),g=r(e=>{e&&(u.current&&(u.current.removeEventListener(`focusin`,m),u.current.removeEventListener(`focusout`,h)),e.addEventListener(`focusin`,m),e.addEventListener(`focusout`,h),u.current=e)},[m,h]);return i(()=>()=>{u.current&&(u.current.removeEventListener(`focusin`,m),u.current.removeEventListener(`focusout`,h))},[]),{ref:g,focused:a}}function M(){let e=s(null),[t,n]=c(!1);return{ref:r(t=>{typeof IntersectionObserver<`u`&&(e.current?.disconnect(),t?(e.current=new IntersectionObserver(e=>{let t=e[e.length-1];n(t.isIntersecting)}),e.current.observe(t)):(e.current=null,n(!1)))},[]),inViewport:t}}function N(e){let[t,n]=c({history:[e],current:0}),i=r(e=>n(t=>{let n=[...t.history.slice(0,t.current+1),e];return{history:n,current:n.length-1}}),[]),a=r((e=1)=>n(t=>({history:t.history,current:Math.max(0,t.current-e)})),[]),s=r((e=1)=>n(t=>({history:t.history,current:Math.min(t.history.length-1,t.current+e)})),[]),l=r(()=>{n({history:[e],current:0})},[e]),u=o(()=>({back:a,forward:s,reset:l,set:i}),[a,s,l,i]);return[t.history[t.current],u,t]}function P(e,t){let a=n(e),o=s(null),c=s(null),l=s(!0),u=s(t),d=s(-1),f=()=>window.clearTimeout(d.current),p=r((...e)=>{a(...e),o.current=e,c.current=e,l.current=!1},[a]),m=r(()=>{o.current&&o.current!==c.current?(p(...o.current),d.current=window.setTimeout(m,u.current)):l.current=!0},[p]),h=r((...e)=>{l.current?(p(...e),d.current=window.setTimeout(m,u.current)):o.current=e},[p,m]);return i(()=>{u.current=t},[t]),[h,f]}function F(e,t){let[n,r]=P(e,t);return i(()=>r,[]),n}export{k as a,b as c,d,u as f,j as i,v as l,N as n,O as o,l as p,M as r,E as s,F as t,_ as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useCallback as e,useRef as t,useSyncExternalStore as n}from"react";function r(e,t,n){let r=new Set(t).add(void 0);return e.listen((e,t,i)=>{r.has(i)&&n(e,t,i)})}let i=(e,t)=>n=>{e.current!==n&&(e.current=n,t())};function a(a,{keys:o,deps:s=[a,o],ssr:c}={}){let l=t();l.current=a.get();let u=e(e=>(i(l,e)(a.value),o?.length>0?r(a,o,i(l,e)):a.listen(i(l,e))),s),d=()=>l.current,f=d;return c&&`init`in a&&(f=c===`initial`?()=>a.init:c),n(u,d,f)}export{a as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useCallback as e,useEffect as t,useLayoutEffect as n,useMemo as r,useRef as i,useState as a}from"react";function o(e){let t=i(e);return t.current=e,r(()=>Object.freeze({get current(){return t.current}}),[])}function s(e){let n=o(e);t(()=>()=>{n.current()},[])}function c(e,n,a,o=0){let c=i(void 0),l=i(void 0),u=i(e),d=i(void 0),f=()=>{c.current&&=(clearTimeout(c.current),void 0),l.current&&=(clearTimeout(l.current),void 0)};return s(f),t(()=>{u.current=e},n),r(()=>{let t=()=>{if(f(),!d.current)return;let e=d.current;d.current=void 0,u.current.apply(e.this,e.args)},n=function(...e){c.current&&clearTimeout(c.current),d.current={args:e,this:this},c.current=setTimeout(t,a),o>0&&!l.current&&(l.current=setTimeout(t,o))};return Object.defineProperties(n,{length:{value:e.length},name:{value:`${e.name||`anonymous`}__debounced__${a}`}}),n},[a,o,...n])}const l=()=>{},u=typeof globalThis<`u`&&typeof navigator<`u`&&typeof document<`u`;function d(t){let n=o(t),a=i(0),c=e(()=>{u&&(a.current&&=(cancelAnimationFrame(a.current),0))},[]);return s(c),[r(()=>{let e=(...e)=>{u&&(c(),a.current=requestAnimationFrame(()=>{n.current(...e),a.current=0}))};return Object.defineProperties(e,{length:{value:t.length},name:{value:`${t.name||`anonymous`}__raf`}}),e},[]),c]}const f=(e,t)=>{if(e===t)return!0;if(e.length!==t.length)return!1;for(let[n,r]of e.entries())if(r!==t[n])return!1;return!0};function p(e,n,r=f,a=t,...o){let s=i(void 0);(s.current===void 0||u&&!r(s.current,n))&&(s.current=n),a(e,s.current,...o)}function m(){let e=i(!0);return t(()=>{e.current=!1},[]),e.current}function h(n=!1){let r=i(n),a=e(()=>r.current,[]);return t(()=>(r.current=!0,()=>{r.current=!1}),[]),a}const g=u?n:t;function _(e){t(()=>{e()},[])}function v(e,n){let[r,i]=d(e);t(()=>(r(),i),n)}const y=e=>(e+1)%(2**53-1);function b(){let[,t]=a(0);return e(()=>{t(y)},[])}function x(e,n){t(m()?l:e,n)}const S=e=>{e&&clearTimeout(e)};function C(n,r){let a=o(n),s=o(r),c=i(null),l=e(()=>{S(c.current)},[]),u=e(()=>{s.current!==void 0&&(l(),c.current=setTimeout(()=>{a.current()},s.current))},[]);return t(()=>(u(),l),[r]),[l,u]}const w=(e,t,n)=>{let a=i(void 0);return(a.current===void 0||!n(a.current,t))&&(a.current=t),r(e,a.current)};function T(e,t){let[n,s]=a({status:`not-executed`,error:void 0,result:t}),c=i(void 0),l=i(void 0),u=o({async execute(...t){l.current=t;let n=e(...t);return c.current=n,s(e=>({...e,status:`loading`})),n.then(e=>{n===c.current&&s(t=>({...t,status:`success`,error:void 0,result:e}))},e=>{n===c.current&&s(t=>({...t,status:`error`,error:e}))}),n},reset(){s({status:`not-executed`,error:void 0,result:t}),c.current=void 0,l.current=void 0}});return[n,r(()=>({reset(){u.current.reset()},execute:async(...e)=>u.current.execute(...e)}),[]),{promise:c.current,lastArgs:l.current}]}export{b as a,g as c,p as d,c as f,x as i,h as l,w as n,v as o,o as p,C as r,_ as s,T as t,m as u};
|
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
import{createElement as e,forwardRef as t}from"react";
|
|
2
|
+
/**
|
|
3
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license.
|
|
6
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
var n={outline:{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},filled:{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`currentColor`,stroke:`none`}};
|
|
9
|
+
/**
|
|
10
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
11
|
+
*
|
|
12
|
+
* This source code is licensed under the MIT license.
|
|
13
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
14
|
+
*/
|
|
15
|
+
const r=(r,i,a,o)=>{let s=t(({color:t=`currentColor`,size:a=24,stroke:s=2,title:c,className:l,children:u,...d},f)=>e(`svg`,{ref:f,...n[r],width:a,height:a,className:[`tabler-icon`,`tabler-icon-${i}`,l].join(` `),...r===`filled`?{fill:t}:{strokeWidth:s,stroke:t},...d},[c&&e(`title`,{key:`svg-title`},c),...o.map(([t,n])=>e(t,n)),...Array.isArray(u)?u:[u]]));return s.displayName=`${a}`,s},i=r(`outline`,`alert-triangle`,`AlertTriangle`,[[`path`,{d:`M12 9v4`,key:`svg-0`}],[`path`,{d:`M10.363 3.591l-8.106 13.534a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636 -2.87l-8.106 -13.536a1.914 1.914 0 0 0 -3.274 0`,key:`svg-1`}],[`path`,{d:`M12 16h.01`,key:`svg-2`}]]),a=r(`outline`,`arrow-down-right`,`ArrowDownRight`,[[`path`,{d:`M7 7l10 10`,key:`svg-0`}],[`path`,{d:`M17 8l0 9l-9 0`,key:`svg-1`}]]),o=r(`outline`,`arrow-left`,`ArrowLeft`,[[`path`,{d:`M5 12l14 0`,key:`svg-0`}],[`path`,{d:`M5 12l6 6`,key:`svg-1`}],[`path`,{d:`M5 12l6 -6`,key:`svg-2`}]]),s=r(`outline`,`arrow-right`,`ArrowRight`,[[`path`,{d:`M5 12l14 0`,key:`svg-0`}],[`path`,{d:`M13 18l6 -6`,key:`svg-1`}],[`path`,{d:`M13 6l6 6`,key:`svg-2`}]]),c=r(`outline`,`bolt`,`Bolt`,[[`path`,{d:`M13 3l0 7l6 0l-8 11l0 -7l-6 0l8 -11`,key:`svg-0`}]]),l=r(`outline`,`browser`,`Browser`,[[`path`,{d:`M4 8h16`,key:`svg-0`}],[`path`,{d:`M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12`,key:`svg-1`}],[`path`,{d:`M8 4v4`,key:`svg-2`}]]),u=r(`outline`,`check`,`Check`,[[`path`,{d:`M5 12l5 5l10 -10`,key:`svg-0`}]]),d=r(`outline`,`chevron-down`,`ChevronDown`,[[`path`,{d:`M6 9l6 6l6 -6`,key:`svg-0`}]]),f=r(`outline`,`chevron-left`,`ChevronLeft`,[[`path`,{d:`M15 6l-6 6l6 6`,key:`svg-0`}]]),p=r(`outline`,`chevron-right`,`ChevronRight`,[[`path`,{d:`M9 6l6 6l-6 6`,key:`svg-0`}]]),m=r(`outline`,`copy`,`Copy`,[[`path`,{d:`M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666`,key:`svg-0`}],[`path`,{d:`M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1`,key:`svg-1`}]]),h=r(`outline`,`cylinder`,`Cylinder`,[[`path`,{d:`M5 6a7 3 0 1 0 14 0a7 3 0 1 0 -14 0`,key:`svg-0`}],[`path`,{d:`M5 6v12c0 1.657 3.134 3 7 3s7 -1.343 7 -3v-12`,key:`svg-1`}]]),g=r(`outline`,`device-mobile`,`DeviceMobile`,[[`path`,{d:`M6 5a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2v-14`,key:`svg-0`}],[`path`,{d:`M11 4h2`,key:`svg-1`}],[`path`,{d:`M12 17v.01`,key:`svg-2`}]]),_=r(`outline`,`external-link`,`ExternalLink`,[[`path`,{d:`M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6`,key:`svg-0`}],[`path`,{d:`M11 13l9 -9`,key:`svg-1`}],[`path`,{d:`M15 4h5v5`,key:`svg-2`}]]),v=r(`outline`,`file-code`,`FileCode`,[[`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`,key:`svg-0`}],[`path`,{d:`M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2`,key:`svg-1`}],[`path`,{d:`M10 13l-1 2l1 2`,key:`svg-2`}],[`path`,{d:`M14 13l1 2l-1 2`,key:`svg-3`}]]),y=r(`outline`,`file-symlink`,`FileSymlink`,[[`path`,{d:`M4 21v-4a3 3 0 0 1 3 -3h5`,key:`svg-0`}],[`path`,{d:`M9 17l3 -3l-3 -3`,key:`svg-1`}],[`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`,key:`svg-2`}],[`path`,{d:`M5 11v-6a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-9.5`,key:`svg-3`}]]),b=r(`outline`,`file-text`,`FileText`,[[`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`,key:`svg-0`}],[`path`,{d:`M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2`,key:`svg-1`}],[`path`,{d:`M9 9l1 0`,key:`svg-2`}],[`path`,{d:`M9 13l6 0`,key:`svg-3`}],[`path`,{d:`M9 17l6 0`,key:`svg-4`}]]),x=r(`outline`,`focus-centered`,`FocusCentered`,[[`path`,{d:`M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-0`}],[`path`,{d:`M4 8v-2a2 2 0 0 1 2 -2h2`,key:`svg-1`}],[`path`,{d:`M4 16v2a2 2 0 0 0 2 2h2`,key:`svg-2`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v2`,key:`svg-3`}],[`path`,{d:`M16 20h2a2 2 0 0 0 2 -2v-2`,key:`svg-4`}]]),S=r(`outline`,`folder-open`,`FolderOpen`,[[`path`,{d:`M5 19l2.757 -7.351a1 1 0 0 1 .936 -.649h12.307a1 1 0 0 1 .986 1.164l-.996 5.211a2 2 0 0 1 -1.964 1.625h-14.026a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2h4l3 3h7a2 2 0 0 1 2 2v2`,key:`svg-0`}]]),C=r(`outline`,`help-circle`,`HelpCircle`,[[`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0`,key:`svg-0`}],[`path`,{d:`M12 16v.01`,key:`svg-1`}],[`path`,{d:`M12 13a2 2 0 0 0 .914 -3.782a1.98 1.98 0 0 0 -2.414 .483`,key:`svg-2`}]]),w=r(`outline`,`id`,`Id`,[[`path`,{d:`M3 7a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v10a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3l0 -10`,key:`svg-0`}],[`path`,{d:`M7 10a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-1`}],[`path`,{d:`M15 8l2 0`,key:`svg-2`}],[`path`,{d:`M15 12l2 0`,key:`svg-3`}],[`path`,{d:`M7 16l10 0`,key:`svg-4`}]]),T=r(`outline`,`info-circle`,`InfoCircle`,[[`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0`,key:`svg-0`}],[`path`,{d:`M12 9h.01`,key:`svg-1`}],[`path`,{d:`M11 12h1v4h1`,key:`svg-2`}]]),E=r(`outline`,`layout-align-bottom`,`LayoutAlignBottom`,[[`path`,{d:`M4 20l16 0`,key:`svg-0`}],[`path`,{d:`M9 6a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2l0 -8`,key:`svg-1`}]]),D=r(`outline`,`layout-align-center`,`LayoutAlignCenter`,[[`path`,{d:`M12 4l0 5`,key:`svg-0`}],[`path`,{d:`M12 15l0 5`,key:`svg-1`}],[`path`,{d:`M6 11a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2l0 -2`,key:`svg-2`}]]),O=r(`outline`,`layout-align-left`,`LayoutAlignLeft`,[[`path`,{d:`M4 4l0 16`,key:`svg-0`}],[`path`,{d:`M8 11a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2l0 -2`,key:`svg-1`}]]),k=r(`outline`,`layout-align-middle`,`LayoutAlignMiddle`,[[`path`,{d:`M4 12l5 0`,key:`svg-0`}],[`path`,{d:`M15 12l5 0`,key:`svg-1`}],[`path`,{d:`M9 8a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2l0 -8`,key:`svg-2`}]]),A=r(`outline`,`layout-align-right`,`LayoutAlignRight`,[[`path`,{d:`M20 4l0 16`,key:`svg-0`}],[`path`,{d:`M4 11a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2l0 -2`,key:`svg-1`}]]),j=r(`outline`,`layout-align-top`,`LayoutAlignTop`,[[`path`,{d:`M4 4l16 0`,key:`svg-0`}],[`path`,{d:`M9 10a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2l0 -8`,key:`svg-1`}]]),M=r(`outline`,`layout-board-split`,`LayoutBoardSplit`,[[`path`,{d:`M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12`,key:`svg-0`}],[`path`,{d:`M4 12h8`,key:`svg-1`}],[`path`,{d:`M12 15h8`,key:`svg-2`}],[`path`,{d:`M12 9h8`,key:`svg-3`}],[`path`,{d:`M12 4v16`,key:`svg-4`}]]),N=r(`outline`,`layout-collage`,`LayoutCollage`,[[`path`,{d:`M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12`,key:`svg-0`}],[`path`,{d:`M10 4l4 16`,key:`svg-1`}],[`path`,{d:`M12 12l-8 2`,key:`svg-2`}]]),ee=r(`outline`,`layout-dashboard`,`LayoutDashboard`,[[`path`,{d:`M5 4h4a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-6a1 1 0 0 1 1 -1`,key:`svg-0`}],[`path`,{d:`M5 16h4a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1`,key:`svg-1`}],[`path`,{d:`M15 12h4a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-6a1 1 0 0 1 1 -1`,key:`svg-2`}],[`path`,{d:`M15 4h4a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1`,key:`svg-3`}]]),P=r(`outline`,`link`,`Link`,[[`path`,{d:`M9 15l6 -6`,key:`svg-0`}],[`path`,{d:`M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464`,key:`svg-1`}],[`path`,{d:`M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463`,key:`svg-2`}]]),F=r(`outline`,`lock-open-2`,`LockOpen2`,[[`path`,{d:`M3 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2l0 -6`,key:`svg-0`}],[`path`,{d:`M9 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0`,key:`svg-1`}],[`path`,{d:`M13 11v-4a4 4 0 1 1 8 0v4`,key:`svg-2`}]]),I=r(`outline`,`lock`,`Lock`,[[`path`,{d:`M5 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-6`,key:`svg-0`}],[`path`,{d:`M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0`,key:`svg-1`}],[`path`,{d:`M8 11v-4a4 4 0 1 1 8 0v4`,key:`svg-2`}]]),L=r(`outline`,`moon-stars`,`MoonStars`,[[`path`,{d:`M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454l0 .008`,key:`svg-0`}],[`path`,{d:`M17 4a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2`,key:`svg-1`}],[`path`,{d:`M19 11h2m-1 -1v2`,key:`svg-2`}]]),R=r(`outline`,`rectangular-prism`,`RectangularPrism`,[[`path`,{d:`M21 14.008v-5.018a1.98 1.98 0 0 0 -1 -1.717l-4 -2.008a2.016 2.016 0 0 0 -2 0l-10 5.008c-.619 .355 -1 1.01 -1 1.718v5.018c0 .709 .381 1.363 1 1.717l4 2.008a2.016 2.016 0 0 0 2 0l10 -5.008c.619 -.355 1 -1.01 1 -1.718`,key:`svg-0`}],[`path`,{d:`M9 21v-7.5`,key:`svg-1`}],[`path`,{d:`M9 13.5l11.5 -5.5`,key:`svg-2`}],[`path`,{d:`M3.5 11l5.5 2.5`,key:`svg-3`}]]),z=r(`outline`,`reorder`,`Reorder`,[[`path`,{d:`M3 16a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1l0 -2`,key:`svg-0`}],[`path`,{d:`M10 16a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1l0 -2`,key:`svg-1`}],[`path`,{d:`M17 16a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1l0 -2`,key:`svg-2`}],[`path`,{d:`M5 11v-3a3 3 0 0 1 3 -3h8a3 3 0 0 1 3 3v3`,key:`svg-3`}],[`path`,{d:`M16.5 8.5l2.5 2.5l2.5 -2.5`,key:`svg-4`}]]),B=r(`outline`,`route-off`,`RouteOff`,[[`path`,{d:`M4 19a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-0`}],[`path`,{d:`M16 5a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-1`}],[`path`,{d:`M12 19h4.5c.71 0 1.372 -.212 1.924 -.576m1.545 -2.459a3.5 3.5 0 0 0 -3.469 -3.965h-.499m-4 0h-3.501a3.5 3.5 0 0 1 -2.477 -5.972m2.477 -1.028h3.5`,key:`svg-2`}],[`path`,{d:`M3 3l18 18`,key:`svg-3`}]]),V=r(`outline`,`search`,`Search`,[[`path`,{d:`M3 10a7 7 0 1 0 14 0a7 7 0 1 0 -14 0`,key:`svg-0`}],[`path`,{d:`M21 21l-6 -6`,key:`svg-1`}]]),H=r(`outline`,`selector`,`Selector`,[[`path`,{d:`M8 9l4 -4l4 4`,key:`svg-0`}],[`path`,{d:`M16 15l-4 4l-4 -4`,key:`svg-1`}]]),U=r(`outline`,`share`,`Share`,[[`path`,{d:`M3 12a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`,key:`svg-0`}],[`path`,{d:`M15 6a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`,key:`svg-1`}],[`path`,{d:`M15 18a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`,key:`svg-2`}],[`path`,{d:`M8.7 10.7l6.6 -3.4`,key:`svg-3`}],[`path`,{d:`M8.7 13.3l6.6 3.4`,key:`svg-4`}]]),W=r(`outline`,`sparkles`,`Sparkles`,[[`path`,{d:`M16 18a2 2 0 0 1 2 2a2 2 0 0 1 2 -2a2 2 0 0 1 -2 -2a2 2 0 0 1 -2 2m0 -12a2 2 0 0 1 2 2a2 2 0 0 1 2 -2a2 2 0 0 1 -2 -2a2 2 0 0 1 -2 2m-7 12a6 6 0 0 1 6 -6a6 6 0 0 1 -6 -6a6 6 0 0 1 -6 6a6 6 0 0 1 6 6`,key:`svg-0`}]]),G=r(`outline`,`stack-2`,`Stack2`,[[`path`,{d:`M12 4l-8 4l8 4l8 -4l-8 -4`,key:`svg-0`}],[`path`,{d:`M4 12l8 4l8 -4`,key:`svg-1`}],[`path`,{d:`M4 16l8 4l8 -4`,key:`svg-2`}]]),K=r(`outline`,`sun`,`Sun`,[[`path`,{d:`M8 12a4 4 0 1 0 8 0a4 4 0 1 0 -8 0`,key:`svg-0`}],[`path`,{d:`M3 12h1m8 -9v1m8 8h1m-9 8v1m-6.4 -15.4l.7 .7m12.1 -.7l-.7 .7m0 11.4l.7 .7m-12.1 -.7l-.7 .7`,key:`svg-1`}]]),q=r(`outline`,`target`,`Target`,[[`path`,{d:`M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-0`}],[`path`,{d:`M7 12a5 5 0 1 0 10 0a5 5 0 1 0 -10 0`,key:`svg-1`}],[`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0`,key:`svg-2`}]]),J=r(`outline`,`transform`,`Transform`,[[`path`,{d:`M3 6a3 3 0 1 0 6 0a3 3 0 0 0 -6 0`,key:`svg-0`}],[`path`,{d:`M21 11v-3a2 2 0 0 0 -2 -2h-6l3 3m0 -6l-3 3`,key:`svg-1`}],[`path`,{d:`M3 13v3a2 2 0 0 0 2 2h6l-3 -3m0 6l3 -3`,key:`svg-2`}],[`path`,{d:`M15 18a3 3 0 1 0 6 0a3 3 0 0 0 -6 0`,key:`svg-3`}]]),Y=r(`outline`,`trash`,`Trash`,[[`path`,{d:`M4 7l16 0`,key:`svg-0`}],[`path`,{d:`M10 11l0 6`,key:`svg-1`}],[`path`,{d:`M14 11l0 6`,key:`svg-2`}],[`path`,{d:`M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12`,key:`svg-3`}],[`path`,{d:`M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3`,key:`svg-4`}]]),X=r(`outline`,`user`,`User`,[[`path`,{d:`M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0`,key:`svg-0`}],[`path`,{d:`M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2`,key:`svg-1`}]]),Z=r(`outline`,`x`,`X`,[[`path`,{d:`M18 6l-12 12`,key:`svg-0`}],[`path`,{d:`M6 6l12 12`,key:`svg-1`}]]),Q=r(`outline`,`zoom-scan`,`ZoomScan`,[[`path`,{d:`M8 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0`,key:`svg-0`}],[`path`,{d:`M16 16l-2.5 -2.5`,key:`svg-1`}],[`path`,{d:`M3 7v-2a2 2 0 0 1 2 -2h2`,key:`svg-2`}],[`path`,{d:`M3 17v2a2 2 0 0 0 2 2h2`,key:`svg-3`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`svg-4`}],[`path`,{d:`M17 21h2a2 2 0 0 0 2 -2v-2`,key:`svg-5`}]]),$=r(`filled`,`direction-sign-filled`,`DirectionSignFilled`,[[`path`,{d:`M10.52 2.614a2.095 2.095 0 0 1 2.835 -.117l.126 .117l7.905 7.905c.777 .777 .816 2.013 .117 2.836l-.117 .126l-7.905 7.905a2.094 2.094 0 0 1 -2.836 .117l-.126 -.117l-7.907 -7.906a2.096 2.096 0 0 1 -.115 -2.835l.117 -.126l7.905 -7.905zm5.969 9.535l.01 -.116l-.003 -.12l-.016 -.114l-.03 -.11l-.044 -.112l-.052 -.098l-.076 -.105l-.07 -.081l-3.5 -3.5l-.095 -.083a1 1 0 0 0 -1.226 0l-.094 .083l-.083 .094a1 1 0 0 0 0 1.226l.083 .094l1.792 1.793h-5.085l-.117 .007a1 1 0 0 0 0 1.986l.117 .007h5.085l-1.792 1.793l-.083 .094a1 1 0 0 0 1.403 1.403l.094 -.083l3.5 -3.5l.097 -.112l.05 -.074l.037 -.067l.05 -.112l.023 -.076l.025 -.117z`,key:`svg-0`}]]),te=r(`filled`,`folder-filled`,`FolderFilled`,[[`path`,{d:`M9 3a1 1 0 0 1 .608 .206l.1 .087l2.706 2.707h6.586a3 3 0 0 1 2.995 2.824l.005 .176v8a3 3 0 0 1 -2.824 2.995l-.176 .005h-14a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-11a3 3 0 0 1 2.824 -2.995l.176 -.005h4z`,key:`svg-0`}]]),ne=r(`filled`,`player-play-filled`,`PlayerPlayFilled`,[[`path`,{d:`M6 4v16a1 1 0 0 0 1.524 .852l13 -8a1 1 0 0 0 0 -1.704l-13 -8a1 1 0 0 0 -1.524 .852z`,key:`svg-0`}]]),re=r(`filled`,`player-skip-back-filled`,`PlayerSkipBackFilled`,[[`path`,{d:`M19.496 4.136l-12 7a1 1 0 0 0 0 1.728l12 7a1 1 0 0 0 1.504 -.864v-14a1 1 0 0 0 -1.504 -.864z`,key:`svg-0`}],[`path`,{d:`M4 4a1 1 0 0 1 .993 .883l.007 .117v14a1 1 0 0 1 -1.993 .117l-.007 -.117v-14a1 1 0 0 1 1 -1z`,key:`svg-1`}]]),ie=r(`filled`,`player-skip-forward-filled`,`PlayerSkipForwardFilled`,[[`path`,{d:`M3 5v14a1 1 0 0 0 1.504 .864l12 -7a1 1 0 0 0 0 -1.728l-12 -7a1 1 0 0 0 -1.504 .864z`,key:`svg-0`}],[`path`,{d:`M20 4a1 1 0 0 1 .993 .883l.007 .117v14a1 1 0 0 1 -1.993 .117l-.007 -.117v-14a1 1 0 0 1 1 -1z`,key:`svg-1`}]]),ae=r(`filled`,`player-stop-filled`,`PlayerStopFilled`,[[`path`,{d:`M17 4h-10a3 3 0 0 0 -3 3v10a3 3 0 0 0 3 3h10a3 3 0 0 0 3 -3v-10a3 3 0 0 0 -3 -3z`,key:`svg-0`}]]),oe=r(`filled`,`star-filled`,`StarFilled`,[[`path`,{d:`M8.243 7.34l-6.38 .925l-.113 .023a1 1 0 0 0 -.44 1.684l4.622 4.499l-1.09 6.355l-.013 .11a1 1 0 0 0 1.464 .944l5.706 -3l5.693 3l.1 .046a1 1 0 0 0 1.352 -1.1l-1.091 -6.355l4.624 -4.5l.078 -.085a1 1 0 0 0 -.633 -1.62l-6.38 -.926l-2.852 -5.78a1 1 0 0 0 -1.794 0l-2.853 5.78z`,key:`svg-0`}]])
|
|
16
|
+
/**
|
|
17
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the MIT license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
24
|
+
*
|
|
25
|
+
* This source code is licensed under the MIT license.
|
|
26
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license.
|
|
32
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/
|
|
34
|
+
/**
|
|
35
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
36
|
+
*
|
|
37
|
+
* This source code is licensed under the MIT license.
|
|
38
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
39
|
+
*/
|
|
40
|
+
/**
|
|
41
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
42
|
+
*
|
|
43
|
+
* This source code is licensed under the MIT license.
|
|
44
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
45
|
+
*/
|
|
46
|
+
/**
|
|
47
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
48
|
+
*
|
|
49
|
+
* This source code is licensed under the MIT license.
|
|
50
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
+
*/
|
|
52
|
+
/**
|
|
53
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
54
|
+
*
|
|
55
|
+
* This source code is licensed under the MIT license.
|
|
56
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
57
|
+
*/
|
|
58
|
+
/**
|
|
59
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
60
|
+
*
|
|
61
|
+
* This source code is licensed under the MIT license.
|
|
62
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
63
|
+
*/
|
|
64
|
+
/**
|
|
65
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
66
|
+
*
|
|
67
|
+
* This source code is licensed under the MIT license.
|
|
68
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
69
|
+
*/
|
|
70
|
+
/**
|
|
71
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
72
|
+
*
|
|
73
|
+
* This source code is licensed under the MIT license.
|
|
74
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
75
|
+
*/
|
|
76
|
+
/**
|
|
77
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
78
|
+
*
|
|
79
|
+
* This source code is licensed under the MIT license.
|
|
80
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
81
|
+
*/
|
|
82
|
+
/**
|
|
83
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
84
|
+
*
|
|
85
|
+
* This source code is licensed under the MIT license.
|
|
86
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
87
|
+
*/
|
|
88
|
+
/**
|
|
89
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
90
|
+
*
|
|
91
|
+
* This source code is licensed under the MIT license.
|
|
92
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
93
|
+
*/
|
|
94
|
+
/**
|
|
95
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
96
|
+
*
|
|
97
|
+
* This source code is licensed under the MIT license.
|
|
98
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
99
|
+
*/
|
|
100
|
+
/**
|
|
101
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
102
|
+
*
|
|
103
|
+
* This source code is licensed under the MIT license.
|
|
104
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
105
|
+
*/
|
|
106
|
+
/**
|
|
107
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
108
|
+
*
|
|
109
|
+
* This source code is licensed under the MIT license.
|
|
110
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
111
|
+
*/
|
|
112
|
+
/**
|
|
113
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
114
|
+
*
|
|
115
|
+
* This source code is licensed under the MIT license.
|
|
116
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
117
|
+
*/
|
|
118
|
+
/**
|
|
119
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
120
|
+
*
|
|
121
|
+
* This source code is licensed under the MIT license.
|
|
122
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
123
|
+
*/
|
|
124
|
+
/**
|
|
125
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
126
|
+
*
|
|
127
|
+
* This source code is licensed under the MIT license.
|
|
128
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
129
|
+
*/
|
|
130
|
+
/**
|
|
131
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
132
|
+
*
|
|
133
|
+
* This source code is licensed under the MIT license.
|
|
134
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
135
|
+
*/
|
|
136
|
+
/**
|
|
137
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
138
|
+
*
|
|
139
|
+
* This source code is licensed under the MIT license.
|
|
140
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
141
|
+
*/
|
|
142
|
+
/**
|
|
143
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
144
|
+
*
|
|
145
|
+
* This source code is licensed under the MIT license.
|
|
146
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
147
|
+
*/
|
|
148
|
+
/**
|
|
149
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
150
|
+
*
|
|
151
|
+
* This source code is licensed under the MIT license.
|
|
152
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
153
|
+
*/
|
|
154
|
+
/**
|
|
155
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
156
|
+
*
|
|
157
|
+
* This source code is licensed under the MIT license.
|
|
158
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
159
|
+
*/
|
|
160
|
+
/**
|
|
161
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
162
|
+
*
|
|
163
|
+
* This source code is licensed under the MIT license.
|
|
164
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
165
|
+
*/
|
|
166
|
+
/**
|
|
167
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
168
|
+
*
|
|
169
|
+
* This source code is licensed under the MIT license.
|
|
170
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
171
|
+
*/
|
|
172
|
+
/**
|
|
173
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
174
|
+
*
|
|
175
|
+
* This source code is licensed under the MIT license.
|
|
176
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
177
|
+
*/
|
|
178
|
+
/**
|
|
179
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
180
|
+
*
|
|
181
|
+
* This source code is licensed under the MIT license.
|
|
182
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
183
|
+
*/
|
|
184
|
+
/**
|
|
185
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
186
|
+
*
|
|
187
|
+
* This source code is licensed under the MIT license.
|
|
188
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
189
|
+
*/
|
|
190
|
+
/**
|
|
191
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
192
|
+
*
|
|
193
|
+
* This source code is licensed under the MIT license.
|
|
194
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
195
|
+
*/
|
|
196
|
+
/**
|
|
197
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
198
|
+
*
|
|
199
|
+
* This source code is licensed under the MIT license.
|
|
200
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
201
|
+
*/
|
|
202
|
+
/**
|
|
203
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
204
|
+
*
|
|
205
|
+
* This source code is licensed under the MIT license.
|
|
206
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
207
|
+
*/
|
|
208
|
+
/**
|
|
209
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
210
|
+
*
|
|
211
|
+
* This source code is licensed under the MIT license.
|
|
212
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
213
|
+
*/
|
|
214
|
+
/**
|
|
215
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
216
|
+
*
|
|
217
|
+
* This source code is licensed under the MIT license.
|
|
218
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
219
|
+
*/
|
|
220
|
+
/**
|
|
221
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
222
|
+
*
|
|
223
|
+
* This source code is licensed under the MIT license.
|
|
224
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
225
|
+
*/
|
|
226
|
+
/**
|
|
227
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
228
|
+
*
|
|
229
|
+
* This source code is licensed under the MIT license.
|
|
230
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
231
|
+
*/
|
|
232
|
+
/**
|
|
233
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
234
|
+
*
|
|
235
|
+
* This source code is licensed under the MIT license.
|
|
236
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
237
|
+
*/
|
|
238
|
+
/**
|
|
239
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
240
|
+
*
|
|
241
|
+
* This source code is licensed under the MIT license.
|
|
242
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
243
|
+
*/
|
|
244
|
+
/**
|
|
245
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
246
|
+
*
|
|
247
|
+
* This source code is licensed under the MIT license.
|
|
248
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
249
|
+
*/
|
|
250
|
+
/**
|
|
251
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
252
|
+
*
|
|
253
|
+
* This source code is licensed under the MIT license.
|
|
254
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
255
|
+
*/
|
|
256
|
+
/**
|
|
257
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
258
|
+
*
|
|
259
|
+
* This source code is licensed under the MIT license.
|
|
260
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
261
|
+
*/
|
|
262
|
+
/**
|
|
263
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
264
|
+
*
|
|
265
|
+
* This source code is licensed under the MIT license.
|
|
266
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
267
|
+
*/
|
|
268
|
+
/**
|
|
269
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
270
|
+
*
|
|
271
|
+
* This source code is licensed under the MIT license.
|
|
272
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
273
|
+
*/
|
|
274
|
+
/**
|
|
275
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
276
|
+
*
|
|
277
|
+
* This source code is licensed under the MIT license.
|
|
278
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
279
|
+
*/
|
|
280
|
+
/**
|
|
281
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
282
|
+
*
|
|
283
|
+
* This source code is licensed under the MIT license.
|
|
284
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
285
|
+
*/
|
|
286
|
+
/**
|
|
287
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
288
|
+
*
|
|
289
|
+
* This source code is licensed under the MIT license.
|
|
290
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
291
|
+
*/
|
|
292
|
+
/**
|
|
293
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
294
|
+
*
|
|
295
|
+
* This source code is licensed under the MIT license.
|
|
296
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
297
|
+
*/
|
|
298
|
+
/**
|
|
299
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
300
|
+
*
|
|
301
|
+
* This source code is licensed under the MIT license.
|
|
302
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
303
|
+
*/
|
|
304
|
+
/**
|
|
305
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
306
|
+
*
|
|
307
|
+
* This source code is licensed under the MIT license.
|
|
308
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
309
|
+
*/
|
|
310
|
+
/**
|
|
311
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
312
|
+
*
|
|
313
|
+
* This source code is licensed under the MIT license.
|
|
314
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
315
|
+
*/
|
|
316
|
+
/**
|
|
317
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
318
|
+
*
|
|
319
|
+
* This source code is licensed under the MIT license.
|
|
320
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
321
|
+
*/
|
|
322
|
+
/**
|
|
323
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
324
|
+
*
|
|
325
|
+
* This source code is licensed under the MIT license.
|
|
326
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
327
|
+
*/
|
|
328
|
+
/**
|
|
329
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
330
|
+
*
|
|
331
|
+
* This source code is licensed under the MIT license.
|
|
332
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
333
|
+
*/
|
|
334
|
+
/**
|
|
335
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
336
|
+
*
|
|
337
|
+
* This source code is licensed under the MIT license.
|
|
338
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
339
|
+
*/
|
|
340
|
+
/**
|
|
341
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
342
|
+
*
|
|
343
|
+
* This source code is licensed under the MIT license.
|
|
344
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
345
|
+
*/
|
|
346
|
+
/**
|
|
347
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
348
|
+
*
|
|
349
|
+
* This source code is licensed under the MIT license.
|
|
350
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
351
|
+
*/
|
|
352
|
+
/**
|
|
353
|
+
* @license @tabler/icons-react v3.44.0 - MIT
|
|
354
|
+
*
|
|
355
|
+
* This source code is licensed under the MIT license.
|
|
356
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
357
|
+
*/
|
|
358
|
+
;export{c as $,j as A,x as B,L as C,ee as D,P as E,E as F,g as G,y as H,T as I,p as J,h as K,w as L,k as M,O as N,N as O,D as P,l as Q,C as R,R as S,F as T,v as U,b as V,_ as W,d as X,f as Y,u as Z,U as _,ne as a,B as b,Q as c,Y as d,s as et,J as f,W as g,G as h,re as i,A as j,M as k,Z as l,K as m,ae as n,a as nt,te as o,q as p,m as q,ie as r,i as rt,$ as s,oe as t,o as tt,X as u,H as v,I as w,z as x,V as y,S as z};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e,r as t,t as n}from"./ai.mjs";var r=class{#e=!0;#t;#n;#r;#i;#a;#o;#s;#c=0;#l=5;#u=!1;#d=!1;#f=null;#p=()=>{this.debugLog(`Connected to event bus`),this.#a=!0,this.#u=!1,this.debugLog(`Emitting queued events`,this.#i),this.#i.forEach(e=>this.emitEventToBus(e)),this.#i=[],this.stopConnectLoop(),this.#n().removeEventListener(`tanstack-connect-success`,this.#p)};#m=()=>{if(this.#c<this.#l){this.#c++,this.dispatchCustomEvent(`tanstack-connect`,{});return}this.#n().removeEventListener(`tanstack-connect`,this.#m),this.#d=!0,this.debugLog(`Max retries reached, giving up on connection`),this.stopConnectLoop()};#h=()=>{this.#u||(this.#u=!0,this.#n().addEventListener(`tanstack-connect-success`,this.#p),this.#m())};constructor({pluginId:e,debug:t=!1,enabled:n=!0,reconnectEveryMs:r=300}){this.#t=e,this.#e=n,this.#n=this.getGlobalTarget,this.#r=t,this.debugLog(` Initializing event subscription for plugin`,this.#t),this.#i=[],this.#a=!1,this.#d=!1,this.#o=null,this.#s=r}startConnectLoop(){this.#o!==null||this.#a||(this.debugLog(`Starting connect loop (every ${this.#s}ms)`),this.#o=setInterval(this.#m,this.#s))}stopConnectLoop(){this.#u=!1,this.#o!==null&&(clearInterval(this.#o),this.#o=null,this.#i=[],this.debugLog(`Stopped connect loop`))}debugLog(...e){this.#r&&console.log(`🌴 [tanstack-devtools:${this.#t}-plugin]`,...e)}getGlobalTarget(){if(typeof globalThis<`u`&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog(`Using global event target`),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<`u`&&window.addEventListener!==void 0)return this.debugLog(`Using window as event target`),window;let e=typeof EventTarget<`u`?new EventTarget:void 0;return e===void 0||e.addEventListener===void 0?(this.debugLog(`No event mechanism available, running in non-web environment`),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog(`Using new EventTarget as fallback`),e)}getPluginId(){return this.#t}dispatchCustomEventShim(e,t){try{let n=new Event(e,{detail:t});this.#n().dispatchEvent(n)}catch{this.debugLog(`Failed to dispatch shim event`)}}dispatchCustomEvent(e,t){try{this.#n().dispatchEvent(new CustomEvent(e,{detail:t}))}catch{this.dispatchCustomEventShim(e,t)}}emitEventToBus(e){this.debugLog(`Emitting event to client bus`,e),this.dispatchCustomEvent(`tanstack-dispatch-event`,e)}createEventPayload(e,t){return{type:`${this.#t}:${e}`,payload:t,pluginId:this.#t}}emit(e,t){if(!this.#e){this.debugLog(`Event bus client is disabled, not emitting event`,e,t);return}if(this.#f&&(this.debugLog(`Emitting event to internal event target`,e,t),this.#f.dispatchEvent(new CustomEvent(`${this.#t}:${e}`,{detail:this.createEventPayload(e,t)}))),this.#d){this.debugLog(`Previously failed to connect, not emitting to bus`);return}if(!this.#a){this.debugLog(`Bus not available, will be pushed as soon as connected`),this.#i.push(this.createEventPayload(e,t)),typeof CustomEvent<`u`&&!this.#u&&(this.#h(),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(e,t))}on(e,t,n){let r=n?.withEventTarget??!1,i=`${this.#t}:${e}`;if(r&&(this.#f||=new EventTarget,this.#f.addEventListener(i,e=>{t(e.detail)})),!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`,i),()=>{};let a=e=>{this.debugLog(`Received event from bus`,e.detail),t(e.detail)};return this.#n().addEventListener(i,a),this.debugLog(`Registered event to bus`,i),()=>{r&&this.#f?.removeEventListener(i,a),this.#n().removeEventListener(i,a)}}onAll(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}onAllPluginEvents(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;this.#t&&n.pluginId!==this.#t||e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}};const i=new class extends r{constructor(){super({pluginId:`tanstack-ai-devtools`})}};var a=class{constructor(e){this.clientId=e}clientCreated(e){this.emitEvent(`client:created`,{initialMessageCount:e})}loadingChanged(e){this.emitEvent(`client:loading:changed`,{isLoading:e})}errorChanged(e){this.emitEvent(`client:error:changed`,{error:e})}textUpdated(e,t,n){this.emitEvent(`text:chunk:content`,{streamId:e,messageId:t,content:n})}toolCallStateChanged(e,t,n,r,i,a){this.emitEvent(`tools:call:updated`,{streamId:e,messageId:t,toolCallId:n,toolName:r,state:i,arguments:a})}thinkingUpdated(e,t,n,r){this.emitEvent(`text:chunk:thinking`,{streamId:e,messageId:t,content:n,delta:r})}approvalRequested(e,t,n,r,i,a){this.emitEvent(`tools:approval:requested`,{streamId:e,messageId:t,toolCallId:n,toolName:r,input:i,approvalId:a})}messageAppended(e,t){let n=e.parts.filter(e=>e.type===`text`).map(e=>e.content).join(` `);this.emitEvent(`text:message:created`,{streamId:t,messageId:e.id,role:e.role,content:n,parts:e.parts})}messageSent(e,t){let n=typeof t==`string`?t:t.filter(e=>e.type===`text`).map(e=>e.content).join(``);this.emitEvent(`text:message:created`,{messageId:e,role:`user`,content:n,...Array.isArray(t)&&{parts:t}}),this.emitEvent(`text:message:user`,{messageId:e,role:`user`,content:n,...Array.isArray(t)&&{parts:t}})}reloaded(e){this.emitEvent(`client:reloaded`,{fromMessageIndex:e})}stopped(){this.emitEvent(`client:stopped`)}messagesCleared(){this.emitEvent(`client:messages:cleared`)}toolResultAdded(e,t,n,r){this.emitEvent(`tools:result:added`,{toolCallId:e,toolName:t,output:n,state:r})}toolApprovalResponded(e,t,n){this.emitEvent(`tools:approval:responded`,{approvalId:e,toolCallId:t,approved:n})}},o=class extends a{emitEvent(e,t){e.startsWith(`client:`)||e.startsWith(`tools:`)||e.startsWith(`text:`)?i.emit(e,{...t,clientId:this.clientId,source:`client`,timestamp:Date.now()}):i.emit(e,{...t,timestamp:Date.now()})}};function s(e){if(!e)return{};if(e instanceof Headers){let t={};return e.forEach((e,n)=>{t[n]=e}),t}return e}async function*c(e,t){try{let n=new TextDecoder,r=``;for(;!t?.aborted;){let{done:t,value:i}=await e.read();if(t)break;r+=n.decode(i,{stream:!0});let a=r.split(`
|
|
2
|
+
`);r=a.pop()||``;for(let e of a)e.trim()&&(yield e)}r.trim()&&(yield r)}finally{e.releaseLock()}}function l(e){if(!e)throw Error(`Connection adapter is required`);let t=`connect`in e,n=`subscribe`in e,r=`send`in e;if(t&&(n||r))throw Error(`Connection adapter must provide either connect or both subscribe and send, not both modes`);if(n&&r)return{subscribe:e.subscribe.bind(e),send:e.send.bind(e)};if(!t)throw Error(`Connection adapter must provide either connect or both subscribe and send`);let i=[],a=[];function o(e){let t=a.shift();t?t(e):i.push(e)}return{subscribe(e){let t=i.splice(0),n=[];return i=t,a=n,(async function*(){for(;!e?.aborted;){let r;r=t.length>0?t.shift():await new Promise(t=>{let r=()=>t(null);n.push(n=>{e?.removeEventListener(`abort`,r),t(n)}),e?.addEventListener(`abort`,r,{once:!0})}),r!==null&&(yield r)}})()},async send(t,n,r){let i=!1;try{let a=e.connect(t,n,r);for await(let e of a)(e.type===`RUN_FINISHED`||e.type===`RUN_ERROR`)&&(i=!0),o(e);!r?.aborted&&!i&&o({type:`RUN_FINISHED`,runId:`run-${Date.now()}`,model:`connect-wrapper`,timestamp:Date.now(),finishReason:`stop`})}catch(e){throw!r?.aborted&&!i&&o({type:`RUN_ERROR`,timestamp:Date.now(),message:e instanceof Error?e.message:`Unknown error in connect()`,error:{message:e instanceof Error?e.message:`Unknown error in connect()`}}),e}}}}function u(e,t={}){return{async*connect(n,r,i){let a=typeof e==`function`?e():e,o=typeof t==`function`?await t():t,l={"Content-Type":`application/json`,...s(o.headers)},u={messages:n,data:r,...o.body},d=await(o.fetchClient??fetch)(a,{method:`POST`,headers:l,body:JSON.stringify(u),credentials:o.credentials||`same-origin`,signal:i||o.signal});if(!d.ok)throw Error(`HTTP error! status: ${d.status} ${d.statusText}`);let f=d.body?.getReader();if(!f)throw Error(`Response body is not readable`);for await(let e of c(f,i)){let t=e.startsWith(`data: `)?e.slice(6):e;if(t===`[DONE]`){console.warn(`[@tanstack/ai-client] Received [DONE] sentinel. This is deprecated — upgrade your @tanstack/ai server package. RUN_FINISHED is the stream terminator.`);continue}try{yield JSON.parse(t)}catch{console.warn(`Failed to parse SSE chunk:`,t)}}}}}var d=class{constructor(e){if(this.body={},this.pendingMessageBody=void 0,this.isLoading=!1,this.isSubscribed=!1,this.error=void 0,this.status=`ready`,this.connectionStatus=`disconnected`,this.abortController=null,this.currentStreamId=null,this.currentMessageId=null,this.postStreamActions=[],this.pendingToolExecutions=new Map,this.continuationPending=!1,this.subscriptionAbortController=null,this.processingResolve=null,this.errorReportedGeneration=null,this.streamGeneration=0,this.continuationSkipped=!1,this.draining=!1,this.sessionGenerating=!1,this.activeRunIds=new Set,this.uniqueId=e.id||this.generateUniqueId(`chat`),this.body=e.body||{},this.connection=l(e.connection),this.events=new o(this.uniqueId),this.clientToolsRef={current:new Map},e.tools)for(let t of e.tools)this.clientToolsRef.current.set(t.name,t);this.callbacksRef={current:{onResponse:e.onResponse||(()=>{}),onChunk:e.onChunk||(()=>{}),onFinish:e.onFinish||(()=>{}),onError:e.onError||(()=>{}),onMessagesChange:e.onMessagesChange||(()=>{}),onLoadingChange:e.onLoadingChange||(()=>{}),onErrorChange:e.onErrorChange||(()=>{}),onStatusChange:e.onStatusChange||(()=>{}),onSubscriptionChange:e.onSubscriptionChange||(()=>{}),onConnectionStatusChange:e.onConnectionStatusChange||(()=>{}),onSessionGeneratingChange:e.onSessionGeneratingChange||(()=>{}),onCustomEvent:e.onCustomEvent||(()=>{})}},this.processor=new n({chunkStrategy:e.streamProcessor?.chunkStrategy,initialMessages:e.initialMessages,events:{onMessagesChange:e=>{this.callbacksRef.current.onMessagesChange(e)},onStreamStart:()=>{this.setStatus(`streaming`);let e=this.processor.getCurrentAssistantMessageId();if(!e)return;let t=this.processor.getMessages().find(t=>t.id===e);t&&(this.currentMessageId=t.id,this.events.messageAppended(t,this.currentStreamId||void 0))},onStreamEnd:e=>{this.callbacksRef.current.onFinish(e),this.setStatus(`ready`),this.resolveProcessing()},onError:e=>{this.reportStreamError(e)},onTextUpdate:(e,t)=>{this.currentStreamId&&this.events.textUpdated(this.currentStreamId,e,t)},onThinkingUpdate:(e,t)=>{this.currentStreamId&&this.events.thinkingUpdated(this.currentStreamId,e,t)},onToolCallStateChange:(e,t,n,r)=>{let i=this.processor.getMessages().find(t=>t.id===e)?.parts.find(e=>e.type===`tool-call`&&e.id===t)?.name||`unknown`;this.currentStreamId&&this.events.toolCallStateChanged(this.currentStreamId,e,t,i,n,r)},onToolCall:e=>{let t=this.clientToolsRef.current.get(e.toolName)?.execute;if(t){let n=(async()=>{try{let n=await t(e.input);await this.addToolResult({toolCallId:e.toolCallId,tool:e.toolName,output:n,state:`output-available`})}catch(t){await this.addToolResult({toolCallId:e.toolCallId,tool:e.toolName,output:null,state:`output-error`,errorText:t.message})}finally{this.pendingToolExecutions.delete(e.toolCallId)}})();this.pendingToolExecutions.set(e.toolCallId,n)}},onApprovalRequest:e=>{this.currentStreamId&&this.events.approvalRequested(this.currentStreamId,this.currentMessageId||``,e.toolCallId,e.toolName,e.input,e.approvalId)},onCustomEvent:(e,t,n)=>{this.callbacksRef.current.onCustomEvent(e,t,n)}}}),this.events.clientCreated(this.processor.getMessages().length)}generateUniqueId(e){return`${e}-${Date.now()}-${Math.random().toString(36).substring(7)}`}setIsLoading(e){this.isLoading=e,this.callbacksRef.current.onLoadingChange(e),this.events.loadingChanged(e)}setStatus(e){this.status=e,this.callbacksRef.current.onStatusChange(e)}setIsSubscribed(e){this.isSubscribed=e,this.callbacksRef.current.onSubscriptionChange(e)}setConnectionStatus(e){this.connectionStatus=e,this.callbacksRef.current.onConnectionStatusChange(e)}setSessionGenerating(e){this.sessionGenerating!==e&&(this.sessionGenerating=e,this.callbacksRef.current.onSessionGeneratingChange(e))}resetSessionGenerating(){this.activeRunIds.clear(),this.setSessionGenerating(!1)}setError(e){this.error=e,this.callbacksRef.current.onErrorChange(e),this.events.errorChanged(e?.message||null)}abortSubscriptionLoop(){this.subscriptionAbortController?.abort(),this.subscriptionAbortController=null}resolveProcessing(){this.processingResolve?.(),this.processingResolve=null}cancelInFlightStream(e){this.abortController?.abort(),this.abortController=null,e?.abortSubscription&&this.abortSubscriptionLoop(),this.resolveProcessing(),this.setIsLoading(!1),e?.setReadyStatus&&this.setStatus(`ready`)}reportStreamError(e){let t=this.errorReportedGeneration===this.streamGeneration;this.setError(e),(this.isLoading||this.status===`submitted`||this.status===`streaming`)&&this.setStatus(`error`),t||(this.errorReportedGeneration=this.streamGeneration,this.callbacksRef.current.onError(e))}startSubscription(){this.subscriptionAbortController=new AbortController;let e=this.subscriptionAbortController.signal;this.consumeSubscription(e).catch(e=>{e instanceof Error&&e.name!==`AbortError`&&(this.setConnectionStatus(`error`),this.resetSessionGenerating(),this.setIsSubscribed(!1),this.reportStreamError(e)),this.resolveProcessing()}).finally(()=>{this.subscriptionAbortController?.signal===e&&(this.subscriptionAbortController=null,!e.aborted&&this.isSubscribed&&(this.setIsSubscribed(!1),this.connectionStatus!==`error`&&this.setConnectionStatus(`disconnected`)))})}async consumeSubscription(e){let t=this.connection.subscribe(e);for await(let n of t){if(e.aborted)break;if(this.connectionStatus===`connecting`&&this.setConnectionStatus(`connected`),this.callbacksRef.current.onChunk(n),this.processor.processChunk(n),n.type===`RUN_STARTED`&&(this.activeRunIds.add(n.runId),this.setSessionGenerating(!0)),n.type===`RUN_FINISHED`||n.type===`RUN_ERROR`){let e=n.type===`RUN_FINISHED`?n.runId:void 0;e?this.activeRunIds.delete(e):n.type===`RUN_ERROR`&&this.activeRunIds.clear(),this.setSessionGenerating(this.activeRunIds.size>0),this.resolveProcessing()}await new Promise(e=>setTimeout(e,0))}}ensureSubscription(){if(!this.isSubscribed){this.subscribe();return}(!this.subscriptionAbortController||this.subscriptionAbortController.signal.aborted)&&this.subscribe({restart:!0})}waitForProcessing(){return this.resolveProcessing(),new Promise(e=>{this.processingResolve=e})}async sendMessage(e,t){if(typeof e==`string`&&!e.trim()||this.isLoading)return;let n=this.normalizeMessageInput(e);this.pendingMessageBody=t;let r=this.processor.addUserMessage(n.content,n.id);this.events.messageSent(r.id,n.content),await this.streamResponse()}normalizeMessageInput(e){return typeof e==`string`?{content:e.trim()}:{content:e.content,id:e.id}}async append(n){let r=e(n,t);if(r.role===`system`)return;let i=r;this.events.messageAppended(i);let a=this.processor.getMessages();if(this.processor.setMessages([...a,i]),this.isLoading){this.queuePostStreamAction(async()=>{await this.streamResponse()});return}await this.streamResponse()}async streamResponse(){if(this.isLoading)return!1;let e=++this.streamGeneration;this.setIsLoading(!0),this.setStatus(`submitted`),this.setError(void 0),this.errorReportedGeneration=null,this.abortController=new AbortController,this.pendingToolExecutions.clear();let t=!1;try{let n=this.processor.getMessages();await this.callbacksRef.current.onResponse();let r={...this.body,...this.pendingMessageBody,conversationId:this.uniqueId};this.pendingMessageBody=void 0,this.currentStreamId=this.generateUniqueId(`stream`),this.currentMessageId=null,this.processor.prepareAssistantMessage(),this.ensureSubscription();let i=this.waitForProcessing();if(await this.connection.send(n,r,this.abortController.signal),await i,e!==this.streamGeneration||this.status===`error`)return!1;this.pendingToolExecutions.size>0&&await Promise.all(this.pendingToolExecutions.values()),this.processor.finalizeStream(),t=!0}catch(t){if(t instanceof Error){if(t.name===`AbortError`)return!1;e===this.streamGeneration&&this.reportStreamError(t)}}finally{if(e===this.streamGeneration&&(this.currentStreamId=null,this.currentMessageId=null,this.abortController=null,this.setIsLoading(!1),this.pendingMessageBody=void 0,await this.drainPostStreamActions(),t)){let e=this.processor.getMessages().at(-1)?.parts.at(-1),{finishReason:t}=this.processor.getState();if(e?.type===`tool-result`&&t!==`stop`&&this.shouldAutoSend())try{await this.checkForContinuation()}catch(e){console.error(`Failed to continue flow after tool result:`,e)}}}return t}subscribe(e){let t=e?.restart===!0;this.isSubscribed&&!t||(this.isSubscribed&&t&&this.abortSubscriptionLoop(),this.setIsSubscribed(!0),this.setConnectionStatus(`connecting`),this.startSubscription())}unsubscribe(){this.cancelInFlightStream({setReadyStatus:!0,abortSubscription:!0}),this.resetSessionGenerating(),this.setIsSubscribed(!1),this.setConnectionStatus(`disconnected`)}async reload(){let e=this.processor.getMessages();if(e.length===0)return;let t=e.findLastIndex(e=>e.role===`user`);t!==-1&&(this.isLoading&&this.cancelInFlightStream(),this.events.reloaded(t),this.processor.removeMessagesAfter(t),await this.streamResponse())}stop(){this.cancelInFlightStream({setReadyStatus:!0}),this.events.stopped()}clear(){this.processor.clearMessages(),this.setError(void 0),this.events.messagesCleared()}async addToolResult(e){if(this.events.toolResultAdded(e.toolCallId,e.tool,e.output,e.state||`output-available`),this.processor.addToolResult(e.toolCallId,e.output,e.errorText),this.isLoading){this.queuePostStreamAction(()=>this.checkForContinuation());return}await this.checkForContinuation()}async addToolApprovalResponse(e){let t=this.processor.getMessages(),n;for(let r of t){let t=r.parts.find(t=>t.type===`tool-call`&&t.approval?.id===e.id);if(t){n=t.id;break}}if(n&&this.events.toolApprovalResponded(e.id,n,e.approved),this.processor.addToolApprovalResponse(e.id,e.approved),this.isLoading){this.queuePostStreamAction(()=>this.checkForContinuation());return}await this.checkForContinuation()}queuePostStreamAction(e){this.postStreamActions.push(e)}async drainPostStreamActions(){if(!this.draining){this.draining=!0;try{for(;this.postStreamActions.length>0;)await this.postStreamActions.shift()()}finally{this.draining=!1}}}async checkForContinuation(){if(this.continuationPending||this.isLoading){this.continuationSkipped=!0;return}if(this.shouldAutoSend()){this.continuationPending=!0,this.continuationSkipped=!1;let e=!1;try{e=await this.streamResponse()}finally{this.continuationPending=!1}this.continuationSkipped&&e&&(this.continuationSkipped=!1,await this.checkForContinuation())}}shouldAutoSend(){let e=this.processor.getMessages().findLast(e=>e.role===`assistant`);return!e||!e.parts.some(e=>e.type===`tool-call`)?!1:this.processor.areAllToolsComplete()}getMessages(){return this.processor.getMessages()}getIsLoading(){return this.isLoading}getStatus(){return this.status}getIsSubscribed(){return this.isSubscribed}getConnectionStatus(){return this.connectionStatus}getSessionGenerating(){return this.sessionGenerating}getError(){return this.error}setMessagesManually(e){this.processor.setMessages(e)}updateOptions(e){if(e.connection!==void 0){let t=this.isSubscribed;this.isLoading?this.cancelInFlightStream({setReadyStatus:!0,abortSubscription:!0}):t&&this.abortSubscriptionLoop(),this.resetSessionGenerating(),this.setIsSubscribed(!1),this.setConnectionStatus(`disconnected`),this.connection=l(e.connection),t&&this.subscribe()}if(e.body!==void 0&&(this.body=e.body),e.tools!==void 0){this.clientToolsRef.current=new Map;for(let t of e.tools)this.clientToolsRef.current.set(t.name,t)}e.onResponse!==void 0&&(this.callbacksRef.current.onResponse=e.onResponse),e.onChunk!==void 0&&(this.callbacksRef.current.onChunk=e.onChunk),e.onFinish!==void 0&&(this.callbacksRef.current.onFinish=e.onFinish),e.onError!==void 0&&(this.callbacksRef.current.onError=e.onError),e.onSubscriptionChange!==void 0&&(this.callbacksRef.current.onSubscriptionChange=e.onSubscriptionChange),e.onConnectionStatusChange!==void 0&&(this.callbacksRef.current.onConnectionStatusChange=e.onConnectionStatusChange),e.onSessionGeneratingChange!==void 0&&(this.callbacksRef.current.onSessionGeneratingChange=e.onSessionGeneratingChange),e.onCustomEvent!==void 0&&(this.callbacksRef.current.onCustomEvent=e.onCustomEvent)}};function f(...e){return e}export{d as n,u as r,f as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./ai-react.mjs";import{createContext as e,useEffect as t,useState as n}from"react";import{Fragment as r,jsx as i,jsxs as a}from"react/jsx-runtime";e(null);function o({content:e,className:r=``,isComplete:o=!1}){let[s,c]=n(!1);return t(()=>{o&&c(!0)},[o]),a(`div`,{className:r||void 0,"data-part-type":`thinking`,"data-part-content":!0,children:[a(`button`,{onClick:()=>c(!s),className:`flex items-center gap-2 text-sm text-gray-400 hover:text-gray-300 transition-colors mb-2`,"aria-expanded":!s,"aria-label":s?`Expand thinking`:`Collapse thinking`,children:[i(`span`,{className:`text-xs`,children:s?`▶`:`▼`}),i(`span`,{className:`italic`,children:`💭 Thinking...`}),o&&i(`span`,{className:`text-xs text-gray-500`,children:`(complete)`})]}),!s&&i(`div`,{className:`text-gray-300 whitespace-pre-wrap font-mono text-sm`,children:e})]})}function s({message:e,className:t=``,userClassName:n=``,assistantClassName:r=``,textPartRenderer:a,thinkingPartRenderer:o,toolsRenderer:s,defaultToolRenderer:l,toolResultRenderer:u}){return i(`div`,{className:[t,e.role===`user`?n:r].filter(Boolean).join(` `)||void 0,"data-message-id":e.id,"data-message-role":e.role,"data-message-created":e.createdAt?.toISOString(),children:e.parts.map((t,n)=>i(c,{part:t,isThinkingComplete:t.type===`thinking`&&e.parts.slice(n+1).some(e=>e.type===`text`),textPartRenderer:a,thinkingPartRenderer:o,toolsRenderer:s,defaultToolRenderer:l,toolResultRenderer:u},`${e.id}-part-${n}`))})}function c({part:e,isThinkingComplete:t,textPartRenderer:n,thinkingPartRenderer:s,toolsRenderer:c,defaultToolRenderer:l,toolResultRenderer:u}){if(e.type===`text`)return n?i(r,{children:n({content:e.content})}):i(`div`,{"data-part-type":`text`,"data-part-content":!0,children:e.content});if(e.type===`thinking`)return s?i(r,{children:s({content:e.content,isComplete:t})}):i(o,{content:e.content,isComplete:t});if(e.type===`tool-call`){let t={id:e.id,name:e.name,arguments:e.arguments,state:e.state,approval:e.approval,output:e.output};return c?.[e.name]?i(r,{children:c[e.name]?.(t)}):l?i(r,{children:l(t)}):a(`div`,{"data-part-type":`tool-call`,"data-tool-name":e.name,"data-tool-state":e.state,"data-tool-id":e.id,children:[a(`div`,{"data-tool-header":!0,children:[i(`strong`,{children:e.name}),i(`span`,{"data-tool-state-badge":!0,children:e.state})]}),e.arguments&&i(`div`,{"data-tool-arguments":!0,children:i(`pre`,{children:e.arguments})}),e.approval&&i(`div`,{"data-tool-approval":!0,children:e.approval.approved===void 0?`⏳ Awaiting approval...`:e.approval.approved?`✓ Approved`:`✗ Denied`}),e.output&&i(`div`,{"data-tool-output":!0,children:i(`pre`,{children:JSON.stringify(e.output,null,2)})})]})}return e.type===`tool-result`?u?i(r,{children:u({toolCallId:e.toolCallId,content:e.content,state:e.state})}):i(`div`,{"data-part-type":`tool-result`,"data-tool-call-id":e.toolCallId,"data-tool-result-state":e.state,children:i(`div`,{"data-tool-result-content":!0,children:e.content})}):null}export{s as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./ai-client.mjs";import{useCallback as t,useEffect as n,useId as r,useMemo as i,useRef as a,useState as o}from"react";function s(s){let c=r(),l=s.id||c,[u,d]=o(s.initialMessages||[]),[f,p]=o(!1),[m,h]=o(void 0),[g,_]=o(`ready`),[v,y]=o(!1),[b,x]=o(`disconnected`),[S,C]=o(!1),w=a(s.initialMessages||[]),T=a(!0);w.current=u;let E=a(s);E.current=s;let D=i(()=>{let t=T.current?s.initialMessages||[]:w.current;return T.current=!1,new e({connection:E.current.connection,id:l,initialMessages:t,body:E.current.body,onResponse:e=>E.current.onResponse?.(e),onChunk:e=>E.current.onChunk?.(e),onFinish:e=>{E.current.onFinish?.(e)},onError:e=>{E.current.onError?.(e)},tools:E.current.tools,onCustomEvent:(e,t,n)=>E.current.onCustomEvent?.(e,t,n),streamProcessor:s.streamProcessor,onMessagesChange:e=>{d(e)},onLoadingChange:e=>{p(e)},onErrorChange:e=>{h(e)},onStatusChange:e=>{_(e)},onSubscriptionChange:e=>{y(e)},onConnectionStatusChange:e=>{x(e)},onSessionGeneratingChange:e=>{C(e)}})},[l]);n(()=>{D.updateOptions({body:s.body})},[D,s.body]),n(()=>{s.initialMessages&&s.initialMessages.length>0&&u.length===0&&D.setMessagesManually(s.initialMessages)},[]),n(()=>{s.live?D.subscribe():D.unsubscribe()},[D,s.live]),n(()=>()=>{s.live?D.unsubscribe():D.stop()},[D,s.live]);let O=t(async e=>{await D.sendMessage(e)},[D]),k=t(async e=>{await D.append(e)},[D]),A=t(async()=>{await D.reload()},[D]),j=t(()=>{D.stop()},[D]),M=t(()=>{D.clear()},[D]);return{messages:u,sendMessage:O,append:k,reload:A,stop:j,isLoading:f,error:m,status:g,isSubscribed:v,connectionStatus:b,sessionGenerating:S,setMessages:t(e=>{D.setMessagesManually(e)},[D]),clear:M,addToolResult:t(async e=>{await D.addToolResult(e)},[D]),addToolApprovalResponse:t(async e=>{await D.addToolApprovalResponse(e)},[D])}}new Uint8Array(128).fill(128);export{s as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t as e}from"../../rolldown-runtime.mjs";function t(e){return e.type===`text`||e.type===`image`||e.type===`audio`||e.type===`video`||e.type===`document`}function n(e){return e.length===0?null:e.every(e=>e.type===`text`)?e.map(e=>e.content).join(``)||null:e}function r(e){return e===null?``:typeof e==`string`?e:e.filter(e=>e.type===`text`).map(e=>e.content).join(``)}function i(e){return e.role===`system`?[]:e.role===`assistant`?c(e):[a(e)]}function a(e){let r=[];for(let n of e.parts)t(n)&&r.push(n);return{role:e.role,content:n(r)}}function o(){return{contentParts:[],toolCalls:[]}}function s(e){return e.state===`input-complete`||e.state===`approval-responded`||e.output!==void 0}function c(e){let t=[],r=o(),i=new Set;function a(){let e=n(r.contentParts),i=e!==null,a=r.toolCalls.length>0;(i||a)&&t.push({role:`assistant`,content:e,...a&&{toolCalls:r.toolCalls}}),r=o()}for(let n of e.parts)switch(n.type){case`text`:case`image`:case`audio`:case`video`:case`document`:r.contentParts.push(n);break;case`tool-call`:s(n)&&r.toolCalls.push({id:n.id,type:`function`,function:{name:n.name,arguments:n.arguments}});break;case`tool-result`:a(),(n.state===`complete`||n.state===`error`)&&!i.has(n.toolCallId)&&(t.push({role:`tool`,content:n.content,toolCallId:n.toolCallId}),i.add(n.toolCallId));break}a();for(let n of e.parts)if(n.type===`tool-call`&&(n.output!==void 0&&!i.has(n.id)&&(t.push({role:`tool`,content:JSON.stringify(n.output),toolCallId:n.id}),i.add(n.id)),n.output===void 0&&n.state===`approval-responded`&&n.approval?.approved!==void 0&&!i.has(n.id))){let e=n.approval.approved;t.push({role:`tool`,content:JSON.stringify({approved:e,...e&&{pendingExecution:!0},message:e?`User approved this action`:`User denied this action`}),toolCallId:n.id}),i.add(n.id)}return t.length===0&&t.push({role:`assistant`,content:null}),t}function l(e,t){let n=[];if(e.role===`tool`&&e.toolCallId)n.push({type:`tool-result`,toolCallId:e.toolCallId,content:r(e.content),state:`complete`});else if(Array.isArray(e.content))for(let t of e.content)n.push(t);else{let t=r(e.content);t&&n.push({type:`text`,content:t})}if(e.toolCalls&&e.toolCalls.length>0)for(let t of e.toolCalls)n.push({type:`tool-call`,id:t.id,name:t.function.name,arguments:t.function.arguments,state:`input-complete`});return{id:t||d(),role:e.role===`tool`?`assistant`:e.role,parts:n}}function u(e,t){return`parts`in e?{...e,id:e.id||t(),createdAt:e.createdAt||new Date}:{...l(e,t()),createdAt:new Date}}function d(){return`msg-${Date.now()}-${Math.random().toString(36).substring(7)}`}function f(e){return{__toolSide:`definition`,...e,server(t){return{__toolSide:`server`,...e,execute:t}},client(t){return{__toolSide:`client`,...e,execute:t}}}}var p=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Allow=e.ALL=e.COLLECTION=e.ATOM=e.SPECIAL=e.INF=e._INFINITY=e.INFINITY=e.NAN=e.BOOL=e.NULL=e.OBJ=e.ARR=e.NUM=e.STR=void 0,e.STR=1,e.NUM=2,e.ARR=4,e.OBJ=8,e.NULL=16,e.BOOL=32,e.NAN=64,e.INFINITY=128,e._INFINITY=256,e.INF=e.INFINITY|e._INFINITY,e.SPECIAL=e.NULL|e.BOOL|e.INF|e.NAN,e.ATOM=e.STR|e.NUM|e.SPECIAL,e.COLLECTION=e.ARR|e.OBJ,e.ALL=e.ATOM|e.COLLECTION,e.Allow={STR:e.STR,NUM:e.NUM,ARR:e.ARR,OBJ:e.OBJ,NULL:e.NULL,BOOL:e.BOOL,NAN:e.NAN,INFINITY:e.INFINITY,_INFINITY:e._INFINITY,INF:e.INF,SPECIAL:e.SPECIAL,ATOM:e.ATOM,COLLECTION:e.COLLECTION,ALL:e.ALL},e.default=e.Allow})),m=e((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.Allow=e.MalformedJSON=e.PartialJSON=e.parseJSON=e.parse=void 0;let r=p();Object.defineProperty(e,"Allow",{enumerable:!0,get:function(){return r.Allow}}),n(p(),e);var i=class extends Error{};e.PartialJSON=i;var a=class extends Error{};e.MalformedJSON=a;function o(e,t=r.Allow.ALL){if(typeof e!=`string`)throw TypeError(`expecting str, got ${typeof e}`);if(!e.trim())throw Error(`${e} is empty`);return s(e.trim(),t)}e.parseJSON=o;let s=(e,t)=>{let n=e.length,o=0,s=e=>{throw new i(`${e} at position ${o}`)},c=e=>{throw new a(`${e} at position ${o}`)},l=()=>(m(),o>=n&&s(`Unexpected end of input`),e[o]===`"`?u():e[o]===`{`?d():e[o]===`[`?f():e.substring(o,o+4)===`null`||r.Allow.NULL&t&&n-o<4&&`null`.startsWith(e.substring(o))?(o+=4,null):e.substring(o,o+4)===`true`||r.Allow.BOOL&t&&n-o<4&&`true`.startsWith(e.substring(o))?(o+=4,!0):e.substring(o,o+5)===`false`||r.Allow.BOOL&t&&n-o<5&&`false`.startsWith(e.substring(o))?(o+=5,!1):e.substring(o,o+8)===`Infinity`||r.Allow.INFINITY&t&&n-o<8&&`Infinity`.startsWith(e.substring(o))?(o+=8,1/0):e.substring(o,o+9)===`-Infinity`||r.Allow._INFINITY&t&&1<n-o&&n-o<9&&`-Infinity`.startsWith(e.substring(o))?(o+=9,-1/0):e.substring(o,o+3)===`NaN`||r.Allow.NAN&t&&n-o<3&&`NaN`.startsWith(e.substring(o))?(o+=3,NaN):p()),u=()=>{let i=o,a=!1;for(o++;o<n&&(e[o]!==`"`||a&&e[o-1]===`\\`);)a=e[o]===`\\`?!a:!1,o++;if(e.charAt(o)==`"`)try{return JSON.parse(e.substring(i,++o-Number(a)))}catch(e){c(String(e))}else if(r.Allow.STR&t)try{return JSON.parse(e.substring(i,o-Number(a))+`"`)}catch{return JSON.parse(e.substring(i,e.lastIndexOf(`\\`))+`"`)}s(`Unterminated string literal`)},d=()=>{o++,m();let i={};try{for(;e[o]!==`}`;){if(m(),o>=n&&r.Allow.OBJ&t)return i;let a=u();m(),o++;try{i[a]=l()}catch(e){if(r.Allow.OBJ&t)return i;throw e}m(),e[o]===`,`&&o++}}catch{if(r.Allow.OBJ&t)return i;s(`Expected '}' at end of object`)}return o++,i},f=()=>{o++;let n=[];try{for(;e[o]!==`]`;)n.push(l()),m(),e[o]===`,`&&o++}catch{if(r.Allow.ARR&t)return n;s(`Expected ']' at end of array`)}return o++,n},p=()=>{if(o===0){e===`-`&&c(`Not sure what '-' is`);try{return JSON.parse(e)}catch(n){if(r.Allow.NUM&t)try{return JSON.parse(e.substring(0,e.lastIndexOf(`e`)))}catch{}c(String(n))}}let i=o;for(e[o]===`-`&&o++;e[o]&&`,]}`.indexOf(e[o])===-1;)o++;o==n&&!(r.Allow.NUM&t)&&s(`Unterminated number literal`);try{return JSON.parse(e.substring(i,o))}catch{e.substring(i,o)===`-`&&s(`Not sure what '-' is`);try{return JSON.parse(e.substring(i,e.lastIndexOf(`e`)))}catch(e){c(String(e))}}},m=()=>{for(;o<n&&`
|
|
2
|
+
\r `.includes(e[o]);)o++};return l()};e.parse=o}))();const h=new class{parse(e){if(!(!e||e.trim()===``))try{return(0,m.parse)(e)}catch{return}}};function g(e,t,n){return e.map(e=>{if(e.id!==t)return e;let r=[...e.parts],i=r.length>0?r[r.length-1]:null;return i&&i.type===`text`?r[r.length-1]={type:`text`,content:n}:r.push({type:`text`,content:n}),{...e,parts:r}})}function _(e,t,n){return e.map(e=>{if(e.id!==t)return e;let r=[...e.parts],i=r.find(e=>e.type===`tool-call`&&e.id===n.id),a={type:`tool-call`,id:n.id,name:n.name,arguments:n.arguments,state:n.state,...i?.approval&&{approval:{...i.approval}},...i?.output!==void 0&&{output:i.output}};return i?r[r.indexOf(i)]=a:r.push(a),{...e,parts:r}})}function v(e,t,n,r,i,a){return e.map(e=>{if(e.id!==t)return e;let o=[...e.parts],s=o.findIndex(e=>e.type===`tool-result`&&e.toolCallId===n),c={type:`tool-result`,toolCallId:n,content:r,state:i,...a&&{error:a}};return s>=0?o[s]=c:o.push(c),{...e,parts:o}})}function y(e,t,n,r){return e.map(e=>{if(e.id!==t)return e;let i=[...e.parts],a=i.find(e=>e.type===`tool-call`&&e.id===n);return a&&(a.state=`approval-requested`,a.approval={id:r,needsApproval:!0}),{...e,parts:i}})}function b(e,t,n,r,i){return e.map(e=>{let a=[...e.parts],o=a.find(e=>e.type===`tool-call`&&e.id===t);return o&&(o.output=i?{error:i}:n,r?o.state=r:o.state=`input-complete`),{...e,parts:a}})}function x(e,t,n){return e.map(e=>{let r=[...e.parts],i=r.find(e=>e.type===`tool-call`&&e.approval?.id===t);return i&&i.approval&&(i.approval.approved=n,i.state=`approval-responded`),{...e,parts:r}})}function S(e,t,n){return e.map(e=>{if(e.id!==t)return e;let r=[...e.parts],i=r.findIndex(e=>e.type===`thinking`),a={type:`thinking`,content:n};return i>=0?r[i]=a:r.push(a),{...e,parts:r}})}var C=class{shouldEmit(e,t){return!0}},w=class e{constructor(e={}){this.messages=[],this.messageStates=new Map,this.activeMessageIds=new Set,this.toolCallToMessage=new Map,this.pendingManualMessageId=null,this.activeRuns=new Set,this.finishReason=null,this.hasError=!1,this.isDone=!1,this.recording=null,this.recordingStartTime=0,this.chunkStrategy=e.chunkStrategy||new C,this.events=e.events||{},this.jsonParser=e.jsonParser||h,this.recordingEnabled=e.recording??!1,e.initialMessages&&(this.messages=[...e.initialMessages])}setMessages(e){this.messages=[...e],this.emitMessagesChange()}addUserMessage(e,t){let n=typeof e==`string`?[{type:`text`,content:e}]:e.map(e=>e),r={id:t??d(),role:`user`,parts:n,createdAt:new Date};return this.messages=[...this.messages,r],this.emitMessagesChange(),r}prepareAssistantMessage(){this.resetStreamState()}startAssistantMessage(e){this.prepareAssistantMessage();let{messageId:t}=this.ensureAssistantMessage(e);return this.pendingManualMessageId=t,t}getCurrentAssistantMessageId(){let e=null;for(let[t,n]of this.messageStates)n.role===`assistant`&&(e=t);return e}addToolResult(e,t,n){let r=this.messages.find(t=>t.parts.some(t=>t.type===`tool-call`&&t.id===e));if(!r){console.warn(`[StreamProcessor] Could not find message with tool call ${e}`);return}let i=b(this.messages,e,t,n?`input-complete`:void 0,n),a=typeof t==`string`?t:JSON.stringify(t),o=n?`error`:`complete`;i=v(i,r.id,e,a,o,n),this.messages=i,this.emitMessagesChange()}addToolApprovalResponse(e,t){this.messages=x(this.messages,e,t),this.emitMessagesChange()}toModelMessages(){let e=[];for(let t of this.messages)e.push(...i(t));return e}getMessages(){return this.messages}areAllToolsComplete(){let e=this.messages.findLast(e=>e.role===`assistant`);if(!e)return!0;let t=e.parts.filter(e=>e.type===`tool-call`);if(t.length===0)return!0;let n=new Set(e.parts.filter(e=>e.type===`tool-result`).map(e=>e.toolCallId));return t.every(e=>e.state===`approval-responded`||e.output!==void 0&&!e.approval||n.has(e.id))}removeMessagesAfter(e){this.messages=this.messages.slice(0,e+1),this.emitMessagesChange()}clearMessages(){this.messages=[],this.messageStates.clear(),this.activeMessageIds.clear(),this.toolCallToMessage.clear(),this.pendingManualMessageId=null,this.emitMessagesChange()}async process(e){this.resetStreamState(),this.recordingEnabled&&this.startRecording();for await(let t of e)this.processChunk(t);return this.finalizeStream(),this.recording&&(this.recording.result=this.getResult()),this.getResult()}processChunk(e){switch(this.recording&&this.recording.chunks.push({chunk:e,timestamp:Date.now(),index:this.recording.chunks.length}),e.type){case`TEXT_MESSAGE_START`:this.handleTextMessageStartEvent(e);break;case`TEXT_MESSAGE_CONTENT`:this.handleTextMessageContentEvent(e);break;case`TEXT_MESSAGE_END`:this.handleTextMessageEndEvent(e);break;case`TOOL_CALL_START`:this.handleToolCallStartEvent(e);break;case`TOOL_CALL_ARGS`:this.handleToolCallArgsEvent(e);break;case`TOOL_CALL_END`:this.handleToolCallEndEvent(e);break;case`RUN_FINISHED`:this.handleRunFinishedEvent(e);break;case`RUN_ERROR`:this.handleRunErrorEvent(e);break;case`STEP_FINISHED`:this.handleStepFinishedEvent(e);break;case`MESSAGES_SNAPSHOT`:this.handleMessagesSnapshotEvent(e);break;case`CUSTOM`:this.handleCustomEvent(e);break;case`RUN_STARTED`:this.handleRunStartedEvent(e);break;case`REASONING_START`:case`REASONING_MESSAGE_START`:case`REASONING_MESSAGE_END`:case`REASONING_END`:break;case`REASONING_MESSAGE_CONTENT`:this.handleReasoningMessageContentEvent(e);break;case`TOOL_CALL_RESULT`:this.handleToolCallResultEvent(e);break}}createMessageState(e,t){let n={id:e,role:t,totalTextContent:``,currentSegmentText:``,lastEmittedText:``,thinkingContent:``,hasSeenReasoningEvents:!1,toolCalls:new Map,toolCallOrder:[],hasToolCallsSinceTextStart:!1,isComplete:!1};return this.messageStates.set(e,n),n}getMessageState(e){return this.messageStates.get(e)}getActiveAssistantMessageId(){let e=Array.from(this.activeMessageIds);for(let t=e.length-1;t>=0;t--){let n=e[t],r=this.messageStates.get(n);if(r&&r.role===`assistant`)return n}return null}ensureAssistantMessage(e){if(e){let t=this.getMessageState(e);if(t)return{messageId:e,state:t}}let t=this.getActiveAssistantMessageId();if(t)return{messageId:t,state:this.getMessageState(t)};if(e){let t=this.messages.find(t=>t.id===e);if(t){let n=this.createMessageState(e,t.role);this.activeMessageIds.add(e);let r=t.parts.length>0?t.parts[t.parts.length-1]:null;return r&&r.type===`text`&&(n.currentSegmentText=r.content,n.lastEmittedText=r.content,n.totalTextContent=r.content),{messageId:e,state:n}}}let n=e||d(),r={id:n,role:`assistant`,parts:[],createdAt:new Date};this.messages=[...this.messages,r];let i=this.createMessageState(n,`assistant`);return this.activeMessageIds.add(n),this.pendingManualMessageId=n,this.events.onStreamStart?.(),this.emitMessagesChange(),{messageId:n,state:i}}handleTextMessageStartEvent(e){let{messageId:t,role:n}=e,r=n===`user`||n===`system`?n:`assistant`;if(this.pendingManualMessageId){let e=this.pendingManualMessageId;if(this.pendingManualMessageId=null,e!==t){this.messages=this.messages.map(n=>n.id===e?{...n,id:t}:n);let n=this.messageStates.get(e);n&&(n.id=t,this.messageStates.delete(e),this.messageStates.set(t,n)),this.activeMessageIds.delete(e),this.activeMessageIds.add(t)}this.messageStates.has(t)||(this.createMessageState(t,r),this.activeMessageIds.add(t)),this.emitMessagesChange();return}if(this.messages.find(e=>e.id===t)){if(this.activeMessageIds.add(t),!this.messageStates.has(t))this.createMessageState(t,r);else{let e=this.messageStates.get(t);e.hasToolCallsSinceTextStart&&=(e.currentSegmentText!==e.lastEmittedText&&this.emitTextUpdateForMessage(t),e.currentSegmentText=``,e.lastEmittedText=``,!1)}return}let i={id:t,role:r,parts:[],createdAt:new Date};this.messages=[...this.messages,i],this.createMessageState(t,r),this.activeMessageIds.add(t),this.events.onStreamStart?.(),this.emitMessagesChange()}handleTextMessageEndEvent(e){let{messageId:t}=e,n=this.getMessageState(t);n&&(n.isComplete||(n.currentSegmentText!==n.lastEmittedText&&this.emitTextUpdateForMessage(t),this.completeAllToolCallsForMessage(t)))}handleMessagesSnapshotEvent(e){this.resetStreamState(),this.messages=[...e.messages],this.emitMessagesChange()}handleTextMessageContentEvent(e){let{messageId:t,state:n}=this.ensureAssistantMessage(e.messageId);this.completeAllToolCallsForMessage(t);let r=n.currentSegmentText;n.hasToolCallsSinceTextStart&&r.length>0&&this.isNewTextSegment(e,r)&&(r!==n.lastEmittedText&&this.emitTextUpdateForMessage(t),n.currentSegmentText=``,n.lastEmittedText=``,n.hasToolCallsSinceTextStart=!1);let i=n.currentSegmentText,a=i,o=e.delta||``;o===``?e.content!==void 0&&e.content!==``&&(a=e.content.startsWith(i)?e.content:i.startsWith(e.content)?i:i+e.content):a=i+o;let s=a.slice(i.length);n.currentSegmentText=a,n.totalTextContent+=s;let c=e.delta||e.content||``;this.chunkStrategy.shouldEmit(c,n.currentSegmentText)&&n.currentSegmentText!==n.lastEmittedText&&this.emitTextUpdateForMessage(t)}handleToolCallStartEvent(e){let t=e.parentMessageId??this.getActiveAssistantMessageId(),{messageId:n,state:r}=this.ensureAssistantMessage(t??void 0);r.hasToolCallsSinceTextStart=!0;let i=e.toolCallId;if(!r.toolCalls.get(i)){let t=`awaiting-input`,a=e.toolCallName,o={id:e.toolCallId,name:a,arguments:``,state:t,parsedArguments:void 0,index:e.index??r.toolCalls.size};r.toolCalls.set(i,o),r.toolCallOrder.push(i),this.toolCallToMessage.set(i,n),this.messages=_(this.messages,n,{id:e.toolCallId,name:a,arguments:``,state:t}),this.emitMessagesChange(),this.events.onToolCallStateChange?.(n,e.toolCallId,t,``)}}handleToolCallArgsEvent(e){let t=e.toolCallId,n=this.toolCallToMessage.get(t);if(!n)return;let r=this.getMessageState(n);if(!r)return;let i=r.toolCalls.get(t);if(!i)return;let a=i.state===`awaiting-input`;i.arguments+=e.delta||``,a&&e.delta&&(i.state=`input-streaming`),i.parsedArguments=this.jsonParser.parse(i.arguments),this.messages=_(this.messages,n,{id:i.id,name:i.name,arguments:i.arguments,state:i.state}),this.emitMessagesChange(),this.events.onToolCallStateChange?.(n,i.id,i.state,i.arguments)}handleToolCallEndEvent(e){let t=this.toolCallToMessage.get(e.toolCallId);if(!t)return;let n=this.getMessageState(t);if(!n)return;let r=n.toolCalls.get(e.toolCallId);if(r&&r.state!==`input-complete`){e.input!==void 0&&!r.arguments&&(r.arguments=JSON.stringify(e.input));let i=n.toolCallOrder.indexOf(e.toolCallId);this.completeToolCall(t,i,r),e.input!==void 0&&(r.parsedArguments=e.input)}if(e.result){let n;try{n=JSON.parse(e.result)}catch{n=e.result}this.messages=b(this.messages,e.toolCallId,n),this.messages=v(this.messages,t,e.toolCallId,e.result,`complete`),this.emitMessagesChange()}}handleToolCallResultEvent(e){let t=this.toolCallToMessage.get(e.toolCallId);if(!t)return;let n;try{n=JSON.parse(e.content)}catch{n=e.content}this.messages=b(this.messages,e.toolCallId,n),this.messages=v(this.messages,t,e.toolCallId,e.content,`complete`),this.emitMessagesChange()}handleRunStartedEvent(e){this.activeRuns.add(e.runId)}handleRunFinishedEvent(e){this.finishReason=e.finishReason??null,this.activeRuns.delete(e.runId),this.activeRuns.size===0&&(this.isDone=!0,this.completeAllToolCalls(),this.finalizeStream())}handleRunErrorEvent(e){this.hasError=!0;let t=e.runId;t?this.activeRuns.delete(t):this.activeRuns.clear(),this.ensureAssistantMessage();let n=e.message||e.error?.message||`An error occurred`;this.events.onError?.(Error(n))}handleStepFinishedEvent(e){let{messageId:t,state:n}=this.ensureAssistantMessage(this.getActiveAssistantMessageId()??void 0);if(n.hasSeenReasoningEvents)return;let r=n.thinkingContent,i=r;e.delta&&e.delta!==``?i=r+e.delta:e.content&&e.content!==``&&(i=e.content.startsWith(r)?e.content:r.startsWith(e.content)?r:r+e.content),n.thinkingContent=i,this.messages=S(this.messages,t,n.thinkingContent),this.emitMessagesChange(),this.events.onThinkingUpdate?.(t,n.thinkingContent)}handleReasoningMessageContentEvent(e){let{messageId:t,state:n}=this.ensureAssistantMessage(this.getActiveAssistantMessageId()??void 0);n.hasSeenReasoningEvents=!0;let r=e.delta||``;n.thinkingContent+=r,this.messages=S(this.messages,t,n.thinkingContent),this.emitMessagesChange(),this.events.onThinkingUpdate?.(t,n.thinkingContent)}handleCustomEvent(e){let t=this.getActiveAssistantMessageId();if(e.name===`tool-input-available`&&e.value){let{toolCallId:t,toolName:n,input:r}=e.value;this.events.onToolCall?.({toolCallId:t,toolName:n,input:r});return}if(e.name===`approval-requested`&&e.value){let{toolCallId:n,toolName:r,input:i,approval:a}=e.value,o=t??this.toolCallToMessage.get(n);o&&(this.messages=y(this.messages,o,n,a.id),this.emitMessagesChange()),this.events.onApprovalRequest?.({toolCallId:n,toolName:r,input:i,approvalId:a.id});return}if(this.events.onCustomEvent){let t=e.value&&typeof e.value==`object`?e.value.toolCallId:void 0;this.events.onCustomEvent(e.name,e.value,{toolCallId:t})}}isNewTextSegment(e,t){return e.content!==void 0&&(e.content.length<t.length||!e.content.startsWith(t)&&!t.startsWith(e.content))}completeAllToolCalls(){for(let e of this.activeMessageIds)this.completeAllToolCallsForMessage(e)}completeAllToolCallsForMessage(e){let t=this.getMessageState(e);t&&t.toolCalls.forEach((n,r)=>{if(n.state!==`input-complete`){let i=t.toolCallOrder.indexOf(r);this.completeToolCall(e,i,n)}})}completeToolCall(e,t,n){n.state=`input-complete`,n.parsedArguments=this.jsonParser.parse(n.arguments),this.messages=_(this.messages,e,{id:n.id,name:n.name,arguments:n.arguments,state:`input-complete`}),this.emitMessagesChange(),this.events.onToolCallStateChange?.(e,n.id,`input-complete`,n.arguments)}emitTextUpdateForMessage(e){let t=this.getMessageState(e);t&&(t.lastEmittedText=t.currentSegmentText,this.messages=g(this.messages,e,t.currentSegmentText),this.emitMessagesChange(),this.events.onTextUpdate?.(e,t.currentSegmentText))}emitMessagesChange(){this.events.onMessagesChange?.([...this.messages])}finalizeStream(){let e;for(let t of this.activeMessageIds){let n=this.getMessageState(t);if(!n)continue;this.completeAllToolCallsForMessage(t),n.currentSegmentText!==n.lastEmittedText&&this.emitTextUpdateForMessage(t),n.isComplete=!0;let r=this.messages.find(e=>e.id===t);r&&r.role===`assistant`&&(e=r)}if(this.activeMessageIds.clear(),e&&!this.hasError&&this.isWhitespaceOnlyMessage(e)){this.messages=this.messages.filter(t=>t.id!==e.id),this.emitMessagesChange();return}e&&this.events.onStreamEnd?.(e)}getCompletedToolCalls(){let e=[];for(let t of this.messageStates.values())for(let n of t.toolCalls.values())n.state===`input-complete`&&e.push({id:n.id,type:`function`,function:{name:n.name,arguments:n.arguments}});return e}getResult(){let e=this.getCompletedToolCalls(),t=``,n=``;for(let e of this.messageStates.values())t+=e.totalTextContent,n+=e.thinkingContent;return{content:t,thinking:n||void 0,toolCalls:e.length>0?e:void 0,finishReason:this.finishReason}}getState(){let e=``,t=``,n=new Map,r=[];for(let i of this.messageStates.values()){e+=i.totalTextContent,t+=i.thinkingContent;for(let[e,t]of i.toolCalls)n.set(e,t);r.push(...i.toolCallOrder)}return{content:e,thinking:t,toolCalls:n,toolCallOrder:r,finishReason:this.finishReason,done:this.isDone}}startRecording(){this.recordingEnabled=!0,this.recordingStartTime=Date.now(),this.recording={version:`1.0`,timestamp:this.recordingStartTime,chunks:[]}}getRecording(){return this.recording}resetStreamState(){this.messageStates.clear(),this.activeMessageIds.clear(),this.activeRuns.clear(),this.toolCallToMessage.clear(),this.pendingManualMessageId=null,this.finishReason=null,this.hasError=!1,this.isDone=!1,this.chunkStrategy.reset?.()}reset(){this.resetStreamState(),this.messages=[]}isWhitespaceOnlyMessage(e){return e.parts.length===0?!1:e.parts.every(e=>e.type===`text`&&e.content.trim()===``)}static async replay(t,n){return new e(n).process(T(t))}};function T(e){return{async*[Symbol.asyncIterator](){for(let{chunk:t}of e.chunks)yield t}}}export{u as i,f as n,d as r,w as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=`__TSR_index`,t=`popstate`,n=`beforeunload`;function r(t){let n=t.getLocation(),r=new Set,a=e=>{n=t.getLocation(),r.forEach(t=>t({location:n,action:e}))},o=e=>{t.notifyOnIndexChange??!0?a(e):n=t.getLocation()},s=async({task:e,navigateOpts:r,...i})=>{var a;if(r?.ignoreBlocker??!1){e();return}let o=t.getBlockers?.call(t)??[],s=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&o.length&&s)for(let e of o){let r=c(i.path,i.state);if(await e.blockerFn({currentLocation:n,nextLocation:r,action:i.type})){(a=t.onBlocked)==null||a.call(t);return}}e()};return{get location(){return n},get length(){return t.getLength()},subscribers:r,subscribe:e=>(r.add(e),()=>{r.delete(e)}),push:(r,o,c)=>{let l=n.state[e];o=i(l+1,o),s({task:()=>{t.pushState(r,o),a({type:`PUSH`})},navigateOpts:c,type:`PUSH`,path:r,state:o})},replace:(r,o,c)=>{let l=n.state[e];o=i(l,o),s({task:()=>{t.replaceState(r,o),a({type:`REPLACE`})},navigateOpts:c,type:`REPLACE`,path:r,state:o})},go:(e,n)=>{s({task:()=>{t.go(e),o({type:`GO`,index:e})},navigateOpts:n,type:`GO`})},back:e=>{s({task:()=>{t.back(e?.ignoreBlocker??!1),o({type:`BACK`})},navigateOpts:e,type:`BACK`})},forward:e=>{s({task:()=>{t.forward(e?.ignoreBlocker??!1),o({type:`FORWARD`})},navigateOpts:e,type:`FORWARD`})},canGoBack:()=>n.state[e]!==0,createHref:e=>t.createHref(e),block:e=>{if(!t.setBlockers)return()=>{};let n=t.getBlockers?.call(t)??[];return t.setBlockers([...n,e]),()=>{var n;let r=t.getBlockers?.call(t)??[];(n=t.setBlockers)==null||n.call(t,r.filter(t=>t!==e))}},flush:()=>t.flush?.call(t),destroy:()=>t.destroy?.call(t),notify:a}}function i(t,n){return n||={},{...n,key:l(),[e]:t}}function a(i){let a=i?.window??(typeof document<`u`?window:void 0),o=a.history.pushState,s=a.history.replaceState,u=[],d=()=>u,f=e=>u=e,p=i?.createHref??(e=>e),m=i?.parseLocation??(()=>c(`${a.location.pathname}${a.location.search}${a.location.hash}`,a.history.state));a.history.state?.key||a.history.replaceState({[e]:0,key:l()},``);let h=m(),g,_=!1,v=!1,y=!1,b=!1,x=()=>h,S,C,w=()=>{S&&(k._ignoreSubscribers=!0,(S.isPush?a.history.pushState:a.history.replaceState)(S.state,``,S.href),k._ignoreSubscribers=!1,S=void 0,C=void 0,g=void 0)},T=(e,t,n)=>{let r=p(t);C||(g=h),h=c(t,n),S={href:r,state:n,isPush:S?.isPush||e===`push`},C||=Promise.resolve().then(()=>w())},E=e=>{h=m(),k.notify({type:e})},D=async()=>{if(v){v=!1;return}let t=m(),n=t.state[e]-h.state[e],r=n===1,i=n===-1,o=!r&&!i||_;_=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,c=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(y)y=!1;else{let e=d();if(typeof document<`u`&&e.length){for(let n of e)if(await n.blockerFn({currentLocation:h,nextLocation:t,action:s})){v=!0,a.history.go(1),k.notify(c);return}}}h=m(),k.notify(c)},O=e=>{if(b){b=!1;return}let t=!1,n=d();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},k=r({getLocation:x,getLength:()=>a.history.length,pushState:(e,t)=>T(`push`,e,t),replaceState:(e,t)=>T(`replace`,e,t),back:e=>(e&&(y=!0),b=!0,a.history.back()),forward:e=>{e&&(y=!0),b=!0,a.history.forward()},go:e=>{_=!0,a.history.go(e)},createHref:e=>p(e),flush:w,destroy:()=>{a.history.pushState=o,a.history.replaceState=s,a.removeEventListener(n,O,{capture:!0}),a.removeEventListener(t,D)},onBlocked:()=>{g&&h!==g&&(h=g)},getBlockers:d,setBlockers:f,notifyOnIndexChange:!1});return a.addEventListener(n,O,{capture:!0}),a.addEventListener(t,D),a.history.pushState=function(...e){let t=o.apply(a.history,e);return k._ignoreSubscribers||E(`PUSH`),t},a.history.replaceState=function(...e){let t=s.apply(a.history,e);return k._ignoreSubscribers||E(`REPLACE`),t},k}function o(e){let t=e?.window??(typeof document<`u`?window:void 0);return a({window:t,parseLocation:()=>{let e=t.location.hash.split(`#`).slice(1),n=e[0]??`/`,r=t.location.search,i=e.slice(1);return c(`${n}${r}${i.length===0?``:`#${i.join(`#`)}`}`,t.history.state)},createHref:e=>`${t.location.pathname}${t.location.search}#${e}`})}function s(e={initialEntries:[`/`]}){let t=e.initialEntries,n=e.initialIndex?Math.min(Math.max(e.initialIndex,0),t.length-1):t.length-1,a=t.map((e,t)=>i(t,void 0));return r({getLocation:()=>c(t[n],a[n]),getLength:()=>t.length,pushState:(e,r)=>{n<t.length-1&&(t.splice(n+1),a.splice(n+1)),a.push(r),t.push(e),n=Math.max(t.length-1,0)},replaceState:(e,r)=>{a[n]=r,t[n]=e},back:()=>{n=Math.max(n-1,0)},forward:()=>{n=Math.min(n+1,t.length-1)},go:e=>{n=Math.min(Math.max(n+e,0),t.length-1)},createHref:e=>e})}function c(t,n){let r=t.indexOf(`#`),i=t.indexOf(`?`);return{href:t,pathname:t.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:t.length),hash:r>-1?t.substring(r):``,search:i>-1?t.slice(i,r===-1?void 0:r):``,state:n||{[e]:0,key:l()}}}function l(){return(Math.random()+1).toString(36).substring(7)}export{c as i,o as n,s as r,a as t};
|