khoj 1.33.3.dev35__py3-none-any.whl → 1.33.3.dev51__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. khoj/configure.py +1 -1
  2. khoj/database/adapters/__init__.py +1 -1
  3. khoj/database/migrations/0080_speechtotextmodeloptions_ai_model_api.py +24 -0
  4. khoj/database/models/__init__.py +2 -0
  5. khoj/interface/compiled/404/index.html +1 -1
  6. khoj/interface/compiled/_next/static/chunks/0d8bff65.4b1018183a8be7c2.js +1 -0
  7. khoj/interface/compiled/_next/static/chunks/1243.ea2826fb35adb15a.js +1 -0
  8. khoj/interface/compiled/_next/static/chunks/133.392ae90c3b2a67f2.js +1 -0
  9. khoj/interface/compiled/_next/static/chunks/1592.b069bdb7aaddd2eb.js +5 -0
  10. khoj/interface/compiled/_next/static/chunks/2069.f060659791c0c484.js +1 -0
  11. khoj/interface/compiled/_next/static/chunks/2170.45431769330fa5b7.js +134 -0
  12. khoj/interface/compiled/_next/static/chunks/2327-17d5d7dc987c0645.js +1 -0
  13. khoj/interface/compiled/_next/static/chunks/3237.c4754f02f1a388cb.js +1 -0
  14. khoj/interface/compiled/_next/static/chunks/3305.1fc7297ba154ee95.js +1 -0
  15. khoj/interface/compiled/_next/static/chunks/3332.6313db5217bb1b67.js +29 -0
  16. khoj/interface/compiled/_next/static/chunks/3451.421db0b49fdbd881.js +252 -0
  17. khoj/interface/compiled/_next/static/chunks/3460.39c2b9b6a3898384.js +159 -0
  18. khoj/interface/compiled/_next/static/chunks/4270-28ab75d62e71521c.js +1 -0
  19. khoj/interface/compiled/_next/static/chunks/4299.2aaa569416cfc208.js +2 -0
  20. khoj/interface/compiled/_next/static/chunks/4327.238d15c09a039b8b.js +60 -0
  21. khoj/interface/compiled/_next/static/chunks/4415.e0c0da5eedae4dd7.js +47 -0
  22. khoj/interface/compiled/_next/static/chunks/4610.196691887afb7fea.js +1 -0
  23. khoj/interface/compiled/_next/static/chunks/4650.41f041da0ad365ad.js +215 -0
  24. khoj/interface/compiled/_next/static/chunks/4872.5422e8324272ab40.js +1 -0
  25. khoj/interface/compiled/_next/static/chunks/4986-24b37356a9642ebb.js +1 -0
  26. khoj/interface/compiled/_next/static/chunks/5061.79a660faed0e16a9.js +1 -0
  27. khoj/interface/compiled/_next/static/chunks/5279.85d537880b8041ae.js +24 -0
  28. khoj/interface/compiled/_next/static/chunks/5402.b9460f1b16b57e92.js +63 -0
  29. khoj/interface/compiled/_next/static/chunks/5555.f7cf9795d675de51.js +88 -0
  30. khoj/interface/compiled/_next/static/chunks/58.f4bd8a3c9d88f5fe.js +46 -0
  31. khoj/interface/compiled/_next/static/chunks/5978.ddc72cd73130aadc.js +1 -0
  32. khoj/interface/compiled/_next/static/chunks/6002-7e3115f142731625.js +78 -0
  33. khoj/interface/compiled/_next/static/chunks/6434.e6cd986d690f2cef.js +1 -0
  34. khoj/interface/compiled/_next/static/chunks/7140.4be689873f6a2d1f.js +116 -0
  35. khoj/interface/compiled/_next/static/chunks/7647-5a935022fa3da0a6.js +1 -0
  36. khoj/interface/compiled/_next/static/chunks/7836.86884157d53d23a1.js +117 -0
  37. khoj/interface/compiled/_next/static/chunks/7890.f681eb1d1f83bea2.js +1 -0
  38. khoj/interface/compiled/_next/static/chunks/7953.f6fc335a23efb959.js +1 -0
  39. khoj/interface/compiled/_next/static/chunks/8254.3145a4fbdcfdca46.js +1 -0
  40. khoj/interface/compiled/_next/static/chunks/8400.c95e4e79bcd79a56.js +78 -0
  41. khoj/interface/compiled/_next/static/chunks/8673.be44c4d9e4f1d084.js +56 -0
  42. khoj/interface/compiled/_next/static/chunks/8698.a088118fef40d302.js +1 -0
  43. khoj/interface/compiled/_next/static/chunks/9022.33974a513a281fd2.js +151 -0
  44. khoj/interface/compiled/_next/static/chunks/90542734.fecd4dc1a89ed166.js +1 -0
  45. khoj/interface/compiled/_next/static/chunks/9433.b1b5f5d050c43e3c.js +36 -0
  46. khoj/interface/compiled/_next/static/chunks/9822.34f293973c4e9b04.js +1 -0
  47. khoj/interface/compiled/_next/static/chunks/app/agents/layout-e00fb81dca656a10.js +1 -0
  48. khoj/interface/compiled/_next/static/chunks/app/agents/{page-f6b7a9ce4a8b2bf7.js → page-05e8780174a478e6.js} +1 -1
  49. khoj/interface/compiled/_next/static/chunks/app/automations/{page-f3c16eb399159215.js → page-a951c331320b870a.js} +1 -1
  50. khoj/interface/compiled/_next/static/chunks/app/chat/layout-33934fc2d6ae6838.js +1 -0
  51. khoj/interface/compiled/_next/static/chunks/app/chat/{page-2917c081fd43ac17.js → page-f68d20917788cbbc.js} +1 -1
  52. khoj/interface/compiled/_next/static/chunks/app/{page-07395c7f0d25d7d4.js → page-0c6346ba12c1b885.js} +1 -1
  53. khoj/interface/compiled/_next/static/chunks/app/search/layout-f5881c7ae3ba0795.js +1 -0
  54. khoj/interface/compiled/_next/static/chunks/app/search/{page-2a09ae0883b04242.js → page-62be289d4136a73a.js} +1 -1
  55. khoj/interface/compiled/_next/static/chunks/app/settings/{page-827fe7bea045fefe.js → page-c244a441045a593e.js} +1 -1
  56. khoj/interface/compiled/_next/static/chunks/app/share/chat/layout-abb6c5f4239ad7be.js +1 -0
  57. khoj/interface/compiled/_next/static/chunks/app/share/chat/{page-ce8299b35835ed71.js → page-075278404a3f37b8.js} +1 -1
  58. khoj/interface/compiled/_next/static/chunks/ebbfb5c1-a73c51b6a41a5ff6.js +10 -0
  59. khoj/interface/compiled/_next/static/chunks/webpack-63793f58b6bd33ee.js +1 -0
  60. khoj/interface/compiled/_next/static/css/37a73b87f02df402.css +1 -0
  61. khoj/interface/compiled/_next/static/css/70b2e9482d96d4c2.css +25 -0
  62. khoj/interface/compiled/_next/static/css/9c164d9727dd8092.css +1 -0
  63. khoj/interface/compiled/_next/static/css/a85b8d56fc9ae551.css +1 -0
  64. khoj/interface/compiled/_next/static/css/df4b47a2d0d85eae.css +1 -0
  65. khoj/interface/compiled/agents/index.html +1 -1
  66. khoj/interface/compiled/agents/index.txt +2 -2
  67. khoj/interface/compiled/automations/index.html +1 -1
  68. khoj/interface/compiled/automations/index.txt +2 -2
  69. khoj/interface/compiled/chat/index.html +1 -1
  70. khoj/interface/compiled/chat/index.txt +2 -2
  71. khoj/interface/compiled/index.html +1 -1
  72. khoj/interface/compiled/index.txt +2 -2
  73. khoj/interface/compiled/search/index.html +1 -1
  74. khoj/interface/compiled/search/index.txt +2 -2
  75. khoj/interface/compiled/settings/index.html +1 -1
  76. khoj/interface/compiled/settings/index.txt +2 -2
  77. khoj/interface/compiled/share/chat/index.html +1 -1
  78. khoj/interface/compiled/share/chat/index.txt +2 -2
  79. khoj/processor/conversation/prompts.py +118 -1
  80. khoj/processor/conversation/utils.py +9 -4
  81. khoj/processor/image/generate.py +9 -7
  82. khoj/routers/api.py +13 -3
  83. khoj/routers/api_chat.py +9 -9
  84. khoj/routers/helpers.py +135 -7
  85. khoj/utils/initialization.py +6 -6
  86. {khoj-1.33.3.dev35.dist-info → khoj-1.33.3.dev51.dist-info}/METADATA +1 -1
  87. {khoj-1.33.3.dev35.dist-info → khoj-1.33.3.dev51.dist-info}/RECORD +92 -55
  88. khoj/interface/compiled/_next/static/chunks/1010-8f39bb4648b5ba10.js +0 -1
  89. khoj/interface/compiled/_next/static/chunks/2581-455000f8aeb08fc3.js +0 -1
  90. khoj/interface/compiled/_next/static/chunks/3789-a09e37a819171a9d.js +0 -1
  91. khoj/interface/compiled/_next/static/chunks/4124-6c28322ce218d2d5.js +0 -1
  92. khoj/interface/compiled/_next/static/chunks/6293-469dd16402ea8a6f.js +0 -3
  93. khoj/interface/compiled/_next/static/chunks/app/agents/layout-e3d72f0edda6aa0c.js +0 -1
  94. khoj/interface/compiled/_next/static/chunks/app/chat/layout-d5ae861e1ade9d08.js +0 -1
  95. khoj/interface/compiled/_next/static/chunks/app/search/layout-4505b79deb734a30.js +0 -1
  96. khoj/interface/compiled/_next/static/chunks/app/share/chat/layout-95998f0bdc22bb13.js +0 -1
  97. khoj/interface/compiled/_next/static/chunks/webpack-fddb78e7c09fff16.js +0 -1
  98. khoj/interface/compiled/_next/static/css/0f0e5dbeda138161.css +0 -1
  99. khoj/interface/compiled/_next/static/css/3b65ca1e74e399bd.css +0 -1
  100. khoj/interface/compiled/_next/static/css/41d6fe14d2c6b14d.css +0 -1
  101. khoj/interface/compiled/_next/static/css/8d02837c730f8d13.css +0 -25
  102. khoj/interface/compiled/_next/static/css/ba1602594aa7828f.css +0 -1
  103. khoj/interface/compiled/_next/static/css/dac88c17aaee5fcf.css +0 -1
  104. /khoj/interface/compiled/_next/static/{oqqUYx3DaH2vt9Te5vFEg → s3dazBmeqIlcdf6ERGzFs}/_buildManifest.js +0 -0
  105. /khoj/interface/compiled/_next/static/{oqqUYx3DaH2vt9Te5vFEg → s3dazBmeqIlcdf6ERGzFs}/_ssgManifest.js +0 -0
  106. {khoj-1.33.3.dev35.dist-info → khoj-1.33.3.dev51.dist-info}/WHEEL +0 -0
  107. {khoj-1.33.3.dev35.dist-info → khoj-1.33.3.dev51.dist-info}/entry_points.txt +0 -0
  108. {khoj-1.33.3.dev35.dist-info → khoj-1.33.3.dev51.dist-info}/licenses/LICENSE +0 -0
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6938],{62960:function(e,t,s){Promise.resolve().then(s.bind(s,31537))},31537:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return em}});var a,n,r=s(57437),i=s(917),l=s.n(i);s(97510);var o=s(2265),c=s(77992),d=s(56937),h=s(7436),m=s(67341),u=s(62869),x=s(26371),p=s(95186),f=s(66070),j=s(84190),g=s(94508);let b=o.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("div",{className:"relative w-full overflow-auto",children:(0,r.jsx)("table",{ref:t,className:(0,g.cn)("w-full caption-bottom text-sm",s),...a})})});b.displayName="Table",o.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("thead",{ref:t,className:(0,g.cn)("[&_tr]:border-b",s),...a})}).displayName="TableHeader";let w=o.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("tbody",{ref:t,className:(0,g.cn)("[&_tr:last-child]:border-0",s),...a})});w.displayName="TableBody",o.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("tfoot",{ref:t,className:(0,g.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",s),...a})}).displayName="TableFooter";let N=o.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("tr",{ref:t,className:(0,g.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",s),...a})});N.displayName="TableRow",o.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("th",{ref:t,className:(0,g.cn)("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",s),...a})}).displayName="TableHead";let y=o.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("td",{ref:t,className:(0,g.cn)("p-4 align-middle [&:has([role=checkbox])]:pr-0",s),...a})});y.displayName="TableCell",o.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("caption",{ref:t,className:(0,g.cn)("mt-4 text-sm text-muted-foreground",s),...a})}).displayName="TableCaption";var v=s(23518),_=s(87296),k=s(89203),S=s(57466),C=s(38513),T=s(19841),D=s(3894),E=s(81228),F=s(94018),P=s(13272),O=s(88435),A=s(37295),I=s(2049),z=s(50525),Y=s(5147),R=s(80438),K=s(29975),Z=s(47615),W=s(47020),M=s(22345),U=s(75216),L=s(90483),B=s(73925),V=s(54271),H=s(95656),G=s(58717),J=s(56777),$=s(97525),q=s(45178),X=s(14308),Q=s(34688),ee=s(59199),et=s(37099),es=s(32759),ea=s(27648),en=s(85872),er=s(34124),ei=s(6512),el=s(37104);let eo=e=>{let{onClose:t}=e,[s,a]=(0,o.useState)([]),[n,i]=(0,o.useState)([]),[l,c]=(0,o.useState)(""),[d,h]=(0,o.useState)(!1),[m,x]=(0,o.useState)(null),[p,f]=(0,o.useState)(null),[j,g]=(0,o.useState)(!1),[b,w]=(0,o.useState)(0),[N,y]=(0,o.useState)([]),D=(0,o.useRef)(null);(0,o.useEffect)(()=>{if(j||w(0),j){let e=setInterval(()=>{w(e=>{let t=e+(Math.floor(5*Math.random())+1);return t<100?t:100})},800);return()=>clearInterval(e)}},[j]),(0,o.useEffect)(()=>{(async()=>{try{let e=await fetch("/api/content/computer");if(!e.ok)throw Error("Failed to fetch files");let t=await e.json();Array.isArray(t)?a(t.toSorted()):console.error("Unexpected data format from API")}catch(e){console.error("Error fetching files:",e)}})()},[N]);let E=s.filter(e=>e.toLowerCase().includes(l.toLowerCase())),F=async()=>{let e=n.length>0?n:E;if(0!==e.length)try{if(!(await fetch("/api/content/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:e})})).ok)throw Error("Failed to delete files");a(t=>t.filter(t=>!e.includes(t))),i([])}catch(e){console.error("Error deleting files:",e)}},P=async e=>{try{if(!(await fetch("/api/content/file?filename=".concat(encodeURIComponent(e)),{method:"DELETE",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to delete file");a(t=>t.filter(t=>t!==e)),i(t=>t.filter(t=>t!==e))}catch(e){console.error("Error deleting file:",e)}};function O(e){(0,ee.ko)(e,x,g,f,y)}return(0,r.jsxs)(v.m5,{open:!0,onOpenChange:t,children:[(0,r.jsx)(et.aR,{open:null!==m||null!=p,children:(0,r.jsxs)(et._T,{children:[(0,r.jsx)(et.fY,{children:(0,r.jsx)(et.f$,{children:"Alert"})}),(0,r.jsx)(et.yT,{children:m||p}),(0,r.jsx)(et.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>{x(null),f(null),g(!1)},children:"Close"})]})}),(0,r.jsxs)("div",{className:"flex flex-col h-full",onDragOver:function(e){e.preventDefault(),h(!0)},onDragLeave:function(e){e.preventDefault(),h(!1)},onDrop:function(e){e.preventDefault(),h(!1),e.dataTransfer.files&&O(e.dataTransfer.files)},onClick:function(){D&&D.current&&D.current.click()},children:[(0,r.jsx)("input",{type:"file",multiple:!0,ref:D,style:{display:"none"},onChange:function(e){e.target.files&&O(e.target.files)}}),(0,r.jsxs)("div",{className:"flex-none p-4",children:["Upload files",j&&(0,r.jsx)(es.E,{indicatorColor:"bg-slate-500",className:"w-full h-2 rounded-full",value:b})]}),(0,r.jsx)("div",{className:"flex-none p-4 bg-secondary border-b ".concat(d?"animate-pulse":""," rounded-lg"),children:(0,r.jsx)("div",{className:"flex items-center justify-center w-full h-32 border-2 border-dashed border-gray-300 rounded-lg",children:d?(0,r.jsxs)("div",{className:"flex items-center justify-center w-full h-full",children:[(0,r.jsx)(_.u,{className:"h-6 w-6 mr-2"}),(0,r.jsx)("span",{children:"Drop files to upload"})]}):(0,r.jsxs)("div",{className:"flex items-center justify-center w-full h-full",children:[(0,r.jsx)(k.v,{className:"h-6 w-6 mr-2"}),(0,r.jsx)("span",{children:"Drag and drop files here"})]})})})]}),(0,r.jsxs)("div",{className:"flex flex-col h-full",children:[(0,r.jsx)("div",{className:"flex-none p-4 bg-background border-b",children:(0,r.jsx)(v.sZ,{placeholder:"Find synced files",value:l,onValueChange:c})}),(0,r.jsx)("div",{className:"flex-grow overflow-auto",children:(0,r.jsxs)(v.e8,{children:[(0,r.jsx)(v.rb,{children:0===s.length?(0,r.jsxs)("div",{className:"flex items-center justify-center",children:[(0,r.jsx)(S.C,{className:"h-4 w-4 mr-2",weight:"bold"}),"No files synced"]}):(0,r.jsxs)("div",{children:["Could not find a good match.",(0,r.jsx)(ea.default,{href:"/search",className:"block",children:"Need advanced search? Click here."})]})}),(0,r.jsx)(v.fu,{heading:"Synced files",children:E.map(e=>(0,r.jsx)(v.di,{value:e,onSelect:e=>{i(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},children:(0,r.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,r.jsxs)("div",{className:"flex items-center ".concat(n.includes(e)?"font-semibold":""),children:[n.includes(e)&&(0,r.jsx)(C.J,{className:"h-4 w-4 mr-2"}),(0,r.jsx)("span",{className:"break-all",children:e})]}),(0,r.jsx)(u.z,{variant:"outline",size:"sm",onClick:()=>P(e),className:"ml-auto",children:(0,r.jsx)(T.r,{className:"h-4 w-4"})})]})},e))})]})}),(0,r.jsx)("div",{className:"flex-none p-4 bg-background border-t",children:(0,r.jsx)("div",{className:"flex justify-between",children:(0,r.jsxs)(u.z,{variant:"outline",size:"sm",onClick:F,className:"mr-2",children:[(0,r.jsx)(T.r,{className:"h-4 w-4 mr-2"}),n.length>0?"Delete Selected (".concat(n.length,")"):"Delete All"]})})})]})]})},ec=e=>{var t,s;let{items:a,selected:n,callbackFunc:i}=e,[l,c]=(0,o.useState)(null!==(s=null==n?void 0:n.toString())&&void 0!==s?s:"0");return!!n&&(0,r.jsx)("div",{className:"overflow-hidden shadow-md rounded-lg",children:(0,r.jsxs)(j.h_,{children:[(0,r.jsx)(j.$F,{asChild:!0,className:"w-full rounded-lg",children:(0,r.jsxs)(u.z,{variant:"outline",className:"justify-start py-6 rounded-lg",children:[null===(t=a.find(e=>e.id.toString()===l))||void 0===t?void 0:t.name," ",(0,r.jsx)(D.p,{className:"h-4 w-4 ml-auto text-muted-foreground"})]})}),(0,r.jsx)(j.AW,{style:{maxHeight:"200px",overflowY:"auto",minWidth:"var(--radix-dropdown-menu-trigger-width)"},children:(0,r.jsx)(j._x,{value:l,onValueChange:async e=>{c(e),await i(e)},children:a.map(e=>(0,r.jsx)(j.qB,{value:e.id.toString(),children:e.name},e.id.toString()))})})]})})},ed=()=>{let[e,t]=(0,o.useState)([]),{toast:s}=(0,c.pm)(),a=async()=>{try{let e=await fetch("/auth/token",{method:"POST",headers:{"Content-Type":"application/json"}}),s=await e.json();t(e=>[...e,s])}catch(e){console.error("Error generating API key:",e)}},n=async e=>{try{await navigator.clipboard.writeText(e),s({title:"\uD83D\uDD11 API Key",description:"Copied to clipboard"})}catch(e){console.error("Error copying API key:",e)}},r=async e=>{try{(await fetch("/auth/token?token=".concat(e),{method:"DELETE"})).ok&&t(t=>t.filter(t=>t.token!==e))}catch(e){console.error("Error deleting API key:",e)}},i=async()=>{try{let e=await fetch("/auth/token"),s=await e.json();(null==s?void 0:s.length)>0&&t(s)}catch(e){console.error("Error listing API keys:",e)}};return(0,o.useEffect)(()=>{i()},[]),{apiKeys:e,generateAPIKey:a,copyAPIKey:n,deleteAPIKey:r}};function eh(){let{apiKeys:e,generateAPIKey:t,copyAPIKey:s,deleteAPIKey:a}=ed(),[n,i]=(0,o.useState)(new Set),{toast:l}=(0,c.pm)();return(0,r.jsxs)(f.Zb,{className:"grid grid-flow-column border border-gray-300 shadow-md rounded-lg dark:bg-muted dark:border-none border-opacity-50 lg:w-2/3",children:[(0,r.jsxs)(f.Ol,{className:"text-xl grid grid-flow-col grid-cols-[1fr_auto] pb-0",children:[(0,r.jsxs)("span",{className:"flex flex-wrap",children:[(0,r.jsx)(E.s,{className:"h-7 w-7 mr-2"}),"API Keys"]}),(0,r.jsxs)(u.z,{variant:"secondary",className:"!mt-0",onClick:t,children:[(0,r.jsx)(k.v,{weight:"bold",className:"h-5 w-5 mr-2"}),"Generate Key"]})]}),(0,r.jsxs)(f.aY,{className:"overflow-hidden grid gap-6",children:[(0,r.jsxs)("p",{className:"text-md text-gray-400",children:["Access Khoj from the"," ",(0,r.jsx)("a",{href:"https://docs.khoj.dev/clients/desktop",target:"_blank",children:"Desktop"}),", ",(0,r.jsx)("a",{href:"https://docs.khoj.dev/clients/obsidian",children:"Obsidian"}),","," ",(0,r.jsx)("a",{href:"https://docs.khoj.dev/clients/emacs",children:"Emacs"})," apps and more."]}),(0,r.jsx)(b,{children:(0,r.jsx)(w,{children:e.map(e=>(0,r.jsxs)(N,{children:[(0,r.jsx)(y,{className:"pl-0 py-3",children:e.name}),(0,r.jsxs)(y,{className:"grid grid-flow-col grid-cols-[1fr_auto] bg-secondary dark:bg-background rounded-xl p-3 m-1",children:[(0,r.jsx)("span",{className:"font-mono text-left w-[50px] md:w-[400px]",children:n.has(e.token)?e.token:"".concat(e.token.slice(0,6),"...").concat(e.token.slice(-4))}),(0,r.jsxs)("div",{className:"grid grid-flow-col",children:[n.has(e.token)?(0,r.jsx)(F.N,{weight:"bold",className:"h-4 w-4 mr-2 hover:bg-primary/40",onClick:()=>i(t=>{let s=new Set(t);return s.delete(e.token),s})}):(0,r.jsx)(P.b,{weight:"bold",className:"h-4 w-4 mr-2 hover:bg-primary/40",onClick:()=>i(new Set([...n,e.token]))}),(0,r.jsx)(O.C,{weight:"bold",className:"h-4 w-4 mr-2 hover:bg-primary/40",onClick:()=>{l({title:"\uD83D\uDD11 Copied API Key: ".concat(e.name),description:"Set this API key in the Khoj apps you want to connect to this Khoj account"}),s(e.token)}}),(0,r.jsx)(T.r,{weight:"bold",className:"h-4 w-4 mr-2 md:ml-4 text-red-400 hover:bg-primary/40",onClick:()=>{l({title:"\uD83D\uDD11 Deleted API Key: ".concat(e.name),description:"Apps using this API key will no longer connect to this Khoj account"}),a(e.token)}})]})]})]},e.token))})})]}),(0,r.jsx)(f.eW,{className:"flex flex-wrap gap-4"})]})}function em(){let{userConfig:e}=(0,d.h2)(!0),[t,s]=(0,o.useState)(null),[a,n]=(0,o.useState)(void 0),[i,j]=(0,o.useState)(null),[g,b]=(0,o.useState)(void 0),[w,N]=(0,o.useState)(""),[y,v]=(0,o.useState)("verified"),[k,C]=(0,o.useState)(!1),{toast:T}=(0,c.pm)(),D=(0,h.IC)(),E="w-full lg:w-5/12 grid grid-flow-column border border-gray-300 shadow-md rounded-lg border dark:border-none border-opacity-50 dark:bg-muted";(0,o.useEffect)(()=>{var t;s(e),b(null==e?void 0:e.phone_number),v((null==e?void 0:e.is_phone_number_verified)?"verified":(null==e?void 0:e.phone_number)?"otp":"setup"),n(null==e?void 0:e.given_name),j(null!==(t=null==e?void 0:e.notion_token)&&void 0!==t?t:null)},[e]);let F=async()=>{try{if(!(await fetch("/api/phone?phone_number=".concat(g),{method:"POST",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to send OTP");v("verify")}catch(e){console.error("Error sending OTP:",e),T({title:"\uD83D\uDCF1 Phone",description:"Failed to send OTP. Try again or contact us at team@khoj.dev"})}},P=async()=>{try{if(!(await fetch("/api/phone/verify?code=".concat(w),{method:"POST",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to verify OTP");v("verified"),T({title:"\uD83D\uDCF1 Phone",description:"Phone number verified"})}catch(e){console.error("Error verifying OTP:",e),T({title:"\uD83D\uDCF1 Phone",description:"Failed to verify OTP. Try again or contact us at team@khoj.dev"})}},O=async()=>{try{if(!(await fetch("/api/phone",{method:"DELETE",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to disconnect phone number");b(void 0),v("setup"),T({title:"\uD83D\uDCF1 Phone",description:"Phone number disconnected"})}catch(e){console.error("Error disconnecting phone number:",e),T({title:"\uD83D\uDCF1 Phone",description:"Failed to disconnect phone number. Try again or contact us at team@khoj.dev"})}},ee=async e=>{try{if(!(await fetch("/api/subscription?operation=".concat(e),{method:"PATCH",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to change subscription");t&&(t.subscription_state="cancel"===e?d.o9.UNSUBSCRIBED:d.o9.SUBSCRIBED,s(t)),T({title:"\uD83D\uDCB3 Subscription",description:(null==t?void 0:t.subscription_state)==="unsubscribed"?"Your subscription was cancelled":"Your Futurist subscription has been renewed"})}catch(t){console.error("Error changing subscription:",t),T({title:"\uD83D\uDCB3 Subscription",description:"cancel"===e?"Failed to cancel subscription. Try again or contact us at team@khoj.dev":"Failed to renew subscription. Try again or contact us at team@khoj.dev"})}},et=async()=>{try{let e=await fetch("/api/subscription/trial",{method:"POST"});if(!e.ok)throw Error("Failed to enable free trial");if((await e.json()).trial_enabled&&t){t.subscription_state=d.o9.TRIAL;let e=new Date(Date.now()+864e5*t.length_of_free_trial);t.subscription_renewal_date=(e=>{let t=new Date(e);return new Intl.DateTimeFormat("en-US",{day:"2-digit",month:"short",year:"numeric"}).format(t)})(e),t.subscription_enabled_trial_at=new Date().toISOString(),s(t),T({title:"\uD83C\uDF89 Trial Enabled",description:"Your free trial will end on ".concat(t.subscription_renewal_date)})}}catch(e){console.error("Error enabling free trial:",e),T({title:"⚠️ Failed to Enable Free Trial",description:"Failed to enable free trial. Try again or contact us at team@khoj.dev"})}},es=async()=>{if(a)try{if(!(await fetch("/api/user/name?name=".concat(a),{method:"PATCH",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to update name");t&&(t.given_name=a,s(t)),T({title:"✅ Updated Profile",description:"You name has been updated to ".concat(a)})}catch(e){console.error("Error updating name:",e),T({title:"⚠️ Failed to Update Profile",description:"Failed to update name. Try again or contact team@khoj.dev"})}},ea=e=>async s=>{if(!(null==t?void 0:t.is_active)){T({title:"Model Update",description:"You need to be subscribed to update ".concat(e," models"),variant:"destructive"});return}try{if(!(await fetch("/api/model/".concat(e,"?id=")+s,{method:"POST",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to update model");T({title:"✅ Updated ".concat((0,h.LF)(e)," Model")})}catch(t){console.error("Failed to update ".concat(e," model:"),t),T({description:"❌ Failed to update ".concat((0,h.LF)(e)," model. Try again."),variant:"destructive"})}},ed=async()=>{if(i)try{if(!(await fetch("/api/content/notion",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:i})})).ok)throw Error("Failed to save Notion API key");t&&(t.notion_token=i,s(t)),T({title:"✅ Saved Notion Settings",description:"You Notion API key has been saved."})}catch(e){console.error("Error updating name:",e),T({title:"⚠️ Failed to Save Notion Settings",description:"Failed to save Notion API key. Try again or contact team@khoj.dev"})}},em=async e=>{try{if(!(await fetch("/api/content?t=".concat(e),{method:"PATCH",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to sync content from ".concat(e));T({title:"\uD83D\uDD04 Syncing ".concat(e),description:"Your ".concat(e," content is being synced.")})}catch(t){console.error("Error syncing content:",t),T({title:"⚠️ Failed to Sync ".concat(e),description:"Failed to sync ".concat(e," content. Try again or contact team@khoj.dev")})}},eu=async e=>{try{if(!(await fetch("/api/content/".concat(e),{method:"DELETE",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to disconnect ".concat(e));t&&("computer"===e?t.enabled_content_source.computer=!1:"notion"===e?(t.enabled_content_source.notion=!1,t.notion_token=null,j(t.notion_token)):"github"===e&&(t.enabled_content_source.github=!1),s(t)),"computer"===e?T({title:"✅ Deleted Synced Files",description:"Your synced documents have been deleted."}):T({title:"✅ Disconnected ".concat(e),description:"Your ".concat(e," integration to Khoj has been disconnected.")})}catch(t){console.error("Error disconnecting ".concat(e,":"),t),T({title:"⚠️ Failed to Disconnect ".concat(e),description:"Failed to disconnect from ".concat(e,". Try again or contact team@khoj.dev")})}};return t?(0,r.jsxs)(en.Hn,{children:[(0,r.jsx)(er.S,{conversationId:""}),(0,r.jsxs)(en.kV,{children:[(0,r.jsxs)("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[(0,r.jsx)(en.vP,{className:"-ml-1"}),(0,r.jsx)(ei.Z,{orientation:"vertical",className:"mr-2 h-4"}),D?(0,r.jsx)("a",{className:"p-0 no-underline",href:"/",children:(0,r.jsx)(el.VO,{className:"h-auto w-16"})}):(0,r.jsx)("h2",{className:"text-lg",children:"Settings"})]}),(0,r.jsxs)("div",{className:l().page,children:[(0,r.jsx)("title",{children:"Settings"}),(0,r.jsx)("div",{className:l().content,children:(0,r.jsx)("div",{className:"".concat(l().contentBody," mx-10 my-2"),children:(0,r.jsx)(o.Suspense,{fallback:(0,r.jsx)(X.Z,{}),children:(0,r.jsxs)("div",{id:"content",className:"grid grid-flow-column sm:grid-flow-row gap-16 m-8",children:[(0,r.jsxs)("div",{className:"section grid gap-8",children:[(0,r.jsx)("div",{className:"text-2xl",children:"Profile"}),(0,r.jsxs)("div",{className:"cards flex flex-wrap gap-16",children:[(0,r.jsxs)(f.Zb,{className:E,children:[(0,r.jsxs)(f.Ol,{className:"text-xl flex flex-row",children:[(0,r.jsx)(A.Y,{className:"h-7 w-7 mr-2"}),"Name"]}),(0,r.jsxs)(f.aY,{className:"overflow-hidden",children:[(0,r.jsx)("p",{className:"pb-4 text-gray-400",children:"What should Khoj refer to you as?"}),(0,r.jsx)(p.I,{type:"text",onChange:e=>n(e.target.value),value:a,className:"w-full border border-gray-300 rounded-lg p-4 py-6"})]}),(0,r.jsx)(f.eW,{className:"flex flex-wrap gap-4",children:(0,r.jsxs)(u.z,{variant:"outline",size:"sm",onClick:es,disabled:a===t.given_name,children:[(0,r.jsx)(I.B,{className:"h-5 w-5 inline mr-2"}),"Save"]})})]}),(0,r.jsxs)(f.Zb,{id:"subscription",className:E,children:[(0,r.jsxs)(f.Ol,{className:"text-xl flex flex-row",children:[(0,r.jsx)(z.a,{className:"h-7 w-7 mr-2"}),"Subscription"]}),(0,r.jsxs)(f.aY,{className:"grid gap-2 overflow-hidden",children:[(0,r.jsx)("p",{className:"text-gray-400",children:"Current Plan"}),"trial"===t.subscription_state&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"text-xl text-primary/80",children:"Futurist (Trial)"}),(0,r.jsxs)("p",{className:"text-gray-400",children:["You are on a"," ",t.length_of_free_trial," ","day trial of the Khoj Futurist plan. Your trial ends on"," ",t.subscription_renewal_date,". Check"," ",(0,r.jsx)("a",{href:"https://khoj.dev/#pricing",target:"_blank",children:"pricing page"})," ","to compare plans."]})]})||"subscribed"===t.subscription_state&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"text-xl text-primary/80",children:"Futurist"}),(0,r.jsxs)("p",{className:"text-gray-400",children:["Subscription ",(0,r.jsx)("b",{children:"renews"})," on"," ",(0,r.jsx)("b",{children:t.subscription_renewal_date})]})]})||"unsubscribed"===t.subscription_state&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"text-xl",children:"Futurist"}),(0,r.jsxs)("p",{className:"text-gray-400",children:["Subscription ",(0,r.jsx)("b",{children:"ends"})," on"," ",(0,r.jsx)("b",{children:t.subscription_renewal_date})]})]})||"expired"===t.subscription_state&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"text-xl",children:"Humanist"}),t.subscription_renewal_date&&(0,r.jsxs)("p",{className:"text-gray-400",children:["Subscription ",(0,r.jsx)("b",{children:"expired"})," ","on"," ",(0,r.jsx)("b",{children:t.subscription_renewal_date})]})||(0,r.jsxs)("p",{className:"text-gray-400",children:["Check"," ",(0,r.jsx)("a",{href:"https://khoj.dev/#pricing",target:"_blank",children:"pricing page"})," ","to compare plans."]})]})]}),(0,r.jsx)(f.eW,{className:"flex flex-wrap gap-4",children:"subscribed"==t.subscription_state&&(0,r.jsxs)(u.z,{variant:"outline",className:"hover:text-red-400",onClick:()=>ee("cancel"),children:[(0,r.jsx)(Y.b,{className:"h-5 w-5 mr-2"}),"Unsubscribe"]})||"unsubscribed"==t.subscription_state&&(0,r.jsxs)(u.z,{variant:"outline",className:"text-primary/80 hover:text-primary",onClick:()=>ee("resubscribe"),children:[(0,r.jsx)(R.e,{weight:"bold",className:"h-5 w-5 mr-2"}),"Resubscribe"]})||t.subscription_enabled_trial_at&&(0,r.jsxs)(u.z,{variant:"outline",className:"text-primary/80 hover:text-primary",onClick:()=>window.open("".concat(t.khoj_cloud_subscription_url,"?prefilled_email=").concat(t.username),"_blank","noopener,noreferrer"),children:[(0,r.jsx)(R.e,{weight:"bold",className:"h-5 w-5 mr-2"}),"Subscribe"]})||(0,r.jsxs)(u.z,{variant:"outline",className:"text-primary/80 hover:text-primary",onClick:et,children:[(0,r.jsx)(R.e,{weight:"bold",className:"h-5 w-5 mr-2"}),"Enable Trial"]})})]})]})]}),k&&(0,r.jsx)(eo,{onClose:()=>C(!1)}),(0,r.jsxs)("div",{className:"section grid gap-8",children:[(0,r.jsx)("div",{className:"text-2xl",children:"Content"}),(0,r.jsxs)("div",{className:"cards flex flex-wrap gap-16",children:[(0,r.jsxs)(f.Zb,{id:"computer",className:E,children:[(0,r.jsxs)(f.Ol,{className:"flex flex-row text-2xl",children:[(0,r.jsx)(K.I,{className:"h-8 w-8 mr-2"}),"Files",t.enabled_content_source.computer&&(0,r.jsx)(Z.f,{className:"h-6 w-6 ml-auto text-green-500",weight:"fill"})]}),(0,r.jsx)(f.aY,{className:"overflow-hidden pb-12 text-gray-400",children:"Manage your synced files"}),(0,r.jsxs)(f.eW,{className:"flex flex-wrap gap-4",children:[(0,r.jsx)(u.z,{variant:"outline",size:"sm",onClick:()=>C(!0),children:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(W.h,{className:"h-5 w-5 inline mr-1"}),"Manage"]})}),(0,r.jsxs)(u.z,{variant:"outline",size:"sm",className:"".concat(t.enabled_content_source.computer||"hidden"),onClick:()=>eu("computer"),children:[(0,r.jsx)(M.u,{className:"h-5 w-5 inline mr-1"}),"Disable"]})]})]}),(0,r.jsxs)(f.Zb,{id:"github",className:"".concat(E," hidden"),children:[(0,r.jsxs)(f.Ol,{className:"flex flex-row text-2xl",children:[(0,r.jsx)(U.b,{className:"h-8 w-8 mr-2"}),"Github"]}),(0,r.jsx)(f.aY,{className:"overflow-hidden pb-12 text-gray-400",children:"Set Github repositories to index"}),(0,r.jsxs)(f.eW,{className:"flex flex-wrap gap-4",children:[(0,r.jsx)(u.z,{variant:"outline",size:"sm",children:t.enabled_content_source.github&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(W.h,{className:"h-5 w-5 inline mr-1"}),"Manage"]})||(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(L.F,{className:"h-5 w-5 inline mr-1"}),"Connect"]})}),(0,r.jsxs)(u.z,{variant:"outline",size:"sm",className:"".concat(t.enabled_content_source.github||"hidden"),children:[(0,r.jsx)(M.u,{className:"h-5 w-5 inline mr-1"}),"Disable"]})]})]}),(0,r.jsxs)(f.Zb,{id:"notion",className:E,children:[(0,r.jsxs)(f.Ol,{className:"text-xl flex flex-row",children:[(0,r.jsx)(B.F,{className:"h-7 w-7 mr-2"}),"Notion",t.enabled_content_source.notion&&(0,r.jsx)(Z.f,{className:"h-6 w-6 ml-auto text-green-500",weight:"fill"})]}),(0,r.jsxs)(f.aY,{className:"grid gap-4",children:[(0,r.jsx)("p",{className:"text-gray-400",children:"Sync your Notion workspace."}),!t.notion_oauth_url&&(0,r.jsx)(p.I,{onChange:e=>j(e.target.value),value:i||"",placeholder:"Enter API Key of your Khoj integration on Notion",className:"w-full border border-gray-300 rounded-lg px-4 py-6"})]}),(0,r.jsxs)(f.eW,{className:"flex flex-wrap gap-4",children:[t.notion_oauth_url&&!t.enabled_content_source.notion?(0,r.jsxs)(u.z,{variant:"outline",size:"sm",onClick:()=>{window.open(t.notion_oauth_url)},children:[(0,r.jsx)(L.F,{className:"h-5 w-5 inline mr-1"}),"Connect"]}):t.enabled_content_source.notion&&i===t.notion_token?(0,r.jsxs)(u.z,{variant:"outline",size:"sm",onClick:()=>em("notion"),children:[(0,r.jsx)(V.t,{className:"h-5 w-5 inline mr-1"}),"Sync"]}):t.notion_oauth_url?(0,r.jsx)(r.Fragment,{}):(0,r.jsxs)(u.z,{variant:"outline",size:"sm",onClick:ed,disabled:i===t.notion_token,children:[(0,r.jsx)(I.B,{className:"h-5 w-5 inline mr-1"}),t.enabled_content_source.notion&&"Update API Key"||"Set API Key"]}),(0,r.jsxs)(u.z,{variant:"outline",size:"sm",className:"".concat(t.notion_token||"hidden"),onClick:()=>eu("notion"),children:[(0,r.jsx)(M.u,{className:"h-5 w-5 inline mr-1"}),"Disconnect"]})]})]})]})]}),(0,r.jsxs)("div",{className:"section grid gap-8",children:[(0,r.jsx)("div",{className:"text-2xl",children:"Models"}),(0,r.jsxs)("div",{className:"cards flex flex-wrap gap-16",children:[t.chat_model_options.length>0&&(0,r.jsxs)(f.Zb,{className:E,children:[(0,r.jsxs)(f.Ol,{className:"text-xl flex flex-row",children:[(0,r.jsx)(H.G,{className:"h-7 w-7 mr-2"}),"Chat"]}),(0,r.jsxs)(f.aY,{className:"overflow-hidden pb-12 grid gap-8 h-fit",children:[(0,r.jsx)("p",{className:"text-gray-400",children:"Pick the chat model to generate text responses"}),(0,r.jsx)(ec,{items:t.chat_model_options,selected:t.selected_chat_model_config,callbackFunc:ea("chat")})]}),(0,r.jsx)(f.eW,{className:"flex flex-wrap gap-4",children:!t.is_active&&(0,r.jsx)("p",{className:"text-gray-400",children:"Subscribe to switch model"})})]}),t.paint_model_options.length>0&&(0,r.jsxs)(f.Zb,{className:E,children:[(0,r.jsxs)(f.Ol,{className:"text-xl flex flex-row",children:[(0,r.jsx)(G.Y,{className:"h-7 w-7 mr-2"}),"Paint"]}),(0,r.jsxs)(f.aY,{className:"overflow-hidden pb-12 grid gap-8 h-fit",children:[(0,r.jsx)("p",{className:"text-gray-400",children:"Pick the paint model to generate image responses"}),(0,r.jsx)(ec,{items:t.paint_model_options,selected:t.selected_paint_model_config,callbackFunc:ea("paint")})]}),(0,r.jsx)(f.eW,{className:"flex flex-wrap gap-4",children:!t.is_active&&(0,r.jsx)("p",{className:"text-gray-400",children:"Subscribe to switch model"})})]}),t.voice_model_options.length>0&&(0,r.jsxs)(f.Zb,{className:E,children:[(0,r.jsxs)(f.Ol,{className:"text-xl flex flex-row",children:[(0,r.jsx)(_.u,{className:"h-7 w-7 mr-2"}),"Voice"]}),(0,r.jsxs)(f.aY,{className:"overflow-hidden pb-12 grid gap-8 h-fit",children:[(0,r.jsx)("p",{className:"text-gray-400",children:"Pick the voice model to generate speech responses"}),(0,r.jsx)(ec,{items:t.voice_model_options,selected:t.selected_voice_model_config,callbackFunc:ea("voice")})]}),(0,r.jsx)(f.eW,{className:"flex flex-wrap gap-4",children:!t.is_active&&(0,r.jsx)("p",{className:"text-gray-400",children:"Subscribe to switch model"})})]})]})]}),(0,r.jsxs)("div",{className:"section grid gap-8",children:[(0,r.jsx)("div",{id:"clients",className:"text-2xl",children:"Clients"}),(0,r.jsxs)("div",{className:"cards flex flex-col flex-wrap gap-8",children:[!t.anonymous_mode&&(0,r.jsx)(eh,{}),(0,r.jsxs)(f.Zb,{className:"".concat(E," lg:w-2/3"),children:[(0,r.jsxs)(f.Ol,{className:"text-xl flex flex-row",children:[(0,r.jsx)(J.V,{className:"h-7 w-7 mr-2"}),"Chat on Whatsapp","verified"===y&&(0,r.jsx)(Z.f,{weight:"bold",className:"h-4 w-4 ml-1 text-green-400"})||"setup"!==y&&(0,r.jsx)(S.C,{weight:"bold",className:"h-4 w-4 ml-1 text-yellow-400"})]}),(0,r.jsxs)(f.aY,{className:"grid gap-4",children:[(0,r.jsxs)("p",{className:"text-gray-400",children:["Connect your number to chat with Khoj on WhatsApp. Learn more about the integration"," ",(0,r.jsx)("a",{href:"https://docs.khoj.dev/clients/whatsapp",children:"here"}),"."]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(Q.Z,{initialValue:g||"",onChangeNumber:b,disabled:"verify"===y,initOptions:{separateDialCode:!0,initialCountry:"af",utilsScript:"https://assets.khoj.dev/intl-tel-input%4023.8.0_build_js_utils.js",containerClass:"".concat(l().phoneInput)}}),"verify"===y&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{children:"Enter the OTP sent to your number: ".concat(g)}),(0,r.jsx)(x.Zn,{autoFocus:!0,maxLength:6,value:w||"",onChange:N,onComplete:()=>v("verify"),children:(0,r.jsxs)(x.hf,{children:[(0,r.jsx)(x.cY,{index:0}),(0,r.jsx)(x.cY,{index:1}),(0,r.jsx)(x.cY,{index:2}),(0,r.jsx)(x.cY,{index:3}),(0,r.jsx)(x.cY,{index:4}),(0,r.jsx)(x.cY,{index:5})]})})]})]})]}),(0,r.jsxs)(f.eW,{className:"flex flex-wrap gap-4",children:["verify"===y&&(0,r.jsx)(u.z,{variant:"outline",onClick:P,children:"Verify"})||(0,r.jsx)(u.z,{variant:"outline",disabled:!g||g===t.phone_number&&"verified"===y||!(0,m.y)(g),onClick:F,children:t.phone_number?g&&(g!==t.phone_number||"verified"!==y)&&(0,m.y)(g)?(0,r.jsxs)(r.Fragment,{children:["Send OTP"," ",(0,r.jsx)(q.o,{className:"inline ml-2",weight:"bold"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)($.F,{className:"inline mr-2 text-green-400"}),"Switch Number"]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(L.F,{className:"inline mr-2"}),"Setup Whatsapp"]})}),"verified"===y&&(0,r.jsxs)(u.z,{variant:"outline",onClick:()=>O(),children:[(0,r.jsx)(M.u,{className:"h-5 w-5 mr-2"}),"Disconnect"]})]})]})]})]})]})})})})]})]})]}):(0,r.jsx)(X.Z,{})}(a=n||(n={})).Setup="setup",a.SendOTP="otp",a.VerifyOTP="verify",a.Verified="verified"},32759:function(e,t,s){"use strict";s.d(t,{E:function(){return l}});var a=s(57437),n=s(2265),r=s(60610),i=s(94508);let l=n.forwardRef((e,t)=>{let{className:s,value:n,indicatorColor:l,...o}=e;return(0,a.jsx)(r.fC,{ref:t,className:(0,i.cn)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",s),...o,children:(0,a.jsx)(r.z$,{className:"h-full w-full flex-1 bg-primary transition-all ".concat(l),style:{transform:"translateX(-".concat(100-(n||0),"%)")}})})});l.displayName=r.fC.displayName},77992:function(e,t,s){"use strict";s.d(t,{pm:function(){return m}});var a=s(2265);let n=0,r=new Map,i=e=>{if(r.has(e))return;let t=setTimeout(()=>{r.delete(e),d({type:"REMOVE_TOAST",toastId:e})},1e6);r.set(e,t)},l=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case"DISMISS_TOAST":{let{toastId:s}=t;return s?i(s):e.toasts.forEach(e=>{i(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===s||void 0===s?{...e,open:!1}:e)}}case"REMOVE_TOAST":if(void 0===t.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},o=[],c={toasts:[]};function d(e){c=l(c,e),o.forEach(e=>{e(c)})}function h(e){let{...t}=e,s=(n=(n+1)%Number.MAX_SAFE_INTEGER).toString(),a=()=>d({type:"DISMISS_TOAST",toastId:s});return d({type:"ADD_TOAST",toast:{...t,id:s,open:!0,onOpenChange:e=>{e||a()}}}),{id:s,dismiss:a,update:e=>d({type:"UPDATE_TOAST",toast:{...e,id:s}})}}function m(){let[e,t]=a.useState(c);return a.useEffect(()=>(o.push(t),()=>{let e=o.indexOf(t);e>-1&&o.splice(e,1)}),[e]),{...e,toast:h,dismiss:e=>d({type:"DISMISS_TOAST",toastId:e})}}},917:function(e){e.exports={page:"settings_page__mP7qk",contentBody:"settings_contentBody__uZjue",phoneInput:"settings_phoneInput__j6xJN"}}},function(e){e.O(0,[6008,9031,9259,8667,182,688,4124,2971,2117,1744],function(){return e(e.s=62960)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6938],{62960:function(e,t,s){Promise.resolve().then(s.bind(s,31537))},31537:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return em}});var a,n,r=s(57437),i=s(917),l=s.n(i);s(97510);var o=s(2265),c=s(77992),d=s(56937),h=s(7436),m=s(67341),u=s(62869),x=s(26371),p=s(95186),f=s(66070),j=s(84190),g=s(94508);let b=o.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("div",{className:"relative w-full overflow-auto",children:(0,r.jsx)("table",{ref:t,className:(0,g.cn)("w-full caption-bottom text-sm",s),...a})})});b.displayName="Table",o.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("thead",{ref:t,className:(0,g.cn)("[&_tr]:border-b",s),...a})}).displayName="TableHeader";let w=o.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("tbody",{ref:t,className:(0,g.cn)("[&_tr:last-child]:border-0",s),...a})});w.displayName="TableBody",o.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("tfoot",{ref:t,className:(0,g.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",s),...a})}).displayName="TableFooter";let N=o.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("tr",{ref:t,className:(0,g.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",s),...a})});N.displayName="TableRow",o.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("th",{ref:t,className:(0,g.cn)("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",s),...a})}).displayName="TableHead";let y=o.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("td",{ref:t,className:(0,g.cn)("p-4 align-middle [&:has([role=checkbox])]:pr-0",s),...a})});y.displayName="TableCell",o.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("caption",{ref:t,className:(0,g.cn)("mt-4 text-sm text-muted-foreground",s),...a})}).displayName="TableCaption";var v=s(23518),_=s(87296),k=s(89203),S=s(57466),C=s(38513),T=s(19841),D=s(3894),E=s(81228),F=s(94018),P=s(13272),O=s(88435),A=s(37295),I=s(2049),z=s(50525),Y=s(5147),R=s(80438),K=s(29975),Z=s(47615),W=s(47020),M=s(22345),U=s(75216),L=s(90483),B=s(73925),V=s(54271),H=s(95656),G=s(58717),J=s(56777),$=s(97525),q=s(45178),X=s(14308),Q=s(34688),ee=s(59199),et=s(37099),es=s(32759),ea=s(27648),en=s(85872),er=s(34124),ei=s(6512),el=s(37104);let eo=e=>{let{onClose:t}=e,[s,a]=(0,o.useState)([]),[n,i]=(0,o.useState)([]),[l,c]=(0,o.useState)(""),[d,h]=(0,o.useState)(!1),[m,x]=(0,o.useState)(null),[p,f]=(0,o.useState)(null),[j,g]=(0,o.useState)(!1),[b,w]=(0,o.useState)(0),[N,y]=(0,o.useState)([]),D=(0,o.useRef)(null);(0,o.useEffect)(()=>{if(j||w(0),j){let e=setInterval(()=>{w(e=>{let t=e+(Math.floor(5*Math.random())+1);return t<100?t:100})},800);return()=>clearInterval(e)}},[j]),(0,o.useEffect)(()=>{(async()=>{try{let e=await fetch("/api/content/computer");if(!e.ok)throw Error("Failed to fetch files");let t=await e.json();Array.isArray(t)?a(t.toSorted()):console.error("Unexpected data format from API")}catch(e){console.error("Error fetching files:",e)}})()},[N]);let E=s.filter(e=>e.toLowerCase().includes(l.toLowerCase())),F=async()=>{let e=n.length>0?n:E;if(0!==e.length)try{if(!(await fetch("/api/content/files",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:e})})).ok)throw Error("Failed to delete files");a(t=>t.filter(t=>!e.includes(t))),i([])}catch(e){console.error("Error deleting files:",e)}},P=async e=>{try{if(!(await fetch("/api/content/file?filename=".concat(encodeURIComponent(e)),{method:"DELETE",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to delete file");a(t=>t.filter(t=>t!==e)),i(t=>t.filter(t=>t!==e))}catch(e){console.error("Error deleting file:",e)}};function O(e){(0,ee.ko)(e,x,g,f,y)}return(0,r.jsxs)(v.m5,{open:!0,onOpenChange:t,children:[(0,r.jsx)(et.aR,{open:null!==m||null!=p,children:(0,r.jsxs)(et._T,{children:[(0,r.jsx)(et.fY,{children:(0,r.jsx)(et.f$,{children:"Alert"})}),(0,r.jsx)(et.yT,{children:m||p}),(0,r.jsx)(et.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>{x(null),f(null),g(!1)},children:"Close"})]})}),(0,r.jsxs)("div",{className:"flex flex-col h-full",onDragOver:function(e){e.preventDefault(),h(!0)},onDragLeave:function(e){e.preventDefault(),h(!1)},onDrop:function(e){e.preventDefault(),h(!1),e.dataTransfer.files&&O(e.dataTransfer.files)},onClick:function(){D&&D.current&&D.current.click()},children:[(0,r.jsx)("input",{type:"file",multiple:!0,ref:D,style:{display:"none"},onChange:function(e){e.target.files&&O(e.target.files)}}),(0,r.jsxs)("div",{className:"flex-none p-4",children:["Upload files",j&&(0,r.jsx)(es.E,{indicatorColor:"bg-slate-500",className:"w-full h-2 rounded-full",value:b})]}),(0,r.jsx)("div",{className:"flex-none p-4 bg-secondary border-b ".concat(d?"animate-pulse":""," rounded-lg"),children:(0,r.jsx)("div",{className:"flex items-center justify-center w-full h-32 border-2 border-dashed border-gray-300 rounded-lg",children:d?(0,r.jsxs)("div",{className:"flex items-center justify-center w-full h-full",children:[(0,r.jsx)(_.u,{className:"h-6 w-6 mr-2"}),(0,r.jsx)("span",{children:"Drop files to upload"})]}):(0,r.jsxs)("div",{className:"flex items-center justify-center w-full h-full",children:[(0,r.jsx)(k.v,{className:"h-6 w-6 mr-2"}),(0,r.jsx)("span",{children:"Drag and drop files here"})]})})})]}),(0,r.jsxs)("div",{className:"flex flex-col h-full",children:[(0,r.jsx)("div",{className:"flex-none p-4 bg-background border-b",children:(0,r.jsx)(v.sZ,{placeholder:"Find synced files",value:l,onValueChange:c})}),(0,r.jsx)("div",{className:"flex-grow overflow-auto",children:(0,r.jsxs)(v.e8,{children:[(0,r.jsx)(v.rb,{children:0===s.length?(0,r.jsxs)("div",{className:"flex items-center justify-center",children:[(0,r.jsx)(S.C,{className:"h-4 w-4 mr-2",weight:"bold"}),"No files synced"]}):(0,r.jsxs)("div",{children:["Could not find a good match.",(0,r.jsx)(ea.default,{href:"/search",className:"block",children:"Need advanced search? Click here."})]})}),(0,r.jsx)(v.fu,{heading:"Synced files",children:E.map(e=>(0,r.jsx)(v.di,{value:e,onSelect:e=>{i(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},children:(0,r.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,r.jsxs)("div",{className:"flex items-center ".concat(n.includes(e)?"font-semibold":""),children:[n.includes(e)&&(0,r.jsx)(C.J,{className:"h-4 w-4 mr-2"}),(0,r.jsx)("span",{className:"break-all",children:e})]}),(0,r.jsx)(u.z,{variant:"outline",size:"sm",onClick:()=>P(e),className:"ml-auto",children:(0,r.jsx)(T.r,{className:"h-4 w-4"})})]})},e))})]})}),(0,r.jsx)("div",{className:"flex-none p-4 bg-background border-t",children:(0,r.jsx)("div",{className:"flex justify-between",children:(0,r.jsxs)(u.z,{variant:"outline",size:"sm",onClick:F,className:"mr-2",children:[(0,r.jsx)(T.r,{className:"h-4 w-4 mr-2"}),n.length>0?"Delete Selected (".concat(n.length,")"):"Delete All"]})})})]})]})},ec=e=>{var t,s;let{items:a,selected:n,callbackFunc:i}=e,[l,c]=(0,o.useState)(null!==(s=null==n?void 0:n.toString())&&void 0!==s?s:"0");return!!n&&(0,r.jsx)("div",{className:"overflow-hidden shadow-md rounded-lg",children:(0,r.jsxs)(j.h_,{children:[(0,r.jsx)(j.$F,{asChild:!0,className:"w-full rounded-lg",children:(0,r.jsxs)(u.z,{variant:"outline",className:"justify-start py-6 rounded-lg",children:[null===(t=a.find(e=>e.id.toString()===l))||void 0===t?void 0:t.name," ",(0,r.jsx)(D.p,{className:"h-4 w-4 ml-auto text-muted-foreground"})]})}),(0,r.jsx)(j.AW,{style:{maxHeight:"200px",overflowY:"auto",minWidth:"var(--radix-dropdown-menu-trigger-width)"},children:(0,r.jsx)(j._x,{value:l,onValueChange:async e=>{c(e),await i(e)},children:a.map(e=>(0,r.jsx)(j.qB,{value:e.id.toString(),children:e.name},e.id.toString()))})})]})})},ed=()=>{let[e,t]=(0,o.useState)([]),{toast:s}=(0,c.pm)(),a=async()=>{try{let e=await fetch("/auth/token",{method:"POST",headers:{"Content-Type":"application/json"}}),s=await e.json();t(e=>[...e,s])}catch(e){console.error("Error generating API key:",e)}},n=async e=>{try{await navigator.clipboard.writeText(e),s({title:"\uD83D\uDD11 API Key",description:"Copied to clipboard"})}catch(e){console.error("Error copying API key:",e)}},r=async e=>{try{(await fetch("/auth/token?token=".concat(e),{method:"DELETE"})).ok&&t(t=>t.filter(t=>t.token!==e))}catch(e){console.error("Error deleting API key:",e)}},i=async()=>{try{let e=await fetch("/auth/token"),s=await e.json();(null==s?void 0:s.length)>0&&t(s)}catch(e){console.error("Error listing API keys:",e)}};return(0,o.useEffect)(()=>{i()},[]),{apiKeys:e,generateAPIKey:a,copyAPIKey:n,deleteAPIKey:r}};function eh(){let{apiKeys:e,generateAPIKey:t,copyAPIKey:s,deleteAPIKey:a}=ed(),[n,i]=(0,o.useState)(new Set),{toast:l}=(0,c.pm)();return(0,r.jsxs)(f.Zb,{className:"grid grid-flow-column border border-gray-300 shadow-md rounded-lg dark:bg-muted dark:border-none border-opacity-50 lg:w-2/3",children:[(0,r.jsxs)(f.Ol,{className:"text-xl grid grid-flow-col grid-cols-[1fr_auto] pb-0",children:[(0,r.jsxs)("span",{className:"flex flex-wrap",children:[(0,r.jsx)(E.s,{className:"h-7 w-7 mr-2"}),"API Keys"]}),(0,r.jsxs)(u.z,{variant:"secondary",className:"!mt-0",onClick:t,children:[(0,r.jsx)(k.v,{weight:"bold",className:"h-5 w-5 mr-2"}),"Generate Key"]})]}),(0,r.jsxs)(f.aY,{className:"overflow-hidden grid gap-6",children:[(0,r.jsxs)("p",{className:"text-md text-gray-400",children:["Access Khoj from the"," ",(0,r.jsx)("a",{href:"https://docs.khoj.dev/clients/desktop",target:"_blank",children:"Desktop"}),", ",(0,r.jsx)("a",{href:"https://docs.khoj.dev/clients/obsidian",children:"Obsidian"}),","," ",(0,r.jsx)("a",{href:"https://docs.khoj.dev/clients/emacs",children:"Emacs"})," apps and more."]}),(0,r.jsx)(b,{children:(0,r.jsx)(w,{children:e.map(e=>(0,r.jsxs)(N,{children:[(0,r.jsx)(y,{className:"pl-0 py-3",children:e.name}),(0,r.jsxs)(y,{className:"grid grid-flow-col grid-cols-[1fr_auto] bg-secondary dark:bg-background rounded-xl p-3 m-1",children:[(0,r.jsx)("span",{className:"font-mono text-left w-[50px] md:w-[400px]",children:n.has(e.token)?e.token:"".concat(e.token.slice(0,6),"...").concat(e.token.slice(-4))}),(0,r.jsxs)("div",{className:"grid grid-flow-col",children:[n.has(e.token)?(0,r.jsx)(F.N,{weight:"bold",className:"h-4 w-4 mr-2 hover:bg-primary/40",onClick:()=>i(t=>{let s=new Set(t);return s.delete(e.token),s})}):(0,r.jsx)(P.b,{weight:"bold",className:"h-4 w-4 mr-2 hover:bg-primary/40",onClick:()=>i(new Set([...n,e.token]))}),(0,r.jsx)(O.C,{weight:"bold",className:"h-4 w-4 mr-2 hover:bg-primary/40",onClick:()=>{l({title:"\uD83D\uDD11 Copied API Key: ".concat(e.name),description:"Set this API key in the Khoj apps you want to connect to this Khoj account"}),s(e.token)}}),(0,r.jsx)(T.r,{weight:"bold",className:"h-4 w-4 mr-2 md:ml-4 text-red-400 hover:bg-primary/40",onClick:()=>{l({title:"\uD83D\uDD11 Deleted API Key: ".concat(e.name),description:"Apps using this API key will no longer connect to this Khoj account"}),a(e.token)}})]})]})]},e.token))})})]}),(0,r.jsx)(f.eW,{className:"flex flex-wrap gap-4"})]})}function em(){let{userConfig:e}=(0,d.h2)(!0),[t,s]=(0,o.useState)(null),[a,n]=(0,o.useState)(void 0),[i,j]=(0,o.useState)(null),[g,b]=(0,o.useState)(void 0),[w,N]=(0,o.useState)(""),[y,v]=(0,o.useState)("verified"),[k,C]=(0,o.useState)(!1),{toast:T}=(0,c.pm)(),D=(0,h.IC)(),E="w-full lg:w-5/12 grid grid-flow-column border border-gray-300 shadow-md rounded-lg border dark:border-none border-opacity-50 dark:bg-muted";(0,o.useEffect)(()=>{var t;s(e),b(null==e?void 0:e.phone_number),v((null==e?void 0:e.is_phone_number_verified)?"verified":(null==e?void 0:e.phone_number)?"otp":"setup"),n(null==e?void 0:e.given_name),j(null!==(t=null==e?void 0:e.notion_token)&&void 0!==t?t:null)},[e]);let F=async()=>{try{if(!(await fetch("/api/phone?phone_number=".concat(g),{method:"POST",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to send OTP");v("verify")}catch(e){console.error("Error sending OTP:",e),T({title:"\uD83D\uDCF1 Phone",description:"Failed to send OTP. Try again or contact us at team@khoj.dev"})}},P=async()=>{try{if(!(await fetch("/api/phone/verify?code=".concat(w),{method:"POST",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to verify OTP");v("verified"),T({title:"\uD83D\uDCF1 Phone",description:"Phone number verified"})}catch(e){console.error("Error verifying OTP:",e),T({title:"\uD83D\uDCF1 Phone",description:"Failed to verify OTP. Try again or contact us at team@khoj.dev"})}},O=async()=>{try{if(!(await fetch("/api/phone",{method:"DELETE",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to disconnect phone number");b(void 0),v("setup"),T({title:"\uD83D\uDCF1 Phone",description:"Phone number disconnected"})}catch(e){console.error("Error disconnecting phone number:",e),T({title:"\uD83D\uDCF1 Phone",description:"Failed to disconnect phone number. Try again or contact us at team@khoj.dev"})}},ee=async e=>{try{if(!(await fetch("/api/subscription?operation=".concat(e),{method:"PATCH",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to change subscription");t&&(t.subscription_state="cancel"===e?d.o9.UNSUBSCRIBED:d.o9.SUBSCRIBED,s(t)),T({title:"\uD83D\uDCB3 Subscription",description:(null==t?void 0:t.subscription_state)==="unsubscribed"?"Your subscription was cancelled":"Your Futurist subscription has been renewed"})}catch(t){console.error("Error changing subscription:",t),T({title:"\uD83D\uDCB3 Subscription",description:"cancel"===e?"Failed to cancel subscription. Try again or contact us at team@khoj.dev":"Failed to renew subscription. Try again or contact us at team@khoj.dev"})}},et=async()=>{try{let e=await fetch("/api/subscription/trial",{method:"POST"});if(!e.ok)throw Error("Failed to enable free trial");if((await e.json()).trial_enabled&&t){t.subscription_state=d.o9.TRIAL;let e=new Date(Date.now()+864e5*t.length_of_free_trial);t.subscription_renewal_date=(e=>{let t=new Date(e);return new Intl.DateTimeFormat("en-US",{day:"2-digit",month:"short",year:"numeric"}).format(t)})(e),t.subscription_enabled_trial_at=new Date().toISOString(),s(t),T({title:"\uD83C\uDF89 Trial Enabled",description:"Your free trial will end on ".concat(t.subscription_renewal_date)})}}catch(e){console.error("Error enabling free trial:",e),T({title:"⚠️ Failed to Enable Free Trial",description:"Failed to enable free trial. Try again or contact us at team@khoj.dev"})}},es=async()=>{if(a)try{if(!(await fetch("/api/user/name?name=".concat(a),{method:"PATCH",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to update name");t&&(t.given_name=a,s(t)),T({title:"✅ Updated Profile",description:"You name has been updated to ".concat(a)})}catch(e){console.error("Error updating name:",e),T({title:"⚠️ Failed to Update Profile",description:"Failed to update name. Try again or contact team@khoj.dev"})}},ea=e=>async s=>{if(!(null==t?void 0:t.is_active)){T({title:"Model Update",description:"You need to be subscribed to update ".concat(e," models"),variant:"destructive"});return}try{if(!(await fetch("/api/model/".concat(e,"?id=")+s,{method:"POST",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to update model");T({title:"✅ Updated ".concat((0,h.LF)(e)," Model")})}catch(t){console.error("Failed to update ".concat(e," model:"),t),T({description:"❌ Failed to update ".concat((0,h.LF)(e)," model. Try again."),variant:"destructive"})}},ed=async()=>{if(i)try{if(!(await fetch("/api/content/notion",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:i})})).ok)throw Error("Failed to save Notion API key");t&&(t.notion_token=i,s(t)),T({title:"✅ Saved Notion Settings",description:"You Notion API key has been saved."})}catch(e){console.error("Error updating name:",e),T({title:"⚠️ Failed to Save Notion Settings",description:"Failed to save Notion API key. Try again or contact team@khoj.dev"})}},em=async e=>{try{if(!(await fetch("/api/content?t=".concat(e),{method:"PATCH",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to sync content from ".concat(e));T({title:"\uD83D\uDD04 Syncing ".concat(e),description:"Your ".concat(e," content is being synced.")})}catch(t){console.error("Error syncing content:",t),T({title:"⚠️ Failed to Sync ".concat(e),description:"Failed to sync ".concat(e," content. Try again or contact team@khoj.dev")})}},eu=async e=>{try{if(!(await fetch("/api/content/".concat(e),{method:"DELETE",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to disconnect ".concat(e));t&&("computer"===e?t.enabled_content_source.computer=!1:"notion"===e?(t.enabled_content_source.notion=!1,t.notion_token=null,j(t.notion_token)):"github"===e&&(t.enabled_content_source.github=!1),s(t)),"computer"===e?T({title:"✅ Deleted Synced Files",description:"Your synced documents have been deleted."}):T({title:"✅ Disconnected ".concat(e),description:"Your ".concat(e," integration to Khoj has been disconnected.")})}catch(t){console.error("Error disconnecting ".concat(e,":"),t),T({title:"⚠️ Failed to Disconnect ".concat(e),description:"Failed to disconnect from ".concat(e,". Try again or contact team@khoj.dev")})}};return t?(0,r.jsxs)(en.Hn,{children:[(0,r.jsx)(er.S,{conversationId:""}),(0,r.jsxs)(en.kV,{children:[(0,r.jsxs)("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[(0,r.jsx)(en.vP,{className:"-ml-1"}),(0,r.jsx)(ei.Z,{orientation:"vertical",className:"mr-2 h-4"}),D?(0,r.jsx)("a",{className:"p-0 no-underline",href:"/",children:(0,r.jsx)(el.VO,{className:"h-auto w-16"})}):(0,r.jsx)("h2",{className:"text-lg",children:"Settings"})]}),(0,r.jsxs)("div",{className:l().page,children:[(0,r.jsx)("title",{children:"Settings"}),(0,r.jsx)("div",{className:l().content,children:(0,r.jsx)("div",{className:"".concat(l().contentBody," mx-10 my-2"),children:(0,r.jsx)(o.Suspense,{fallback:(0,r.jsx)(X.Z,{}),children:(0,r.jsxs)("div",{id:"content",className:"grid grid-flow-column sm:grid-flow-row gap-16 m-8",children:[(0,r.jsxs)("div",{className:"section grid gap-8",children:[(0,r.jsx)("div",{className:"text-2xl",children:"Profile"}),(0,r.jsxs)("div",{className:"cards flex flex-wrap gap-16",children:[(0,r.jsxs)(f.Zb,{className:E,children:[(0,r.jsxs)(f.Ol,{className:"text-xl flex flex-row",children:[(0,r.jsx)(A.Y,{className:"h-7 w-7 mr-2"}),"Name"]}),(0,r.jsxs)(f.aY,{className:"overflow-hidden",children:[(0,r.jsx)("p",{className:"pb-4 text-gray-400",children:"What should Khoj refer to you as?"}),(0,r.jsx)(p.I,{type:"text",onChange:e=>n(e.target.value),value:a,className:"w-full border border-gray-300 rounded-lg p-4 py-6"})]}),(0,r.jsx)(f.eW,{className:"flex flex-wrap gap-4",children:(0,r.jsxs)(u.z,{variant:"outline",size:"sm",onClick:es,disabled:a===t.given_name,children:[(0,r.jsx)(I.B,{className:"h-5 w-5 inline mr-2"}),"Save"]})})]}),(0,r.jsxs)(f.Zb,{id:"subscription",className:E,children:[(0,r.jsxs)(f.Ol,{className:"text-xl flex flex-row",children:[(0,r.jsx)(z.a,{className:"h-7 w-7 mr-2"}),"Subscription"]}),(0,r.jsxs)(f.aY,{className:"grid gap-2 overflow-hidden",children:[(0,r.jsx)("p",{className:"text-gray-400",children:"Current Plan"}),"trial"===t.subscription_state&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"text-xl text-primary/80",children:"Futurist (Trial)"}),(0,r.jsxs)("p",{className:"text-gray-400",children:["You are on a"," ",t.length_of_free_trial," ","day trial of the Khoj Futurist plan. Your trial ends on"," ",t.subscription_renewal_date,". Check"," ",(0,r.jsx)("a",{href:"https://khoj.dev/#pricing",target:"_blank",children:"pricing page"})," ","to compare plans."]})]})||"subscribed"===t.subscription_state&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"text-xl text-primary/80",children:"Futurist"}),(0,r.jsxs)("p",{className:"text-gray-400",children:["Subscription ",(0,r.jsx)("b",{children:"renews"})," on"," ",(0,r.jsx)("b",{children:t.subscription_renewal_date})]})]})||"unsubscribed"===t.subscription_state&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"text-xl",children:"Futurist"}),(0,r.jsxs)("p",{className:"text-gray-400",children:["Subscription ",(0,r.jsx)("b",{children:"ends"})," on"," ",(0,r.jsx)("b",{children:t.subscription_renewal_date})]})]})||"expired"===t.subscription_state&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"text-xl",children:"Humanist"}),t.subscription_renewal_date&&(0,r.jsxs)("p",{className:"text-gray-400",children:["Subscription ",(0,r.jsx)("b",{children:"expired"})," ","on"," ",(0,r.jsx)("b",{children:t.subscription_renewal_date})]})||(0,r.jsxs)("p",{className:"text-gray-400",children:["Check"," ",(0,r.jsx)("a",{href:"https://khoj.dev/#pricing",target:"_blank",children:"pricing page"})," ","to compare plans."]})]})]}),(0,r.jsx)(f.eW,{className:"flex flex-wrap gap-4",children:"subscribed"==t.subscription_state&&(0,r.jsxs)(u.z,{variant:"outline",className:"hover:text-red-400",onClick:()=>ee("cancel"),children:[(0,r.jsx)(Y.b,{className:"h-5 w-5 mr-2"}),"Unsubscribe"]})||"unsubscribed"==t.subscription_state&&(0,r.jsxs)(u.z,{variant:"outline",className:"text-primary/80 hover:text-primary",onClick:()=>ee("resubscribe"),children:[(0,r.jsx)(R.e,{weight:"bold",className:"h-5 w-5 mr-2"}),"Resubscribe"]})||t.subscription_enabled_trial_at&&(0,r.jsxs)(u.z,{variant:"outline",className:"text-primary/80 hover:text-primary",onClick:()=>window.open("".concat(t.khoj_cloud_subscription_url,"?prefilled_email=").concat(t.username),"_blank","noopener,noreferrer"),children:[(0,r.jsx)(R.e,{weight:"bold",className:"h-5 w-5 mr-2"}),"Subscribe"]})||(0,r.jsxs)(u.z,{variant:"outline",className:"text-primary/80 hover:text-primary",onClick:et,children:[(0,r.jsx)(R.e,{weight:"bold",className:"h-5 w-5 mr-2"}),"Enable Trial"]})})]})]})]}),k&&(0,r.jsx)(eo,{onClose:()=>C(!1)}),(0,r.jsxs)("div",{className:"section grid gap-8",children:[(0,r.jsx)("div",{className:"text-2xl",children:"Content"}),(0,r.jsxs)("div",{className:"cards flex flex-wrap gap-16",children:[(0,r.jsxs)(f.Zb,{id:"computer",className:E,children:[(0,r.jsxs)(f.Ol,{className:"flex flex-row text-2xl",children:[(0,r.jsx)(K.I,{className:"h-8 w-8 mr-2"}),"Files",t.enabled_content_source.computer&&(0,r.jsx)(Z.f,{className:"h-6 w-6 ml-auto text-green-500",weight:"fill"})]}),(0,r.jsx)(f.aY,{className:"overflow-hidden pb-12 text-gray-400",children:"Manage your synced files"}),(0,r.jsxs)(f.eW,{className:"flex flex-wrap gap-4",children:[(0,r.jsx)(u.z,{variant:"outline",size:"sm",onClick:()=>C(!0),children:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(W.h,{className:"h-5 w-5 inline mr-1"}),"Manage"]})}),(0,r.jsxs)(u.z,{variant:"outline",size:"sm",className:"".concat(t.enabled_content_source.computer||"hidden"),onClick:()=>eu("computer"),children:[(0,r.jsx)(M.u,{className:"h-5 w-5 inline mr-1"}),"Disable"]})]})]}),(0,r.jsxs)(f.Zb,{id:"github",className:"".concat(E," hidden"),children:[(0,r.jsxs)(f.Ol,{className:"flex flex-row text-2xl",children:[(0,r.jsx)(U.b,{className:"h-8 w-8 mr-2"}),"Github"]}),(0,r.jsx)(f.aY,{className:"overflow-hidden pb-12 text-gray-400",children:"Set Github repositories to index"}),(0,r.jsxs)(f.eW,{className:"flex flex-wrap gap-4",children:[(0,r.jsx)(u.z,{variant:"outline",size:"sm",children:t.enabled_content_source.github&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(W.h,{className:"h-5 w-5 inline mr-1"}),"Manage"]})||(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(L.F,{className:"h-5 w-5 inline mr-1"}),"Connect"]})}),(0,r.jsxs)(u.z,{variant:"outline",size:"sm",className:"".concat(t.enabled_content_source.github||"hidden"),children:[(0,r.jsx)(M.u,{className:"h-5 w-5 inline mr-1"}),"Disable"]})]})]}),(0,r.jsxs)(f.Zb,{id:"notion",className:E,children:[(0,r.jsxs)(f.Ol,{className:"text-xl flex flex-row",children:[(0,r.jsx)(B.F,{className:"h-7 w-7 mr-2"}),"Notion",t.enabled_content_source.notion&&(0,r.jsx)(Z.f,{className:"h-6 w-6 ml-auto text-green-500",weight:"fill"})]}),(0,r.jsxs)(f.aY,{className:"grid gap-4",children:[(0,r.jsx)("p",{className:"text-gray-400",children:"Sync your Notion workspace."}),!t.notion_oauth_url&&(0,r.jsx)(p.I,{onChange:e=>j(e.target.value),value:i||"",placeholder:"Enter API Key of your Khoj integration on Notion",className:"w-full border border-gray-300 rounded-lg px-4 py-6"})]}),(0,r.jsxs)(f.eW,{className:"flex flex-wrap gap-4",children:[t.notion_oauth_url&&!t.enabled_content_source.notion?(0,r.jsxs)(u.z,{variant:"outline",size:"sm",onClick:()=>{window.open(t.notion_oauth_url)},children:[(0,r.jsx)(L.F,{className:"h-5 w-5 inline mr-1"}),"Connect"]}):t.enabled_content_source.notion&&i===t.notion_token?(0,r.jsxs)(u.z,{variant:"outline",size:"sm",onClick:()=>em("notion"),children:[(0,r.jsx)(V.t,{className:"h-5 w-5 inline mr-1"}),"Sync"]}):t.notion_oauth_url?(0,r.jsx)(r.Fragment,{}):(0,r.jsxs)(u.z,{variant:"outline",size:"sm",onClick:ed,disabled:i===t.notion_token,children:[(0,r.jsx)(I.B,{className:"h-5 w-5 inline mr-1"}),t.enabled_content_source.notion&&"Update API Key"||"Set API Key"]}),(0,r.jsxs)(u.z,{variant:"outline",size:"sm",className:"".concat(t.notion_token||"hidden"),onClick:()=>eu("notion"),children:[(0,r.jsx)(M.u,{className:"h-5 w-5 inline mr-1"}),"Disconnect"]})]})]})]})]}),(0,r.jsxs)("div",{className:"section grid gap-8",children:[(0,r.jsx)("div",{className:"text-2xl",children:"Models"}),(0,r.jsxs)("div",{className:"cards flex flex-wrap gap-16",children:[t.chat_model_options.length>0&&(0,r.jsxs)(f.Zb,{className:E,children:[(0,r.jsxs)(f.Ol,{className:"text-xl flex flex-row",children:[(0,r.jsx)(H.G,{className:"h-7 w-7 mr-2"}),"Chat"]}),(0,r.jsxs)(f.aY,{className:"overflow-hidden pb-12 grid gap-8 h-fit",children:[(0,r.jsx)("p",{className:"text-gray-400",children:"Pick the chat model to generate text responses"}),(0,r.jsx)(ec,{items:t.chat_model_options,selected:t.selected_chat_model_config,callbackFunc:ea("chat")})]}),(0,r.jsx)(f.eW,{className:"flex flex-wrap gap-4",children:!t.is_active&&(0,r.jsx)("p",{className:"text-gray-400",children:"Subscribe to switch model"})})]}),t.paint_model_options.length>0&&(0,r.jsxs)(f.Zb,{className:E,children:[(0,r.jsxs)(f.Ol,{className:"text-xl flex flex-row",children:[(0,r.jsx)(G.Y,{className:"h-7 w-7 mr-2"}),"Paint"]}),(0,r.jsxs)(f.aY,{className:"overflow-hidden pb-12 grid gap-8 h-fit",children:[(0,r.jsx)("p",{className:"text-gray-400",children:"Pick the paint model to generate image responses"}),(0,r.jsx)(ec,{items:t.paint_model_options,selected:t.selected_paint_model_config,callbackFunc:ea("paint")})]}),(0,r.jsx)(f.eW,{className:"flex flex-wrap gap-4",children:!t.is_active&&(0,r.jsx)("p",{className:"text-gray-400",children:"Subscribe to switch model"})})]}),t.voice_model_options.length>0&&(0,r.jsxs)(f.Zb,{className:E,children:[(0,r.jsxs)(f.Ol,{className:"text-xl flex flex-row",children:[(0,r.jsx)(_.u,{className:"h-7 w-7 mr-2"}),"Voice"]}),(0,r.jsxs)(f.aY,{className:"overflow-hidden pb-12 grid gap-8 h-fit",children:[(0,r.jsx)("p",{className:"text-gray-400",children:"Pick the voice model to generate speech responses"}),(0,r.jsx)(ec,{items:t.voice_model_options,selected:t.selected_voice_model_config,callbackFunc:ea("voice")})]}),(0,r.jsx)(f.eW,{className:"flex flex-wrap gap-4",children:!t.is_active&&(0,r.jsx)("p",{className:"text-gray-400",children:"Subscribe to switch model"})})]})]})]}),(0,r.jsxs)("div",{className:"section grid gap-8",children:[(0,r.jsx)("div",{id:"clients",className:"text-2xl",children:"Clients"}),(0,r.jsxs)("div",{className:"cards flex flex-col flex-wrap gap-8",children:[!t.anonymous_mode&&(0,r.jsx)(eh,{}),(0,r.jsxs)(f.Zb,{className:"".concat(E," lg:w-2/3"),children:[(0,r.jsxs)(f.Ol,{className:"text-xl flex flex-row",children:[(0,r.jsx)(J.V,{className:"h-7 w-7 mr-2"}),"Chat on Whatsapp","verified"===y&&(0,r.jsx)(Z.f,{weight:"bold",className:"h-4 w-4 ml-1 text-green-400"})||"setup"!==y&&(0,r.jsx)(S.C,{weight:"bold",className:"h-4 w-4 ml-1 text-yellow-400"})]}),(0,r.jsxs)(f.aY,{className:"grid gap-4",children:[(0,r.jsxs)("p",{className:"text-gray-400",children:["Connect your number to chat with Khoj on WhatsApp. Learn more about the integration"," ",(0,r.jsx)("a",{href:"https://docs.khoj.dev/clients/whatsapp",children:"here"}),"."]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(Q.Z,{initialValue:g||"",onChangeNumber:b,disabled:"verify"===y,initOptions:{separateDialCode:!0,initialCountry:"af",utilsScript:"https://assets.khoj.dev/intl-tel-input%4023.8.0_build_js_utils.js",containerClass:"".concat(l().phoneInput)}}),"verify"===y&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{children:"Enter the OTP sent to your number: ".concat(g)}),(0,r.jsx)(x.Zn,{autoFocus:!0,maxLength:6,value:w||"",onChange:N,onComplete:()=>v("verify"),children:(0,r.jsxs)(x.hf,{children:[(0,r.jsx)(x.cY,{index:0}),(0,r.jsx)(x.cY,{index:1}),(0,r.jsx)(x.cY,{index:2}),(0,r.jsx)(x.cY,{index:3}),(0,r.jsx)(x.cY,{index:4}),(0,r.jsx)(x.cY,{index:5})]})})]})]})]}),(0,r.jsxs)(f.eW,{className:"flex flex-wrap gap-4",children:["verify"===y&&(0,r.jsx)(u.z,{variant:"outline",onClick:P,children:"Verify"})||(0,r.jsx)(u.z,{variant:"outline",disabled:!g||g===t.phone_number&&"verified"===y||!(0,m.y)(g),onClick:F,children:t.phone_number?g&&(g!==t.phone_number||"verified"!==y)&&(0,m.y)(g)?(0,r.jsxs)(r.Fragment,{children:["Send OTP"," ",(0,r.jsx)(q.o,{className:"inline ml-2",weight:"bold"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)($.F,{className:"inline mr-2 text-green-400"}),"Switch Number"]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(L.F,{className:"inline mr-2"}),"Setup Whatsapp"]})}),"verified"===y&&(0,r.jsxs)(u.z,{variant:"outline",onClick:()=>O(),children:[(0,r.jsx)(M.u,{className:"h-5 w-5 mr-2"}),"Disconnect"]})]})]})]})]})]})})})})]})]})]}):(0,r.jsx)(X.Z,{})}(a=n||(n={})).Setup="setup",a.SendOTP="otp",a.VerifyOTP="verify",a.Verified="verified"},32759:function(e,t,s){"use strict";s.d(t,{E:function(){return l}});var a=s(57437),n=s(2265),r=s(60610),i=s(94508);let l=n.forwardRef((e,t)=>{let{className:s,value:n,indicatorColor:l,...o}=e;return(0,a.jsx)(r.fC,{ref:t,className:(0,i.cn)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",s),...o,children:(0,a.jsx)(r.z$,{className:"h-full w-full flex-1 bg-primary transition-all ".concat(l),style:{transform:"translateX(-".concat(100-(n||0),"%)")}})})});l.displayName=r.fC.displayName},77992:function(e,t,s){"use strict";s.d(t,{pm:function(){return m}});var a=s(2265);let n=0,r=new Map,i=e=>{if(r.has(e))return;let t=setTimeout(()=>{r.delete(e),d({type:"REMOVE_TOAST",toastId:e})},1e6);r.set(e,t)},l=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case"DISMISS_TOAST":{let{toastId:s}=t;return s?i(s):e.toasts.forEach(e=>{i(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===s||void 0===s?{...e,open:!1}:e)}}case"REMOVE_TOAST":if(void 0===t.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},o=[],c={toasts:[]};function d(e){c=l(c,e),o.forEach(e=>{e(c)})}function h(e){let{...t}=e,s=(n=(n+1)%Number.MAX_SAFE_INTEGER).toString(),a=()=>d({type:"DISMISS_TOAST",toastId:s});return d({type:"ADD_TOAST",toast:{...t,id:s,open:!0,onOpenChange:e=>{e||a()}}}),{id:s,dismiss:a,update:e=>d({type:"UPDATE_TOAST",toast:{...e,id:s}})}}function m(){let[e,t]=a.useState(c);return a.useEffect(()=>(o.push(t),()=>{let e=o.indexOf(t);e>-1&&o.splice(e,1)}),[e]),{...e,toast:h,dismiss:e=>d({type:"DISMISS_TOAST",toastId:e})}}},917:function(e){e.exports={page:"settings_page__mP7qk",contentBody:"settings_contentBody__uZjue",phoneInput:"settings_phoneInput__j6xJN"}}},function(e){e.O(0,[6008,1607,9259,8667,182,688,2327,2971,2117,1744],function(){return e(e.s=62960)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7138,3317,8459,244],{63521:function(){}},function(n){n.O(0,[2971,2117,1744],function(){return n(n.s=63521)}),_N_E=n.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3111],{91955:function(e,t,s){Promise.resolve().then(s.bind(s,41694))},41694:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return f}});var a=s(57437),n=s(22515),o=s.n(n),i=s(2265),c=s(53789),r=s(14308);s(2446);var l=s(7436),d=s(56937),h=s(5477),u=s(85872),g=s(34124),m=s(6512),p=s(37104);function x(e){let[t,s]=(0,i.useState)(""),[n,r]=(0,i.useState)([]),[l,d]=(0,i.useState)(!1),[u,g]=(0,i.useState)(null),m=(0,i.useRef)(null),p=e.setQueryToProcess,x=e.streamedMessages,f=e.isMobileWidth?"w-full":"w-4/6";return((0,i.useEffect)(()=>{if(n.length>0){let t=n.map(e=>encodeURIComponent(e));e.setImages(t)}},[n,e.setImages]),(0,i.useEffect)(()=>{t&&(d(!0),p(t))},[t,p]),(0,i.useEffect)(()=>{x&&x.length>0&&x[x.length-1].completed?d(!1):s("")},[x]),e.publicConversationSlug||e.conversationId)?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:o().chatBodyFull,children:(0,a.jsx)(c.Z,{publicConversationSlug:e.publicConversationSlug,conversationId:e.conversationId||"",setAgent:g,setTitle:e.setTitle,pendingMessage:l?t:"",incomingMessages:e.streamedMessages,customClassName:f})}),(0,a.jsx)("div",{className:"".concat(o().inputBox," p-1 md:px-2 shadow-md bg-background align-middle items-center justify-center dark:bg-neutral-700 dark:border-0 dark:shadow-sm rounded-2xl md:rounded-xl h-fit ").concat(f," mr-auto ml-auto"),children:(0,a.jsx)(h.a,{isLoggedIn:e.isLoggedIn,sendMessage:e=>s(e),sendImage:e=>r(t=>[...t,e]),sendDisabled:l,chatOptionsData:e.chatOptionsData,conversationId:e.conversationId,agentColor:null==u?void 0:u.color,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles,setTriggeredAbort:()=>{},ref:m})})]}):(0,a.jsx)("div",{className:o().suggestions,children:"Whoops, nothing to see here!"})}function f(){let[e,t]=(0,i.useState)(null),[s,n]=(0,i.useState)(!0),[c,h]=(0,i.useState)("Khoj AI - Chat"),[f,_]=(0,i.useState)(void 0),[v,j]=(0,i.useState)([]),[S,C]=(0,i.useState)(""),[I,b]=(0,i.useState)(null),[N,y]=(0,i.useState)(void 0),[B,w]=(0,i.useState)([]),{data:O,error:k,isLoading:M}=(0,d.GW)(),E=(0,l.IC)();return((0,i.useEffect)(()=>{fetch("/api/chat/options").then(e=>e.json()).then(e=>{n(!1),e&&t(e)}).catch(e=>{console.error(e)}),(0,l.EK)(),y(window.location.pathname.split("/").pop()||"")},[]),(0,i.useEffect)(()=>{I&&localStorage.setItem("uploadedFiles",JSON.stringify(I))},[I]),(0,i.useEffect)(()=>{if(S&&!f){fetch("/api/chat/share/fork?public_conversation_slug=".concat(N),{method:"POST",headers:{"Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{_(e.conversation_id),localStorage.setItem("message",S),B.length>0&&localStorage.setItem("images",JSON.stringify(B)),window.location.href="/chat?conversationId=".concat(e.conversation_id)}).catch(e=>{console.error(e)});return}},[S,f,N]),s)?(0,a.jsx)(r.Z,{}):N?(0,a.jsxs)(u.Hn,{children:[(0,a.jsx)(g.S,{conversationId:f||""}),(0,a.jsxs)(u.kV,{children:[(0,a.jsxs)("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[(0,a.jsx)(u.vP,{className:"-ml-1"}),(0,a.jsx)(m.Z,{orientation:"vertical",className:"mr-2 h-4"}),N&&(0,a.jsx)("div",{className:"".concat(o().chatTitleWrapper," text-nowrap text-ellipsis overflow-hidden max-w-screen-md grid items-top font-bold mx-2 md:mr-8 col-auto h-fit"),children:E?(0,a.jsx)("a",{className:"p-0 no-underline",href:"/",children:(0,a.jsx)(p.VO,{className:"h-auto w-16"})}):c&&(0,a.jsx)(a.Fragment,{children:(0,a.jsx)("h2",{className:"text-lg text-ellipsis whitespace-nowrap overflow-x-hidden mr-4",children:c})})})]}),(0,a.jsxs)("div",{className:"".concat(o().main," ").concat(o().chatLayout),children:[(0,a.jsx)("title",{children:c}),(0,a.jsx)("div",{className:o().chatBox,children:(0,a.jsx)("div",{className:o().chatBoxBody,children:(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(r.Z,{}),children:(0,a.jsx)(x,{conversationId:f,streamedMessages:v,setQueryToProcess:C,isLoggedIn:!!O,publicConversationSlug:N,chatOptionsData:e,setTitle:h,setUploadedFiles:b,isMobileWidth:E,setImages:w})})})})]})]})]}):(0,a.jsx)("div",{className:o().suggestions,children:"Whoops, nothing to see here!"})}},22515:function(e){e.exports={main:"sharedChat_main__7Nayy",suggestions:"sharedChat_suggestions__V8kr_",inputBox:"sharedChat_inputBox__wRW5A",chatBodyFull:"sharedChat_chatBodyFull__O1MOv",chatBody:"sharedChat_chatBody__OnHDL",chatLayout:"sharedChat_chatLayout__gutlc",chatBox:"sharedChat_chatBox__PmAPg",titleBar:"sharedChat_titleBar__vOHp_",chatBoxBody:"sharedChat_chatBoxBody__ef2Nl",agentIndicator:"sharedChat_agentIndicator__ORCl4"}}},function(e){e.O(0,[2421,9031,3954,9259,8667,182,1010,6293,4124,5477,3789,2971,2117,1744],function(){return e(e.s=91955)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3111],{91955:function(e,t,s){Promise.resolve().then(s.bind(s,41694))},41694:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return f}});var a=s(57437),n=s(22515),o=s.n(n),i=s(2265),c=s(74986),r=s(14308);s(2446);var l=s(7436),d=s(56937),h=s(5477),u=s(85872),g=s(34124),m=s(6512),p=s(37104);function x(e){let[t,s]=(0,i.useState)(""),[n,r]=(0,i.useState)([]),[l,d]=(0,i.useState)(!1),[u,g]=(0,i.useState)(null),m=(0,i.useRef)(null),p=e.setQueryToProcess,x=e.streamedMessages,f=e.isMobileWidth?"w-full":"w-4/6";return((0,i.useEffect)(()=>{if(n.length>0){let t=n.map(e=>encodeURIComponent(e));e.setImages(t)}},[n,e.setImages]),(0,i.useEffect)(()=>{t&&(d(!0),p(t))},[t,p]),(0,i.useEffect)(()=>{x&&x.length>0&&x[x.length-1].completed?d(!1):s("")},[x]),e.publicConversationSlug||e.conversationId)?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:o().chatBodyFull,children:(0,a.jsx)(c.Z,{publicConversationSlug:e.publicConversationSlug,conversationId:e.conversationId||"",setAgent:g,setTitle:e.setTitle,pendingMessage:l?t:"",incomingMessages:e.streamedMessages,customClassName:f})}),(0,a.jsx)("div",{className:"".concat(o().inputBox," p-1 md:px-2 shadow-md bg-background align-middle items-center justify-center dark:bg-neutral-700 dark:border-0 dark:shadow-sm rounded-2xl md:rounded-xl h-fit ").concat(f," mr-auto ml-auto"),children:(0,a.jsx)(h.a,{isLoggedIn:e.isLoggedIn,sendMessage:e=>s(e),sendImage:e=>r(t=>[...t,e]),sendDisabled:l,chatOptionsData:e.chatOptionsData,conversationId:e.conversationId,agentColor:null==u?void 0:u.color,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles,setTriggeredAbort:()=>{},ref:m})})]}):(0,a.jsx)("div",{className:o().suggestions,children:"Whoops, nothing to see here!"})}function f(){let[e,t]=(0,i.useState)(null),[s,n]=(0,i.useState)(!0),[c,h]=(0,i.useState)("Khoj AI - Chat"),[f,_]=(0,i.useState)(void 0),[v,j]=(0,i.useState)([]),[S,C]=(0,i.useState)(""),[I,b]=(0,i.useState)(null),[N,y]=(0,i.useState)(void 0),[B,w]=(0,i.useState)([]),{data:O,error:k,isLoading:M}=(0,d.GW)(),E=(0,l.IC)();return((0,i.useEffect)(()=>{fetch("/api/chat/options").then(e=>e.json()).then(e=>{n(!1),e&&t(e)}).catch(e=>{console.error(e)}),(0,l.EK)(),y(window.location.pathname.split("/").pop()||"")},[]),(0,i.useEffect)(()=>{I&&localStorage.setItem("uploadedFiles",JSON.stringify(I))},[I]),(0,i.useEffect)(()=>{if(S&&!f){fetch("/api/chat/share/fork?public_conversation_slug=".concat(N),{method:"POST",headers:{"Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{_(e.conversation_id),localStorage.setItem("message",S),B.length>0&&localStorage.setItem("images",JSON.stringify(B)),window.location.href="/chat?conversationId=".concat(e.conversation_id)}).catch(e=>{console.error(e)});return}},[S,f,N]),s)?(0,a.jsx)(r.Z,{}):N?(0,a.jsxs)(u.Hn,{children:[(0,a.jsx)(g.S,{conversationId:f||""}),(0,a.jsxs)(u.kV,{children:[(0,a.jsxs)("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[(0,a.jsx)(u.vP,{className:"-ml-1"}),(0,a.jsx)(m.Z,{orientation:"vertical",className:"mr-2 h-4"}),N&&(0,a.jsx)("div",{className:"".concat(o().chatTitleWrapper," text-nowrap text-ellipsis overflow-hidden max-w-screen-md grid items-top font-bold mx-2 md:mr-8 col-auto h-fit"),children:E?(0,a.jsx)("a",{className:"p-0 no-underline",href:"/",children:(0,a.jsx)(p.VO,{className:"h-auto w-16"})}):c&&(0,a.jsx)(a.Fragment,{children:(0,a.jsx)("h2",{className:"text-lg text-ellipsis whitespace-nowrap overflow-x-hidden mr-4",children:c})})})]}),(0,a.jsxs)("div",{className:"".concat(o().main," ").concat(o().chatLayout),children:[(0,a.jsx)("title",{children:c}),(0,a.jsx)("div",{className:o().chatBox,children:(0,a.jsx)("div",{className:o().chatBoxBody,children:(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(r.Z,{}),children:(0,a.jsx)(x,{conversationId:f,streamedMessages:v,setQueryToProcess:C,isLoggedIn:!!O,publicConversationSlug:N,chatOptionsData:e,setTitle:h,setUploadedFiles:b,isMobileWidth:E,setImages:w})})})})]})]})]}):(0,a.jsx)("div",{className:o().suggestions,children:"Whoops, nothing to see here!"})}},22515:function(e){e.exports={main:"sharedChat_main__7Nayy",suggestions:"sharedChat_suggestions__V8kr_",inputBox:"sharedChat_inputBox__wRW5A",chatBodyFull:"sharedChat_chatBodyFull__O1MOv",chatBody:"sharedChat_chatBody__OnHDL",chatLayout:"sharedChat_chatLayout__gutlc",chatBox:"sharedChat_chatBox__PmAPg",titleBar:"sharedChat_titleBar__vOHp_",chatBoxBody:"sharedChat_chatBoxBody__ef2Nl",agentIndicator:"sharedChat_agentIndicator__ORCl4"}}},function(e){e.O(0,[9346,8255,1607,3954,1919,9259,8667,182,4270,6002,2327,5477,4986,2971,2117,1744],function(){return e(e.s=91955)}),_N_E=e.O()}]);
@@ -0,0 +1,10 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1919],{65903:function(t,e,a){a.d(e,{C1:function(){return d},Lf:function(){return en},XO:function(){return b},Yn:function(){return es},ZH:function(){return P},aH:function(){return eo},dW:function(){return er},gU:function(){return eh},jr:function(){return g},us:function(){return L}});var l=a(66384),r=a(75794),i=a(1816),n=a(86954),s=a(30086),h=a(15440),o=a(90705),d=(0,s.eW)(async(t,e,a)=>{let l,r;let o=e.useHtmlLabels||(0,s.ku)(s.nV()?.htmlLabels);l=a||"node default";let d=t.insert("g").attr("class",l).attr("id",e.domId||e.id),c=d.insert("g").attr("class","label").attr("style",(0,n.R7)(e.labelStyle));r=void 0===e.label?"":"string"==typeof e.label?e.label:e.label[0];let g=await (0,i.rw)(c,(0,s.oO)((0,n.SH)(r),(0,s.nV)()),{useHtmlLabels:o,width:e.width||s.nV().flowchart?.wrappingWidth,cssClasses:"markdown-node-label",style:e.labelStyle,addSvgBackground:!!e.icon||!!e.img}),y=g.getBBox(),f=(e?.padding??0)/2;if(o){let t=g.children[0],e=(0,h.Ys)(g),a=t.getElementsByTagName("img");if(a){let t=""===r.replace(/<img[^>]*>/g,"").trim();await Promise.all([...a].map(e=>new Promise(a=>{function l(){if(e.style.display="flex",e.style.flexDirection="column",t){let t=(0,s.nV)().fontSize?(0,s.nV)().fontSize:window.getComputedStyle(document.body).fontSize,[a=s.vZ.fontSize]=(0,n.VG)(t),l=5*a+"px";e.style.minWidth=l,e.style.maxWidth=l}else e.style.width="100%";a(e)}(0,s.eW)(l,"setupImage"),setTimeout(()=>{e.complete&&l()}),e.addEventListener("error",l),e.addEventListener("load",l)})))}y=t.getBoundingClientRect(),e.attr("width",y.width),e.attr("height",y.height)}return o?c.attr("transform","translate("+-y.width/2+", "+-y.height/2+")"):c.attr("transform","translate(0, "+-y.height/2+")"),e.centerLabel&&c.attr("transform","translate("+-y.width/2+", "+-y.height/2+")"),c.insert("rect",":first-child"),{shapeSvg:d,bbox:y,halfPadding:f,label:c}},"labelHelper"),c=(0,s.eW)(async(t,e,a)=>{let l=a.useHtmlLabels||(0,s.ku)(s.nV()?.flowchart?.htmlLabels),r=t.insert("g").attr("class","label").attr("style",a.labelStyle||""),o=await (0,i.rw)(r,(0,s.oO)((0,n.SH)(e),(0,s.nV)()),{useHtmlLabels:l,width:a.width||s.nV()?.flowchart?.wrappingWidth,style:a.labelStyle,addSvgBackground:!!a.icon||!!a.img}),d=o.getBBox(),c=a.padding/2;if((0,s.ku)(s.nV()?.flowchart?.htmlLabels)){let t=o.children[0],e=(0,h.Ys)(o);d=t.getBoundingClientRect(),e.attr("width",d.width),e.attr("height",d.height)}return l?r.attr("transform","translate("+-d.width/2+", "+-d.height/2+")"):r.attr("transform","translate(0, "+-d.height/2+")"),a.centerLabel&&r.attr("transform","translate("+-d.width/2+", "+-d.height/2+")"),r.insert("rect",":first-child"),{shapeSvg:t,bbox:d,halfPadding:c,label:r}},"insertLabel"),g=(0,s.eW)((t,e)=>{let a=e.node().getBBox();t.width=a.width,t.height=a.height},"updateNodeBounds"),y=(0,s.eW)((t,e)=>("handDrawn"===t.look?"rough-node":"node")+" "+t.cssClasses+" "+(e||""),"getNodeClasses");function f(t){let e=t.map((t,e)=>`${0===e?"M":"L"}${t.x},${t.y}`);return e.push("Z"),e.join(" ")}function p(t,e,a,l,r,i){let n=[],s=a-t,h=2*Math.PI/(s/i),o=e+(l-e)/2;for(let e=0;e<=50;e++){let a=t+e/50*s,l=o+r*Math.sin(h*(a-t));n.push({x:a,y:l})}return n}function u(t,e,a,l,r,i){let n=[],s=r*Math.PI/180,h=(i*Math.PI/180-s)/(l-1);for(let r=0;r<l;r++){let l=s+r*h,i=t+a*Math.cos(l),o=e+a*Math.sin(l);n.push({x:-i,y:-o})}return n}(0,s.eW)(f,"createPathFromPoints"),(0,s.eW)(p,"generateFullSineWavePoints"),(0,s.eW)(u,"generateCirclePoints");var m=(0,s.eW)((t,e)=>{var a,l,r=t.x,i=t.y,n=e.x-r,s=e.y-i,h=t.width/2,o=t.height/2;return Math.abs(s)*h>Math.abs(n)*o?(s<0&&(o=-o),a=0===s?0:o*n/s,l=o):(n<0&&(h=-h),a=h,l=0===n?0:h*s/n),{x:r+a,y:i+l}},"intersectRect");function x(t,e){e&&t.attr("style",e)}async function w(t){let e=(0,h.Ys)(document.createElementNS("http://www.w3.org/2000/svg","foreignObject")),a=e.append("xhtml:div"),l=t.label;t.label&&(0,s.l0)(t.label)&&(l=await (0,s.uT)(t.label.replace(s.SY.lineBreakRegex,"\n"),(0,s.nV)()));let r=t.isNode?"nodeLabel":"edgeLabel";return a.html('<span class="'+r+'" '+(t.labelStyle?'style="'+t.labelStyle+'"':"")+">"+l+"</span>"),x(a,t.labelStyle),a.style("display","inline-block"),a.style("padding-right","1px"),a.style("white-space","nowrap"),a.attr("xmlns","http://www.w3.org/1999/xhtml"),e.node()}(0,s.eW)(x,"applyStyle"),(0,s.eW)(w,"addHtmlLabel");var b=(0,s.eW)(async(t,e,a,l)=>{let r=t||"";if("object"==typeof r&&(r=r[0]),(0,s.ku)((0,s.nV)().flowchart.htmlLabels)){r=r.replace(/\\n|\n/g,"<br />"),s.cM.info("vertexText"+r);let t={isNode:l,label:(0,n.SH)(r).replace(/fa[blrs]?:fa-[\w-]+/g,t=>`<i class='${t.replace(":"," ")}'></i>`),labelStyle:e?e.replace("fill:","color:"):e};return await w(t)}{let t=document.createElementNS("http://www.w3.org/2000/svg","text");t.setAttribute("style",e.replace("color:","fill:"));for(let e of"string"==typeof r?r.split(/\\n|\n|<br\s*\/?>/gi):Array.isArray(r)?r:[]){let l=document.createElementNS("http://www.w3.org/2000/svg","tspan");l.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),l.setAttribute("dy","1em"),l.setAttribute("x","0"),a?l.setAttribute("class","title-row"):l.setAttribute("class","row"),l.textContent=e.trim(),t.appendChild(l)}return t}},"createLabel"),$=(0,s.eW)((t,e,a,l,r)=>["M",t+r,e,"H",t+a-r,"A",r,r,0,0,1,t+a,e+r,"V",e+l-r,"A",r,r,0,0,1,t+a-r,e+l,"H",t+r,"A",r,r,0,0,1,t,e+l-r,"V",e+r,"A",r,r,0,0,1,t+r,e,"Z"].join(" "),"createRoundedRectPathD"),k=(0,s.eW)(t=>{let{handDrawnSeed:e}=(0,s.nV)();return{fill:t,hachureAngle:120,hachureGap:4,fillWeight:2,roughness:.7,stroke:t,seed:e}},"solidStateFill"),M=(0,s.eW)(t=>{let e=S([...t.cssCompiledStyles||[],...t.cssStyles||[]]);return{stylesMap:e,stylesArray:[...e]}},"compileStyles"),S=(0,s.eW)(t=>{let e=new Map;return t.forEach(t=>{let[a,l]=t.split(":");e.set(a.trim(),l?.trim())}),e},"styles2Map"),D=(0,s.eW)(t=>{let{stylesArray:e}=M(t),a=[],l=[],r=[],i=[];return e.forEach(t=>{let e=t[0];"color"===e||"font-size"===e||"font-family"===e||"font-weight"===e||"font-style"===e||"text-decoration"===e||"text-align"===e||"text-transform"===e||"line-height"===e||"letter-spacing"===e||"word-spacing"===e||"text-shadow"===e||"text-overflow"===e||"white-space"===e||"word-wrap"===e||"word-break"===e||"overflow-wrap"===e||"hyphens"===e?a.push(t.join(":")+" !important"):(l.push(t.join(":")+" !important"),e.includes("stroke")&&r.push(t.join(":")+" !important"),"fill"===e&&i.push(t.join(":")+" !important"))}),{labelStyles:a.join(";"),nodeStyles:l.join(";"),stylesArray:e,borderStyles:r,backgroundStyles:i}},"styles2String"),W=(0,s.eW)((t,e)=>{let{themeVariables:a,handDrawnSeed:l}=(0,s.nV)(),{nodeBorder:r,mainBkg:i}=a,{stylesMap:n}=M(t);return Object.assign({roughness:.7,fill:n.get("fill")||i,fillStyle:"hachure",fillWeight:4,hachureGap:5.2,stroke:n.get("stroke")||r,seed:l,strokeWidth:n.get("stroke-width")?.replace("px","")||1.3,fillLineDash:[0,0]},e)},"userNodeOverrides"),v=(0,s.eW)(async(t,e)=>{let a;s.cM.info("Creating subgraph rect for ",e.id,e);let l=(0,s.nV)(),{themeVariables:n,handDrawnSeed:d}=l,{clusterBkg:c,clusterBorder:g}=n,{labelStyles:y,nodeStyles:f,borderStyles:p,backgroundStyles:u}=D(e),x=t.insert("g").attr("class","cluster "+e.cssClasses).attr("id",e.id).attr("data-look",e.look),w=(0,s.ku)(l.flowchart.htmlLabels),b=x.insert("g").attr("class","cluster-label "),k=await (0,i.rw)(b,e.label,{style:e.labelStyle,useHtmlLabels:w,isNode:!0}),M=k.getBBox();if((0,s.ku)(l.flowchart.htmlLabels)){let t=k.children[0],e=(0,h.Ys)(k);M=t.getBoundingClientRect(),e.attr("width",M.width),e.attr("height",M.height)}let S=e.width<=M.width+e.padding?M.width+e.padding:e.width;e.width<=M.width+e.padding?e.diff=(S-e.width)/2-e.padding:e.diff=-e.padding;let v=e.height,N=e.x-S/2,C=e.y-v/2;if(s.cM.trace("Data ",e,JSON.stringify(e)),"handDrawn"===e.look){let t=o.Z.svg(x),l=W(e,{roughness:.7,fill:c,stroke:g,fillWeight:3,seed:d}),r=t.path($(N,C,S,v,0),l);(a=x.insert(()=>(s.cM.debug("Rough node insert CXC",r),r),":first-child")).select("path:nth-child(2)").attr("style",p.join(";")),a.select("path").attr("style",u.join(";").replace("fill","stroke"))}else(a=x.insert("rect",":first-child")).attr("style",f).attr("rx",e.rx).attr("ry",e.ry).attr("x",N).attr("y",C).attr("width",S).attr("height",v);let{subGraphTitleTopMargin:B}=(0,r.L)(l);if(b.attr("transform",`translate(${e.x-M.width/2}, ${e.y-e.height/2+B})`),y){let t=b.select("span");t&&t.attr("style",y)}let A=a.node().getBBox();return e.offsetX=0,e.width=A.width,e.height=A.height,e.offsetY=M.height-e.padding/2,e.intersect=function(t){return m(e,t)},{cluster:x,labelBBox:M}},"rect"),N=(0,s.eW)((t,e)=>{let a=t.insert("g").attr("class","note-cluster").attr("id",e.id),l=a.insert("rect",":first-child"),r=0*e.padding,i=r/2;l.attr("rx",e.rx).attr("ry",e.ry).attr("x",e.x-e.width/2-i).attr("y",e.y-e.height/2-i).attr("width",e.width+r).attr("height",e.height+r).attr("fill","none");let n=l.node().getBBox();return e.width=n.width,e.height=n.height,e.intersect=function(t){return m(e,t)},{cluster:a,labelBBox:{width:0,height:0}}},"noteGroup"),C=(0,s.eW)(async(t,e)=>{let a;let l=(0,s.nV)(),{themeVariables:r,handDrawnSeed:i}=l,{altBackground:n,compositeBackground:d,compositeTitleBackground:c,nodeBorder:g}=r,y=t.insert("g").attr("class",e.cssClasses).attr("id",e.id).attr("data-id",e.id).attr("data-look",e.look),f=y.insert("g",":first-child"),p=y.insert("g").attr("class","cluster-label"),u=y.append("rect"),x=p.node().appendChild(await b(e.label,e.labelStyle,void 0,!0)),w=x.getBBox();if((0,s.ku)(l.flowchart.htmlLabels)){let t=x.children[0],e=(0,h.Ys)(x);w=t.getBoundingClientRect(),e.attr("width",w.width),e.attr("height",w.height)}let k=0*e.padding,M=(e.width<=w.width+e.padding?w.width+e.padding:e.width)+k;e.width<=w.width+e.padding?e.diff=(M-e.width)/2-e.padding:e.diff=-e.padding;let S=e.height+k,D=e.height+k-w.height-6,W=e.x-M/2,v=e.y-S/2;e.width=M;let N=e.y-e.height/2-k/2+w.height+2;if("handDrawn"===e.look){let t=e.cssClasses.includes("statediagram-cluster-alt"),l=o.Z.svg(y),r=e.rx||e.ry?l.path($(W,v,M,S,10),{roughness:.7,fill:c,fillStyle:"solid",stroke:g,seed:i}):l.rectangle(W,v,M,S,{seed:i});a=y.insert(()=>r,":first-child");let s=l.rectangle(W,N,M,D,{fill:t?n:d,fillStyle:t?"hachure":"solid",stroke:g,seed:i});a=y.insert(()=>r,":first-child"),u=y.insert(()=>s)}else(a=f.insert("rect",":first-child")).attr("class","outer").attr("x",W).attr("y",v).attr("width",M).attr("height",S).attr("data-look",e.look),u.attr("class","inner").attr("x",W).attr("y",N).attr("width",M).attr("height",D);p.attr("transform",`translate(${e.x-w.width/2}, ${v+1-((0,s.ku)(l.flowchart.htmlLabels)?0:3)})`);let C=a.node().getBBox();return e.height=C.height,e.offsetX=0,e.offsetY=w.height-e.padding/2,e.labelBBox=w,e.intersect=function(t){return m(e,t)},{cluster:y,labelBBox:w}},"roundedWithTitle"),B=(0,s.eW)(async(t,e)=>{let a;s.cM.info("Creating subgraph rect for ",e.id,e);let l=(0,s.nV)(),{themeVariables:n,handDrawnSeed:d}=l,{clusterBkg:c,clusterBorder:g}=n,{labelStyles:y,nodeStyles:f,borderStyles:p,backgroundStyles:u}=D(e),x=t.insert("g").attr("class","cluster "+e.cssClasses).attr("id",e.id).attr("data-look",e.look),w=(0,s.ku)(l.flowchart.htmlLabels),b=x.insert("g").attr("class","cluster-label "),k=await (0,i.rw)(b,e.label,{style:e.labelStyle,useHtmlLabels:w,isNode:!0,width:e.width}),M=k.getBBox();if((0,s.ku)(l.flowchart.htmlLabels)){let t=k.children[0],e=(0,h.Ys)(k);M=t.getBoundingClientRect(),e.attr("width",M.width),e.attr("height",M.height)}let S=e.width<=M.width+e.padding?M.width+e.padding:e.width;e.width<=M.width+e.padding?e.diff=(S-e.width)/2-e.padding:e.diff=-e.padding;let v=e.height,N=e.x-S/2,C=e.y-v/2;if(s.cM.trace("Data ",e,JSON.stringify(e)),"handDrawn"===e.look){let t=o.Z.svg(x),l=W(e,{roughness:.7,fill:c,stroke:g,fillWeight:4,seed:d}),r=t.path($(N,C,S,v,e.rx),l);(a=x.insert(()=>(s.cM.debug("Rough node insert CXC",r),r),":first-child")).select("path:nth-child(2)").attr("style",p.join(";")),a.select("path").attr("style",u.join(";").replace("fill","stroke"))}else(a=x.insert("rect",":first-child")).attr("style",f).attr("rx",e.rx).attr("ry",e.ry).attr("x",N).attr("y",C).attr("width",S).attr("height",v);let{subGraphTitleTopMargin:B}=(0,r.L)(l);if(b.attr("transform",`translate(${e.x-M.width/2}, ${e.y-e.height/2+B})`),y){let t=b.select("span");t&&t.attr("style",y)}let A=a.node().getBBox();return e.offsetX=0,e.width=A.width,e.height=A.height,e.offsetY=M.height-e.padding/2,e.intersect=function(t){return m(e,t)},{cluster:x,labelBBox:M}},"kanbanSection"),A={rect:v,squareRect:v,roundedWithTitle:C,noteGroup:N,divider:(0,s.eW)((t,e)=>{let a;let{themeVariables:l,handDrawnSeed:r}=(0,s.nV)(),{nodeBorder:i}=l,n=t.insert("g").attr("class",e.cssClasses).attr("id",e.id).attr("data-look",e.look),h=n.insert("g",":first-child"),d=0*e.padding,c=e.width+d;e.diff=-e.padding;let g=e.height+d,y=e.x-c/2,f=e.y-g/2;if(e.width=c,"handDrawn"===e.look){let t=o.Z.svg(n).rectangle(y,f,c,g,{fill:"lightgrey",roughness:.5,strokeLineDash:[5],stroke:i,seed:r});a=n.insert(()=>t,":first-child")}else(a=h.insert("rect",":first-child")).attr("class","divider").attr("x",y).attr("y",f).attr("width",c).attr("height",g).attr("data-look",e.look);let p=a.node().getBBox();return e.height=p.height,e.offsetX=0,e.offsetY=0,e.intersect=function(t){return m(e,t)},{cluster:n,labelBBox:{}}},"divider"),kanbanSection:B},R=new Map,L=(0,s.eW)(async(t,e)=>{let a=e.shape||"rect",l=await A[a](t,e);return R.set(e.id,l),l},"insertCluster"),P=(0,s.eW)(()=>{R=new Map},"clear");function Z(t,e,a,l){var r=t.x,i=t.y,n=r-l.x,s=i-l.y,h=Math.sqrt(e*e*s*s+a*a*n*n),o=Math.abs(e*a*n/h);l.x<r&&(o=-o);var d=Math.abs(e*a*s/h);return l.y<i&&(d=-d),{x:r+o,y:i+d}}function I(t,e,a){return Z(t,e,e,a)}function T(t,e,a,l){var r,i,n,s,h,o,d,c,g,y,f,p,u;if(r=e.y-t.y,n=t.x-e.x,h=e.x*t.y-t.x*e.y,g=r*a.x+n*a.y+h,y=r*l.x+n*l.y+h,!(0!==g&&0!==y&&E(g,y))&&(i=l.y-a.y,s=a.x-l.x,o=l.x*a.y-a.x*l.y,d=i*t.x+s*t.y+o,c=i*e.x+s*e.y+o,!(0!==d&&0!==c&&E(d,c))&&0!=(f=r*s-i*n)))return p=Math.abs(f/2),{x:(u=n*o-s*h)<0?(u-p)/f:(u+p)/f,y:(u=i*h-r*o)<0?(u-p)/f:(u+p)/f}}function E(t,e){return t*e>0}function H(t,e,a){let l=t.x,r=t.y,i=[],n=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY;"function"==typeof e.forEach?e.forEach(function(t){n=Math.min(n,t.x),s=Math.min(s,t.y)}):(n=Math.min(n,e.x),s=Math.min(s,e.y));let h=l-t.width/2-n,o=r-t.height/2-s;for(let l=0;l<e.length;l++){let r=e[l],n=e[l<e.length-1?l+1:0],s=T(t,a,{x:h+r.x,y:o+r.y},{x:h+n.x,y:o+n.y});s&&i.push(s)}return i.length?(i.length>1&&i.sort(function(t,e){let l=t.x-a.x,r=t.y-a.y,i=Math.sqrt(l*l+r*r),n=e.x-a.x,s=e.y-a.y,h=Math.sqrt(n*n+s*s);return i<h?-1:i===h?0:1}),i[0]):t}(0,s.eW)(function(t,e){return t.intersect(e)},"intersectNode"),(0,s.eW)(Z,"intersectEllipse"),(0,s.eW)(I,"intersectCircle"),(0,s.eW)(T,"intersectLine"),(0,s.eW)(E,"sameSign"),(0,s.eW)(H,"intersectPolygon");var V={circle:I,polygon:H,rect:m};function j(t,e){let{labelStyles:a}=D(e);e.labelStyle=a;let l=y(e),r=l;l||(r="anchor");let i=t.insert("g").attr("class",r).attr("id",e.domId||e.id),{cssStyles:h}=e,d=o.Z.svg(i),c=W(e,{fill:"black",stroke:"none",fillStyle:"solid"});"handDrawn"!==e.look&&(c.roughness=0);let f=d.circle(0,0,2,c),p=i.insert(()=>f,":first-child");return p.attr("class","anchor").attr("style",(0,n.R7)(h)),g(e,p),e.intersect=function(t){return s.cM.info("Circle intersect",e,1,t),V.circle(e,1,t)},i}function _(t,e,a,l,r,i,n){let s=Math.atan2(l-e,a-t),h=Math.sqrt(((a-t)/2/r)**2+((l-e)/2/i)**2);if(h>1)throw Error("The given radii are too small to create an arc between the points.");let o=Math.sqrt(1-h**2),d=(t+a)/2+o*i*Math.sin(s)*(n?-1:1),c=(e+l)/2-o*r*Math.cos(s)*(n?-1:1),g=Math.atan2((e-c)/i,(t-d)/r),y=Math.atan2((l-c)/i,(a-d)/r)-g;n&&y<0&&(y+=2*Math.PI),!n&&y>0&&(y-=2*Math.PI);let f=[];for(let t=0;t<20;t++){let e=g+t/19*y,a=d+r*Math.cos(e),l=c+i*Math.sin(e);f.push({x:a,y:l})}return f}async function Y(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a;let{shapeSvg:r,bbox:i}=await d(t,e,y(e)),n=i.width+e.padding+20,s=i.height+e.padding,h=s/2,c=h/(2.5+s/50),{cssStyles:p}=e,u=[{x:n/2,y:-s/2},{x:-n/2,y:-s/2},..._(-n/2,-s/2,-n/2,s/2,c,h,!1),{x:n/2,y:s/2},..._(n/2,s/2,n/2,-s/2,c,h,!0)],m=o.Z.svg(r),x=W(e,{});"handDrawn"!==e.look&&(x.roughness=0,x.fillStyle="solid");let w=f(u),b=m.path(w,x),$=r.insert(()=>b,":first-child");return $.attr("class","basic label-container"),p&&"handDrawn"!==e.look&&$.selectAll("path").attr("style",p),l&&"handDrawn"!==e.look&&$.selectAll("path").attr("style",l),$.attr("transform",`translate(${c/2}, 0)`),g(e,$),e.intersect=function(t){return V.polygon(e,u,t)},r}function z(t,e,a,l){return t.insert("polygon",":first-child").attr("points",l.map(function(t){return t.x+","+t.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-e/2+","+a/2+")")}async function q(t,e){let a;let{labelStyles:l,nodeStyles:r}=D(e);e.labelStyle=l;let{shapeSvg:i,bbox:n}=await d(t,e,y(e)),s=n.height+e.padding,h=n.width+e.padding+12,c=-s,p=[{x:12,y:c},{x:h,y:c},{x:h,y:0},{x:0,y:0},{x:0,y:c+12},{x:12,y:c}],{cssStyles:u}=e;if("handDrawn"===e.look){let t=o.Z.svg(i),l=W(e,{}),r=f(p),n=t.path(r,l);a=i.insert(()=>n,":first-child").attr("transform",`translate(${-h/2}, ${s/2})`),u&&a.attr("style",u)}else a=z(i,h,s,p);return r&&a.attr("style",r),g(e,a),e.intersect=function(t){return V.polygon(e,p,t)},i}function O(t,e){let{nodeStyles:a}=D(e);e.label="";let l=t.insert("g").attr("class",y(e)).attr("id",e.domId??e.id),{cssStyles:r}=e,i=Math.max(28,e.width??0),n=[{x:0,y:i/2},{x:i/2,y:0},{x:0,y:-i/2},{x:-i/2,y:0}],s=o.Z.svg(l),h=W(e,{});"handDrawn"!==e.look&&(h.roughness=0,h.fillStyle="solid");let d=f(n),c=s.path(d,h),g=l.insert(()=>c,":first-child");return r&&"handDrawn"!==e.look&&g.selectAll("path").attr("style",r),a&&"handDrawn"!==e.look&&g.selectAll("path").attr("style",a),e.width=28,e.height=28,e.intersect=function(t){return V.polygon(e,n,t)},l}async function F(t,e){let a;let{labelStyles:l,nodeStyles:r}=D(e);e.labelStyle=l;let{shapeSvg:i,bbox:h,halfPadding:c}=await d(t,e,y(e)),f=h.width/2+c,{cssStyles:p}=e;if("handDrawn"===e.look){let t=o.Z.svg(i),l=W(e,{}),r=t.circle(0,0,2*f,l);(a=i.insert(()=>r,":first-child")).attr("class","basic label-container").attr("style",(0,n.R7)(p))}else a=i.insert("circle",":first-child").attr("class","basic label-container").attr("style",r).attr("r",f).attr("cx",0).attr("cy",0);return g(e,a),e.intersect=function(t){return s.cM.info("Circle intersect",e,f,t),V.circle(e,f,t)},i}function X(t){let e=Math.cos(Math.PI/4),a=Math.sin(Math.PI/4),l=2*t,r={x:l/2*e,y:l/2*a},i={x:-(l/2)*e,y:l/2*a},n={x:-(l/2)*e,y:-(l/2)*a},s={x:l/2*e,y:-(l/2)*a};return`M ${i.x},${i.y} L ${s.x},${s.y}
2
+ M ${r.x},${r.y} L ${n.x},${n.y}`}function J(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a,e.label="";let r=t.insert("g").attr("class",y(e)).attr("id",e.domId??e.id),i=Math.max(30,e?.width??0),{cssStyles:n}=e,h=o.Z.svg(r),d=W(e,{});"handDrawn"!==e.look&&(d.roughness=0,d.fillStyle="solid");let c=h.circle(0,0,2*i,d),f=X(i),p=h.path(f,d),u=r.insert(()=>c,":first-child");return u.insert(()=>p),n&&"handDrawn"!==e.look&&u.selectAll("path").attr("style",n),l&&"handDrawn"!==e.look&&u.selectAll("path").attr("style",l),g(e,u),e.intersect=function(t){return s.cM.info("crossedCircle intersect",e,{radius:i,point:t}),V.circle(e,i,t)},r}function G(t,e,a,l=100,r=0,i=180){let n=[],s=r*Math.PI/180,h=(i*Math.PI/180-s)/(l-1);for(let r=0;r<l;r++){let l=s+r*h,i=t+a*Math.cos(l),o=e+a*Math.sin(l);n.push({x:-i,y:-o})}return n}async function U(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a;let{shapeSvg:r,bbox:i,label:n}=await d(t,e,y(e)),s=i.width+(e.padding??0),h=i.height+(e.padding??0),c=Math.max(5,.1*h),{cssStyles:p}=e,u=[...G(s/2,-h/2,c,30,-90,0),{x:-s/2-c,y:c},...G(s/2+2*c,-c,c,20,-180,-270),...G(s/2+2*c,c,c,20,-90,-180),{x:-s/2-c,y:-h/2},...G(s/2,h/2,c,20,0,90)],m=[{x:s/2,y:-h/2-c},{x:-s/2,y:-h/2-c},...G(s/2,-h/2,c,20,-90,0),{x:-s/2-c,y:-c},...G(s/2+.1*s,-c,c,20,-180,-270),...G(s/2+.1*s,c,c,20,-90,-180),{x:-s/2-c,y:h/2},...G(s/2,h/2,c,20,0,90),{x:-s/2,y:h/2+c},{x:s/2,y:h/2+c}],x=o.Z.svg(r),w=W(e,{fill:"none"});"handDrawn"!==e.look&&(w.roughness=0,w.fillStyle="solid");let b=f(u).replace("Z",""),$=x.path(b,w),k=f(m),M=x.path(k,{...w}),S=r.insert("g",":first-child");return S.insert(()=>M,":first-child").attr("stroke-opacity",0),S.insert(()=>$,":first-child"),S.attr("class","text"),p&&"handDrawn"!==e.look&&S.selectAll("path").attr("style",p),l&&"handDrawn"!==e.look&&S.selectAll("path").attr("style",l),S.attr("transform",`translate(${c}, 0)`),n.attr("transform",`translate(${-s/2+c-(i.x-(i.left??0))},${-h/2+(e.padding??0)/2-(i.y-(i.top??0))})`),g(e,S),e.intersect=function(t){return V.polygon(e,m,t)},r}function K(t,e,a,l=100,r=0,i=180){let n=[],s=r*Math.PI/180,h=(i*Math.PI/180-s)/(l-1);for(let r=0;r<l;r++){let l=s+r*h,i=t+a*Math.cos(l),o=e+a*Math.sin(l);n.push({x:i,y:o})}return n}async function Q(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a;let{shapeSvg:r,bbox:i,label:n}=await d(t,e,y(e)),s=i.width+(e.padding??0),h=i.height+(e.padding??0),c=Math.max(5,.1*h),{cssStyles:p}=e,u=[...K(s/2,-h/2,c,20,-90,0),{x:s/2+c,y:-c},...K(s/2+2*c,-c,c,20,-180,-270),...K(s/2+2*c,c,c,20,-90,-180),{x:s/2+c,y:h/2},...K(s/2,h/2,c,20,0,90)],m=[{x:-s/2,y:-h/2-c},{x:s/2,y:-h/2-c},...K(s/2,-h/2,c,20,-90,0),{x:s/2+c,y:-c},...K(s/2+2*c,-c,c,20,-180,-270),...K(s/2+2*c,c,c,20,-90,-180),{x:s/2+c,y:h/2},...K(s/2,h/2,c,20,0,90),{x:s/2,y:h/2+c},{x:-s/2,y:h/2+c}],x=o.Z.svg(r),w=W(e,{fill:"none"});"handDrawn"!==e.look&&(w.roughness=0,w.fillStyle="solid");let b=f(u).replace("Z",""),$=x.path(b,w),k=f(m),M=x.path(k,{...w}),S=r.insert("g",":first-child");return S.insert(()=>M,":first-child").attr("stroke-opacity",0),S.insert(()=>$,":first-child"),S.attr("class","text"),p&&"handDrawn"!==e.look&&S.selectAll("path").attr("style",p),l&&"handDrawn"!==e.look&&S.selectAll("path").attr("style",l),S.attr("transform",`translate(${-c}, 0)`),n.attr("transform",`translate(${-s/2+(e.padding??0)/2-(i.x-(i.left??0))},${-h/2+(e.padding??0)/2-(i.y-(i.top??0))})`),g(e,S),e.intersect=function(t){return V.polygon(e,m,t)},r}function tt(t,e,a,l=100,r=0,i=180){let n=[],s=r*Math.PI/180,h=(i*Math.PI/180-s)/(l-1);for(let r=0;r<l;r++){let l=s+r*h,i=t+a*Math.cos(l),o=e+a*Math.sin(l);n.push({x:-i,y:-o})}return n}async function te(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a;let{shapeSvg:r,bbox:i,label:n}=await d(t,e,y(e)),s=i.width+(e.padding??0),h=i.height+(e.padding??0),c=Math.max(5,.1*h),{cssStyles:p}=e,u=[...tt(s/2,-h/2,c,30,-90,0),{x:-s/2-c,y:c},...tt(s/2+2*c,-c,c,20,-180,-270),...tt(s/2+2*c,c,c,20,-90,-180),{x:-s/2-c,y:-h/2},...tt(s/2,h/2,c,20,0,90)],m=[...tt(-s/2+c+c/2,-h/2,c,20,-90,-180),{x:s/2-c/2,y:c},...tt(-s/2-c/2,-c,c,20,0,90),...tt(-s/2-c/2,c,c,20,-90,0),{x:s/2-c/2,y:-c},...tt(-s/2+c+c/2,h/2,c,30,-180,-270)],x=[{x:s/2,y:-h/2-c},{x:-s/2,y:-h/2-c},...tt(s/2,-h/2,c,20,-90,0),{x:-s/2-c,y:-c},...tt(s/2+2*c,-c,c,20,-180,-270),...tt(s/2+2*c,c,c,20,-90,-180),{x:-s/2-c,y:h/2},...tt(s/2,h/2,c,20,0,90),{x:-s/2,y:h/2+c},{x:s/2-c-c/2,y:h/2+c},...tt(-s/2+c+c/2,-h/2,c,20,-90,-180),{x:s/2-c/2,y:c},...tt(-s/2-c/2,-c,c,20,0,90),...tt(-s/2-c/2,c,c,20,-90,0),{x:s/2-c/2,y:-c},...tt(-s/2+c+c/2,h/2,c,30,-180,-270)],w=o.Z.svg(r),b=W(e,{fill:"none"});"handDrawn"!==e.look&&(b.roughness=0,b.fillStyle="solid");let $=f(u).replace("Z",""),k=w.path($,b),M=f(m).replace("Z",""),S=w.path(M,b),v=f(x),N=w.path(v,{...b}),C=r.insert("g",":first-child");return C.insert(()=>N,":first-child").attr("stroke-opacity",0),C.insert(()=>k,":first-child"),C.insert(()=>S,":first-child"),C.attr("class","text"),p&&"handDrawn"!==e.look&&C.selectAll("path").attr("style",p),l&&"handDrawn"!==e.look&&C.selectAll("path").attr("style",l),C.attr("transform",`translate(${c-c/4}, 0)`),n.attr("transform",`translate(${-s/2+(e.padding??0)/2-(i.x-(i.left??0))},${-h/2+(e.padding??0)/2-(i.y-(i.top??0))})`),g(e,C),e.intersect=function(t){return V.polygon(e,x,t)},r}async function ta(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a;let{shapeSvg:r,bbox:i}=await d(t,e,y(e)),n=Math.max(80,(i.width+(e.padding??0)*2)*1.25,e?.width??0),s=Math.max(20,i.height+(e.padding??0)*2,e?.height??0),h=s/2,{cssStyles:c}=e,p=o.Z.svg(r),m=W(e,{});"handDrawn"!==e.look&&(m.roughness=0,m.fillStyle="solid");let x=n-h,w=s/4,b=[{x:x,y:0},{x:w,y:0},{x:0,y:s/2},{x:w,y:s},{x:x,y:s},...u(-x,-s/2,h,50,270,90)],$=f(b),k=p.path($,m),M=r.insert(()=>k,":first-child");return M.attr("class","basic label-container"),c&&"handDrawn"!==e.look&&M.selectChildren("path").attr("style",c),l&&"handDrawn"!==e.look&&M.selectChildren("path").attr("style",l),M.attr("transform",`translate(${-n/2}, ${-s/2})`),g(e,M),e.intersect=function(t){return V.polygon(e,b,t)},r}(0,s.eW)(j,"anchor"),(0,s.eW)(_,"generateArcPoints"),(0,s.eW)(Y,"bowTieRect"),(0,s.eW)(z,"insertPolygonShape"),(0,s.eW)(q,"card"),(0,s.eW)(O,"choice"),(0,s.eW)(F,"circle"),(0,s.eW)(X,"createLine"),(0,s.eW)(J,"crossedCircle"),(0,s.eW)(G,"generateCirclePoints"),(0,s.eW)(U,"curlyBraceLeft"),(0,s.eW)(K,"generateCirclePoints"),(0,s.eW)(Q,"curlyBraceRight"),(0,s.eW)(tt,"generateCirclePoints"),(0,s.eW)(te,"curlyBraces"),(0,s.eW)(ta,"curvedTrapezoid");var tl=(0,s.eW)((t,e,a,l,r,i)=>`M${t},${e+i} a${r},${i} 0,0,0 ${a},0 a${r},${i} 0,0,0 ${-a},0 l0,${l} a${r},${i} 0,0,0 ${a},0 l0,${-l}`,"createCylinderPathD"),tr=(0,s.eW)((t,e,a,l,r,i)=>`M${t},${e+i} M${t+a},${e+i} a${r},${i} 0,0,0 ${-a},0 l0,${l} a${r},${i} 0,0,0 ${a},0 l0,${-l}`,"createOuterCylinderPathD"),ti=(0,s.eW)((t,e,a,l,r,i)=>`M${t-a/2},${-l/2} a${r},${i} 0,0,0 ${a},0`,"createInnerCylinderPathD");async function tn(t,e){let a;let{labelStyles:l,nodeStyles:r}=D(e);e.labelStyle=l;let{shapeSvg:i,bbox:s,label:h}=await d(t,e,y(e)),c=Math.max(s.width+e.padding,e.width??0),f=c/2,p=f/(2.5+c/50),u=Math.max(s.height+p+e.padding,e.height??0),{cssStyles:m}=e;if("handDrawn"===e.look){let t=o.Z.svg(i),l=tr(0,0,c,u,f,p),r=ti(0,p,c,u,f,p),n=t.path(l,W(e,{})),s=t.path(r,W(e,{fill:"none"}));a=i.insert(()=>s,":first-child"),(a=i.insert(()=>n,":first-child")).attr("class","basic label-container"),m&&a.attr("style",m)}else{let t=tl(0,0,c,u,f,p);a=i.insert("path",":first-child").attr("d",t).attr("class","basic label-container").attr("style",(0,n.R7)(m)).attr("style",r)}return a.attr("label-offset-y",p),a.attr("transform",`translate(${-c/2}, ${-(u/2+p)})`),g(e,a),h.attr("transform",`translate(${-(s.width/2)-(s.x-(s.left??0))}, ${-(s.height/2)+(e.padding??0)/1.5-(s.y-(s.top??0))})`),e.intersect=function(t){let a=V.rect(e,t),l=a.x-(e.x??0);if(0!=f&&(Math.abs(l)<(e.width??0)/2||Math.abs(l)==(e.width??0)/2&&Math.abs(a.y-(e.y??0))>(e.height??0)/2-p)){let r=p*p*(1-l*l/(f*f));r>0&&(r=Math.sqrt(r)),r=p-r,t.y-(e.y??0)>0&&(r=-r),a.y+=r}return a},i}async function ts(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a;let{shapeSvg:r,bbox:i,label:n}=await d(t,e,y(e)),s=i.width+e.padding,h=i.height+e.padding,c=.2*h,f=-s/2,p=-h/2-c/2,{cssStyles:u}=e,m=o.Z.svg(r),x=W(e,{});"handDrawn"!==e.look&&(x.roughness=0,x.fillStyle="solid");let w=m.polygon([{x:f,y:p+c},{x:-f,y:p+c},{x:-f,y:-p},{x:f,y:-p},{x:f,y:p},{x:-f,y:p},{x:-f,y:p+c}].map(t=>[t.x,t.y]),x),b=r.insert(()=>w,":first-child");return b.attr("class","basic label-container"),u&&"handDrawn"!==e.look&&b.selectAll("path").attr("style",u),l&&"handDrawn"!==e.look&&b.selectAll("path").attr("style",l),n.attr("transform",`translate(${f+(e.padding??0)/2-(i.x-(i.left??0))}, ${p+c+(e.padding??0)/2-(i.y-(i.top??0))})`),g(e,b),e.intersect=function(t){return V.rect(e,t)},r}async function th(t,e){let a;let{labelStyles:l,nodeStyles:r}=D(e);e.labelStyle=l;let{shapeSvg:i,bbox:h,halfPadding:c}=await d(t,e,y(e)),f=h.width/2+c+5,p=h.width/2+c,{cssStyles:u}=e;if("handDrawn"===e.look){let t=o.Z.svg(i),l=W(e,{roughness:.2,strokeWidth:2.5}),r=W(e,{roughness:.2,strokeWidth:1.5}),s=t.circle(0,0,2*f,l),h=t.circle(0,0,2*p,r);(a=i.insert("g",":first-child")).attr("class",(0,n.R7)(e.cssClasses)).attr("style",(0,n.R7)(u)),a.node()?.appendChild(s),a.node()?.appendChild(h)}else{let t=(a=i.insert("g",":first-child")).insert("circle",":first-child"),e=a.insert("circle");a.attr("class","basic label-container").attr("style",r),t.attr("class","outer-circle").attr("style",r).attr("r",f).attr("cx",0).attr("cy",0),e.attr("class","inner-circle").attr("style",r).attr("r",p).attr("cx",0).attr("cy",0)}return g(e,a),e.intersect=function(t){return s.cM.info("DoubleCircle intersect",e,f,t),V.circle(e,f,t)},i}function to(t,e,{config:{themeVariables:a}}){let{labelStyles:l,nodeStyles:r}=D(e);e.label="",e.labelStyle=l;let i=t.insert("g").attr("class",y(e)).attr("id",e.domId??e.id),{cssStyles:n}=e,h=o.Z.svg(i),{nodeBorder:d}=a,c=W(e,{fillStyle:"solid"});"handDrawn"!==e.look&&(c.roughness=0);let f=h.circle(0,0,14,c),p=i.insert(()=>f,":first-child");return p.selectAll("path").attr("style",`fill: ${d} !important;`),n&&n.length>0&&"handDrawn"!==e.look&&p.selectAll("path").attr("style",n),r&&"handDrawn"!==e.look&&p.selectAll("path").attr("style",r),g(e,p),e.intersect=function(t){return s.cM.info("filledCircle intersect",e,{radius:7,point:t}),V.circle(e,7,t)},i}async function td(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a;let{shapeSvg:r,bbox:i,label:n}=await d(t,e,y(e)),h=i.width+(e.padding??0),c=h+i.height,p=h+i.height,u=[{x:0,y:-c},{x:p,y:-c},{x:p/2,y:0}],{cssStyles:m}=e,x=o.Z.svg(r),w=W(e,{});"handDrawn"!==e.look&&(w.roughness=0,w.fillStyle="solid");let b=f(u),$=x.path(b,w),k=r.insert(()=>$,":first-child").attr("transform",`translate(${-c/2}, ${c/2})`);return m&&"handDrawn"!==e.look&&k.selectChildren("path").attr("style",m),l&&"handDrawn"!==e.look&&k.selectChildren("path").attr("style",l),e.width=h,e.height=c,g(e,k),n.attr("transform",`translate(${-i.width/2-(i.x-(i.left??0))}, ${-c/2+(e.padding??0)/2+(i.y-(i.top??0))})`),e.intersect=function(t){return s.cM.info("Triangle intersect",e,u,t),V.polygon(e,u,t)},r}function tc(t,e,{dir:a,config:{state:l,themeVariables:r}}){let{nodeStyles:i}=D(e);e.label="";let n=t.insert("g").attr("class",y(e)).attr("id",e.domId??e.id),{cssStyles:s}=e,h=Math.max(70,e?.width??0),d=Math.max(10,e?.height??0);"LR"===a&&(h=Math.max(10,e?.width??0),d=Math.max(70,e?.height??0));let c=-1*h/2,f=-1*d/2,p=o.Z.svg(n),u=W(e,{stroke:r.lineColor,fill:r.lineColor});"handDrawn"!==e.look&&(u.roughness=0,u.fillStyle="solid");let m=p.rectangle(c,f,h,d,u),x=n.insert(()=>m,":first-child");s&&"handDrawn"!==e.look&&x.selectAll("path").attr("style",s),i&&"handDrawn"!==e.look&&x.selectAll("path").attr("style",i),g(e,x);let w=l?.padding??0;return e.width&&e.height&&(e.width+=w/2||0,e.height+=w/2||0),e.intersect=function(t){return V.rect(e,t)},n}async function tg(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a;let{shapeSvg:r,bbox:i}=await d(t,e,y(e)),n=Math.max(80,i.width+(e.padding??0)*2,e?.width??0),h=Math.max(50,i.height+(e.padding??0)*2,e?.height??0),c=h/2,{cssStyles:p}=e,m=o.Z.svg(r),x=W(e,{});"handDrawn"!==e.look&&(x.roughness=0,x.fillStyle="solid");let w=[{x:-n/2,y:-h/2},{x:n/2-c,y:-h/2},...u(-n/2+c,0,c,50,90,270),{x:n/2-c,y:h/2},{x:-n/2,y:h/2}],b=f(w),$=m.path(b,x),k=r.insert(()=>$,":first-child");return k.attr("class","basic label-container"),p&&"handDrawn"!==e.look&&k.selectChildren("path").attr("style",p),l&&"handDrawn"!==e.look&&k.selectChildren("path").attr("style",l),g(e,k),e.intersect=function(t){return s.cM.info("Pill intersect",e,{radius:c,point:t}),V.polygon(e,w,t)},r}(0,s.eW)(tn,"cylinder"),(0,s.eW)(ts,"dividedRectangle"),(0,s.eW)(th,"doublecircle"),(0,s.eW)(to,"filledCircle"),(0,s.eW)(td,"flippedTriangle"),(0,s.eW)(tc,"forkJoin"),(0,s.eW)(tg,"halfRoundedRectangle");var ty=(0,s.eW)((t,e,a,l,r)=>`M${t+r},${e} L${t+a-r},${e} L${t+a},${e-l/2} L${t+a-r},${e-l} L${t+r},${e-l} L${t},${e-l/2} Z`,"createHexagonPathD");async function tf(t,e){let a;let{labelStyles:l,nodeStyles:r}=D(e);e.labelStyle=l;let{shapeSvg:i,bbox:n}=await d(t,e,y(e)),s=n.height+e.padding,h=s/4,c=n.width+2*h+e.padding,f=[{x:h,y:0},{x:c-h,y:0},{x:c,y:-s/2},{x:c-h,y:-s},{x:h,y:-s},{x:0,y:-s/2}],{cssStyles:p}=e;if("handDrawn"===e.look){let t=o.Z.svg(i),l=W(e,{}),r=ty(0,0,c,s,h),n=t.path(r,l);a=i.insert(()=>n,":first-child").attr("transform",`translate(${-c/2}, ${s/2})`),p&&a.attr("style",p)}else a=z(i,c,s,f);return r&&a.attr("style",r),e.width=c,e.height=s,g(e,a),e.intersect=function(t){return V.polygon(e,f,t)},i}async function tp(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.label="",e.labelStyle=a;let{shapeSvg:r}=await d(t,e,y(e)),i=Math.max(30,e?.width??0),n=Math.max(30,e?.height??0),{cssStyles:h}=e,c=o.Z.svg(r),p=W(e,{});"handDrawn"!==e.look&&(p.roughness=0,p.fillStyle="solid");let u=[{x:0,y:0},{x:i,y:0},{x:0,y:n},{x:i,y:n}],m=f(u),x=c.path(m,p),w=r.insert(()=>x,":first-child");return w.attr("class","basic label-container"),h&&"handDrawn"!==e.look&&w.selectChildren("path").attr("style",h),l&&"handDrawn"!==e.look&&w.selectChildren("path").attr("style",l),w.attr("transform",`translate(${-i/2}, ${-n/2})`),g(e,w),e.intersect=function(t){return s.cM.info("Pill intersect",e,{points:u}),V.polygon(e,u,t)},r}async function tu(t,e,{config:{themeVariables:a,flowchart:r}}){let{labelStyles:i}=D(e);e.labelStyle=i;let n=Math.max(e.assetHeight??48,e.assetWidth??48),h=r?.wrappingWidth;e.width=Math.max(n,h??0);let{shapeSvg:c,bbox:y,label:f}=await d(t,e,"icon-shape default"),p="t"===e.pos,{nodeBorder:u}=a,{stylesMap:m}=M(e),x=-n/2,w=-n/2,b=e.label?8:0,$=o.Z.svg(c),k=W(e,{stroke:"none",fill:"none"});"handDrawn"!==e.look&&(k.roughness=0,k.fillStyle="solid");let S=$.rectangle(x,w,n,n,k),v=Math.max(n,y.width),N=n+y.height+b,C=$.rectangle(-v/2,-N/2,v,N,{...k,fill:"transparent",stroke:"none"}),B=c.insert(()=>S,":first-child"),A=c.insert(()=>C);if(e.icon){let t=c.append("g");t.html(`<g>${await (0,l.s4)(e.icon,{height:n,width:n,fallbackPrefix:""})}</g>`);let a=t.node().getBBox(),r=a.width,i=a.height,s=a.x,h=a.y;t.attr("transform",`translate(${-r/2-s},${p?y.height/2+b/2-i/2-h:-y.height/2-b/2-i/2-h})`),t.attr("style",`color: ${m.get("stroke")??u};`)}return f.attr("transform",`translate(${-y.width/2-(y.x-(y.left??0))},${p?-N/2:N/2-y.height})`),B.attr("transform",`translate(0,${p?y.height/2+b/2:-y.height/2-b/2})`),g(e,A),e.intersect=function(t){if(s.cM.info("iconSquare intersect",e,t),!e.label)return V.rect(e,t);let a=e.x??0,l=e.y??0,r=e.height??0,i=[];return i=p?[{x:a-y.width/2,y:l-r/2},{x:a+y.width/2,y:l-r/2},{x:a+y.width/2,y:l-r/2+y.height+b},{x:a+n/2,y:l-r/2+y.height+b},{x:a+n/2,y:l+r/2},{x:a-n/2,y:l+r/2},{x:a-n/2,y:l-r/2+y.height+b},{x:a-y.width/2,y:l-r/2+y.height+b}]:[{x:a-n/2,y:l-r/2},{x:a+n/2,y:l-r/2},{x:a+n/2,y:l-r/2+n},{x:a+y.width/2,y:l-r/2+n},{x:a+y.width/2/2,y:l+r/2},{x:a-y.width/2,y:l+r/2},{x:a-y.width/2,y:l-r/2+n},{x:a-n/2,y:l-r/2+n}],V.polygon(e,i,t)},c}async function tm(t,e,{config:{themeVariables:a,flowchart:r}}){let{labelStyles:i}=D(e);e.labelStyle=i;let n=Math.max(e.assetHeight??48,e.assetWidth??48),h=r?.wrappingWidth;e.width=Math.max(n,h??0);let{shapeSvg:c,bbox:y,label:f}=await d(t,e,"icon-shape default"),p=e.label?8:0,u="t"===e.pos,{nodeBorder:m,mainBkg:x}=a,{stylesMap:w}=M(e),b=o.Z.svg(c),$=W(e,{});"handDrawn"!==e.look&&($.roughness=0,$.fillStyle="solid");let k=w.get("fill");$.stroke=k??x;let S=c.append("g");e.icon&&S.html(`<g>${await (0,l.s4)(e.icon,{height:n,width:n,fallbackPrefix:""})}</g>`);let v=S.node().getBBox(),N=v.width,C=v.height,B=v.x,A=v.y,R=Math.max(N,C)*Math.SQRT2+40,L=b.circle(0,0,R,$),P=Math.max(R,y.width),Z=R+y.height+p,I=b.rectangle(-P/2,-Z/2,P,Z,{...$,fill:"transparent",stroke:"none"}),T=c.insert(()=>L,":first-child"),E=c.insert(()=>I);return S.attr("transform",`translate(${-N/2-B},${u?y.height/2+p/2-C/2-A:-y.height/2-p/2-C/2-A})`),S.attr("style",`color: ${w.get("stroke")??m};`),f.attr("transform",`translate(${-y.width/2-(y.x-(y.left??0))},${u?-Z/2:Z/2-y.height})`),T.attr("transform",`translate(0,${u?y.height/2+p/2:-y.height/2-p/2})`),g(e,E),e.intersect=function(t){return s.cM.info("iconSquare intersect",e,t),V.rect(e,t)},c}async function tx(t,e,{config:{themeVariables:a,flowchart:r}}){let{labelStyles:i}=D(e);e.labelStyle=i;let n=Math.max(e.assetHeight??48,e.assetWidth??48),h=r?.wrappingWidth;e.width=Math.max(n,h??0);let{shapeSvg:c,bbox:y,halfPadding:f,label:p}=await d(t,e,"icon-shape default"),u="t"===e.pos,m=n+2*f,x=n+2*f,{nodeBorder:w,mainBkg:b}=a,{stylesMap:k}=M(e),S=e.label?8:0,v=o.Z.svg(c),N=W(e,{});"handDrawn"!==e.look&&(N.roughness=0,N.fillStyle="solid");let C=k.get("fill");N.stroke=C??b;let B=v.path($(-x/2,-m/2,x,m,5),N),A=Math.max(x,y.width),R=m+y.height+S,L=v.rectangle(-A/2,-R/2,A,R,{...N,fill:"transparent",stroke:"none"}),P=c.insert(()=>B,":first-child").attr("class","icon-shape2"),Z=c.insert(()=>L);if(e.icon){let t=c.append("g");t.html(`<g>${await (0,l.s4)(e.icon,{height:n,width:n,fallbackPrefix:""})}</g>`);let a=t.node().getBBox(),r=a.width,i=a.height,s=a.x,h=a.y;t.attr("transform",`translate(${-r/2-s},${u?y.height/2+S/2-i/2-h:-y.height/2-S/2-i/2-h})`),t.attr("style",`color: ${k.get("stroke")??w};`)}return p.attr("transform",`translate(${-y.width/2-(y.x-(y.left??0))},${u?-R/2:R/2-y.height})`),P.attr("transform",`translate(0,${u?y.height/2+S/2:-y.height/2-S/2})`),g(e,Z),e.intersect=function(t){if(s.cM.info("iconSquare intersect",e,t),!e.label)return V.rect(e,t);let a=e.x??0,l=e.y??0,r=e.height??0,i=[];return i=u?[{x:a-y.width/2,y:l-r/2},{x:a+y.width/2,y:l-r/2},{x:a+y.width/2,y:l-r/2+y.height+S},{x:a+x/2,y:l-r/2+y.height+S},{x:a+x/2,y:l+r/2},{x:a-x/2,y:l+r/2},{x:a-x/2,y:l-r/2+y.height+S},{x:a-y.width/2,y:l-r/2+y.height+S}]:[{x:a-x/2,y:l-r/2},{x:a+x/2,y:l-r/2},{x:a+x/2,y:l-r/2+m},{x:a+y.width/2,y:l-r/2+m},{x:a+y.width/2/2,y:l+r/2},{x:a-y.width/2,y:l+r/2},{x:a-y.width/2,y:l-r/2+m},{x:a-x/2,y:l-r/2+m}],V.polygon(e,i,t)},c}async function tw(t,e,{config:{themeVariables:a,flowchart:r}}){let{labelStyles:i}=D(e);e.labelStyle=i;let n=Math.max(e.assetHeight??48,e.assetWidth??48),h=r?.wrappingWidth;e.width=Math.max(n,h??0);let{shapeSvg:c,bbox:y,halfPadding:f,label:p}=await d(t,e,"icon-shape default"),u="t"===e.pos,m=n+2*f,x=n+2*f,{nodeBorder:w,mainBkg:b}=a,{stylesMap:k}=M(e),S=e.label?8:0,v=o.Z.svg(c),N=W(e,{});"handDrawn"!==e.look&&(N.roughness=0,N.fillStyle="solid");let C=k.get("fill");N.stroke=C??b;let B=v.path($(-x/2,-m/2,x,m,.1),N),A=Math.max(x,y.width),R=m+y.height+S,L=v.rectangle(-A/2,-R/2,A,R,{...N,fill:"transparent",stroke:"none"}),P=c.insert(()=>B,":first-child"),Z=c.insert(()=>L);if(e.icon){let t=c.append("g");t.html(`<g>${await (0,l.s4)(e.icon,{height:n,width:n,fallbackPrefix:""})}</g>`);let a=t.node().getBBox(),r=a.width,i=a.height,s=a.x,h=a.y;t.attr("transform",`translate(${-r/2-s},${u?y.height/2+S/2-i/2-h:-y.height/2-S/2-i/2-h})`),t.attr("style",`color: ${k.get("stroke")??w};`)}return p.attr("transform",`translate(${-y.width/2-(y.x-(y.left??0))},${u?-R/2:R/2-y.height})`),P.attr("transform",`translate(0,${u?y.height/2+S/2:-y.height/2-S/2})`),g(e,Z),e.intersect=function(t){if(s.cM.info("iconSquare intersect",e,t),!e.label)return V.rect(e,t);let a=e.x??0,l=e.y??0,r=e.height??0,i=[];return i=u?[{x:a-y.width/2,y:l-r/2},{x:a+y.width/2,y:l-r/2},{x:a+y.width/2,y:l-r/2+y.height+S},{x:a+x/2,y:l-r/2+y.height+S},{x:a+x/2,y:l+r/2},{x:a-x/2,y:l+r/2},{x:a-x/2,y:l-r/2+y.height+S},{x:a-y.width/2,y:l-r/2+y.height+S}]:[{x:a-x/2,y:l-r/2},{x:a+x/2,y:l-r/2},{x:a+x/2,y:l-r/2+m},{x:a+y.width/2,y:l-r/2+m},{x:a+y.width/2/2,y:l+r/2},{x:a-y.width/2,y:l+r/2},{x:a-y.width/2,y:l-r/2+m},{x:a-x/2,y:l-r/2+m}],V.polygon(e,i,t)},c}async function tb(t,e,{config:{flowchart:a}}){let l=new Image;l.src=e?.img??"",await l.decode();let r=Number(l.naturalWidth.toString().replace("px","")),i=Number(l.naturalHeight.toString().replace("px",""));e.imageAspectRatio=r/i;let{labelStyles:n}=D(e);e.labelStyle=n;let h=a?.wrappingWidth;e.defaultWidth=a?.wrappingWidth;let c=Math.max(e.label?h??0:0,e?.assetWidth??r),y="on"===e.constraint&&e?.assetHeight?e.assetHeight*e.imageAspectRatio:c,f="on"===e.constraint?y/e.imageAspectRatio:e?.assetHeight??i;e.width=Math.max(y,h??0);let{shapeSvg:p,bbox:u,label:m}=await d(t,e,"image-shape default"),x="t"===e.pos,w=-y/2,b=e.label?8:0,$=o.Z.svg(p),k=W(e,{});"handDrawn"!==e.look&&(k.roughness=0,k.fillStyle="solid");let M=$.rectangle(w,-f/2,y,f,k),S=Math.max(y,u.width),v=f+u.height+b,N=$.rectangle(-S/2,-v/2,S,v,{...k,fill:"none",stroke:"none"}),C=p.insert(()=>M,":first-child"),B=p.insert(()=>N);if(e.img){let t=p.append("image");t.attr("href",e.img),t.attr("width",y),t.attr("height",f),t.attr("preserveAspectRatio","none"),t.attr("transform",`translate(${-y/2},${x?v/2-f:-v/2})`)}return m.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${x?-f/2-u.height/2-b/2:f/2-u.height/2+b/2})`),C.attr("transform",`translate(0,${x?u.height/2+b/2:-u.height/2-b/2})`),g(e,B),e.intersect=function(t){if(s.cM.info("iconSquare intersect",e,t),!e.label)return V.rect(e,t);let a=e.x??0,l=e.y??0,r=e.height??0,i=[];return i=x?[{x:a-u.width/2,y:l-r/2},{x:a+u.width/2,y:l-r/2},{x:a+u.width/2,y:l-r/2+u.height+b},{x:a+y/2,y:l-r/2+u.height+b},{x:a+y/2,y:l+r/2},{x:a-y/2,y:l+r/2},{x:a-y/2,y:l-r/2+u.height+b},{x:a-u.width/2,y:l-r/2+u.height+b}]:[{x:a-y/2,y:l-r/2},{x:a+y/2,y:l-r/2},{x:a+y/2,y:l-r/2+f},{x:a+u.width/2,y:l-r/2+f},{x:a+u.width/2/2,y:l+r/2},{x:a-u.width/2,y:l+r/2},{x:a-u.width/2,y:l-r/2+f},{x:a-y/2,y:l-r/2+f}],V.polygon(e,i,t)},p}async function t$(t,e){let a;let{labelStyles:l,nodeStyles:r}=D(e);e.labelStyle=l;let{shapeSvg:i,bbox:n}=await d(t,e,y(e)),s=Math.max(n.width+(e.padding??0)*2,e?.width??0),h=Math.max(n.height+(e.padding??0)*2,e?.height??0),c=[{x:0,y:0},{x:s,y:0},{x:s+3*h/6,y:-h},{x:-3*h/6,y:-h}],{cssStyles:p}=e;if("handDrawn"===e.look){let t=o.Z.svg(i),l=W(e,{}),r=f(c),n=t.path(r,l);a=i.insert(()=>n,":first-child").attr("transform",`translate(${-s/2}, ${h/2})`),p&&a.attr("style",p)}else a=z(i,s,h,c);return r&&a.attr("style",r),e.width=s,e.height=h,g(e,a),e.intersect=function(t){return V.polygon(e,c,t)},i}async function tk(t,e,a){let l;let{labelStyles:r,nodeStyles:i}=D(e);e.labelStyle=r;let{shapeSvg:s,bbox:h}=await d(t,e,y(e)),c=Math.max(h.width+2*a.labelPaddingX,e?.width||0),f=Math.max(h.height+2*a.labelPaddingY,e?.height||0),p=-c/2,u=-f/2,{rx:m,ry:x}=e,{cssStyles:w}=e;if(a?.rx&&a.ry&&(m=a.rx,x=a.ry),"handDrawn"===e.look){let t=o.Z.svg(s),a=W(e,{}),r=m||x?t.path($(p,u,c,f,m||0),a):t.rectangle(p,u,c,f,a);(l=s.insert(()=>r,":first-child")).attr("class","basic label-container").attr("style",(0,n.R7)(w))}else(l=s.insert("rect",":first-child")).attr("class","basic label-container").attr("style",i).attr("rx",(0,n.R7)(m)).attr("ry",(0,n.R7)(x)).attr("x",p).attr("y",u).attr("width",c).attr("height",f);return g(e,l),e.intersect=function(t){return V.rect(e,t)},s}async function tM(t,e){let{shapeSvg:a,bbox:l,label:r}=await d(t,e,"label"),i=a.insert("rect",":first-child");return i.attr("width",.1).attr("height",.1),a.attr("class","label edgeLabel"),r.attr("transform",`translate(${-(l.width/2)-(l.x-(l.left??0))}, ${-(l.height/2)-(l.y-(l.top??0))})`),g(e,i),e.intersect=function(t){return V.rect(e,t)},a}async function tS(t,e){let a;let{labelStyles:l,nodeStyles:r}=D(e);e.labelStyle=l;let{shapeSvg:i,bbox:n}=await d(t,e,y(e)),s=Math.max(n.width+(e.padding??0),e?.width??0),h=Math.max(n.height+(e.padding??0),e?.height??0),c=[{x:0,y:0},{x:s+3*h/6,y:0},{x:s,y:-h},{x:-(3*h)/6,y:-h}],{cssStyles:p}=e;if("handDrawn"===e.look){let t=o.Z.svg(i),l=W(e,{}),r=f(c),n=t.path(r,l);a=i.insert(()=>n,":first-child").attr("transform",`translate(${-s/2}, ${h/2})`),p&&a.attr("style",p)}else a=z(i,s,h,c);return r&&a.attr("style",r),e.width=s,e.height=h,g(e,a),e.intersect=function(t){return V.polygon(e,c,t)},i}async function tD(t,e){let a;let{labelStyles:l,nodeStyles:r}=D(e);e.labelStyle=l;let{shapeSvg:i,bbox:n}=await d(t,e,y(e)),s=Math.max(n.width+(e.padding??0),e?.width??0),h=Math.max(n.height+(e.padding??0),e?.height??0),c=[{x:-3*h/6,y:0},{x:s,y:0},{x:s+3*h/6,y:-h},{x:0,y:-h}],{cssStyles:p}=e;if("handDrawn"===e.look){let t=o.Z.svg(i),l=W(e,{}),r=f(c),n=t.path(r,l);a=i.insert(()=>n,":first-child").attr("transform",`translate(${-s/2}, ${h/2})`),p&&a.attr("style",p)}else a=z(i,s,h,c);return r&&a.attr("style",r),e.width=s,e.height=h,g(e,a),e.intersect=function(t){return V.polygon(e,c,t)},i}function tW(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.label="",e.labelStyle=a;let r=t.insert("g").attr("class",y(e)).attr("id",e.domId??e.id),{cssStyles:i}=e,n=Math.max(35,e?.width??0),h=Math.max(35,e?.height??0),d=[{x:n,y:0},{x:0,y:h+3.5},{x:n-14,y:h+3.5},{x:0,y:2*h},{x:n,y:h-3.5},{x:14,y:h-3.5}],c=o.Z.svg(r),p=W(e,{});"handDrawn"!==e.look&&(p.roughness=0,p.fillStyle="solid");let u=f(d),m=c.path(u,p),x=r.insert(()=>m,":first-child");return i&&"handDrawn"!==e.look&&x.selectAll("path").attr("style",i),l&&"handDrawn"!==e.look&&x.selectAll("path").attr("style",l),x.attr("transform",`translate(-${n/2},${-h})`),g(e,x),e.intersect=function(t){return s.cM.info("lightningBolt intersect",e,t),V.polygon(e,d,t)},r}(0,s.eW)(tf,"hexagon"),(0,s.eW)(tp,"hourglass"),(0,s.eW)(tu,"icon"),(0,s.eW)(tm,"iconCircle"),(0,s.eW)(tx,"iconRounded"),(0,s.eW)(tw,"iconSquare"),(0,s.eW)(tb,"imageSquare"),(0,s.eW)(t$,"inv_trapezoid"),(0,s.eW)(tk,"drawRect"),(0,s.eW)(tM,"labelRect"),(0,s.eW)(tS,"lean_left"),(0,s.eW)(tD,"lean_right"),(0,s.eW)(tW,"lightningBolt");var tv=(0,s.eW)((t,e,a,l,r,i,n)=>`M${t},${e+i} a${r},${i} 0,0,0 ${a},0 a${r},${i} 0,0,0 ${-a},0 l0,${l} a${r},${i} 0,0,0 ${a},0 l0,${-l} M${t},${e+i+n} a${r},${i} 0,0,0 ${a},0`,"createCylinderPathD"),tN=(0,s.eW)((t,e,a,l,r,i,n)=>`M${t},${e+i} M${t+a},${e+i} a${r},${i} 0,0,0 ${-a},0 l0,${l} a${r},${i} 0,0,0 ${a},0 l0,${-l} M${t},${e+i+n} a${r},${i} 0,0,0 ${a},0`,"createOuterCylinderPathD"),tC=(0,s.eW)((t,e,a,l,r,i)=>`M${t-a/2},${-l/2} a${r},${i} 0,0,0 ${a},0`,"createInnerCylinderPathD");async function tB(t,e){let a;let{labelStyles:l,nodeStyles:r}=D(e);e.labelStyle=l;let{shapeSvg:i,bbox:s,label:h}=await d(t,e,y(e)),c=Math.max(s.width+(e.padding??0),e.width??0),f=c/2,p=f/(2.5+c/50),u=Math.max(s.height+p+(e.padding??0),e.height??0),m=.1*u,{cssStyles:x}=e;if("handDrawn"===e.look){let t=o.Z.svg(i),l=tN(0,0,c,u,f,p,m),r=tC(0,p,c,u,f,p),n=W(e,{}),s=t.path(l,n),h=t.path(r,n);i.insert(()=>h,":first-child").attr("class","line"),(a=i.insert(()=>s,":first-child")).attr("class","basic label-container"),x&&a.attr("style",x)}else{let t=tv(0,0,c,u,f,p,m);a=i.insert("path",":first-child").attr("d",t).attr("class","basic label-container").attr("style",(0,n.R7)(x)).attr("style",r)}return a.attr("label-offset-y",p),a.attr("transform",`translate(${-c/2}, ${-(u/2+p)})`),g(e,a),h.attr("transform",`translate(${-(s.width/2)-(s.x-(s.left??0))}, ${-(s.height/2)+p-(s.y-(s.top??0))})`),e.intersect=function(t){let a=V.rect(e,t),l=a.x-(e.x??0);if(0!=f&&(Math.abs(l)<(e.width??0)/2||Math.abs(l)==(e.width??0)/2&&Math.abs(a.y-(e.y??0))>(e.height??0)/2-p)){let r=p*p*(1-l*l/(f*f));r>0&&(r=Math.sqrt(r)),r=p-r,t.y-(e.y??0)>0&&(r=-r),a.y+=r}return a},i}async function tA(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a;let{shapeSvg:r,bbox:i,label:n}=await d(t,e,y(e)),s=Math.max(i.width+(e.padding??0)*2,e?.width??0),h=Math.max(i.height+(e.padding??0)*2,e?.height??0),c=h/4,f=h+c,{cssStyles:u}=e,m=o.Z.svg(r),x=W(e,{});"handDrawn"!==e.look&&(x.roughness=0,x.fillStyle="solid");let w=[{x:-s/2-s/2*.1,y:-f/2},{x:-s/2-s/2*.1,y:f/2},...p(-s/2-s/2*.1,f/2,s/2+s/2*.1,f/2,c,.8),{x:s/2+s/2*.1,y:-f/2},{x:-s/2-s/2*.1,y:-f/2},{x:-s/2,y:-f/2},{x:-s/2,y:f/2*1.1},{x:-s/2,y:-f/2}],b=m.polygon(w.map(t=>[t.x,t.y]),x),$=r.insert(()=>b,":first-child");return $.attr("class","basic label-container"),u&&"handDrawn"!==e.look&&$.selectAll("path").attr("style",u),l&&"handDrawn"!==e.look&&$.selectAll("path").attr("style",l),$.attr("transform",`translate(0,${-c/2})`),n.attr("transform",`translate(${-s/2+(e.padding??0)+s/2*.1/2-(i.x-(i.left??0))},${-h/2+(e.padding??0)-c/2-(i.y-(i.top??0))})`),g(e,$),e.intersect=function(t){return V.polygon(e,w,t)},r}async function tR(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a;let{shapeSvg:r,bbox:i,label:n}=await d(t,e,y(e)),s=Math.max(i.width+(e.padding??0)*2,e?.width??0),h=Math.max(i.height+(e.padding??0)*2,e?.height??0),c=-s/2,p=-h/2,{cssStyles:u}=e,m=o.Z.svg(r),x=W(e,{}),w=[{x:c-5,y:p+5},{x:c-5,y:p+h+5},{x:c+s-5,y:p+h+5},{x:c+s-5,y:p+h},{x:c+s,y:p+h},{x:c+s,y:p+h-5},{x:c+s+5,y:p+h-5},{x:c+s+5,y:p-5},{x:c+5,y:p-5},{x:c+5,y:p},{x:c,y:p},{x:c,y:p+5}];"handDrawn"!==e.look&&(x.roughness=0,x.fillStyle="solid");let b=f(w),$=m.path(b,x),k=f([{x:c,y:p+5},{x:c+s-5,y:p+5},{x:c+s-5,y:p+h},{x:c+s,y:p+h},{x:c+s,y:p},{x:c,y:p}]),M=m.path(k,{...x,fill:"none"}),S=r.insert(()=>M,":first-child");return S.insert(()=>$,":first-child"),S.attr("class","basic label-container"),u&&"handDrawn"!==e.look&&S.selectAll("path").attr("style",u),l&&"handDrawn"!==e.look&&S.selectAll("path").attr("style",l),n.attr("transform",`translate(${-(i.width/2)-5-(i.x-(i.left??0))}, ${-(i.height/2)+5-(i.y-(i.top??0))})`),g(e,S),e.intersect=function(t){return V.polygon(e,w,t)},r}async function tL(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a;let{shapeSvg:r,bbox:i,label:n}=await d(t,e,y(e)),s=Math.max(i.width+(e.padding??0)*2,e?.width??0),h=Math.max(i.height+(e.padding??0)*2,e?.height??0),c=h/4,u=h+c,m=-s/2,x=-u/2,{cssStyles:w}=e,b=p(m-5,x+u+5,m+s-5,x+u+5,c,.8),$=b?.[b.length-1],k=[{x:m-5,y:x+5},{x:m-5,y:x+u+5},...b,{x:m+s-5,y:$.y-5},{x:m+s,y:$.y-5},{x:m+s,y:$.y-10},{x:m+s+5,y:$.y-10},{x:m+s+5,y:x-5},{x:m+5,y:x-5},{x:m+5,y:x},{x:m,y:x},{x:m,y:x+5}],M=[{x:m,y:x+5},{x:m+s-5,y:x+5},{x:m+s-5,y:$.y-5},{x:m+s,y:$.y-5},{x:m+s,y:x},{x:m,y:x}],S=o.Z.svg(r),v=W(e,{});"handDrawn"!==e.look&&(v.roughness=0,v.fillStyle="solid");let N=f(k),C=S.path(N,v),B=f(M),A=S.path(B,v),R=r.insert(()=>C,":first-child");return R.insert(()=>A),R.attr("class","basic label-container"),w&&"handDrawn"!==e.look&&R.selectAll("path").attr("style",w),l&&"handDrawn"!==e.look&&R.selectAll("path").attr("style",l),R.attr("transform",`translate(0,${-c/2})`),n.attr("transform",`translate(${-(i.width/2)-5-(i.x-(i.left??0))}, ${-(i.height/2)+5-c/2-(i.y-(i.top??0))})`),g(e,R),e.intersect=function(t){return V.polygon(e,k,t)},r}async function tP(t,e,{config:{themeVariables:a}}){let{labelStyles:l,nodeStyles:r}=D(e);e.labelStyle=l,e.useHtmlLabels||s.iE().flowchart?.htmlLabels!==!1||(e.centerLabel=!0);let{shapeSvg:i,bbox:n}=await d(t,e,y(e)),h=Math.max(n.width+(e.padding??0)*2,e?.width??0),c=Math.max(n.height+(e.padding??0)*2,e?.height??0),{cssStyles:f}=e,p=o.Z.svg(i),u=W(e,{fill:a.noteBkgColor,stroke:a.noteBorderColor});"handDrawn"!==e.look&&(u.roughness=0,u.fillStyle="solid");let m=p.rectangle(-h/2,-c/2,h,c,u),x=i.insert(()=>m,":first-child");return x.attr("class","basic label-container"),f&&"handDrawn"!==e.look&&x.selectAll("path").attr("style",f),r&&"handDrawn"!==e.look&&x.selectAll("path").attr("style",r),g(e,x),e.intersect=function(t){return V.rect(e,t)},i}(0,s.eW)(tB,"linedCylinder"),(0,s.eW)(tA,"linedWaveEdgedRect"),(0,s.eW)(tR,"multiRect"),(0,s.eW)(tL,"multiWaveEdgedRectangle"),(0,s.eW)(tP,"note");var tZ=(0,s.eW)((t,e,a)=>`M${t+a/2},${e} L${t+a},${e-a/2} L${t+a/2},${e-a} L${t},${e-a/2} Z`,"createDecisionBoxPathD");async function tI(t,e){let a;let{labelStyles:l,nodeStyles:r}=D(e);e.labelStyle=l;let{shapeSvg:i,bbox:n}=await d(t,e,y(e)),h=n.width+e.padding+(n.height+e.padding),c=[{x:h/2,y:0},{x:h,y:-h/2},{x:h/2,y:-h},{x:0,y:-h/2}],{cssStyles:f}=e;if("handDrawn"===e.look){let t=o.Z.svg(i),l=W(e,{}),r=tZ(0,0,h),n=t.path(r,l);a=i.insert(()=>n,":first-child").attr("transform",`translate(${-h/2}, ${h/2})`),f&&a.attr("style",f)}else a=z(i,h,h,c);return r&&a.attr("style",r),g(e,a),e.intersect=function(t){return s.cM.debug("APA12 Intersect called SPLIT\npoint:",t,"\nnode:\n",e,"\nres:",V.polygon(e,c,t)),V.polygon(e,c,t)},i}async function tT(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a;let{shapeSvg:r,bbox:i,label:n}=await d(t,e,y(e)),s=Math.max(i.width+(e.padding??0),e?.width??0),h=Math.max(i.height+(e.padding??0),e?.height??0),c=-s/2,p=-h/2,u=p/2,m=[{x:c+u,y:p},{x:c,y:0},{x:c+u,y:-p},{x:-c,y:-p},{x:-c,y:p}],{cssStyles:x}=e,w=o.Z.svg(r),b=W(e,{});"handDrawn"!==e.look&&(b.roughness=0,b.fillStyle="solid");let $=f(m),k=w.path($,b),M=r.insert(()=>k,":first-child");return M.attr("class","basic label-container"),x&&"handDrawn"!==e.look&&M.selectAll("path").attr("style",x),l&&"handDrawn"!==e.look&&M.selectAll("path").attr("style",l),M.attr("transform",`translate(${-u/2},0)`),n.attr("transform",`translate(${-u/2-i.width/2-(i.x-(i.left??0))}, ${-(i.height/2)-(i.y-(i.top??0))})`),g(e,M),e.intersect=function(t){return V.polygon(e,m,t)},r}async function tE(t,e){let a,l,r;let{labelStyles:i,nodeStyles:n}=D(e);e.labelStyle=i,a=e.cssClasses?"node "+e.cssClasses:"node default";let d=t.insert("g").attr("class",a).attr("id",e.domId||e.id),c=d.insert("g"),y=d.insert("g").attr("class","label").attr("style",n),f=e.description,p=e.label,u=y.node().appendChild(await b(p,e.labelStyle,!0,!0)),m={width:0,height:0};if((0,s.ku)(s.nV()?.flowchart?.htmlLabels)){let t=u.children[0],e=(0,h.Ys)(u);m=t.getBoundingClientRect(),e.attr("width",m.width),e.attr("height",m.height)}s.cM.info("Text 2",f);let x=f||[],w=u.getBBox(),k=y.node().appendChild(await b(x.join?x.join("<br/>"):x,e.labelStyle,!0,!0)),M=k.children[0],S=(0,h.Ys)(k);m=M.getBoundingClientRect(),S.attr("width",m.width),S.attr("height",m.height);let v=(e.padding||0)/2;(0,h.Ys)(k).attr("transform","translate( "+(m.width>w.width?0:(w.width-m.width)/2)+", "+(w.height+v+5)+")"),(0,h.Ys)(u).attr("transform","translate( "+(m.width<w.width?0:-(w.width-m.width)/2)+", 0)"),m=y.node().getBBox(),y.attr("transform","translate("+-m.width/2+", "+(-m.height/2-v+3)+")");let N=m.width+(e.padding||0),C=m.height+(e.padding||0),B=-m.width/2-v,A=-m.height/2-v;if("handDrawn"===e.look){let t=o.Z.svg(d),a=W(e,{}),i=t.path($(B,A,N,C,e.rx||0),a),n=t.line(-m.width/2-v,-m.height/2-v+w.height+v,m.width/2+v,-m.height/2-v+w.height+v,a);r=d.insert(()=>(s.cM.debug("Rough node insert CXC",i),n),":first-child"),l=d.insert(()=>(s.cM.debug("Rough node insert CXC",i),i),":first-child")}else l=c.insert("rect",":first-child"),r=c.insert("line"),l.attr("class","outer title-state").attr("style",n).attr("x",-m.width/2-v).attr("y",-m.height/2-v).attr("width",m.width+(e.padding||0)).attr("height",m.height+(e.padding||0)),r.attr("class","divider").attr("x1",-m.width/2-v).attr("x2",m.width/2+v).attr("y1",-m.height/2-v+w.height+v).attr("y2",-m.height/2-v+w.height+v);return g(e,l),e.intersect=function(t){return V.rect(e,t)},d}async function tH(t,e){let a={rx:5,ry:5,classes:"",labelPaddingX:1*(e?.padding||0),labelPaddingY:1*(e?.padding||0)};return tk(t,e,a)}async function tV(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a;let{shapeSvg:r,bbox:i,label:s}=await d(t,e,y(e)),h=e?.padding??0,c=Math.max(i.width+(e.padding??0)*2,e?.width??0),f=Math.max(i.height+(e.padding??0)*2,e?.height??0),p=-i.width/2-h,u=-i.height/2-h,{cssStyles:m}=e,x=o.Z.svg(r),w=W(e,{});"handDrawn"!==e.look&&(w.roughness=0,w.fillStyle="solid");let b=x.polygon([{x:p,y:u},{x:p+c+8,y:u},{x:p+c+8,y:u+f},{x:p-8,y:u+f},{x:p-8,y:u},{x:p,y:u},{x:p,y:u+f}].map(t=>[t.x,t.y]),w),$=r.insert(()=>b,":first-child");return $.attr("class","basic label-container").attr("style",(0,n.R7)(m)),l&&"handDrawn"!==e.look&&$.selectAll("path").attr("style",l),m&&"handDrawn"!==e.look&&$.selectAll("path").attr("style",l),s.attr("transform",`translate(${-c/2+4+(e.padding??0)-(i.x-(i.left??0))},${-f/2+(e.padding??0)-(i.y-(i.top??0))})`),g(e,$),e.intersect=function(t){return V.rect(e,t)},r}async function tj(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a;let{shapeSvg:r,bbox:i,label:n}=await d(t,e,y(e)),s=Math.max(i.width+(e.padding??0)*2,e?.width??0),h=Math.max(i.height+(e.padding??0)*2,e?.height??0),c=-s/2,p=-h/2,{cssStyles:u}=e,m=o.Z.svg(r),x=W(e,{});"handDrawn"!==e.look&&(x.roughness=0,x.fillStyle="solid");let w=[{x:c,y:p},{x:c,y:p+h},{x:c+s,y:p+h},{x:c+s,y:p-h/2}],b=f(w),$=m.path(b,x),k=r.insert(()=>$,":first-child");return k.attr("class","basic label-container"),u&&"handDrawn"!==e.look&&k.selectChildren("path").attr("style",u),l&&"handDrawn"!==e.look&&k.selectChildren("path").attr("style",l),k.attr("transform",`translate(0, ${h/4})`),n.attr("transform",`translate(${-s/2+(e.padding??0)-(i.x-(i.left??0))}, ${-h/4+(e.padding??0)-(i.y-(i.top??0))})`),g(e,k),e.intersect=function(t){return V.polygon(e,w,t)},r}async function t_(t,e){let a={rx:0,ry:0,classes:"",labelPaddingX:2*(e?.padding||0),labelPaddingY:1*(e?.padding||0)};return tk(t,e,a)}async function tY(t,e){let a;let{labelStyles:l,nodeStyles:r}=D(e);e.labelStyle=l;let{shapeSvg:i,bbox:s}=await d(t,e,y(e)),h=s.height+e.padding,c=s.width+h/4+e.padding,{cssStyles:f}=e;if("handDrawn"===e.look){let t=o.Z.svg(i),l=W(e,{}),r=$(-c/2,-h/2,c,h,h/2),s=t.path(r,l);(a=i.insert(()=>s,":first-child")).attr("class","basic label-container").attr("style",(0,n.R7)(f))}else(a=i.insert("rect",":first-child")).attr("class","basic label-container").attr("style",r).attr("rx",h/2).attr("ry",h/2).attr("x",-c/2).attr("y",-h/2).attr("width",c).attr("height",h);return g(e,a),e.intersect=function(t){return V.rect(e,t)},i}async function tz(t,e){return tk(t,e,{rx:5,ry:5,classes:"flowchart-node"})}function tq(t,e,{config:{themeVariables:a}}){let{labelStyles:l,nodeStyles:r}=D(e);e.labelStyle=l;let{cssStyles:i}=e,{lineColor:n,stateBorder:s,nodeBorder:h}=a,d=t.insert("g").attr("class","node default").attr("id",e.domId||e.id),c=o.Z.svg(d),y=W(e,{});"handDrawn"!==e.look&&(y.roughness=0,y.fillStyle="solid");let f=c.circle(0,0,14,{...y,stroke:n,strokeWidth:2}),p=s??h,u=c.circle(0,0,5,{...y,fill:p,stroke:p,strokeWidth:2,fillStyle:"solid"}),m=d.insert(()=>f,":first-child");return m.insert(()=>u),i&&m.selectAll("path").attr("style",i),r&&m.selectAll("path").attr("style",r),g(e,m),e.intersect=function(t){return V.circle(e,7,t)},d}function tO(t,e,{config:{themeVariables:a}}){let l;let{lineColor:r}=a,i=t.insert("g").attr("class","node default").attr("id",e.domId||e.id);if("handDrawn"===e.look){let t=o.Z.svg(i).circle(0,0,14,k(r));(l=i.insert(()=>t)).attr("class","state-start").attr("r",7).attr("width",14).attr("height",14)}else(l=i.insert("circle",":first-child")).attr("class","state-start").attr("r",7).attr("width",14).attr("height",14);return g(e,l),e.intersect=function(t){return V.circle(e,7,t)},i}async function tF(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a;let{shapeSvg:r,bbox:i}=await d(t,e,y(e)),s=(e?.padding||0)/2,h=i.width+e.padding,c=i.height+e.padding,f=-i.width/2-s,p=-i.height/2-s,u=[{x:0,y:0},{x:h,y:0},{x:h,y:-c},{x:0,y:-c},{x:0,y:0},{x:-8,y:0},{x:h+8,y:0},{x:h+8,y:-c},{x:-8,y:-c},{x:-8,y:0}];if("handDrawn"===e.look){let t=o.Z.svg(r),a=W(e,{}),l=t.rectangle(f-8,p,h+16,c,a),i=t.line(f,p,f,p+c,a),s=t.line(f+h,p,f+h,p+c,a);r.insert(()=>i,":first-child"),r.insert(()=>s,":first-child");let d=r.insert(()=>l,":first-child"),{cssStyles:y}=e;d.attr("class","basic label-container").attr("style",(0,n.R7)(y)),g(e,d)}else{let t=z(r,h,c,u);l&&t.attr("style",l),g(e,t)}return e.intersect=function(t){return V.polygon(e,u,t)},r}async function tX(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a;let{shapeSvg:r,bbox:i}=await d(t,e,y(e)),n=Math.max(i.width+(e.padding??0)*2,e?.width??0),s=Math.max(i.height+(e.padding??0)*2,e?.height??0),h=-n/2,c=-s/2,p=.2*s,{cssStyles:u}=e,m=o.Z.svg(r),x=W(e,{}),w=[{x:h-p/2,y:c},{x:h+n+p/2,y:c},{x:h+n+p/2,y:c+s},{x:h-p/2,y:c+s}];"handDrawn"!==e.look&&(x.roughness=0,x.fillStyle="solid");let b=f(w),$=m.path(b,x),k=f([{x:h+n-p/2,y:c+s},{x:h+n+p/2,y:c+s},{x:h+n+p/2,y:c+s-.2*s}]),M=m.path(k,{...x,fillStyle:"solid"}),S=r.insert(()=>M,":first-child");return S.insert(()=>$,":first-child"),S.attr("class","basic label-container"),u&&"handDrawn"!==e.look&&S.selectAll("path").attr("style",u),l&&"handDrawn"!==e.look&&S.selectAll("path").attr("style",l),g(e,S),e.intersect=function(t){return V.polygon(e,w,t)},r}async function tJ(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a;let{shapeSvg:r,bbox:i,label:n}=await d(t,e,y(e)),s=Math.max(i.width+(e.padding??0)*2,e?.width??0),h=Math.max(i.height+(e.padding??0)*2,e?.height??0),c=h/4,u=.2*s,m=.2*h,x=h+c,{cssStyles:w}=e,b=o.Z.svg(r),$=W(e,{});"handDrawn"!==e.look&&($.roughness=0,$.fillStyle="solid");let k=[{x:-s/2-s/2*.1,y:x/2},...p(-s/2-s/2*.1,x/2,s/2+s/2*.1,x/2,c,.8),{x:s/2+s/2*.1,y:-x/2},{x:-s/2-s/2*.1,y:-x/2}],M=-s/2+s/2*.1,S=-x/2-.4*m,v=[{x:M+s-u,y:(S+h)*1.4},{x:M+s,y:S+h-m},{x:M+s,y:(S+h)*.9},...p(M+s,(S+h)*1.3,M+s-u,(S+h)*1.5,-(.03*h),.5)],N=f(k),C=b.path(N,$),B=f(v),A=b.path(B,{...$,fillStyle:"solid"}),R=r.insert(()=>A,":first-child");return R.insert(()=>C,":first-child"),R.attr("class","basic label-container"),w&&"handDrawn"!==e.look&&R.selectAll("path").attr("style",w),l&&"handDrawn"!==e.look&&R.selectAll("path").attr("style",l),R.attr("transform",`translate(0,${-c/2})`),n.attr("transform",`translate(${-s/2+(e.padding??0)-(i.x-(i.left??0))},${-h/2+(e.padding??0)-c/2-(i.y-(i.top??0))})`),g(e,R),e.intersect=function(t){return V.polygon(e,k,t)},r}async function tG(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a;let{shapeSvg:r,bbox:i}=await d(t,e,y(e)),n=Math.max(i.width+e.padding,e?.width||0),s=Math.max(i.height+e.padding,e?.height||0),h=r.insert("rect",":first-child");return h.attr("class","text").attr("style",l).attr("rx",0).attr("ry",0).attr("x",-n/2).attr("y",-s/2).attr("width",n).attr("height",s),g(e,h),e.intersect=function(t){return V.rect(e,t)},r}(0,s.eW)(tI,"question"),(0,s.eW)(tT,"rect_left_inv_arrow"),(0,s.eW)(tE,"rectWithTitle"),(0,s.eW)(tH,"roundedRect"),(0,s.eW)(tV,"shadedProcess"),(0,s.eW)(tj,"slopedRect"),(0,s.eW)(t_,"squareRect"),(0,s.eW)(tY,"stadium"),(0,s.eW)(tz,"state"),(0,s.eW)(tq,"stateEnd"),(0,s.eW)(tO,"stateStart"),(0,s.eW)(tF,"subroutine"),(0,s.eW)(tX,"taggedRect"),(0,s.eW)(tJ,"taggedWaveEdgedRectangle"),(0,s.eW)(tG,"text");var tU=(0,s.eW)((t,e,a,l,r,i)=>`M${t},${e}
3
+ a${r},${i} 0,0,1 0,${-l}
4
+ l${a},0
5
+ a${r},${i} 0,0,1 0,${l}
6
+ M${a},${-l}
7
+ a${r},${i} 0,0,0 0,${l}
8
+ l${-a},0`,"createCylinderPathD"),tK=(0,s.eW)((t,e,a,l,r,i)=>`M${t},${e} M${t+a},${e} a${r},${i} 0,0,0 0,${-l} l${-a},0 a${r},${i} 0,0,0 0,${l} l${a},0`,"createOuterCylinderPathD"),tQ=(0,s.eW)((t,e,a,l,r,i)=>`M${t+a/2},${-l/2} a${r},${i} 0,0,0 0,${l}`,"createInnerCylinderPathD");async function t0(t,e){let a;let{labelStyles:l,nodeStyles:r}=D(e);e.labelStyle=l;let{shapeSvg:i,bbox:s,label:h,halfPadding:c}=await d(t,e,y(e)),f="neo"===e.look?2*c:c,p=s.height+f,u=p/2,m=u/(2.5+p/50),x=s.width+m+f,{cssStyles:w}=e;if("handDrawn"===e.look){let t=o.Z.svg(i),l=tK(0,0,x,p,m,u),r=tQ(0,0,x,p,m,u),n=t.path(l,W(e,{})),s=t.path(r,W(e,{fill:"none"}));a=i.insert(()=>s,":first-child"),(a=i.insert(()=>n,":first-child")).attr("class","basic label-container"),w&&a.attr("style",w)}else{let t=tU(0,0,x,p,m,u);(a=i.insert("path",":first-child").attr("d",t).attr("class","basic label-container").attr("style",(0,n.R7)(w)).attr("style",r)).attr("class","basic label-container"),w&&a.selectAll("path").attr("style",w),r&&a.selectAll("path").attr("style",r)}return a.attr("label-offset-x",m),a.attr("transform",`translate(${-x/2}, ${p/2} )`),h.attr("transform",`translate(${-(s.width/2)-m-(s.x-(s.left??0))}, ${-(s.height/2)-(s.y-(s.top??0))})`),g(e,a),e.intersect=function(t){let a=V.rect(e,t),l=a.y-(e.y??0);if(0!=u&&(Math.abs(l)<(e.height??0)/2||Math.abs(l)==(e.height??0)/2&&Math.abs(a.x-(e.x??0))>(e.width??0)/2-m)){let r=m*m*(1-l*l/(u*u));0!=r&&(r=Math.sqrt(Math.abs(r))),r=m-r,t.x-(e.x??0)>0&&(r=-r),a.x+=r}return a},i}async function t2(t,e){let a;let{labelStyles:l,nodeStyles:r}=D(e);e.labelStyle=l;let{shapeSvg:i,bbox:n}=await d(t,e,y(e)),s=n.width+e.padding,h=n.height+e.padding,c=[{x:-3*h/6,y:0},{x:s+3*h/6,y:0},{x:s,y:-h},{x:0,y:-h}],{cssStyles:p}=e;if("handDrawn"===e.look){let t=o.Z.svg(i),l=W(e,{}),r=f(c),n=t.path(r,l);a=i.insert(()=>n,":first-child").attr("transform",`translate(${-s/2}, ${h/2})`),p&&a.attr("style",p)}else a=z(i,s,h,c);return r&&a.attr("style",r),e.width=s,e.height=h,g(e,a),e.intersect=function(t){return V.polygon(e,c,t)},i}async function t1(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a;let{shapeSvg:r,bbox:i}=await d(t,e,y(e)),n=Math.max(60,i.width+(e.padding??0)*2,e?.width??0),s=Math.max(20,i.height+(e.padding??0)*2,e?.height??0),{cssStyles:h}=e,c=o.Z.svg(r),p=W(e,{});"handDrawn"!==e.look&&(p.roughness=0,p.fillStyle="solid");let u=[{x:-n/2*.8,y:-s/2},{x:n/2*.8,y:-s/2},{x:n/2,y:-s/2*.6},{x:n/2,y:s/2},{x:-n/2,y:s/2},{x:-n/2,y:-s/2*.6}],m=f(u),x=c.path(m,p),w=r.insert(()=>x,":first-child");return w.attr("class","basic label-container"),h&&"handDrawn"!==e.look&&w.selectChildren("path").attr("style",h),l&&"handDrawn"!==e.look&&w.selectChildren("path").attr("style",l),g(e,w),e.intersect=function(t){return V.polygon(e,u,t)},r}async function t5(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a;let{shapeSvg:r,bbox:i,label:n}=await d(t,e,y(e)),h=(0,s.ku)(s.nV().flowchart?.htmlLabels),c=i.width+(e.padding??0),p=c+i.height,u=c+i.height,m=[{x:0,y:0},{x:u,y:0},{x:u/2,y:-p}],{cssStyles:x}=e,w=o.Z.svg(r),b=W(e,{});"handDrawn"!==e.look&&(b.roughness=0,b.fillStyle="solid");let $=f(m),k=w.path($,b),M=r.insert(()=>k,":first-child").attr("transform",`translate(${-p/2}, ${p/2})`);return x&&"handDrawn"!==e.look&&M.selectChildren("path").attr("style",x),l&&"handDrawn"!==e.look&&M.selectChildren("path").attr("style",l),e.width=c,e.height=p,g(e,M),n.attr("transform",`translate(${-i.width/2-(i.x-(i.left??0))}, ${p/2-(i.height+(e.padding??0)/(h?2:1)-(i.y-(i.top??0)))})`),e.intersect=function(t){return s.cM.info("Triangle intersect",e,m,t),V.polygon(e,m,t)},r}async function t8(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a;let{shapeSvg:r,bbox:i,label:n}=await d(t,e,y(e)),s=Math.max(i.width+(e.padding??0)*2,e?.width??0),h=Math.max(i.height+(e.padding??0)*2,e?.height??0),c=h/8,u=h+c,{cssStyles:m}=e,x=70-s,w=x>0?x/2:0,b=o.Z.svg(r),$=W(e,{});"handDrawn"!==e.look&&($.roughness=0,$.fillStyle="solid");let k=[{x:-s/2-w,y:u/2},...p(-s/2-w,u/2,s/2+w,u/2,c,.8),{x:s/2+w,y:-u/2},{x:-s/2-w,y:-u/2}],M=f(k),S=b.path(M,$),v=r.insert(()=>S,":first-child");return v.attr("class","basic label-container"),m&&"handDrawn"!==e.look&&v.selectAll("path").attr("style",m),l&&"handDrawn"!==e.look&&v.selectAll("path").attr("style",l),v.attr("transform",`translate(0,${-c/2})`),n.attr("transform",`translate(${-s/2+(e.padding??0)-(i.x-(i.left??0))},${-h/2+(e.padding??0)-c-(i.y-(i.top??0))})`),g(e,v),e.intersect=function(t){return V.polygon(e,k,t)},r}async function t4(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a;let{shapeSvg:r,bbox:i}=await d(t,e,y(e)),n=Math.max(i.width+(e.padding??0)*2,e?.width??0),s=Math.max(i.height+(e.padding??0)*2,e?.height??0),h=n/s,c=n,u=s;c>u*h?u=c/h:c=u*h,c=Math.max(c,100);let m=Math.min(.2*(u=Math.max(u,50)),u/4),x=u+2*m,{cssStyles:w}=e,b=o.Z.svg(r),$=W(e,{});"handDrawn"!==e.look&&($.roughness=0,$.fillStyle="solid");let k=[{x:-c/2,y:x/2},...p(-c/2,x/2,c/2,x/2,m,1),{x:c/2,y:-x/2},...p(c/2,-x/2,-c/2,-x/2,m,-1)],M=f(k),S=b.path(M,$),v=r.insert(()=>S,":first-child");return v.attr("class","basic label-container"),w&&"handDrawn"!==e.look&&v.selectAll("path").attr("style",w),l&&"handDrawn"!==e.look&&v.selectAll("path").attr("style",l),g(e,v),e.intersect=function(t){return V.polygon(e,k,t)},r}async function t7(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a;let{shapeSvg:r,bbox:i,label:n}=await d(t,e,y(e)),s=Math.max(i.width+(e.padding??0)*2,e?.width??0),h=Math.max(i.height+(e.padding??0)*2,e?.height??0),c=-s/2,f=-h/2,{cssStyles:p}=e,u=o.Z.svg(r),m=W(e,{}),x=[{x:c-5,y:f-5},{x:c-5,y:f+h},{x:c+s,y:f+h},{x:c+s,y:f-5}],w=`M${c-5},${f-5} L${c+s},${f-5} L${c+s},${f+h} L${c-5},${f+h} L${c-5},${f-5}
9
+ M${c-5},${f} L${c+s},${f}
10
+ M${c},${f-5} L${c},${f+h}`;"handDrawn"!==e.look&&(m.roughness=0,m.fillStyle="solid");let b=u.path(w,m),$=r.insert(()=>b,":first-child");return $.attr("transform","translate(2.5, 2.5)"),$.attr("class","basic label-container"),p&&"handDrawn"!==e.look&&$.selectAll("path").attr("style",p),l&&"handDrawn"!==e.look&&$.selectAll("path").attr("style",l),n.attr("transform",`translate(${-(i.width/2)+2.5-(i.x-(i.left??0))}, ${-(i.height/2)+2.5-(i.y-(i.top??0))})`),g(e,$),e.intersect=function(t){return V.polygon(e,x,t)},r}async function t9(t,e,a,l,r=a.class.padding??12){let i=l?0:3,n=t.insert("g").attr("class",y(e)).attr("id",e.domId||e.id),s=null,h=null,o=null,d=null,c=0,g=0,f=0;if(s=n.insert("g").attr("class","annotation-group text"),e.annotations.length>0){let t=e.annotations[0];await t3(s,{text:`\xab${t}\xbb`},0),c=s.node().getBBox().height}h=n.insert("g").attr("class","label-group text"),await t3(h,e,0,["font-weight: bolder"]);let p=h.node().getBBox();g=p.height,o=n.insert("g").attr("class","members-group text");let u=0;for(let t of e.members){let e=await t3(o,t,u,[t.parseClassifier()]);u+=e+i}(f=o.node().getBBox().height)<=0&&(f=r/2),d=n.insert("g").attr("class","methods-group text");let m=0;for(let t of e.methods){let e=await t3(d,t,m,[t.parseClassifier()]);m+=e+i}let x=n.node().getBBox();if(null!==s){let t=s.node().getBBox();s.attr("transform",`translate(${-t.width/2})`)}return h.attr("transform",`translate(${-p.width/2}, ${c})`),x=n.node().getBBox(),o.attr("transform",`translate(0, ${c+g+2*r})`),x=n.node().getBBox(),d.attr("transform",`translate(0, ${c+g+(f?f+4*r:2*r)})`),x=n.node().getBBox(),{shapeSvg:n,bbox:x}}async function t3(t,e,a,l=[]){let r;let o=t.insert("g").attr("class","label").attr("style",l.join("; ")),d=(0,s.iE)(),c="useHtmlLabels"in e?e.useHtmlLabels:(0,s.ku)(d.htmlLabels)??!0,g="";g="text"in e?e.text:e.label,!c&&g.startsWith("\\")&&(g=g.substring(1)),(0,s.l0)(g)&&(c=!0);let y=await (0,i.rw)(o,(0,s.uX)((0,n.SH)(g)),{width:(0,n.Cq)(g,d)+50,classes:"markdown-node-label",useHtmlLabels:c},d),f=1;if(c){let t=y.children[0],e=(0,h.Ys)(y);f=t.innerHTML.split("<br>").length,t.innerHTML.includes("</math>")&&(f+=t.innerHTML.split("<mrow>").length-1);let a=t.getElementsByTagName("img");if(a){let t=""===g.replace(/<img[^>]*>/g,"").trim();await Promise.all([...a].map(e=>new Promise(a=>{function l(){if(e.style.display="flex",e.style.flexDirection="column",t){let t=5*parseInt(d.fontSize?.toString()??window.getComputedStyle(document.body).fontSize,10)+"px";e.style.minWidth=t,e.style.maxWidth=t}else e.style.width="100%";a(e)}(0,s.eW)(l,"setupImage"),setTimeout(()=>{e.complete&&l()}),e.addEventListener("error",l),e.addEventListener("load",l)})))}r=t.getBoundingClientRect(),e.attr("width",r.width),e.attr("height",r.height)}else{l.includes("font-weight: bolder")&&(0,h.Ys)(y).selectAll("tspan").attr("font-weight",""),f=y.children.length;let t=y.children[0];(""===y.textContent||y.textContent.includes("&gt"))&&(t.textContent=g[0]+g.substring(1).replaceAll("&gt;",">").replaceAll("&lt;","<").trim()," "===g[1]&&(t.textContent=t.textContent[0]+" "+t.textContent.substring(1))),"undefined"===t.textContent&&(t.textContent=""),r=y.getBBox()}return o.attr("transform","translate(0,"+(-r.height/(2*f)+a)+")"),r.height}async function t6(t,e){let a=(0,s.nV)(),l=a.class.padding??12,r=e.useHtmlLabels??(0,s.ku)(a.htmlLabels)??!0;e.annotations=e.annotations??[],e.members=e.members??[],e.methods=e.methods??[];let{shapeSvg:i,bbox:n}=await t9(t,e,a,r,l),{labelStyles:d,nodeStyles:c}=D(e);e.labelStyle=d,e.cssStyles=e.styles||"";let y=e.styles?.join(";")||c||"";e.cssStyles||(e.cssStyles=y.replaceAll("!important","").split(";"));let f=0===e.members.length&&0===e.methods.length&&!a.class?.hideEmptyMembersBox,p=o.Z.svg(i),u=W(e,{});"handDrawn"!==e.look&&(u.roughness=0,u.fillStyle="solid");let m=n.width,x=n.height;0===e.members.length&&0===e.methods.length?x+=l:e.members.length>0&&0===e.methods.length&&(x+=2*l);let w=-m/2,b=-x/2,$=p.rectangle(w-l,b-l-(f?l:0===e.members.length&&0===e.methods.length?-l/2:0),m+2*l,x+2*l+(f?2*l:0===e.members.length&&0===e.methods.length?-l:0),u),k=i.insert(()=>$,":first-child");k.attr("class","basic label-container");let M=k.node().getBBox();i.selectAll(".text").each((t,a,n)=>{let s=(0,h.Ys)(n[a]),o=s.attr("transform"),d=0;if(o){let t=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(o);t&&(d=parseFloat(t[2]))}let c=d+b+l-(f?l:0===e.members.length&&0===e.methods.length?-l/2:0);r||(c-=4);let g=w;(s.attr("class").includes("label-group")||s.attr("class").includes("annotation-group"))&&(g=-s.node()?.getBBox().width/2||0,i.selectAll("text").each(function(t,e,a){"middle"===window.getComputedStyle(a[e]).textAnchor&&(g=0)})),s.attr("transform",`translate(${g}, ${c})`)});let S=i.select(".annotation-group").node().getBBox().height-(f?l/2:0)||0,v=i.select(".label-group").node().getBBox().height-(f?l/2:0)||0,N=i.select(".members-group").node().getBBox().height-(f?l/2:0)||0;if(e.members.length>0||e.methods.length>0||f){let t=p.line(M.x,S+v+b+l,M.x+M.width,S+v+b+l,u);i.insert(()=>t).attr("class","divider").attr("style",y)}if(f||e.members.length>0||e.methods.length>0){let t=p.line(M.x,S+v+N+b+2*l+l,M.x+M.width,S+v+N+b+l+2*l,u);i.insert(()=>t).attr("class","divider").attr("style",y)}if("handDrawn"!==e.look&&i.selectAll("path").attr("style",y),k.select(":nth-child(2)").attr("style",y),i.selectAll(".divider").select("path").attr("style",y),e.labelStyle?i.selectAll("span").attr("style",e.labelStyle):i.selectAll("span").attr("style",y),!r){let t=RegExp(/color\s*:\s*([^;]*)/),e=t.exec(y);if(e){let t=e[0].replace("color","fill");i.selectAll("tspan").attr("style",t)}else if(d){let e=t.exec(d);if(e){let t=e[0].replace("color","fill");i.selectAll("tspan").attr("style",t)}}}return g(e,k),e.intersect=function(t){return V.rect(e,t)},i}(0,s.eW)(t0,"tiltedCylinder"),(0,s.eW)(t2,"trapezoid"),(0,s.eW)(t1,"trapezoidalPentagon"),(0,s.eW)(t5,"triangle"),(0,s.eW)(t8,"waveEdgedRectangle"),(0,s.eW)(t4,"waveRectangle"),(0,s.eW)(t7,"windowPane"),(0,s.eW)(t9,"textHelper"),(0,s.eW)(t3,"addText"),(0,s.eW)(t6,"classBox");var et=(0,s.eW)(t=>{switch(t){case"Very High":return"red";case"High":return"orange";case"Medium":return null;case"Low":return"blue";case"Very Low":return"lightblue"}},"colorFromPriority");async function ee(t,e,{config:a}){let l,r,i,n;let{labelStyles:s,nodeStyles:h}=D(e);e.labelStyle=s||"";let f=e.width;e.width=(e.width??200)-10;let{shapeSvg:p,bbox:u,label:m}=await d(t,e,y(e)),x=e.padding||10,w="";"ticket"in e&&e.ticket&&a?.kanban?.ticketBaseUrl&&(w=a?.kanban?.ticketBaseUrl.replace("#TICKET#",e.ticket),l=p.insert("svg:a",":first-child").attr("class","kanban-ticket-link").attr("xlink:href",w).attr("target","_blank"));let b={useHtmlLabels:e.useHtmlLabels,labelStyle:e.labelStyle||"",width:e.width,img:e.img,padding:e.padding||8,centerLabel:!1};l?{label:r,bbox:i}=await c(l,"ticket"in e&&e.ticket||"",b):{label:r,bbox:i}=await c(p,"ticket"in e&&e.ticket||"",b);let{label:k,bbox:M}=await c(p,"assigned"in e&&e.assigned||"",b);e.width=f;let S=e?.width||0,v=Math.max(i.height,M.height)/2,N=Math.max(u.height+20,e?.height||0)+v,C=-S/2,B=-N/2;m.attr("transform","translate("+(x-S/2)+", "+(-v-u.height/2)+")"),r.attr("transform","translate("+(x-S/2)+", "+(-v+u.height/2)+")"),k.attr("transform","translate("+(x+S/2-M.width-20)+", "+(-v+u.height/2)+")");let{rx:A,ry:R}=e,{cssStyles:L}=e;if("handDrawn"===e.look){let t=o.Z.svg(p),a=W(e,{}),l=A||R?t.path($(C,B,S,N,A||0),a):t.rectangle(C,B,S,N,a);(n=p.insert(()=>l,":first-child")).attr("class","basic label-container").attr("style",L||null)}else{(n=p.insert("rect",":first-child")).attr("class","basic label-container __APA__").attr("style",h).attr("rx",A??5).attr("ry",R??5).attr("x",C).attr("y",B).attr("width",S).attr("height",N);let t="priority"in e&&e.priority;if(t){let e=p.append("line"),a=C+2,l=B+Math.floor((A??0)/2),r=B+N-Math.floor((A??0)/2);e.attr("x1",a).attr("y1",l).attr("x2",a).attr("y2",r).attr("stroke-width","4").attr("stroke",et(t))}}return g(e,n),e.height=N,e.intersect=function(t){return V.rect(e,t)},p}(0,s.eW)(ee,"kanbanItem");var ea=[{semanticName:"Process",name:"Rectangle",shortName:"rect",description:"Standard process shape",aliases:["proc","process","rectangle"],internalAliases:["squareRect"],handler:t_},{semanticName:"Event",name:"Rounded Rectangle",shortName:"rounded",description:"Represents an event",aliases:["event"],internalAliases:["roundedRect"],handler:tH},{semanticName:"Terminal Point",name:"Stadium",shortName:"stadium",description:"Terminal point",aliases:["terminal","pill"],handler:tY},{semanticName:"Subprocess",name:"Framed Rectangle",shortName:"fr-rect",description:"Subprocess",aliases:["subprocess","subproc","framed-rectangle","subroutine"],handler:tF},{semanticName:"Database",name:"Cylinder",shortName:"cyl",description:"Database storage",aliases:["db","database","cylinder"],handler:tn},{semanticName:"Start",name:"Circle",shortName:"circle",description:"Starting point",aliases:["circ"],handler:F},{semanticName:"Decision",name:"Diamond",shortName:"diam",description:"Decision-making step",aliases:["decision","diamond","question"],handler:tI},{semanticName:"Prepare Conditional",name:"Hexagon",shortName:"hex",description:"Preparation or condition step",aliases:["hexagon","prepare"],handler:tf},{semanticName:"Data Input/Output",name:"Lean Right",shortName:"lean-r",description:"Represents input or output",aliases:["lean-right","in-out"],internalAliases:["lean_right"],handler:tD},{semanticName:"Data Input/Output",name:"Lean Left",shortName:"lean-l",description:"Represents output or input",aliases:["lean-left","out-in"],internalAliases:["lean_left"],handler:tS},{semanticName:"Priority Action",name:"Trapezoid Base Bottom",shortName:"trap-b",description:"Priority action",aliases:["priority","trapezoid-bottom","trapezoid"],handler:t2},{semanticName:"Manual Operation",name:"Trapezoid Base Top",shortName:"trap-t",description:"Represents a manual task",aliases:["manual","trapezoid-top","inv-trapezoid"],internalAliases:["inv_trapezoid"],handler:t$},{semanticName:"Stop",name:"Double Circle",shortName:"dbl-circ",description:"Represents a stop point",aliases:["double-circle"],internalAliases:["doublecircle"],handler:th},{semanticName:"Text Block",name:"Text Block",shortName:"text",description:"Text block",handler:tG},{semanticName:"Card",name:"Notched Rectangle",shortName:"notch-rect",description:"Represents a card",aliases:["card","notched-rectangle"],handler:q},{semanticName:"Lined/Shaded Process",name:"Lined Rectangle",shortName:"lin-rect",description:"Lined process shape",aliases:["lined-rectangle","lined-process","lin-proc","shaded-process"],handler:tV},{semanticName:"Start",name:"Small Circle",shortName:"sm-circ",description:"Small starting point",aliases:["start","small-circle"],internalAliases:["stateStart"],handler:tO},{semanticName:"Stop",name:"Framed Circle",shortName:"fr-circ",description:"Stop point",aliases:["stop","framed-circle"],internalAliases:["stateEnd"],handler:tq},{semanticName:"Fork/Join",name:"Filled Rectangle",shortName:"fork",description:"Fork or join in process flow",aliases:["join"],internalAliases:["forkJoin"],handler:tc},{semanticName:"Collate",name:"Hourglass",shortName:"hourglass",description:"Represents a collate operation",aliases:["hourglass","collate"],handler:tp},{semanticName:"Comment",name:"Curly Brace",shortName:"brace",description:"Adds a comment",aliases:["comment","brace-l"],handler:U},{semanticName:"Comment Right",name:"Curly Brace",shortName:"brace-r",description:"Adds a comment",handler:Q},{semanticName:"Comment with braces on both sides",name:"Curly Braces",shortName:"braces",description:"Adds a comment",handler:te},{semanticName:"Com Link",name:"Lightning Bolt",shortName:"bolt",description:"Communication link",aliases:["com-link","lightning-bolt"],handler:tW},{semanticName:"Document",name:"Document",shortName:"doc",description:"Represents a document",aliases:["doc","document"],handler:t8},{semanticName:"Delay",name:"Half-Rounded Rectangle",shortName:"delay",description:"Represents a delay",aliases:["half-rounded-rectangle"],handler:tg},{semanticName:"Direct Access Storage",name:"Horizontal Cylinder",shortName:"h-cyl",description:"Direct access storage",aliases:["das","horizontal-cylinder"],handler:t0},{semanticName:"Disk Storage",name:"Lined Cylinder",shortName:"lin-cyl",description:"Disk storage",aliases:["disk","lined-cylinder"],handler:tB},{semanticName:"Display",name:"Curved Trapezoid",shortName:"curv-trap",description:"Represents a display",aliases:["curved-trapezoid","display"],handler:ta},{semanticName:"Divided Process",name:"Divided Rectangle",shortName:"div-rect",description:"Divided process shape",aliases:["div-proc","divided-rectangle","divided-process"],handler:ts},{semanticName:"Extract",name:"Triangle",shortName:"tri",description:"Extraction process",aliases:["extract","triangle"],handler:t5},{semanticName:"Internal Storage",name:"Window Pane",shortName:"win-pane",description:"Internal storage",aliases:["internal-storage","window-pane"],handler:t7},{semanticName:"Junction",name:"Filled Circle",shortName:"f-circ",description:"Junction point",aliases:["junction","filled-circle"],handler:to},{semanticName:"Loop Limit",name:"Trapezoidal Pentagon",shortName:"notch-pent",description:"Loop limit step",aliases:["loop-limit","notched-pentagon"],handler:t1},{semanticName:"Manual File",name:"Flipped Triangle",shortName:"flip-tri",description:"Manual file operation",aliases:["manual-file","flipped-triangle"],handler:td},{semanticName:"Manual Input",name:"Sloped Rectangle",shortName:"sl-rect",description:"Manual input step",aliases:["manual-input","sloped-rectangle"],handler:tj},{semanticName:"Multi-Document",name:"Stacked Document",shortName:"docs",description:"Multiple documents",aliases:["documents","st-doc","stacked-document"],handler:tL},{semanticName:"Multi-Process",name:"Stacked Rectangle",shortName:"st-rect",description:"Multiple processes",aliases:["procs","processes","stacked-rectangle"],handler:tR},{semanticName:"Stored Data",name:"Bow Tie Rectangle",shortName:"bow-rect",description:"Stored data",aliases:["stored-data","bow-tie-rectangle"],handler:Y},{semanticName:"Summary",name:"Crossed Circle",shortName:"cross-circ",description:"Summary",aliases:["summary","crossed-circle"],handler:J},{semanticName:"Tagged Document",name:"Tagged Document",shortName:"tag-doc",description:"Tagged document",aliases:["tag-doc","tagged-document"],handler:tJ},{semanticName:"Tagged Process",name:"Tagged Rectangle",shortName:"tag-rect",description:"Tagged process",aliases:["tagged-rectangle","tag-proc","tagged-process"],handler:tX},{semanticName:"Paper Tape",name:"Flag",shortName:"flag",description:"Paper tape",aliases:["paper-tape"],handler:t4},{semanticName:"Odd",name:"Odd",shortName:"odd",description:"Odd shape",internalAliases:["rect_left_inv_arrow"],handler:tT},{semanticName:"Lined Document",name:"Lined Document",shortName:"lin-doc",description:"Lined document",aliases:["lined-document"],handler:tA}],el=(0,s.eW)(()=>Object.fromEntries([...Object.entries({state:tz,choice:O,note:tP,rectWithTitle:tE,labelRect:tM,iconSquare:tw,iconCircle:tm,icon:tu,iconRounded:tx,imageSquare:tb,anchor:j,kanbanItem:ee,classBox:t6}),...ea.flatMap(t=>[t.shortName,..."aliases"in t?t.aliases:[],..."internalAliases"in t?t.internalAliases:[]].map(e=>[e,t.handler]))]),"generateShapeMap")();function er(t){return t in el}(0,s.eW)(er,"isValidShape");var ei=new Map;async function en(t,e,a){let l,r;"rect"===e.shape&&(e.rx&&e.ry?e.shape="roundedRect":e.shape="squareRect");let i=e.shape?el[e.shape]:void 0;if(!i)throw Error(`No such shape: ${e.shape}. Please check your syntax.`);if(e.link){let n;"sandbox"===a.config.securityLevel?n="_top":e.linkTarget&&(n=e.linkTarget||"_blank"),l=t.insert("svg:a").attr("xlink:href",e.link).attr("target",n??null),r=await i(l,e,a)}else l=r=await i(t,e,a);return e.tooltip&&r.attr("title",e.tooltip),ei.set(e.id,l),e.haveCallback&&l.attr("class",l.attr("class")+" clickable"),l}(0,s.eW)(en,"insertNode");var es=(0,s.eW)((t,e)=>{ei.set(e.id,t)},"setNodeElem"),eh=(0,s.eW)(()=>{ei.clear()},"clear"),eo=(0,s.eW)(t=>{let e=ei.get(t.id);s.cM.trace("Transforming node",t.diff,t,"translate("+(t.x-t.width/2-5)+", "+t.width/2+")");let a=t.diff||0;return t.clusterNode?e.attr("transform","translate("+(t.x+a-t.width/2)+", "+(t.y-t.height/2-8)+")"):e.attr("transform","translate("+t.x+", "+t.y+")"),a},"positionNode")}}]);
@@ -0,0 +1 @@
1
+ !function(){"use strict";var e,t,n,r,o,c,f,a,u,i={},d={};function b(e){var t=d[e];if(void 0!==t)return t.exports;var n=d[e]={exports:{}},r=!0;try{i[e].call(n.exports,n,n.exports,b),r=!1}finally{r&&delete d[e]}return n.exports}b.m=i,e=[],b.O=function(t,n,r,o){if(n){o=o||0;for(var c=e.length;c>0&&e[c-1][2]>o;c--)e[c]=e[c-1];e[c]=[n,r,o];return}for(var f=1/0,c=0;c<e.length;c++){for(var n=e[c][0],r=e[c][1],o=e[c][2],a=!0,u=0;u<n.length;u++)f>=o&&Object.keys(b.O).every(function(e){return b.O[e](n[u])})?n.splice(u--,1):(a=!1,o<f&&(f=o));if(a){e.splice(c--,1);var i=r();void 0!==i&&(t=i)}}return t},b.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return b.d(t,{a:t}),t},n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},b.t=function(e,r){if(1&r&&(e=this(e)),8&r||"object"==typeof e&&e&&(4&r&&e.__esModule||16&r&&"function"==typeof e.then))return e;var o=Object.create(null);b.r(o);var c={};t=t||[null,n({}),n([]),n(n)];for(var f=2&r&&e;"object"==typeof f&&!~t.indexOf(f);f=n(f))Object.getOwnPropertyNames(f).forEach(function(t){c[t]=function(){return e[t]}});return c.default=function(){return e},b.d(o,c),o},b.d=function(e,t){for(var n in t)b.o(t,n)&&!b.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},b.f={},b.e=function(e){return Promise.all(Object.keys(b.f).reduce(function(t,n){return b.f[n](e,t),t},[]))},b.u=function(e){return"static/chunks/"+(({1264:"90542734",4692:"0d8bff65",6555:"964ecbae",7293:"94ca1967"})[e]||e)+"."+({58:"f4bd8a3c9d88f5fe",133:"392ae90c3b2a67f2",1243:"ea2826fb35adb15a",1264:"fecd4dc1a89ed166",1592:"b069bdb7aaddd2eb",2069:"f060659791c0c484",2170:"45431769330fa5b7",3237:"c4754f02f1a388cb",3305:"1fc7297ba154ee95",3332:"6313db5217bb1b67",3451:"421db0b49fdbd881",3460:"39c2b9b6a3898384",3727:"dcea8f2193111552",4299:"2aaa569416cfc208",4327:"238d15c09a039b8b",4415:"e0c0da5eedae4dd7",4610:"196691887afb7fea",4650:"41f041da0ad365ad",4692:"4b1018183a8be7c2",4872:"5422e8324272ab40",5061:"79a660faed0e16a9",5279:"85d537880b8041ae",5402:"b9460f1b16b57e92",5555:"f7cf9795d675de51",5978:"ddc72cd73130aadc",6434:"e6cd986d690f2cef",6555:"51d6faf8801d15e6",7140:"4be689873f6a2d1f",7293:"1d9b42d929a1ee8c",7836:"86884157d53d23a1",7890:"f681eb1d1f83bea2",7953:"f6fc335a23efb959",8254:"3145a4fbdcfdca46",8400:"c95e4e79bcd79a56",8673:"be44c4d9e4f1d084",8698:"a088118fef40d302",9022:"33974a513a281fd2",9433:"b1b5f5d050c43e3c",9597:"83583248dfbf6e73",9822:"34f293973c4e9b04"})[e]+".js"},b.miniCssF=function(e){},b.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),b.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r={},o="_N_E:",b.l=function(e,t,n,c){if(r[e]){r[e].push(t);return}if(void 0!==n)for(var f,a,u=document.getElementsByTagName("script"),i=0;i<u.length;i++){var d=u[i];if(d.getAttribute("src")==e||d.getAttribute("data-webpack")==o+n){f=d;break}}f||(a=!0,(f=document.createElement("script")).charset="utf-8",f.timeout=120,b.nc&&f.setAttribute("nonce",b.nc),f.setAttribute("data-webpack",o+n),f.src=b.tu(e)),r[e]=[t];var l=function(t,n){f.onerror=f.onload=null,clearTimeout(s);var o=r[e];if(delete r[e],f.parentNode&&f.parentNode.removeChild(f),o&&o.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:f}),12e4);f.onerror=l.bind(null,f.onerror),f.onload=l.bind(null,f.onload),a&&document.head.appendChild(f)},b.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},b.tt=function(){return void 0===c&&(c={createScriptURL:function(e){return e}},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(c=trustedTypes.createPolicy("nextjs#bundler",c))),c},b.tu=function(e){return b.tt().createScriptURL(e)},b.p="/_next/",f={2272:0,3254:0,3587:0,6250:0,8255:0,1607:0,6008:0,2026:0,9346:0},b.f.j=function(e,t){var n=b.o(f,e)?f[e]:void 0;if(0!==n){if(n)t.push(n[2]);else if(/^(1607|2026|2272|3254|3587|6008|6250|8255|9346)$/.test(e))f[e]=0;else{var r=new Promise(function(t,r){n=f[e]=[t,r]});t.push(n[2]=r);var o=b.p+b.u(e),c=Error();b.l(o,function(t){if(b.o(f,e)&&(0!==(n=f[e])&&(f[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;c.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",c.name="ChunkLoadError",c.type=r,c.request=o,n[1](c)}},"chunk-"+e,e)}}},b.O.j=function(e){return 0===f[e]},a=function(e,t){var n,r,o=t[0],c=t[1],a=t[2],u=0;if(o.some(function(e){return 0!==f[e]})){for(n in c)b.o(c,n)&&(b.m[n]=c[n]);if(a)var i=a(b)}for(e&&e(t);u<o.length;u++)r=o[u],b.o(f,r)&&f[r]&&f[r][0](),f[r]=0;return b.O(i)},(u=self.webpackChunk_N_E=self.webpackChunk_N_E||[]).forEach(a.bind(null,0)),u.push=a.bind(null,u.push.bind(u)),b.nc=void 0}();
@@ -0,0 +1 @@
1
+ div.search_searchLayout__fP3m0{display:grid;grid-template-columns:1fr;gap:1rem;height:100%}@media screen and (max-width:768px){div.search_searchLayout__fP3m0{gap:0}}