khoj 2.0.0b12__py3-none-any.whl → 2.0.0b13__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.
- khoj/app/README.md +1 -1
- khoj/app/urls.py +1 -0
- khoj/configure.py +21 -54
- khoj/database/adapters/__init__.py +6 -15
- khoj/database/management/commands/delete_orphaned_fileobjects.py +0 -1
- khoj/database/migrations/0064_remove_conversation_temp_id_alter_conversation_id.py +1 -1
- khoj/database/migrations/0075_migrate_generated_assets_and_validate.py +1 -1
- khoj/database/migrations/0092_alter_chatmodel_model_type_alter_chatmodel_name_and_more.py +36 -0
- khoj/database/migrations/0093_remove_localorgconfig_user_and_more.py +36 -0
- khoj/database/models/__init__.py +10 -40
- khoj/database/tests.py +0 -2
- khoj/interface/compiled/404/index.html +2 -2
- khoj/interface/compiled/_next/static/chunks/{9245.a04e92d034540234.js → 1225.ecac11e7421504c4.js} +3 -3
- khoj/interface/compiled/_next/static/chunks/1320.ae930ad00affe685.js +5 -0
- khoj/interface/compiled/_next/static/chunks/{1327-3b1a41af530fa8ee.js → 1327-e254819a9172cfa7.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/1626.15a8acc0d6639ec6.js +1 -0
- khoj/interface/compiled/_next/static/chunks/{3489.c523fe96a2eee74f.js → 1940.d082758bd04e08ae.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/{2327-ea623ca2d22f78e9.js → 2327-438aaec1657c5ada.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/2475.57a0d0fd93d07af0.js +93 -0
- khoj/interface/compiled/_next/static/chunks/2481.5ce6524ba0a73f90.js +55 -0
- khoj/interface/compiled/_next/static/chunks/297.4c4c823ff6e3255b.js +174 -0
- khoj/interface/compiled/_next/static/chunks/{5639-09e2009a2adedf8b.js → 3260-82d2521fab032ff1.js} +68 -23
- khoj/interface/compiled/_next/static/chunks/3353.1c6d553216a1acae.js +1 -0
- khoj/interface/compiled/_next/static/chunks/3855.f7b8131f78af046e.js +1 -0
- khoj/interface/compiled/_next/static/chunks/3973.dc54a39586ab48be.js +1 -0
- khoj/interface/compiled/_next/static/chunks/4241.c1cd170f7f37ac59.js +24 -0
- khoj/interface/compiled/_next/static/chunks/{4327.8d2a1b8f1ea78208.js → 4327.f3704dc398c67113.js} +19 -19
- khoj/interface/compiled/_next/static/chunks/4505.f09454a346269c3f.js +117 -0
- khoj/interface/compiled/_next/static/chunks/4801.96a152d49742b644.js +1 -0
- khoj/interface/compiled/_next/static/chunks/5427-a95ec748e52abb75.js +1 -0
- khoj/interface/compiled/_next/static/chunks/549.2bd27f59a91a9668.js +148 -0
- khoj/interface/compiled/_next/static/chunks/5765.71b1e1207b76b03f.js +1 -0
- khoj/interface/compiled/_next/static/chunks/584.d7ce3505f169b706.js +1 -0
- khoj/interface/compiled/_next/static/chunks/6240.34f7c1fa692edd61.js +24 -0
- khoj/interface/compiled/_next/static/chunks/6d3fe5a5-f9f3c16e0bc0cdf9.js +10 -0
- khoj/interface/compiled/_next/static/chunks/{7127-0f4a2a77d97fb5fa.js → 7127-97b83757db125ba6.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/7200-93ab0072359b8028.js +1 -0
- khoj/interface/compiled/_next/static/chunks/{2612.bcf5a623b3da209e.js → 7553.f5ad54b1f6e92c49.js} +2 -2
- khoj/interface/compiled/_next/static/chunks/7626-1b630f1654172341.js +1 -0
- khoj/interface/compiled/_next/static/chunks/764.dadd316e8e16d191.js +63 -0
- khoj/interface/compiled/_next/static/chunks/78.08169ab541abab4f.js +43 -0
- khoj/interface/compiled/_next/static/chunks/784.e03acf460df213d1.js +1 -0
- khoj/interface/compiled/_next/static/chunks/{9537-d9ab442ce15d1e20.js → 8072-e1440cb482a0940e.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/{3265.924139c4146ee344.js → 8086.8d39887215807fcd.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/8168.f074ab8c7c16d82d.js +59 -0
- khoj/interface/compiled/_next/static/chunks/{8694.2bd9c2f65d8c5847.js → 8223.1705878fa7a09292.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/8483.94f6c9e2bee86f50.js +215 -0
- khoj/interface/compiled/_next/static/chunks/{8888.ebe0e552b59e7fed.js → 8810.fc0e479de78c7c61.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/8828.bc74dc4ce94e78f6.js +1 -0
- khoj/interface/compiled/_next/static/chunks/{7303.d0612f812a967a08.js → 8909.14ac3f43d0070cf1.js} +5 -5
- khoj/interface/compiled/_next/static/chunks/90542734.b1a1629065ba199b.js +1 -0
- khoj/interface/compiled/_next/static/chunks/9167.098534184f03fe92.js +56 -0
- khoj/interface/compiled/_next/static/chunks/{4980.63500d68b3bb1222.js → 9537.e934ce37bf314509.js} +5 -5
- khoj/interface/compiled/_next/static/chunks/9574.3fe8e26e95bf1c34.js +1 -0
- khoj/interface/compiled/_next/static/chunks/9599.ec50b5296c27dae9.js +1 -0
- khoj/interface/compiled/_next/static/chunks/9643.b34248df52ffc77c.js +262 -0
- khoj/interface/compiled/_next/static/chunks/9747.2fd9065b1435abb1.js +1 -0
- khoj/interface/compiled/_next/static/chunks/9922.98f2b2a9959b4ebe.js +1 -0
- khoj/interface/compiled/_next/static/chunks/app/agents/layout-e49165209d2e406c.js +1 -0
- khoj/interface/compiled/_next/static/chunks/app/agents/page-e291b49977f43880.js +1 -0
- khoj/interface/compiled/_next/static/chunks/app/automations/page-198b26df6e09bbb0.js +1 -0
- khoj/interface/compiled/_next/static/chunks/app/chat/layout-33934fc2d6ae6838.js +1 -0
- khoj/interface/compiled/_next/static/chunks/app/chat/{page-4bc2938df5d57981.js → page-dfcc1e8e2ad62873.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/{page-a19a597629e87fb8.js → page-1567cac7b79a7c59.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/search/layout-c02531d586972d7d.js +1 -0
- khoj/interface/compiled/_next/static/chunks/app/search/{page-fa366ac14b228688.js → page-3639e50ec3e9acfd.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/settings/{page-8f9a85f96088c18b.js → page-6081362437c82470.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/share/chat/layout-6fb51c5c80f8ec67.js +1 -0
- khoj/interface/compiled/_next/static/chunks/app/share/chat/{page-ed7787cf4938b8e3.js → page-e0dcb1762f8c8f88.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/webpack-5393aad3d824e0cb.js +1 -0
- khoj/interface/compiled/_next/static/css/{a0c2fd63bb396f04.css → 23b26df423cd8a9c.css} +1 -1
- khoj/interface/compiled/_next/static/css/{93eeacc43e261162.css → c34713c98384ee87.css} +1 -1
- khoj/interface/compiled/agents/index.html +2 -2
- khoj/interface/compiled/agents/index.txt +3 -3
- khoj/interface/compiled/automations/index.html +2 -2
- khoj/interface/compiled/automations/index.txt +4 -4
- khoj/interface/compiled/chat/index.html +2 -2
- khoj/interface/compiled/chat/index.txt +3 -3
- khoj/interface/compiled/index.html +2 -2
- khoj/interface/compiled/index.txt +3 -3
- khoj/interface/compiled/search/index.html +2 -2
- khoj/interface/compiled/search/index.txt +3 -3
- khoj/interface/compiled/settings/index.html +2 -2
- khoj/interface/compiled/settings/index.txt +5 -5
- khoj/interface/compiled/share/chat/index.html +2 -2
- khoj/interface/compiled/share/chat/index.txt +3 -3
- khoj/main.py +7 -9
- khoj/manage.py +1 -0
- khoj/processor/content/github/github_to_entries.py +6 -7
- khoj/processor/content/images/image_to_entries.py +0 -1
- khoj/processor/content/markdown/markdown_to_entries.py +2 -3
- khoj/processor/content/notion/notion_to_entries.py +5 -6
- khoj/processor/content/org_mode/org_to_entries.py +4 -5
- khoj/processor/content/org_mode/orgnode.py +4 -4
- khoj/processor/content/plaintext/plaintext_to_entries.py +1 -2
- khoj/processor/content/text_to_entries.py +1 -3
- khoj/processor/conversation/google/utils.py +3 -3
- khoj/processor/conversation/openai/gpt.py +65 -28
- khoj/processor/conversation/openai/utils.py +359 -28
- khoj/processor/conversation/prompts.py +16 -41
- khoj/processor/conversation/utils.py +29 -39
- khoj/processor/embeddings.py +0 -2
- khoj/processor/image/generate.py +3 -3
- khoj/processor/operator/__init__.py +2 -3
- khoj/processor/operator/grounding_agent.py +15 -2
- khoj/processor/operator/grounding_agent_uitars.py +34 -23
- khoj/processor/operator/operator_agent_anthropic.py +29 -4
- khoj/processor/operator/operator_agent_base.py +1 -1
- khoj/processor/operator/operator_agent_binary.py +4 -4
- khoj/processor/operator/operator_agent_openai.py +21 -6
- khoj/processor/operator/operator_environment_browser.py +1 -1
- khoj/processor/operator/operator_environment_computer.py +1 -1
- khoj/processor/speech/text_to_speech.py +0 -1
- khoj/processor/tools/online_search.py +1 -1
- khoj/processor/tools/run_code.py +1 -1
- khoj/routers/api.py +2 -15
- khoj/routers/api_agents.py +1 -2
- khoj/routers/api_automation.py +1 -1
- khoj/routers/api_chat.py +10 -16
- khoj/routers/api_content.py +3 -111
- khoj/routers/api_model.py +0 -1
- khoj/routers/api_subscription.py +1 -1
- khoj/routers/email.py +4 -4
- khoj/routers/helpers.py +44 -103
- khoj/routers/research.py +8 -8
- khoj/search_filter/base_filter.py +2 -4
- khoj/search_type/text_search.py +1 -2
- khoj/utils/cli.py +5 -53
- khoj/utils/config.py +0 -65
- khoj/utils/constants.py +6 -7
- khoj/utils/helpers.py +10 -18
- khoj/utils/initialization.py +7 -48
- khoj/utils/models.py +2 -4
- khoj/utils/rawconfig.py +1 -69
- khoj/utils/state.py +2 -8
- khoj/utils/yaml.py +0 -39
- {khoj-2.0.0b12.dist-info → khoj-2.0.0b13.dist-info}/METADATA +3 -3
- {khoj-2.0.0b12.dist-info → khoj-2.0.0b13.dist-info}/RECORD +149 -158
- khoj/interface/compiled/_next/static/chunks/1191.b547ec13349b4aed.js +0 -1
- khoj/interface/compiled/_next/static/chunks/1588.f0558a0bdffc4761.js +0 -117
- khoj/interface/compiled/_next/static/chunks/1918.925cb4a35518d258.js +0 -43
- khoj/interface/compiled/_next/static/chunks/2849.dc00ae5ba7219cfc.js +0 -1
- khoj/interface/compiled/_next/static/chunks/303.fe76de943e930fbd.js +0 -1
- khoj/interface/compiled/_next/static/chunks/4533.586e74b45a2bde25.js +0 -55
- khoj/interface/compiled/_next/static/chunks/4551.82ce1476b5516bc2.js +0 -5
- khoj/interface/compiled/_next/static/chunks/4748.0edd37cba3ea2809.js +0 -59
- khoj/interface/compiled/_next/static/chunks/5210.cd35a1c1ec594a20.js +0 -93
- khoj/interface/compiled/_next/static/chunks/5329.f8b3c5b3d16159cd.js +0 -1
- khoj/interface/compiled/_next/static/chunks/5427-13d6ffd380fdfab7.js +0 -1
- khoj/interface/compiled/_next/static/chunks/558-c14e76cff03f6a60.js +0 -1
- khoj/interface/compiled/_next/static/chunks/5830.8876eccb82da9b7d.js +0 -262
- khoj/interface/compiled/_next/static/chunks/6230.88a71d8145347b3f.js +0 -1
- khoj/interface/compiled/_next/static/chunks/7161.77e0530a40ad5ca8.js +0 -1
- khoj/interface/compiled/_next/static/chunks/7200-ac3b2e37ff30e126.js +0 -1
- khoj/interface/compiled/_next/static/chunks/7505.c31027a3695bdebb.js +0 -148
- khoj/interface/compiled/_next/static/chunks/7760.35649cc21d9585bd.js +0 -56
- khoj/interface/compiled/_next/static/chunks/83.48e2db193a940052.js +0 -1
- khoj/interface/compiled/_next/static/chunks/8427.844694e06133fb51.js +0 -1
- khoj/interface/compiled/_next/static/chunks/8665.4db7e6b2e8933497.js +0 -174
- khoj/interface/compiled/_next/static/chunks/872.caf84cc1a39ae59f.js +0 -1
- khoj/interface/compiled/_next/static/chunks/8890.6e8a59e4de6978bc.js +0 -215
- khoj/interface/compiled/_next/static/chunks/8950.5f2272e0ac923f9e.js +0 -1
- khoj/interface/compiled/_next/static/chunks/90542734.2c21f16f18b22411.js +0 -1
- khoj/interface/compiled/_next/static/chunks/9202.c703864fcedc8d1f.js +0 -63
- khoj/interface/compiled/_next/static/chunks/9320.6aca4885d541aa44.js +0 -24
- khoj/interface/compiled/_next/static/chunks/9535.f78cd92d03331e55.js +0 -1
- khoj/interface/compiled/_next/static/chunks/9968.b111fc002796da81.js +0 -1
- khoj/interface/compiled/_next/static/chunks/app/agents/layout-4e2a134ec26aa606.js +0 -1
- khoj/interface/compiled/_next/static/chunks/app/agents/page-5db6ad18da10d353.js +0 -1
- khoj/interface/compiled/_next/static/chunks/app/automations/page-6271e2e31c7571d1.js +0 -1
- khoj/interface/compiled/_next/static/chunks/app/chat/layout-ad4d1792ab1a4108.js +0 -1
- khoj/interface/compiled/_next/static/chunks/app/search/layout-f5881c7ae3ba0795.js +0 -1
- khoj/interface/compiled/_next/static/chunks/app/share/chat/layout-abb6c5f4239ad7be.js +0 -1
- khoj/interface/compiled/_next/static/chunks/f3e3247b-1758d4651e4457c2.js +0 -10
- khoj/interface/compiled/_next/static/chunks/webpack-4b00e5a0da4a9dae.js +0 -1
- khoj/migrations/__init__.py +0 -0
- khoj/migrations/migrate_offline_chat_default_model.py +0 -69
- khoj/migrations/migrate_offline_chat_default_model_2.py +0 -71
- khoj/migrations/migrate_offline_chat_schema.py +0 -83
- khoj/migrations/migrate_offline_model.py +0 -29
- khoj/migrations/migrate_processor_config_openai.py +0 -67
- khoj/migrations/migrate_server_pg.py +0 -132
- khoj/migrations/migrate_version.py +0 -17
- khoj/processor/conversation/offline/__init__.py +0 -0
- khoj/processor/conversation/offline/chat_model.py +0 -224
- khoj/processor/conversation/offline/utils.py +0 -80
- khoj/processor/conversation/offline/whisper.py +0 -15
- khoj/utils/fs_syncer.py +0 -252
- /khoj/interface/compiled/_next/static/{TTch40tYWOfh0SzwjwZXV → RYbQvo3AvgOR0bEVVfxF4}/_buildManifest.js +0 -0
- /khoj/interface/compiled/_next/static/{TTch40tYWOfh0SzwjwZXV → RYbQvo3AvgOR0bEVVfxF4}/_ssgManifest.js +0 -0
- /khoj/interface/compiled/_next/static/chunks/{1915-fbfe167c84ad60c5.js → 1915-5c6508f6ebb62a30.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{2117-e78b6902ad6f75ec.js → 2117-080746c8e170c81a.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{2939-4d4084c5b888b960.js → 2939-4af3fd24b8ffc9ad.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{4447-d6cf93724d57e34b.js → 4447-cd95608f8e93e711.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{8667-4b7790573b08c50d.js → 8667-50b03a89e82e0ba7.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{9139-ce1ae935dac9c871.js → 9139-8ac4d9feb10f8869.js} +0 -0
- {khoj-2.0.0b12.dist-info → khoj-2.0.0b13.dist-info}/WHEEL +0 -0
- {khoj-2.0.0b12.dist-info → khoj-2.0.0b13.dist-info}/entry_points.txt +0 -0
- {khoj-2.0.0b12.dist-info → khoj-2.0.0b13.dist-info}/licenses/LICENSE +0 -0
@@ -1,63 +0,0 @@
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9202],{80469:function(t,e,r){function a(t,e){t.accDescr&&e.setAccDescription?.(t.accDescr),t.accTitle&&e.setAccTitle?.(t.accTitle),t.title&&e.setDiagramTitle?.(t.title)}r.d(e,{A:function(){return a}}),(0,r(54166).eW)(a,"populateCommonDb")},40747:function(t,e,r){r.d(e,{A:function(){return o}});var a=r(54166),o=class{constructor(t){this.init=t,this.records=this.init()}static{(0,a.eW)(this,"ImperativeState")}reset(){this.records=this.init()}}},9202:function(t,e,r){r.d(e,{diagram:function(){return tp}});var a=r(80469),o=r(40747),i=r(9242),c=r(54166),n=r(54327),s=r(15440),h={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},d=c.vZ.gitGraph,l=(0,c.eW)(()=>(0,i.Rb)({...d,...(0,c.iE)().gitGraph}),"getConfig"),$=new o.A(()=>{let t=l(),e=t.mainBranchName,r=t.mainBranchOrder;return{mainBranchName:e,commits:new Map,head:null,branchConfig:new Map([[e,{name:e,order:r}]]),branches:new Map([[e,null]]),currBranch:e,direction:"LR",seq:0,options:{}}});function m(){return(0,i.MX)({length:7})}function g(t,e){let r=Object.create(null);return t.reduce((t,a)=>{let o=e(a);return r[o]||(r[o]=!0,t.push(a)),t},[])}(0,c.eW)(m,"getID"),(0,c.eW)(g,"uniqBy");var y=(0,c.eW)(function(t){$.records.direction=t},"setDirection"),p=(0,c.eW)(function(t){c.cM.debug("options str",t),t=(t=t?.trim())||"{}";try{$.records.options=JSON.parse(t)}catch(t){c.cM.error("error while parsing gitGraph options",t.message)}},"setOptions"),f=(0,c.eW)(function(){return $.records.options},"getOptions"),x=(0,c.eW)(function(t){let e=t.msg,r=t.id,a=t.type,o=t.tags;c.cM.info("commit",e,r,a,o),c.cM.debug("Entering commit:",e,r,a,o);let i=l();r=c.SY.sanitizeText(r,i),e=c.SY.sanitizeText(e,i),o=o?.map(t=>c.SY.sanitizeText(t,i));let n={id:r||$.records.seq+"-"+m(),message:e,seq:$.records.seq++,type:a??h.NORMAL,tags:o??[],parents:null==$.records.head?[]:[$.records.head.id],branch:$.records.currBranch};$.records.head=n,c.cM.info("main branch",i.mainBranchName),$.records.commits.set(n.id,n),$.records.branches.set($.records.currBranch,n.id),c.cM.debug("in pushCommit "+n.id)},"commit"),u=(0,c.eW)(function(t){let e=t.name,r=t.order;if(e=c.SY.sanitizeText(e,l()),$.records.branches.has(e))throw Error(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${e}")`);$.records.branches.set(e,null!=$.records.head?$.records.head.id:null),$.records.branchConfig.set(e,{name:e,order:r}),E(e),c.cM.debug("in createBranch")},"branch"),b=(0,c.eW)(t=>{let e=t.branch,r=t.id,a=t.type,o=t.tags,i=l();e=c.SY.sanitizeText(e,i),r&&(r=c.SY.sanitizeText(r,i));let n=$.records.branches.get($.records.currBranch),s=$.records.branches.get(e),d=n?$.records.commits.get(n):void 0,g=s?$.records.commits.get(s):void 0;if(d&&g&&d.branch===e)throw Error(`Cannot merge branch '${e}' into itself.`);if($.records.currBranch===e){let t=Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw t.hash={text:`merge ${e}`,token:`merge ${e}`,expected:["branch abc"]},t}if(void 0===d||!d){let t=Error(`Incorrect usage of "merge". Current branch (${$.records.currBranch})has no commits`);throw t.hash={text:`merge ${e}`,token:`merge ${e}`,expected:["commit"]},t}if(!$.records.branches.has(e)){let t=Error('Incorrect usage of "merge". Branch to be merged ('+e+") does not exist");throw t.hash={text:`merge ${e}`,token:`merge ${e}`,expected:[`branch ${e}`]},t}if(void 0===g||!g){let t=Error('Incorrect usage of "merge". Branch to be merged ('+e+") has no commits");throw t.hash={text:`merge ${e}`,token:`merge ${e}`,expected:['"commit"']},t}if(d===g){let t=Error('Incorrect usage of "merge". Both branches have same head');throw t.hash={text:`merge ${e}`,token:`merge ${e}`,expected:["branch abc"]},t}if(r&&$.records.commits.has(r)){let t=Error('Incorrect usage of "merge". Commit with id:'+r+" already exists, use different custom id");throw t.hash={text:`merge ${e} ${r} ${a} ${o?.join(" ")}`,token:`merge ${e} ${r} ${a} ${o?.join(" ")}`,expected:[`merge ${e} ${r}_UNIQUE ${a} ${o?.join(" ")}`]},t}let y={id:r||`${$.records.seq}-${m()}`,message:`merged branch ${e} into ${$.records.currBranch}`,seq:$.records.seq++,parents:null==$.records.head?[]:[$.records.head.id,s||""],branch:$.records.currBranch,type:h.MERGE,customType:a,customId:!!r,tags:o??[]};$.records.head=y,$.records.commits.set(y.id,y),$.records.branches.set($.records.currBranch,y.id),c.cM.debug($.records.branches),c.cM.debug("in mergeBranch")},"merge"),w=(0,c.eW)(function(t){let e=t.id,r=t.targetId,a=t.tags,o=t.parent;c.cM.debug("Entering cherryPick:",e,r,a);let i=l();if(e=c.SY.sanitizeText(e,i),r=c.SY.sanitizeText(r,i),a=a?.map(t=>c.SY.sanitizeText(t,i)),o=c.SY.sanitizeText(o,i),!e||!$.records.commits.has(e)){let t=Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw t.hash={text:`cherryPick ${e} ${r}`,token:`cherryPick ${e} ${r}`,expected:["cherry-pick abc"]},t}let n=$.records.commits.get(e);if(void 0===n||!n)throw Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(o&&!(Array.isArray(n.parents)&&n.parents.includes(o)))throw Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");let s=n.branch;if(n.type===h.MERGE&&!o)throw Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");if(!r||!$.records.commits.has(r)){if(s===$.records.currBranch){let t=Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw t.hash={text:`cherryPick ${e} ${r}`,token:`cherryPick ${e} ${r}`,expected:["cherry-pick abc"]},t}let t=$.records.branches.get($.records.currBranch);if(void 0===t||!t){let t=Error(`Incorrect usage of "cherry-pick". Current branch (${$.records.currBranch})has no commits`);throw t.hash={text:`cherryPick ${e} ${r}`,token:`cherryPick ${e} ${r}`,expected:["cherry-pick abc"]},t}let i=$.records.commits.get(t);if(void 0===i||!i){let t=Error(`Incorrect usage of "cherry-pick". Current branch (${$.records.currBranch})has no commits`);throw t.hash={text:`cherryPick ${e} ${r}`,token:`cherryPick ${e} ${r}`,expected:["cherry-pick abc"]},t}let d={id:$.records.seq+"-"+m(),message:`cherry-picked ${n?.message} into ${$.records.currBranch}`,seq:$.records.seq++,parents:null==$.records.head?[]:[$.records.head.id,n.id],branch:$.records.currBranch,type:h.CHERRY_PICK,tags:a?a.filter(Boolean):[`cherry-pick:${n.id}${n.type===h.MERGE?`|parent:${o}`:""}`]};$.records.head=d,$.records.commits.set(d.id,d),$.records.branches.set($.records.currBranch,d.id),c.cM.debug($.records.branches),c.cM.debug("in cherryPick")}},"cherryPick"),E=(0,c.eW)(function(t){if(t=c.SY.sanitizeText(t,l()),$.records.branches.has(t)){$.records.currBranch=t;let e=$.records.branches.get($.records.currBranch);void 0!==e&&e?$.records.head=$.records.commits.get(e)??null:$.records.head=null}else{let e=Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${t}")`);throw e.hash={text:`checkout ${t}`,token:`checkout ${t}`,expected:[`branch ${t}`]},e}},"checkout");function B(t,e,r){let a=t.indexOf(e);-1===a?t.push(r):t.splice(a,1,r)}function k(t){let e=t.reduce((t,e)=>t.seq>e.seq?t:e,t[0]),r="";t.forEach(function(t){t===e?r+=" *":r+=" |"});let a=[r,e.id,e.seq];for(let t in $.records.branches)$.records.branches.get(t)===e.id&&a.push(t);if(c.cM.debug(a.join(" ")),e.parents&&2==e.parents.length&&e.parents[0]&&e.parents[1]){let r=$.records.commits.get(e.parents[0]);B(t,e,r),e.parents[1]&&t.push($.records.commits.get(e.parents[1]))}else if(0==e.parents.length)return;else if(e.parents[0]){let r=$.records.commits.get(e.parents[0]);B(t,e,r)}k(t=g(t,t=>t.id))}(0,c.eW)(B,"upsert"),(0,c.eW)(k,"prettyPrintCommitHistory");var M=(0,c.eW)(function(){c.cM.debug($.records.commits),k([v()[0]])},"prettyPrint"),C=(0,c.eW)(function(){$.reset(),(0,c.ZH)()},"clear"),L=(0,c.eW)(function(){return[...$.records.branchConfig.values()].map((t,e)=>null!==t.order&&void 0!==t.order?t:{...t,order:parseFloat(`0.${e}`)}).sort((t,e)=>(t.order??0)-(e.order??0)).map(({name:t})=>({name:t}))},"getBranchesAsObjArray"),T=(0,c.eW)(function(){return $.records.branches},"getBranches"),W=(0,c.eW)(function(){return $.records.commits},"getCommits"),v=(0,c.eW)(function(){let t=[...$.records.commits.values()];return t.forEach(function(t){c.cM.debug(t.id)}),t.sort((t,e)=>t.seq-e.seq),t},"getCommitsArray"),R={commitType:h,getConfig:l,setDirection:y,setOptions:p,getOptions:f,commit:x,branch:u,merge:b,cherryPick:w,checkout:E,prettyPrint:M,clear:C,getBranchesAsObjArray:L,getBranches:T,getCommits:W,getCommitsArray:v,getCurrentBranch:(0,c.eW)(function(){return $.records.currBranch},"getCurrentBranch"),getDirection:(0,c.eW)(function(){return $.records.direction},"getDirection"),getHead:(0,c.eW)(function(){return $.records.head},"getHead"),setAccTitle:c.GN,getAccTitle:c.eu,getAccDescription:c.Mx,setAccDescription:c.U$,setDiagramTitle:c.g2,getDiagramTitle:c.Kr},P=(0,c.eW)((t,e)=>{for(let r of((0,a.A)(t,e),t.dir&&e.setDirection(t.dir),t.statements))A(r,e)},"populate"),A=(0,c.eW)((t,e)=>{let r={Commit:(0,c.eW)(t=>e.commit(I(t)),"Commit"),Branch:(0,c.eW)(t=>e.branch(G(t)),"Branch"),Merge:(0,c.eW)(t=>e.merge(S(t)),"Merge"),Checkout:(0,c.eW)(t=>e.checkout(O(t)),"Checkout"),CherryPicking:(0,c.eW)(t=>e.cherryPick(q(t)),"CherryPicking")}[t.$type];r?r(t):c.cM.error(`Unknown statement type: ${t.$type}`)},"parseStatement"),I=(0,c.eW)(t=>({id:t.id,msg:t.message??"",type:void 0!==t.type?h[t.type]:h.NORMAL,tags:t.tags??void 0}),"parseCommit"),G=(0,c.eW)(t=>({name:t.name,order:t.order??0}),"parseBranch"),S=(0,c.eW)(t=>({branch:t.branch,id:t.id??"",type:void 0!==t.type?h[t.type]:void 0,tags:t.tags??void 0}),"parseMerge"),O=(0,c.eW)(t=>t.branch,"parseCheckout"),q=(0,c.eW)(t=>({id:t.id,targetId:"",tags:t.tags?.length===0?void 0:t.tags,parent:t.parent}),"parseCherryPicking"),H={parse:(0,c.eW)(async t=>{let e=await (0,n.Qc)("gitGraph",t);c.cM.debug(e),P(e,R)},"parse")},z=(0,c.nV)(),Y=z?.gitGraph,D=new Map,N=new Map,_=new Map,j=[],K=0,F="LR",U=(0,c.eW)(()=>{D.clear(),N.clear(),_.clear(),K=0,j=[],F="LR"},"clear"),V=(0,c.eW)(t=>{let e=document.createElementNS("http://www.w3.org/2000/svg","text");return("string"==typeof t?t.split(/\\n|\n|<br\s*\/?>/gi):t).forEach(t=>{let r=document.createElementNS("http://www.w3.org/2000/svg","tspan");r.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),r.setAttribute("dy","1em"),r.setAttribute("x","0"),r.setAttribute("class","row"),r.textContent=t.trim(),e.appendChild(r)}),e},"drawText"),Q=(0,c.eW)(t=>{let e,r,a;return"BT"===F?(r=(0,c.eW)((t,e)=>t<=e,"comparisonFunc"),a=1/0):(r=(0,c.eW)((t,e)=>t>=e,"comparisonFunc"),a=0),t.forEach(t=>{let o="TB"===F||"BT"==F?N.get(t)?.y:N.get(t)?.x;void 0!==o&&r(o,a)&&(e=t,a=o)}),e},"findClosestParent"),X=(0,c.eW)(t=>{let e="",r=1/0;return t.forEach(t=>{let a=N.get(t).y;a<=r&&(e=t,r=a)}),e||void 0},"findClosestParentBT"),Z=(0,c.eW)((t,e,r)=>{let a=r,o=r,i=[];t.forEach(t=>{let r=e.get(t);if(!r)throw Error(`Commit not found for key ${t}`);r.parents.length?o=Math.max(a=tt(r),o):i.push(r),te(r,a)}),a=o,i.forEach(t=>{tr(t,a,r)}),t.forEach(t=>{let r=e.get(t);if(r?.parents.length){let t=X(r.parents);(a=N.get(t).y-40)<=o&&(o=a);let e=D.get(r.branch).pos,i=a-10;N.set(r.id,{x:e,y:i})}})},"setParallelBTPos"),J=(0,c.eW)(t=>{let e=Q(t.parents.filter(t=>null!==t));if(!e)throw Error(`Closest parent not found for commit ${t.id}`);let r=N.get(e)?.y;if(void 0===r)throw Error(`Closest parent position not found for commit ${t.id}`);return r},"findClosestParentPos"),tt=(0,c.eW)(t=>J(t)+40,"calculateCommitPosition"),te=(0,c.eW)((t,e)=>{let r=D.get(t.branch);if(!r)throw Error(`Branch not found for commit ${t.id}`);let a=r.pos,o=e+10;return N.set(t.id,{x:a,y:o}),{x:a,y:o}},"setCommitPosition"),tr=(0,c.eW)((t,e,r)=>{let a=D.get(t.branch);if(!a)throw Error(`Branch not found for commit ${t.id}`);let o=a.pos;N.set(t.id,{x:o,y:e+r})},"setRootPosition"),ta=(0,c.eW)((t,e,r,a,o,i)=>{if(i===h.HIGHLIGHT)t.append("rect").attr("x",r.x-10).attr("y",r.y-10).attr("width",20).attr("height",20).attr("class",`commit ${e.id} commit-highlight${o%8} ${a}-outer`),t.append("rect").attr("x",r.x-6).attr("y",r.y-6).attr("width",12).attr("height",12).attr("class",`commit ${e.id} commit${o%8} ${a}-inner`);else if(i===h.CHERRY_PICK)t.append("circle").attr("cx",r.x).attr("cy",r.y).attr("r",10).attr("class",`commit ${e.id} ${a}`),t.append("circle").attr("cx",r.x-3).attr("cy",r.y+2).attr("r",2.75).attr("fill","#fff").attr("class",`commit ${e.id} ${a}`),t.append("circle").attr("cx",r.x+3).attr("cy",r.y+2).attr("r",2.75).attr("fill","#fff").attr("class",`commit ${e.id} ${a}`),t.append("line").attr("x1",r.x+3).attr("y1",r.y+1).attr("x2",r.x).attr("y2",r.y-5).attr("stroke","#fff").attr("class",`commit ${e.id} ${a}`),t.append("line").attr("x1",r.x-3).attr("y1",r.y+1).attr("x2",r.x).attr("y2",r.y-5).attr("stroke","#fff").attr("class",`commit ${e.id} ${a}`);else{let c=t.append("circle");if(c.attr("cx",r.x),c.attr("cy",r.y),c.attr("r",e.type===h.MERGE?9:10),c.attr("class",`commit ${e.id} commit${o%8}`),i===h.MERGE){let i=t.append("circle");i.attr("cx",r.x),i.attr("cy",r.y),i.attr("r",6),i.attr("class",`commit ${a} ${e.id} commit${o%8}`)}i===h.REVERSE&&t.append("path").attr("d",`M ${r.x-5},${r.y-5}L${r.x+5},${r.y+5}M${r.x-5},${r.y+5}L${r.x+5},${r.y-5}`).attr("class",`commit ${a} ${e.id} commit${o%8}`)}},"drawCommitBullet"),to=(0,c.eW)((t,e,r,a)=>{if(e.type!==h.CHERRY_PICK&&(e.customId&&e.type===h.MERGE||e.type!==h.MERGE)&&Y?.showCommitLabel){let o=t.append("g"),i=o.insert("rect").attr("class","commit-label-bkg"),c=o.append("text").attr("x",a).attr("y",r.y+25).attr("class","commit-label").text(e.id),n=c.node()?.getBBox();if(n&&(i.attr("x",r.posWithOffset-n.width/2-2).attr("y",r.y+13.5).attr("width",n.width+4).attr("height",n.height+4),"TB"===F||"BT"===F?(i.attr("x",r.x-(n.width+16+5)).attr("y",r.y-12),c.attr("x",r.x-(n.width+16)).attr("y",r.y+n.height-12)):c.attr("x",r.posWithOffset-n.width/2),Y.rotateCommitLabel)){if("TB"===F||"BT"===F)c.attr("transform","rotate(-45, "+r.x+", "+r.y+")"),i.attr("transform","rotate(-45, "+r.x+", "+r.y+")");else{let t=-7.5-(n.width+10)/25*9.5,e=10+n.width/25*8.5;o.attr("transform","translate("+t+", "+e+") rotate(-45, "+a+", "+r.y+")")}}}},"drawCommitLabel"),ti=(0,c.eW)((t,e,r,a)=>{if(e.tags.length>0){let o=0,i=0,c=0,n=[];for(let a of e.tags.reverse()){let e=t.insert("polygon"),s=t.append("circle"),h=t.append("text").attr("y",r.y-16-o).attr("class","tag-label").text(a),d=h.node()?.getBBox();if(!d)throw Error("Tag bbox not found");i=Math.max(i,d.width),c=Math.max(c,d.height),h.attr("x",r.posWithOffset-d.width/2),n.push({tag:h,hole:s,rect:e,yOffset:o}),o+=20}for(let{tag:t,hole:e,rect:o,yOffset:s}of n){let n=c/2,h=r.y-19.2-s;if(o.attr("class","tag-label-bkg").attr("points",`
|
2
|
-
${a-i/2-2},${h+2}
|
3
|
-
${a-i/2-2},${h-2}
|
4
|
-
${r.posWithOffset-i/2-4},${h-n-2}
|
5
|
-
${r.posWithOffset+i/2+4},${h-n-2}
|
6
|
-
${r.posWithOffset+i/2+4},${h+n+2}
|
7
|
-
${r.posWithOffset-i/2-4},${h+n+2}`),e.attr("cy",h).attr("cx",a-i/2+2).attr("r",1.5).attr("class","tag-hole"),"TB"===F||"BT"===F){let c=a+s;o.attr("class","tag-label-bkg").attr("points",`
|
8
|
-
${r.x},${c+2}
|
9
|
-
${r.x},${c-2}
|
10
|
-
${r.x+10},${c-n-2}
|
11
|
-
${r.x+10+i+4},${c-n-2}
|
12
|
-
${r.x+10+i+4},${c+n+2}
|
13
|
-
${r.x+10},${c+n+2}`).attr("transform","translate(12,12) rotate(45, "+r.x+","+a+")"),e.attr("cx",r.x+2).attr("cy",c).attr("transform","translate(12,12) rotate(45, "+r.x+","+a+")"),t.attr("x",r.x+5).attr("y",c+3).attr("transform","translate(14,14) rotate(45, "+r.x+","+a+")")}}}},"drawCommitTags"),tc=(0,c.eW)(t=>{switch(t.customType??t.type){case h.NORMAL:return"commit-normal";case h.REVERSE:return"commit-reverse";case h.HIGHLIGHT:return"commit-highlight";case h.MERGE:return"commit-merge";case h.CHERRY_PICK:return"commit-cherry-pick";default:return"commit-normal"}},"getCommitClassType"),tn=(0,c.eW)((t,e,r,a)=>{let o={x:0,y:0};if(t.parents.length>0){let r=Q(t.parents);if(r){let i=a.get(r)??o;return"TB"===e?i.y+40:"BT"===e?(a.get(t.id)??o).y-40:i.x+40}}else{if("TB"===e)return 30;if("BT"===e)return(a.get(t.id)??o).y-40}return 0},"calculatePosition"),ts=(0,c.eW)((t,e,r)=>{let a="BT"===F&&r?e:e+10,o="TB"===F||"BT"===F?a:D.get(t.branch)?.pos,i="TB"===F||"BT"===F?D.get(t.branch)?.pos:a;if(void 0===i||void 0===o)throw Error(`Position were undefined for commit ${t.id}`);return{x:i,y:o,posWithOffset:a}},"getCommitPosition"),th=(0,c.eW)((t,e,r)=>{if(!Y)throw Error("GitGraph config not found");let a=t.append("g").attr("class","commit-bullets"),o=t.append("g").attr("class","commit-labels"),i="TB"===F||"BT"===F?30:0,n=[...e.keys()],s=Y?.parallelCommits??!1,h=n.sort((0,c.eW)((t,r)=>{let a=e.get(t)?.seq,o=e.get(r)?.seq;return void 0!==a&&void 0!==o?a-o:0},"sortKeys"));"BT"===F&&(s&&Z(h,e,i),h=h.reverse()),h.forEach(t=>{let c=e.get(t);if(!c)throw Error(`Commit not found for key ${t}`);s&&(i=tn(c,F,i,N));let n=ts(c,i,s);if(r){let t=tc(c),e=c.customType??c.type,r=D.get(c.branch)?.index??0;ta(a,c,n,t,r,e),to(o,c,n,i),ti(o,c,n,i)}"TB"===F||"BT"===F?N.set(c.id,{x:n.x,y:n.posWithOffset}):N.set(c.id,{x:n.posWithOffset,y:n.y}),(i="BT"===F&&s?i+40:i+40+10)>K&&(K=i)})},"drawCommits"),td=(0,c.eW)((t,e,r,a,o)=>{let i=("TB"===F||"BT"===F?r.x<a.x:r.y<a.y)?e.branch:t.branch,n=(0,c.eW)(t=>t.branch===i,"isOnBranchToGetCurve"),s=(0,c.eW)(r=>r.seq>t.seq&&r.seq<e.seq,"isBetweenCommits");return[...o.values()].some(t=>s(t)&&n(t))},"shouldRerouteArrow"),tl=(0,c.eW)((t,e,r=0)=>{let a=t+Math.abs(t-e)/2;if(r>5)return a;if(j.every(t=>Math.abs(t-a)>=10))return j.push(a),a;let o=Math.abs(t-e);return tl(t,e-o/5,r+1)},"findLane"),t$=(0,c.eW)((t,e,r,a)=>{let o;let i=N.get(e.id),c=N.get(r.id);if(void 0===i||void 0===c)throw Error(`Commit positions not found for commits ${e.id} and ${r.id}`);let n=td(e,r,i,c,a),s="",d="",l=0,$=0,m=D.get(r.branch)?.index;if(r.type===h.MERGE&&e.id!==r.parents[0]&&(m=D.get(e.branch)?.index),n){s="A 10 10, 0, 0, 0,",d="A 10 10, 0, 0, 1,",l=10,$=10;let t=i.y<c.y?tl(i.y,c.y):tl(c.y,i.y),r=i.x<c.x?tl(i.x,c.x):tl(c.x,i.x);"TB"===F?i.x<c.x?o=`M ${i.x} ${i.y} L ${r-l} ${i.y} ${d} ${r} ${i.y+$} L ${r} ${c.y-l} ${s} ${r+$} ${c.y} L ${c.x} ${c.y}`:(m=D.get(e.branch)?.index,o=`M ${i.x} ${i.y} L ${r+l} ${i.y} ${s} ${r} ${i.y+$} L ${r} ${c.y-l} ${d} ${r-$} ${c.y} L ${c.x} ${c.y}`):"BT"===F?i.x<c.x?o=`M ${i.x} ${i.y} L ${r-l} ${i.y} ${s} ${r} ${i.y-$} L ${r} ${c.y+l} ${d} ${r+$} ${c.y} L ${c.x} ${c.y}`:(m=D.get(e.branch)?.index,o=`M ${i.x} ${i.y} L ${r+l} ${i.y} ${d} ${r} ${i.y-$} L ${r} ${c.y+l} ${s} ${r-$} ${c.y} L ${c.x} ${c.y}`):i.y<c.y?o=`M ${i.x} ${i.y} L ${i.x} ${t-l} ${s} ${i.x+$} ${t} L ${c.x-l} ${t} ${d} ${c.x} ${t+$} L ${c.x} ${c.y}`:(m=D.get(e.branch)?.index,o=`M ${i.x} ${i.y} L ${i.x} ${t+l} ${d} ${i.x+$} ${t} L ${c.x-l} ${t} ${s} ${c.x} ${t-$} L ${c.x} ${c.y}`)}else s="A 20 20, 0, 0, 0,",d="A 20 20, 0, 0, 1,",l=20,$=20,"TB"===F?(i.x<c.x&&(o=r.type===h.MERGE&&e.id!==r.parents[0]?`M ${i.x} ${i.y} L ${i.x} ${c.y-l} ${s} ${i.x+$} ${c.y} L ${c.x} ${c.y}`:`M ${i.x} ${i.y} L ${c.x-l} ${i.y} ${d} ${c.x} ${i.y+$} L ${c.x} ${c.y}`),i.x>c.x&&(s="A 20 20, 0, 0, 0,",d="A 20 20, 0, 0, 1,",l=20,$=20,o=r.type===h.MERGE&&e.id!==r.parents[0]?`M ${i.x} ${i.y} L ${i.x} ${c.y-l} ${d} ${i.x-$} ${c.y} L ${c.x} ${c.y}`:`M ${i.x} ${i.y} L ${c.x+l} ${i.y} ${s} ${c.x} ${i.y+$} L ${c.x} ${c.y}`),i.x===c.x&&(o=`M ${i.x} ${i.y} L ${c.x} ${c.y}`)):"BT"===F?(i.x<c.x&&(o=r.type===h.MERGE&&e.id!==r.parents[0]?`M ${i.x} ${i.y} L ${i.x} ${c.y+l} ${d} ${i.x+$} ${c.y} L ${c.x} ${c.y}`:`M ${i.x} ${i.y} L ${c.x-l} ${i.y} ${s} ${c.x} ${i.y-$} L ${c.x} ${c.y}`),i.x>c.x&&(s="A 20 20, 0, 0, 0,",d="A 20 20, 0, 0, 1,",l=20,$=20,o=r.type===h.MERGE&&e.id!==r.parents[0]?`M ${i.x} ${i.y} L ${i.x} ${c.y+l} ${s} ${i.x-$} ${c.y} L ${c.x} ${c.y}`:`M ${i.x} ${i.y} L ${c.x-l} ${i.y} ${s} ${c.x} ${i.y-$} L ${c.x} ${c.y}`),i.x===c.x&&(o=`M ${i.x} ${i.y} L ${c.x} ${c.y}`)):(i.y<c.y&&(o=r.type===h.MERGE&&e.id!==r.parents[0]?`M ${i.x} ${i.y} L ${c.x-l} ${i.y} ${d} ${c.x} ${i.y+$} L ${c.x} ${c.y}`:`M ${i.x} ${i.y} L ${i.x} ${c.y-l} ${s} ${i.x+$} ${c.y} L ${c.x} ${c.y}`),i.y>c.y&&(o=r.type===h.MERGE&&e.id!==r.parents[0]?`M ${i.x} ${i.y} L ${c.x-l} ${i.y} ${s} ${c.x} ${i.y-$} L ${c.x} ${c.y}`:`M ${i.x} ${i.y} L ${i.x} ${c.y+l} ${d} ${i.x+$} ${c.y} L ${c.x} ${c.y}`),i.y===c.y&&(o=`M ${i.x} ${i.y} L ${c.x} ${c.y}`));if(void 0===o)throw Error("Line definition not found");t.append("path").attr("d",o).attr("class","arrow arrow"+m%8)},"drawArrow"),tm=(0,c.eW)((t,e)=>{let r=t.append("g").attr("class","commit-arrows");[...e.keys()].forEach(t=>{let a=e.get(t);a.parents&&a.parents.length>0&&a.parents.forEach(t=>{t$(r,e.get(t),a,e)})})},"drawArrows"),tg=(0,c.eW)((t,e)=>{let r=t.append("g");e.forEach((t,e)=>{let a=e%8,o=D.get(t.name)?.pos;if(void 0===o)throw Error(`Position not found for branch ${t.name}`);let i=r.append("line");i.attr("x1",0),i.attr("y1",o),i.attr("x2",K),i.attr("y2",o),i.attr("class","branch branch"+a),"TB"===F?(i.attr("y1",30),i.attr("x1",o),i.attr("y2",K),i.attr("x2",o)):"BT"===F&&(i.attr("y1",K),i.attr("x1",o),i.attr("y2",30),i.attr("x2",o)),j.push(o);let c=V(t.name),n=r.insert("rect"),s=r.insert("g").attr("class","branchLabel").insert("g").attr("class","label branch-label"+a);s.node().appendChild(c);let h=c.getBBox();n.attr("class","branchLabelBkg label"+a).attr("rx",4).attr("ry",4).attr("x",-h.width-4-(Y?.rotateCommitLabel===!0?30:0)).attr("y",-h.height/2+8).attr("width",h.width+18).attr("height",h.height+4),s.attr("transform","translate("+(-h.width-14-(Y?.rotateCommitLabel===!0?30:0))+", "+(o-h.height/2-1)+")"),"TB"===F?(n.attr("x",o-h.width/2-10).attr("y",0),s.attr("transform","translate("+(o-h.width/2-5)+", 0)")):"BT"===F?(n.attr("x",o-h.width/2-10).attr("y",K),s.attr("transform","translate("+(o-h.width/2-5)+", "+K+")")):n.attr("transform","translate(-19, "+(o-h.height/2)+")")})},"drawBranches"),ty=(0,c.eW)(function(t,e,r,a,o){return D.set(t,{pos:e,index:r}),e+=50+(o?40:0)+("TB"===F||"BT"===F?a.width/2:0)},"setBranchPosition"),tp={parser:H,db:R,renderer:{draw:(0,c.eW)(function(t,e,r,a){if(U(),c.cM.debug("in gitgraph renderer",t+"\n","id:",e,r),!Y)throw Error("GitGraph config not found");let o=Y.rotateCommitLabel??!1,n=a.db;_=n.getCommits();let h=n.getBranchesAsObjArray();F=n.getDirection();let d=(0,s.Ys)(`[id="${e}"]`),l=0;h.forEach((t,e)=>{let r=V(t.name),a=d.append("g"),i=a.insert("g").attr("class","branchLabel"),c=i.insert("g").attr("class","label branch-label");c.node()?.appendChild(r);let n=r.getBBox();l=ty(t.name,l,e,n,o),c.remove(),i.remove(),a.remove()}),th(d,_,!1),Y.showBranches&&tg(d,h),tm(d,_),th(d,_,!0),i.w8.insertTitle(d,"gitTitleText",Y.titleTopMargin??0,n.getDiagramTitle()),(0,c.Rw)(void 0,d,Y.diagramPadding,Y.useMaxWidth)},"draw")},styles:(0,c.eW)(t=>`
|
14
|
-
.commit-id,
|
15
|
-
.commit-msg,
|
16
|
-
.branch-label {
|
17
|
-
fill: lightgrey;
|
18
|
-
color: lightgrey;
|
19
|
-
font-family: 'trebuchet ms', verdana, arial, sans-serif;
|
20
|
-
font-family: var(--mermaid-font-family);
|
21
|
-
}
|
22
|
-
${[0,1,2,3,4,5,6,7].map(e=>`
|
23
|
-
.branch-label${e} { fill: ${t["gitBranchLabel"+e]}; }
|
24
|
-
.commit${e} { stroke: ${t["git"+e]}; fill: ${t["git"+e]}; }
|
25
|
-
.commit-highlight${e} { stroke: ${t["gitInv"+e]}; fill: ${t["gitInv"+e]}; }
|
26
|
-
.label${e} { fill: ${t["git"+e]}; }
|
27
|
-
.arrow${e} { stroke: ${t["git"+e]}; }
|
28
|
-
`).join("\n")}
|
29
|
-
|
30
|
-
.branch {
|
31
|
-
stroke-width: 1;
|
32
|
-
stroke: ${t.lineColor};
|
33
|
-
stroke-dasharray: 2;
|
34
|
-
}
|
35
|
-
.commit-label { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelColor};}
|
36
|
-
.commit-label-bkg { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelBackground}; opacity: 0.5; }
|
37
|
-
.tag-label { font-size: ${t.tagLabelFontSize}; fill: ${t.tagLabelColor};}
|
38
|
-
.tag-label-bkg { fill: ${t.tagLabelBackground}; stroke: ${t.tagLabelBorder}; }
|
39
|
-
.tag-hole { fill: ${t.textColor}; }
|
40
|
-
|
41
|
-
.commit-merge {
|
42
|
-
stroke: ${t.primaryColor};
|
43
|
-
fill: ${t.primaryColor};
|
44
|
-
}
|
45
|
-
.commit-reverse {
|
46
|
-
stroke: ${t.primaryColor};
|
47
|
-
fill: ${t.primaryColor};
|
48
|
-
stroke-width: 3;
|
49
|
-
}
|
50
|
-
.commit-highlight-outer {
|
51
|
-
}
|
52
|
-
.commit-highlight-inner {
|
53
|
-
stroke: ${t.primaryColor};
|
54
|
-
fill: ${t.primaryColor};
|
55
|
-
}
|
56
|
-
|
57
|
-
.arrow { stroke-width: 8; stroke-linecap: round; fill: none}
|
58
|
-
.gitTitleText {
|
59
|
-
text-anchor: middle;
|
60
|
-
font-size: 18px;
|
61
|
-
fill: ${t.textColor};
|
62
|
-
}
|
63
|
-
`,"getStyles")}}}]);
|
@@ -1,24 +0,0 @@
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9320],{80469:function(t,e,a){function r(t,e){t.accDescr&&e.setAccDescription?.(t.accDescr),t.accTitle&&e.setAccTitle?.(t.accTitle),t.title&&e.setDiagramTitle?.(t.title)}a.d(e,{A:function(){return r}}),(0,a(54166).eW)(r,"populateCommonDb")},19320:function(t,e,a){a.d(e,{diagram:function(){return C}});var r=a(80469),l=a(9242),o=a(83026),i=a(54166),n=a(54327),c={packet:[]},s=structuredClone(c),d=i.vZ.packet,k=(0,i.eW)(()=>{let t=(0,l.Rb)({...d,...(0,i.iE)().packet});return t.showBits&&(t.paddingY+=10),t},"getConfig"),p=(0,i.eW)(()=>s.packet,"getPacket"),b={pushWord:(0,i.eW)(t=>{t.length>0&&s.packet.push(t)},"pushWord"),getPacket:p,getConfig:k,clear:(0,i.eW)(()=>{(0,i.ZH)(),s=structuredClone(c)},"clear"),setAccTitle:i.GN,getAccTitle:i.eu,setDiagramTitle:i.g2,getDiagramTitle:i.Kr,getAccDescription:i.Mx,setAccDescription:i.U$},f=(0,i.eW)(t=>{(0,r.A)(t,b);let e=-1,a=[],l=1,{bitsPerRow:o}=b.getConfig();for(let{start:r,end:n,bits:c,label:s}of t.blocks){if(void 0!==r&&void 0!==n&&n<r)throw Error(`Packet block ${r} - ${n} is invalid. End must be greater than start.`);if((r??=e+1)!==e+1)throw Error(`Packet block ${r} - ${n??r} is not contiguous. It should start from ${e+1}.`);if(0===c)throw Error(`Packet block ${r} is invalid. Cannot have a zero bit field.`);for(n??=r+(c??1)-1,c??=n-r+1,e=n,i.cM.debug(`Packet block ${r} - ${e} with label ${s}`);a.length<=o+1&&b.getPacket().length<1e4;){let[t,e]=h({start:r,end:n,bits:c,label:s},l,o);if(a.push(t),t.end+1===l*o&&(b.pushWord(a),a=[],l++),!e)break;({start:r,end:n,bits:c,label:s}=e)}}b.pushWord(a)},"populate"),h=(0,i.eW)((t,e,a)=>{if(void 0===t.start)throw Error("start should have been set during first phase");if(void 0===t.end)throw Error("end should have been set during first phase");if(t.start>t.end)throw Error(`Block start ${t.start} is greater than block end ${t.end}.`);if(t.end+1<=e*a)return[t,void 0];let r=e*a-1,l=e*a;return[{start:t.start,end:r,label:t.label,bits:r-t.start},{start:l,end:t.end,label:t.label,bits:t.end-l}]},"getNextFittingBlock"),u={parse:(0,i.eW)(async t=>{let e=await (0,n.Qc)("packet",t);i.cM.debug(e),f(e)},"parse")},g=(0,i.eW)((t,e,a,r)=>{let l=r.db,n=l.getConfig(),{rowHeight:c,paddingY:s,bitWidth:d,bitsPerRow:k}=n,p=l.getPacket(),b=l.getDiagramTitle(),f=c+s,h=f*(p.length+1)-(b?0:c),u=d*k+2,g=(0,o.P)(e);for(let[t,e]of(g.attr("viewbox",`0 0 ${u} ${h}`),(0,i.v2)(g,h,u,n.useMaxWidth),p.entries()))x(g,e,t,n);g.append("text").text(b).attr("x",u/2).attr("y",h-f/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),x=(0,i.eW)((t,e,a,{rowHeight:r,paddingX:l,paddingY:o,bitWidth:i,bitsPerRow:n,showBits:c})=>{let s=t.append("g"),d=a*(r+o)+o;for(let t of e){let e=t.start%n*i+1,a=(t.end-t.start+1)*i-l;if(s.append("rect").attr("x",e).attr("y",d).attr("width",a).attr("height",r).attr("class","packetBlock"),s.append("text").attr("x",e+a/2).attr("y",d+r/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(t.label),!c)continue;let o=t.end===t.start,k=d-2;s.append("text").attr("x",e+(o?a/2:0)).attr("y",k).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",o?"middle":"start").text(t.start),o||s.append("text").attr("x",e+a).attr("y",k).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(t.end)}},"drawWord"),$={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},C={parser:u,db:b,renderer:{draw:g},styles:(0,i.eW)(({packet:t}={})=>{let e=(0,l.Rb)($,t);return`
|
2
|
-
.packetByte {
|
3
|
-
font-size: ${e.byteFontSize};
|
4
|
-
}
|
5
|
-
.packetByte.start {
|
6
|
-
fill: ${e.startByteColor};
|
7
|
-
}
|
8
|
-
.packetByte.end {
|
9
|
-
fill: ${e.endByteColor};
|
10
|
-
}
|
11
|
-
.packetLabel {
|
12
|
-
fill: ${e.labelColor};
|
13
|
-
font-size: ${e.labelFontSize};
|
14
|
-
}
|
15
|
-
.packetTitle {
|
16
|
-
fill: ${e.titleColor};
|
17
|
-
font-size: ${e.titleFontSize};
|
18
|
-
}
|
19
|
-
.packetBlock {
|
20
|
-
stroke: ${e.blockStrokeColor};
|
21
|
-
stroke-width: ${e.blockStrokeWidth};
|
22
|
-
fill: ${e.blockFillColor};
|
23
|
-
}
|
24
|
-
`},"styles")}}}]);
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9535],{69535:function(e,n,c){c.d(n,{createInfoServices:function(){return u.M}});var u=c(86191);c(95132)}}]);
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9968],{39968:function(e,c,n){n.d(c,{createPacketServices:function(){return t.g}});var t=n(51052);n(95132)}}]);
|
@@ -1 +0,0 @@
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8459,3317,7138,244],{63521:function(){}},function(n){n.O(0,[2971,2117,1744],function(){return n(n.s=63521)}),_N_E=n.O()}]);
|
@@ -1 +0,0 @@
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9718],{1813:function(e,a,t){Promise.resolve().then(t.bind(t,37335))},37335:function(e,a,t){"use strict";t.r(a),t.d(a,{default:function(){return V}});var l=t(57437),n=t(14675),r=t.n(n),o=t(17200),s=t(2265),i=t(56937),d=t(2335),c=t(19945),u=t(26110),h=t(39535),m=t(14308),p=t(65613),f=t(7436),v=t(25427),g=t(29501),x=t(13590),A=t(60729),j=t(34124),b=t(6512),_=t(37104),Z=t(49027),M=t(27648);let N=()=>window.fetch("/api/agents").then(e=>e.json()).catch(e=>console.log(e)),y=e=>fetch(e).then(e=>e.json());function E(e){let[a,t]=(0,s.useState)(!1),[n,r]=(0,s.useState)(null),[o,i]=(0,s.useState)(!0),c=(0,g.cI)({resolver:(0,x.F)(v.bc),defaultValues:{name:e.data.name,persona:e.data.persona,color:e.data.color,icon:e.data.icon,privacy_level:e.data.privacy_level,chat_model:e.selectedChatModelOption,files:[]}});return(0,s.useEffect)(()=>{c.reset({name:e.data.name,persona:e.data.persona,color:e.data.color,icon:e.data.icon,privacy_level:e.data.privacy_level,chat_model:e.selectedChatModelOption,files:[]})},[e.selectedChatModelOption,e.data]),(0,l.jsxs)(u.Vq,{open:a,onOpenChange:t,children:[(0,l.jsx)(u.hg,{children:(0,l.jsxs)("div",{className:"flex items-center text-md gap-2",children:[(0,l.jsx)(d.v,{}),"Create Agent"]})}),(0,l.jsxs)(u.cZ,{className:"lg:max-w-screen-lg py-4 overflow-y-scroll h-full md:h-4/6 rounded-lg flex flex-col",children:[(0,l.jsx)(u.fK,{children:(0,l.jsx)(Z.$N,{children:"Create Agent"})}),!e.userProfile&&o&&(0,l.jsx)(h.Z,{onOpenChange:i,isMobileWidth:e.isMobileWidth}),(0,l.jsx)(v.ks,{form:c,onSubmit:a=>{fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}).then(a=>{200===a.status?(c.reset(),t(!1),r(null),e.setAgentChangeTriggered(!0)):a.json().then(e=>{console.error(e),e.error&&r(e.error)})}).catch(e=>{console.error("Error:",e),r(e)})},create:!0,errors:n,filesOptions:e.filesOptions,modelOptions:e.modelOptions,inputToolOptions:e.inputToolOptions,outputModeOptions:e.outputModeOptions,isSubscribed:e.isSubscribed})]})]})}function V(){let{data:e,error:a,mutate:t}=(0,o.ZP)("agents",N,{revalidateOnFocus:!1}),{data:n,error:d,isLoading:u}=(0,i.GW)(),{data:g}=(0,i.h2)(!0),[x,Z]=(0,s.useState)(!1),V=(0,f.IC)(),[w,O]=(0,s.useState)([]),[L,C]=(0,s.useState)([]),[S,P]=(0,s.useState)(null),{data:F,error:H}=(0,o.ZP)(g?"/api/content/computer":null,y),{data:T,error:k}=(0,o.ZP)("/api/agents/options",y),[I,W]=(0,s.useState)(!1);if((0,s.useEffect)(()=>{I&&(t(),W(!1))},[I]),(0,s.useEffect)(()=>{if(e){O(e.filter(e=>e.creator===(null==n?void 0:n.username)));let a=e.filter(e=>"private"!==e.privacy_level&&e.creator!==(null==n?void 0:n.username));C(a);{let t=new URLSearchParams(window.location.search).get("agent");if(t){P(t);let l=e.find(e=>e.slug===t);l||(l=a.find(e=>e.slug===t)),l||fetch("/api/agents/".concat(t)).then(e=>{if(404===e.status)throw Error("Agent not found");return e.json()}).then(e=>{"protected"===e.privacy_level&&C(a=>[...a,e])})}}}},[e,n]),a)return(0,l.jsxs)("main",{className:r().main,children:[(0,l.jsx)("div",{className:"".concat(r().titleBar," text-5xl"),children:"Agents"}),(0,l.jsx)("div",{className:r().agentList,children:"Error loading agents"})]});if(!e)return(0,l.jsx)("main",{className:r().main,children:(0,l.jsxs)("div",{className:r().agentList,children:[(0,l.jsx)(m.l,{})," booting up your agents"]})});let R=(null==g?void 0:g.chat_model_options)||[],B=(null==g?void 0:g.selected_chat_model_config)||0,Y=(null==g?void 0:g.is_active)||!1,z=R.find(e=>e.id===B);return(0,l.jsxs)(A.Hn,{children:[(0,l.jsx)(j.S,{conversationId:""}),(0,l.jsxs)(A.kV,{children:[(0,l.jsxs)("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[(0,l.jsx)(A.vP,{className:"-ml-1"}),(0,l.jsx)(b.Z,{orientation:"vertical",className:"mr-2 h-4"}),V?(0,l.jsx)("a",{className:"p-0 no-underline",href:"/",children:(0,l.jsx)(_.VO,{className:"h-auto w-16"})}):(0,l.jsx)("h2",{className:"text-lg",children:"Agents"})]}),(0,l.jsx)("main",{className:"w-full mx-auto",children:(0,l.jsx)("div",{className:"grid w-full mx-auto",children:(0,l.jsxs)("div",{className:"".concat(r().pageLayout," w-full"),children:[(0,l.jsxs)("div",{className:"pt-6 md:pt-8 flex justify-between",children:[(0,l.jsx)("h1",{className:"text-3xl flex items-center",children:"Agents"}),(0,l.jsx)("div",{className:"ml-auto float-right border p-2 pt-3 rounded-xl font-bold hover:bg-stone-100 dark:hover:bg-neutral-900",children:(0,l.jsx)(E,{data:{slug:"",name:"",persona:"",color:"",icon:"",privacy_level:"private",managed_by_admin:!1,chat_model:"",input_tools:[],output_modes:[],is_hidden:!1},userProfile:u?null:null!=n?n:null,isMobileWidth:V,filesOptions:F||[],modelOptions:(null==g?void 0:g.chat_model_options)||[],selectedChatModelOption:(null==z?void 0:z.name)||"",isSubscribed:Y,setAgentChangeTriggered:W,inputToolOptions:(null==T?void 0:T.input_tools)||{},outputModeOptions:(null==T?void 0:T.output_modes)||{}})})]}),x&&(0,l.jsx)(h.Z,{onOpenChange:Z,isMobileWidth:V}),(0,l.jsx)(p.bZ,{className:"bg-secondary border-none my-4",children:(0,l.jsxs)(p.X,{children:[(0,l.jsx)(c.P,{weight:"fill",className:"h-4 w-4 text-purple-400 inline"}),(0,l.jsx)("span",{className:"font-bold",children:"How it works"})," Use any of these specialized personas to tune your conversation to your needs.",!Y&&(0,l.jsxs)("span",{children:[" ",(0,l.jsx)(M.default,{href:"/settings",className:"font-bold",children:"Upgrade your plan"})," to leverage custom models. You will fallback to the default model when chatting."]})]})}),(0,l.jsx)("div",{className:"pt-6 md:pt-8",children:(0,l.jsx)("div",{className:"".concat(r().agentList),children:n&&w.map(e=>(0,l.jsx)(v.EY,{data:e,userProfile:n,isMobileWidth:V,filesOptions:null!=F?F:[],selectedChatModelOption:(null==z?void 0:z.name)||"",isSubscribed:Y,setAgentChangeTriggered:W,modelOptions:(null==g?void 0:g.chat_model_options)||[],editCard:!0,agentSlug:S||"",inputToolOptions:(null==T?void 0:T.input_tools)||{},outputModeOptions:(null==T?void 0:T.output_modes)||{}},e.slug))})}),(0,l.jsxs)("div",{className:"pt-6 md:pt-8",children:[(0,l.jsx)("h2",{className:"text-2xl",children:"Explore"}),(0,l.jsx)("div",{className:"".concat(r().agentList),children:!u&&L.map(e=>(0,l.jsx)(v.EY,{data:e,userProfile:n||null,isMobileWidth:V,editCard:!1,filesOptions:null!=F?F:[],selectedChatModelOption:(null==z?void 0:z.name)||"",isSubscribed:Y,setAgentChangeTriggered:W,modelOptions:(null==g?void 0:g.chat_model_options)||[],agentSlug:S||"",inputToolOptions:(null==T?void 0:T.input_tools)||{},outputModeOptions:(null==T?void 0:T.output_modes)||{}},e.slug))})]})]})})})]})]})}},32759:function(e,a,t){"use strict";t.d(a,{E:function(){return s}});var l=t(57437),n=t(2265),r=t(60610),o=t(94508);let s=n.forwardRef((e,a)=>{let{className:t,value:n,indicatorColor:s,...i}=e;return(0,l.jsx)(r.fC,{ref:a,className:(0,o.cn)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",t),...i,children:(0,l.jsx)(r.z$,{className:"h-full w-full flex-1 bg-primary transition-all ".concat(s),style:{transform:"translateX(-".concat(100-(n||0),"%)")}})})});s.displayName=r.fC.displayName},76818:function(e,a,t){"use strict";t.d(a,{g:function(){return o}});var l=t(57437),n=t(2265),r=t(94508);let o=n.forwardRef((e,a)=>{let{className:t,...n}=e;return(0,l.jsx)("textarea",{className:(0,r.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),ref:a,...n})});o.displayName="Textarea"},14675:function(e){e.exports={titleBar:"agents_titleBar__FzYbY",agentPersonality:"agents_agentPersonality__o0Ysz",pageLayout:"agents_pageLayout__gR3S3",infoButton:"agents_infoButton__NqI7E",agentList:"agents_agentList__XVx4A"}},49807:function(e,a,t){"use strict";t.d(a,{a:function(){return s}});var l=t(2265),n=t(4992);let r=new Map([["bold",l.createElement(l.Fragment,null,l.createElement("path",{d:"M252,124a60.14,60.14,0,0,0-32-53.08,52,52,0,0,0-92-32.11A52,52,0,0,0,36,70.92a60,60,0,0,0,0,106.14,52,52,0,0,0,92,32.13,52,52,0,0,0,92-32.13A60.05,60.05,0,0,0,252,124ZM88,204a28,28,0,0,1-26.85-20.07c1,0,1.89.07,2.85.07h8a12,12,0,0,0,0-24H64A36,36,0,0,1,52,90.05a12,12,0,0,0,8-11.32V72a28,28,0,0,1,56,0v60.18a51.61,51.61,0,0,0-7.2-3.85,12,12,0,1,0-9.6,22A28,28,0,0,1,88,204Zm104-44h-8a12,12,0,0,0,0,24h8c1,0,1.9,0,2.85-.07a28,28,0,1,1-38-33.61,12,12,0,1,0-9.6-22,51.61,51.61,0,0,0-7.2,3.85V72a28,28,0,0,1,56,0v6.73a12,12,0,0,0,8,11.32,36,36,0,0,1-12,70Zm16-44a12,12,0,0,1-12,12,40,40,0,0,1-40-40V84a12,12,0,0,1,24,0v4a16,16,0,0,0,16,16A12,12,0,0,1,208,116ZM100,88a40,40,0,0,1-40,40,12,12,0,0,1,0-24A16,16,0,0,0,76,88V84a12,12,0,0,1,24,0Z"}))],["duotone",l.createElement(l.Fragment,null,l.createElement("path",{d:"M240,124a48,48,0,0,1-32,45.27h0V176a40,40,0,0,1-80,0,40,40,0,0,1-80,0v-6.73h0a48,48,0,0,1,0-90.54V72a40,40,0,0,1,80,0,40,40,0,0,1,80,0v6.73A48,48,0,0,1,240,124Z",opacity:"0.2"}),l.createElement("path",{d:"M248,124a56.11,56.11,0,0,0-32-50.61V72a48,48,0,0,0-88-26.49A48,48,0,0,0,40,72v1.39a56,56,0,0,0,0,101.2V176a48,48,0,0,0,88,26.49A48,48,0,0,0,216,176v-1.41A56.09,56.09,0,0,0,248,124ZM88,208a32,32,0,0,1-31.81-28.56A55.87,55.87,0,0,0,64,180h8a8,8,0,0,0,0-16H64A40,40,0,0,1,50.67,86.27,8,8,0,0,0,56,78.73V72a32,32,0,0,1,64,0v68.26A47.8,47.8,0,0,0,88,128a8,8,0,0,0,0,16,32,32,0,0,1,0,64Zm104-44h-8a8,8,0,0,0,0,16h8a55.87,55.87,0,0,0,7.81-.56A32,32,0,1,1,168,144a8,8,0,0,0,0-16,47.8,47.8,0,0,0-32,12.26V72a32,32,0,0,1,64,0v6.73a8,8,0,0,0,5.33,7.54A40,40,0,0,1,192,164Zm16-52a8,8,0,0,1-8,8h-4a36,36,0,0,1-36-36V80a8,8,0,0,1,16,0v4a20,20,0,0,0,20,20h4A8,8,0,0,1,208,112ZM60,120H56a8,8,0,0,1,0-16h4A20,20,0,0,0,80,84V80a8,8,0,0,1,16,0v4A36,36,0,0,1,60,120Z"}))],["fill",l.createElement(l.Fragment,null,l.createElement("path",{d:"M212,76V72a44,44,0,0,0-74.86-31.31,3.93,3.93,0,0,0-1.14,2.8v88.72a4,4,0,0,0,6.2,3.33A47.67,47.67,0,0,1,167.68,128a8.18,8.18,0,0,1,8.31,7.58,8,8,0,0,1-8,8.42,32,32,0,0,0-32,32v33.88a4,4,0,0,0,1.49,3.12,47.92,47.92,0,0,0,74.21-17.16,4,4,0,0,0-4.49-5.56A68.06,68.06,0,0,1,192,192h-7.73a8.18,8.18,0,0,1-8.25-7.47,8,8,0,0,1,8-8.53h8a51.6,51.6,0,0,0,24-5.88v0A52,52,0,0,0,212,76Zm-12,36h-4a36,36,0,0,1-36-36V72a8,8,0,0,1,16,0v4a20,20,0,0,0,20,20h4a8,8,0,0,1,0,16ZM88,28A44.05,44.05,0,0,0,44,72v4a52,52,0,0,0-4,94.12h0A51.6,51.6,0,0,0,64,176h7.73A8.18,8.18,0,0,1,80,183.47,8,8,0,0,1,72,192H64a67.48,67.48,0,0,1-15.21-1.73,4,4,0,0,0-4.5,5.55A47.93,47.93,0,0,0,118.51,213a4,4,0,0,0,1.49-3.12V176a32,32,0,0,0-32-32,8,8,0,0,1-8-8.42A8.18,8.18,0,0,1,88.32,128a47.67,47.67,0,0,1,25.48,7.54,4,4,0,0,0,6.2-3.33V43.49a4,4,0,0,0-1.14-2.81A43.85,43.85,0,0,0,88,28Zm8,48a36,36,0,0,1-36,36H56a8,8,0,0,1,0-16h4A20,20,0,0,0,80,76V72a8,8,0,0,1,16,0Z"}))],["light",l.createElement(l.Fragment,null,l.createElement("path",{d:"M246,124a54.13,54.13,0,0,0-32-49.33V72a46,46,0,0,0-86-22.67A46,46,0,0,0,42,72v2.67a54,54,0,0,0,0,98.63V176a46,46,0,0,0,86,22.67A46,46,0,0,0,214,176v-2.7A54.07,54.07,0,0,0,246,124ZM88,210a34,34,0,0,1-34-32.94A53.67,53.67,0,0,0,64,178h8a6,6,0,0,0,0-12H64A42,42,0,0,1,50,84.39a6,6,0,0,0,4-5.66V72a34,34,0,0,1,68,0v73.05A45.89,45.89,0,0,0,88,130a6,6,0,0,0,0,12,34,34,0,0,1,0,68Zm104-44h-8a6,6,0,0,0,0,12h8a53.67,53.67,0,0,0,10-.94A34,34,0,1,1,168,142a6,6,0,0,0,0-12,45.89,45.89,0,0,0-34,15.05V72a34,34,0,0,1,68,0v6.73a6,6,0,0,0,4,5.66A42,42,0,0,1,192,166Zm14-54a6,6,0,0,1-6,6h-4a34,34,0,0,1-34-34V80a6,6,0,0,1,12,0v4a22,22,0,0,0,22,22h4A6,6,0,0,1,206,112ZM60,118H56a6,6,0,0,1,0-12h4A22,22,0,0,0,82,84V80a6,6,0,0,1,12,0v4A34,34,0,0,1,60,118Z"}))],["regular",l.createElement(l.Fragment,null,l.createElement("path",{d:"M248,124a56.11,56.11,0,0,0-32-50.61V72a48,48,0,0,0-88-26.49A48,48,0,0,0,40,72v1.39a56,56,0,0,0,0,101.2V176a48,48,0,0,0,88,26.49A48,48,0,0,0,216,176v-1.41A56.09,56.09,0,0,0,248,124ZM88,208a32,32,0,0,1-31.81-28.56A55.87,55.87,0,0,0,64,180h8a8,8,0,0,0,0-16H64A40,40,0,0,1,50.67,86.27,8,8,0,0,0,56,78.73V72a32,32,0,0,1,64,0v68.26A47.8,47.8,0,0,0,88,128a8,8,0,0,0,0,16,32,32,0,0,1,0,64Zm104-44h-8a8,8,0,0,0,0,16h8a55.87,55.87,0,0,0,7.81-.56A32,32,0,1,1,168,144a8,8,0,0,0,0-16,47.8,47.8,0,0,0-32,12.26V72a32,32,0,0,1,64,0v6.73a8,8,0,0,0,5.33,7.54A40,40,0,0,1,192,164Zm16-52a8,8,0,0,1-8,8h-4a36,36,0,0,1-36-36V80a8,8,0,0,1,16,0v4a20,20,0,0,0,20,20h4A8,8,0,0,1,208,112ZM60,120H56a8,8,0,0,1,0-16h4A20,20,0,0,0,80,84V80a8,8,0,0,1,16,0v4A36,36,0,0,1,60,120Z"}))],["thin",l.createElement(l.Fragment,null,l.createElement("path",{d:"M244,124a52.1,52.1,0,0,0-32-48V72a44,44,0,0,0-84-18.3A44,44,0,0,0,44,72v4a52,52,0,0,0,0,96v4a44,44,0,0,0,84,18.3A44,44,0,0,0,212,176v-4A52.07,52.07,0,0,0,244,124ZM88,212a36,36,0,0,1-36-36v-1.41A52.13,52.13,0,0,0,64,176h8a4,4,0,0,0,0-8H64A44,44,0,0,1,49.33,82.5,4,4,0,0,0,52,78.73V72a36,36,0,0,1,72,0v78.75A44,44,0,0,0,88,132a4,4,0,0,0,0,8,36,36,0,0,1,0,72Zm104-44h-8a4,4,0,0,0,0,8h8a52.13,52.13,0,0,0,12-1.41V176a36,36,0,1,1-36-36,4,4,0,0,0,0-8,44,44,0,0,0-36,18.75V72a36,36,0,0,1,72,0v6.73a4,4,0,0,0,2.67,3.77A44,44,0,0,1,192,168Zm12-56a4,4,0,0,1-4,4h-4a32,32,0,0,1-32-32V80a4,4,0,0,1,8,0v4a24,24,0,0,0,24,24h4A4,4,0,0,1,204,112ZM92,84a32,32,0,0,1-32,32H56a4,4,0,0,1,0-8h4A24,24,0,0,0,84,84V80a4,4,0,0,1,8,0Z"}))]]),o=l.forwardRef((e,a)=>l.createElement(n.Z,{ref:a,...e,weights:r}));o.displayName="BrainIcon";let s=o},19945:function(e,a,t){"use strict";t.d(a,{P:function(){return s}});var l=t(2265),n=t(4992);let r=new Map([["bold",l.createElement(l.Fragment,null,l.createElement("path",{d:"M219.71,117.38a12,12,0,0,0-7.25-8.52L161.28,88.39l10.59-70.61a12,12,0,0,0-20.64-10l-112,120a12,12,0,0,0,4.31,19.33l51.18,20.47L84.13,238.22a12,12,0,0,0,20.64,10l112-120A12,12,0,0,0,219.71,117.38ZM113.6,203.55l6.27-41.77a12,12,0,0,0-7.41-12.92L68.74,131.37,142.4,52.45l-6.27,41.77a12,12,0,0,0,7.41,12.92l43.72,17.49Z"}))],["duotone",l.createElement(l.Fragment,null,l.createElement("path",{d:"M96,240l16-80L48,136,160,16,144,96l64,24Z",opacity:"0.2"}),l.createElement("path",{d:"M215.79,118.17a8,8,0,0,0-5-5.66L153.18,90.9l14.66-73.33a8,8,0,0,0-13.69-7l-112,120a8,8,0,0,0,3,13l57.63,21.61L88.16,238.43a8,8,0,0,0,13.69,7l112-120A8,8,0,0,0,215.79,118.17ZM109.37,214l10.47-52.38a8,8,0,0,0-5-9.06L62,132.71l84.62-90.66L136.16,94.43a8,8,0,0,0,5,9.06l52.8,19.8Z"}))],["fill",l.createElement(l.Fragment,null,l.createElement("path",{d:"M213.85,125.46l-112,120a8,8,0,0,1-13.69-7l14.66-73.33L45.19,143.49a8,8,0,0,1-3-13l112-120a8,8,0,0,1,13.69,7L153.18,90.9l57.63,21.61a8,8,0,0,1,3,12.95Z"}))],["light",l.createElement(l.Fragment,null,l.createElement("path",{d:"M213.84,118.63a6,6,0,0,0-3.73-4.25L150.88,92.17l15-75a6,6,0,0,0-10.27-5.27l-112,120a6,6,0,0,0,2.28,9.71l59.23,22.21-15,75a6,6,0,0,0,3.14,6.52A6.07,6.07,0,0,0,96,246a6,6,0,0,0,4.39-1.91l112-120A6,6,0,0,0,213.84,118.63ZM106,220.46l11.85-59.28a6,6,0,0,0-3.77-6.8l-55.6-20.85,91.46-98L138.12,94.82a6,6,0,0,0,3.77,6.8l55.6,20.85Z"}))],["regular",l.createElement(l.Fragment,null,l.createElement("path",{d:"M215.79,118.17a8,8,0,0,0-5-5.66L153.18,90.9l14.66-73.33a8,8,0,0,0-13.69-7l-112,120a8,8,0,0,0,3,13l57.63,21.61L88.16,238.43a8,8,0,0,0,13.69,7l112-120A8,8,0,0,0,215.79,118.17ZM109.37,214l10.47-52.38a8,8,0,0,0-5-9.06L62,132.71l84.62-90.66L136.16,94.43a8,8,0,0,0,5,9.06l52.8,19.8Z"}))],["thin",l.createElement(l.Fragment,null,l.createElement("path",{d:"M211.89,119.09a4,4,0,0,0-2.49-2.84l-60.81-22.8,15.33-76.67a4,4,0,0,0-6.84-3.51l-112,120a4,4,0,0,0-1,3.64,4,4,0,0,0,2.49,2.84l60.81,22.8L92.08,239.22a4,4,0,0,0,6.84,3.51l112-120A4,4,0,0,0,211.89,119.09ZM102.68,227l13.24-66.2a4,4,0,0,0-2.52-4.53L55,134.36,153.32,29l-13.24,66.2a4,4,0,0,0,2.52,4.53L201,121.64Z"}))]]),o=l.forwardRef((e,a)=>l.createElement(n.Z,{ref:a,...e,weights:r}));o.displayName="LightningIcon";let s=o},60610:function(e,a,t){"use strict";t.d(a,{fC:function(){return j},z$:function(){return b}});var l=t(2265),n=t(73966),r=t(66840),o=t(57437),s="Progress",[i,d]=(0,n.b)(s),[c,u]=i(s),h=l.forwardRef((e,a)=>{var t,l,n,s;let{__scopeProgress:i,value:d=null,max:u,getValueLabel:h=f,...m}=e;(u||0===u)&&!x(u)&&console.error((t="".concat(u),l="Progress","Invalid prop `max` of value `".concat(t,"` supplied to `").concat(l,"`. Only numbers greater than 0 are valid max values. Defaulting to `").concat(100,"`.")));let p=x(u)?u:100;null===d||A(d,p)||console.error((n="".concat(d),s="Progress","Invalid prop `value` of value `".concat(n,"` supplied to `").concat(s,"`. The `value` prop must be:\n - a positive number\n - less than the value passed to `max` (or ").concat(100," if no `max` prop is set)\n - `null` or `undefined` if the progress is indeterminate.\n\nDefaulting to `null`.")));let j=A(d,p)?d:null,b=g(j)?h(j,p):void 0;return(0,o.jsx)(c,{scope:i,value:j,max:p,children:(0,o.jsx)(r.WV.div,{"aria-valuemax":p,"aria-valuemin":0,"aria-valuenow":g(j)?j:void 0,"aria-valuetext":b,role:"progressbar","data-state":v(j,p),"data-value":null!=j?j:void 0,"data-max":p,...m,ref:a})})});h.displayName=s;var m="ProgressIndicator",p=l.forwardRef((e,a)=>{var t;let{__scopeProgress:l,...n}=e,s=u(m,l);return(0,o.jsx)(r.WV.div,{"data-state":v(s.value,s.max),"data-value":null!==(t=s.value)&&void 0!==t?t:void 0,"data-max":s.max,...n,ref:a})});function f(e,a){return"".concat(Math.round(e/a*100),"%")}function v(e,a){return null==e?"indeterminate":e===a?"complete":"loading"}function g(e){return"number"==typeof e}function x(e){return g(e)&&!isNaN(e)&&e>0}function A(e,a){return g(e)&&!isNaN(e)&&e<=a&&e>=0}p.displayName=m;var j=h,b=p}},function(e){e.O(0,[4173,2939,7200,8667,1327,4447,558,3595,2327,5427,2971,2117,1744],function(){return e(e.s=1813)}),_N_E=e.O()}]);
|
@@ -1 +0,0 @@
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4371],{2743:function(e,t,a){Promise.resolve().then(a.bind(a,77837))},77837:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return eg}});var s=a(57437),n=a(17200),r=a(14308),o=a(66070),i=a(62869),l=a(53647),c=a(47107),d=a.n(c),u=a(13590),m=a(29501),h=a(91115),x=a(2265),f=a(15681),p=a(95186),g=a(26110),j=a(49027),y=a(76818),w=a(7436),v=a(30190),N=a.n(v),b=a(97673),k=a(99376),D=a(57054),S=a(86723),C=a(66142),_=a(96620),M=a(25888),I=a(45646),A=a(81627),T=a(82875),R=a(74646),z=a(64446),P=a(14353),L=a(2335),O=a(19945),W=a(56937),q=a(39535),E=a(77992),U=a(89534),V=a(65613),F=a(17814),G=a(60729),B=a(34124),Z=a(6512),J=a(37104);let Q=()=>window.fetch("/api/automation").then(e=>e.json()).catch(e=>console.log(e));function X(e){let t=e.split(" "),a=t[2],s=t[4];return"*"===a&&"*"===s?"Day":"*"!==s?"Week":"*"!==a?"Month":"Day"}function H(e){let t=e.split(" ");if("*"===t[3]&&"*"!==t[4])return Number(t[4])}function Y(e){let t=e.split(" "),a=t[1],s=t[0],n=Number(a)>=12?"PM":"AM",r=Number(a)>12?Number(a)-12:a;"00"===r&&(r="12");let o=s;return 10>Number(o)&&"00"!==o&&(o="0".concat(o)),"".concat(r,":").concat(o," ").concat(n)}function $(e){return String(e.split(" ")[2])}function K(e){return d().toString(e)}let ee=["Day","Week","Month"],et=Array.from({length:31},(e,t)=>String(t+1)),ea=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],es=[],en=["AM","PM"];for(var er=0;er<en.length;er++)for(var eo=0;eo<12;eo++)for(var ei=0;ei<60;ei+=15){let e=String(ei).padStart(2,"0"),t=0===eo?12:eo;es.push("".concat(t,":").concat(e," ").concat(en[er]))}let el=Date.now(),ec=[{subject:"Weekly Newsletter",scheduling_request:"/research Compile a message including: 1. A recap of news from last week 2. An at-home workout I can do before work 3. A quote to inspire me for the week ahead",schedule:"9AM every Monday",next:"Next run at 9AM on Monday",crontime:"0 9 * * 1",id:el,query_to_run:""},{subject:"Front Page of Hacker News",scheduling_request:"/research Summarize the top 5 posts from https://news.ycombinator.com/best and share them with me, including links",schedule:"9PM on every Wednesday",next:"Next run at 9PM on Wednesday",crontime:"0 21 * * 3",id:el+2,query_to_run:""},{subject:"Market Summary",scheduling_request:"/research Get the market summary for today and share it with me. Focus on tech stocks and the S&P 500.",schedule:"9AM on every weekday",next:"Next run at 9AM on Monday",crontime:"0 9 * * *",id:el+3,query_to_run:""},{subject:"Market Crash Notification",scheduling_request:"Notify me if the stock market fell by more than 5% today.",schedule:"5PM every evening",next:"Next run at 5PM today",crontime:"0 17 * * *",id:el+5,query_to_run:""},{subject:"Round-up of research papers about AI in healthcare",scheduling_request:"/research Summarize the top 3 research papers about AI in healthcare that were published in the last week. Include links to the full papers.",schedule:"9AM every Friday",next:"Next run at 9AM on Friday",crontime:"0 9 * * 5",id:el+4,query_to_run:""},{subject:"Daily Bedtime Story",scheduling_request:"Compose a bedtime story that a five-year-old might enjoy. It should not exceed five paragraphs. Appeal to the imagination, but weave in learnings.",schedule:"9PM every night",next:"Next run at 9PM today",crontime:"0 21 * * *",id:el+1,query_to_run:""}];function ed(e){let t=encodeURIComponent(e.subject),a=encodeURIComponent(e.scheduling_request),s=encodeURIComponent(e.crontime);return"".concat(window.location.origin,"/automations?subject=").concat(t,"&query=").concat(a,"&crontime=").concat(s)}function eu(e){let[t,a]=(0,x.useState)(!1),[n,r]=(0,x.useState)(null),[l,c]=(0,x.useState)(!1),d=e.automation,[u,m]=(0,x.useState)(""),[h,f]=(0,x.useState)("");return((0,x.useEffect)(()=>{let e=n||d;m(Y(e.crontime));let t=X(e.crontime);if("Day"===t)f("Daily");else if("Week"===t){let t=H(e.crontime);void 0===t?f("Weekly"):f("".concat(ea[t]))}else if("Month"===t){let t=$(e.crontime);f("Monthly on the ".concat(t))}},[n,d]),l)?null:(0,s.jsxs)(o.Zb,{className:"h-full shadow-md rounded-lg dark:bg-muted ".concat(N().automationCard),children:[(0,s.jsx)(o.Ol,{children:(0,s.jsxs)(o.ll,{className:"line-clamp-2 leading-normal flex justify-between",children:[(null==n?void 0:n.subject)||d.subject,(0,s.jsxs)(D.J2,{children:[(0,s.jsx)(D.xo,{asChild:!0,children:(0,s.jsx)(i.z,{className:"bg-background",variant:"ghost",children:(0,s.jsx)(S.F,{className:"h-4 w-4"})})}),(0,s.jsxs)(D.yk,{className:"w-auto grid gap-2 text-left bg-secondary",children:[!e.suggestedCard&&e.locationData&&(0,s.jsx)(ep,{isMobileWidth:e.isMobileWidth,callToAction:"Edit",createNew:!1,setIsCreating:a,setShowLoginPrompt:e.setShowLoginPrompt,setNewAutomationData:r,authenticatedData:e.authenticatedData,isCreating:t,automation:n||d,ipLocationData:e.locationData,setToastMessage:e.setToastMessage}),(0,s.jsx)(b.Z,{buttonTitle:"Share",includeIcon:!0,buttonClassName:"justify-start px-4 py-2 h-10",buttonVariant:"outline",title:"Share Automation",description:"Copy the link below and share it with your coworkers or friends.",url:ed(d),onShare:()=>{navigator.clipboard.writeText(ed(d))}}),!e.suggestedCard&&(0,s.jsxs)(i.z,{variant:"outline",className:"justify-start",onClick:()=>{!function(e,t){fetch("/api/automation/trigger?automation_id=".concat(e),{method:"POST"}).then(e=>{if(!e.ok)throw Error("Network response was not ok");return e}).then(e=>{t("Automation triggered. Check your inbox in a few minutes!")}).catch(e=>{t("Sorry, something went wrong. Try again later.")})}(d.id.toString(),e.setToastMessage)},children:[(0,s.jsx)(C.s,{className:"h-4 w-4 mr-2"}),"Run Now"]}),(0,s.jsxs)(i.z,{variant:"destructive",className:"justify-start",onClick:()=>{if(e.suggestedCard){c(!0);return}!function(e,t){fetch("/api/automation?automation_id=".concat(e),{method:"DELETE"}).then(e=>e.json()).then(e=>{t(!0)})}(d.id.toString(),c)},children:[(0,s.jsx)(_.r,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})}),(0,s.jsx)(o.aY,{className:"text-secondary-foreground break-all",children:(null==n?void 0:n.scheduling_request)||d.scheduling_request}),(0,s.jsxs)(o.eW,{className:"flex flex-col items-start md:flex-row md:justify-between md:items-center gap-2",children:[(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsxs)("div",{className:"flex items-center rounded-lg p-1.5 border-blue-200 border dark:border-blue-500",children:[(0,s.jsx)(M.T,{className:"h-4 w-4 mr-2 text-blue-700 dark:text-blue-300"}),(0,s.jsx)("div",{className:"text-s text-blue-700 dark:text-blue-300",children:u})]}),(0,s.jsxs)("div",{className:"flex items-center rounded-lg p-1.5 border-purple-200 border dark:border-purple-500",children:[(0,s.jsx)(I.u,{className:"h-4 w-4 mr-2 text-purple-700 dark:text-purple-300"}),(0,s.jsx)("div",{className:"text-s text-purple-700 dark:text-purple-300",children:h})]})]}),e.suggestedCard&&e.setNewAutomationData&&(0,s.jsx)(ep,{isMobileWidth:e.isMobileWidth,callToAction:"Add",createNew:!0,setIsCreating:a,setShowLoginPrompt:e.setShowLoginPrompt,setNewAutomationData:e.setNewAutomationData,authenticatedData:e.authenticatedData,isCreating:t,automation:d,ipLocationData:e.locationData,setToastMessage:e.setToastMessage})]})]})}function em(e){let t=(0,k.useSearchParams)(),[a,n]=(0,x.useState)(!0),r=t.get("subject"),o=t.get("query"),i=t.get("crontime");if(!r||!o||!i)return null;let l={id:0,subject:decodeURIComponent(r),scheduling_request:decodeURIComponent(o),query_to_run:"",schedule:K(decodeURIComponent(i)),crontime:decodeURIComponent(i),next:""};return a?(0,s.jsx)(ep,{isMobileWidth:e.isMobileWidth,callToAction:"Shared",createNew:!0,setIsCreating:n,setShowLoginPrompt:e.setShowLoginPrompt,setNewAutomationData:e.setNewAutomationData,authenticatedData:e.authenticatedData,isCreating:a,automation:l,ipLocationData:e.locationData,setToastMessage:e.setToastMessage}):null}let eh=h.z.object({subject:h.z.optional(h.z.string()),everyBlah:h.z.string({required_error:"Every is required"}),dayOfWeek:h.z.optional(h.z.number()),dayOfMonth:h.z.optional(h.z.string()),timeRecurrence:h.z.string({required_error:"Time Recurrence is required"}),schedulingRequest:h.z.string({required_error:"Query to Run is required"})});function ex(e){let t=e.automation,a=(0,m.cI)({resolver:(0,u.F)(eh),defaultValues:{subject:null==t?void 0:t.subject,everyBlah:(null==t?void 0:t.crontime)?X(t.crontime):"Day",dayOfWeek:(null==t?void 0:t.crontime)?H(t.crontime):void 0,timeRecurrence:(null==t?void 0:t.crontime)?Y(t.crontime):"12:00 PM",dayOfMonth:(null==t?void 0:t.crontime)?$(t.crontime):"1",schedulingRequest:null==t?void 0:t.scheduling_request}});return(0,s.jsx)(ef,{authenticatedData:e.authenticatedData,locationData:e.locationData||null,form:a,onSubmit:a=>{let s=function(e,t,a,s){let n="",r=t.split(":")[1].split(" ")[0],o=t.split(":")[1].split(" ")[1],i=Number(t.split(":")[0]),l="PM"===o&&i<12?String(i+12):i;switch(e){case"Day":n="".concat(r," ").concat(l," * * *");break;case"Week":n="".concat(r," ").concat(l," * * ").concat(void 0!==a?7===a?0:a:"*");break;case"Month":n="".concat(r," ").concat(l," ").concat(s," * *")}return n}(a.everyBlah,a.timeRecurrence,a.dayOfWeek,a.dayOfMonth),n="/api/automation?";n+="q=".concat(encodeURIComponent(a.schedulingRequest)),(null==t?void 0:t.id)&&!e.createNew&&(n+="&automation_id=".concat(encodeURIComponent(t.id))),a.subject&&(n+="&subject=".concat(encodeURIComponent(a.subject))),n+="&crontime=".concat(encodeURIComponent(s)),e.locationData&&e.locationData.city&&(n+="&city=".concat(encodeURIComponent(e.locationData.city))),e.locationData&&e.locationData.region&&(n+="®ion=".concat(encodeURIComponent(e.locationData.region))),e.locationData&&e.locationData.country&&(n+="&country=".concat(encodeURIComponent(e.locationData.country))),e.locationData&&e.locationData.timezone&&(n+="&timezone=".concat(encodeURIComponent(e.locationData.timezone))),fetch(n,{method:e.createNew?"POST":"PUT"}).then(e=>e.json()).then(t=>{e.setIsEditing(!1),e.setUpdatedAutomationData({id:t.id,subject:t.subject||"",query_to_run:t.query_to_run,scheduling_request:t.scheduling_request,schedule:K(t.crontime),crontime:t.crontime,next:t.next})}).catch(t=>{console.error("Error saving automation:",t),e.setIsEditing(!1),e.setToastMessage("Sorry, something went wrong. Try again or contact team@khoj.dev.")})},create:e.createNew,isLoggedIn:e.isLoggedIn,setShowLoginPrompt:e.setShowLoginPrompt})}function ef(e){var t,a;let[n,r]=(0,x.useState)(!1),{errors:o}=e.form.formState,c=["Make a picture of","Generate a summary of","Create a newsletter of","Notify me when"];return(0,s.jsx)(f.l0,{...e.form,children:(0,s.jsxs)("form",{onSubmit:e.form.handleSubmit(t=>{e.onSubmit(t),r(!0)}),className:"space-y-6",children:[(0,s.jsx)(f.xJ,{className:"space-y-1",children:(0,s.jsxs)(f.pf,{children:["Emails will be sent to this address. Timezone and location data will be used to schedule automations.",e.locationData&&(t=e.locationData,a=e.authenticatedData,(0,s.jsxs)("div",{className:"flex flex-wrap gap-2 items-center justify-start",children:[a?(0,s.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm dark:bg-muted",children:[(0,s.jsx)(R.w,{className:"h-4 w-4 mr-2 inline text-orange-500 shadow-sm"}),a.email]}):null,t&&(0,s.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm dark:bg-muted",children:[(0,s.jsx)(z.x,{className:"h-4 w-4 mr-2 inline text-purple-500"}),t?"".concat(t.city,", ").concat(t.country):"Unknown"]}),t&&(0,s.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm dark:bg-muted",children:[(0,s.jsx)(P.S,{className:"h-4 w-4 mr-2 inline text-green-500"}),t?"".concat(t.timezone):"Unknown"]})]}))]})}),!e.create&&(0,s.jsx)(f.Wi,{control:e.form.control,name:"subject",render:e=>{var t;let{field:a}=e;return(0,s.jsxs)(f.xJ,{className:"space-y-1",children:[(0,s.jsx)(f.lX,{children:"Subject"}),(0,s.jsx)(f.pf,{children:"This is the subject of the email you will receive."}),(0,s.jsx)(f.NI,{children:(0,s.jsx)(p.I,{placeholder:"Digest of Healthcare AI trends",...a})}),(0,s.jsx)(f.zG,{}),o.subject&&(0,s.jsx)(f.zG,{children:null===(t=o.subject)||void 0===t?void 0:t.message})]})}}),(0,s.jsx)(f.Wi,{control:e.form.control,name:"everyBlah",render:e=>{var t;let{field:a}=e;return(0,s.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,s.jsx)(f.lX,{children:"Frequency"}),(0,s.jsx)(f.pf,{children:"How often should this automation run?"}),(0,s.jsxs)(l.Ph,{onValueChange:a.onChange,defaultValue:a.value,children:[(0,s.jsx)(f.NI,{children:(0,s.jsxs)(l.i4,{className:"w-[200px]",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(A.W,{className:"h-4 w-4 mr-2 inline"}),"Every"]}),(0,s.jsx)(l.ki,{placeholder:""})]})}),(0,s.jsx)(l.Bw,{children:ee.map(e=>(0,s.jsx)(l.Ql,{value:e,children:e},e))})]}),(0,s.jsx)(f.zG,{}),o.subject&&(0,s.jsx)(f.zG,{children:null===(t=o.everyBlah)||void 0===t?void 0:t.message})]})}}),"Week"===e.form.watch("everyBlah")&&(0,s.jsx)(f.Wi,{control:e.form.control,name:"dayOfWeek",render:e=>{var t;let{field:a}=e;return(0,s.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,s.jsx)(f.pf,{children:"Every week, on which day should this automation run?"}),(0,s.jsxs)(l.Ph,{onValueChange:e=>a.onChange(Number(e)),defaultValue:String(a.value),children:[(0,s.jsx)(f.NI,{children:(0,s.jsxs)(l.i4,{className:"w-[200px]",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(T.n,{className:"h-4 w-4 mr-2 inline"}),"On"]}),(0,s.jsx)(l.ki,{placeholder:""})]})}),(0,s.jsx)(l.Bw,{children:ea.map((e,t)=>(0,s.jsx)(l.Ql,{value:String(t),children:e},e))})]}),(0,s.jsx)(f.zG,{}),o.subject&&(0,s.jsx)(f.zG,{children:null===(t=o.dayOfWeek)||void 0===t?void 0:t.message})]})}}),"Month"===e.form.watch("everyBlah")&&(0,s.jsx)(f.Wi,{control:e.form.control,name:"dayOfMonth",render:e=>{var t;let{field:a}=e;return(0,s.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,s.jsx)(f.pf,{children:"Every month, on which day should the automation run?"}),(0,s.jsxs)(l.Ph,{onValueChange:a.onChange,defaultValue:a.value,children:[(0,s.jsx)(f.NI,{children:(0,s.jsxs)(l.i4,{className:"w-[200px]",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(T.n,{className:"h-4 w-4 mr-2 inline"}),"On the"]}),(0,s.jsx)(l.ki,{placeholder:""})]})}),(0,s.jsx)(l.Bw,{children:et.map(e=>(0,s.jsx)(l.Ql,{value:e,children:e},e))})]}),(0,s.jsx)(f.zG,{}),o.subject&&(0,s.jsx)(f.zG,{children:null===(t=o.dayOfMonth)||void 0===t?void 0:t.message})]})}}),("Day"===e.form.watch("everyBlah")||"Week"==e.form.watch("everyBlah")||"Month"==e.form.watch("everyBlah"))&&(0,s.jsx)(f.Wi,{control:e.form.control,name:"timeRecurrence",render:e=>{var t;let{field:a}=e;return(0,s.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,s.jsx)(f.lX,{children:"Time"}),(0,s.jsx)(f.pf,{children:"On the days this automation runs, at what time should it run?"}),(0,s.jsxs)(l.Ph,{onValueChange:a.onChange,defaultValue:a.value,children:[(0,s.jsx)(f.NI,{children:(0,s.jsxs)(l.i4,{className:"w-[200px]",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(I.u,{className:"h-4 w-4 mr-2 inline"}),"At"]}),(0,s.jsx)(l.ki,{placeholder:""})]})}),(0,s.jsx)(l.Bw,{children:es.map(e=>(0,s.jsx)(l.Ql,{value:e,children:e},e))})]}),(0,s.jsx)(f.zG,{}),o.subject&&(0,s.jsx)(f.zG,{children:null===(t=o.timeRecurrence)||void 0===t?void 0:t.message})]})}}),(0,s.jsx)(f.Wi,{control:e.form.control,name:"schedulingRequest",render:t=>{var a;let{field:n}=t;return(0,s.jsxs)(f.xJ,{className:"space-y-1",children:[(0,s.jsx)(f.lX,{children:"Instructions"}),(0,s.jsx)(f.pf,{children:"What do you want Khoj to do?"}),e.create&&(0,s.jsx)("div",{children:c.map(e=>{var t;return t=n.onChange,(0,s.jsxs)(i.z,{className:"text-xs bg-slate-50 dark:bg-slate-950 h-auto p-1.5 m-1 rounded-full",variant:"ghost",onClick:a=>{a.preventDefault(),t({target:{value:e}},a)},children:[e,"..."]},e)})}),(0,s.jsx)(f.NI,{children:(0,s.jsx)(y.g,{placeholder:"Create a summary of the latest news about AI in healthcare.",value:n.value,onChange:n.onChange})}),(0,s.jsx)(f.zG,{}),o.subject&&(0,s.jsx)(f.zG,{children:null===(a=o.schedulingRequest)||void 0===a?void 0:a.message})]})}}),(0,s.jsx)("fieldset",{disabled:n,children:e.isLoggedIn?n?(0,s.jsx)(i.z,{type:"submit",disabled:!0,children:"Saving..."}):(0,s.jsx)(i.z,{type:"submit",children:"Save"}):(0,s.jsx)(i.z,{onClick:t=>{t.preventDefault(),e.setShowLoginPrompt(!0)},variant:"default",children:"Login to Save"})})]})})}function ep(e){return e.isMobileWidth?(0,s.jsxs)(F.dy,{open:e.isCreating,onOpenChange:t=>{e.setIsCreating(t)},children:[(0,s.jsx)(F.Qz,{asChild:!0,children:(0,s.jsxs)(i.z,{className:"shadow-sm justify-start",variant:"outline",children:[(0,s.jsx)(L.v,{className:"h-4 w-4 mr-2"}),e.callToAction]})}),(0,s.jsxs)(F.sc,{className:"p-2",children:[(0,s.jsx)(F.iI,{children:"Automation"}),(0,s.jsx)(ex,{createNew:e.createNew,automation:e.automation,setIsEditing:e.setIsCreating,isLoggedIn:!!e.authenticatedData,authenticatedData:e.authenticatedData,setShowLoginPrompt:e.setShowLoginPrompt,setUpdatedAutomationData:e.setNewAutomationData,locationData:e.ipLocationData,setToastMessage:e.setToastMessage})]})]}):(0,s.jsxs)(g.Vq,{open:e.isCreating,onOpenChange:t=>{e.setIsCreating(t)},children:[(0,s.jsx)(g.hg,{asChild:!0,children:(0,s.jsxs)(i.z,{className:"shadow-sm justify-start",variant:"outline",children:[(0,s.jsx)(L.v,{className:"h-4 w-4 mr-2"}),e.callToAction]})}),(0,s.jsxs)(g.cZ,{className:"max-h-[98vh] overflow-y-auto",children:[(0,s.jsx)(j.$N,{children:"Automation"}),(0,s.jsx)(ex,{automation:e.automation,createNew:e.createNew,setIsEditing:e.setIsCreating,isLoggedIn:!!e.authenticatedData,authenticatedData:e.authenticatedData,setShowLoginPrompt:e.setShowLoginPrompt,setUpdatedAutomationData:e.setNewAutomationData,locationData:e.ipLocationData,setToastMessage:e.setToastMessage})]})]})}function eg(){let{data:e,error:t,isLoading:a}=(0,W.GW)(),{data:o,error:l,isLoading:c}=(0,n.ZP)(e?"automations":null,Q,{revalidateOnFocus:!1}),[d,u]=(0,x.useState)(!1),[m,h]=(0,x.useState)(null),[f,p]=(0,x.useState)([]),[g,j]=(0,x.useState)([]),[y,v]=(0,x.useState)(!1),b=(0,w.IC)(),{locationData:k,locationDataError:D,locationDataLoading:S}=(0,w.k6)(),[C,_]=(0,x.useState)(""),{toast:M}=(0,E.pm)();return((0,x.useEffect)(()=>{m&&(p([...f,m]),h(null))},[m,f]),(0,x.useEffect)(()=>{let e=o?o.concat(f):f;e&&j(ec.filter(t=>void 0===e.find(e=>t.subject===e.subject)))},[o,f]),(0,x.useEffect)(()=>{C&&(M({title:"Automation",description:C,action:(0,s.jsx)(U.gD,{altText:"Dismiss",children:"Ok"}),variant:C.includes("Sorry")?"destructive":"default"}),_(""))},[C]),l)?(0,s.jsx)(r.l,{message:"Oops, something went wrong. Please refresh the page."}):(0,s.jsxs)(G.Hn,{children:[(0,s.jsx)(B.S,{conversationId:""}),(0,s.jsxs)(G.kV,{children:[(0,s.jsxs)("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[(0,s.jsx)(G.vP,{className:"-ml-1"}),(0,s.jsx)(Z.Z,{orientation:"vertical",className:"mr-2 h-4"}),b?(0,s.jsx)("a",{className:"p-0 no-underline",href:"/",children:(0,s.jsx)(J.VO,{className:"h-auto w-16"})}):(0,s.jsx)("h2",{className:"text-lg",children:"Automations"})]}),(0,s.jsx)("main",{className:"w-full mx-auto",children:(0,s.jsx)("div",{className:"grid w-full mx-auto",children:(0,s.jsxs)("div",{className:"".concat(N().pageLayout," w-full"),children:[(0,s.jsxs)("div",{className:"pt-6 md:pt-8 grid gap-1 md:flex md:justify-between",children:[(0,s.jsx)("h1",{className:"text-3xl flex items-center",children:"Automations"}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2 items-center justify-start",children:[e?(0,s.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm dark:bg-muted",children:[(0,s.jsx)(R.w,{className:"h-4 w-4 mr-2 inline text-orange-500 shadow-sm"}),e.email]}):null,k&&(0,s.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm dark:bg-muted",children:[(0,s.jsx)(z.x,{className:"h-4 w-4 mr-2 inline text-purple-500"}),k?"".concat(k.city,", ").concat(k.country):"Unknown"]}),k&&(0,s.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm dark:bg-muted",children:[(0,s.jsx)(P.S,{className:"h-4 w-4 mr-2 inline text-green-500"}),k?"".concat(k.timezone):"Unknown"]})]})]}),y&&(0,s.jsx)(q.Z,{onOpenChange:v,isMobileWidth:b}),(0,s.jsx)(V.bZ,{className:"bg-secondary border-none my-4",children:(0,s.jsxs)(V.X,{children:[(0,s.jsx)(O.P,{weight:"fill",className:"h-4 w-4 text-purple-400 inline"}),(0,s.jsx)("span",{className:"font-bold",children:"How it works"})," Automations help you structure your time by automating tasks you do regularly. Build your own, or try out our presets. Get results straight to your inbox."]})}),(0,s.jsx)("div",{className:"flex justify-between items-center py-4",children:e?(0,s.jsx)(ep,{isMobileWidth:b,callToAction:"Create Automation",createNew:!0,setIsCreating:u,setShowLoginPrompt:v,setNewAutomationData:h,authenticatedData:e,isCreating:d,ipLocationData:k,setToastMessage:_}):(0,s.jsxs)(i.z,{className:"shadow-sm",onClick:()=>v(!0),variant:"outline",children:[(0,s.jsx)(L.v,{className:"h-4 w-4 mr-2"}),"Create Automation"]})}),(0,s.jsx)(x.Suspense,{children:(0,s.jsx)(em,{isMobileWidth:b,authenticatedData:e||null,locationData:k,isLoggedIn:!!e,setShowLoginPrompt:v,setNewAutomationData:h,setToastMessage:_})}),c&&(0,s.jsx)(r.l,{message:"booting up your automations"}),(0,s.jsxs)("div",{className:"".concat(N().automationsLayout),children:[e&&o&&o.map(t=>(0,s.jsx)(eu,{isMobileWidth:b,authenticatedData:e,automation:t,locationData:k,isLoggedIn:!!e,setShowLoginPrompt:v,setToastMessage:_},t.id)),e&&f.map(t=>(0,s.jsx)(eu,{isMobileWidth:b,authenticatedData:e,automation:t,locationData:k,isLoggedIn:!!e,setShowLoginPrompt:v,setToastMessage:_},t.id))]}),(0,s.jsx)("h3",{className:"text-xl py-4",children:"Explore"}),(0,s.jsx)("div",{className:"".concat(N().automationsLayout),children:g.map(t=>(0,s.jsx)(eu,{isMobileWidth:b,setNewAutomationData:h,authenticatedData:e||null,automation:t,locationData:k,isLoggedIn:!!e,setShowLoginPrompt:v,suggestedCard:!0,setToastMessage:_},t.id))})]})})})]})]})}},97673:function(e,t,a){"use strict";a.d(t,{Z:function(){return c}});var s=a(57437),n=a(26110),r=a(62869),o=a(95186),i=a(26815),l=a(33321);function c(e){var t;return(0,s.jsxs)(n.Vq,{children:[(0,s.jsx)(n.hg,{asChild:!0,onClick:e.onShare,children:(0,s.jsxs)(r.z,{size:"sm",className:"".concat(e.buttonClassName||"px-3"),variant:null!==(t=e.buttonVariant)&&void 0!==t?t:"default",children:[e.includeIcon&&(0,s.jsx)(l.m,{className:"w-4 h-4 mr-2"}),e.buttonTitle]})}),(0,s.jsxs)(n.cZ,{children:[(0,s.jsxs)(n.fK,{children:[(0,s.jsx)(n.$N,{children:e.title}),(0,s.jsx)(n.Be,{children:e.description})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsxs)("div",{className:"grid flex-1 gap-2",children:[(0,s.jsx)(i._,{htmlFor:"link",className:"sr-only",children:"Link"}),(0,s.jsx)(o.I,{id:"link",defaultValue:e.url,readOnly:!0})]}),(0,s.jsx)(r.z,{type:"submit",size:"sm",className:"px-3",onClick:()=>(function(e){let t=navigator.clipboard;t&&t.writeText(e)})(e.url),children:(0,s.jsx)("span",{children:"Copy"})})]})]})]})}},65613:function(e,t,a){"use strict";a.d(t,{X:function(){return c},bZ:function(){return l}});var s=a(57437),n=a(2265),r=a(90535),o=a(94508);let i=(0,r.j)("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),l=n.forwardRef((e,t)=>{let{className:a,variant:n,...r}=e;return(0,s.jsx)("div",{ref:t,role:"alert",className:(0,o.cn)(i({variant:n}),a),...r})});l.displayName="Alert",n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)("h5",{ref:t,className:(0,o.cn)("mb-1 font-medium leading-none tracking-tight",a),...n})}).displayName="AlertTitle";let c=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)("div",{ref:t,className:(0,o.cn)("text-sm [&_p]:leading-relaxed",a),...n})});c.displayName="AlertDescription"},15681:function(e,t,a){"use strict";a.d(t,{NI:function(){return p},Wi:function(){return u},l0:function(){return c},lX:function(){return f},pf:function(){return g},xJ:function(){return x},zG:function(){return j}});var s=a(57437),n=a(2265),r=a(37053),o=a(29501),i=a(94508),l=a(26815);let c=o.RV,d=n.createContext({}),u=e=>{let{...t}=e;return(0,s.jsx)(d.Provider,{value:{name:t.name},children:(0,s.jsx)(o.Qr,{...t})})},m=()=>{let e=n.useContext(d),t=n.useContext(h),{getFieldState:a,formState:s}=(0,o.Gc)(),r=a(e.name,s);if(!e)throw Error("useFormField should be used within <FormField>");let{id:i}=t;return{id:i,name:e.name,formItemId:"".concat(i,"-form-item"),formDescriptionId:"".concat(i,"-form-item-description"),formMessageId:"".concat(i,"-form-item-message"),...r}},h=n.createContext({}),x=n.forwardRef((e,t)=>{let{className:a,...r}=e,o=n.useId();return(0,s.jsx)(h.Provider,{value:{id:o},children:(0,s.jsx)("div",{ref:t,className:(0,i.cn)("space-y-2",a),...r})})});x.displayName="FormItem";let f=n.forwardRef((e,t)=>{let{className:a,...n}=e,{error:r,formItemId:o}=m();return(0,s.jsx)(l._,{ref:t,className:(0,i.cn)(r&&"text-destructive",a),htmlFor:o,...n})});f.displayName="FormLabel";let p=n.forwardRef((e,t)=>{let{...a}=e,{error:n,formItemId:o,formDescriptionId:i,formMessageId:l}=m();return(0,s.jsx)(r.g7,{ref:t,id:o,"aria-describedby":n?"".concat(i," ").concat(l):"".concat(i),"aria-invalid":!!n,...a})});p.displayName="FormControl";let g=n.forwardRef((e,t)=>{let{className:a,...n}=e,{formDescriptionId:r}=m();return(0,s.jsx)("p",{ref:t,id:r,className:(0,i.cn)("text-sm text-muted-foreground",a),...n})});g.displayName="FormDescription";let j=n.forwardRef((e,t)=>{let{className:a,children:n,...r}=e,{error:o,formMessageId:l}=m(),c=o?String(null==o?void 0:o.message):n;return c?(0,s.jsx)("p",{ref:t,id:l,className:(0,i.cn)("text-sm font-medium text-destructive",a),...r,children:c}):null});j.displayName="FormMessage"},26815:function(e,t,a){"use strict";a.d(t,{_:function(){return c}});var s=a(57437),n=a(2265),r=a(6394),o=a(90535),i=a(94508);let l=(0,o.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),c=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.f,{ref:t,className:(0,i.cn)(l(),a),...n})});c.displayName=r.f.displayName},53647:function(e,t,a){"use strict";a.d(t,{Bw:function(){return f},Ph:function(){return d},Ql:function(){return p},i4:function(){return m},ki:function(){return u}});var s=a(57437),n=a(2265),r=a(56873),o=a(40875),i=a(22135),l=a(30401),c=a(94508);let d=r.fC;r.ZA;let u=r.B4,m=n.forwardRef((e,t)=>{let{className:a,children:n,...i}=e;return(0,s.jsxs)(r.xz,{ref:t,className:(0,c.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",a),...i,children:[n,(0,s.jsx)(r.JO,{asChild:!0,children:(0,s.jsx)(o.Z,{className:"h-4 w-4 opacity-50"})})]})});m.displayName=r.xz.displayName;let h=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.u_,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",a),...n,children:(0,s.jsx)(i.Z,{className:"h-4 w-4"})})});h.displayName=r.u_.displayName;let x=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.$G,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",a),...n,children:(0,s.jsx)(o.Z,{className:"h-4 w-4"})})});x.displayName=r.$G.displayName;let f=n.forwardRef((e,t)=>{let{className:a,children:n,position:o="popper",...i}=e;return(0,s.jsx)(r.h_,{children:(0,s.jsxs)(r.VY,{ref:t,className:(0,c.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===o&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",a),position:o,...i,children:[(0,s.jsx)(h,{}),(0,s.jsx)(r.l_,{className:(0,c.cn)("p-1","popper"===o&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),(0,s.jsx)(x,{})]})})});f.displayName=r.VY.displayName,n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.__,{ref:t,className:(0,c.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",a),...n})}).displayName=r.__.displayName;let p=n.forwardRef((e,t)=>{let{className:a,children:n,...o}=e;return(0,s.jsxs)(r.ck,{ref:t,className:(0,c.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...o,children:[(0,s.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,s.jsx)(r.wU,{children:(0,s.jsx)(l.Z,{className:"h-4 w-4"})})}),(0,s.jsx)(r.eT,{children:n})]})});p.displayName=r.ck.displayName,n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.Z0,{ref:t,className:(0,c.cn)("-mx-1 my-1 h-px bg-muted",a),...n})}).displayName=r.Z0.displayName},76818:function(e,t,a){"use strict";a.d(t,{g:function(){return o}});var s=a(57437),n=a(2265),r=a(94508);let o=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)("textarea",{className:(0,r.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",a),ref:t,...n})});o.displayName="Textarea"},89534:function(e,t,a){"use strict";a.d(t,{FN:function(){return m},Mi:function(){return f},VW:function(){return c},_i:function(){return d},gD:function(){return h},lj:function(){return p},sA:function(){return x}});var s=a(57437),n=a(2265),r=a(41915),o=a(90535),i=a(32489),l=a(94508);let c=r.zt,d=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.l_,{ref:t,className:(0,l.cn)("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",a),...n})});d.displayName=r.l_.displayName;let u=(0,o.j)("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),m=n.forwardRef((e,t)=>{let{className:a,variant:n,...o}=e;return(0,s.jsx)(r.fC,{ref:t,className:(0,l.cn)(u({variant:n}),a),...o})});m.displayName=r.fC.displayName;let h=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.aU,{ref:t,className:(0,l.cn)("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",a),...n})});h.displayName=r.aU.displayName;let x=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.x8,{ref:t,className:(0,l.cn)("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",a),"toast-close":"",...n,children:(0,s.jsx)(i.Z,{className:"h-4 w-4"})})});x.displayName=r.x8.displayName;let f=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.Dx,{ref:t,className:(0,l.cn)("text-sm font-semibold",a),...n})});f.displayName=r.Dx.displayName;let p=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.dk,{ref:t,className:(0,l.cn)("text-sm opacity-90",a),...n})});p.displayName=r.dk.displayName},77992:function(e,t,a){"use strict";a.d(t,{pm:function(){return m}});var s=a(2265);let n=0,r=new Map,o=e=>{if(r.has(e))return;let t=setTimeout(()=>{r.delete(e),d({type:"REMOVE_TOAST",toastId:e})},1e6);r.set(e,t)},i=(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:a}=t;return a?o(a):e.toasts.forEach(e=>{o(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===a||void 0===a?{...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)}}},l=[],c={toasts:[]};function d(e){c=i(c,e),l.forEach(e=>{e(c)})}function u(e){let{...t}=e,a=(n=(n+1)%Number.MAX_SAFE_INTEGER).toString(),s=()=>d({type:"DISMISS_TOAST",toastId:a});return d({type:"ADD_TOAST",toast:{...t,id:a,open:!0,onOpenChange:e=>{e||s()}}}),{id:a,dismiss:s,update:e=>d({type:"UPDATE_TOAST",toast:{...e,id:a}})}}function m(){let[e,t]=s.useState(c);return s.useEffect(()=>(l.push(t),()=>{let e=l.indexOf(t);e>-1&&l.splice(e,1)}),[e]),{...e,toast:u,dismiss:e=>d({type:"DISMISS_TOAST",toastId:e})}}},30190:function(e){e.exports={automationsLayout:"automations_automationsLayout__Atoh_",automationCard:"automations_automationCard__BKidA",pageLayout:"automations_pageLayout__OaoYA"}}},function(e){e.O(0,[4173,2939,7200,8667,1327,4447,558,1915,9537,2327,2971,2117,1744],function(){return e(e.s=2743)}),_N_E=e.O()}]);
|
@@ -1 +0,0 @@
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3317,8459,7138,244],{63521:function(){}},function(n){n.O(0,[2971,2117,1744],function(){return n(n.s=63521)}),_N_E=n.O()}]);
|
@@ -1 +0,0 @@
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[244,3317,8459,7138],{63521:function(){}},function(n){n.O(0,[2971,2117,1744],function(){return n(n.s=63521)}),_N_E=n.O()}]);
|
@@ -1 +0,0 @@
|
|
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,10 +0,0 @@
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1860],{47833:function(t,e,a){a.d(e,{C1:function(){return o},Fh:function(){return S},Lf:function(){return ed},XO:function(){return x},Yn:function(){return ec},ZH:function(){return P},aH:function(){return ey},dW:function(){return eh},gU:function(){return eg},jr:function(){return c},us:function(){return R}});var l=a(39263),r=a(24568),i=a(9242),n=a(54166),s=a(15440),h=a(90705),o=(0,n.eW)(async(t,e,a)=>{let l,h;let o=e.useHtmlLabels||(0,n.ku)(n.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,i.R7)(e.labelStyle));h=void 0===e.label?"":"string"==typeof e.label?e.label:e.label[0];let g=await (0,r.rw)(c,(0,n.oO)((0,i.SH)(h),(0,n.nV)()),{useHtmlLabels:o,width:e.width||n.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,s.Ys)(g),a=t.getElementsByTagName("img");if(a){let t=""===h.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,n.nV)().fontSize?(0,n.nV)().fontSize:window.getComputedStyle(document.body).fontSize,[a=n.vZ.fontSize]=(0,i.VG)(t),l=5*a+"px";e.style.minWidth=l,e.style.maxWidth=l}else e.style.width="100%";a(e)}(0,n.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"),d=(0,n.eW)(async(t,e,a)=>{let l=a.useHtmlLabels||(0,n.ku)(n.nV()?.flowchart?.htmlLabels),h=t.insert("g").attr("class","label").attr("style",a.labelStyle||""),o=await (0,r.rw)(h,(0,n.oO)((0,i.SH)(e),(0,n.nV)()),{useHtmlLabels:l,width:a.width||n.nV()?.flowchart?.wrappingWidth,style:a.labelStyle,addSvgBackground:!!a.icon||!!a.img}),d=o.getBBox(),c=a.padding/2;if((0,n.ku)(n.nV()?.flowchart?.htmlLabels)){let t=o.children[0],e=(0,s.Ys)(o);d=t.getBoundingClientRect(),e.attr("width",d.width),e.attr("height",d.height)}return l?h.attr("transform","translate("+-d.width/2+", "+-d.height/2+")"):h.attr("transform","translate(0, "+-d.height/2+")"),a.centerLabel&&h.attr("transform","translate("+-d.width/2+", "+-d.height/2+")"),h.insert("rect",":first-child"),{shapeSvg:t,bbox:d,halfPadding:c,label:h}},"insertLabel"),c=(0,n.eW)((t,e)=>{let a=e.node().getBBox();t.width=a.width,t.height=a.height},"updateNodeBounds"),g=(0,n.eW)((t,e)=>("handDrawn"===t.look?"rough-node":"node")+" "+t.cssClasses+" "+(e||""),"getNodeClasses");function y(t){let e=t.map((t,e)=>`${0===e?"M":"L"}${t.x},${t.y}`);return e.push("Z"),e.join(" ")}function f(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 p(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,n.eW)(y,"createPathFromPoints"),(0,n.eW)(f,"generateFullSineWavePoints"),(0,n.eW)(p,"generateCirclePoints");var u=(0,n.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 m(t,e){e&&t.attr("style",e)}async function w(t){let e=(0,s.Ys)(document.createElementNS("http://www.w3.org/2000/svg","foreignObject")),a=e.append("xhtml:div"),l=t.label;t.label&&(0,n.l0)(t.label)&&(l=await (0,n.uT)(t.label.replace(n.SY.lineBreakRegex,"\n"),(0,n.nV)()));let r=t.isNode?"nodeLabel":"edgeLabel";return a.html('<span class="'+r+'" '+(t.labelStyle?'style="'+t.labelStyle+'"':"")+">"+l+"</span>"),m(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,n.eW)(m,"applyStyle"),(0,n.eW)(w,"addHtmlLabel");var x=(0,n.eW)(async(t,e,a,l)=>{let r=t||"";if("object"==typeof r&&(r=r[0]),(0,n.ku)((0,n.nV)().flowchart.htmlLabels)){r=r.replace(/\\n|\n/g,"<br />"),n.cM.info("vertexText"+r);let t={isNode:l,label:(0,i.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"),b=(0,n.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"),$=(0,n.eW)(t=>{let{handDrawnSeed:e}=(0,n.nV)();return{fill:t,hachureAngle:120,hachureGap:4,fillWeight:2,roughness:.7,stroke:t,seed:e}},"solidStateFill"),k=(0,n.eW)(t=>{let e=M([...t.cssCompiledStyles||[],...t.cssStyles||[]]);return{stylesMap:e,stylesArray:[...e]}},"compileStyles"),M=(0,n.eW)(t=>{let e=new Map;return t.forEach(t=>{let[a,l]=t.split(":");e.set(a.trim(),l?.trim())}),e},"styles2Map"),S=(0,n.eW)(t=>"color"===t||"font-size"===t||"font-family"===t||"font-weight"===t||"font-style"===t||"text-decoration"===t||"text-align"===t||"text-transform"===t||"line-height"===t||"letter-spacing"===t||"word-spacing"===t||"text-shadow"===t||"text-overflow"===t||"white-space"===t||"word-wrap"===t||"word-break"===t||"overflow-wrap"===t||"hyphens"===t,"isLabelStyle"),D=(0,n.eW)(t=>{let{stylesArray:e}=k(t),a=[],l=[],r=[],i=[];return e.forEach(t=>{let e=t[0];S(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,n.eW)((t,e)=>{let{themeVariables:a,handDrawnSeed:l}=(0,n.nV)(),{nodeBorder:r,mainBkg:i}=a,{stylesMap:s}=k(t);return Object.assign({roughness:.7,fill:s.get("fill")||i,fillStyle:"hachure",fillWeight:4,hachureGap:5.2,stroke:s.get("stroke")||r,seed:l,strokeWidth:s.get("stroke-width")?.replace("px","")||1.3,fillLineDash:[0,0]},e)},"userNodeOverrides"),v=(0,n.eW)(async(t,e)=>{let a;n.cM.info("Creating subgraph rect for ",e.id,e);let i=(0,n.nV)(),{themeVariables:o,handDrawnSeed:d}=i,{clusterBkg:c,clusterBorder:g}=o,{labelStyles:y,nodeStyles:f,borderStyles:p,backgroundStyles:m}=D(e),w=t.insert("g").attr("class","cluster "+e.cssClasses).attr("id",e.id).attr("data-look",e.look),x=(0,n.ku)(i.flowchart.htmlLabels),$=w.insert("g").attr("class","cluster-label "),k=await (0,r.rw)($,e.label,{style:e.labelStyle,useHtmlLabels:x,isNode:!0}),M=k.getBBox();if((0,n.ku)(i.flowchart.htmlLabels)){let t=k.children[0],e=(0,s.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,C=e.x-S/2,B=e.y-v/2;if(n.cM.trace("Data ",e,JSON.stringify(e)),"handDrawn"===e.look){let t=h.Z.svg(w),l=W(e,{roughness:.7,fill:c,stroke:g,fillWeight:3,seed:d}),r=t.path(b(C,B,S,v,0),l);(a=w.insert(()=>(n.cM.debug("Rough node insert CXC",r),r),":first-child")).select("path:nth-child(2)").attr("style",p.join(";")),a.select("path").attr("style",m.join(";").replace("fill","stroke"))}else(a=w.insert("rect",":first-child")).attr("style",f).attr("rx",e.rx).attr("ry",e.ry).attr("x",C).attr("y",B).attr("width",S).attr("height",v);let{subGraphTitleTopMargin:N}=(0,l.L)(i);if($.attr("transform",`translate(${e.x-M.width/2}, ${e.y-e.height/2+N})`),y){let t=$.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 u(e,t)},{cluster:w,labelBBox:M}},"rect"),C=(0,n.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 u(e,t)},{cluster:a,labelBBox:{width:0,height:0}}},"noteGroup"),B=(0,n.eW)(async(t,e)=>{let a;let l=(0,n.nV)(),{themeVariables:r,handDrawnSeed:i}=l,{altBackground:o,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"),m=y.append("rect"),w=p.node().appendChild(await x(e.label,e.labelStyle,void 0,!0)),$=w.getBBox();if((0,n.ku)(l.flowchart.htmlLabels)){let t=w.children[0],e=(0,s.Ys)(w);$=t.getBoundingClientRect(),e.attr("width",$.width),e.attr("height",$.height)}let k=0*e.padding,M=(e.width<=$.width+e.padding?$.width+e.padding:e.width)+k;e.width<=$.width+e.padding?e.diff=(M-e.width)/2-e.padding:e.diff=-e.padding;let S=e.height+k,D=e.height+k-$.height-6,W=e.x-M/2,v=e.y-S/2;e.width=M;let C=e.y-e.height/2-k/2+$.height+2;if("handDrawn"===e.look){let t=e.cssClasses.includes("statediagram-cluster-alt"),l=h.Z.svg(y),r=e.rx||e.ry?l.path(b(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 n=l.rectangle(W,C,M,D,{fill:t?o:d,fillStyle:t?"hachure":"solid",stroke:g,seed:i});a=y.insert(()=>r,":first-child"),m=y.insert(()=>n)}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),m.attr("class","inner").attr("x",W).attr("y",C).attr("width",M).attr("height",D);p.attr("transform",`translate(${e.x-$.width/2}, ${v+1-((0,n.ku)(l.flowchart.htmlLabels)?0:3)})`);let B=a.node().getBBox();return e.height=B.height,e.offsetX=0,e.offsetY=$.height-e.padding/2,e.labelBBox=$,e.intersect=function(t){return u(e,t)},{cluster:y,labelBBox:$}},"roundedWithTitle"),N=(0,n.eW)(async(t,e)=>{let a;n.cM.info("Creating subgraph rect for ",e.id,e);let i=(0,n.nV)(),{themeVariables:o,handDrawnSeed:d}=i,{clusterBkg:c,clusterBorder:g}=o,{labelStyles:y,nodeStyles:f,borderStyles:p,backgroundStyles:m}=D(e),w=t.insert("g").attr("class","cluster "+e.cssClasses).attr("id",e.id).attr("data-look",e.look),x=(0,n.ku)(i.flowchart.htmlLabels),$=w.insert("g").attr("class","cluster-label "),k=await (0,r.rw)($,e.label,{style:e.labelStyle,useHtmlLabels:x,isNode:!0,width:e.width}),M=k.getBBox();if((0,n.ku)(i.flowchart.htmlLabels)){let t=k.children[0],e=(0,s.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,C=e.x-S/2,B=e.y-v/2;if(n.cM.trace("Data ",e,JSON.stringify(e)),"handDrawn"===e.look){let t=h.Z.svg(w),l=W(e,{roughness:.7,fill:c,stroke:g,fillWeight:4,seed:d}),r=t.path(b(C,B,S,v,e.rx),l);(a=w.insert(()=>(n.cM.debug("Rough node insert CXC",r),r),":first-child")).select("path:nth-child(2)").attr("style",p.join(";")),a.select("path").attr("style",m.join(";").replace("fill","stroke"))}else(a=w.insert("rect",":first-child")).attr("style",f).attr("rx",e.rx).attr("ry",e.ry).attr("x",C).attr("y",B).attr("width",S).attr("height",v);let{subGraphTitleTopMargin:N}=(0,l.L)(i);if($.attr("transform",`translate(${e.x-M.width/2}, ${e.y-e.height/2+N})`),y){let t=$.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 u(e,t)},{cluster:w,labelBBox:M}},"kanbanSection"),A={rect:v,squareRect:v,roundedWithTitle:B,noteGroup:C,divider:(0,n.eW)((t,e)=>{let a;let{themeVariables:l,handDrawnSeed:r}=(0,n.nV)(),{nodeBorder:i}=l,s=t.insert("g").attr("class",e.cssClasses).attr("id",e.id).attr("data-look",e.look),o=s.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=h.Z.svg(s).rectangle(y,f,c,g,{fill:"lightgrey",roughness:.5,strokeLineDash:[5],stroke:i,seed:r});a=s.insert(()=>t,":first-child")}else(a=o.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 u(e,t)},{cluster:s,labelBBox:{}}},"divider"),kanbanSection:N},L=new Map,R=(0,n.eW)(async(t,e)=>{let a=e.shape||"rect",l=await A[a](t,e);return L.set(e.id,l),l},"insertCluster"),P=(0,n.eW)(()=>{L=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,n.eW)(function(t,e){return t.intersect(e)},"intersectNode"),(0,n.eW)(Z,"intersectEllipse"),(0,n.eW)(I,"intersectCircle"),(0,n.eW)(T,"intersectLine"),(0,n.eW)(E,"sameSign"),(0,n.eW)(H,"intersectPolygon");var j={circle:I,polygon:H,rect:u};function V(t,e){let{labelStyles:a}=D(e);e.labelStyle=a;let l=g(e),r=l;l||(r="anchor");let s=t.insert("g").attr("class",r).attr("id",e.domId||e.id),{cssStyles:o}=e,d=h.Z.svg(s),y=W(e,{fill:"black",stroke:"none",fillStyle:"solid"});"handDrawn"!==e.look&&(y.roughness=0);let f=d.circle(0,0,2,y),p=s.insert(()=>f,":first-child");return p.attr("class","anchor").attr("style",(0,i.R7)(o)),c(e,p),e.intersect=function(t){return n.cM.info("Circle intersect",e,1,t),j.circle(e,1,t)},s}function Y(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 q(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a;let{shapeSvg:r,bbox:i}=await o(t,e,g(e)),n=i.width+e.padding+20,s=i.height+e.padding,d=s/2,f=d/(2.5+s/50),{cssStyles:p}=e,u=[{x:n/2,y:-s/2},{x:-n/2,y:-s/2},...Y(-n/2,-s/2,-n/2,s/2,f,d,!1),{x:n/2,y:s/2},...Y(n/2,s/2,n/2,-s/2,f,d,!0)],m=h.Z.svg(r),w=W(e,{});"handDrawn"!==e.look&&(w.roughness=0,w.fillStyle="solid");let x=y(u),b=m.path(x,w),$=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(${f/2}, 0)`),c(e,$),e.intersect=function(t){return j.polygon(e,u,t)},r}function O(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 _(t,e){let a;let{labelStyles:l,nodeStyles:r}=D(e);e.labelStyle=l;let{shapeSvg:i,bbox:n}=await o(t,e,g(e)),s=n.height+e.padding,d=n.width+e.padding+12,f=-s,p=[{x:12,y:f},{x:d,y:f},{x:d,y:0},{x:0,y:0},{x:0,y:f+12},{x:12,y:f}],{cssStyles:u}=e;if("handDrawn"===e.look){let t=h.Z.svg(i),l=W(e,{}),r=y(p),n=t.path(r,l);a=i.insert(()=>n,":first-child").attr("transform",`translate(${-d/2}, ${s/2})`),u&&a.attr("style",u)}else a=O(i,d,s,p);return r&&a.attr("style",r),c(e,a),e.intersect=function(t){return j.polygon(e,p,t)},i}function z(t,e){let{nodeStyles:a}=D(e);e.label="";let l=t.insert("g").attr("class",g(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=h.Z.svg(l),o=W(e,{});"handDrawn"!==e.look&&(o.roughness=0,o.fillStyle="solid");let d=y(n),c=s.path(d,o),f=l.insert(()=>c,":first-child");return r&&"handDrawn"!==e.look&&f.selectAll("path").attr("style",r),a&&"handDrawn"!==e.look&&f.selectAll("path").attr("style",a),e.width=28,e.height=28,e.intersect=function(t){return j.polygon(e,n,t)},l}async function F(t,e){let a;let{labelStyles:l,nodeStyles:r}=D(e);e.labelStyle=l;let{shapeSvg:s,bbox:d,halfPadding:y}=await o(t,e,g(e)),f=d.width/2+y,{cssStyles:p}=e;if("handDrawn"===e.look){let t=h.Z.svg(s),l=W(e,{}),r=t.circle(0,0,2*f,l);(a=s.insert(()=>r,":first-child")).attr("class","basic label-container").attr("style",(0,i.R7)(p))}else a=s.insert("circle",":first-child").attr("class","basic label-container").attr("style",r).attr("r",f).attr("cx",0).attr("cy",0);return c(e,a),e.intersect=function(t){return n.cM.info("Circle intersect",e,f,t),j.circle(e,f,t)},s}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",g(e)).attr("id",e.domId??e.id),i=Math.max(30,e?.width??0),{cssStyles:s}=e,o=h.Z.svg(r),d=W(e,{});"handDrawn"!==e.look&&(d.roughness=0,d.fillStyle="solid");let y=o.circle(0,0,2*i,d),f=X(i),p=o.path(f,d),u=r.insert(()=>y,":first-child");return u.insert(()=>p),s&&"handDrawn"!==e.look&&u.selectAll("path").attr("style",s),l&&"handDrawn"!==e.look&&u.selectAll("path").attr("style",l),c(e,u),e.intersect=function(t){return n.cM.info("crossedCircle intersect",e,{radius:i,point:t}),j.circle(e,i,t)},r}function U(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 G(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a;let{shapeSvg:r,bbox:i,label:n}=await o(t,e,g(e)),s=i.width+(e.padding??0),d=i.height+(e.padding??0),f=Math.max(5,.1*d),{cssStyles:p}=e,u=[...U(s/2,-d/2,f,30,-90,0),{x:-s/2-f,y:f},...U(s/2+2*f,-f,f,20,-180,-270),...U(s/2+2*f,f,f,20,-90,-180),{x:-s/2-f,y:-d/2},...U(s/2,d/2,f,20,0,90)],m=[{x:s/2,y:-d/2-f},{x:-s/2,y:-d/2-f},...U(s/2,-d/2,f,20,-90,0),{x:-s/2-f,y:-f},...U(s/2+.1*s,-f,f,20,-180,-270),...U(s/2+.1*s,f,f,20,-90,-180),{x:-s/2-f,y:d/2},...U(s/2,d/2,f,20,0,90),{x:-s/2,y:d/2+f},{x:s/2,y:d/2+f}],w=h.Z.svg(r),x=W(e,{fill:"none"});"handDrawn"!==e.look&&(x.roughness=0,x.fillStyle="solid");let b=y(u).replace("Z",""),$=w.path(b,x),k=y(m),M=w.path(k,{...x}),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(${f}, 0)`),n.attr("transform",`translate(${-s/2+f-(i.x-(i.left??0))},${-d/2+(e.padding??0)/2-(i.y-(i.top??0))})`),c(e,S),e.intersect=function(t){return j.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 o(t,e,g(e)),s=i.width+(e.padding??0),d=i.height+(e.padding??0),f=Math.max(5,.1*d),{cssStyles:p}=e,u=[...K(s/2,-d/2,f,20,-90,0),{x:s/2+f,y:-f},...K(s/2+2*f,-f,f,20,-180,-270),...K(s/2+2*f,f,f,20,-90,-180),{x:s/2+f,y:d/2},...K(s/2,d/2,f,20,0,90)],m=[{x:-s/2,y:-d/2-f},{x:s/2,y:-d/2-f},...K(s/2,-d/2,f,20,-90,0),{x:s/2+f,y:-f},...K(s/2+2*f,-f,f,20,-180,-270),...K(s/2+2*f,f,f,20,-90,-180),{x:s/2+f,y:d/2},...K(s/2,d/2,f,20,0,90),{x:s/2,y:d/2+f},{x:-s/2,y:d/2+f}],w=h.Z.svg(r),x=W(e,{fill:"none"});"handDrawn"!==e.look&&(x.roughness=0,x.fillStyle="solid");let b=y(u).replace("Z",""),$=w.path(b,x),k=y(m),M=w.path(k,{...x}),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(${-f}, 0)`),n.attr("transform",`translate(${-s/2+(e.padding??0)/2-(i.x-(i.left??0))},${-d/2+(e.padding??0)/2-(i.y-(i.top??0))})`),c(e,S),e.intersect=function(t){return j.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 o(t,e,g(e)),s=i.width+(e.padding??0),d=i.height+(e.padding??0),f=Math.max(5,.1*d),{cssStyles:p}=e,u=[...tt(s/2,-d/2,f,30,-90,0),{x:-s/2-f,y:f},...tt(s/2+2*f,-f,f,20,-180,-270),...tt(s/2+2*f,f,f,20,-90,-180),{x:-s/2-f,y:-d/2},...tt(s/2,d/2,f,20,0,90)],m=[...tt(-s/2+f+f/2,-d/2,f,20,-90,-180),{x:s/2-f/2,y:f},...tt(-s/2-f/2,-f,f,20,0,90),...tt(-s/2-f/2,f,f,20,-90,0),{x:s/2-f/2,y:-f},...tt(-s/2+f+f/2,d/2,f,30,-180,-270)],w=[{x:s/2,y:-d/2-f},{x:-s/2,y:-d/2-f},...tt(s/2,-d/2,f,20,-90,0),{x:-s/2-f,y:-f},...tt(s/2+2*f,-f,f,20,-180,-270),...tt(s/2+2*f,f,f,20,-90,-180),{x:-s/2-f,y:d/2},...tt(s/2,d/2,f,20,0,90),{x:-s/2,y:d/2+f},{x:s/2-f-f/2,y:d/2+f},...tt(-s/2+f+f/2,-d/2,f,20,-90,-180),{x:s/2-f/2,y:f},...tt(-s/2-f/2,-f,f,20,0,90),...tt(-s/2-f/2,f,f,20,-90,0),{x:s/2-f/2,y:-f},...tt(-s/2+f+f/2,d/2,f,30,-180,-270)],x=h.Z.svg(r),b=W(e,{fill:"none"});"handDrawn"!==e.look&&(b.roughness=0,b.fillStyle="solid");let $=y(u).replace("Z",""),k=x.path($,b),M=y(m).replace("Z",""),S=x.path(M,b),v=y(w),C=x.path(v,{...b}),B=r.insert("g",":first-child");return B.insert(()=>C,":first-child").attr("stroke-opacity",0),B.insert(()=>k,":first-child"),B.insert(()=>S,":first-child"),B.attr("class","text"),p&&"handDrawn"!==e.look&&B.selectAll("path").attr("style",p),l&&"handDrawn"!==e.look&&B.selectAll("path").attr("style",l),B.attr("transform",`translate(${f-f/4}, 0)`),n.attr("transform",`translate(${-s/2+(e.padding??0)/2-(i.x-(i.left??0))},${-d/2+(e.padding??0)/2-(i.y-(i.top??0))})`),c(e,B),e.intersect=function(t){return j.polygon(e,w,t)},r}async function ta(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a;let{shapeSvg:r,bbox:i}=await o(t,e,g(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),d=s/2,{cssStyles:f}=e,u=h.Z.svg(r),m=W(e,{});"handDrawn"!==e.look&&(m.roughness=0,m.fillStyle="solid");let w=n-d,x=s/4,b=[{x:w,y:0},{x:x,y:0},{x:0,y:s/2},{x:x,y:s},{x:w,y:s},...p(-w,-s/2,d,50,270,90)],$=y(b),k=u.path($,m),M=r.insert(()=>k,":first-child");return M.attr("class","basic label-container"),f&&"handDrawn"!==e.look&&M.selectChildren("path").attr("style",f),l&&"handDrawn"!==e.look&&M.selectChildren("path").attr("style",l),M.attr("transform",`translate(${-n/2}, ${-s/2})`),c(e,M),e.intersect=function(t){return j.polygon(e,b,t)},r}(0,n.eW)(V,"anchor"),(0,n.eW)(Y,"generateArcPoints"),(0,n.eW)(q,"bowTieRect"),(0,n.eW)(O,"insertPolygonShape"),(0,n.eW)(_,"card"),(0,n.eW)(z,"choice"),(0,n.eW)(F,"circle"),(0,n.eW)(X,"createLine"),(0,n.eW)(J,"crossedCircle"),(0,n.eW)(U,"generateCirclePoints"),(0,n.eW)(G,"curlyBraceLeft"),(0,n.eW)(K,"generateCirclePoints"),(0,n.eW)(Q,"curlyBraceRight"),(0,n.eW)(tt,"generateCirclePoints"),(0,n.eW)(te,"curlyBraces"),(0,n.eW)(ta,"curvedTrapezoid");var tl=(0,n.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,n.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,n.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:n,bbox:s,label:d}=await o(t,e,g(e)),y=Math.max(s.width+e.padding,e.width??0),f=y/2,p=f/(2.5+y/50),u=Math.max(s.height+p+e.padding,e.height??0),{cssStyles:m}=e;if("handDrawn"===e.look){let t=h.Z.svg(n),l=tr(0,0,y,u,f,p),r=ti(0,p,y,u,f,p),i=t.path(l,W(e,{})),s=t.path(r,W(e,{fill:"none"}));a=n.insert(()=>s,":first-child"),(a=n.insert(()=>i,":first-child")).attr("class","basic label-container"),m&&a.attr("style",m)}else{let t=tl(0,0,y,u,f,p);a=n.insert("path",":first-child").attr("d",t).attr("class","basic label-container").attr("style",(0,i.R7)(m)).attr("style",r)}return a.attr("label-offset-y",p),a.attr("transform",`translate(${-y/2}, ${-(u/2+p)})`),c(e,a),d.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=j.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},n}async function ts(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a;let{shapeSvg:r,bbox:i,label:n}=await o(t,e,g(e)),s=i.width+e.padding,d=i.height+e.padding,y=.2*d,f=-s/2,p=-d/2-y/2,{cssStyles:u}=e,m=h.Z.svg(r),w=W(e,{});"handDrawn"!==e.look&&(w.roughness=0,w.fillStyle="solid");let x=m.polygon([{x:f,y:p+y},{x:-f,y:p+y},{x:-f,y:-p},{x:f,y:-p},{x:f,y:p},{x:-f,y:p},{x:-f,y:p+y}].map(t=>[t.x,t.y]),w),b=r.insert(()=>x,":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+y+(e.padding??0)/2-(i.y-(i.top??0))})`),c(e,b),e.intersect=function(t){return j.rect(e,t)},r}async function th(t,e){let a;let{labelStyles:l,nodeStyles:r}=D(e);e.labelStyle=l;let{shapeSvg:s,bbox:d,halfPadding:y}=await o(t,e,g(e)),f=d.width/2+y+5,p=d.width/2+y,{cssStyles:u}=e;if("handDrawn"===e.look){let t=h.Z.svg(s),l=W(e,{roughness:.2,strokeWidth:2.5}),r=W(e,{roughness:.2,strokeWidth:1.5}),n=t.circle(0,0,2*f,l),o=t.circle(0,0,2*p,r);(a=s.insert("g",":first-child")).attr("class",(0,i.R7)(e.cssClasses)).attr("style",(0,i.R7)(u)),a.node()?.appendChild(n),a.node()?.appendChild(o)}else{let t=(a=s.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 c(e,a),e.intersect=function(t){return n.cM.info("DoubleCircle intersect",e,f,t),j.circle(e,f,t)},s}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",g(e)).attr("id",e.domId??e.id),{cssStyles:s}=e,o=h.Z.svg(i),{nodeBorder:d}=a,y=W(e,{fillStyle:"solid"});"handDrawn"!==e.look&&(y.roughness=0);let f=o.circle(0,0,14,y),p=i.insert(()=>f,":first-child");return p.selectAll("path").attr("style",`fill: ${d} !important;`),s&&s.length>0&&"handDrawn"!==e.look&&p.selectAll("path").attr("style",s),r&&"handDrawn"!==e.look&&p.selectAll("path").attr("style",r),c(e,p),e.intersect=function(t){return n.cM.info("filledCircle intersect",e,{radius:7,point:t}),j.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:s}=await o(t,e,g(e)),d=i.width+(e.padding??0),f=d+i.height,p=d+i.height,u=[{x:0,y:-f},{x:p,y:-f},{x:p/2,y:0}],{cssStyles:m}=e,w=h.Z.svg(r),x=W(e,{});"handDrawn"!==e.look&&(x.roughness=0,x.fillStyle="solid");let b=y(u),$=w.path(b,x),k=r.insert(()=>$,":first-child").attr("transform",`translate(${-f/2}, ${f/2})`);return m&&"handDrawn"!==e.look&&k.selectChildren("path").attr("style",m),l&&"handDrawn"!==e.look&&k.selectChildren("path").attr("style",l),e.width=d,e.height=f,c(e,k),s.attr("transform",`translate(${-i.width/2-(i.x-(i.left??0))}, ${-f/2+(e.padding??0)/2+(i.y-(i.top??0))})`),e.intersect=function(t){return n.cM.info("Triangle intersect",e,u,t),j.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",g(e)).attr("id",e.domId??e.id),{cssStyles:s}=e,o=Math.max(70,e?.width??0),d=Math.max(10,e?.height??0);"LR"===a&&(o=Math.max(10,e?.width??0),d=Math.max(70,e?.height??0));let y=-1*o/2,f=-1*d/2,p=h.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(y,f,o,d,u),w=n.insert(()=>m,":first-child");s&&"handDrawn"!==e.look&&w.selectAll("path").attr("style",s),i&&"handDrawn"!==e.look&&w.selectAll("path").attr("style",i),c(e,w);let x=l?.padding??0;return e.width&&e.height&&(e.width+=x/2||0,e.height+=x/2||0),e.intersect=function(t){return j.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 o(t,e,g(e)),s=Math.max(80,i.width+(e.padding??0)*2,e?.width??0),d=Math.max(50,i.height+(e.padding??0)*2,e?.height??0),f=d/2,{cssStyles:u}=e,m=h.Z.svg(r),w=W(e,{});"handDrawn"!==e.look&&(w.roughness=0,w.fillStyle="solid");let x=[{x:-s/2,y:-d/2},{x:s/2-f,y:-d/2},...p(-s/2+f,0,f,50,90,270),{x:s/2-f,y:d/2},{x:-s/2,y:d/2}],b=y(x),$=m.path(b,w),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),c(e,k),e.intersect=function(t){return n.cM.info("Pill intersect",e,{radius:f,point:t}),j.polygon(e,x,t)},r}(0,n.eW)(tn,"cylinder"),(0,n.eW)(ts,"dividedRectangle"),(0,n.eW)(th,"doublecircle"),(0,n.eW)(to,"filledCircle"),(0,n.eW)(td,"flippedTriangle"),(0,n.eW)(tc,"forkJoin"),(0,n.eW)(tg,"halfRoundedRectangle");var ty=(0,n.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 o(t,e,g(e)),s=n.height+e.padding,d=s/4,y=n.width+2*d+e.padding,f=[{x:d,y:0},{x:y-d,y:0},{x:y,y:-s/2},{x:y-d,y:-s},{x:d,y:-s},{x:0,y:-s/2}],{cssStyles:p}=e;if("handDrawn"===e.look){let t=h.Z.svg(i),l=W(e,{}),r=ty(0,0,y,s,d),n=t.path(r,l);a=i.insert(()=>n,":first-child").attr("transform",`translate(${-y/2}, ${s/2})`),p&&a.attr("style",p)}else a=O(i,y,s,f);return r&&a.attr("style",r),e.width=y,e.height=s,c(e,a),e.intersect=function(t){return j.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 o(t,e,g(e)),i=Math.max(30,e?.width??0),s=Math.max(30,e?.height??0),{cssStyles:d}=e,f=h.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:s},{x:i,y:s}],m=y(u),w=f.path(m,p),x=r.insert(()=>w,":first-child");return x.attr("class","basic label-container"),d&&"handDrawn"!==e.look&&x.selectChildren("path").attr("style",d),l&&"handDrawn"!==e.look&&x.selectChildren("path").attr("style",l),x.attr("transform",`translate(${-i/2}, ${-s/2})`),c(e,x),e.intersect=function(t){return n.cM.info("Pill intersect",e,{points:u}),j.polygon(e,u,t)},r}async function tu(t,e,{config:{themeVariables:a,flowchart:l}}){let{labelStyles:i}=D(e);e.labelStyle=i;let s=Math.max(e.assetHeight??48,e.assetWidth??48),d=l?.wrappingWidth;e.width=Math.max(s,d??0);let{shapeSvg:g,bbox:y,label:f}=await o(t,e,"icon-shape default"),p="t"===e.pos,{nodeBorder:u}=a,{stylesMap:m}=k(e),w=-s/2,x=-s/2,b=e.label?8:0,$=h.Z.svg(g),M=W(e,{stroke:"none",fill:"none"});"handDrawn"!==e.look&&(M.roughness=0,M.fillStyle="solid");let S=$.rectangle(w,x,s,s,M),v=Math.max(s,y.width),C=s+y.height+b,B=$.rectangle(-v/2,-C/2,v,C,{...M,fill:"transparent",stroke:"none"}),N=g.insert(()=>S,":first-child"),A=g.insert(()=>B);if(e.icon){let t=g.append("g");t.html(`<g>${await (0,r.s4)(e.icon,{height:s,width:s,fallbackPrefix:""})}</g>`);let a=t.node().getBBox(),l=a.width,i=a.height,n=a.x,h=a.y;t.attr("transform",`translate(${-l/2-n},${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?-C/2:C/2-y.height})`),N.attr("transform",`translate(0,${p?y.height/2+b/2:-y.height/2-b/2})`),c(e,A),e.intersect=function(t){if(n.cM.info("iconSquare intersect",e,t),!e.label)return j.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+s/2,y:l-r/2+y.height+b},{x:a+s/2,y:l+r/2},{x:a-s/2,y:l+r/2},{x:a-s/2,y:l-r/2+y.height+b},{x:a-y.width/2,y:l-r/2+y.height+b}]:[{x:a-s/2,y:l-r/2},{x:a+s/2,y:l-r/2},{x:a+s/2,y:l-r/2+s},{x:a+y.width/2,y:l-r/2+s},{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+s},{x:a-s/2,y:l-r/2+s}],j.polygon(e,i,t)},g}async function tm(t,e,{config:{themeVariables:a,flowchart:l}}){let{labelStyles:i}=D(e);e.labelStyle=i;let s=Math.max(e.assetHeight??48,e.assetWidth??48),d=l?.wrappingWidth;e.width=Math.max(s,d??0);let{shapeSvg:g,bbox:y,label:f}=await o(t,e,"icon-shape default"),p=e.label?8:0,u="t"===e.pos,{nodeBorder:m,mainBkg:w}=a,{stylesMap:x}=k(e),b=h.Z.svg(g),$=W(e,{});"handDrawn"!==e.look&&($.roughness=0,$.fillStyle="solid");let M=x.get("fill");$.stroke=M??w;let S=g.append("g");e.icon&&S.html(`<g>${await (0,r.s4)(e.icon,{height:s,width:s,fallbackPrefix:""})}</g>`);let v=S.node().getBBox(),C=v.width,B=v.height,N=v.x,A=v.y,L=Math.max(C,B)*Math.SQRT2+40,R=b.circle(0,0,L,$),P=Math.max(L,y.width),Z=L+y.height+p,I=b.rectangle(-P/2,-Z/2,P,Z,{...$,fill:"transparent",stroke:"none"}),T=g.insert(()=>R,":first-child"),E=g.insert(()=>I);return S.attr("transform",`translate(${-C/2-N},${u?y.height/2+p/2-B/2-A:-y.height/2-p/2-B/2-A})`),S.attr("style",`color: ${x.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})`),c(e,E),e.intersect=function(t){return n.cM.info("iconSquare intersect",e,t),j.rect(e,t)},g}async function tw(t,e,{config:{themeVariables:a,flowchart:l}}){let{labelStyles:i}=D(e);e.labelStyle=i;let s=Math.max(e.assetHeight??48,e.assetWidth??48),d=l?.wrappingWidth;e.width=Math.max(s,d??0);let{shapeSvg:g,bbox:y,halfPadding:f,label:p}=await o(t,e,"icon-shape default"),u="t"===e.pos,m=s+2*f,w=s+2*f,{nodeBorder:x,mainBkg:$}=a,{stylesMap:M}=k(e),S=e.label?8:0,v=h.Z.svg(g),C=W(e,{});"handDrawn"!==e.look&&(C.roughness=0,C.fillStyle="solid");let B=M.get("fill");C.stroke=B??$;let N=v.path(b(-w/2,-m/2,w,m,5),C),A=Math.max(w,y.width),L=m+y.height+S,R=v.rectangle(-A/2,-L/2,A,L,{...C,fill:"transparent",stroke:"none"}),P=g.insert(()=>N,":first-child").attr("class","icon-shape2"),Z=g.insert(()=>R);if(e.icon){let t=g.append("g");t.html(`<g>${await (0,r.s4)(e.icon,{height:s,width:s,fallbackPrefix:""})}</g>`);let a=t.node().getBBox(),l=a.width,i=a.height,n=a.x,h=a.y;t.attr("transform",`translate(${-l/2-n},${u?y.height/2+S/2-i/2-h:-y.height/2-S/2-i/2-h})`),t.attr("style",`color: ${M.get("stroke")??x};`)}return p.attr("transform",`translate(${-y.width/2-(y.x-(y.left??0))},${u?-L/2:L/2-y.height})`),P.attr("transform",`translate(0,${u?y.height/2+S/2:-y.height/2-S/2})`),c(e,Z),e.intersect=function(t){if(n.cM.info("iconSquare intersect",e,t),!e.label)return j.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+w/2,y:l-r/2+y.height+S},{x:a+w/2,y:l+r/2},{x:a-w/2,y:l+r/2},{x:a-w/2,y:l-r/2+y.height+S},{x:a-y.width/2,y:l-r/2+y.height+S}]:[{x:a-w/2,y:l-r/2},{x:a+w/2,y:l-r/2},{x:a+w/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-w/2,y:l-r/2+m}],j.polygon(e,i,t)},g}async function tx(t,e,{config:{themeVariables:a,flowchart:l}}){let{labelStyles:i}=D(e);e.labelStyle=i;let s=Math.max(e.assetHeight??48,e.assetWidth??48),d=l?.wrappingWidth;e.width=Math.max(s,d??0);let{shapeSvg:g,bbox:y,halfPadding:f,label:p}=await o(t,e,"icon-shape default"),u="t"===e.pos,m=s+2*f,w=s+2*f,{nodeBorder:x,mainBkg:$}=a,{stylesMap:M}=k(e),S=e.label?8:0,v=h.Z.svg(g),C=W(e,{});"handDrawn"!==e.look&&(C.roughness=0,C.fillStyle="solid");let B=M.get("fill");C.stroke=B??$;let N=v.path(b(-w/2,-m/2,w,m,.1),C),A=Math.max(w,y.width),L=m+y.height+S,R=v.rectangle(-A/2,-L/2,A,L,{...C,fill:"transparent",stroke:"none"}),P=g.insert(()=>N,":first-child"),Z=g.insert(()=>R);if(e.icon){let t=g.append("g");t.html(`<g>${await (0,r.s4)(e.icon,{height:s,width:s,fallbackPrefix:""})}</g>`);let a=t.node().getBBox(),l=a.width,i=a.height,n=a.x,h=a.y;t.attr("transform",`translate(${-l/2-n},${u?y.height/2+S/2-i/2-h:-y.height/2-S/2-i/2-h})`),t.attr("style",`color: ${M.get("stroke")??x};`)}return p.attr("transform",`translate(${-y.width/2-(y.x-(y.left??0))},${u?-L/2:L/2-y.height})`),P.attr("transform",`translate(0,${u?y.height/2+S/2:-y.height/2-S/2})`),c(e,Z),e.intersect=function(t){if(n.cM.info("iconSquare intersect",e,t),!e.label)return j.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+w/2,y:l-r/2+y.height+S},{x:a+w/2,y:l+r/2},{x:a-w/2,y:l+r/2},{x:a-w/2,y:l-r/2+y.height+S},{x:a-y.width/2,y:l-r/2+y.height+S}]:[{x:a-w/2,y:l-r/2},{x:a+w/2,y:l-r/2},{x:a+w/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-w/2,y:l-r/2+m}],j.polygon(e,i,t)},g}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:s}=D(e);e.labelStyle=s;let d=a?.wrappingWidth;e.defaultWidth=a?.wrappingWidth;let g=Math.max(e.label?d??0:0,e?.assetWidth??r),y="on"===e.constraint&&e?.assetHeight?e.assetHeight*e.imageAspectRatio:g,f="on"===e.constraint?y/e.imageAspectRatio:e?.assetHeight??i;e.width=Math.max(y,d??0);let{shapeSvg:p,bbox:u,label:m}=await o(t,e,"image-shape default"),w="t"===e.pos,x=-y/2,b=e.label?8:0,$=h.Z.svg(p),k=W(e,{});"handDrawn"!==e.look&&(k.roughness=0,k.fillStyle="solid");let M=$.rectangle(x,-f/2,y,f,k),S=Math.max(y,u.width),v=f+u.height+b,C=$.rectangle(-S/2,-v/2,S,v,{...k,fill:"none",stroke:"none"}),B=p.insert(()=>M,":first-child"),N=p.insert(()=>C);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},${w?v/2-f:-v/2})`)}return m.attr("transform",`translate(${-u.width/2-(u.x-(u.left??0))},${w?-f/2-u.height/2-b/2:f/2-u.height/2+b/2})`),B.attr("transform",`translate(0,${w?u.height/2+b/2:-u.height/2-b/2})`),c(e,N),e.intersect=function(t){if(n.cM.info("iconSquare intersect",e,t),!e.label)return j.rect(e,t);let a=e.x??0,l=e.y??0,r=e.height??0,i=[];return i=w?[{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}],j.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 o(t,e,g(e)),s=Math.max(n.width+(e.padding??0)*2,e?.width??0),d=Math.max(n.height+(e.padding??0)*2,e?.height??0),f=[{x:0,y:0},{x:s,y:0},{x:s+3*d/6,y:-d},{x:-3*d/6,y:-d}],{cssStyles:p}=e;if("handDrawn"===e.look){let t=h.Z.svg(i),l=W(e,{}),r=y(f),n=t.path(r,l);a=i.insert(()=>n,":first-child").attr("transform",`translate(${-s/2}, ${d/2})`),p&&a.attr("style",p)}else a=O(i,s,d,f);return r&&a.attr("style",r),e.width=s,e.height=d,c(e,a),e.intersect=function(t){return j.polygon(e,f,t)},i}async function tk(t,e,a){let l;let{labelStyles:r,nodeStyles:n}=D(e);e.labelStyle=r;let{shapeSvg:s,bbox:d}=await o(t,e,g(e)),y=Math.max(d.width+2*a.labelPaddingX,e?.width||0),f=Math.max(d.height+2*a.labelPaddingY,e?.height||0),p=-y/2,u=-f/2,{rx:m,ry:w}=e,{cssStyles:x}=e;if(a?.rx&&a.ry&&(m=a.rx,w=a.ry),"handDrawn"===e.look){let t=h.Z.svg(s),a=W(e,{}),r=m||w?t.path(b(p,u,y,f,m||0),a):t.rectangle(p,u,y,f,a);(l=s.insert(()=>r,":first-child")).attr("class","basic label-container").attr("style",(0,i.R7)(x))}else(l=s.insert("rect",":first-child")).attr("class","basic label-container").attr("style",n).attr("rx",(0,i.R7)(m)).attr("ry",(0,i.R7)(w)).attr("x",p).attr("y",u).attr("width",y).attr("height",f);return c(e,l),e.intersect=function(t){return j.rect(e,t)},s}async function tM(t,e){let{shapeSvg:a,bbox:l,label:r}=await o(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))})`),c(e,i),e.intersect=function(t){return j.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 o(t,e,g(e)),s=Math.max(n.width+(e.padding??0),e?.width??0),d=Math.max(n.height+(e.padding??0),e?.height??0),f=[{x:0,y:0},{x:s+3*d/6,y:0},{x:s,y:-d},{x:-(3*d)/6,y:-d}],{cssStyles:p}=e;if("handDrawn"===e.look){let t=h.Z.svg(i),l=W(e,{}),r=y(f),n=t.path(r,l);a=i.insert(()=>n,":first-child").attr("transform",`translate(${-s/2}, ${d/2})`),p&&a.attr("style",p)}else a=O(i,s,d,f);return r&&a.attr("style",r),e.width=s,e.height=d,c(e,a),e.intersect=function(t){return j.polygon(e,f,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 o(t,e,g(e)),s=Math.max(n.width+(e.padding??0),e?.width??0),d=Math.max(n.height+(e.padding??0),e?.height??0),f=[{x:-3*d/6,y:0},{x:s,y:0},{x:s+3*d/6,y:-d},{x:0,y:-d}],{cssStyles:p}=e;if("handDrawn"===e.look){let t=h.Z.svg(i),l=W(e,{}),r=y(f),n=t.path(r,l);a=i.insert(()=>n,":first-child").attr("transform",`translate(${-s/2}, ${d/2})`),p&&a.attr("style",p)}else a=O(i,s,d,f);return r&&a.attr("style",r),e.width=s,e.height=d,c(e,a),e.intersect=function(t){return j.polygon(e,f,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",g(e)).attr("id",e.domId??e.id),{cssStyles:i}=e,s=Math.max(35,e?.width??0),o=Math.max(35,e?.height??0),d=[{x:s,y:0},{x:0,y:o+3.5},{x:s-14,y:o+3.5},{x:0,y:2*o},{x:s,y:o-3.5},{x:14,y:o-3.5}],f=h.Z.svg(r),p=W(e,{});"handDrawn"!==e.look&&(p.roughness=0,p.fillStyle="solid");let u=y(d),m=f.path(u,p),w=r.insert(()=>m,":first-child");return i&&"handDrawn"!==e.look&&w.selectAll("path").attr("style",i),l&&"handDrawn"!==e.look&&w.selectAll("path").attr("style",l),w.attr("transform",`translate(-${s/2},${-o})`),c(e,w),e.intersect=function(t){return n.cM.info("lightningBolt intersect",e,t),j.polygon(e,d,t)},r}(0,n.eW)(tf,"hexagon"),(0,n.eW)(tp,"hourglass"),(0,n.eW)(tu,"icon"),(0,n.eW)(tm,"iconCircle"),(0,n.eW)(tw,"iconRounded"),(0,n.eW)(tx,"iconSquare"),(0,n.eW)(tb,"imageSquare"),(0,n.eW)(t$,"inv_trapezoid"),(0,n.eW)(tk,"drawRect"),(0,n.eW)(tM,"labelRect"),(0,n.eW)(tS,"lean_left"),(0,n.eW)(tD,"lean_right"),(0,n.eW)(tW,"lightningBolt");var tv=(0,n.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"),tC=(0,n.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"),tB=(0,n.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:n,bbox:s,label:d}=await o(t,e,g(e)),y=Math.max(s.width+(e.padding??0),e.width??0),f=y/2,p=f/(2.5+y/50),u=Math.max(s.height+p+(e.padding??0),e.height??0),m=.1*u,{cssStyles:w}=e;if("handDrawn"===e.look){let t=h.Z.svg(n),l=tC(0,0,y,u,f,p,m),r=tB(0,p,y,u,f,p),i=W(e,{}),s=t.path(l,i),o=t.path(r,i);n.insert(()=>o,":first-child").attr("class","line"),(a=n.insert(()=>s,":first-child")).attr("class","basic label-container"),w&&a.attr("style",w)}else{let t=tv(0,0,y,u,f,p,m);a=n.insert("path",":first-child").attr("d",t).attr("class","basic label-container").attr("style",(0,i.R7)(w)).attr("style",r)}return a.attr("label-offset-y",p),a.attr("transform",`translate(${-y/2}, ${-(u/2+p)})`),c(e,a),d.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=j.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},n}async function tA(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a;let{shapeSvg:r,bbox:i,label:n}=await o(t,e,g(e)),s=Math.max(i.width+(e.padding??0)*2,e?.width??0),d=Math.max(i.height+(e.padding??0)*2,e?.height??0),y=d/4,p=d+y,{cssStyles:u}=e,m=h.Z.svg(r),w=W(e,{});"handDrawn"!==e.look&&(w.roughness=0,w.fillStyle="solid");let x=[{x:-s/2-s/2*.1,y:-p/2},{x:-s/2-s/2*.1,y:p/2},...f(-s/2-s/2*.1,p/2,s/2+s/2*.1,p/2,y,.8),{x:s/2+s/2*.1,y:-p/2},{x:-s/2-s/2*.1,y:-p/2},{x:-s/2,y:-p/2},{x:-s/2,y:p/2*1.1},{x:-s/2,y:-p/2}],b=m.polygon(x.map(t=>[t.x,t.y]),w),$=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,${-y/2})`),n.attr("transform",`translate(${-s/2+(e.padding??0)+s/2*.1/2-(i.x-(i.left??0))},${-d/2+(e.padding??0)-y/2-(i.y-(i.top??0))})`),c(e,$),e.intersect=function(t){return j.polygon(e,x,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 o(t,e,g(e)),s=Math.max(i.width+(e.padding??0)*2,e?.width??0),d=Math.max(i.height+(e.padding??0)*2,e?.height??0),f=-s/2,p=-d/2,{cssStyles:u}=e,m=h.Z.svg(r),w=W(e,{}),x=[{x:f-5,y:p+5},{x:f-5,y:p+d+5},{x:f+s-5,y:p+d+5},{x:f+s-5,y:p+d},{x:f+s,y:p+d},{x:f+s,y:p+d-5},{x:f+s+5,y:p+d-5},{x:f+s+5,y:p-5},{x:f+5,y:p-5},{x:f+5,y:p},{x:f,y:p},{x:f,y:p+5}];"handDrawn"!==e.look&&(w.roughness=0,w.fillStyle="solid");let b=y(x),$=m.path(b,w),k=y([{x:f,y:p+5},{x:f+s-5,y:p+5},{x:f+s-5,y:p+d},{x:f+s,y:p+d},{x:f+s,y:p},{x:f,y:p}]),M=m.path(k,{...w,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))})`),c(e,S),e.intersect=function(t){return j.polygon(e,x,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 o(t,e,g(e)),s=Math.max(i.width+(e.padding??0)*2,e?.width??0),d=Math.max(i.height+(e.padding??0)*2,e?.height??0),p=d/4,u=d+p,m=-s/2,w=-u/2,{cssStyles:x}=e,b=f(m-5,w+u+5,m+s-5,w+u+5,p,.8),$=b?.[b.length-1],k=[{x:m-5,y:w+5},{x:m-5,y:w+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:w-5},{x:m+5,y:w-5},{x:m+5,y:w},{x:m,y:w},{x:m,y:w+5}],M=[{x:m,y:w+5},{x:m+s-5,y:w+5},{x:m+s-5,y:$.y-5},{x:m+s,y:$.y-5},{x:m+s,y:w},{x:m,y:w}],S=h.Z.svg(r),v=W(e,{});"handDrawn"!==e.look&&(v.roughness=0,v.fillStyle="solid");let C=y(k),B=S.path(C,v),N=y(M),A=S.path(N,v),L=r.insert(()=>B,":first-child");return L.insert(()=>A),L.attr("class","basic label-container"),x&&"handDrawn"!==e.look&&L.selectAll("path").attr("style",x),l&&"handDrawn"!==e.look&&L.selectAll("path").attr("style",l),L.attr("transform",`translate(0,${-p/2})`),n.attr("transform",`translate(${-(i.width/2)-5-(i.x-(i.left??0))}, ${-(i.height/2)+5-p/2-(i.y-(i.top??0))})`),c(e,L),e.intersect=function(t){return j.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||n.iE().flowchart?.htmlLabels!==!1||(e.centerLabel=!0);let{shapeSvg:i,bbox:s}=await o(t,e,g(e)),d=Math.max(s.width+(e.padding??0)*2,e?.width??0),y=Math.max(s.height+(e.padding??0)*2,e?.height??0),{cssStyles:f}=e,p=h.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(-d/2,-y/2,d,y,u),w=i.insert(()=>m,":first-child");return w.attr("class","basic label-container"),f&&"handDrawn"!==e.look&&w.selectAll("path").attr("style",f),r&&"handDrawn"!==e.look&&w.selectAll("path").attr("style",r),c(e,w),e.intersect=function(t){return j.rect(e,t)},i}(0,n.eW)(tN,"linedCylinder"),(0,n.eW)(tA,"linedWaveEdgedRect"),(0,n.eW)(tL,"multiRect"),(0,n.eW)(tR,"multiWaveEdgedRectangle"),(0,n.eW)(tP,"note");var tZ=(0,n.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:s}=await o(t,e,g(e)),d=s.width+e.padding+(s.height+e.padding),y=[{x:d/2,y:0},{x:d,y:-d/2},{x:d/2,y:-d},{x:0,y:-d/2}],{cssStyles:f}=e;if("handDrawn"===e.look){let t=h.Z.svg(i),l=W(e,{}),r=tZ(0,0,d),n=t.path(r,l);a=i.insert(()=>n,":first-child").attr("transform",`translate(${-d/2}, ${d/2})`),f&&a.attr("style",f)}else a=O(i,d,d,y);return r&&a.attr("style",r),c(e,a),e.intersect=function(t){return n.cM.debug("APA12 Intersect called SPLIT\npoint:",t,"\nnode:\n",e,"\nres:",j.polygon(e,y,t)),j.polygon(e,y,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 o(t,e,g(e)),s=Math.max(i.width+(e.padding??0),e?.width??0),d=Math.max(i.height+(e.padding??0),e?.height??0),f=-s/2,p=-d/2,u=p/2,m=[{x:f+u,y:p},{x:f,y:0},{x:f+u,y:-p},{x:-f,y:-p},{x:-f,y:p}],{cssStyles:w}=e,x=h.Z.svg(r),b=W(e,{});"handDrawn"!==e.look&&(b.roughness=0,b.fillStyle="solid");let $=y(m),k=x.path($,b),M=r.insert(()=>k,":first-child");return M.attr("class","basic label-container"),w&&"handDrawn"!==e.look&&M.selectAll("path").attr("style",w),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))})`),c(e,M),e.intersect=function(t){return j.polygon(e,m,t)},r}async function tE(t,e){let a,l,r;let{labelStyles:i,nodeStyles:o}=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),g=d.insert("g"),y=d.insert("g").attr("class","label").attr("style",o),f=e.description,p=e.label,u=y.node().appendChild(await x(p,e.labelStyle,!0,!0)),m={width:0,height:0};if((0,n.ku)(n.nV()?.flowchart?.htmlLabels)){let t=u.children[0],e=(0,s.Ys)(u);m=t.getBoundingClientRect(),e.attr("width",m.width),e.attr("height",m.height)}n.cM.info("Text 2",f);let w=f||[],$=u.getBBox(),k=y.node().appendChild(await x(w.join?w.join("<br/>"):w,e.labelStyle,!0,!0)),M=k.children[0],S=(0,s.Ys)(k);m=M.getBoundingClientRect(),S.attr("width",m.width),S.attr("height",m.height);let v=(e.padding||0)/2;(0,s.Ys)(k).attr("transform","translate( "+(m.width>$.width?0:($.width-m.width)/2)+", "+($.height+v+5)+")"),(0,s.Ys)(u).attr("transform","translate( "+(m.width<$.width?0:-($.width-m.width)/2)+", 0)"),m=y.node().getBBox(),y.attr("transform","translate("+-m.width/2+", "+(-m.height/2-v+3)+")");let C=m.width+(e.padding||0),B=m.height+(e.padding||0),N=-m.width/2-v,A=-m.height/2-v;if("handDrawn"===e.look){let t=h.Z.svg(d),a=W(e,{}),i=t.path(b(N,A,C,B,e.rx||0),a),s=t.line(-m.width/2-v,-m.height/2-v+$.height+v,m.width/2+v,-m.height/2-v+$.height+v,a);r=d.insert(()=>(n.cM.debug("Rough node insert CXC",i),s),":first-child"),l=d.insert(()=>(n.cM.debug("Rough node insert CXC",i),i),":first-child")}else l=g.insert("rect",":first-child"),r=g.insert("line"),l.attr("class","outer title-state").attr("style",o).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+$.height+v).attr("y2",-m.height/2-v+$.height+v);return c(e,l),e.intersect=function(t){return j.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 tj(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a;let{shapeSvg:r,bbox:n,label:s}=await o(t,e,g(e)),d=e?.padding??0,y=Math.max(n.width+(e.padding??0)*2,e?.width??0),f=Math.max(n.height+(e.padding??0)*2,e?.height??0),p=-n.width/2-d,u=-n.height/2-d,{cssStyles:m}=e,w=h.Z.svg(r),x=W(e,{});"handDrawn"!==e.look&&(x.roughness=0,x.fillStyle="solid");let b=w.polygon([{x:p,y:u},{x:p+y+8,y:u},{x:p+y+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]),x),$=r.insert(()=>b,":first-child");return $.attr("class","basic label-container").attr("style",(0,i.R7)(m)),l&&"handDrawn"!==e.look&&$.selectAll("path").attr("style",l),m&&"handDrawn"!==e.look&&$.selectAll("path").attr("style",l),s.attr("transform",`translate(${-y/2+4+(e.padding??0)-(n.x-(n.left??0))},${-f/2+(e.padding??0)-(n.y-(n.top??0))})`),c(e,$),e.intersect=function(t){return j.rect(e,t)},r}async function tV(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a;let{shapeSvg:r,bbox:i,label:n}=await o(t,e,g(e)),s=Math.max(i.width+(e.padding??0)*2,e?.width??0),d=Math.max(i.height+(e.padding??0)*2,e?.height??0),f=-s/2,p=-d/2,{cssStyles:u}=e,m=h.Z.svg(r),w=W(e,{});"handDrawn"!==e.look&&(w.roughness=0,w.fillStyle="solid");let x=[{x:f,y:p},{x:f,y:p+d},{x:f+s,y:p+d},{x:f+s,y:p-d/2}],b=y(x),$=m.path(b,w),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, ${d/4})`),n.attr("transform",`translate(${-s/2+(e.padding??0)-(i.x-(i.left??0))}, ${-d/4+(e.padding??0)-(i.y-(i.top??0))})`),c(e,k),e.intersect=function(t){return j.polygon(e,x,t)},r}async function tY(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 tq(t,e){let a;let{labelStyles:l,nodeStyles:r}=D(e);e.labelStyle=l;let{shapeSvg:n,bbox:s}=await o(t,e,g(e)),d=s.height+e.padding,y=s.width+d/4+e.padding,{cssStyles:f}=e;if("handDrawn"===e.look){let t=h.Z.svg(n),l=W(e,{}),r=b(-y/2,-d/2,y,d,d/2),s=t.path(r,l);(a=n.insert(()=>s,":first-child")).attr("class","basic label-container").attr("style",(0,i.R7)(f))}else(a=n.insert("rect",":first-child")).attr("class","basic label-container").attr("style",r).attr("rx",d/2).attr("ry",d/2).attr("x",-y/2).attr("y",-d/2).attr("width",y).attr("height",d);return c(e,a),e.intersect=function(t){return j.rect(e,t)},n}async function tO(t,e){return tk(t,e,{rx:5,ry:5,classes:"flowchart-node"})}function t_(t,e,{config:{themeVariables:a}}){let{labelStyles:l,nodeStyles:r}=D(e);e.labelStyle=l;let{cssStyles:i}=e,{lineColor:n,stateBorder:s,nodeBorder:o}=a,d=t.insert("g").attr("class","node default").attr("id",e.domId||e.id),g=h.Z.svg(d),y=W(e,{});"handDrawn"!==e.look&&(y.roughness=0,y.fillStyle="solid");let f=g.circle(0,0,14,{...y,stroke:n,strokeWidth:2}),p=s??o,u=g.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),c(e,m),e.intersect=function(t){return j.circle(e,7,t)},d}function tz(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=h.Z.svg(i).circle(0,0,14,$(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 c(e,l),e.intersect=function(t){return j.circle(e,7,t)},i}async function tF(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a;let{shapeSvg:r,bbox:n}=await o(t,e,g(e)),s=(e?.padding||0)/2,d=n.width+e.padding,y=n.height+e.padding,f=-n.width/2-s,p=-n.height/2-s,u=[{x:0,y:0},{x:d,y:0},{x:d,y:-y},{x:0,y:-y},{x:0,y:0},{x:-8,y:0},{x:d+8,y:0},{x:d+8,y:-y},{x:-8,y:-y},{x:-8,y:0}];if("handDrawn"===e.look){let t=h.Z.svg(r),a=W(e,{}),l=t.rectangle(f-8,p,d+16,y,a),n=t.line(f,p,f,p+y,a),s=t.line(f+d,p,f+d,p+y,a);r.insert(()=>n,":first-child"),r.insert(()=>s,":first-child");let o=r.insert(()=>l,":first-child"),{cssStyles:g}=e;o.attr("class","basic label-container").attr("style",(0,i.R7)(g)),c(e,o)}else{let t=O(r,d,y,u);l&&t.attr("style",l),c(e,t)}return e.intersect=function(t){return j.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 o(t,e,g(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),d=-n/2,f=-s/2,p=.2*s,{cssStyles:u}=e,m=h.Z.svg(r),w=W(e,{}),x=[{x:d-p/2,y:f},{x:d+n+p/2,y:f},{x:d+n+p/2,y:f+s},{x:d-p/2,y:f+s}];"handDrawn"!==e.look&&(w.roughness=0,w.fillStyle="solid");let b=y(x),$=m.path(b,w),k=y([{x:d+n-p/2,y:f+s},{x:d+n+p/2,y:f+s},{x:d+n+p/2,y:f+s-.2*s}]),M=m.path(k,{...w,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),c(e,S),e.intersect=function(t){return j.polygon(e,x,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 o(t,e,g(e)),s=Math.max(i.width+(e.padding??0)*2,e?.width??0),d=Math.max(i.height+(e.padding??0)*2,e?.height??0),p=d/4,u=.2*s,m=.2*d,w=d+p,{cssStyles:x}=e,b=h.Z.svg(r),$=W(e,{});"handDrawn"!==e.look&&($.roughness=0,$.fillStyle="solid");let k=[{x:-s/2-s/2*.1,y:w/2},...f(-s/2-s/2*.1,w/2,s/2+s/2*.1,w/2,p,.8),{x:s/2+s/2*.1,y:-w/2},{x:-s/2-s/2*.1,y:-w/2}],M=-s/2+s/2*.1,S=-w/2-.4*m,v=[{x:M+s-u,y:(S+d)*1.4},{x:M+s,y:S+d-m},{x:M+s,y:(S+d)*.9},...f(M+s,(S+d)*1.3,M+s-u,(S+d)*1.5,-(.03*d),.5)],C=y(k),B=b.path(C,$),N=y(v),A=b.path(N,{...$,fillStyle:"solid"}),L=r.insert(()=>A,":first-child");return L.insert(()=>B,":first-child"),L.attr("class","basic label-container"),x&&"handDrawn"!==e.look&&L.selectAll("path").attr("style",x),l&&"handDrawn"!==e.look&&L.selectAll("path").attr("style",l),L.attr("transform",`translate(0,${-p/2})`),n.attr("transform",`translate(${-s/2+(e.padding??0)-(i.x-(i.left??0))},${-d/2+(e.padding??0)-p/2-(i.y-(i.top??0))})`),c(e,L),e.intersect=function(t){return j.polygon(e,k,t)},r}async function tU(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a;let{shapeSvg:r,bbox:i}=await o(t,e,g(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),c(e,h),e.intersect=function(t){return j.rect(e,t)},r}(0,n.eW)(tI,"question"),(0,n.eW)(tT,"rect_left_inv_arrow"),(0,n.eW)(tE,"rectWithTitle"),(0,n.eW)(tH,"roundedRect"),(0,n.eW)(tj,"shadedProcess"),(0,n.eW)(tV,"slopedRect"),(0,n.eW)(tY,"squareRect"),(0,n.eW)(tq,"stadium"),(0,n.eW)(tO,"state"),(0,n.eW)(t_,"stateEnd"),(0,n.eW)(tz,"stateStart"),(0,n.eW)(tF,"subroutine"),(0,n.eW)(tX,"taggedRect"),(0,n.eW)(tJ,"taggedWaveEdgedRectangle"),(0,n.eW)(tU,"text");var tG=(0,n.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,n.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,n.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:n,bbox:s,label:d,halfPadding:y}=await o(t,e,g(e)),f="neo"===e.look?2*y:y,p=s.height+f,u=p/2,m=u/(2.5+p/50),w=s.width+m+f,{cssStyles:x}=e;if("handDrawn"===e.look){let t=h.Z.svg(n),l=tK(0,0,w,p,m,u),r=tQ(0,0,w,p,m,u),i=t.path(l,W(e,{})),s=t.path(r,W(e,{fill:"none"}));a=n.insert(()=>s,":first-child"),(a=n.insert(()=>i,":first-child")).attr("class","basic label-container"),x&&a.attr("style",x)}else{let t=tG(0,0,w,p,m,u);(a=n.insert("path",":first-child").attr("d",t).attr("class","basic label-container").attr("style",(0,i.R7)(x)).attr("style",r)).attr("class","basic label-container"),x&&a.selectAll("path").attr("style",x),r&&a.selectAll("path").attr("style",r)}return a.attr("label-offset-x",m),a.attr("transform",`translate(${-w/2}, ${p/2} )`),d.attr("transform",`translate(${-(s.width/2)-m-(s.x-(s.left??0))}, ${-(s.height/2)-(s.y-(s.top??0))})`),c(e,a),e.intersect=function(t){let a=j.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},n}async function t2(t,e){let a;let{labelStyles:l,nodeStyles:r}=D(e);e.labelStyle=l;let{shapeSvg:i,bbox:n}=await o(t,e,g(e)),s=n.width+e.padding,d=n.height+e.padding,f=[{x:-3*d/6,y:0},{x:s+3*d/6,y:0},{x:s,y:-d},{x:0,y:-d}],{cssStyles:p}=e;if("handDrawn"===e.look){let t=h.Z.svg(i),l=W(e,{}),r=y(f),n=t.path(r,l);a=i.insert(()=>n,":first-child").attr("transform",`translate(${-s/2}, ${d/2})`),p&&a.attr("style",p)}else a=O(i,s,d,f);return r&&a.attr("style",r),e.width=s,e.height=d,c(e,a),e.intersect=function(t){return j.polygon(e,f,t)},i}async function t1(t,e){let{labelStyles:a,nodeStyles:l}=D(e);e.labelStyle=a;let{shapeSvg:r,bbox:i}=await o(t,e,g(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:d}=e,f=h.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=y(u),w=f.path(m,p),x=r.insert(()=>w,":first-child");return x.attr("class","basic label-container"),d&&"handDrawn"!==e.look&&x.selectChildren("path").attr("style",d),l&&"handDrawn"!==e.look&&x.selectChildren("path").attr("style",l),c(e,x),e.intersect=function(t){return j.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:s}=await o(t,e,g(e)),d=(0,n.ku)(n.nV().flowchart?.htmlLabels),f=i.width+(e.padding??0),p=f+i.height,u=f+i.height,m=[{x:0,y:0},{x:u,y:0},{x:u/2,y:-p}],{cssStyles:w}=e,x=h.Z.svg(r),b=W(e,{});"handDrawn"!==e.look&&(b.roughness=0,b.fillStyle="solid");let $=y(m),k=x.path($,b),M=r.insert(()=>k,":first-child").attr("transform",`translate(${-p/2}, ${p/2})`);return w&&"handDrawn"!==e.look&&M.selectChildren("path").attr("style",w),l&&"handDrawn"!==e.look&&M.selectChildren("path").attr("style",l),e.width=f,e.height=p,c(e,M),s.attr("transform",`translate(${-i.width/2-(i.x-(i.left??0))}, ${p/2-(i.height+(e.padding??0)/(d?2:1)-(i.y-(i.top??0)))})`),e.intersect=function(t){return n.cM.info("Triangle intersect",e,m,t),j.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 o(t,e,g(e)),s=Math.max(i.width+(e.padding??0)*2,e?.width??0),d=Math.max(i.height+(e.padding??0)*2,e?.height??0),p=d/8,u=d+p,{cssStyles:m}=e,w=70-s,x=w>0?w/2:0,b=h.Z.svg(r),$=W(e,{});"handDrawn"!==e.look&&($.roughness=0,$.fillStyle="solid");let k=[{x:-s/2-x,y:u/2},...f(-s/2-x,u/2,s/2+x,u/2,p,.8),{x:s/2+x,y:-u/2},{x:-s/2-x,y:-u/2}],M=y(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,${-p/2})`),n.attr("transform",`translate(${-s/2+(e.padding??0)-(i.x-(i.left??0))},${-d/2+(e.padding??0)-p-(i.y-(i.top??0))})`),c(e,v),e.intersect=function(t){return j.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 o(t,e,g(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),d=n/s,p=n,u=s;p>u*d?u=p/d:p=u*d,p=Math.max(p,100);let m=Math.min(.2*(u=Math.max(u,50)),u/4),w=u+2*m,{cssStyles:x}=e,b=h.Z.svg(r),$=W(e,{});"handDrawn"!==e.look&&($.roughness=0,$.fillStyle="solid");let k=[{x:-p/2,y:w/2},...f(-p/2,w/2,p/2,w/2,m,1),{x:p/2,y:-w/2},...f(p/2,-w/2,-p/2,-w/2,m,-1)],M=y(k),S=b.path(M,$),v=r.insert(()=>S,":first-child");return v.attr("class","basic label-container"),x&&"handDrawn"!==e.look&&v.selectAll("path").attr("style",x),l&&"handDrawn"!==e.look&&v.selectAll("path").attr("style",l),c(e,v),e.intersect=function(t){return j.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 o(t,e,g(e)),s=Math.max(i.width+(e.padding??0)*2,e?.width??0),d=Math.max(i.height+(e.padding??0)*2,e?.height??0),y=-s/2,f=-d/2,{cssStyles:p}=e,u=h.Z.svg(r),m=W(e,{}),w=[{x:y-5,y:f-5},{x:y-5,y:f+d},{x:y+s,y:f+d},{x:y+s,y:f-5}],x=`M${y-5},${f-5} L${y+s},${f-5} L${y+s},${f+d} L${y-5},${f+d} L${y-5},${f-5}
|
9
|
-
M${y-5},${f} L${y+s},${f}
|
10
|
-
M${y},${f-5} L${y},${f+d}`;"handDrawn"!==e.look&&(m.roughness=0,m.fillStyle="solid");let b=u.path(x,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))})`),c(e,$),e.intersect=function(t){return j.polygon(e,w,t)},r}async function t3(t,e){if(e.alias&&(e.label=e.alias),"handDrawn"===e.look){let{themeVariables:a}=(0,n.iE)(),{background:l}=a,r={...e,id:e.id+"-background",look:"default",cssStyles:["stroke: none",`fill: ${l}`]};await t3(t,r)}let a=(0,n.iE)();e.useHtmlLabels=a.htmlLabels;let l=a.er?.diagramPadding??10,r=a.er?.entityPadding??6,{cssStyles:o}=e,{labelStyles:d,nodeStyles:y}=D(e);if(0===e.attributes.length&&e.label){let r={rx:0,ry:0,labelPaddingX:l,labelPaddingY:1.5*l,classes:""};(0,i.Cq)(e.label,a)+2*r.labelPaddingX<a.er.minEntityWidth&&(e.width=a.er.minEntityWidth);let s=await tk(t,e,r);if(!(0,n.ku)(a.htmlLabels)){let t=s.select("text"),e=t.node()?.getBBox();t.attr("transform",`translate(${-e.width/2}, 0)`)}return s}a.htmlLabels||(l*=1.25,r*=1.25);let f=g(e);f||(f="node default");let p=t.insert("g").attr("class",f).attr("id",e.domId||e.id),u=await t9(p,e.label??"",a,0,0,["name"],d);u.height+=r;let m=0,w=[],x=[],b=0,$=0,k=0,M=0,S=!0,v=!0;for(let t of e.attributes){let e=await t9(p,t.type,a,0,m,["attribute-type"],d);b=Math.max(b,e.width+l);let i=await t9(p,t.name,a,0,m,["attribute-name"],d);$=Math.max($,i.width+l);let n=await t9(p,t.keys.join(),a,0,m,["attribute-keys"],d);k=Math.max(k,n.width+l);let s=await t9(p,t.comment,a,0,m,["attribute-comment"],d);M=Math.max(M,s.width+l);let h=Math.max(e.height,i.height,n.height,s.height)+r;x.push({yOffset:m,rowHeight:h}),m+=h}let C=4;k<=l&&(S=!1,k=0,C--),M<=l&&(v=!1,M=0,C--);let B=p.node().getBBox();if(u.width+2*l-(b+$+k+M)>0){let t=u.width+2*l-(b+$+k+M);b+=t/C,$+=t/C,k>0&&(k+=t/C),M>0&&(M+=t/C)}let N=b+$+k+M,A=h.Z.svg(p),L=W(e,{});"handDrawn"!==e.look&&(L.roughness=0,L.fillStyle="solid");let R=0;x.length>0&&(R=x.reduce((t,e)=>t+(e?.rowHeight??0),0));let P=Math.max(B.width+2*l,e?.width||0,N),Z=Math.max((R??0)+u.height,e?.height||0),I=-P/2,T=-Z/2;p.selectAll("g:not(:first-child)").each((t,e,a)=>{let i=(0,s.Ys)(a[e]),n=i.attr("transform"),h=0,o=0;if(n){let t=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(n);t&&(h=parseFloat(t[1]),o=parseFloat(t[2]),i.attr("class").includes("attribute-name")?h+=b:i.attr("class").includes("attribute-keys")?h+=b+$:i.attr("class").includes("attribute-comment")&&(h+=b+$+k))}i.attr("transform",`translate(${I+l/2+h}, ${o+T+u.height+r/2})`)}),p.select(".name").attr("transform","translate("+-u.width/2+", "+(T+r/2)+")");let E=A.rectangle(I,T,P,Z,L),H=p.insert(()=>E,":first-child").attr("style",o.join("")),{themeVariables:V}=(0,n.iE)(),{rowEven:Y,rowOdd:q,nodeBorder:O}=V;for(let[t,e]of(w.push(0),x.entries())){let a=(t+1)%2==0&&0!==e.yOffset,l=A.rectangle(I,u.height+T+e?.yOffset,P,e?.rowHeight,{...L,fill:a?Y:q,stroke:O});p.insert(()=>l,"g.label").attr("style",o.join("")).attr("class",`row-rect-${a?"even":"odd"}`)}let _=A.line(I,u.height+T,P+I,u.height+T,L);for(let t of(p.insert(()=>_).attr("class","divider"),_=A.line(b+I,u.height+T,b+I,Z+T,L),p.insert(()=>_).attr("class","divider"),S&&(_=A.line(b+$+I,u.height+T,b+$+I,Z+T,L),p.insert(()=>_).attr("class","divider")),v&&(_=A.line(b+$+k+I,u.height+T,b+$+k+I,Z+T,L),p.insert(()=>_).attr("class","divider")),w))_=A.line(I,u.height+T+t,P+I,u.height+T+t,L),p.insert(()=>_).attr("class","divider");if(c(e,H),y&&"handDrawn"!==e.look){let t=y.split(";"),e=t?.filter(t=>t.includes("stroke"))?.map(t=>`${t}`).join("; ");p.selectAll("path").attr("style",e??""),p.selectAll(".row-rect-even path").attr("style",y)}return e.intersect=function(t){return j.rect(e,t)},p}async function t9(t,e,a,l=0,h=0,o=[],d=""){let c=t.insert("g").attr("class",`label ${o.join(" ")}`).attr("transform",`translate(${l}, ${h})`).attr("style",d);e!==(0,n.UO)(e)&&(e=(e=(0,n.UO)(e)).replaceAll("<","<").replaceAll(">",">"));let g=c.node().appendChild(await (0,r.rw)(c,e,{width:(0,i.Cq)(e,a)+100,style:d,useHtmlLabels:a.htmlLabels},a));if(e.includes("<")||e.includes(">")){let t=g.children[0];for(t.textContent=t.textContent.replaceAll("<","<").replaceAll(">",">");t.childNodes[0];)(t=t.childNodes[0]).textContent=t.textContent.replaceAll("<","<").replaceAll(">",">")}let y=g.getBBox();if((0,n.ku)(a.htmlLabels)){let t=g.children[0];t.style.textAlign="start";let e=(0,s.Ys)(g);y=t.getBoundingClientRect(),e.attr("width",y.width),e.attr("height",y.height)}return y}async function t6(t,e,a,l,r=a.class.padding??12){let i=l?0:3,n=t.insert("g").attr("class",g(e)).attr("id",e.domId||e.id),s=null,h=null,o=null,d=null,c=0,y=0,f=0;if(s=n.insert("g").attr("class","annotation-group text"),e.annotations.length>0){let t=e.annotations[0];await et(s,{text:`\xab${t}\xbb`},0),c=s.node().getBBox().height}h=n.insert("g").attr("class","label-group text"),await et(h,e,0,["font-weight: bolder"]);let p=h.node().getBBox();y=p.height,o=n.insert("g").attr("class","members-group text");let u=0;for(let t of e.members){let e=await et(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 et(d,t,m,[t.parseClassifier()]);m+=e+i}let w=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})`),w=n.node().getBBox(),o.attr("transform",`translate(0, ${c+y+2*r})`),w=n.node().getBBox(),d.attr("transform",`translate(0, ${c+y+(f?f+4*r:2*r)})`),w=n.node().getBBox(),{shapeSvg:n,bbox:w}}async function et(t,e,a,l=[]){let h;let o=t.insert("g").attr("class","label").attr("style",l.join("; ")),d=(0,n.iE)(),c="useHtmlLabels"in e?e.useHtmlLabels:(0,n.ku)(d.htmlLabels)??!0,g="";g="text"in e?e.text:e.label,!c&&g.startsWith("\\")&&(g=g.substring(1)),(0,n.l0)(g)&&(c=!0);let y=await (0,r.rw)(o,(0,n.uX)((0,i.SH)(g)),{width:(0,i.Cq)(g,d)+50,classes:"markdown-node-label",useHtmlLabels:c},d),f=1;if(c){let t=y.children[0],e=(0,s.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,n.eW)(l,"setupImage"),setTimeout(()=>{e.complete&&l()}),e.addEventListener("error",l),e.addEventListener("load",l)})))}h=t.getBoundingClientRect(),e.attr("width",h.width),e.attr("height",h.height)}else{l.includes("font-weight: bolder")&&(0,s.Ys)(y).selectAll("tspan").attr("font-weight",""),f=y.children.length;let t=y.children[0];(""===y.textContent||y.textContent.includes(">"))&&(t.textContent=g[0]+g.substring(1).replaceAll(">",">").replaceAll("<","<").trim()," "===g[1]&&(t.textContent=t.textContent[0]+" "+t.textContent.substring(1))),"undefined"===t.textContent&&(t.textContent=""),h=y.getBBox()}return o.attr("transform","translate(0,"+(-h.height/(2*f)+a)+")"),h.height}async function ee(t,e){let a=(0,n.nV)(),l=a.class.padding??12,r=e.useHtmlLabels??(0,n.ku)(a.htmlLabels)??!0;e.annotations=e.annotations??[],e.members=e.members??[],e.methods=e.methods??[];let{shapeSvg:i,bbox:o}=await t6(t,e,a,r,l),{labelStyles:d,nodeStyles:g}=D(e);e.labelStyle=d,e.cssStyles=e.styles||"";let y=e.styles?.join(";")||g||"";e.cssStyles||(e.cssStyles=y.replaceAll("!important","").split(";"));let f=0===e.members.length&&0===e.methods.length&&!a.class?.hideEmptyMembersBox,p=h.Z.svg(i),u=W(e,{});"handDrawn"!==e.look&&(u.roughness=0,u.fillStyle="solid");let m=o.width,w=o.height;0===e.members.length&&0===e.methods.length?w+=l:e.members.length>0&&0===e.methods.length&&(w+=2*l);let x=-m/2,b=-w/2,$=p.rectangle(x-l,b-l-(f?l:0===e.members.length&&0===e.methods.length?-l/2:0),m+2*l,w+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 h=(0,s.Ys)(n[a]),o=h.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=x;(h.attr("class").includes("label-group")||h.attr("class").includes("annotation-group"))&&(g=-h.node()?.getBBox().width/2||0,i.selectAll("text").each(function(t,e,a){"middle"===window.getComputedStyle(a[e]).textAnchor&&(g=0)})),h.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,C=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+C+b+2*l+l,M.x+M.width,S+v+C+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 c(e,k),e.intersect=function(t){return j.rect(e,t)},i}async function ea(t,e){let a;let{labelStyles:l,nodeStyles:r}=D(e);e.labelStyle=l;let i="verifyMethod"in e,n=g(e),o=t.insert("g").attr("class",n).attr("id",e.domId??e.id),d=a=i?await el(o,`<<${e.type}>>`,0,e.labelStyle):await el(o,"<<Element>>",0,e.labelStyle),y=await el(o,e.name,d,e.labelStyle+"; font-weight: bold;");if(d+=y+20,i){let t=await el(o,`${e.requirementId?`id: ${e.requirementId}`:""}`,d,e.labelStyle);d+=t;let a=await el(o,`${e.text?`Text: ${e.text}`:""}`,d,e.labelStyle);d+=a;let l=await el(o,`${e.risk?`Risk: ${e.risk}`:""}`,d,e.labelStyle);d+=l,await el(o,`${e.verifyMethod?`Verification: ${e.verifyMethod}`:""}`,d,e.labelStyle)}else{let t=await el(o,`${e.type?`Type: ${e.type}`:""}`,d,e.labelStyle);d+=t,await el(o,`${e.docRef?`Doc Ref: ${e.docRef}`:""}`,d,e.labelStyle)}let f=(o.node()?.getBBox().width??200)+20,p=(o.node()?.getBBox().height??200)+20,u=-f/2,m=-p/2,w=h.Z.svg(o),x=W(e,{});"handDrawn"!==e.look&&(x.roughness=0,x.fillStyle="solid");let b=w.rectangle(u,m,f,p,x),$=o.insert(()=>b,":first-child");if($.attr("class","basic label-container").attr("style",r),o.selectAll(".label").each((t,e,a)=>{let l=(0,s.Ys)(a[e]),r=l.attr("transform"),i=0,n=0;if(r){let t=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(r);t&&(i=parseFloat(t[1]),n=parseFloat(t[2]))}let h=n-p/2,o=u+10;(0===e||1===e)&&(o=i),l.attr("transform",`translate(${o}, ${h+20})`)}),d>a+y+20){let t=w.line(u,m+a+y+20,u+f,m+a+y+20,x);o.insert(()=>t).attr("style",r)}return c(e,$),e.intersect=function(t){return j.rect(e,t)},o}async function el(t,e,a,l=""){let h;if(""===e)return 0;let o=t.insert("g").attr("class","label").attr("style",l),d=(0,n.nV)(),c=d.htmlLabels??!0,g=await (0,r.rw)(o,(0,n.uX)((0,i.SH)(e)),{width:(0,i.Cq)(e,d)+50,classes:"markdown-node-label",useHtmlLabels:c,style:l},d);if(c){let t=g.children[0],e=(0,s.Ys)(g);h=t.getBoundingClientRect(),e.attr("width",h.width),e.attr("height",h.height)}else{for(let t of g.children[0].children)t.textContent=t.textContent.replaceAll(">",">").replaceAll("<","<"),l&&t.setAttribute("style",l);h=g.getBBox(),h.height+=6}return o.attr("transform",`translate(${-h.width/2},${-h.height/2+a})`),h.height}(0,n.eW)(t0,"tiltedCylinder"),(0,n.eW)(t2,"trapezoid"),(0,n.eW)(t1,"trapezoidalPentagon"),(0,n.eW)(t5,"triangle"),(0,n.eW)(t8,"waveEdgedRectangle"),(0,n.eW)(t4,"waveRectangle"),(0,n.eW)(t7,"windowPane"),(0,n.eW)(t3,"erBox"),(0,n.eW)(t9,"addText"),(0,n.eW)(t6,"textHelper"),(0,n.eW)(et,"addText"),(0,n.eW)(ee,"classBox"),(0,n.eW)(ea,"requirementBox"),(0,n.eW)(el,"addText");var er=(0,n.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 ei(t,e,{config:a}){let l,r,i,n;let{labelStyles:s,nodeStyles:y}=D(e);e.labelStyle=s||"";let f=e.width;e.width=(e.width??200)-10;let{shapeSvg:p,bbox:u,label:m}=await o(t,e,g(e)),w=e.padding||10,x="";"ticket"in e&&e.ticket&&a?.kanban?.ticketBaseUrl&&(x=a?.kanban?.ticketBaseUrl.replace("#TICKET#",e.ticket),l=p.insert("svg:a",":first-child").attr("class","kanban-ticket-link").attr("xlink:href",x).attr("target","_blank"));let $={useHtmlLabels:e.useHtmlLabels,labelStyle:e.labelStyle||"",width:e.width,img:e.img,padding:e.padding||8,centerLabel:!1};l?{label:r,bbox:i}=await d(l,"ticket"in e&&e.ticket||"",$):{label:r,bbox:i}=await d(p,"ticket"in e&&e.ticket||"",$);let{label:k,bbox:M}=await d(p,"assigned"in e&&e.assigned||"",$);e.width=f;let S=e?.width||0,v=Math.max(i.height,M.height)/2,C=Math.max(u.height+20,e?.height||0)+v,B=-S/2,N=-C/2;m.attr("transform","translate("+(w-S/2)+", "+(-v-u.height/2)+")"),r.attr("transform","translate("+(w-S/2)+", "+(-v+u.height/2)+")"),k.attr("transform","translate("+(w+S/2-M.width-20)+", "+(-v+u.height/2)+")");let{rx:A,ry:L}=e,{cssStyles:R}=e;if("handDrawn"===e.look){let t=h.Z.svg(p),a=W(e,{}),l=A||L?t.path(b(B,N,S,C,A||0),a):t.rectangle(B,N,S,C,a);(n=p.insert(()=>l,":first-child")).attr("class","basic label-container").attr("style",R||null)}else{(n=p.insert("rect",":first-child")).attr("class","basic label-container __APA__").attr("style",y).attr("rx",A??5).attr("ry",L??5).attr("x",B).attr("y",N).attr("width",S).attr("height",C);let t="priority"in e&&e.priority;if(t){let e=p.append("line"),a=B+2,l=N+Math.floor((A??0)/2),r=N+C-Math.floor((A??0)/2);e.attr("x1",a).attr("y1",l).attr("x2",a).attr("y2",r).attr("stroke-width","4").attr("stroke",er(t))}}return c(e,n),e.height=C,e.intersect=function(t){return j.rect(e,t)},p}(0,n.eW)(ei,"kanbanItem");var en=[{semanticName:"Process",name:"Rectangle",shortName:"rect",description:"Standard process shape",aliases:["proc","process","rectangle"],internalAliases:["squareRect"],handler:tY},{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:tq},{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:tU},{semanticName:"Card",name:"Notched Rectangle",shortName:"notch-rect",description:"Represents a card",aliases:["card","notched-rectangle"],handler:_},{semanticName:"Lined/Shaded Process",name:"Lined Rectangle",shortName:"lin-rect",description:"Lined process shape",aliases:["lined-rectangle","lined-process","lin-proc","shaded-process"],handler:tj},{semanticName:"Start",name:"Small Circle",shortName:"sm-circ",description:"Small starting point",aliases:["start","small-circle"],internalAliases:["stateStart"],handler:tz},{semanticName:"Stop",name:"Framed Circle",shortName:"fr-circ",description:"Stop point",aliases:["stop","framed-circle"],internalAliases:["stateEnd"],handler:t_},{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:G},{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:tN},{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:tV},{semanticName:"Multi-Document",name:"Stacked Document",shortName:"docs",description:"Multiple documents",aliases:["documents","st-doc","stacked-document"],handler:tR},{semanticName:"Multi-Process",name:"Stacked Rectangle",shortName:"st-rect",description:"Multiple processes",aliases:["procs","processes","stacked-rectangle"],handler:tL},{semanticName:"Stored Data",name:"Bow Tie Rectangle",shortName:"bow-rect",description:"Stored data",aliases:["stored-data","bow-tie-rectangle"],handler:q},{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}],es=(0,n.eW)(()=>Object.fromEntries([...Object.entries({state:tO,choice:z,note:tP,rectWithTitle:tE,labelRect:tM,iconSquare:tx,iconCircle:tm,icon:tu,iconRounded:tw,imageSquare:tb,anchor:V,kanbanItem:ei,classBox:ee,erBox:t3,requirementBox:ea}),...en.flatMap(t=>[t.shortName,..."aliases"in t?t.aliases:[],..."internalAliases"in t?t.internalAliases:[]].map(e=>[e,t.handler]))]),"generateShapeMap")();function eh(t){return t in es}(0,n.eW)(eh,"isValidShape");var eo=new Map;async function ed(t,e,a){let l,r;"rect"===e.shape&&(e.rx&&e.ry?e.shape="roundedRect":e.shape="squareRect");let i=e.shape?es[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),eo.set(e.id,l),e.haveCallback&&l.attr("class",l.attr("class")+" clickable"),l}(0,n.eW)(ed,"insertNode");var ec=(0,n.eW)((t,e)=>{eo.set(e.id,t)},"setNodeElem"),eg=(0,n.eW)(()=>{eo.clear()},"clear"),ey=(0,n.eW)(t=>{let e=eo.get(t.id);n.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")}}]);
|