@kern0x1b/penstock-cli 26.10.3 → 26.10.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/licensing.json +1 -1
  2. package/dist/penstock.js +458 -197
  3. package/dist/web/assets/{AgentSettings-C-1YBic4.js → AgentSettings-BvzT4Itb.js} +1 -1
  4. package/dist/web/assets/{AgentsDialog-CSu8pyh7.js → AgentsDialog-BqY3wKcV.js} +1 -1
  5. package/dist/web/assets/BpmnCanvas-BTdM1l9l.js +1905 -0
  6. package/dist/web/assets/BpmnDocument-uifU3NGG.js +24 -0
  7. package/dist/web/assets/{ConflictDialog-nygfF7Dn.js → ConflictDialog-C4A9-Psr.js} +1 -1
  8. package/dist/web/assets/{DiffDocument-DUrje9io.js → DiffDocument-BMTSevd7.js} +1 -1
  9. package/dist/web/assets/{DmnDocument-fn7AH7P1.js → DmnDocument-B8wWuhfX.js} +9 -9
  10. package/dist/web/assets/{FormDocument-BbyRqjib.js → FormDocument-bQ5VRsrh.js} +1 -1
  11. package/dist/web/assets/{FormStepView-BYRMBW0U.js → FormStepView-DbMCFSO1.js} +1 -1
  12. package/dist/web/assets/{GraphAwareLayoutService-BiLVDmB7.js → GraphAwareLayoutService-CePcz6pL.js} +1 -1
  13. package/dist/web/assets/NewFileDialog-DsoFURD9.js +47 -0
  14. package/dist/web/assets/{QuickOpen-D-u9hdSt.js → QuickOpen-mzlfRqvG.js} +1 -1
  15. package/dist/web/assets/{ScriptPane-BQorfmyv.js → ScriptPane-C9q5wLfO.js} +2 -2
  16. package/dist/web/assets/{ScriptRunDialog-DjBW0LRD.js → ScriptRunDialog-Dm-_0H1Z.js} +1 -1
  17. package/dist/web/assets/{SettingsDialog-DvYUAKpH.js → SettingsDialog-Bhwwtyg7.js} +1 -1
  18. package/dist/web/assets/{ShortcutsDialog-BQ5BYHj3.js → ShortcutsDialog-BXP0h7Tp.js} +1 -1
  19. package/dist/web/assets/{SourceDocument-BfHVXxuk.js → SourceDocument-DgrNCprS.js} +1 -1
  20. package/dist/web/assets/{TextDocument-BPepqeGu.js → TextDocument-D8N0uaQa.js} +1 -1
  21. package/dist/web/assets/{UnreadableFileLayer-D5B6nixz.js → UnreadableFileLayer-D2Rcxnt7.js} +1 -1
  22. package/dist/web/assets/{UploadDialog-BzIvQ1YS.js → UploadDialog-Dinga4TP.js} +1 -1
  23. package/dist/web/assets/apply-CzXxiRWK.js +1 -0
  24. package/dist/web/assets/{bpmnTheme-Divwrkjy.js → bpmnTheme-db4tYvop.js} +1 -1
  25. package/dist/web/assets/bridgeInstance-BPwbITOf.js +850 -0
  26. package/dist/web/assets/{commands-N2yKHjf_.js → commands-BAnBjEk3.js} +1 -1
  27. package/dist/web/assets/de-Cd75cvcZ.js +1 -0
  28. package/dist/web/assets/{dialog-DSf66Ory.js → dialog-KVjfqSrB.js} +1 -1
  29. package/dist/web/assets/{diff-DkfgVbKD.js → diff-Cw0ENHJR.js} +1 -1
  30. package/dist/web/assets/{documentBridge-DSWBQZRP.js → documentBridge-D5SaBThP.js} +8 -8
  31. package/dist/web/assets/{documents-C4vr2KnQ.js → documents-Dkor36oS.js} +1 -1
  32. package/dist/web/assets/{duplicate-C-AiqE1T.js → duplicate-ud-StKuO.js} +1 -1
  33. package/dist/web/assets/{engines-DG8KgTeX.js → engines-BQRXHtW8.js} +1 -1
  34. package/dist/web/assets/es-D2PUEg_Z.js +1 -0
  35. package/dist/web/assets/{formChecks-B_ZFz9DR.js → formChecks-DFrCuO4I.js} +1 -1
  36. package/dist/web/assets/fr-DkGYGarc.js +1 -0
  37. package/dist/web/assets/{frontend-BLfXy4OQ.js → frontend-B05iyhCp.js} +1 -1
  38. package/dist/web/assets/{httpHost-Cll6HteE.js → httpHost-DX-P_FDg.js} +1 -1
  39. package/dist/web/assets/{index.es-DQAdm_u9.js → index.es-DR-czZl7.js} +1 -1
  40. package/dist/web/assets/{index.es-B0wi5_fv.js → index.es-dFUgH_-g.js} +1 -1
  41. package/dist/web/assets/{intelligence-glU4hcHy.js → intelligence-BkxcJMU_.js} +1 -1
  42. package/dist/web/assets/ja-De4NAvK-.js +1 -0
  43. package/dist/web/assets/{jspdf.es.min-xdeBAA_m.js → jspdf.es.min-BMfOi0te.js} +3 -3
  44. package/dist/web/assets/ko-Ci27KQ5n.js +1 -0
  45. package/dist/web/assets/{lib-DJ1i09sd.js → lib-C3uYnGWx.js} +1 -1
  46. package/dist/web/assets/{engine-BPUfS3r2.js → moddle-CGpeSs3G.js} +1 -1
  47. package/dist/web/assets/{platform-BS7bgwr3.js → platform-zEAtGnYc.js} +1 -1
  48. package/dist/web/assets/preferences-K6VRM9Ah.js +1 -0
  49. package/dist/web/assets/pt-BR-CNmIseZJ.js +1 -0
  50. package/dist/web/assets/ru-BtK7W4xW.js +1 -0
  51. package/dist/web/assets/{run-Df8AD_as.js → run-fV7AmV4q.js} +1 -1
  52. package/dist/web/assets/{samples-chRLnLcq.js → samples-D-3Bquy_.js} +1 -1
  53. package/dist/web/assets/testCaseRuns-C-0blM3d.js +1 -0
  54. package/dist/web/assets/translator-Dvvasoz-.js +1 -0
  55. package/dist/web/assets/{ui-AICOEtWR.js → ui-TBzvKaKQ.js} +1 -1
  56. package/dist/web/assets/{useTrace-B3gDUL0X.js → useTrace-BgpeAcQR.js} +1 -1
  57. package/dist/web/assets/{web-BtxFF0jJ.js → web-qJCedJJw.js} +8 -8
  58. package/dist/web/assets/zh-DxI_A5kC.js +1 -0
  59. package/dist/web/index.html +20 -20
  60. package/package.json +4 -1
  61. package/dist/web/assets/BpmnCanvas-DnBLxMNQ.js +0 -1905
  62. package/dist/web/assets/BpmnDocument-BPpyqTzJ.js +0 -24
  63. package/dist/web/assets/NewFileDialog-Ce_cTeOv.js +0 -34
  64. package/dist/web/assets/apply-B0vauBJn.js +0 -1
  65. package/dist/web/assets/bridgeInstance-D0bzpNGz.js +0 -600
  66. package/dist/web/assets/de-izeWpfua.js +0 -1
  67. package/dist/web/assets/es-CRMYEYWD.js +0 -1
  68. package/dist/web/assets/fr-8pTyPyAI.js +0 -1
  69. package/dist/web/assets/ja-I1fjeFMy.js +0 -1
  70. package/dist/web/assets/ko-CFd9C-RA.js +0 -1
  71. package/dist/web/assets/preferences-C_EXTz45.js +0 -1
  72. package/dist/web/assets/pt-BR-Dl_APu95.js +0 -1
  73. package/dist/web/assets/ru-_vhcOTod.js +0 -1
  74. package/dist/web/assets/testCaseRuns-DLEqANBi.js +0 -1
  75. package/dist/web/assets/translator-CS9eR0My.js +0 -1
  76. package/dist/web/assets/zh-Do_q1RZ2.js +0 -1
@@ -1 +1 @@
1
- import"./rolldown-runtime-B8BYMn-z.js";import{c as e,i as t,o as n,r,u as i}from"./vendor-NJP34MHU.js";import{i as a}from"./translator-CS9eR0My.js";import{t as o}from"./bridgeInstance-D0bzpNGz.js";import"./platform-BS7bgwr3.js";import{s}from"./ui-AICOEtWR.js";import{i as c}from"./lib-DJ1i09sd.js";import{u as l}from"./index.es-DQAdm_u9.js";function findEmbeddedFormSchema(e,t){if(!e)return null;if(typeof e==`string`){let n=RegExp(`<zeebe:userTaskForm[^>]*id=["']${t}["'][^>]*>([\\s\\S]*?)<\\/zeebe:userTaskForm>`,`i`).exec(e)??RegExp(`<zeebe:userTaskForm[^>]*id=["']userTaskForm_${t}["'][^>]*>([\\s\\S]*?)<\\/zeebe:userTaskForm>`,`i`).exec(e);if(n)try{let e=JSON.parse(n[1].trim());if(typeof e==`object`&&e)return e}catch{}}let n=e.rootElements??(Array.isArray(e)?e:[e]);for(let e of n){let n=e?.extensionElements?.values??[];for(let e of n)if(e.$type===`zeebe:UserTaskForm`||e.$type===`UserTaskForm`){let n=String(e.id??``),r=n.replace(/^userTaskForm_/,``),i=t.replace(/^userTaskForm_/,``);if(n===t||n===`userTaskForm_${t}`||t===`userTaskForm_${n}`||r===i){let t=e.body??e.text??e.content;if(typeof t==`string`)try{let e=JSON.parse(t);if(typeof e==`object`&&e)return e}catch{}}}}return null}async function findFormSchema(e,t,n,r){if(!e)return null;let i=e,a=!1;if(e.startsWith(`camunda-forms:bpmn:`)?(i=e.slice(19),a=!0):e.startsWith(`camunda-forms:deployment:`)?i=e.slice(25):e.startsWith(`camunda-forms:app:`)&&(i=e.slice(18)),a||i.startsWith(`userTaskForm_`)){let e=findEmbeddedFormSchema(t,i);if(e)return e}let o=findEmbeddedFormSchema(t,i);if(o)return o;let s=n.get(i)??n.get(e);if(s){let e=await r(s).catch(()=>null);if(e)try{let t=JSON.parse(e);if(typeof t==`object`&&t)return t}catch{}}for(let[e,t]of n.entries())if(t.endsWith(i)||t.endsWith(`${i}.form`)||e===i){let e=await r(t).catch(()=>null);if(e)try{let t=JSON.parse(e);if(typeof t==`object`&&t)return t}catch{}}let c=await r(i).catch(()=>null);if(c)try{let e=JSON.parse(c);if(typeof e==`object`&&e)return e}catch{}return null}function FormStepView({step:u,review:d,runs:f,onChange:p,onComplete:m,onRevealFile:h}){let g=t(null),_=t(null),v=t({}),[y,b]=e(null),[x,S]=e(!0),C=n(()=>{let e={};for(let t of u.values?.rows??[])t.name&&(e[t.name]=t.value);return e},[u.values?.rows]);if(i(()=>{let e=!1;S(!0);let t=u.links.form;if(!t)b(null),S(!1);else return(async()=>{try{let n=await findFormSchema(t,d.context?.definitions,d.targets.forms,e=>o().readFileIfPresent(e));if(e)return;b(n)}catch{if(e)return;b(null)}finally{e||S(!1)}})(),()=>{e=!0}},[u.links.form,u.elementId,d.context?.definitions,d.targets.forms]),i(()=>{if(g.current&&y)try{let e=new l({container:g.current,additionalModules:[c]});_.current=e;let t=!1;return e.on(`changed`,e=>{v.current=e.data,t&&p(Object.entries(e.data).map(([e,t])=>({name:e,value:t})))}),v.current=C,e.importSchema(y,C).then(()=>{t=!0}).catch(()=>{}),()=>{_.current=null;try{e.destroy()}catch{}}}catch{return}},[y,u.elementId]),x)return r(`div`,{class:`penstock-review__empty`,children:r(`p`,{class:`penstock-review__hint`,children:a(`app.common.loading`)})});if(!y)return r(`div`,{class:`penstock-review__empty`,children:[r(s,{title:a(`app.runs.noFormWithTheId`,{id:u.links.form??u.name}),hint:a(`app.runs.formNotInProject`,{id:u.links.form??u.name}),guide:`scenarios`}),u.links.form&&h&&r(`div`,{class:`penstock-review__actions`,children:r(`button`,{type:`button`,class:`penstock-review__link`,onClick:()=>h(u),children:a(`app.runs.goToTheForm`)})})]});let w=f.waiting&&f.waiting.kind===`userTask`&&f.waiting.elementId===u.elementId;return r(`div`,{class:`penstock-review__form-wrap`,children:[r(`div`,{class:`penstock-review__form`,ref:g}),w&&r(`div`,{class:`penstock-review__footer`,children:r(`button`,{type:`button`,class:`ui-button ui-button--primary`,onClick:()=>m?.(v.current),children:a(`app.runs.complete`)})}),u.links.form&&h&&!w&&r(`div`,{class:`penstock-review__actions penstock-review__pad`,children:r(`button`,{type:`button`,class:`penstock-review__link`,onClick:()=>h(u),children:a(`app.runs.goToTheForm`)})})]})}export{FormStepView};
1
+ import"./rolldown-runtime-B8BYMn-z.js";import{c as e,i as t,o as n,r,u as i}from"./vendor-NJP34MHU.js";import{i as a}from"./translator-Dvvasoz-.js";import{t as o}from"./bridgeInstance-BPwbITOf.js";import"./platform-zEAtGnYc.js";import{s}from"./ui-TBzvKaKQ.js";import{i as c}from"./lib-C3uYnGWx.js";import{u as l}from"./index.es-DR-czZl7.js";function findEmbeddedFormSchema(e,t){if(!e)return null;if(typeof e==`string`){let n=RegExp(`<zeebe:userTaskForm[^>]*id=["']${t}["'][^>]*>([\\s\\S]*?)<\\/zeebe:userTaskForm>`,`i`).exec(e)??RegExp(`<zeebe:userTaskForm[^>]*id=["']userTaskForm_${t}["'][^>]*>([\\s\\S]*?)<\\/zeebe:userTaskForm>`,`i`).exec(e);if(n)try{let e=JSON.parse(n[1].trim());if(typeof e==`object`&&e)return e}catch{}}let n=e.rootElements??(Array.isArray(e)?e:[e]);for(let e of n){let n=e?.extensionElements?.values??[];for(let e of n)if(e.$type===`zeebe:UserTaskForm`||e.$type===`UserTaskForm`){let n=String(e.id??``),r=n.replace(/^userTaskForm_/,``),i=t.replace(/^userTaskForm_/,``);if(n===t||n===`userTaskForm_${t}`||t===`userTaskForm_${n}`||r===i){let t=e.body??e.text??e.content;if(typeof t==`string`)try{let e=JSON.parse(t);if(typeof e==`object`&&e)return e}catch{}}}}return null}async function findFormSchema(e,t,n,r){if(!e)return null;let i=e,a=!1;if(e.startsWith(`camunda-forms:bpmn:`)?(i=e.slice(19),a=!0):e.startsWith(`camunda-forms:deployment:`)?i=e.slice(25):e.startsWith(`camunda-forms:app:`)&&(i=e.slice(18)),a||i.startsWith(`userTaskForm_`)){let e=findEmbeddedFormSchema(t,i);if(e)return e}let o=findEmbeddedFormSchema(t,i);if(o)return o;let s=n.get(i)??n.get(e);if(s){let e=await r(s).catch(()=>null);if(e)try{let t=JSON.parse(e);if(typeof t==`object`&&t)return t}catch{}}for(let[e,t]of n.entries())if(t.endsWith(i)||t.endsWith(`${i}.form`)||e===i){let e=await r(t).catch(()=>null);if(e)try{let t=JSON.parse(e);if(typeof t==`object`&&t)return t}catch{}}let c=await r(i).catch(()=>null);if(c)try{let e=JSON.parse(c);if(typeof e==`object`&&e)return e}catch{}return null}function FormStepView({step:u,review:d,runs:f,onChange:p,onComplete:m,onRevealFile:h}){let g=t(null),_=t(null),v=t({}),[y,b]=e(null),[x,S]=e(!0),C=n(()=>{let e={};for(let t of u.values?.rows??[])t.name&&(e[t.name]=t.value);return e},[u.values?.rows]);if(i(()=>{let e=!1;S(!0);let t=u.links.form;if(!t)b(null),S(!1);else return(async()=>{try{let n=await findFormSchema(t,d.context?.definitions,d.targets.forms,e=>o().readFileIfPresent(e));if(e)return;b(n)}catch{if(e)return;b(null)}finally{e||S(!1)}})(),()=>{e=!0}},[u.links.form,u.elementId,d.context?.definitions,d.targets.forms]),i(()=>{if(g.current&&y)try{let e=new l({container:g.current,additionalModules:[c]});_.current=e;let t=!1;return e.on(`changed`,e=>{v.current=e.data,t&&p(Object.entries(e.data).map(([e,t])=>({name:e,value:t})))}),v.current=C,e.importSchema(y,C).then(()=>{t=!0}).catch(()=>{}),()=>{_.current=null;try{e.destroy()}catch{}}}catch{return}},[y,u.elementId]),x)return r(`div`,{class:`penstock-review__empty`,children:r(`p`,{class:`penstock-review__hint`,children:a(`app.common.loading`)})});if(!y)return r(`div`,{class:`penstock-review__empty`,children:[r(s,{title:a(`app.runs.noFormWithTheId`,{id:u.links.form??u.name}),hint:a(`app.runs.formNotInProject`,{id:u.links.form??u.name}),guide:`scenarios`}),u.links.form&&h&&r(`div`,{class:`penstock-review__actions`,children:r(`button`,{type:`button`,class:`penstock-review__link`,onClick:()=>h(u),children:a(`app.runs.goToTheForm`)})})]});let w=f.waiting&&f.waiting.kind===`userTask`&&f.waiting.elementId===u.elementId;return r(`div`,{class:`penstock-review__form-wrap`,children:[r(`div`,{class:`penstock-review__form`,ref:g}),w&&r(`div`,{class:`penstock-review__footer`,children:r(`button`,{type:`button`,class:`ui-button ui-button--primary`,onClick:()=>m?.(v.current),children:a(`app.runs.complete`)})}),u.links.form&&h&&!w&&r(`div`,{class:`penstock-review__actions penstock-review__pad`,children:r(`button`,{type:`button`,class:`penstock-review__link`,onClick:()=>h(u),children:a(`app.runs.goToTheForm`)})})]})}export{FormStepView};
@@ -1,4 +1,4 @@
1
- import{i as c,t as u}from"./rolldown-runtime-B8BYMn-z.js";import{i as m}from"./translator-CS9eR0My.js";import{A as h,C as g,D as v,E as y,O as S,S as w,T,_ as E,a as D,b as k,c as j,d as M,f as N,g as P,h as I,i as L,j as z,k as B,l as V,m as H,n as U,o as W,p as ee,r as G,s as K,t as Z,u as Q,v as te,w as ne,x as $,y as re}from"./BpmnDocument-BPpyqTzJ.js";var Bt=c=>({avoidLib:void 0,async load(u=void 0){if(this.avoidLib)console.log(`Avoid library is already initialized`);else{let ce=function(c,m){return u!==void 0&&c.endsWith(`.wasm`)?u:m+c};this.avoidLib=await c({locateFile:ce})}},getInstance(){if(!this.avoidLib)throw Error(`Avoid library should be initialized before using`);return this.avoidLib}}),ae=Bt((()=>{var c=import.meta.url;return async function(u={}){var m,h=u,g,v,y=new Promise((c,u)=>{g=c,v=u}),S=`./this.program`,w=``,Ye;if(typeof document<`u`&&document.currentScript&&(w=document.currentScript.src),c&&(w=c),w=w.startsWith(`blob:`)?``:w.slice(0,w.replace(/[?#].*/,``).lastIndexOf(`/`)+1),typeof window!=`object`&&typeof WorkerGlobalScope>`u`)throw Error(`not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)`);Ye=async c=>{if(d(!Ze(c),`readAsync does not work with file:// URLs`),c=await fetch(c,{credentials:`same-origin`}),c.ok)return c.arrayBuffer();throw Error(c.status+` : `+c.url)};var T=console.log.bind(console),E=console.error.bind(console);d(!0,"worker environment detected but not enabled at build time. Add `worker` to `-sENVIRONMENT` to enable."),d(!0,"node environment detected but not enabled at build time. Add `node` to `-sENVIRONMENT` to enable."),d(!0,"shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable.");var D;typeof WebAssembly!=`object`&&E(`no native wasm support detected`);var k,j=!1,M;function d(c,u){c||A(`Assertion failed`+(u?`: `+u:``))}var N,P,I,L,z,B,V,H,U,W,ee=!1,G=!1,Ze=c=>c.startsWith(`file://`);function Ht(){var c=Ot();d(!(c&3)),c==0&&(c+=4),B[c>>2]=34821223,B[c+4>>2]=2310721022,B[0]=1668509029}function ie(){if(!j){var c=Ot();c==0&&(c+=4);var u=B[c>>2],m=B[c+4>>2];u==34821223&&m==2310721022||A(`Stack overflow! Stack cookie has been overwritten at ${J(c)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${J(m)} ${J(u)}`),B[0]!=1668509029&&A(`Runtime error: The application has corrupted its heap memory area (address zero)!`)}}var K=new Int16Array(1),Z=new Int8Array(K.buffer);if(K[0]=25459,Z[0]!==115||Z[1]!==99)throw`Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)`;function he(c){Object.getOwnPropertyDescriptor(h,c)||Object.defineProperty(h,c,{configurable:!0,set(){A(`Attempt to set \`Module.${c}\` after it has already been processed. This can happen, for example, when code is injected via '--post-js' rather than '--pre-js'`)}})}function rt(c){return c===`FS_createPath`||c===`FS_createDataFile`||c===`FS_createPreloadedFile`||c===`FS_unlink`||c===`addRunDependency`||c===`FS_createLazyFile`||c===`FS_createDevice`||c===`removeRunDependency`}function nt(c,u){typeof globalThis>`u`||Object.getOwnPropertyDescriptor(globalThis,c)||Object.defineProperty(globalThis,c,{configurable:!0,get(){u()}})}function it(c,u){nt(c,()=>{O(`\`${c}\` is not longer defined by emscripten. ${u}`)})}it(`buffer`,`Please use HEAP8.buffer or wasmMemory.buffer`),it(`asm`,`Please use wasmExports instead`);function ot(c){Object.getOwnPropertyDescriptor(h,c)||Object.defineProperty(h,c,{configurable:!0,get(){var u=`'${c}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`;rt(c)&&(u+=`. Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you`),A(u)}})}function at(){var c=k.buffer;N=new Int8Array(c),I=new Int16Array(c),P=new Uint8Array(c),L=new Uint16Array(c),z=new Int32Array(c),B=new Uint32Array(c),V=new Float32Array(c),W=new Float64Array(c),H=new BigInt64Array(c),U=new BigUint64Array(c)}d(typeof Int32Array<`u`&&typeof Float64Array<`u`&&Int32Array.prototype.subarray!=null&&Int32Array.prototype.set!=null,`JS engine does not provide full typed array support`);var Q=0,te=null,ne={},$=null;function zt(){Q++,h.monitorRunDependencies?.(Q),d(!ne[`wasm-instantiate`]),ne[`wasm-instantiate`]=1,$===null&&typeof setInterval<`u`&&($=setInterval(()=>{if(j)clearInterval($),$=null;else{var c=!1,u;for(u in ne)c||(c=!0,E(`still waiting on run dependencies:`)),E(`dependency: ${u}`);c&&E(`(end of list)`)}},1e4))}function A(c){throw h.onAbort?.(c),c=`Aborted(`+c+`)`,E(c),j=!0,ee&&Nt(),c=new WebAssembly.RuntimeError(c),v(c),c}function st(){A(`Filesystem support (FS) was not included. The problem is that you are using files from JS, but files were not used from C/C++, so filesystem support was not auto-included. You can force-include filesystem support with -sFORCE_FILESYSTEM`)}function F(c,u){return(...m)=>{d(ee,`native function \`${c}\` called before runtime initialization`),d(!G,`native function \`${c}\` called after runtime exit (use NO_EXIT_RUNTIME to keep it alive after main() exits)`);var h=gt[c];return d(h,`exported native function \`${c}\` not found`),d(m.length<=u,`native function \`${c}\` called with ${m.length} args but expects ${u}`),h(...m)}}var re=0;function ut(c){return(...u)=>{if(j)throw`program has already aborted!`;re++;try{return c(...u)}catch(c){if(j||1<re||c===`unwind`)throw c;A(`unhandled exception: `+[c,c.stack])}finally{re--}}}function Jt(){var c=de.get,u={};de.get=m=>{var h=c.call(de,m),g=u[m];return g&&g.S===h||(g=u[m]={S:h,ca:ut(h)}),g.ca}}var ae;async function Yt(c){if(!D)try{var u=await Ye(c);return new Uint8Array(u)}catch{}if(c==ae&&D)c=new Uint8Array(D);else throw`both async and sync fetching of the wasm failed`;return c}async function Kt(c,u){try{var m=await Yt(c);return await WebAssembly.instantiate(m,u)}catch(c){E(`failed to asynchronously prepare wasm: ${c}`),Ze(ae)&&E(`warning: Loading from a file URI (${ae}) is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing`),A(c)}}async function qt(c){var u=ae;if(!D&&typeof WebAssembly.instantiateStreaming==`function`)try{var m=fetch(u,{credentials:`same-origin`});return await WebAssembly.instantiateStreaming(m,c)}catch(c){E(`wasm streaming compile failed: ${c}`),E(`falling back to ArrayBuffer instantiation`)}return Kt(u,c)}class lt{name=`ExitStatus`;constructor(c){this.message=`Program terminated with exit(${c})`,this.status=c}}var ct=c=>{for(;0<c.length;)c.shift()(h)},oe=[],se=[],Xt=()=>{var c=h.preRun.shift();se.push(c)},le=!1,J=c=>(d(typeof c==`number`),`0x`+(c>>>0).toString(16).padStart(8,`0`)),O=c=>{O.M||={},O.M[c]||(O.M[c]=1,E(c))},de,fe=typeof TextDecoder<`u`?new TextDecoder:void 0,pt=(c,u=0,m=NaN)=>{var h=u+m;for(m=u;c[m]&&!(m>=h);)++m;if(16<m-u&&c.buffer&&fe)return fe.decode(c.subarray(u,m));for(h=``;u<m;){var g=c[u++];if(g&128){var v=c[u++]&63;if((g&224)==192)h+=String.fromCharCode((g&31)<<6|v);else{var y=c[u++]&63;(g&240)==224?g=(g&15)<<12|v<<6|y:((g&248)!=240&&O(`Invalid UTF-8 leading byte `+J(g)+` encountered when deserializing a UTF-8 string in wasm memory to a JS string!`),g=(g&7)<<18|v<<12|y<<6|c[u++]&63),65536>g?h+=String.fromCharCode(g):(g-=65536,h+=String.fromCharCode(55296|g>>10,56320|g&1023))}}else h+=String.fromCharCode(g)}return h},Y=(c,u)=>(d(typeof c==`number`,`UTF8ToString expects a number (got ${typeof c})`),c?pt(P,c,u):``),be=c=>(c=c.getArg(gt.__cpp_exception,0),en(c)),ht=c=>{var u=be(c);c=Ut();var m=Vt(4),h=Vt(4);if(tn(u,m,h),u=B[m>>2],h=B[h>>2],m=Y(u),xt(u),h){var g=Y(h);xt(h)}return Lt(c),[m,g]},x=c=>{if(c===null)return`null`;var u=typeof c;return u===`object`||u===`array`||u===`function`?c.toString():``+c},pe,_=c=>{for(var u=``;P[c];)u+=pe[P[c++]];return u},me={},ge={},ye={},De=h.BindingError=class extends Error{constructor(c){super(c),this.name=`BindingError`}},Qt=c=>{throw new De(c)};function Zt(c,u,m={}){var h=u.name;if(!c)throw new De(`type "${h}" must have a positive integer typeid pointer`);if(ge.hasOwnProperty(c)){if(m.V)return;throw new De(`Cannot register type '${h}' twice`)}ge[c]=u,delete ye[c],me.hasOwnProperty(c)&&(u=me[c],delete me[c],u.forEach(c=>c()))}function C(c,u,m={}){if(u.o===void 0)throw TypeError(`registerType registeredInstance requires argPackAdvance`);return Zt(c,u,m)}var yt=(c,u,m)=>{switch(u){case 1:return m?c=>N[c]:c=>P[c];case 2:return m?c=>I[c>>1]:c=>L[c>>1];case 4:return m?c=>z[c>>2]:c=>B[c>>2];case 8:return m?c=>H[c>>3]:c=>U[c>>3];default:throw TypeError(`invalid integer width (${u}): ${c}`)}},Re=c=>{throw new De(c.g.j.h.name+` instance already deleted`)},je=!1,vt=()=>{},wt=(c,u,m)=>u===m?c:m.m===void 0?null:(c=wt(c,u,m.m),c===null?null:m.R(c)),Me={},Pe={},tr=(c,u)=>{if(u===void 0)throw new De(`ptr should not be undefined`);for(;c.m;)u=c.H(u),c=c.m;return Pe[u]},Fe=h.InternalError=class extends Error{constructor(c){super(c),this.name=`InternalError`}},ve=(c,u)=>{if(!u.j||!u.i)throw new Fe(`makeClassHandle requires ptr and ptrType`);if(!!u.v!=!!u.l)throw new Fe(`Both smartPtrType and smartPtr must be specified`);return u.count={value:1},ue(Object.create(c,{g:{value:u,writable:!0}}))};function Tt(c){function t(){return this.K?ve(this.h.A,{j:this.Y,i:u,v:this,l:c}):ve(this.h.A,{j:this,i:c})}var u=this.U(c);if(!u)return this.N(c),null;var m=tr(this.h,u);if(m!==void 0)return m.g.count.value===0?(m.g.i=u,m.g.l=c,m.clone()):(m=m.clone(),this.N(c),m);if(m=this.h.T(u),m=Me[m],!m)return t.call(this);m=this.J?m.P:m.pointerType;var h=wt(u,this.h,m.h);return h===null?t.call(this):this.K?ve(m.h.A,{j:m,i:h,v:this,l:c}):ve(m.h.A,{j:m,i:h})}var ue=c=>typeof FinalizationRegistry>`u`?(ue=c=>c,c):(je=new FinalizationRegistry(c=>{console.warn(c.X),c=c.g,--c.count.value,c.count.value===0&&(c.l?c.v.B(c.l):c.j.h.B(c.i))}),ue=c=>{var u=c.g;if(u.l){var m={g:u};u=Error(`Embind found a leaked C++ instance ${u.j.h.name} <${J(u.i)}>.
1
+ import{i as c,t as u}from"./rolldown-runtime-B8BYMn-z.js";import{i as m}from"./translator-Dvvasoz-.js";import{A as h,C as g,D as v,E as y,O as S,S as w,T,_ as E,a as D,b as k,c as j,d as M,f as N,g as P,h as I,i as L,j as z,k as B,l as V,m as H,n as U,o as W,p as ee,r as G,s as K,t as Z,u as Q,v as te,w as ne,x as $,y as re}from"./BpmnDocument-uifU3NGG.js";var Bt=c=>({avoidLib:void 0,async load(u=void 0){if(this.avoidLib)console.log(`Avoid library is already initialized`);else{let ce=function(c,m){return u!==void 0&&c.endsWith(`.wasm`)?u:m+c};this.avoidLib=await c({locateFile:ce})}},getInstance(){if(!this.avoidLib)throw Error(`Avoid library should be initialized before using`);return this.avoidLib}}),ae=Bt((()=>{var c=import.meta.url;return async function(u={}){var m,h=u,g,v,y=new Promise((c,u)=>{g=c,v=u}),S=`./this.program`,w=``,Ye;if(typeof document<`u`&&document.currentScript&&(w=document.currentScript.src),c&&(w=c),w=w.startsWith(`blob:`)?``:w.slice(0,w.replace(/[?#].*/,``).lastIndexOf(`/`)+1),typeof window!=`object`&&typeof WorkerGlobalScope>`u`)throw Error(`not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)`);Ye=async c=>{if(d(!Ze(c),`readAsync does not work with file:// URLs`),c=await fetch(c,{credentials:`same-origin`}),c.ok)return c.arrayBuffer();throw Error(c.status+` : `+c.url)};var T=console.log.bind(console),E=console.error.bind(console);d(!0,"worker environment detected but not enabled at build time. Add `worker` to `-sENVIRONMENT` to enable."),d(!0,"node environment detected but not enabled at build time. Add `node` to `-sENVIRONMENT` to enable."),d(!0,"shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable.");var D;typeof WebAssembly!=`object`&&E(`no native wasm support detected`);var k,j=!1,M;function d(c,u){c||A(`Assertion failed`+(u?`: `+u:``))}var N,P,I,L,z,B,V,H,U,W,ee=!1,G=!1,Ze=c=>c.startsWith(`file://`);function Ht(){var c=Ot();d(!(c&3)),c==0&&(c+=4),B[c>>2]=34821223,B[c+4>>2]=2310721022,B[0]=1668509029}function ie(){if(!j){var c=Ot();c==0&&(c+=4);var u=B[c>>2],m=B[c+4>>2];u==34821223&&m==2310721022||A(`Stack overflow! Stack cookie has been overwritten at ${J(c)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${J(m)} ${J(u)}`),B[0]!=1668509029&&A(`Runtime error: The application has corrupted its heap memory area (address zero)!`)}}var K=new Int16Array(1),Z=new Int8Array(K.buffer);if(K[0]=25459,Z[0]!==115||Z[1]!==99)throw`Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)`;function he(c){Object.getOwnPropertyDescriptor(h,c)||Object.defineProperty(h,c,{configurable:!0,set(){A(`Attempt to set \`Module.${c}\` after it has already been processed. This can happen, for example, when code is injected via '--post-js' rather than '--pre-js'`)}})}function rt(c){return c===`FS_createPath`||c===`FS_createDataFile`||c===`FS_createPreloadedFile`||c===`FS_unlink`||c===`addRunDependency`||c===`FS_createLazyFile`||c===`FS_createDevice`||c===`removeRunDependency`}function nt(c,u){typeof globalThis>`u`||Object.getOwnPropertyDescriptor(globalThis,c)||Object.defineProperty(globalThis,c,{configurable:!0,get(){u()}})}function it(c,u){nt(c,()=>{O(`\`${c}\` is not longer defined by emscripten. ${u}`)})}it(`buffer`,`Please use HEAP8.buffer or wasmMemory.buffer`),it(`asm`,`Please use wasmExports instead`);function ot(c){Object.getOwnPropertyDescriptor(h,c)||Object.defineProperty(h,c,{configurable:!0,get(){var u=`'${c}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`;rt(c)&&(u+=`. Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you`),A(u)}})}function at(){var c=k.buffer;N=new Int8Array(c),I=new Int16Array(c),P=new Uint8Array(c),L=new Uint16Array(c),z=new Int32Array(c),B=new Uint32Array(c),V=new Float32Array(c),W=new Float64Array(c),H=new BigInt64Array(c),U=new BigUint64Array(c)}d(typeof Int32Array<`u`&&typeof Float64Array<`u`&&Int32Array.prototype.subarray!=null&&Int32Array.prototype.set!=null,`JS engine does not provide full typed array support`);var Q=0,te=null,ne={},$=null;function zt(){Q++,h.monitorRunDependencies?.(Q),d(!ne[`wasm-instantiate`]),ne[`wasm-instantiate`]=1,$===null&&typeof setInterval<`u`&&($=setInterval(()=>{if(j)clearInterval($),$=null;else{var c=!1,u;for(u in ne)c||(c=!0,E(`still waiting on run dependencies:`)),E(`dependency: ${u}`);c&&E(`(end of list)`)}},1e4))}function A(c){throw h.onAbort?.(c),c=`Aborted(`+c+`)`,E(c),j=!0,ee&&Nt(),c=new WebAssembly.RuntimeError(c),v(c),c}function st(){A(`Filesystem support (FS) was not included. The problem is that you are using files from JS, but files were not used from C/C++, so filesystem support was not auto-included. You can force-include filesystem support with -sFORCE_FILESYSTEM`)}function F(c,u){return(...m)=>{d(ee,`native function \`${c}\` called before runtime initialization`),d(!G,`native function \`${c}\` called after runtime exit (use NO_EXIT_RUNTIME to keep it alive after main() exits)`);var h=gt[c];return d(h,`exported native function \`${c}\` not found`),d(m.length<=u,`native function \`${c}\` called with ${m.length} args but expects ${u}`),h(...m)}}var re=0;function ut(c){return(...u)=>{if(j)throw`program has already aborted!`;re++;try{return c(...u)}catch(c){if(j||1<re||c===`unwind`)throw c;A(`unhandled exception: `+[c,c.stack])}finally{re--}}}function Jt(){var c=de.get,u={};de.get=m=>{var h=c.call(de,m),g=u[m];return g&&g.S===h||(g=u[m]={S:h,ca:ut(h)}),g.ca}}var ae;async function Yt(c){if(!D)try{var u=await Ye(c);return new Uint8Array(u)}catch{}if(c==ae&&D)c=new Uint8Array(D);else throw`both async and sync fetching of the wasm failed`;return c}async function Kt(c,u){try{var m=await Yt(c);return await WebAssembly.instantiate(m,u)}catch(c){E(`failed to asynchronously prepare wasm: ${c}`),Ze(ae)&&E(`warning: Loading from a file URI (${ae}) is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing`),A(c)}}async function qt(c){var u=ae;if(!D&&typeof WebAssembly.instantiateStreaming==`function`)try{var m=fetch(u,{credentials:`same-origin`});return await WebAssembly.instantiateStreaming(m,c)}catch(c){E(`wasm streaming compile failed: ${c}`),E(`falling back to ArrayBuffer instantiation`)}return Kt(u,c)}class lt{name=`ExitStatus`;constructor(c){this.message=`Program terminated with exit(${c})`,this.status=c}}var ct=c=>{for(;0<c.length;)c.shift()(h)},oe=[],se=[],Xt=()=>{var c=h.preRun.shift();se.push(c)},le=!1,J=c=>(d(typeof c==`number`),`0x`+(c>>>0).toString(16).padStart(8,`0`)),O=c=>{O.M||={},O.M[c]||(O.M[c]=1,E(c))},de,fe=typeof TextDecoder<`u`?new TextDecoder:void 0,pt=(c,u=0,m=NaN)=>{var h=u+m;for(m=u;c[m]&&!(m>=h);)++m;if(16<m-u&&c.buffer&&fe)return fe.decode(c.subarray(u,m));for(h=``;u<m;){var g=c[u++];if(g&128){var v=c[u++]&63;if((g&224)==192)h+=String.fromCharCode((g&31)<<6|v);else{var y=c[u++]&63;(g&240)==224?g=(g&15)<<12|v<<6|y:((g&248)!=240&&O(`Invalid UTF-8 leading byte `+J(g)+` encountered when deserializing a UTF-8 string in wasm memory to a JS string!`),g=(g&7)<<18|v<<12|y<<6|c[u++]&63),65536>g?h+=String.fromCharCode(g):(g-=65536,h+=String.fromCharCode(55296|g>>10,56320|g&1023))}}else h+=String.fromCharCode(g)}return h},Y=(c,u)=>(d(typeof c==`number`,`UTF8ToString expects a number (got ${typeof c})`),c?pt(P,c,u):``),be=c=>(c=c.getArg(gt.__cpp_exception,0),en(c)),ht=c=>{var u=be(c);c=Ut();var m=Vt(4),h=Vt(4);if(tn(u,m,h),u=B[m>>2],h=B[h>>2],m=Y(u),xt(u),h){var g=Y(h);xt(h)}return Lt(c),[m,g]},x=c=>{if(c===null)return`null`;var u=typeof c;return u===`object`||u===`array`||u===`function`?c.toString():``+c},pe,_=c=>{for(var u=``;P[c];)u+=pe[P[c++]];return u},me={},ge={},ye={},De=h.BindingError=class extends Error{constructor(c){super(c),this.name=`BindingError`}},Qt=c=>{throw new De(c)};function Zt(c,u,m={}){var h=u.name;if(!c)throw new De(`type "${h}" must have a positive integer typeid pointer`);if(ge.hasOwnProperty(c)){if(m.V)return;throw new De(`Cannot register type '${h}' twice`)}ge[c]=u,delete ye[c],me.hasOwnProperty(c)&&(u=me[c],delete me[c],u.forEach(c=>c()))}function C(c,u,m={}){if(u.o===void 0)throw TypeError(`registerType registeredInstance requires argPackAdvance`);return Zt(c,u,m)}var yt=(c,u,m)=>{switch(u){case 1:return m?c=>N[c]:c=>P[c];case 2:return m?c=>I[c>>1]:c=>L[c>>1];case 4:return m?c=>z[c>>2]:c=>B[c>>2];case 8:return m?c=>H[c>>3]:c=>U[c>>3];default:throw TypeError(`invalid integer width (${u}): ${c}`)}},Re=c=>{throw new De(c.g.j.h.name+` instance already deleted`)},je=!1,vt=()=>{},wt=(c,u,m)=>u===m?c:m.m===void 0?null:(c=wt(c,u,m.m),c===null?null:m.R(c)),Me={},Pe={},tr=(c,u)=>{if(u===void 0)throw new De(`ptr should not be undefined`);for(;c.m;)u=c.H(u),c=c.m;return Pe[u]},Fe=h.InternalError=class extends Error{constructor(c){super(c),this.name=`InternalError`}},ve=(c,u)=>{if(!u.j||!u.i)throw new Fe(`makeClassHandle requires ptr and ptrType`);if(!!u.v!=!!u.l)throw new Fe(`Both smartPtrType and smartPtr must be specified`);return u.count={value:1},ue(Object.create(c,{g:{value:u,writable:!0}}))};function Tt(c){function t(){return this.K?ve(this.h.A,{j:this.Y,i:u,v:this,l:c}):ve(this.h.A,{j:this,i:c})}var u=this.U(c);if(!u)return this.N(c),null;var m=tr(this.h,u);if(m!==void 0)return m.g.count.value===0?(m.g.i=u,m.g.l=c,m.clone()):(m=m.clone(),this.N(c),m);if(m=this.h.T(u),m=Me[m],!m)return t.call(this);m=this.J?m.P:m.pointerType;var h=wt(u,this.h,m.h);return h===null?t.call(this):this.K?ve(m.h.A,{j:m,i:h,v:this,l:c}):ve(m.h.A,{j:m,i:h})}var ue=c=>typeof FinalizationRegistry>`u`?(ue=c=>c,c):(je=new FinalizationRegistry(c=>{console.warn(c.X),c=c.g,--c.count.value,c.count.value===0&&(c.l?c.v.B(c.l):c.j.h.B(c.i))}),ue=c=>{var u=c.g;if(u.l){var m={g:u};u=Error(`Embind found a leaked C++ instance ${u.j.h.name} <${J(u.i)}>.
2
2
  We'll free it automatically in this case, but this functionality is not reliable across various environments.
3
3
  Make sure to invoke .delete() manually once you're done with the instance instead.
4
4
  Originally allocated`),`captureStackTrace`in Error&&Error.captureStackTrace(u,Tt),m.X=u.stack.replace(/^Error: /,``),je.register(c,m,c)}return c},vt=c=>{je.unregister(c)},ue(c)),Ie=[];function we(){}var _e=(c,u)=>Object.defineProperty(u,"name",{value:c}),Et=(c,u,m)=>{if(c[u].u===void 0){var h=c[u];c[u]=function(...h){if(!c[u].u.hasOwnProperty(h.length))throw new De(`Function '${m}' called with an invalid number of arguments (${h.length}) - expects one of (${c[u].u})!`);return c[u].u[h.length].apply(this,h)},c[u].u=[],c[u].u[h.C]=h}},At=(c,u)=>{if(h.hasOwnProperty(c))throw new De(`Cannot register public name '${c}' twice`);h[c]=u,h[c].C=void 0},nr=c=>{d(typeof c==`string`),c=c.replace(/[^a-zA-Z0-9_]/g,`$`);var u=c.charCodeAt(0);return 48<=u&&57>=u?`_${c}`:c};function ir(c,u,m,h,g,v,y,S){this.name=c,this.constructor=u,this.A=m,this.B=h,this.m=g,this.T=v,this.H=y,this.R=S,this.Z=[]}var Te=(c,u,m)=>{for(;u!==m;){if(!u.H)throw new De(`Expected null or instance of ${m.name}, got an instance of ${u.name}`);c=u.H(c),u=u.m}return c};function or(c,u){if(u===null){if(this.L)throw new De(`null is not a valid ${this.name}`);return 0}if(!u.g)throw new De(`Cannot pass "${x(u)}" as a ${this.name}`);if(!u.g.i)throw new De(`Cannot pass deleted object as a pointer of type ${this.name}`);return Te(u.g.i,u.g.j.h,this.h)}function ar(c,u){if(u===null){if(this.L)throw new De(`null is not a valid ${this.name}`);if(this.K){var m=this.$();return c!==null&&c.push(this.B,m),m}return 0}if(!u||!u.g)throw new De(`Cannot pass "${x(u)}" as a ${this.name}`);if(!u.g.i)throw new De(`Cannot pass deleted object as a pointer of type ${this.name}`);if(!this.J&&u.g.j.J)throw new De(`Cannot convert argument of type ${u.g.v?u.g.v.name:u.g.j.name} to parameter type ${this.name}`);if(m=Te(u.g.i,u.g.j.h,this.h),this.K){if(u.g.l===void 0)throw new De(`Passing raw pointer to smart pointer is illegal`);switch(this.ba){case 0:if(u.g.v===this)m=u.g.l;else throw new De(`Cannot convert argument of type ${u.g.v?u.g.v.name:u.g.j.name} to parameter type ${this.name}`);break;case 1:m=u.g.l;break;case 2:if(u.g.v===this)m=u.g.l;else{var h=u.clone();m=this.aa(m,Se(()=>h.delete())),c!==null&&c.push(this.B,m)}break;default:throw new De(`Unsupporting sharing policy`)}}return m}function sr(c,u){if(u===null){if(this.L)throw new De(`null is not a valid ${this.name}`);return 0}if(!u.g)throw new De(`Cannot pass "${x(u)}" as a ${this.name}`);if(!u.g.i)throw new De(`Cannot pass deleted object as a pointer of type ${this.name}`);if(u.g.j.J)throw new De(`Cannot convert argument of type ${u.g.j.name} to parameter type ${this.name}`);return Te(u.g.i,u.g.j.h,this.h)}function Ee(c){return this.fromWireType(B[c>>2])}function Ae(c,u,m,h,g,v,y,S,w,T,E){this.name=c,this.h=u,this.L=m,this.J=h,this.K=g,this.Y=v,this.ba=y,this.O=S,this.$=w,this.aa=T,this.B=E,g||u.m!==void 0?this.toWireType=ar:(this.toWireType=h?or:sr,this.s=null)}var ur=(c,u)=>{if(!h.hasOwnProperty(c))throw new Fe(`Replacing nonexistent public symbol`);h[c]=u,h[c].C=void 0},Le=[],b=(c,u,m=!1)=>{if(d(!m,`Async bindings are only supported with JSPI.`),c=_(c),(m=Le[u])||(Le[u]=m=de.get(u)),d(de.get(u)==m,`JavaScript-side Wasm function table mirror is out of date!`),typeof m!=`function`)throw new De(`unknown function pointer with signature ${c}: ${u}`);return m};class lr extends Error{}var Ct=c=>{c=_t(c);var u=_(c);return xt(c),u},q=(c,u)=>{function r(c){h[c]||ge[c]||(ye[c]?ye[c].forEach(r):(m.push(c),h[c]=!0))}var m=[],h={};throw u.forEach(r),new lr(`${c}: `+m.map(Ct).join([`, `]))},R=(c,u,m)=>{function n(u){if(u=m(u),u.length!==c.length)throw new Fe(`Mismatched type converter count`);for(var h=0;h<c.length;++h)C(c[h],u[h])}c.forEach(c=>ye[c]=u);var h=Array(u.length),g=[],v=0;u.forEach((c,u)=>{ge.hasOwnProperty(c)?h[u]=ge[c]:(g.push(c),me.hasOwnProperty(c)||(me[c]=[]),me[c].push(()=>{h[u]=ge[c],++v,v===g.length&&n(h)}))}),g.length===0&&n(h)},ke=c=>{for(;c.length;){var u=c.pop();c.pop()(u)}};function $t(c){for(var u=1;u<c.length;++u)if(c[u]!==null&&c[u].s===void 0)return!0;return!1}function cr(c,u,m,h,g){(c<u||c>m)&&g(`function ${h} called with ${c} arguments, expected ${u==m?u:`${u} to ${m}`}`)}function Oe(c,u,m,h,g,v){var y=u.length;if(2>y)throw new De(`argTypes array size mismatch! Must at least get return value and 'this' types!`);d(!v,`Async bindings are only supported with JSPI.`);var S=u[1]!==null&&m!==null,w=$t(u);m=u[0].name!==`void`;for(var T=y-2,E=u.length-2,D=u.length-1;2<=D&&u[D].optional;--D)E--;for(h=[c,Qt,h,g,ke,u[0],u[1]],g=0;g<y-2;++g)h.push(u[g+2]);if(!w)for(g=S?1:2;g<u.length;++g)u[g].s!==null&&h.push(u[g].s);for(h.push(cr,E,T),w=$t(u),T=u.length-2,E=[],g=[`fn`],S&&g.push(`thisWired`),y=0;y<T;++y)E.push(`arg${y}`),g.push(`arg${y}Wired`);E=E.join(`,`),g=g.join(`,`),E=`return function (${E}) {
@@ -0,0 +1,47 @@
1
+ import"./rolldown-runtime-B8BYMn-z.js";import{c as e,o as t,r as n}from"./vendor-NJP34MHU.js";import{i as r}from"./translator-Dvvasoz-.js";import{cn as i,dn as a,fn as o,ln as s,on as c,pn as l,sn as u,un as d}from"./bridgeInstance-BPwbITOf.js";import{f,w as p}from"./moddle-CGpeSs3G.js";import{f as m,l as h,o as g,p as _,u as v}from"./ui-TBzvKaKQ.js";import{d as y,l as b}from"./files-Chpd_QD0.js";var x=[`bpmn`,`dmn`,`form`],S={bpmn:`.bpmn`,dmn:`.dmn`,form:`.form`};function familyOf(e){let t=f(e);return t===`camunda-7`||t===`operaton`||t===`cib-seven`?t:flowableOf(e)?`camunda-7`:`camunda-8`}function identifier(e,t){let n=e.replace(/\.[^.]+$/,``).replace(/[^A-Za-z0-9_.-]+/g,`_`).replace(/^[^A-Za-z_]+/,``);return n?`${t}_${n}`:`${t}_1`}function escapeXml(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}function emptyProcess(e,t){let n=a(e),r=identifier(t,`Process`);return`<?xml version="1.0" encoding="UTF-8"?>
2
+ <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" ${n.namespaces} xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" modeler:executionPlatform="${n.name}" modeler:executionPlatformVersion="${n.version}">
3
+ <bpmn:process id="${r}" name="${escapeXml(t.replace(/\.[^.]+$/,``))}" isExecutable="true"${u(e).process}>
4
+ <bpmn:startEvent id="StartEvent_1" />
5
+ </bpmn:process>
6
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
7
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="${r}">
8
+ <bpmndi:BPMNShape id="StartEvent_1_di" bpmnElement="StartEvent_1">
9
+ <dc:Bounds x="182" y="102" width="36" height="36" />
10
+ </bpmndi:BPMNShape>
11
+ </bpmndi:BPMNPlane>
12
+ </bpmndi:BPMNDiagram>
13
+ </bpmn:definitions>
14
+ `}function emptyDecision(e,t){let n=a(e),r=identifier(t,`Decision`),i=escapeXml(t.replace(/\.[^.]+$/,``)),o=l(e);return`<?xml version="1.0" encoding="UTF-8"?>
15
+ <definitions xmlns="https://www.omg.org/spec/DMN/20191111/MODEL/" xmlns:dmndi="https://www.omg.org/spec/DMN/20191111/DMNDI/" xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/"${o.namespace} xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1" name="${i}" namespace="${s(e)}" modeler:executionPlatform="${n.name}" modeler:executionPlatformVersion="${n.version}">
16
+ <decision id="${r}" name="${i}"${o.attribute}>
17
+ <decisionTable id="DecisionTable_1">
18
+ <input id="Input_1">
19
+ <inputExpression id="InputExpression_1" typeRef="string">
20
+ <text></text>
21
+ </inputExpression>
22
+ </input>
23
+ <output id="Output_1" typeRef="string" />
24
+ </decisionTable>
25
+ </decision>
26
+ <dmndi:DMNDI>
27
+ <dmndi:DMNDiagram id="DMNDiagram_1">
28
+ <dmndi:DMNShape id="DMNShape_1" dmnElementRef="${r}">
29
+ <dc:Bounds height="80" width="180" x="160" y="100" />
30
+ </dmndi:DMNShape>
31
+ </dmndi:DMNDiagram>
32
+ </dmndi:DMNDI>
33
+ </definitions>
34
+ `}function emptyForm(e,t){let n=a(e);return`${JSON.stringify({components:[],type:`default`,id:identifier(t,`Form`),executionPlatform:n.name,executionPlatformVersion:n.version,schemaVersion:18},null,2)}\n`}function flowableOf(e){let t=f(e);return t===`flowable`||t===`activiti`?t:null}function emptyFlowableProcess(e,t){let n=identifier(t,`Process`);return`<?xml version="1.0" encoding="UTF-8"?>
35
+ <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:${e}="${p[e]}" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn">
36
+ <bpmn:process id="${n}" name="${escapeXml(t.replace(/\.[^.]+$/,``))}" isExecutable="true">
37
+ <bpmn:startEvent id="StartEvent_1" />
38
+ </bpmn:process>
39
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
40
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="${n}">
41
+ <bpmndi:BPMNShape id="StartEvent_1_di" bpmnElement="StartEvent_1">
42
+ <dc:Bounds x="182" y="102" width="36" height="36" />
43
+ </bpmndi:BPMNShape>
44
+ </bpmndi:BPMNPlane>
45
+ </bpmndi:BPMNDiagram>
46
+ </bpmn:definitions>
47
+ `}function newFileContent(e,t,n,r){let a=flowableOf(n);if(a&&e===`bpmn`)return t===`example`?c(a):emptyFlowableProcess(a,r);let s=familyOf(n);return t===`example`?e===`bpmn`?o(s):e===`dmn`?i(s):d(s):e===`bpmn`?emptyProcess(s,r):e===`dmn`?emptyDecision(s,r):emptyForm(s,r)}function relativeOf(e){let t=e.name.trim(),n=S[e.kind],r=t.toLowerCase().endsWith(n)?t:`${t}${n}`,i=b(e.folder.trim()).replace(/^\/+|\/+$/g,``);return i?`${i}/${r}`:r}function problemWith(e,t){let n=e.name.trim();if(n===``)return`name-empty`;if(/[\\/\0:*?"<>|]/.test(n)||n===`.`||n===`..`)return`name-characters`;let r=e.folder.trim();if(r!==``&&y(r)===null)return`folder-outside`;let i=relativeOf(e);return t.some(e=>e.rel.toLowerCase()===i.toLowerCase())?`exists`:null}function defaultFolder(e,t){let n=new Map;for(let r of t){if(r.kind!==e)continue;let t=r.rel.lastIndexOf(`/`),i=t<0?``:r.rel.slice(0,t);n.set(i,(n.get(i)??0)+1)}let r=``,i=0;for(let[e,t]of n)t>i&&(r=e,i=t);return r}function describe(e){switch(e){case`name-empty`:return r(`app.web.newFile.nameEmpty`);case`name-characters`:return r(`app.web.newFile.nameCharacters`);case`folder-outside`:return r(`app.web.newFile.folderOutside`);default:return r(`app.web.newFile.exists`)}}function NewFileDialog({files:i,engine:a,initialKind:o=`bpmn`,initialFolder:s,onCreate:c,onClose:l}){let[u,d]=e(o),[f,p]=e(`empty`),[y,b]=e(``),[C,w]=e(()=>s??defaultFolder(o,i)),[T,E]=e(s!==void 0),[D,O]=e(!1),[k,A]=e(null),j=g(),M={kind:u,content:f,name:y,folder:C},N=t(()=>problemWith(M,i),[u,y,C,i]),P=N===`name-empty`||N===`name-characters`||N===`exists`?N:null,F=N===`folder-outside`?N:null,pickKind=e=>{d(e),T||w(defaultFolder(e,i))},create=async()=>{if(j.submit(),N)requestAnimationFrame(()=>document.querySelector(`.ui-dialog [aria-invalid="true"]`)?.focus());else{O(!0),A(null);try{await c(relativeOf(M),newFileContent(u,f,a,y.trim())),l()}catch(e){A(r(`app.web.newFile.failed`,{reason:e instanceof Error?e.message:String(e)})),O(!1)}}};return n(m,{title:r(`app.web.newFile.title`),size:`medium`,onClose:l,onSubmit:()=>void create(),footer:n(_,{actions:[{id:`cancel`,label:r(`app.common.cancel`),role:`cancel`,onClick:l,disabled:D},{id:`create`,label:r(`app.web.newFile.create`),role:`primary`,onClick:()=>void create(),busy:D}]}),children:[n(h,{label:r(`app.web.newFile.type`),children:e=>n(`select`,{...e,value:u,onChange:e=>pickKind(e.target.value),children:x.map(e=>n(`option`,{value:e,children:r(`app.web.newFile.kind.${e}`)},e))})}),n(h,{label:r(`app.web.newFile.content`),children:e=>n(`select`,{...e,value:f,onChange:e=>p(e.target.value),children:[n(`option`,{value:`empty`,children:r(`app.web.newFile.empty`)}),n(`option`,{value:`example`,children:r(`app.web.newFile.example`)})]})}),n(h,{label:r(`app.web.newFile.name`),hint:r(`app.web.newFile.nameHint`,{extension:S[u]}),error:j.errorOf(`name`,P&&describe(P)),children:e=>n(`input`,{...e,value:y,spellcheck:!1,autocomplete:`off`,onInput:e=>b(e.target.value),onBlur:()=>j.touch(`name`)})}),n(h,{label:r(`app.web.newFile.folder`),optional:!0,hint:r(`app.web.newFile.folderHint`),error:j.errorOf(`folder`,F&&describe(F)),children:e=>n(`input`,{...e,value:C,spellcheck:!1,autocomplete:`off`,onInput:e=>{E(!0),w(e.target.value)},onBlur:()=>j.touch(`folder`)})}),k&&n(v,{children:k})]})}export{NewFileDialog};
@@ -1 +1 @@
1
- import"./rolldown-runtime-B8BYMn-z.js";import{c as e,h as t,i as n,o as r,r as i,s as a,u as o}from"./vendor-NJP34MHU.js";import{i as s}from"./translator-CS9eR0My.js";import{G as c,K as l,f as u}from"./web-BtxFF0jJ.js";var d=-.005,f=-.005,p=-.01,m=1,h=2,g=512;function bonusAt(e,t){if(t===0)return .8;let n=e[t-1];if(n===`/`)return .9;if(n===`-`||n===`_`||n===` `)return .8;if(n===`.`)return .6;let r=e[t];return n>=`a`&&n<=`z`&&r>=`A`&&r<=`Z`?.7:0}function subsequence(e,t){let n=0;for(let r=0;r<t.length&&n<e.length;r+=1)t[r]===e[n]&&(n+=1);return n===e.length}function fuzzy(e,t){let n=e.toLowerCase(),r=n.length;if(r===0)return{score:0,positions:[]};let i=t.length>g?t.slice(t.length-g):t,a=i.toLowerCase(),o=a.length;if(r>o||!subsequence(n,a))return null;let s=new Float64Array(o);for(let e=0;e<o;e+=1)s[e]=bonusAt(i,e);let c=[],l=[];for(let e=0;e<r;e+=1){let t=new Float64Array(o).fill(-1/0),i=new Float64Array(o).fill(-1/0),u=-1/0,h=e===r-1?f:p;for(let r=0;r<o;r+=1){if(n[e]===a[r]){let n=-1/0;e===0?n=r*d+s[r]:r>0&&(n=Math.max(l[e-1][r-1]+s[r],c[e-1][r-1]+m)),t[r]=n,u=Math.max(n,u+h)}else u+=h;i[r]=u}c.push(t),l.push(i)}let u=Array(r).fill(0),h=!1;for(let e=r-1,t=o-1;e>=0;--e)for(;t>=0;--t)if(c[e][t]!==-1/0&&(h||c[e][t]===l[e][t])){h=e>0&&t>0&&l[e][t]===c[e-1][t-1]+m,u[e]=t,--t;break}let _=t.length-i.length;return{score:l[r-1][o-1],positions:u.map(e=>e+_)}}function rankFiles(e,t,n=[]){let r=t.trim().split(/\s+/).filter(Boolean),i=new Map(n.map((e,t)=>[e,n.length-t]));if(r.length===0){let t=e.filter(e=>i.has(e.rel)).sort((e,t)=>(i.get(t.rel)??0)-(i.get(e.rel)??0)),n=e.filter(e=>!i.has(e.rel)).sort((e,t)=>e.rel.localeCompare(t.rel,void 0,{numeric:!0,sensitivity:`base`}));return[...t,...n].map(e=>({file:e,score:0,positions:[]}))}let a=[];for(let t of e){let e=0,n=[],o=t.rel.length-t.name.length,s=!0;for(let i of r){let r=fuzzy(i,t.rel);if(!r){s=!1;break}e+=r.score+(r.positions.every(e=>e>=o)?h:0),n.push(...r.positions)}s&&a.push({file:t,score:e+(i.get(t.rel)??0)*.001,positions:[...new Set(n)].sort((e,t)=>e-t)})}return a.sort((e,t)=>t.score-e.score||e.file.rel.length-t.file.rel.length||e.file.rel.localeCompare(t.file.rel))}function rangesOf(e,t,n){let r=[];for(let i of e){if(i<t||i>=n)continue;let e=i-t,a=r[r.length-1];a&&a[1]===e?a[1]=e+1:r.push([e,e+1])}return r}function useModal(e,t){a(()=>{let n=e.current;if(!n)return;let r=t??(document.activeElement instanceof HTMLElement?document.activeElement:null),i=[],a=n,o=0;for(;a&&a.parentElement&&o<50;){o+=1;let e=a.parentElement;for(let t of Array.from(e.children))t===a||t.hasAttribute(`inert`)||(t.setAttribute(`inert`,``),i.push(t));a=e}return()=>{i.forEach(e=>e.removeAttribute(`inert`));let e=document.activeElement,t=e!==null&&n.contains(e),a=e===null||e===document.body||!document.contains(e);if((t||a)&&r?.isConnected)try{r.focus()}catch{}}},[])}var _=6,v=336,y=`web-quick-list`;function rowsFor(e,t,n,r,i){if(e.startsWith(`>`)){let t=e.slice(1).trim();return i.map(e=>({command:e,found:t===``?{score:0,positions:[]}:fuzzy(t,e.title)})).filter(e=>e.found!==null).sort((e,t)=>t.found.score-e.found.score).map(e=>({type:`command`,id:`c:${e.command.id}`,command:e.command,positions:e.found.positions}))}let a=rankFiles(t,e,n),o=[],c=new Set(n),l=null;for(let t of a){if(e.trim()===``){let e=c.has(t.file.rel)?`recent`:`files`;e!==l&&(l=e,(e===`recent`||a.some(e=>c.has(e.file.rel)))&&o.push({type:`heading`,id:`h:${e}`,text:s(e===`recent`?`app.web.quick.recent`:`app.web.quick.files`)}))}o.push({type:`file`,id:`p:${t.file.path}`,file:t.file,positions:t.positions,open:r.has(t.file.path)})}return o}function windowOf(e,t,n){return{start:Math.max(0,Math.floor(e/28)-_),end:Math.min(n,Math.ceil((e+t)/28)+_)}}function Marked({text:e,ranges:n}){if(n.length===0)return i(t,{children:e});let r=[],a=0;return n.forEach(([n,o])=>{n>a&&r.push(i(t,{children:e.slice(a,n)})),r.push(i(`span`,{class:`palette__match`,children:e.slice(n,o)})),a=o}),a<e.length&&r.push(i(t,{children:e.slice(a)})),i(t,{children:r})}function selectable(e){return!!e&&e.type!==`heading`}function stepIndex(e,t,n){let r=t;for(let i=0;i<e.length;i+=1){if(r+=n,r<0||r>=e.length)return t;if(selectable(e[r]))return r}return t}function QuickOpen({files:t,recent:d,open:f,commands:p,initial:m=``,side:h=!1,onPick:g,onRun:_,onClose:b}){let[x,S]=e(m),[C,w]=e(0),[T,E]=e(0),[D,O]=e(v),k=n(null),A=n(null),j=n(null);useModal(k);let M=r(()=>rowsFor(x,t,d,f,p),[x,t,d,f,p]),N=x.startsWith(`>`);o(()=>{let e=M.findIndex(selectable);w(e<0?0:e),E(0),A.current&&(A.current.scrollTop=0)},[x,M.length]),a(()=>{let e=A.current;if(!e)return;let measure=()=>O(e.clientHeight||v);if(measure(),typeof ResizeObserver>`u`)return;let t=new ResizeObserver(measure);return t.observe(e),()=>t.disconnect()},[]),o(()=>{j.current?.focus(),j.current?.setSelectionRange(m.length,m.length)},[]);let reveal=e=>{let t=A.current;if(!t)return;let n=e*28,r=t.clientHeight||v;n<t.scrollTop?t.scrollTop=n:n+28>t.scrollTop+r&&(t.scrollTop=n+28-r),E(t.scrollTop)},go=e=>{w(e),reveal(e)},choose=(e,t)=>{e&&(e.type===`file`?g(e.file,t||h):e.type===`command`&&_(e.command))},P=Math.max(1,Math.floor((A.current?.clientHeight||v)/28)-1),keys=e=>{if(e.key===`Escape`)e.preventDefault(),e.stopPropagation(),b();else if(e.key===`ArrowDown`)e.preventDefault(),go(stepIndex(M,C,1));else if(e.key===`ArrowUp`)e.preventDefault(),go(stepIndex(M,C,-1));else if(e.key===`PageDown`||e.key===`PageUp`){e.preventDefault();let t=C;for(let n=0;n<P;n+=1)t=stepIndex(M,t,e.key===`PageDown`?1:-1);go(t)}else if(e.key===`Home`&&e.ctrlKey)e.preventDefault(),go(Math.max(0,M.findIndex(selectable)));else if(e.key===`End`&&e.ctrlKey){e.preventDefault();for(let e=M.length-1;e>=0;--e)if(selectable(M[e])){go(e);break}}else e.key===`Enter`?(e.preventDefault(),choose(M[C],e.ctrlKey||e.metaKey)):e.key===`Tab`&&e.preventDefault()},{start:F,end:I}=windowOf(T,D,M.length),L=M[C],R=r(()=>{let e=0;return M.map(t=>selectable(t)?e+=1:e)},[M]),z=R.length>0?R[R.length-1]:0,position=e=>R[e]??0;return i(`div`,{ref:k,class:`palette-overlay web-quick`,onMouseDown:e=>{e.target===e.currentTarget&&b()},children:i(`div`,{class:`palette`,role:`dialog`,"aria-modal":`true`,"aria-label":s(N?`app.web.quick.commandsLabel`:`app.web.quick.label`),children:[i(`input`,{ref:j,class:`palette__field`,type:`text`,role:`combobox`,"aria-expanded":`true`,"aria-controls":y,"aria-autocomplete":`list`,"aria-activedescendant":L&&selectable(L)?`web-quick-${C}`:void 0,"aria-describedby":`web-quick-hint`,placeholder:s(h?`app.web.quick.sidePlaceholder`:`app.web.quick.placeholder`),spellcheck:!1,autoComplete:`off`,value:x,onInput:e=>S(e.currentTarget.value),onKeyDown:keys}),i(`span`,{id:`web-quick-hint`,class:`palette__hint`,children:s(`app.web.quick.hint`)}),i(`ul`,{ref:A,id:y,class:`palette__list web-quick__list`,role:`listbox`,"aria-label":s(N?`app.web.quick.commandsLabel`:`app.web.quick.results`),onScroll:e=>E(e.currentTarget.scrollTop),children:[i(`li`,{role:`presentation`,class:`web-quick__canvas`,style:{height:`${M.length*28}px`},children:M.slice(F,I).map((e,t)=>{let n=F+t,r={top:`${n*28}px`};if(e.type===`heading`)return i(`div`,{class:`palette__heading web-quick__heading`,role:`presentation`,style:r,children:e.text},e.id);let a=n===C;if(e.type===`command`)return i(`div`,{id:`web-quick-${n}`,role:`option`,"aria-selected":a,"aria-setsize":z,"aria-posinset":position(n),class:`palette__row web-quick__row${a?` is-active`:``}`,style:r,onMouseMove:()=>!a&&w(n),onClick:()=>choose(e,!1),children:[i(`span`,{class:`palette__title`,children:i(Marked,{text:e.command.title,ranges:rangesOf(e.positions,0,e.command.title.length)})}),e.command.keys&&i(`span`,{class:`palette__shortcut`,children:e.command.keys})]},e.id);let o=e.file.rel.length-e.file.name.length,d=e.file.rel.slice(0,Math.max(0,o-1));return i(`div`,{id:`web-quick-${n}`,role:`option`,"aria-selected":a,"aria-setsize":z,"aria-posinset":position(n),"aria-label":e.open?s(`app.web.quick.openFile`,{path:e.file.rel}):e.file.rel,title:e.file.rel,class:`palette__row web-quick__row${a?` is-active`:``}`,style:r,onMouseMove:()=>!a&&w(n),onClick:()=>choose(e,!1),children:[i(`span`,{class:`palette__icon web-quick__icon`,children:i(c,{name:l(u(e.file.kind))})}),i(`span`,{class:`palette__title`,children:i(Marked,{text:e.file.name,ranges:rangesOf(e.positions,o,e.file.rel.length)})}),d&&i(`span`,{class:`palette__section web-quick__folder`,children:i(Marked,{text:d,ranges:rangesOf(e.positions,0,d.length)})}),e.open&&i(`span`,{class:`palette__shortcut`,children:s(`app.web.quick.opened`)})]},e.id)})}),M.length===0&&i(`li`,{class:`palette__empty`,role:`presentation`,children:N?s(`app.web.quick.noCommands`):t.length===0?s(`app.web.quick.noFiles`):s(`app.web.quick.noMatch`,{query:x.trim()})})]})]})})}export{QuickOpen};
1
+ import"./rolldown-runtime-B8BYMn-z.js";import{c as e,h as t,i as n,o as r,r as i,s as a,u as o}from"./vendor-NJP34MHU.js";import{i as s}from"./translator-Dvvasoz-.js";import{G as c,K as l,f as u}from"./web-qJCedJJw.js";var d=-.005,f=-.005,p=-.01,m=1,h=2,g=512;function bonusAt(e,t){if(t===0)return .8;let n=e[t-1];if(n===`/`)return .9;if(n===`-`||n===`_`||n===` `)return .8;if(n===`.`)return .6;let r=e[t];return n>=`a`&&n<=`z`&&r>=`A`&&r<=`Z`?.7:0}function subsequence(e,t){let n=0;for(let r=0;r<t.length&&n<e.length;r+=1)t[r]===e[n]&&(n+=1);return n===e.length}function fuzzy(e,t){let n=e.toLowerCase(),r=n.length;if(r===0)return{score:0,positions:[]};let i=t.length>g?t.slice(t.length-g):t,a=i.toLowerCase(),o=a.length;if(r>o||!subsequence(n,a))return null;let s=new Float64Array(o);for(let e=0;e<o;e+=1)s[e]=bonusAt(i,e);let c=[],l=[];for(let e=0;e<r;e+=1){let t=new Float64Array(o).fill(-1/0),i=new Float64Array(o).fill(-1/0),u=-1/0,h=e===r-1?f:p;for(let r=0;r<o;r+=1){if(n[e]===a[r]){let n=-1/0;e===0?n=r*d+s[r]:r>0&&(n=Math.max(l[e-1][r-1]+s[r],c[e-1][r-1]+m)),t[r]=n,u=Math.max(n,u+h)}else u+=h;i[r]=u}c.push(t),l.push(i)}let u=Array(r).fill(0),h=!1;for(let e=r-1,t=o-1;e>=0;--e)for(;t>=0;--t)if(c[e][t]!==-1/0&&(h||c[e][t]===l[e][t])){h=e>0&&t>0&&l[e][t]===c[e-1][t-1]+m,u[e]=t,--t;break}let _=t.length-i.length;return{score:l[r-1][o-1],positions:u.map(e=>e+_)}}function rankFiles(e,t,n=[]){let r=t.trim().split(/\s+/).filter(Boolean),i=new Map(n.map((e,t)=>[e,n.length-t]));if(r.length===0){let t=e.filter(e=>i.has(e.rel)).sort((e,t)=>(i.get(t.rel)??0)-(i.get(e.rel)??0)),n=e.filter(e=>!i.has(e.rel)).sort((e,t)=>e.rel.localeCompare(t.rel,void 0,{numeric:!0,sensitivity:`base`}));return[...t,...n].map(e=>({file:e,score:0,positions:[]}))}let a=[];for(let t of e){let e=0,n=[],o=t.rel.length-t.name.length,s=!0;for(let i of r){let r=fuzzy(i,t.rel);if(!r){s=!1;break}e+=r.score+(r.positions.every(e=>e>=o)?h:0),n.push(...r.positions)}s&&a.push({file:t,score:e+(i.get(t.rel)??0)*.001,positions:[...new Set(n)].sort((e,t)=>e-t)})}return a.sort((e,t)=>t.score-e.score||e.file.rel.length-t.file.rel.length||e.file.rel.localeCompare(t.file.rel))}function rangesOf(e,t,n){let r=[];for(let i of e){if(i<t||i>=n)continue;let e=i-t,a=r[r.length-1];a&&a[1]===e?a[1]=e+1:r.push([e,e+1])}return r}function useModal(e,t){a(()=>{let n=e.current;if(!n)return;let r=t??(document.activeElement instanceof HTMLElement?document.activeElement:null),i=[],a=n,o=0;for(;a&&a.parentElement&&o<50;){o+=1;let e=a.parentElement;for(let t of Array.from(e.children))t===a||t.hasAttribute(`inert`)||(t.setAttribute(`inert`,``),i.push(t));a=e}return()=>{i.forEach(e=>e.removeAttribute(`inert`));let e=document.activeElement,t=e!==null&&n.contains(e),a=e===null||e===document.body||!document.contains(e);if((t||a)&&r?.isConnected)try{r.focus()}catch{}}},[])}var _=6,v=336,y=`web-quick-list`;function rowsFor(e,t,n,r,i){if(e.startsWith(`>`)){let t=e.slice(1).trim();return i.map(e=>({command:e,found:t===``?{score:0,positions:[]}:fuzzy(t,e.title)})).filter(e=>e.found!==null).sort((e,t)=>t.found.score-e.found.score).map(e=>({type:`command`,id:`c:${e.command.id}`,command:e.command,positions:e.found.positions}))}let a=rankFiles(t,e,n),o=[],c=new Set(n),l=null;for(let t of a){if(e.trim()===``){let e=c.has(t.file.rel)?`recent`:`files`;e!==l&&(l=e,(e===`recent`||a.some(e=>c.has(e.file.rel)))&&o.push({type:`heading`,id:`h:${e}`,text:s(e===`recent`?`app.web.quick.recent`:`app.web.quick.files`)}))}o.push({type:`file`,id:`p:${t.file.path}`,file:t.file,positions:t.positions,open:r.has(t.file.path)})}return o}function windowOf(e,t,n){return{start:Math.max(0,Math.floor(e/28)-_),end:Math.min(n,Math.ceil((e+t)/28)+_)}}function Marked({text:e,ranges:n}){if(n.length===0)return i(t,{children:e});let r=[],a=0;return n.forEach(([n,o])=>{n>a&&r.push(i(t,{children:e.slice(a,n)})),r.push(i(`span`,{class:`palette__match`,children:e.slice(n,o)})),a=o}),a<e.length&&r.push(i(t,{children:e.slice(a)})),i(t,{children:r})}function selectable(e){return!!e&&e.type!==`heading`}function stepIndex(e,t,n){let r=t;for(let i=0;i<e.length;i+=1){if(r+=n,r<0||r>=e.length)return t;if(selectable(e[r]))return r}return t}function QuickOpen({files:t,recent:d,open:f,commands:p,initial:m=``,side:h=!1,onPick:g,onRun:_,onClose:b}){let[x,S]=e(m),[C,w]=e(0),[T,E]=e(0),[D,O]=e(v),k=n(null),A=n(null),j=n(null);useModal(k);let M=r(()=>rowsFor(x,t,d,f,p),[x,t,d,f,p]),N=x.startsWith(`>`);o(()=>{let e=M.findIndex(selectable);w(e<0?0:e),E(0),A.current&&(A.current.scrollTop=0)},[x,M.length]),a(()=>{let e=A.current;if(!e)return;let measure=()=>O(e.clientHeight||v);if(measure(),typeof ResizeObserver>`u`)return;let t=new ResizeObserver(measure);return t.observe(e),()=>t.disconnect()},[]),o(()=>{j.current?.focus(),j.current?.setSelectionRange(m.length,m.length)},[]);let reveal=e=>{let t=A.current;if(!t)return;let n=e*28,r=t.clientHeight||v;n<t.scrollTop?t.scrollTop=n:n+28>t.scrollTop+r&&(t.scrollTop=n+28-r),E(t.scrollTop)},go=e=>{w(e),reveal(e)},choose=(e,t)=>{e&&(e.type===`file`?g(e.file,t||h):e.type===`command`&&_(e.command))},P=Math.max(1,Math.floor((A.current?.clientHeight||v)/28)-1),keys=e=>{if(e.key===`Escape`)e.preventDefault(),e.stopPropagation(),b();else if(e.key===`ArrowDown`)e.preventDefault(),go(stepIndex(M,C,1));else if(e.key===`ArrowUp`)e.preventDefault(),go(stepIndex(M,C,-1));else if(e.key===`PageDown`||e.key===`PageUp`){e.preventDefault();let t=C;for(let n=0;n<P;n+=1)t=stepIndex(M,t,e.key===`PageDown`?1:-1);go(t)}else if(e.key===`Home`&&e.ctrlKey)e.preventDefault(),go(Math.max(0,M.findIndex(selectable)));else if(e.key===`End`&&e.ctrlKey){e.preventDefault();for(let e=M.length-1;e>=0;--e)if(selectable(M[e])){go(e);break}}else e.key===`Enter`?(e.preventDefault(),choose(M[C],e.ctrlKey||e.metaKey)):e.key===`Tab`&&e.preventDefault()},{start:F,end:I}=windowOf(T,D,M.length),L=M[C],R=r(()=>{let e=0;return M.map(t=>selectable(t)?e+=1:e)},[M]),z=R.length>0?R[R.length-1]:0,position=e=>R[e]??0;return i(`div`,{ref:k,class:`palette-overlay web-quick`,onMouseDown:e=>{e.target===e.currentTarget&&b()},children:i(`div`,{class:`palette`,role:`dialog`,"aria-modal":`true`,"aria-label":s(N?`app.web.quick.commandsLabel`:`app.web.quick.label`),children:[i(`input`,{ref:j,class:`palette__field`,type:`text`,role:`combobox`,"aria-expanded":`true`,"aria-controls":y,"aria-autocomplete":`list`,"aria-activedescendant":L&&selectable(L)?`web-quick-${C}`:void 0,"aria-describedby":`web-quick-hint`,placeholder:s(h?`app.web.quick.sidePlaceholder`:`app.web.quick.placeholder`),spellcheck:!1,autoComplete:`off`,value:x,onInput:e=>S(e.currentTarget.value),onKeyDown:keys}),i(`span`,{id:`web-quick-hint`,class:`palette__hint`,children:s(`app.web.quick.hint`)}),i(`ul`,{ref:A,id:y,class:`palette__list web-quick__list`,role:`listbox`,"aria-label":s(N?`app.web.quick.commandsLabel`:`app.web.quick.results`),onScroll:e=>E(e.currentTarget.scrollTop),children:[i(`li`,{role:`presentation`,class:`web-quick__canvas`,style:{height:`${M.length*28}px`},children:M.slice(F,I).map((e,t)=>{let n=F+t,r={top:`${n*28}px`};if(e.type===`heading`)return i(`div`,{class:`palette__heading web-quick__heading`,role:`presentation`,style:r,children:e.text},e.id);let a=n===C;if(e.type===`command`)return i(`div`,{id:`web-quick-${n}`,role:`option`,"aria-selected":a,"aria-setsize":z,"aria-posinset":position(n),class:`palette__row web-quick__row${a?` is-active`:``}`,style:r,onMouseMove:()=>!a&&w(n),onClick:()=>choose(e,!1),children:[i(`span`,{class:`palette__title`,children:i(Marked,{text:e.command.title,ranges:rangesOf(e.positions,0,e.command.title.length)})}),e.command.keys&&i(`span`,{class:`palette__shortcut`,children:e.command.keys})]},e.id);let o=e.file.rel.length-e.file.name.length,d=e.file.rel.slice(0,Math.max(0,o-1));return i(`div`,{id:`web-quick-${n}`,role:`option`,"aria-selected":a,"aria-setsize":z,"aria-posinset":position(n),"aria-label":e.open?s(`app.web.quick.openFile`,{path:e.file.rel}):e.file.rel,title:e.file.rel,class:`palette__row web-quick__row${a?` is-active`:``}`,style:r,onMouseMove:()=>!a&&w(n),onClick:()=>choose(e,!1),children:[i(`span`,{class:`palette__icon web-quick__icon`,children:i(c,{name:l(u(e.file.kind))})}),i(`span`,{class:`palette__title`,children:i(Marked,{text:e.file.name,ranges:rangesOf(e.positions,o,e.file.rel.length)})}),d&&i(`span`,{class:`palette__section web-quick__folder`,children:i(Marked,{text:d,ranges:rangesOf(e.positions,0,d.length)})}),e.open&&i(`span`,{class:`palette__shortcut`,children:s(`app.web.quick.opened`)})]},e.id)})}),M.length===0&&i(`li`,{class:`palette__empty`,role:`presentation`,children:N?s(`app.web.quick.noCommands`):t.length===0?s(`app.web.quick.noFiles`):s(`app.web.quick.noMatch`,{query:x.trim()})})]})]})})}export{QuickOpen};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./run-Df8AD_as.js","./rolldown-runtime-B8BYMn-z.js","./translator-CS9eR0My.js","./preload-helper-VRuDKI9K.js","./samples-chRLnLcq.js","./engines-DG8KgTeX.js","./dist-CxyFqsL2.js","./dist-CRJyslwo.js","./dist-CHluRwHI.js","./dist-TNwbKIWT.js","./syntax-DBcQvmbn.js","./dist-CAxViutc.js","./dist-CsBP6QjA.js","./dist-DvFyMwGd.js","./ScriptRunDialog-DjBW0LRD.js","./vendor-NJP34MHU.js","./ui-AICOEtWR.js","./bridgeInstance-D0bzpNGz.js","./dist-DgvQWhKm.js","./engine-BPUfS3r2.js","./dist-BqwyxNP3.js","./dialog-DSf66Ory.js"])))=>i.map(i=>d[i]);
2
- import"./rolldown-runtime-B8BYMn-z.js";import{c as e,i as t,r as n,u as r}from"./vendor-NJP34MHU.js";import{i}from"./translator-CS9eR0My.js";import{t as a}from"./preload-helper-VRuDKI9K.js";import{t as o}from"./bridgeInstance-D0bzpNGz.js";import"./platform-BS7bgwr3.js";import{a as s}from"./httpHost-Cll6HteE.js";import{$ as c,I as l,J as u,Q as d,T as f,Tt as p,Y as m,Z as h,ht as g,l as _,lt as v,pt as y}from"./dist-CsBP6QjA.js";import{a as b,i as x,r as S}from"./dist-DvFyMwGd.js";import{r as C}from"./dist-DUkRqvKl.js";import{n as w}from"./dist-Km3QNqlU.js";import{d as T,q as E}from"./web-BtxFF0jJ.js";import{n as D,t as O}from"./syntax-DBcQvmbn.js";import{n as k,r as A,t as j}from"./source-frame-q4WXS_Md.js";var M={DOUBLE_EQUALS:`app.feel.problem.doubleEquals`,SPACED_NAME:`app.feel.problem.spacedName`,UNCLOSED_BRACKET:`app.feel.problem.unclosedBracket`,MISSING_ELSE:`app.feel.problem.missingElse`,ENDS_TOO_EARLY:`app.feel.problem.endsTooEarly`,UNEXPECTED_TOKEN:`app.feel.problem.unexpectedToken`,UNTERMINATED_STRING:`app.feel.problem.unterminatedString`,NOT_FEEL:`app.feel.problem.notFeel`};function feelProblemText(e){return i(M[e])}var N=[{name:`number`,parameters:[`from`,`grouping separator`,`decimal separator`]},{name:`string`,parameters:[`from`]},{name:`date`,parameters:[`year`,`month`,`day`,`from`]},{name:`date and time`,parameters:[`date`,`time`,`from`]},{name:`time`,parameters:[`hour`,`minute`,`second`,`offset`,`from`]},{name:`duration`,parameters:[`from`]},{name:`years and months duration`,parameters:[`from`,`to`]},{name:`now`,parameters:[]},{name:`today`,parameters:[]},{name:`not`,parameters:[`negand`]},{name:`substring`,parameters:[`string`,`start position`,`length`]},{name:`string length`,parameters:[`string`]},{name:`upper case`,parameters:[`string`]},{name:`lower case`,parameters:[`string`]},{name:`substring before`,parameters:[`string`,`match`]},{name:`substring after`,parameters:[`string`,`match`]},{name:`replace`,parameters:[`input`,`pattern`,`replacement`,`flags`]},{name:`contains`,parameters:[`string`,`match`]},{name:`matches`,parameters:[`input`,`pattern`,`flags`]},{name:`starts with`,parameters:[`string`,`match`]},{name:`ends with`,parameters:[`string`,`match`]},{name:`split`,parameters:[`string`,`delimiter`]},{name:`string join`,parameters:[`list`,`delimiter`]},{name:`list contains`,parameters:[`list`,`element`]},{name:`list replace`,parameters:[`list`,`position`,`newItem`,`match`]},{name:`count`,parameters:[`list`]},{name:`sublist`,parameters:[`list`,`start`,`length`]},{name:`append`,parameters:[`list`,`...item`]},{name:`concatenate`,parameters:[`...list`]},{name:`insert before`,parameters:[`list`,`position`,`newItem`]},{name:`remove`,parameters:[`list`,`position`]},{name:`reverse`,parameters:[`list`]},{name:`index of`,parameters:[`list`,`match`]},{name:`distinct values`,parameters:[`list`]},{name:`flatten`,parameters:[`list`]},{name:`decimal`,parameters:[`n`,`scale`]},{name:`floor`,parameters:[`n`,`scale`]},{name:`ceiling`,parameters:[`n`,`scale`]},{name:`abs`,parameters:[`n`]},{name:`round up`,parameters:[`n`,`scale`]},{name:`round down`,parameters:[`n`,`scale`]},{name:`round half up`,parameters:[`n`,`scale`]},{name:`round half down`,parameters:[`n`,`scale`]},{name:`modulo`,parameters:[`dividend`,`divisor`]},{name:`sqrt`,parameters:[`number`]},{name:`log`,parameters:[`number`]},{name:`exp`,parameters:[`number`]},{name:`odd`,parameters:[`number`]},{name:`even`,parameters:[`number`]},{name:`is`,parameters:[`value1`,`value2`]},{name:`before`,parameters:[`a`,`b`]},{name:`after`,parameters:[`a`,`b`]},{name:`meets`,parameters:[`range1`,`range2`]},{name:`met by`,parameters:[`range1`,`range2`]},{name:`overlaps`,parameters:[`range1`,`range2`]},{name:`includes`,parameters:[`range`,`value`]},{name:`day of year`,parameters:[`date`]},{name:`day of week`,parameters:[`date`]},{name:`month of year`,parameters:[`date`]},{name:`week of year`,parameters:[`date`]},{name:`sort`,parameters:[`list`,`precedes`]},{name:`get value`,parameters:[`m`,`key`]},{name:`get entries`,parameters:[`m`]},{name:`context put`,parameters:[`context`,`keys`,`value`,`key`]}],P=[`execution`,`task`],F={getVariable:`read`,getVariableTyped:`read`,hasVariable:`test`,setVariable:`write`,removeVariable:`remove`},I=RegExp(`\\b(?:${P.join(`|`)})\\s*\\.\\s*(${Object.keys(F).join(`|`)})\\s*\\(\\s*(["'])([^"'\\\\\\r\\n]+)\\2`,`g`),L=RegExp(`\\b(?:${P.join(`|`)})\\s*\\.\\s*(?:${Object.keys(F).join(`|`)})\\s*\\(\\s*(["'])[^"'\\\\\\r\\n]*$`);function isInsideVariableName(e){return L.test(e)}function scriptVariableReferences(e){return[...e.matchAll(I)].flatMap(e=>{let t=e[1],n=e[2],r=e[3],i=t===void 0?void 0:F[t];if(t===void 0||n===void 0||r===void 0||i===void 0)return[];let a=e.index+e[0].length-n.length;return[{name:r,start:a-r.length,end:a,access:i,method:t}]})}function feelNameAt(e,t){let n=D(e),r=n.findIndex(e=>e.start<=t&&t<e.end),i=n[r];if(!(!i||i.kind!==`name`&&i.kind!==`backtick_name`)&&n[r+1]?.kind!==`open_parenthesis`)return{name:i.kind===`backtick_name`?i.text.slice(1,-1):i.text,start:i.start,end:i.end}}function variableNamed(e,t){return e.find(e=>e.name===t)}function referenceAt(e,t){return scriptVariableReferences(e).find(e=>e.start<=t&&t<=e.end)}function variableAt(e,t,n,r){let i=e===`feel`?feelNameAt(t,n):referenceAt(t,n),a=i===void 0?void 0:variableNamed(r,i.name);return a&&i?{variable:a,start:i.start,end:i.end}:void 0}function placesOf(e){return e.writers.map(e=>e.label).join(`, `)}function setByText(e){return e.writers.length>0?i(`app.script.writers.set`,{places:placesOf(e)}):i(`app.script.writers.none`)}function variableCompletions(e){return e.map(e=>({name:e.name,detail:e.type??i(`app.script.completion.variable`),documentation:setByText(e)}))}function builtinCompletions(){return N.map(e=>({name:e.name,signature:`${e.name}(${e.parameters.join(`, `)})`}))}function completionsFor(e,t,n){if(e!==`feel`&&!isInsideVariableName(t))return[];let r=variableCompletions(n).map(e=>({name:e.name,kind:`variable`,detail:e.detail,documentation:e.documentation}));if(e!==`feel`)return r;let a=builtinCompletions().map(e=>({name:e.name,kind:`builtin`,detail:e.signature,documentation:i(`app.script.completion.builtin`)}));return[...r,...a]}function variableHover(e){return{name:e.name,typeLine:e.type?i(`app.script.typeLabel`,{type:e.type}):null,setBy:setByText(e)}}function contextSummary(e){if(e.length!==0)return i(`app.script.context.summary`,{names:e.map(e=>e.name).join(`, `)})}function feelDiagnostics(e){let t=O(e);if(!t)return[];let n={start:t.start,end:t.end,message:feelProblemText(t.problem)};return t.replacement!==void 0&&(n.replacement=t.replacement),[n]}async function engineFor(e,t){if(t===void 0)return{note:i(`app.feel.run.noEngine`)};let{connectedFeelTarget:n}=await a(async()=>{let{connectedFeelTarget:e}=await import(`./run-Df8AD_as.js`);return{connectedFeelTarget:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]),import.meta.url),r=await e.getDeployTargets(t),o=n(r.targets,r.active);if(o===void 0)return{note:i(`app.feel.run.noEngine`)};let s=o.profile??null;return{link:{kind:`CAMUNDA_8`,ask:n=>e.askEngine(s,n,t)}}}async function runFeelScript(e,t,n,r){let i=await a(()=>import(`./run-Df8AD_as.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]),import.meta.url),o=i.resolveSampleInputs(r);if(o.status===`failed`)return{status:`inputs`,message:o.message};try{let r=await engineFor(e,t);return{status:`report`,report:await i.runEvaluation(n,o.variables,r.link,r.link===void 0?r.note:void 0)}}catch(e){return{status:`report`,report:i.failureReport(await s(e))}}}var R=v.define(),z=/[\p{L}\p{N}_]*/u,B=/^[\p{L}\p{N}_]*$/u,V=g.transactionExtender.of(e=>e.annotation(R)?{annotations:p.addToHistory.of(!1)}:null);function scriptTabLanguageOf(e){return e===`feel`||e===`groovy`||e===`javascript`?e:null}async function scriptLanguageExtension(e){return e===`feel`?(await a(async()=>{let{feel:e}=await import(`./dist-CAxViutc.js`).then(e=>e.t);return{feel:e}},__vite__mapDeps([11,1,7,8,9,12,13]),import.meta.url)).feel():A(e)}function scriptBasics(){return[w,c(),m(),u(),_(),f(),x(),d.of(b)]}async function feelWords(e){let{keywordCompletions:t,snippets:n}=await a(async()=>{let{keywordCompletions:e,snippets:t}=await import(`./dist-CAxViutc.js`).then(e=>e.t);return{keywordCompletions:e,snippets:t}},__vite__mapDeps([11,1,7,8,9,12,13]),import.meta.url);return[...(await Promise.all(t.map(t=>t(e)))).flatMap(e=>e?.options??[]),...n]}function completionSource(e,t,n){return async r=>{let i=r.matchBefore(z);if(!i||i.from===i.to&&!r.explicit)return null;let a=r.state.doc.lineAt(r.pos),o=completionsFor(n,a.text.slice(0,r.pos-a.from),e.contextOf(t)).map(e=>({label:e.name,type:e.kind===`builtin`?`function`:`variable`,detail:e.detail,info:e.documentation})),s=n===`feel`?[...o,...await feelWords(r)]:o;return s.length>0?{from:i.from,options:s,validFor:B}:null}}function hoverElement(e){let t=document.createElement(`div`);t.className=`web-script__hover`;let n=document.createElement(`strong`);if(n.textContent=e.name,t.append(n),e.typeLine!==null){let n=document.createElement(`div`);n.textContent=e.typeLine,t.append(n)}let r=document.createElement(`div`);return r.textContent=e.setBy,t.append(r),t}function hoverFor(e,t,n){return h((r,i)=>{let a=variableAt(n,r.state.doc.toString(),i,e.contextOf(t));if(!a)return null;let o=variableHover(a.variable);return{pos:a.start,end:a.end,above:!0,create:()=>({dom:hoverElement(o)})}})}var H=C(e=>feelDiagnostics(e.state.doc.toString()).map(e=>({from:e.start,to:e.end,severity:`error`,message:e.message})));function scriptEditing(e,t,n){let r=S({override:[completionSource(e,t,n)]}),i=hoverFor(e,t,n);return n===`feel`?[r,i,V,H]:[r,i,V]}var U={feel:`FEEL`,groovy:`Groovy`,javascript:`JavaScript`};function ScriptResult({report:e}){return n(`div`,{class:e.failed?`web-script__result is-error`:`web-script__result`,role:e.failed?`alert`:`status`,children:e.lines.map((e,t)=>n(`p`,{class:`type-body`,children:e},t))})}function ScriptPane({hub:s,tab:c,shown:u,focused:d}){let f=t(null),p=t(null),m=t(Symbol(`script-tab`)),h=scriptTabLanguageOf(c.language),_=s.contextOf(c.id),v=contextSummary(_),[b,x]=e(!1),[S,C]=e(null),[w,D]=e(null),[O,A]=e({}),[M,N]=e(null),P=h===`feel`;r(()=>{let e=f.current;if(!e)return;let t=!0,n=new y,r=h?scriptEditing(s,c.id,h):[],i=new l({parent:e,state:g.create({doc:c.text,extensions:[scriptBasics(),j,k,n.of(r),l.updateListener.of(e=>{e.docChanged&&!e.transactions.some(e=>e.annotation(R))&&(s.changed(c.id,e.state.doc.toString()),C(null))})]})});return p.current=i,h&&scriptLanguageExtension(h).then(e=>{t&&i.dispatch({effects:n.reconfigure([e,...r])})}),()=>{t=!1,i.destroy(),p.current=null}},[c.id]),r(()=>{let e=p.current;e&&e.state.doc.toString()!==c.text&&e.dispatch({changes:{from:0,to:e.state.doc.length,insert:c.text},annotations:R.of(!0)})},[c.revision]),r(()=>{if(u&&d)return E(m.current,()=>({undo:()=>s.history(c.id,`undo`),redo:()=>s.history(c.id,`redo`)}))},[u,d,c.id]),r(()=>{if(!S?.mark)return;let{start:e,end:t}=S.mark;p.current?.dispatch({selection:{anchor:e,head:t},effects:l.scrollIntoView(e,{y:`center`})})},[S]);let openRun=()=>{let e=p.current;P&&e&&(D({expression:e.state.doc.toString()}),a(()=>import(`./ScriptRunDialog-DjBW0LRD.js`).then(e=>N(()=>e.ScriptRunDialog)),__vite__mapDeps([14,1,15,2,3,4,5,6,7,8,9,10,16,17,18,19,20,21]),import.meta.url))},runFeel=async(e,t)=>{let n=await runFeelScript(o(),s.diagramOf(c.id),e,t);return n.status===`inputs`?n.message:(A(t),C(n.report),D(null),null)};return n(`div`,{id:T(`web-pane`,c.id),class:`web-pane web-script`,role:`tabpanel`,"aria-labelledby":T(`web-tab`,c.id),"data-active":u?`true`:`false`,"data-focused":d?`true`:`false`,"aria-hidden":!u||void 0,children:[c.conflict!==null&&n(`div`,{class:`web-pane__banner is-warning`,role:`alert`,children:[n(`span`,{class:`web-pane__banner-text type-body`,children:i(`app.script.conflict.message`,{name:c.title})}),n(`button`,{type:`button`,class:`ui-button type-button`,onClick:()=>s.resolve(c.id,`tab`),children:i(`app.script.conflict.keepTab`)}),n(`button`,{type:`button`,class:`ui-button type-button`,onClick:()=>s.resolve(c.id,`diagram`),children:i(`app.script.conflict.useDiagram`)})]}),n(`div`,{class:`web-script__bar`,children:[n(`span`,{class:`web-script__language type-help`,children:h?U[h]:c.language}),v&&n(`span`,{class:`web-script__context type-help`,children:v}),_.length>0&&n(`button`,{type:`button`,class:`ui-button type-button`,"aria-expanded":b,onClick:()=>x(e=>!e),children:i(`app.script.context.showAll`)}),n(`button`,{type:`button`,class:`ui-button type-button`,disabled:!P,onClick:openRun,children:i(`app.script.run.button`)})]}),!P&&n(`p`,{class:`web-script__note type-help`,role:`status`,children:i(`app.script.run.unavailable`)}),b&&n(`ul`,{class:`web-script__variables`,children:_.map(e=>n(`li`,{class:`web-script__variable`,children:[n(`span`,{class:`type-body`,children:e.name}),e.type&&n(`span`,{class:`type-help`,children:e.type}),n(`span`,{class:`type-help`,children:variableHover(e).setBy})]},e.name))}),n(`div`,{class:`web-script__editor`,ref:f,"aria-label":c.title}),S&&n(ScriptResult,{report:S}),w&&M&&n(M,{expression:w.expression,variables:_,remembered:O,onRun:e=>runFeel(w.expression,e),onClose:()=>D(null)})]})}export{ScriptPane,feelProblemText as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./run-fV7AmV4q.js","./rolldown-runtime-B8BYMn-z.js","./translator-Dvvasoz-.js","./preload-helper-VRuDKI9K.js","./samples-D-3Bquy_.js","./engines-BQRXHtW8.js","./dist-CxyFqsL2.js","./dist-CRJyslwo.js","./dist-CHluRwHI.js","./dist-TNwbKIWT.js","./syntax-DBcQvmbn.js","./dist-CAxViutc.js","./dist-CsBP6QjA.js","./dist-DvFyMwGd.js","./ScriptRunDialog-Dm-_0H1Z.js","./vendor-NJP34MHU.js","./ui-TBzvKaKQ.js","./bridgeInstance-BPwbITOf.js","./dist-DgvQWhKm.js","./moddle-CGpeSs3G.js","./dist-BqwyxNP3.js","./dialog-KVjfqSrB.js"])))=>i.map(i=>d[i]);
2
+ import"./rolldown-runtime-B8BYMn-z.js";import{c as e,i as t,r as n,u as r}from"./vendor-NJP34MHU.js";import{i}from"./translator-Dvvasoz-.js";import{t as a}from"./preload-helper-VRuDKI9K.js";import{t as o}from"./bridgeInstance-BPwbITOf.js";import"./platform-zEAtGnYc.js";import{a as s}from"./httpHost-DX-P_FDg.js";import{$ as c,I as l,J as u,Q as d,T as f,Tt as p,Y as m,Z as h,ht as g,l as _,lt as v,pt as y}from"./dist-CsBP6QjA.js";import{a as b,i as x,r as S}from"./dist-DvFyMwGd.js";import{r as C}from"./dist-DUkRqvKl.js";import{n as w}from"./dist-Km3QNqlU.js";import{d as T,q as E}from"./web-qJCedJJw.js";import{n as D,t as O}from"./syntax-DBcQvmbn.js";import{n as k,r as A,t as j}from"./source-frame-q4WXS_Md.js";var M={DOUBLE_EQUALS:`app.feel.problem.doubleEquals`,SPACED_NAME:`app.feel.problem.spacedName`,UNCLOSED_BRACKET:`app.feel.problem.unclosedBracket`,MISSING_ELSE:`app.feel.problem.missingElse`,ENDS_TOO_EARLY:`app.feel.problem.endsTooEarly`,UNEXPECTED_TOKEN:`app.feel.problem.unexpectedToken`,UNTERMINATED_STRING:`app.feel.problem.unterminatedString`,NOT_FEEL:`app.feel.problem.notFeel`};function feelProblemText(e){return i(M[e])}var N=[{name:`number`,parameters:[`from`,`grouping separator`,`decimal separator`]},{name:`string`,parameters:[`from`]},{name:`date`,parameters:[`year`,`month`,`day`,`from`]},{name:`date and time`,parameters:[`date`,`time`,`from`]},{name:`time`,parameters:[`hour`,`minute`,`second`,`offset`,`from`]},{name:`duration`,parameters:[`from`]},{name:`years and months duration`,parameters:[`from`,`to`]},{name:`now`,parameters:[]},{name:`today`,parameters:[]},{name:`not`,parameters:[`negand`]},{name:`substring`,parameters:[`string`,`start position`,`length`]},{name:`string length`,parameters:[`string`]},{name:`upper case`,parameters:[`string`]},{name:`lower case`,parameters:[`string`]},{name:`substring before`,parameters:[`string`,`match`]},{name:`substring after`,parameters:[`string`,`match`]},{name:`replace`,parameters:[`input`,`pattern`,`replacement`,`flags`]},{name:`contains`,parameters:[`string`,`match`]},{name:`matches`,parameters:[`input`,`pattern`,`flags`]},{name:`starts with`,parameters:[`string`,`match`]},{name:`ends with`,parameters:[`string`,`match`]},{name:`split`,parameters:[`string`,`delimiter`]},{name:`string join`,parameters:[`list`,`delimiter`]},{name:`list contains`,parameters:[`list`,`element`]},{name:`list replace`,parameters:[`list`,`position`,`newItem`,`match`]},{name:`count`,parameters:[`list`]},{name:`sublist`,parameters:[`list`,`start`,`length`]},{name:`append`,parameters:[`list`,`...item`]},{name:`concatenate`,parameters:[`...list`]},{name:`insert before`,parameters:[`list`,`position`,`newItem`]},{name:`remove`,parameters:[`list`,`position`]},{name:`reverse`,parameters:[`list`]},{name:`index of`,parameters:[`list`,`match`]},{name:`distinct values`,parameters:[`list`]},{name:`flatten`,parameters:[`list`]},{name:`decimal`,parameters:[`n`,`scale`]},{name:`floor`,parameters:[`n`,`scale`]},{name:`ceiling`,parameters:[`n`,`scale`]},{name:`abs`,parameters:[`n`]},{name:`round up`,parameters:[`n`,`scale`]},{name:`round down`,parameters:[`n`,`scale`]},{name:`round half up`,parameters:[`n`,`scale`]},{name:`round half down`,parameters:[`n`,`scale`]},{name:`modulo`,parameters:[`dividend`,`divisor`]},{name:`sqrt`,parameters:[`number`]},{name:`log`,parameters:[`number`]},{name:`exp`,parameters:[`number`]},{name:`odd`,parameters:[`number`]},{name:`even`,parameters:[`number`]},{name:`is`,parameters:[`value1`,`value2`]},{name:`before`,parameters:[`a`,`b`]},{name:`after`,parameters:[`a`,`b`]},{name:`meets`,parameters:[`range1`,`range2`]},{name:`met by`,parameters:[`range1`,`range2`]},{name:`overlaps`,parameters:[`range1`,`range2`]},{name:`includes`,parameters:[`range`,`value`]},{name:`day of year`,parameters:[`date`]},{name:`day of week`,parameters:[`date`]},{name:`month of year`,parameters:[`date`]},{name:`week of year`,parameters:[`date`]},{name:`sort`,parameters:[`list`,`precedes`]},{name:`get value`,parameters:[`m`,`key`]},{name:`get entries`,parameters:[`m`]},{name:`context put`,parameters:[`context`,`keys`,`value`,`key`]}],P=[`execution`,`task`],F={getVariable:`read`,getVariableTyped:`read`,hasVariable:`test`,setVariable:`write`,removeVariable:`remove`},I=RegExp(`\\b(?:${P.join(`|`)})\\s*\\.\\s*(${Object.keys(F).join(`|`)})\\s*\\(\\s*(["'])([^"'\\\\\\r\\n]+)\\2`,`g`),L=RegExp(`\\b(?:${P.join(`|`)})\\s*\\.\\s*(?:${Object.keys(F).join(`|`)})\\s*\\(\\s*(["'])[^"'\\\\\\r\\n]*$`);function isInsideVariableName(e){return L.test(e)}function scriptVariableReferences(e){return[...e.matchAll(I)].flatMap(e=>{let t=e[1],n=e[2],r=e[3],i=t===void 0?void 0:F[t];if(t===void 0||n===void 0||r===void 0||i===void 0)return[];let a=e.index+e[0].length-n.length;return[{name:r,start:a-r.length,end:a,access:i,method:t}]})}function feelNameAt(e,t){let n=D(e),r=n.findIndex(e=>e.start<=t&&t<e.end),i=n[r];if(!(!i||i.kind!==`name`&&i.kind!==`backtick_name`)&&n[r+1]?.kind!==`open_parenthesis`)return{name:i.kind===`backtick_name`?i.text.slice(1,-1):i.text,start:i.start,end:i.end}}function variableNamed(e,t){return e.find(e=>e.name===t)}function referenceAt(e,t){return scriptVariableReferences(e).find(e=>e.start<=t&&t<=e.end)}function variableAt(e,t,n,r){let i=e===`feel`?feelNameAt(t,n):referenceAt(t,n),a=i===void 0?void 0:variableNamed(r,i.name);return a&&i?{variable:a,start:i.start,end:i.end}:void 0}function placesOf(e){return e.writers.map(e=>e.label).join(`, `)}function setByText(e){return e.writers.length>0?i(`app.script.writers.set`,{places:placesOf(e)}):i(`app.script.writers.none`)}function variableCompletions(e){return e.map(e=>({name:e.name,detail:e.type??i(`app.script.completion.variable`),documentation:setByText(e)}))}function builtinCompletions(){return N.map(e=>({name:e.name,signature:`${e.name}(${e.parameters.join(`, `)})`}))}function completionsFor(e,t,n){if(e!==`feel`&&!isInsideVariableName(t))return[];let r=variableCompletions(n).map(e=>({name:e.name,kind:`variable`,detail:e.detail,documentation:e.documentation}));if(e!==`feel`)return r;let a=builtinCompletions().map(e=>({name:e.name,kind:`builtin`,detail:e.signature,documentation:i(`app.script.completion.builtin`)}));return[...r,...a]}function variableHover(e){return{name:e.name,typeLine:e.type?i(`app.script.typeLabel`,{type:e.type}):null,setBy:setByText(e)}}function contextSummary(e){if(e.length!==0)return i(`app.script.context.summary`,{names:e.map(e=>e.name).join(`, `)})}function feelDiagnostics(e){let t=O(e);if(!t)return[];let n={start:t.start,end:t.end,message:feelProblemText(t.problem)};return t.replacement!==void 0&&(n.replacement=t.replacement),[n]}async function engineFor(e,t){if(t===void 0)return{note:i(`app.feel.run.noEngine`)};let{connectedFeelTarget:n}=await a(async()=>{let{connectedFeelTarget:e}=await import(`./run-fV7AmV4q.js`);return{connectedFeelTarget:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]),import.meta.url),r=await e.getDeployTargets(t),o=n(r.targets,r.active);if(o===void 0)return{note:i(`app.feel.run.noEngine`)};let s=o.profile??null;return{link:{kind:`CAMUNDA_8`,ask:n=>e.askEngine(s,n,t)}}}async function runFeelScript(e,t,n,r){let i=await a(()=>import(`./run-fV7AmV4q.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]),import.meta.url),o=i.resolveSampleInputs(r);if(o.status===`failed`)return{status:`inputs`,message:o.message};try{let r=await engineFor(e,t);return{status:`report`,report:await i.runEvaluation(n,o.variables,r.link,r.link===void 0?r.note:void 0)}}catch(e){return{status:`report`,report:i.failureReport(await s(e))}}}var R=v.define(),z=/[\p{L}\p{N}_]*/u,B=/^[\p{L}\p{N}_]*$/u,V=g.transactionExtender.of(e=>e.annotation(R)?{annotations:p.addToHistory.of(!1)}:null);function scriptTabLanguageOf(e){return e===`feel`||e===`groovy`||e===`javascript`?e:null}async function scriptLanguageExtension(e){return e===`feel`?(await a(async()=>{let{feel:e}=await import(`./dist-CAxViutc.js`).then(e=>e.t);return{feel:e}},__vite__mapDeps([11,1,7,8,9,12,13]),import.meta.url)).feel():A(e)}function scriptBasics(){return[w,c(),m(),u(),_(),f(),x(),d.of(b)]}async function feelWords(e){let{keywordCompletions:t,snippets:n}=await a(async()=>{let{keywordCompletions:e,snippets:t}=await import(`./dist-CAxViutc.js`).then(e=>e.t);return{keywordCompletions:e,snippets:t}},__vite__mapDeps([11,1,7,8,9,12,13]),import.meta.url);return[...(await Promise.all(t.map(t=>t(e)))).flatMap(e=>e?.options??[]),...n]}function completionSource(e,t,n){return async r=>{let i=r.matchBefore(z);if(!i||i.from===i.to&&!r.explicit)return null;let a=r.state.doc.lineAt(r.pos),o=completionsFor(n,a.text.slice(0,r.pos-a.from),e.contextOf(t)).map(e=>({label:e.name,type:e.kind===`builtin`?`function`:`variable`,detail:e.detail,info:e.documentation})),s=n===`feel`?[...o,...await feelWords(r)]:o;return s.length>0?{from:i.from,options:s,validFor:B}:null}}function hoverElement(e){let t=document.createElement(`div`);t.className=`web-script__hover`;let n=document.createElement(`strong`);if(n.textContent=e.name,t.append(n),e.typeLine!==null){let n=document.createElement(`div`);n.textContent=e.typeLine,t.append(n)}let r=document.createElement(`div`);return r.textContent=e.setBy,t.append(r),t}function hoverFor(e,t,n){return h((r,i)=>{let a=variableAt(n,r.state.doc.toString(),i,e.contextOf(t));if(!a)return null;let o=variableHover(a.variable);return{pos:a.start,end:a.end,above:!0,create:()=>({dom:hoverElement(o)})}})}var H=C(e=>feelDiagnostics(e.state.doc.toString()).map(e=>({from:e.start,to:e.end,severity:`error`,message:e.message})));function scriptEditing(e,t,n){let r=S({override:[completionSource(e,t,n)]}),i=hoverFor(e,t,n);return n===`feel`?[r,i,V,H]:[r,i,V]}var U={feel:`FEEL`,groovy:`Groovy`,javascript:`JavaScript`};function ScriptResult({report:e}){return n(`div`,{class:e.failed?`web-script__result is-error`:`web-script__result`,role:e.failed?`alert`:`status`,children:e.lines.map((e,t)=>n(`p`,{class:`type-body`,children:e},t))})}function ScriptPane({hub:s,tab:c,shown:u,focused:d}){let f=t(null),p=t(null),m=t(Symbol(`script-tab`)),h=scriptTabLanguageOf(c.language),_=s.contextOf(c.id),v=contextSummary(_),[b,x]=e(!1),[S,C]=e(null),[w,D]=e(null),[O,A]=e({}),[M,N]=e(null),P=h===`feel`;r(()=>{let e=f.current;if(!e)return;let t=!0,n=new y,r=h?scriptEditing(s,c.id,h):[],i=new l({parent:e,state:g.create({doc:c.text,extensions:[scriptBasics(),j,k,n.of(r),l.updateListener.of(e=>{e.docChanged&&!e.transactions.some(e=>e.annotation(R))&&(s.changed(c.id,e.state.doc.toString()),C(null))})]})});return p.current=i,h&&scriptLanguageExtension(h).then(e=>{t&&i.dispatch({effects:n.reconfigure([e,...r])})}),()=>{t=!1,i.destroy(),p.current=null}},[c.id]),r(()=>{let e=p.current;e&&e.state.doc.toString()!==c.text&&e.dispatch({changes:{from:0,to:e.state.doc.length,insert:c.text},annotations:R.of(!0)})},[c.revision]),r(()=>{if(u&&d)return E(m.current,()=>({undo:()=>s.history(c.id,`undo`),redo:()=>s.history(c.id,`redo`)}))},[u,d,c.id]),r(()=>{if(!S?.mark)return;let{start:e,end:t}=S.mark;p.current?.dispatch({selection:{anchor:e,head:t},effects:l.scrollIntoView(e,{y:`center`})})},[S]);let openRun=()=>{let e=p.current;P&&e&&(D({expression:e.state.doc.toString()}),a(()=>import(`./ScriptRunDialog-Dm-_0H1Z.js`).then(e=>N(()=>e.ScriptRunDialog)),__vite__mapDeps([14,1,15,2,3,4,5,6,7,8,9,10,16,17,18,19,20,21]),import.meta.url))},runFeel=async(e,t)=>{let n=await runFeelScript(o(),s.diagramOf(c.id),e,t);return n.status===`inputs`?n.message:(A(t),C(n.report),D(null),null)};return n(`div`,{id:T(`web-pane`,c.id),class:`web-pane web-script`,role:`tabpanel`,"aria-labelledby":T(`web-tab`,c.id),"data-active":u?`true`:`false`,"data-focused":d?`true`:`false`,"aria-hidden":!u||void 0,children:[c.conflict!==null&&n(`div`,{class:`web-pane__banner is-warning`,role:`alert`,children:[n(`span`,{class:`web-pane__banner-text type-body`,children:i(`app.script.conflict.message`,{name:c.title})}),n(`button`,{type:`button`,class:`ui-button type-button`,onClick:()=>s.resolve(c.id,`tab`),children:i(`app.script.conflict.keepTab`)}),n(`button`,{type:`button`,class:`ui-button type-button`,onClick:()=>s.resolve(c.id,`diagram`),children:i(`app.script.conflict.useDiagram`)})]}),n(`div`,{class:`web-script__bar`,children:[n(`span`,{class:`web-script__language type-help`,children:h?U[h]:c.language}),v&&n(`span`,{class:`web-script__context type-help`,children:v}),_.length>0&&n(`button`,{type:`button`,class:`ui-button type-button`,"aria-expanded":b,onClick:()=>x(e=>!e),children:i(`app.script.context.showAll`)}),n(`button`,{type:`button`,class:`ui-button type-button`,disabled:!P,onClick:openRun,children:i(`app.script.run.button`)})]}),!P&&n(`p`,{class:`web-script__note type-help`,role:`status`,children:i(`app.script.run.unavailable`)}),b&&n(`ul`,{class:`web-script__variables`,children:_.map(e=>n(`li`,{class:`web-script__variable`,children:[n(`span`,{class:`type-body`,children:e.name}),e.type&&n(`span`,{class:`type-help`,children:e.type}),n(`span`,{class:`type-help`,children:variableHover(e).setBy})]},e.name))}),n(`div`,{class:`web-script__editor`,ref:f,"aria-label":c.title}),S&&n(ScriptResult,{report:S}),w&&M&&n(M,{expression:w.expression,variables:_,remembered:O,onRun:e=>runFeel(w.expression,e),onClose:()=>D(null)})]})}export{ScriptPane,feelProblemText as t};
@@ -1 +1 @@
1
- import"./rolldown-runtime-B8BYMn-z.js";import{c as e,r as t}from"./vendor-NJP34MHU.js";import{i as n}from"./translator-CS9eR0My.js";import{t as r}from"./samples-chRLnLcq.js";import{f as i,l as a,p as o,u as s}from"./ui-AICOEtWR.js";var c={mode:`json`,text:``},l=3;function ScriptRunDialog({expression:u,variables:d,remembered:f,onRun:p,onClose:m}){let h=r(u),[g,_]=e(()=>Object.fromEntries(h.map(e=>[e,f[e]??c]))),[v,y]=e(null),[b,x]=e(!1),change=(e,t)=>{_(n=>({...n,[e]:{...n[e]??c,...t}}))},run=async()=>{x(!0);let e=await p(g);e!==null&&(y(e),x(!1))},typeOf=e=>d.find(t=>t.name===e)?.type??void 0;return t(i,{title:n(`app.script.run.title`),size:h.length>l?`medium`:`small`,onClose:m,onSubmit:run,footer:t(o,{actions:[{id:`cancel`,label:n(`app.common.cancel`),role:`cancel`,onClick:m,disabled:b},{id:`run`,label:n(`app.script.run.button`),role:`primary`,onClick:run,busy:b}]}),children:[t(`p`,{class:`type-help`,children:n(`app.script.run.help`)}),h.map(e=>t(a,{label:e,hint:typeOf(e),children:r=>t(`div`,{class:`web-script__sample`,children:[t(`input`,{...r,value:g[e]?.text??``,disabled:b,spellcheck:!1,autocomplete:`off`,onInput:t=>change(e,{text:t.target.value})}),t(`select`,{"aria-label":n(`app.script.run.kindLabel`),value:g[e]?.mode??c.mode,disabled:b,onChange:t=>change(e,{mode:t.target.value}),children:[t(`option`,{value:`json`,children:n(`app.script.run.kind.json`)}),t(`option`,{value:`expression`,children:n(`app.script.run.kind.expression`)})]})]})},e)),v&&t(s,{children:v})]})}export{ScriptRunDialog};
1
+ import"./rolldown-runtime-B8BYMn-z.js";import{c as e,r as t}from"./vendor-NJP34MHU.js";import{i as n}from"./translator-Dvvasoz-.js";import{t as r}from"./samples-D-3Bquy_.js";import{f as i,l as a,p as o,u as s}from"./ui-TBzvKaKQ.js";var c={mode:`json`,text:``},l=3;function ScriptRunDialog({expression:u,variables:d,remembered:f,onRun:p,onClose:m}){let h=r(u),[g,_]=e(()=>Object.fromEntries(h.map(e=>[e,f[e]??c]))),[v,y]=e(null),[b,x]=e(!1),change=(e,t)=>{_(n=>({...n,[e]:{...n[e]??c,...t}}))},run=async()=>{x(!0);let e=await p(g);e!==null&&(y(e),x(!1))},typeOf=e=>d.find(t=>t.name===e)?.type??void 0;return t(i,{title:n(`app.script.run.title`),size:h.length>l?`medium`:`small`,onClose:m,onSubmit:run,footer:t(o,{actions:[{id:`cancel`,label:n(`app.common.cancel`),role:`cancel`,onClick:m,disabled:b},{id:`run`,label:n(`app.script.run.button`),role:`primary`,onClick:run,busy:b}]}),children:[t(`p`,{class:`type-help`,children:n(`app.script.run.help`)}),h.map(e=>t(a,{label:e,hint:typeOf(e),children:r=>t(`div`,{class:`web-script__sample`,children:[t(`input`,{...r,value:g[e]?.text??``,disabled:b,spellcheck:!1,autocomplete:`off`,onInput:t=>change(e,{text:t.target.value})}),t(`select`,{"aria-label":n(`app.script.run.kindLabel`),value:g[e]?.mode??c.mode,disabled:b,onChange:t=>change(e,{mode:t.target.value}),children:[t(`option`,{value:`json`,children:n(`app.script.run.kind.json`)}),t(`option`,{value:`expression`,children:n(`app.script.run.kind.expression`)})]})]})},e)),v&&t(s,{children:v})]})}export{ScriptRunDialog};
@@ -1 +1 @@
1
- import"./rolldown-runtime-B8BYMn-z.js";import{c as e,r as t}from"./vendor-NJP34MHU.js";import{i as n}from"./translator-CS9eR0My.js";import{f as r,l as i,p as a}from"./ui-AICOEtWR.js";import{et as o}from"./web-BtxFF0jJ.js";function parseSeconds(e){if(!/^\d{1,4}$/.test(e.trim()))return null;let t=Number(e);return t>=1&&t<=600?t:null}function SettingsDialog({theme:s,autosave:c,onAgents:l,onTheme:u,onAutosave:d,suggestNextBlock:f,onSuggestNextBlock:p,suggestions:m,onSuggestions:h,onClose:g}){let[_,v]=e(s),[y,b]=e(c!==null),[x,S]=e(String(c??5)),[C,w]=e(f),[T,E]=e(m),D=parseSeconds(x)!==null,pickTheme=e=>{v(e),u(e)},toggleSuggest=e=>{w(e),p(e)},toggleNames=e=>{E(e),h(e)},toggle=e=>{b(e),d(e?parseSeconds(x)??5:null)},change=e=>{S(e);let t=parseSeconds(e);y&&t!==null&&d(t)};return t(r,{title:n(`app.web.settings.title`),size:`medium`,onClose:g,onSubmit:()=>D&&g(),footer:t(a,{actions:[{id:`done`,label:n(`app.common.done`),role:`primary`,onClick:g,disabled:!D}]}),children:t(`div`,{class:`web-settings`,children:[t(`section`,{class:`web-settings__group`,"aria-labelledby":`web-settings-theme`,children:[t(`h3`,{id:`web-settings-theme`,class:`web-settings__heading type-section-heading`,children:n(`app.web.settings.appearance`)}),t(`div`,{role:`radiogroup`,"aria-labelledby":`web-settings-theme`,class:`web-settings__choices`,children:o.map(e=>t(`label`,{class:`web-settings__choice type-body`,children:[t(`input`,{type:`radio`,name:`web-theme`,value:e,checked:_===e,onChange:()=>pickTheme(e)}),t(`span`,{children:n(e===`ide`?`app.web.settings.themeSystem`:`app.themeChoice.${e}`)})]},e))})]}),t(`section`,{class:`web-settings__group`,"aria-labelledby":`web-settings-editor`,children:[t(`h3`,{id:`web-settings-editor`,class:`web-settings__heading type-section-heading`,children:n(`app.web.settings.editor`)}),t(`label`,{class:`web-settings__choice type-body`,children:[t(`input`,{type:`checkbox`,checked:C,onChange:e=>toggleSuggest(e.currentTarget.checked)}),t(`span`,{children:n(`app.web.settings.suggestNextBlock`)})]}),t(`p`,{class:`web-settings__help type-help`,children:n(`app.web.settings.suggestNextBlockHelp`)}),t(`label`,{class:`web-settings__choice type-body`,children:[t(`input`,{type:`checkbox`,checked:T,onChange:e=>toggleNames(e.currentTarget.checked)}),t(`span`,{children:n(`app.web.settings.suggestions`)})]}),t(`p`,{class:`web-settings__help type-help`,children:n(`app.web.settings.suggestionsHelp`)})]}),t(`section`,{class:`web-settings__group`,"aria-labelledby":`web-settings-save`,children:[t(`h3`,{id:`web-settings-save`,class:`web-settings__heading type-section-heading`,children:n(`app.web.settings.saving`)}),t(`label`,{class:`web-settings__choice type-body`,children:[t(`input`,{type:`checkbox`,checked:y,onChange:e=>toggle(e.currentTarget.checked)}),t(`span`,{children:n(`app.web.settings.autosave`)})]}),t(i,{label:n(`app.web.settings.autosaveDelay`),hint:n(`app.web.settings.autosaveHelp`),error:D?void 0:n(`app.web.settings.autosaveRange`,{min:1,max:600}),children:e=>t(`input`,{...e,class:`${e.class} type-input web-settings__number`,type:`text`,inputMode:`numeric`,value:x,disabled:!y,onInput:e=>change(e.currentTarget.value)})})]}),t(`section`,{class:`web-settings__group`,"aria-labelledby":`web-settings-agents`,children:[t(`h3`,{id:`web-settings-agents`,class:`web-settings__heading type-section-heading`,children:n(`app.web.settings.agents`)}),t(`p`,{class:`web-settings__help type-help`,children:n(`app.web.settings.agentsHelp`)}),t(`button`,{type:`button`,class:`ui-button type-button web-settings__manage`,onClick:l,children:n(`app.web.settings.agentsManage`)})]})]})})}export{SettingsDialog};
1
+ import"./rolldown-runtime-B8BYMn-z.js";import{c as e,r as t}from"./vendor-NJP34MHU.js";import{i as n}from"./translator-Dvvasoz-.js";import{f as r,l as i,p as a}from"./ui-TBzvKaKQ.js";import{et as o}from"./web-qJCedJJw.js";function parseSeconds(e){if(!/^\d{1,4}$/.test(e.trim()))return null;let t=Number(e);return t>=1&&t<=600?t:null}function SettingsDialog({theme:s,autosave:c,onAgents:l,onTheme:u,onAutosave:d,suggestNextBlock:f,onSuggestNextBlock:p,suggestions:m,onSuggestions:h,onClose:g}){let[_,v]=e(s),[y,b]=e(c!==null),[x,S]=e(String(c??5)),[C,w]=e(f),[T,E]=e(m),D=parseSeconds(x)!==null,pickTheme=e=>{v(e),u(e)},toggleSuggest=e=>{w(e),p(e)},toggleNames=e=>{E(e),h(e)},toggle=e=>{b(e),d(e?parseSeconds(x)??5:null)},change=e=>{S(e);let t=parseSeconds(e);y&&t!==null&&d(t)};return t(r,{title:n(`app.web.settings.title`),size:`medium`,onClose:g,onSubmit:()=>D&&g(),footer:t(a,{actions:[{id:`done`,label:n(`app.common.done`),role:`primary`,onClick:g,disabled:!D}]}),children:t(`div`,{class:`web-settings`,children:[t(`section`,{class:`web-settings__group`,"aria-labelledby":`web-settings-theme`,children:[t(`h3`,{id:`web-settings-theme`,class:`web-settings__heading type-section-heading`,children:n(`app.web.settings.appearance`)}),t(`div`,{role:`radiogroup`,"aria-labelledby":`web-settings-theme`,class:`web-settings__choices`,children:o.map(e=>t(`label`,{class:`web-settings__choice type-body`,children:[t(`input`,{type:`radio`,name:`web-theme`,value:e,checked:_===e,onChange:()=>pickTheme(e)}),t(`span`,{children:n(e===`ide`?`app.web.settings.themeSystem`:`app.themeChoice.${e}`)})]},e))})]}),t(`section`,{class:`web-settings__group`,"aria-labelledby":`web-settings-editor`,children:[t(`h3`,{id:`web-settings-editor`,class:`web-settings__heading type-section-heading`,children:n(`app.web.settings.editor`)}),t(`label`,{class:`web-settings__choice type-body`,children:[t(`input`,{type:`checkbox`,checked:C,onChange:e=>toggleSuggest(e.currentTarget.checked)}),t(`span`,{children:n(`app.web.settings.suggestNextBlock`)})]}),t(`p`,{class:`web-settings__help type-help`,children:n(`app.web.settings.suggestNextBlockHelp`)}),t(`label`,{class:`web-settings__choice type-body`,children:[t(`input`,{type:`checkbox`,checked:T,onChange:e=>toggleNames(e.currentTarget.checked)}),t(`span`,{children:n(`app.web.settings.suggestions`)})]}),t(`p`,{class:`web-settings__help type-help`,children:n(`app.web.settings.suggestionsHelp`)})]}),t(`section`,{class:`web-settings__group`,"aria-labelledby":`web-settings-save`,children:[t(`h3`,{id:`web-settings-save`,class:`web-settings__heading type-section-heading`,children:n(`app.web.settings.saving`)}),t(`label`,{class:`web-settings__choice type-body`,children:[t(`input`,{type:`checkbox`,checked:y,onChange:e=>toggle(e.currentTarget.checked)}),t(`span`,{children:n(`app.web.settings.autosave`)})]}),t(i,{label:n(`app.web.settings.autosaveDelay`),hint:n(`app.web.settings.autosaveHelp`),error:D?void 0:n(`app.web.settings.autosaveRange`,{min:1,max:600}),children:e=>t(`input`,{...e,class:`${e.class} type-input web-settings__number`,type:`text`,inputMode:`numeric`,value:x,disabled:!y,onInput:e=>change(e.currentTarget.value)})})]}),t(`section`,{class:`web-settings__group`,"aria-labelledby":`web-settings-agents`,children:[t(`h3`,{id:`web-settings-agents`,class:`web-settings__heading type-section-heading`,children:n(`app.web.settings.agents`)}),t(`p`,{class:`web-settings__help type-help`,children:n(`app.web.settings.agentsHelp`)}),t(`button`,{type:`button`,class:`ui-button type-button web-settings__manage`,onClick:l,children:n(`app.web.settings.agentsManage`)})]})]})})}export{SettingsDialog};
@@ -1 +1 @@
1
- import"./rolldown-runtime-B8BYMn-z.js";import{r as e}from"./vendor-NJP34MHU.js";import{i as t}from"./translator-CS9eR0My.js";import{o as n}from"./AgentSettings-C-1YBic4.js";import{f as r,p as i}from"./ui-AICOEtWR.js";import{t as a}from"./commands-N2yKHjf_.js";import"./web-BtxFF0jJ.js";function shortcutRows(){return[{group:t(`app.web.shortcuts.group.files`),rows:[{command:`quickOpen`,label:t(`app.web.command.quickOpen`)},{command:`actions`,label:t(`app.web.command.actions`)},{command:`newFile`,label:t(`app.web.command.newFile`)},{command:`save`,label:t(`app.web.command.save`)},{command:`saveAll`,label:t(`app.web.command.saveAll`)}]},{group:t(`app.web.shortcuts.group.tabs`),rows:[{command:`closeTab`,label:t(`app.web.command.closeTab`)},{command:`nextTab`,label:t(`app.web.command.nextTab`)},{command:`previousTab`,label:t(`app.web.command.previousTab`)},{command:`tab1`,label:t(`app.web.command.jumpToTab`)},{command:`splitView`,label:t(`app.web.command.splitView`)}]},{group:t(`app.web.shortcuts.group.window`),rows:[{command:`toggleSidebar`,label:t(`app.web.command.toggleSidebar`)},...n()?[{command:`askAgent`,label:t(`app.web.command.askAgent`)}]:[],{command:`shortcuts`,label:t(`app.web.command.shortcuts`)}]}]}function ShortcutsDialog({mac:n,onClose:o}){return e(r,{title:t(`app.web.shortcuts.title`),size:`medium`,onClose:o,onSubmit:o,footer:e(i,{help:t(`app.web.shortcuts.editorHint`),actions:[{id:`close`,label:t(`app.common.close`),role:`primary`,onClick:o}]}),children:e(`div`,{class:`web-shortcuts`,children:shortcutRows().map(t=>e(`section`,{class:`web-shortcuts__group`,"aria-label":t.group,children:[e(`h3`,{class:`web-shortcuts__heading type-section-heading`,children:t.group}),e(`dl`,{class:`web-shortcuts__list`,children:t.rows.map(t=>e(`div`,{class:`web-shortcuts__row`,children:[e(`dt`,{class:`type-body`,children:t.label}),e(`dd`,{class:`web-shortcuts__keys`,children:t.command===`tab1`?e(`kbd`,{class:`web-shortcuts__key type-help`,children:n?`⌘1…9`:`Ctrl+1…9`}):a(t.command,n).map(t=>e(`kbd`,{class:`web-shortcuts__key type-help`,children:t},t))})]},t.command))})]},t.group))})})}export{ShortcutsDialog};
1
+ import"./rolldown-runtime-B8BYMn-z.js";import{r as e}from"./vendor-NJP34MHU.js";import{i as t}from"./translator-Dvvasoz-.js";import{o as n}from"./AgentSettings-BvzT4Itb.js";import{f as r,p as i}from"./ui-TBzvKaKQ.js";import{t as a}from"./commands-BAnBjEk3.js";import"./web-qJCedJJw.js";function shortcutRows(){return[{group:t(`app.web.shortcuts.group.files`),rows:[{command:`quickOpen`,label:t(`app.web.command.quickOpen`)},{command:`actions`,label:t(`app.web.command.actions`)},{command:`newFile`,label:t(`app.web.command.newFile`)},{command:`save`,label:t(`app.web.command.save`)},{command:`saveAll`,label:t(`app.web.command.saveAll`)}]},{group:t(`app.web.shortcuts.group.tabs`),rows:[{command:`closeTab`,label:t(`app.web.command.closeTab`)},{command:`nextTab`,label:t(`app.web.command.nextTab`)},{command:`previousTab`,label:t(`app.web.command.previousTab`)},{command:`tab1`,label:t(`app.web.command.jumpToTab`)},{command:`splitView`,label:t(`app.web.command.splitView`)}]},{group:t(`app.web.shortcuts.group.window`),rows:[{command:`toggleSidebar`,label:t(`app.web.command.toggleSidebar`)},...n()?[{command:`askAgent`,label:t(`app.web.command.askAgent`)}]:[],{command:`shortcuts`,label:t(`app.web.command.shortcuts`)}]}]}function ShortcutsDialog({mac:n,onClose:o}){return e(r,{title:t(`app.web.shortcuts.title`),size:`medium`,onClose:o,onSubmit:o,footer:e(i,{help:t(`app.web.shortcuts.editorHint`),actions:[{id:`close`,label:t(`app.common.close`),role:`primary`,onClick:o}]}),children:e(`div`,{class:`web-shortcuts`,children:shortcutRows().map(t=>e(`section`,{class:`web-shortcuts__group`,"aria-label":t.group,children:[e(`h3`,{class:`web-shortcuts__heading type-section-heading`,children:t.group}),e(`dl`,{class:`web-shortcuts__list`,children:t.rows.map(t=>e(`div`,{class:`web-shortcuts__row`,children:[e(`dt`,{class:`type-body`,children:t.label}),e(`dd`,{class:`web-shortcuts__keys`,children:t.command===`tab1`?e(`kbd`,{class:`web-shortcuts__key type-help`,children:n?`⌘1…9`:`Ctrl+1…9`}):a(t.command,n).map(t=>e(`kbd`,{class:`web-shortcuts__key type-help`,children:t},t))})]},t.command))})]},t.group))})})}export{ShortcutsDialog};
@@ -1 +1 @@
1
- import"./rolldown-runtime-B8BYMn-z.js";import{c as e,i as t,r as n,u as r}from"./vendor-NJP34MHU.js";import{i}from"./translator-CS9eR0My.js";import{r as a}from"./files-Chpd_QD0.js";import{I as o,ht as s,pt as c}from"./dist-CsBP6QjA.js";import{t as l}from"./dist-Km3QNqlU.js";import{$ as u,Q as d}from"./web-BtxFF0jJ.js";import{i as f,n as p,r as m,t as h}from"./source-frame-q4WXS_Md.js";import{t as g}from"./intelligence-glU4hcHy.js";var _=2e6;function shown(e){return e.length>_?{text:e.slice(0,_),cut:!0}:{text:e,cut:!1}}function SourceDocument({handle:_}){let v=t(null),y=t(null),[b,x]=e(shown(_.initialText).cut),[S,C]=e(null),w=a(_.path),T=f(w),goTo=e=>{let t=y.current;if(!t||e===null)return;let n=t.state.doc.lines,r=t.state.doc.line(Math.max(1,Math.min(e,n)));t.dispatch({selection:{anchor:r.from},effects:o.scrollIntoView(r.from,{y:`center`})})};return r(()=>{let e=v.current;if(!e)return;let t=!0;C(null);let n=new c,r=new c,i=new o({parent:e,state:s.create({doc:shown(_.initialText).text,extensions:[l,h,p,s.readOnly.of(!0),n.of([]),r.of([])]})});y.current=i,m(T).then(e=>{t&&i.dispatch({effects:n.reconfigure(e)})}),g(i,r,_,T,{noServer:e=>t&&C(e)},()=>t),requestAnimationFrame(()=>t&&goTo(d(_.path)));let a=u(_.path,goTo),f=_.onReload(e=>{let t=shown(e);x(t.cut),i.dispatch({changes:{from:0,to:i.state.doc.length,insert:t.text}})});return()=>{t=!1,a(),f(),i.destroy(),y.current=null}},[_,T]),n(`div`,{class:`web-source`,children:[n(`div`,{class:`web-source__bar`,children:[n(`span`,{class:`web-source__path type-help`,title:w,children:w}),n(`span`,{class:`web-source__tag type-help`,children:i(`app.webHost.source.readOnly`)})]}),S&&n(`p`,{class:`web-source__hint type-help`,role:`status`,children:i(`app.web.code.noServer`,{server:S})}),b&&n(`p`,{class:`web-source__note type-help`,role:`status`,children:i(`app.webHost.source.truncated`)}),n(`div`,{class:`web-source__editor`,ref:v,"aria-label":i(`app.webHost.source.label`,{name:_.name})})]})}export{SourceDocument};
1
+ import"./rolldown-runtime-B8BYMn-z.js";import{c as e,i as t,r as n,u as r}from"./vendor-NJP34MHU.js";import{i}from"./translator-Dvvasoz-.js";import{r as a}from"./files-Chpd_QD0.js";import{I as o,ht as s,pt as c}from"./dist-CsBP6QjA.js";import{t as l}from"./dist-Km3QNqlU.js";import{$ as u,Q as d}from"./web-qJCedJJw.js";import{i as f,n as p,r as m,t as h}from"./source-frame-q4WXS_Md.js";import{t as g}from"./intelligence-BkxcJMU_.js";var _=2e6;function shown(e){return e.length>_?{text:e.slice(0,_),cut:!0}:{text:e,cut:!1}}function SourceDocument({handle:_}){let v=t(null),y=t(null),[b,x]=e(shown(_.initialText).cut),[S,C]=e(null),w=a(_.path),T=f(w),goTo=e=>{let t=y.current;if(!t||e===null)return;let n=t.state.doc.lines,r=t.state.doc.line(Math.max(1,Math.min(e,n)));t.dispatch({selection:{anchor:r.from},effects:o.scrollIntoView(r.from,{y:`center`})})};return r(()=>{let e=v.current;if(!e)return;let t=!0;C(null);let n=new c,r=new c,i=new o({parent:e,state:s.create({doc:shown(_.initialText).text,extensions:[l,h,p,s.readOnly.of(!0),n.of([]),r.of([])]})});y.current=i,m(T).then(e=>{t&&i.dispatch({effects:n.reconfigure(e)})}),g(i,r,_,T,{noServer:e=>t&&C(e)},()=>t),requestAnimationFrame(()=>t&&goTo(d(_.path)));let a=u(_.path,goTo),f=_.onReload(e=>{let t=shown(e);x(t.cut),i.dispatch({changes:{from:0,to:i.state.doc.length,insert:t.text}})});return()=>{t=!1,a(),f(),i.destroy(),y.current=null}},[_,T]),n(`div`,{class:`web-source`,children:[n(`div`,{class:`web-source__bar`,children:[n(`span`,{class:`web-source__path type-help`,title:w,children:w}),n(`span`,{class:`web-source__tag type-help`,children:i(`app.webHost.source.readOnly`)})]}),S&&n(`p`,{class:`web-source__hint type-help`,role:`status`,children:i(`app.web.code.noServer`,{server:S})}),b&&n(`p`,{class:`web-source__note type-help`,role:`status`,children:i(`app.webHost.source.truncated`)}),n(`div`,{class:`web-source__editor`,ref:v,"aria-label":i(`app.webHost.source.label`,{name:_.name})})]})}export{SourceDocument};
@@ -1 +1 @@
1
- import"./rolldown-runtime-B8BYMn-z.js";import{c as e,i as t,r as n,u as r}from"./vendor-NJP34MHU.js";import{i}from"./translator-CS9eR0My.js";import{r as a}from"./files-Chpd_QD0.js";import{I as o,ht as s,lt as c,pt as l}from"./dist-CsBP6QjA.js";import{t as u}from"./dist-Km3QNqlU.js";import{i as d,n as f,r as p,t as m}from"./source-frame-q4WXS_Md.js";import{t as h}from"./intelligence-glU4hcHy.js";var g=c.define();function TextDocument({handle:c}){let _=t(null),[v,y]=e(null),b=a(c.path),x=d(b);return r(()=>{let e=_.current;if(!e)return;let t=!0;y(null);let n=new l,r=new l,i=new o({parent:e,state:s.create({doc:c.initialText,extensions:[u,m,f,n.of([]),r.of([]),o.updateListener.of(e=>{e.docChanged&&!e.transactions.some(e=>e.annotation(g))&&c.edit(e.state.doc.toString())})]})});p(x).then(e=>{t&&i.dispatch({effects:n.reconfigure(e)})}),h(i,r,c,x,{noServer:e=>t&&y(e)},()=>t);let a=c.onReload(e=>{i.state.doc.toString()!==e&&i.dispatch({changes:{from:0,to:i.state.doc.length,insert:e},annotations:g.of(!0)})});return()=>{t=!1,a(),i.destroy()}},[c,x]),n(`div`,{class:`web-source`,children:[n(`div`,{class:`web-source__bar`,children:n(`span`,{class:`web-source__path type-help`,title:b,children:b})}),v&&n(`p`,{class:`web-source__hint type-help`,role:`status`,children:i(`app.web.code.noServer`,{server:v})}),n(`div`,{class:`web-source__editor`,ref:_,"aria-label":i(`app.web.text.label`,{name:c.name})})]})}export{TextDocument};
1
+ import"./rolldown-runtime-B8BYMn-z.js";import{c as e,i as t,r as n,u as r}from"./vendor-NJP34MHU.js";import{i}from"./translator-Dvvasoz-.js";import{r as a}from"./files-Chpd_QD0.js";import{I as o,ht as s,lt as c,pt as l}from"./dist-CsBP6QjA.js";import{t as u}from"./dist-Km3QNqlU.js";import{i as d,n as f,r as p,t as m}from"./source-frame-q4WXS_Md.js";import{t as h}from"./intelligence-BkxcJMU_.js";var g=c.define();function TextDocument({handle:c}){let _=t(null),[v,y]=e(null),b=a(c.path),x=d(b);return r(()=>{let e=_.current;if(!e)return;let t=!0;y(null);let n=new l,r=new l,i=new o({parent:e,state:s.create({doc:c.initialText,extensions:[u,m,f,n.of([]),r.of([]),o.updateListener.of(e=>{e.docChanged&&!e.transactions.some(e=>e.annotation(g))&&c.edit(e.state.doc.toString())})]})});p(x).then(e=>{t&&i.dispatch({effects:n.reconfigure(e)})}),h(i,r,c,x,{noServer:e=>t&&y(e)},()=>t);let a=c.onReload(e=>{i.state.doc.toString()!==e&&i.dispatch({changes:{from:0,to:i.state.doc.length,insert:e},annotations:g.of(!0)})});return()=>{t=!1,a(),i.destroy()}},[c,x]),n(`div`,{class:`web-source`,children:[n(`div`,{class:`web-source__bar`,children:n(`span`,{class:`web-source__path type-help`,title:b,children:b})}),v&&n(`p`,{class:`web-source__hint type-help`,role:`status`,children:i(`app.web.code.noServer`,{server:v})}),n(`div`,{class:`web-source__editor`,ref:_,"aria-label":i(`app.web.text.label`,{name:c.name})})]})}export{TextDocument};
@@ -1 +1 @@
1
- import"./rolldown-runtime-B8BYMn-z.js";import{r as e}from"./vendor-NJP34MHU.js";import{i as t}from"./translator-CS9eR0My.js";import{Rn as n,t as r}from"./bridgeInstance-D0bzpNGz.js";import{r as i}from"./platform-BS7bgwr3.js";import{o as a}from"./documentBridge-DSWBQZRP.js";import{s as o}from"./ui-AICOEtWR.js";function ResourceProblemsTab({findings:n,waiting:r,clean:i,onRecheck:a,onPick:s}){let c=n?.length??0;return e(`div`,{class:`problems`,children:[e(`header`,{class:`problems__bar`,children:[e(`span`,{class:`problems__count`,children:n?t(`app.problems.tally`,{count:c}):``}),e(`button`,{type:`button`,class:`ui-button`,onClick:a,title:t(`app.common.checkAgain`),children:t(`app.common.recheck`)})]}),n===null&&e(o,{title:r,hint:t(`app.editorShell.useCheckInTheToolbar`),guide:`problems`}),n!==null&&c===0&&e(o,{title:t(`app.diagramCheck.noProblemsFound`),hint:i,guide:`problems`}),n!==null&&c>0&&e(`ul`,{class:`diagram-check__list`,children:n.map((t,n)=>e(`li`,{children:e(`button`,{type:`button`,class:`diagram-check__row`,onClick:()=>s(n),children:[e(`span`,{class:`diagram-check__row-title`,children:t.title}),e(`span`,{class:`diagram-check__row-where diagram-check__row-where--wrap`,children:t.detail})]})},n))})]})}function historyState(e){return{undo:!!e?.canUndo?.(),redo:!!e?.canRedo?.()}}function UnreadableFileLayer({message:o,kind:s,client:c,onReload:l}){if(o===null)return null;let openText=()=>{let e=r().getBpmnFilePath();e&&r().openAsText(e).catch(e=>console.error(`Failed to open as text:`,e))},reload=async()=>{let e=r().getBpmnFilePath();if(e)try{let t=await c.file.readFile(e);t&&l(t)}catch(e){console.error(`Failed to read the file again:`,e),i.error(t(`app.canvas.unableToReadTheFile`))}};return e(a,{problem:n(Error(o)),kind:s,onOpenText:openText,onReload:()=>void reload()})}export{historyState as n,ResourceProblemsTab as r,UnreadableFileLayer as t};
1
+ import"./rolldown-runtime-B8BYMn-z.js";import{r as e}from"./vendor-NJP34MHU.js";import{i as t}from"./translator-Dvvasoz-.js";import{Bn as n,t as r}from"./bridgeInstance-BPwbITOf.js";import{r as i}from"./platform-zEAtGnYc.js";import{o as a}from"./documentBridge-D5SaBThP.js";import{s as o}from"./ui-TBzvKaKQ.js";function ResourceProblemsTab({findings:n,waiting:r,clean:i,onRecheck:a,onPick:s}){let c=n?.length??0;return e(`div`,{class:`problems`,children:[e(`header`,{class:`problems__bar`,children:[e(`span`,{class:`problems__count`,children:n?t(`app.problems.tally`,{count:c}):``}),e(`button`,{type:`button`,class:`ui-button`,onClick:a,title:t(`app.common.checkAgain`),children:t(`app.common.recheck`)})]}),n===null&&e(o,{title:r,hint:t(`app.editorShell.useCheckInTheToolbar`),guide:`problems`}),n!==null&&c===0&&e(o,{title:t(`app.diagramCheck.noProblemsFound`),hint:i,guide:`problems`}),n!==null&&c>0&&e(`ul`,{class:`diagram-check__list`,children:n.map((t,n)=>e(`li`,{children:e(`button`,{type:`button`,class:`diagram-check__row`,onClick:()=>s(n),children:[e(`span`,{class:`diagram-check__row-title`,children:t.title}),e(`span`,{class:`diagram-check__row-where diagram-check__row-where--wrap`,children:t.detail})]})},n))})]})}function historyState(e){return{undo:!!e?.canUndo?.(),redo:!!e?.canRedo?.()}}function UnreadableFileLayer({message:o,kind:s,client:c,onReload:l}){if(o===null)return null;let openText=()=>{let e=r().getBpmnFilePath();e&&r().openAsText(e).catch(e=>console.error(`Failed to open as text:`,e))},reload=async()=>{let e=r().getBpmnFilePath();if(e)try{let t=await c.file.readFile(e);t&&l(t)}catch(e){console.error(`Failed to read the file again:`,e),i.error(t(`app.canvas.unableToReadTheFile`))}};return e(a,{problem:n(Error(o)),kind:s,onOpenText:openText,onReload:()=>void reload()})}export{historyState as n,ResourceProblemsTab as r,UnreadableFileLayer as t};
@@ -1 +1 @@
1
- import"./rolldown-runtime-B8BYMn-z.js";import{c as e,h as t,r as n}from"./vendor-NJP34MHU.js";import{i as r}from"./translator-CS9eR0My.js";import{f as i,l as a,o,p as s,u as c}from"./ui-AICOEtWR.js";import{d as l}from"./files-Chpd_QD0.js";import{m as u,p as d,r as f}from"./web-BtxFF0jJ.js";function uploadProblem(e,t,n){let i=t.trim();if(i!==``&&l(i)===null)return{folder:r(`app.web.newFile.folderOutside`)};let a=i===``?``:`${l(i)}/`,o=new Set(n.map(e=>e.rel.toLowerCase())),s=new Set;for(let t=0;t<e.length;t+=1){let n=e[t].name.trim(),i=u(n);if(i)return{index:t,text:i};if(!f(n))return{index:t,text:r(`app.web.upload.extension`)};let c=`${a}${n}`.toLowerCase();if(o.has(c)||s.has(c))return{index:t,text:r(`app.web.newFile.exists`)};s.add(c)}return null}function UploadDialog({files:u,existing:f,folders:p,onUpload:m,onClose:h}){let[g,_]=e(()=>u.map(e=>({file:e,name:e.name}))),[v,y]=e(``),[b,x]=e(!1),[S,C]=e(null),w=o(),T=uploadProblem(g,v,f),upload=async()=>{if(w.submit(),T)requestAnimationFrame(()=>document.querySelector(`.ui-dialog [aria-invalid="true"]`)?.focus());else{x(!0),C(null);try{let e=v.trim()===``?``:`${l(v.trim())}/`;await m(await Promise.all(g.map(async t=>({rel:`${e}${t.name.trim()}`,content:await t.file.text()})))),h()}catch(e){C(d(e)),x(!1)}}},nameError=e=>T&&`index`in T&&T.index===e?w.errorOf(`name${e}`,T.text):null,E=T&&`folder`in T?w.errorOf(`folder`,T.folder):null;return n(i,{title:r(`app.web.upload.title`),size:`medium`,onClose:h,onSubmit:()=>void upload(),footer:n(s,{actions:[{id:`cancel`,label:r(`app.common.cancel`),role:`cancel`,onClick:h,disabled:b},{id:`upload`,label:g.length===1?r(`app.web.upload.addOne`):r(`app.web.upload.addMany`,{count:g.length}),role:`primary`,onClick:()=>void upload(),busy:b}]}),children:[n(`p`,{class:`web-dialog-text type-body`,children:r(`app.web.upload.text`)}),n(a,{label:r(`app.web.newFile.folder`),optional:!0,hint:r(`app.web.newFile.folderHint`),error:E,children:e=>n(t,{children:[n(`input`,{...e,value:v,list:`web-upload-folders`,spellcheck:!1,autocomplete:`off`,onInput:e=>y(e.target.value),onBlur:()=>w.touch(`folder`)}),n(`datalist`,{id:`web-upload-folders`,children:p.slice(0,500).map(e=>n(`option`,{value:e},e))})]})}),g.map((e,t)=>n(a,{label:g.length===1?r(`app.web.newFile.name`):r(`app.web.upload.fileN`,{number:t+1}),error:nameError(t),children:r=>n(`input`,{...r,value:e.name,spellcheck:!1,autocomplete:`off`,onInput:e=>{let n=e.target.value;_(e=>e.map((e,r)=>r===t?{...e,name:n}:e))},onBlur:()=>w.touch(`name${t}`)})},t)),S&&n(c,{children:S})]})}export{UploadDialog};
1
+ import"./rolldown-runtime-B8BYMn-z.js";import{c as e,h as t,r as n}from"./vendor-NJP34MHU.js";import{i as r}from"./translator-Dvvasoz-.js";import{f as i,l as a,o,p as s,u as c}from"./ui-TBzvKaKQ.js";import{d as l}from"./files-Chpd_QD0.js";import{m as u,p as d,r as f}from"./web-qJCedJJw.js";function uploadProblem(e,t,n){let i=t.trim();if(i!==``&&l(i)===null)return{folder:r(`app.web.newFile.folderOutside`)};let a=i===``?``:`${l(i)}/`,o=new Set(n.map(e=>e.rel.toLowerCase())),s=new Set;for(let t=0;t<e.length;t+=1){let n=e[t].name.trim(),i=u(n);if(i)return{index:t,text:i};if(!f(n))return{index:t,text:r(`app.web.upload.extension`)};let c=`${a}${n}`.toLowerCase();if(o.has(c)||s.has(c))return{index:t,text:r(`app.web.newFile.exists`)};s.add(c)}return null}function UploadDialog({files:u,existing:f,folders:p,onUpload:m,onClose:h}){let[g,_]=e(()=>u.map(e=>({file:e,name:e.name}))),[v,y]=e(``),[b,x]=e(!1),[S,C]=e(null),w=o(),T=uploadProblem(g,v,f),upload=async()=>{if(w.submit(),T)requestAnimationFrame(()=>document.querySelector(`.ui-dialog [aria-invalid="true"]`)?.focus());else{x(!0),C(null);try{let e=v.trim()===``?``:`${l(v.trim())}/`;await m(await Promise.all(g.map(async t=>({rel:`${e}${t.name.trim()}`,content:await t.file.text()})))),h()}catch(e){C(d(e)),x(!1)}}},nameError=e=>T&&`index`in T&&T.index===e?w.errorOf(`name${e}`,T.text):null,E=T&&`folder`in T?w.errorOf(`folder`,T.folder):null;return n(i,{title:r(`app.web.upload.title`),size:`medium`,onClose:h,onSubmit:()=>void upload(),footer:n(s,{actions:[{id:`cancel`,label:r(`app.common.cancel`),role:`cancel`,onClick:h,disabled:b},{id:`upload`,label:g.length===1?r(`app.web.upload.addOne`):r(`app.web.upload.addMany`,{count:g.length}),role:`primary`,onClick:()=>void upload(),busy:b}]}),children:[n(`p`,{class:`web-dialog-text type-body`,children:r(`app.web.upload.text`)}),n(a,{label:r(`app.web.newFile.folder`),optional:!0,hint:r(`app.web.newFile.folderHint`),error:E,children:e=>n(t,{children:[n(`input`,{...e,value:v,list:`web-upload-folders`,spellcheck:!1,autocomplete:`off`,onInput:e=>y(e.target.value),onBlur:()=>w.touch(`folder`)}),n(`datalist`,{id:`web-upload-folders`,children:p.slice(0,500).map(e=>n(`option`,{value:e},e))})]})}),g.map((e,t)=>n(a,{label:g.length===1?r(`app.web.newFile.name`):r(`app.web.upload.fileN`,{number:t+1}),error:nameError(t),children:r=>n(`input`,{...r,value:e.name,spellcheck:!1,autocomplete:`off`,onInput:e=>{let n=e.target.value;_(e=>e.map((e,r)=>r===t?{...e,name:n}:e))},onBlur:()=>w.touch(`name${t}`)})},t)),S&&n(c,{children:S})]})}export{UploadDialog};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-B8BYMn-z.js";import{i as t}from"./translator-Dvvasoz-.js";import{S as n,_ as r,h as i,i as a,n as o,r as s,y as c}from"./moddle-CGpeSs3G.js";var l=`{Type}_{Name}`;function pascal(e){return typeof e==`string`?e.split(/[^A-Za-z0-9]+/).filter(Boolean).map(e=>e[0].toUpperCase()+e.slice(1)).join(``):``}function typeOf(e){return(e.$type??e.type??``).replace(/^[a-z0-9]+:/i,``)}function validId(e){let t=e.replace(/[^A-Za-z0-9_.-]/g,`_`);return/^[A-Za-z_]/.test(t)?t:`_${t}`}function idFor(e,t,n){if(!n.fromName)return null;let r=pascal(t);return r?validId((typeof n.pattern==`string`&&n.pattern?n.pattern:l).replace(`{Type}`,()=>typeOf(e)).replace(`{Name}`,()=>r)):null}var u=1e6;function uniqueId(e,t){if(!t(e))return e;for(let n=2;n<u;n+=1){let r=`${e}_${n}`;if(!t(r))return r}return`${e}_${u}`}function defaultsFor(e,t){let n=e?.defaults;if(typeof n!=`object`||!n||!Object.hasOwn(n,t))return{};let r=n[t];return typeof r==`object`&&r?r:{}}var d={task:{type:`bpmn:Task`},"user-task":{type:`bpmn:UserTask`},"service-task":{type:`bpmn:ServiceTask`},"script-task":{type:`bpmn:ScriptTask`},"send-task":{type:`bpmn:SendTask`},"receive-task":{type:`bpmn:ReceiveTask`},"business-rule-task":{type:`bpmn:BusinessRuleTask`},"manual-task":{type:`bpmn:ManualTask`},"call-activity":{type:`bpmn:CallActivity`},"sub-process":{type:`bpmn:SubProcess`},"end-event":{type:`bpmn:EndEvent`},"intermediate-catch-event":{type:`bpmn:IntermediateCatchEvent`},"intermediate-throw-event":{type:`bpmn:IntermediateThrowEvent`},"exclusive-gateway":{type:`bpmn:ExclusiveGateway`},"parallel-gateway":{type:`bpmn:ParallelGateway`},"inclusive-gateway":{type:`bpmn:InclusiveGateway`},"event-based-gateway":{type:`bpmn:EventBasedGateway`}},f={message:`bpmn:MessageEventDefinition`,timer:`bpmn:TimerEventDefinition`,signal:`bpmn:SignalEventDefinition`,error:`bpmn:ErrorEventDefinition`,escalation:`bpmn:EscalationEventDefinition`,conditional:`bpmn:ConditionalEventDefinition`,terminate:`bpmn:TerminateEventDefinition`},described=(e,t,n)=>({kind:t,description:`app.cli.edit.property.${e}`,on:n}),p=[`bpmn:Task`,`bpmn:UserTask`,`bpmn:ServiceTask`,`bpmn:ScriptTask`,`bpmn:SendTask`,`bpmn:ReceiveTask`,`bpmn:BusinessRuleTask`,`bpmn:ManualTask`,`bpmn:CallActivity`,`bpmn:SubProcess`],m=[`bpmn:ServiceTask`,`bpmn:SendTask`,`bpmn:BusinessRuleTask`,`bpmn:ScriptTask`],h={name:described(`name`,`string`),documentation:described(`documentation`,`string`)},g={...h,condition:described(`condition`,`string`,[`bpmn:SequenceFlow`]),class:described(`class`,`string`,m),delegateExpression:described(`delegateExpression`,`string`,m),expression:described(`expression`,`string`,m),resultVariable:described(`resultVariable`,`string`,m),topic:described(`topic`,`string`,m),asyncBefore:described(`asyncBefore`,`boolean`),asyncAfter:described(`asyncAfter`,`boolean`),assignee:described(`assignee`,`string`,[`bpmn:UserTask`]),candidateUsers:described(`candidateUsers`,`string`,[`bpmn:UserTask`]),candidateGroups:described(`candidateGroups`,`string`,[`bpmn:UserTask`]),formKey:described(`formKey`,`string`,[`bpmn:UserTask`,`bpmn:StartEvent`]),calledElement:described(`calledElement`,`string`,[`bpmn:CallActivity`]),decisionRef:described(`decisionRef`,`string`,[`bpmn:BusinessRuleTask`]),inputs:described(`inputs`,`mapping`,p),outputs:described(`outputs`,`mapping`,p)},_={...h,condition:described(`condition`,`string`,[`bpmn:SequenceFlow`]),class:described(`class`,`string`,[`bpmn:ServiceTask`,`bpmn:SendTask`,`bpmn:BusinessRuleTask`]),delegateExpression:described(`delegateExpression`,`string`,[`bpmn:ServiceTask`,`bpmn:SendTask`,`bpmn:BusinessRuleTask`]),expression:described(`expression`,`string`,[`bpmn:ServiceTask`,`bpmn:SendTask`,`bpmn:BusinessRuleTask`]),resultVariable:described(`resultVariable`,`string`,[`bpmn:ServiceTask`,`bpmn:ScriptTask`,`bpmn:BusinessRuleTask`]),async:described(`async`,`boolean`,[`bpmn:Task`,`bpmn:UserTask`,`bpmn:ServiceTask`,`bpmn:ScriptTask`,`bpmn:SendTask`,`bpmn:ReceiveTask`,`bpmn:BusinessRuleTask`,`bpmn:ManualTask`,`bpmn:CallActivity`,`bpmn:SubProcess`]),skipExpression:described(`skipExpression`,`string`,[`bpmn:Task`,`bpmn:UserTask`,`bpmn:ServiceTask`,`bpmn:ScriptTask`,`bpmn:SendTask`,`bpmn:ReceiveTask`,`bpmn:BusinessRuleTask`,`bpmn:ManualTask`]),assignee:described(`assignee`,`string`,[`bpmn:UserTask`]),candidateUsers:described(`candidateUsers`,`string`,[`bpmn:UserTask`]),candidateGroups:described(`candidateGroups`,`string`,[`bpmn:UserTask`]),formKey:described(`formKey`,`string`,[`bpmn:UserTask`,`bpmn:StartEvent`]),calledElement:described(`calledElement`,`string`,[`bpmn:CallActivity`])},v={classic:{...h,condition:described(`conditionSimple`,`string`,[`bpmn:SequenceFlow`])},"camunda-7":g,operaton:g,"cib-seven":g,flowable:_,activiti:_,"camunda-8":{...h,condition:described(`feelCondition`,`string`,[`bpmn:SequenceFlow`]),jobType:described(`jobType`,`string`,m),retries:described(`retries`,`integer`,m),assignee:described(`assignee`,`string`,[`bpmn:UserTask`]),candidateUsers:described(`candidateUsers`,`string`,[`bpmn:UserTask`]),candidateGroups:described(`candidateGroups`,`string`,[`bpmn:UserTask`]),formId:described(`formId`,`string`,[`bpmn:UserTask`]),processId:described(`processId`,`string`,[`bpmn:CallActivity`]),decisionId:described(`decisionId`,`string`,[`bpmn:BusinessRuleTask`]),inputs:described(`inputMappings`,`mapping`,p),outputs:described(`outputMappings`,`mapping`,p)}},ContractError=class extends Error{};function propertyAllowedOn(e,t,n){let r=Object.hasOwn(v[e],t)?v[e][t]:void 0;return!!r&&(!r.on||r.on.includes(n))}var y={"bpmn:EndEvent":[`message`,`signal`,`error`,`escalation`,`terminate`],"bpmn:IntermediateThrowEvent":[`message`,`signal`,`escalation`],"bpmn:IntermediateCatchEvent":[`message`,`timer`,`signal`,`conditional`]},b=[`bpmn:ReceiveTask`,`bpmn:IntermediateCatchEvent`];function checkEventDefinition(e,n){if(n&&(!(y[e]??[]).includes(n)||!Object.hasOwn(f,n)))throw new ContractError(t(`app.patch.eventNotAllowed`,{type:typeOf({type:e}),event:n}))}function checkSequenceFlow(e,n,r){if(e.id===n.id)throw new ContractError(t(`app.patch.sameElement`,{id:e.id}));if(e.type===`bpmn:EndEvent`)throw new ContractError(t(`app.cli.edit.afterEndEvent`,{id:e.id}));if(n.type===`bpmn:StartEvent`)throw new ContractError(t(`app.patch.startEventTarget`,{id:n.id}));if(n.type===`bpmn:BoundaryEvent`)throw new ContractError(t(`app.patch.boundaryTarget`,{id:n.id}));if(e.scope!==n.scope)throw new ContractError(t(`app.patch.differentScopes`,{from:e.id,to:n.id}));if(e.type===`bpmn:EventBasedGateway`&&!b.includes(n.type))throw new ContractError(t(`app.patch.eventBasedTarget`,{to:n.id}));if(r(e.id,n.id))throw new ContractError(t(`app.patch.duplicateFlow`,{from:e.id,to:n.id}))}var x=12,S=6,C=[0,1,-1,2,-2,3,-3,4,-4];function sizeOf(e){return e.endsWith(`Event`)?{width:36,height:36}:e.endsWith(`Gateway`)?{width:50,height:50}:e===`bpmn:SubProcess`?{width:350,height:200}:{width:100,height:80}}function overlaps(e,t,n=0){return e.x<t.x+t.width+n&&e.x+e.width+n>t.x&&e.y<t.y+t.height+n&&e.y+e.height+n>t.y}function labelBoxOf(e,t,n){if(!t||!/(Event|Gateway)$/.test(e))return;let r=Math.max(n.width,Math.min(t.length*7,120));return{x:Math.round(n.x+n.width/2-r/2),y:n.y+n.height+4,width:r,height:28}}function contains(e,t){return t.x>=e.x&&t.y>=e.y&&t.x+t.width<=e.x+e.width&&t.y+t.height<=e.y+e.height}function centreOf(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function placeAfter(e,t,n,r,i=50,a){let{width:o,height:s}=sizeOf(t),c=e.y+e.height/2,l=[];for(let t=0;t<S;t+=1)for(let n of C)l.push({x:Math.round(e.x+e.width+i+t*(o+i)),y:Math.round(c-s/2+n*(s+i*.6)),width:o,height:s});let clear=e=>!n.some(t=>overlaps(e,t,x)),free=e=>{let n=labelBoxOf(t,a,e);return clear(e)&&(!n||clear(n))},inside=e=>!r||contains(r,e);return l.find(e=>inside(e)&&free(e))??l.find(free)??l[0]}function routeBetween(e,t){let n=centreOf(e),r=centreOf(t);if(t.x>=e.x+e.width){let i={x:e.x+e.width,y:n.y},a={x:t.x,y:r.y};if(i.y===a.y)return[i,a];let o=Math.round((i.x+a.x)/2);return[i,{x:o,y:i.y},{x:o,y:a.y},a]}let i=Math.max(e.y+e.height,t.y+t.height)+25;return[{x:n.x,y:e.y+e.height},{x:n.x,y:i},{x:r.x,y:i},{x:r.x,y:t.y+t.height}]}var w=[`class`,`delegateExpression`,`expression`,`topic`],T=[`class`,`delegateExpression`,`expression`];function setProperties(e,n,r,i){for(let e of Object.keys(i))if(!propertyAllowedOn(n,e,r.type))throw new ContractError(t(`app.cli.edit.doesNotApply`,{key:e,type:typeOf(r),id:r.id}));for(let[t,a]of Object.entries(i))setProperty(e,n,r,t,a)}function setProperty(e,t,n,i,a){let{modeling:o,moddle:s}=e;if(i===`name`)return o.updateProperties(n,{name:a});if(i===`documentation`)return o.updateProperties(n,{documentation:[s.create(`bpmn:Documentation`,{text:a})]});if(i===`condition`)return o.updateProperties(n,{conditionExpression:s.create(`bpmn:FormalExpression`,{body:a})});if(r(t))return setCamunda7(e,t,n,i,a);if(c(t))return setFlowable(e,t,n,i,a);if(t===`camunda-8`)return setCamunda8(e,n,i,a)}function setCamunda7(e,t,n,r,a){let{modeling:o,moddle:s}=e,c=i(t);if(w.includes(r)){let e=Object.fromEntries([`class`,`delegateExpression`,`expression`,`topic`,`type`].map(e=>[`${c}:${e}`,void 0])),t=r===`topic`?{[`${c}:type`]:`external`,[`${c}:topic`]:a}:{[`${c}:${r}`]:a};return o.updateProperties(n,{...e,...t})}if(r===`inputs`||r===`outputs`){let t=extension(e,n,`${c}:InputOutput`),i=Object.entries(a).map(([e,t])=>s.create(r===`inputs`?`${c}:InputParameter`:`${c}:OutputParameter`,{name:e,value:t}));return o.updateModdleProperties(n,t,{[r===`inputs`?`inputParameters`:`outputParameters`]:i})}return o.updateProperties(n,{[`${c}:${r}`]:a})}function setFlowable(e,t,n,r,a){let o=i(t);if(T.includes(r)){let t=Object.fromEntries([`class`,`delegateExpression`,`expression`,`type`].map(e=>[`${o}:${e}`,void 0]));return e.modeling.updateProperties(n,{...t,[`${o}:${r}`]:a})}return r===`resultVariable`?e.modeling.updateProperties(n,{[`${o}:${n.type===`bpmn:ServiceTask`?`resultVariableName`:`resultVariable`}`]:a}):e.modeling.updateProperties(n,{[`${o}:${r}`]:a})}function setCamunda8(e,t,n,r){let{modeling:i,moddle:a}=e,update=(n,r)=>{i.updateModdleProperties(t,extension(e,t,n),r)};switch(n){case`jobType`:return update(`zeebe:TaskDefinition`,{type:r});case`retries`:return update(`zeebe:TaskDefinition`,{retries:String(r)});case`assignee`:case`candidateUsers`:case`candidateGroups`:return update(`zeebe:AssignmentDefinition`,{[n]:r});case`formId`:return update(`zeebe:FormDefinition`,{formId:r});case`processId`:return update(`zeebe:CalledElement`,{processId:r});case`decisionId`:return update(`zeebe:CalledDecision`,{decisionId:r});case`inputs`:case`outputs`:{let e=Object.entries(r).map(([e,t])=>a.create(n===`inputs`?`zeebe:Input`:`zeebe:Output`,{target:e,source:t}));return update(`zeebe:IoMapping`,{[n===`inputs`?`inputParameters`:`outputParameters`]:e})}}}function extension(e,t,n){let{modeling:r,moddle:i}=e,a=t.businessObject.extensionElements;a||(a=i.create(`bpmn:ExtensionElements`,{values:[]}),r.updateProperties(t,{extensionElements:a}));let o=(a.values??[]).find(e=>e.$type===n);if(o)return o;let s=i.create(n);return s.$parent=a,r.updateModdleProperties(t,a,{values:[...a.values??[],s]}),s}function readProperties(e,t){let n={},a=e.extensionElements?.values??[],find=e=>a.find(t=>t.$type===e),put=(e,t)=>{t!=null&&t!==``&&(n[e]=t)};put(`documentation`,e.documentation?.[0]?.text),put(`condition`,e.conditionExpression?.body);let o=e.eventDefinitions?.[0]?.$type;if(o&&put(`event`,Object.entries(f).find(([,e])=>e===o)?.[0]),r(t)){let n=i(t);for(let t of Object.keys(v[`camunda-7`])){if([`inputs`,`outputs`,`name`,`documentation`,`condition`].includes(t))continue;let r=e.get(`${n}:${t}`);(typeof r!=`boolean`||Object.prototype.hasOwnProperty.call(e,t))&&put(t,r)}let r=find(`${n}:InputOutput`),map=e=>e?.length?Object.fromEntries(e.map(e=>[e.name,String(e.value??``)])):void 0;put(`inputs`,map(r?.inputParameters)),put(`outputs`,map(r?.outputParameters))}if(c(t)){let n=i(t);for(let r of Object.keys(v[t])){if([`name`,`documentation`,`condition`,`resultVariable`].includes(r))continue;let t=e.get(`${n}:${r}`);(typeof t!=`boolean`||Object.prototype.hasOwnProperty.call(e,r))&&put(r,t)}put(`resultVariable`,e.get(`${n}:resultVariableName`)??e.get(`${n}:resultVariable`))}if(t===`camunda-8`){let e=find(`zeebe:TaskDefinition`);put(`jobType`,e?.type),put(`retries`,e?.retries===void 0?void 0:Number(e.retries));let t=find(`zeebe:AssignmentDefinition`);put(`assignee`,t?.assignee),put(`candidateUsers`,t?.candidateUsers),put(`candidateGroups`,t?.candidateGroups),put(`formId`,find(`zeebe:FormDefinition`)?.formId),put(`processId`,find(`zeebe:CalledElement`)?.processId),put(`decisionId`,find(`zeebe:CalledDecision`)?.decisionId);let n=find(`zeebe:IoMapping`),map=e=>e?.length?Object.fromEntries(e.map(e=>[e.target,String(e.source??``)])):void 0;put(`inputs`,map(n?.inputParameters)),put(`outputs`,map(n?.outputParameters))}return n}var E=e({applyPatch:()=>applyPatch,closureOf:()=>closureOf,dependenciesOf:()=>dependenciesOf,dependentsOf:()=>dependentsOf,inspectModel:()=>inspectModel}),D=`bpmn:SequenceFlow`;function hash(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t.toString(36).padStart(7,`0`).slice(-7)}function prefixOf(e){return e.endsWith(`Gateway`)?`Gateway`:e.endsWith(`Event`)?`Event`:`Activity`}function referencesOf(e){switch(e.op){case`add`:return[e.after];case`connect`:return[e.from,e.to];default:return[e.id]}}function dependenciesOf(e){let t=new Map;return e.map((e,n)=>{let r=new Set;for(let n of referencesOf(e)){let e=t.get(n);e!==void 0&&r.add(e)}return e.op===`add`&&e.id&&!t.has(e.id)&&t.set(e.id,n),[...r].sort((e,t)=>e-t)})}function closureOf(e,t){let n=dependenciesOf(e),r=new Set,visit=e=>{r.has(e)||(r.add(e),n[e].forEach(visit))};for(let e of t)visit(e);return[...r].sort((e,t)=>e-t)}function dependentsOf(e,t){let n=dependenciesOf(e),r=new Set(t);for(let t=0;t<e.length;t+=1)n[t].some(e=>r.has(e))&&r.add(t);return[...r].sort((e,t)=>e-t)}var Diagram=class{nodes=new Map;flows=new Map;shapes=new Map;edges=new Map;pairs=new Set;taken=new Set;plane;moddle;properties;definitions;engine;conventions;gap;constructor(e,t,n,r=50){this.definitions=e,this.engine=t,this.conventions=n,this.gap=r,this.moddle=o(e),this.plane=e.diagrams?.[0]?.plane,this.properties={moddle:this.moddle,modeling:{updateProperties:(e,t)=>{for(let[n,r]of Object.entries(t))e.businessObject.set(n,r)},updateModdleProperties:(e,t,n)=>{for(let[e,r]of Object.entries(n))t.set(e,r)}}},this.index()}index(){let claim=e=>{typeof e==`string`&&this.taken.add(e)},e=new Set,t=[this.definitions];for(;t.length>0;){let n=t.pop();if(n&&typeof n==`object`&&!e.has(n)){if(e.add(n),Array.isArray(n))t.push(...n);else{claim(n.id);for(let[e,r]of Object.entries(n))!e.startsWith(`$`)&&r&&typeof r==`object`&&t.push(r)}}}for(let e of this.definitions.rootElements??[])if(e.$type===`bpmn:Process`&&this.walk(e),e.$type===`bpmn:Collaboration`){this.nodes.set(e.id,{bo:e,kind:`root`});for(let t of e.participants??[])this.nodes.set(t.id,{bo:t,kind:`container`}),t.processRef&&this.walk(t.processRef)}for(let e of this.plane?.planeElement??[]){let t=e.bpmnElement?.id;t&&(e.$type===`bpmndi:BPMNShape`&&this.shapes.set(t,e),e.$type===`bpmndi:BPMNEdge`&&this.edges.set(t,e))}}walk(e){this.nodes.has(e.id)||this.nodes.set(e.id,{bo:e,kind:`root`});for(let t of e.laneSets?.flatMap(e=>this.lanesOf(e))??[])this.nodes.set(t.id,{bo:t,kind:`container`});for(let t of e.flowElements??[])t.$type===D?(this.flows.set(t.id,t),this.pairs.add(`${t.sourceRef?.id}>${t.targetRef?.id}`)):t.$instanceOf(`bpmn:FlowNode`)&&(this.nodes.set(t.id,{bo:t,kind:`node`}),t.$instanceOf(`bpmn:SubProcess`)&&this.walk(t))}lanesOf(e){return(e.lanes??[]).flatMap(e=>[e,...e.childLaneSet?this.lanesOf(e.childLaneSet):[]])}has(e){return this.nodes.has(e)||this.flows.has(e)}node(e){let n=this.nodes.get(e);if(!n)throw new ContractError(t(`app.cli.edit.noSuchElement`,{id:e}));return n}freshId(e,t){let n=e===D?`Flow`:prefixOf(e);for(let e=0;;e+=1){let r=`${n}_${hash(e===0?t:`${t}#${e}`)}`;if(!this.taken.has(r))return r}}boundsOf(e){let t=this.shapes.get(e)?.bounds;return t?{x:t.x,y:t.y,width:t.width,height:t.height}:void 0}pointsOf(e){let t=this.edges.get(e)?.waypoint;return t?t.map(e=>({x:e.x,y:e.y})):void 0}snapshot(e){let t=this.flows.get(e),n=t??this.nodes.get(e)?.bo,r=n?.$parent;return{id:e,type:n?.$type??``,...n?.name?{name:n.name}:{},...this.boundsOf(e)?{bounds:this.boundsOf(e)}:{},...t?{waypoints:this.pointsOf(e),source:t.sourceRef?.id,target:t.targetRef?.id}:{},...r?.id&&r.$type!==`bpmn:Definitions`?{parent:r.id}:{},...n?.attachedToRef?.id?{attachedTo:n.attachedToRef.id}:{}}}scopeOf(e){return e.attachedToRef?e.attachedToRef.$parent:e.$parent}shape(e,t){let n=this.moddle.create(`dc:Bounds`,t),r={id:this.uniqueDi(e.id),bpmnElement:e,bounds:n};e.$type===`bpmn:ExclusiveGateway`&&(r.isMarkerVisible=!0),e.$type===`bpmn:SubProcess`&&(r.isExpanded=!0);let i=this.moddle.create(`bpmndi:BPMNShape`,r);this.plane.get(`planeElement`).push(i),i.$parent=this.plane,this.shapes.set(e.id,i)}uniqueDi(e){let t=uniqueId(`${e}_di`,e=>this.taken.has(e));return this.taken.add(t),t}edge(e,t){let n=this.moddle.create(`bpmndi:BPMNEdge`,{id:this.uniqueDi(e.id),bpmnElement:e,waypoint:t.map(e=>this.moddle.create(`dc:Point`,e))});this.plane.get(`planeElement`).push(n),n.$parent=this.plane,this.edges.set(e.id,n)}reroute(e){let t=this.flows.get(e),n=this.edges.get(e),r=this.boundsOf(t?.sourceRef?.id),i=this.boundsOf(t?.targetRef?.id);n&&r&&i&&n.set(`waypoint`,routeBetween(r,i).map(e=>this.moddle.create(`dc:Point`,e)))}unplane(e){for(let t of[this.shapes,this.edges]){let n=t.get(e);if(!n)continue;let r=this.plane.get(`planeElement`),i=r.indexOf(n);i>=0&&r.splice(i,1),t.delete(e)}}occupiedAround(e,t){let n=[];for(let[r,i]of this.nodes){if(i.kind!==`node`||t.has(r))continue;let a=this.boundsOf(r);if(!a||i.bo.$instanceOf(`bpmn:SubProcess`)&&contains(a,e))continue;n.push(a);let o=this.labelOf(r,a,i.bo);o&&n.push(o)}return n}labelOf(e,t,n){let r=this.shapes.get(e)?.label?.bounds;return r?{x:r.x,y:r.y,width:r.width,height:r.height}:labelBoxOf(n.$type,n.name,t)}withinOf(e){if(e.$instanceOf(`bpmn:SubProcess`))return this.boundsOf(e.id);for(let t of this.definitions.rootElements??[]){if(t.$type!==`bpmn:Collaboration`)continue;let n=(t.participants??[]).find(t=>t.processRef===e);if(n)return this.boundsOf(n.id)}}describe(){let e=[];for(let[t,n]of this.nodes){if(n.kind===`root`)continue;let r=this.scopeOf(n.bo)?.id;e.push({id:t,type:typeOf(n.bo),...n.bo.name?{name:n.bo.name}:{},...r?{parent:r}:{},properties:readProperties(n.bo,this.engine)})}for(let[t,n]of this.flows)e.push({id:t,type:typeOf(n),...n.name?{name:n.name}:{},source:n.sourceRef?.id,target:n.targetRef?.id,properties:readProperties(n,this.engine)});return e.sort((e,t)=>e.id<t.id?-1:+(e.id>t.id))}snapshotAll(){return{nodes:[...this.nodes].filter(([,e])=>e.kind===`node`).map(([e])=>this.snapshot(e)),flows:[...this.flows.keys()].map(e=>this.snapshot(e))}}flowTouching(e){return[...this.flows.values()].filter(t=>t.sourceRef?.id===e||t.targetRef?.id===e).map(e=>e.id)}create(e,n,r){if(this.flows.has(e.after))throw new ContractError(t(`app.cli.edit.isAConnection`,{id:e.after}));let i=this.node(e.after);if(i.kind!==`node`)throw new ContractError(t(`app.cli.edit.addAfterAnElementInside`,{id:e.after,type:typeOf(i.bo)}));if(!this.plane)throw new ContractError(t(`app.patch.noDrawing`));let a=d[e.element].type,o=this.scopeOf(i.bo);if(checkEventDefinition(a,e.event),e.id&&this.taken.has(e.id))throw new ContractError(t(`app.cli.edit.idTaken`,{id:e.id}));checkSequenceFlow({id:i.bo.id,type:i.bo.$type,scope:o},{id:e.id??``,type:a,scope:o},(e,t)=>this.pairs.has(`${e}>${t}`));let s=e.id;if(!s){let t=e.name&&this.conventions.ids?idFor({$type:a},e.name,this.conventions.ids):null;s=t?uniqueId(t,e=>this.taken.has(e)):this.freshId(a,`${n}:${a}:${e.name??``}:${e.after}`)}this.taken.add(s);let c=this.moddle.create(a,{id:s});if(c.$parent=o,e.event){let t=this.moddle.create(f[e.event]);t.$parent=c,c.get(`eventDefinitions`).push(t)}o.get(`flowElements`).push(c),this.nodes.set(s,{bo:c,kind:`node`});for(let e of[...this.nodes.values()].filter(e=>e.kind===`container`&&e.bo.$type===`bpmn:Lane`))(e.bo.flowNodeRef??[]).includes(i.bo)&&e.bo.get(`flowNodeRef`).push(c);let l=this.boundsOf(i.bo.id);if(!l)throw new ContractError(t(`app.patch.noDrawing`));let u=placeAfter(l,a,this.occupiedAround(l,new Set([s])),this.withinOf(o),this.gap,e.name);this.shape(c,u);let p=defaultsFor(this.conventions,a);Object.keys(p).length>0&&this.properties.modeling.updateProperties({businessObject:c},p),e.name&&c.set(`name`,e.name),e.properties&&setProperties(this.properties,this.engine,{id:s,type:a,businessObject:c},e.properties);let m=this.link(i.bo,c,`${n}:flow:${i.bo.id}>${s}`);r.added.push(this.snapshot(s)),r.addedFlows.push(this.snapshot(m.id)),r.touched.push(s,m.id),r.summary=t(`app.cli.edit.added`,{type:typeOf(c),id:s,after:i.bo.id})}link(e,t,n){let r=this.freshId(D,n);this.taken.add(r);let i=this.moddle.create(D,{id:r,sourceRef:e,targetRef:t}),a=this.scopeOf(e);i.$parent=a,a.get(`flowElements`).push(i),e.get(`outgoing`).push(i),t.get(`incoming`).push(i),this.flows.set(r,i),this.pairs.add(`${e.id}>${t.id}`);let o=this.boundsOf(e.id),s=this.boundsOf(t.id);return o&&s&&this.plane&&this.edge(i,routeBetween(o,s)),i}connect(e,n,r){let i=this.node(e.from),a=this.node(e.to);if(i.kind!==`node`)throw new ContractError(t(`app.patch.notAFlowNode`,{id:e.from,type:typeOf(i.bo)}));if(a.kind!==`node`)throw new ContractError(t(`app.patch.notAFlowNode`,{id:e.to,type:typeOf(a.bo)}));checkSequenceFlow({id:i.bo.id,type:i.bo.$type,scope:this.scopeOf(i.bo)},{id:a.bo.id,type:a.bo.$type,scope:this.scopeOf(a.bo)},(e,t)=>this.pairs.has(`${e}>${t}`));let o=this.link(i.bo,a.bo,`${n}:flow:${e.from}>${e.to}`);e.name&&o.set(`name`,e.name),e.condition&&setProperties(this.properties,this.engine,{id:o.id,type:D,businessObject:o},{condition:e.condition}),r.addedFlows.push(this.snapshot(o.id)),r.touched.push(o.id),r.summary=t(`app.cli.edit.connect`,{from:e.from,to:e.to,id:o.id})}set(e,n){let r=this.flows.get(e.id)??this.node(e.id).bo;setProperties(this.properties,this.engine,{id:r.id,type:r.$type,businessObject:r},e.properties),n.changed.push({id:r.id,keys:Object.keys(e.properties),bounds:this.boundsOf(r.id)}),n.touched.push(r.id),n.summary=t(`app.cli.edit.set`,{keys:Object.keys(e.properties).join(`, `),id:r.id})}remove(e,n){let r=this.flows.get(e.id);if(r){this.snapshotAndDrop([r.id],n),n.summary=t(`app.cli.edit.removed`,{id:e.id});return}let i=this.node(e.id);if(i.kind===`root`)throw new ContractError(t(`app.cli.edit.isTheRoot`,{id:e.id}));if(i.kind===`container`)throw new ContractError(t(`app.patch.cannotRemoveContainer`,{id:e.id,type:typeOf(i.bo)}));let a=new Set([e.id]),o=[i.bo];for(;o.length>0;){let e=o.pop();for(let t of this.nodes.values())t.bo.attachedToRef===e&&!a.has(t.bo.id)&&(a.add(t.bo.id),o.push(t.bo));if(e.$instanceOf(`bpmn:SubProcess`))for(let t of e.flowElements??[])t.$type!==D&&this.nodes.has(t.id)&&!a.has(t.id)&&(a.add(t.id),o.push(t))}let s=new Set;for(let e of a)for(let t of this.flowTouching(e))s.add(t);this.snapshotAndDrop([...s,...a],n),n.summary=t(`app.cli.edit.removed`,{id:e.id})}snapshotAndDrop(e,t){let n=[...new Set(e)];for(let e of n)t.removed.push(this.snapshot(e));for(let e of n){let t=this.flows.get(e);if(t){let dropFrom=(e,t)=>{let n=e?.indexOf(t)??-1;n>=0&&e.splice(n,1)};dropFrom(t.sourceRef?.outgoing,t),dropFrom(t.targetRef?.incoming,t),dropFrom(t.$parent?.flowElements,t),t.sourceRef?.default===t&&t.sourceRef.set(`default`,void 0),this.flows.delete(e),this.pairs.delete(`${t.sourceRef?.id}>${t.targetRef?.id}`),this.unplane(e);continue}let n=this.nodes.get(e);if(!n)continue;let r=n.bo.$parent?.flowElements,i=r?.indexOf(n.bo)??-1;i>=0&&r.splice(i,1);for(let e of this.nodes.values()){let t=e.bo.flowNodeRef,r=t?.indexOf(n.bo)??-1;r>=0&&t.splice(r,1)}this.nodes.delete(e),this.unplane(e)}t.touched.push(...n)}move(e,n){if(this.flows.has(e.id))throw new ContractError(t(`app.patch.isAFlow`,{id:e.id}));let r=this.node(e.id);if(r.kind!==`node`)throw new ContractError(t(`app.patch.notAFlowNode`,{id:e.id,type:typeOf(r.bo)}));if(!this.shapes.has(e.id))throw new ContractError(t(`app.patch.noDrawing`));let i=new Set([e.id]);for(let e of this.nodes.values())e.bo.attachedToRef===r.bo&&i.add(e.bo.id);if(r.bo.$instanceOf(`bpmn:SubProcess`)){let visit=e=>{for(let t of e.flowElements??[])t.$type!==D&&(i.add(t.id),t.$instanceOf(`bpmn:SubProcess`)&&visit(t))};visit(r.bo)}for(let t of i){let r=this.shapes.get(t)?.bounds;if(!r)continue;let i=this.boundsOf(t);r.set(`x`,i.x+e.dx),r.set(`y`,i.y+e.dy),n.moved.push({id:t,from:i,to:this.boundsOf(t)}),n.touched.push(t)}for(let t of this.flows.values()){let n=i.has(t.sourceRef?.id),r=i.has(t.targetRef?.id);if(n||r){if(n&&r){let n=this.edges.get(t.id);for(let t of n?.waypoint??[])t.set(`x`,t.x+e.dx),t.set(`y`,t.y+e.dy)}else this.reroute(t.id)}}n.summary=t(`app.cli.edit.moved`,{id:e.id,dx:e.dx,dy:e.dy})}};function emptyEffect(e,t){return{index:e,operation:t,summary:``,added:[],addedFlows:[],removed:[],changed:[],moved:[],touched:[]}}function run(e,n){let r=dependenciesOf(n),i=[];return n.forEach((n,a)=>{let o=emptyEffect(a,n);i.push(o);let s=r[a].find(e=>i[e].error);if(s!==void 0)o.skipped=!0,o.error=t(`app.patch.dependsOnFailed`,{number:s+1});else try{switch(n.op){case`add`:e.create(n,a,o);break;case`connect`:e.connect(n,a,o);break;case`set`:e.set(n,o);break;case`remove`:e.remove(n,o);break;case`move`:e.move(n,o)}}catch(e){if(!(e instanceof ContractError))throw e;o.error=e.message}}),i}async function applyPatch(e,t,r){if(t.operations.length===0)return{ok:!0,xml:e,steps:[]};let i=await s(e,n(r.engine));if(!i)return{ok:!1,steps:[],failedAt:-1};let o=run(new Diagram(i,r.engine,r.conventions??{},r.gap),t.operations),c=o.find(e=>e.error);return c?{ok:!1,steps:o,failedAt:c.index}:{ok:!0,xml:await a(i),steps:o}}async function inspectModel(e,t){let r=await s(e,n(t));if(!r)return null;let i=new Diagram(r,t,{});return{elements:i.describe(),...i.snapshotAll()}}export{dependentsOf as a,ContractError as c,propertyAllowedOn as d,defaultsFor as f,dependenciesOf as i,d as l,uniqueId as m,E as n,inspectModel as o,idFor as p,closureOf as r,setProperties as s,applyPatch as t,f as u};