camunda-bpmn-js 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28375,11 +28375,11 @@
28375
28375
 
28376
28376
  var n$3,l$3,u$3,t$5,o$5,f$3={},e$5=[],c$3=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function s$3(n,l){for(var u in l)n[u]=l[u];return n}function a$4(n){var l=n.parentNode;l&&l.removeChild(n);}function h$3(l,u,i){var t,o,r,f={};for(r in u)"key"==r?t=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n$3.call(arguments,2):i),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return v$3(l,f,t,o,null)}function v$3(n,i,t,o,r){var f={type:n,props:i,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++u$3:r};return null==r&&null!=l$3.vnode&&l$3.vnode(f),f}function p$4(n){return n.children}function d$3(n,l){this.props=n,this.context=l;}function _$3(n,l){if(null==l)return n.__?_$3(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return "function"==typeof n.type?_$3(n):null}function k$4(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return k$4(n)}}function b$3(n){(!n.__d&&(n.__d=!0)&&t$5.push(n)&&!g$4.__r++||o$5!==l$3.debounceRendering)&&((o$5=l$3.debounceRendering)||setTimeout)(g$4);}function g$4(){for(var n;g$4.__r=t$5.length;)n=t$5.sort(function(n,l){return n.__v.__b-l.__v.__b}),t$5=[],n.some(function(n){var l,u,i,t,o,r;n.__d&&(o=(t=(l=n).__v).__e,(r=l.__P)&&(u=[],(i=s$3({},t)).__v=t.__v+1,j$4(r,t,i,l.__n,void 0!==r.ownerSVGElement,null!=t.__h?[o]:null,u,null==o?_$3(t):o,t.__h),z$3(u,t),t.__e!=o&&k$4(t)));});}function w$4(n,l,u,i,t,o,r,c,s,a){var h,y,d,k,b,g,w,x=i&&i.__k||e$5,C=x.length;for(u.__k=[],h=0;h<l.length;h++)if(null!=(k=u.__k[h]=null==(k=l[h])||"boolean"==typeof k?null:"string"==typeof k||"number"==typeof k||"bigint"==typeof k?v$3(null,k,null,null,k):Array.isArray(k)?v$3(p$4,{children:k},null,null,null):k.__b>0?v$3(k.type,k.props,k.key,k.ref?k.ref:null,k.__v):k)){if(k.__=u,k.__b=u.__b+1,null===(d=x[h])||d&&k.key==d.key&&k.type===d.type)x[h]=void 0;else for(y=0;y<C;y++){if((d=x[y])&&k.key==d.key&&k.type===d.type){x[y]=void 0;break}d=null;}j$4(n,k,d=d||f$3,t,o,r,c,s,a),b=k.__e,(y=k.ref)&&d.ref!=y&&(w||(w=[]),d.ref&&w.push(d.ref,null,k),w.push(y,k.__c||b,k)),null!=b?(null==g&&(g=b),"function"==typeof k.type&&k.__k===d.__k?k.__d=s=m$4(k,s,n):s=A$3(n,k,d,x,b,s),"function"==typeof u.type&&(u.__d=s)):s&&d.__e==s&&s.parentNode!=n&&(s=_$3(d));}for(u.__e=g,h=C;h--;)null!=x[h]&&N$2(x[h],x[h]);if(w)for(h=0;h<w.length;h++)M$2(w[h],w[++h],w[++h]);}function m$4(n,l,u){for(var i,t=n.__k,o=0;t&&o<t.length;o++)(i=t[o])&&(i.__=n,l="function"==typeof i.type?m$4(i,l,u):A$3(u,i,i,t,i.__e,l));return l}function A$3(n,l,u,i,t,o){var r,f,e;if(void 0!==l.__d)r=l.__d,l.__d=void 0;else if(null==u||t!=o||null==t.parentNode)n:if(null==o||o.parentNode!==n)n.appendChild(t),r=null;else {for(f=o,e=0;(f=f.nextSibling)&&e<i.length;e+=1)if(f==t)break n;n.insertBefore(t,o),r=o;}return void 0!==r?r:t.nextSibling}function C$3(n,l,u,i,t){var o;for(o in u)"children"===o||"key"===o||o in l||H$2(n,o,null,u[o],i);for(o in l)t&&"function"!=typeof l[o]||"children"===o||"key"===o||"value"===o||"checked"===o||u[o]===l[o]||H$2(n,o,l[o],u[o],i);}function $$2(n,l,u){"-"===l[0]?n.setProperty(l,u):n[l]=null==u?"":"number"!=typeof u||c$3.test(l)?u:u+"px";}function H$2(n,l,u,i,t){var o;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof i&&(n.style.cssText=i=""),i)for(l in i)u&&l in u||$$2(n.style,l,"");if(u)for(l in u)i&&u[l]===i[l]||$$2(n.style,l,u[l]);}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/Capture$/,"")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?i||n.addEventListener(l,o?T$4:I$2,o):n.removeEventListener(l,o?T$4:I$2,o);else if("dangerouslySetInnerHTML"!==l){if(t)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("href"!==l&&"list"!==l&&"form"!==l&&"tabIndex"!==l&&"download"!==l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||!1===u&&-1==l.indexOf("-")?n.removeAttribute(l):n.setAttribute(l,u));}}function I$2(n){this.l[n.type+!1](l$3.event?l$3.event(n):n);}function T$4(n){this.l[n.type+!0](l$3.event?l$3.event(n):n);}function j$4(n,u,i,t,o,r,f,e,c){var a,h,v,y,_,k,b,g,m,x,A,C,$,H,I,T=u.type;if(void 0!==u.constructor)return null;null!=i.__h&&(c=i.__h,e=u.__e=i.__e,u.__h=null,r=[e]),(a=l$3.__b)&&a(u);try{n:if("function"==typeof T){if(g=u.props,m=(a=T.contextType)&&t[a.__c],x=a?m?m.props.value:a.__:t,i.__c?b=(h=u.__c=i.__c).__=h.__E:("prototype"in T&&T.prototype.render?u.__c=h=new T(g,x):(u.__c=h=new d$3(g,x),h.constructor=T,h.render=O$2),m&&m.sub(h),h.props=g,h.state||(h.state={}),h.context=x,h.__n=t,v=h.__d=!0,h.__h=[],h._sb=[]),null==h.__s&&(h.__s=h.state),null!=T.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=s$3({},h.__s)),s$3(h.__s,T.getDerivedStateFromProps(g,h.__s))),y=h.props,_=h.state,v)null==T.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else {if(null==T.getDerivedStateFromProps&&g!==y&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(g,x),!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(g,h.__s,x)||u.__v===i.__v){for(h.props=g,h.state=h.__s,u.__v!==i.__v&&(h.__d=!1),h.__v=u,u.__e=i.__e,u.__k=i.__k,u.__k.forEach(function(n){n&&(n.__=u);}),A=0;A<h._sb.length;A++)h.__h.push(h._sb[A]);h._sb=[],h.__h.length&&f.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(g,h.__s,x),null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(y,_,k);});}if(h.context=x,h.props=g,h.__v=u,h.__P=n,C=l$3.__r,$=0,"prototype"in T&&T.prototype.render){for(h.state=h.__s,h.__d=!1,C&&C(u),a=h.render(h.props,h.state,h.context),H=0;H<h._sb.length;H++)h.__h.push(h._sb[H]);h._sb=[];}else do{h.__d=!1,C&&C(u),a=h.render(h.props,h.state,h.context),h.state=h.__s;}while(h.__d&&++$<25);h.state=h.__s,null!=h.getChildContext&&(t=s$3(s$3({},t),h.getChildContext())),v||null==h.getSnapshotBeforeUpdate||(k=h.getSnapshotBeforeUpdate(y,_)),I=null!=a&&a.type===p$4&&null==a.key?a.props.children:a,w$4(n,Array.isArray(I)?I:[I],u,i,t,o,r,f,e,c),h.base=u.__e,u.__h=null,h.__h.length&&f.push(h),b&&(h.__E=h.__=null),h.__e=!1;}else null==r&&u.__v===i.__v?(u.__k=i.__k,u.__e=i.__e):u.__e=L$2(i.__e,u,i,t,o,r,f,c);(a=l$3.diffed)&&a(u);}catch(n){u.__v=null,(c||null!=r)&&(u.__e=e,u.__h=!!c,r[r.indexOf(e)]=null),l$3.__e(n,u,i);}}function z$3(n,u){l$3.__c&&l$3.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u);});}catch(n){l$3.__e(n,u.__v);}});}function L$2(l,u,i,t,o,r,e,c){var s,h,v,y=i.props,p=u.props,d=u.type,k=0;if("svg"===d&&(o=!0),null!=r)for(;k<r.length;k++)if((s=r[k])&&"setAttribute"in s==!!d&&(d?s.localName===d:3===s.nodeType)){l=s,r[k]=null;break}if(null==l){if(null===d)return document.createTextNode(p);l=o?document.createElementNS("http://www.w3.org/2000/svg",d):document.createElement(d,p.is&&p),r=null,c=!1;}if(null===d)y===p||c&&l.data===p||(l.data=p);else {if(r=r&&n$3.call(l.childNodes),h=(y=i.props||f$3).dangerouslySetInnerHTML,v=p.dangerouslySetInnerHTML,!c){if(null!=r)for(y={},k=0;k<l.attributes.length;k++)y[l.attributes[k].name]=l.attributes[k].value;(v||h)&&(v&&(h&&v.__html==h.__html||v.__html===l.innerHTML)||(l.innerHTML=v&&v.__html||""));}if(C$3(l,p,y,o,c),v)u.__k=[];else if(k=u.props.children,w$4(l,Array.isArray(k)?k:[k],u,i,t,o&&"foreignObject"!==d,r,e,r?r[0]:i.__k&&_$3(i,0),c),null!=r)for(k=r.length;k--;)null!=r[k]&&a$4(r[k]);c||("value"in p&&void 0!==(k=p.value)&&(k!==l.value||"progress"===d&&!k||"option"===d&&k!==y.value)&&H$2(l,"value",k,y.value,!1),"checked"in p&&void 0!==(k=p.checked)&&k!==l.checked&&H$2(l,"checked",k,y.checked,!1));}return l}function M$2(n,u,i){try{"function"==typeof n?n(u):n.current=u;}catch(n){l$3.__e(n,i);}}function N$2(n,u,i){var t,o;if(l$3.unmount&&l$3.unmount(n),(t=n.ref)&&(t.current&&t.current!==n.__e||M$2(t,null,u)),null!=(t=n.__c)){if(t.componentWillUnmount)try{t.componentWillUnmount();}catch(n){l$3.__e(n,u);}t.base=t.__P=null,n.__c=void 0;}if(t=n.__k)for(o=0;o<t.length;o++)t[o]&&N$2(t[o],u,i||"function"!=typeof n.type);i||null==n.__e||a$4(n.__e),n.__=n.__e=n.__d=void 0;}function O$2(n,l,u){return this.constructor(n,u)}function P$2(u,i,t){var o,r,e;l$3.__&&l$3.__(u,i),r=(o="function"==typeof t)?null:t&&t.__k||i.__k,e=[],j$4(i,u=(!o&&t||i).__k=h$3(p$4,null,[u]),r||f$3,f$3,void 0!==i.ownerSVGElement,!o&&t?[t]:r?null:i.firstChild?n$3.call(i.childNodes):null,e,!o&&t?t:r?r.__e:i.firstChild,o),z$3(e,u);}n$3=e$5.slice,l$3={__e:function(n,l,u,i){for(var t,o,r;l=l.__;)if((t=l.__c)&&!t.__)try{if((o=t.constructor)&&null!=o.getDerivedStateFromError&&(t.setState(o.getDerivedStateFromError(n)),r=t.__d),null!=t.componentDidCatch&&(t.componentDidCatch(n,i||{}),r=t.__d),r)return t.__E=t}catch(l){n=l;}throw n}},u$3=0,d$3.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=s$3({},this.state),"function"==typeof n&&(n=n(s$3({},u),this.props)),n&&s$3(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),b$3(this));},d$3.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),b$3(this));},d$3.prototype.render=p$4,t$5=[],g$4.__r=0;
28377
28377
 
28378
- var t$4,r$3,u$2,i$4,o$4=0,f$2=[],c$2=[],e$4=l$3.__b,a$3=l$3.__r,v$2=l$3.diffed,l$2=l$3.__c,m$3=l$3.unmount;function d$2(t,u){l$3.__h&&l$3.__h(r$3,t,o$4||u),o$4=0;var i=r$3.__H||(r$3.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({__V:c$2}),i.__[t]}function p$3(n){return o$4=1,y$2(B$1,n)}function y$2(n,u,i){var o=d$2(t$4++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):B$1(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}));}],o.__c=r$3,!r$3.u)){r$3.u=!0;var f=r$3.shouldComponentUpdate;r$3.shouldComponentUpdate=function(n,t,r){if(!o.__c.__H)return !0;var u=o.__c.__H.__.filter(function(n){return n.__c});if(u.every(function(n){return !n.__N}))return !f||f.call(this,n,t,r);var i=!1;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=!0);}}),!(!i&&o.__c.props===n)&&(!f||f.call(this,n,t,r))};}return o.__N||o.__}function h$2(u,i){var o=d$2(t$4++,3);!l$3.__s&&z$2(o.__H,i)&&(o.__=u,o.i=i,r$3.__H.__h.push(o));}function s$2(u,i){var o=d$2(t$4++,4);!l$3.__s&&z$2(o.__H,i)&&(o.__=u,o.i=i,r$3.__h.push(o));}function _$2(n){return o$4=5,F$2(function(){return {current:n}},[])}function F$2(n,r){var u=d$2(t$4++,7);return z$2(u.__H,r)?(u.__V=n(),u.i=r,u.__h=n,u.__V):u.__}function T$3(n,t){return o$4=8,F$2(function(){return n},t)}function b$2(){for(var t;t=f$2.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(k$3),t.__H.__h.forEach(w$3),t.__H.__h=[];}catch(r){t.__H.__h=[],l$3.__e(r,t.__v);}}l$3.__b=function(n){r$3=null,e$4&&e$4(n);},l$3.__r=function(n){a$3&&a$3(n),t$4=0;var i=(r$3=n.__c).__H;i&&(u$2===r$3?(i.__h=[],r$3.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=c$2,n.__N=n.i=void 0;})):(i.__h.forEach(k$3),i.__h.forEach(w$3),i.__h=[])),u$2=r$3;},l$3.diffed=function(t){v$2&&v$2(t);var o=t.__c;o&&o.__H&&(o.__H.__h.length&&(1!==f$2.push(o)&&i$4===l$3.requestAnimationFrame||((i$4=l$3.requestAnimationFrame)||j$3)(b$2)),o.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==c$2&&(n.__=n.__V),n.i=void 0,n.__V=c$2;})),u$2=r$3=null;},l$3.__c=function(t,r){r.some(function(t){try{t.__h.forEach(k$3),t.__h=t.__h.filter(function(n){return !n.__||w$3(n)});}catch(u){r.some(function(n){n.__h&&(n.__h=[]);}),r=[],l$3.__e(u,t.__v);}}),l$2&&l$2(t,r);},l$3.unmount=function(t){m$3&&m$3(t);var r,u=t.__c;u&&u.__H&&(u.__H.__.forEach(function(n){try{k$3(n);}catch(n){r=n;}}),u.__H=void 0,r&&l$3.__e(r,u.__v));};var g$3="function"==typeof requestAnimationFrame;function j$3(n){var t,r=function(){clearTimeout(u),g$3&&cancelAnimationFrame(t),setTimeout(n);},u=setTimeout(r,100);g$3&&(t=requestAnimationFrame(r));}function k$3(n){var t=r$3,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),r$3=t;}function w$3(n){var t=r$3;n.__c=n.__(),r$3=t;}function z$2(n,t){return !n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function B$1(n,t){return "function"==typeof t?t(n):t}
28378
+ var n$2=function(t,s,r,e){var u;s[0]=0;for(var h=1;h<s.length;h++){var p=s[h++],a=s[h]?(s[0]|=p?1:2,r[s[h++]]):s[++h];3===p?e[0]=a:4===p?e[1]=Object.assign(e[1]||{},a):5===p?(e[1]=e[1]||{})[s[++h]]=a:6===p?e[1][s[++h]]+=a+"":p?(u=t.apply(a,n$2(t,a,r,["",null])),e.push(u),a[0]?s[0]|=2:(s[h-2]=0,s[h]=u)):e.push(a);}return e},t$4=new Map;function e$4(s){var r=t$4.get(this);return r||(r=new Map,t$4.set(this,r)),(r=n$2(this,r.get(s)||(r.set(s,r=function(n){for(var t,s,r=1,e="",u="",h=[0],p=function(n){1===r&&(n||(e=e.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?h.push(0,n,e):3===r&&(n||e)?(h.push(3,n,e),r=2):2===r&&"..."===e&&n?h.push(4,n,0):2===r&&e&&!n?h.push(5,0,!0,e):r>=5&&((e||!n&&5===r)&&(h.push(r,0,e,s),r=6),n&&(h.push(r,n,0,s),r=6)),e="";},a=0;a<n.length;a++){a&&(1===r&&p(),p(a));for(var l=0;l<n[a].length;l++)t=n[a][l],1===r?"<"===t?(p(),h=[h],r=3):e+=t:4===r?"--"===e&&">"===t?(r=1,e=""):e=t+e[0]:u?t===u?u="":e+=t:'"'===t||"'"===t?u=t:">"===t?(p(),r=1):r&&("="===t?(r=5,s=e,e=""):"/"===t&&(r<5||">"===n[a][l+1])?(p(),3===r&&(h=h[0]),r=h,(h=h[0]).push(2,0,r),r=0):" "===t||"\t"===t||"\n"===t||"\r"===t?(p(),r=2):e+=t),3===r&&"!--"===e&&(r=4,h=h[0]);}return p(),h}(s)),r),arguments,[])).length>1?r:r[0]}
28379
28379
 
28380
- var n$2=function(t,s,r,e){var u;s[0]=0;for(var h=1;h<s.length;h++){var p=s[h++],a=s[h]?(s[0]|=p?1:2,r[s[h++]]):s[++h];3===p?e[0]=a:4===p?e[1]=Object.assign(e[1]||{},a):5===p?(e[1]=e[1]||{})[s[++h]]=a:6===p?e[1][s[++h]]+=a+"":p?(u=t.apply(a,n$2(t,a,r,["",null])),e.push(u),a[0]?s[0]|=2:(s[h-2]=0,s[h]=u)):e.push(a);}return e},t$3=new Map;function e$3(s){var r=t$3.get(this);return r||(r=new Map,t$3.set(this,r)),(r=n$2(this,r.get(s)||(r.set(s,r=function(n){for(var t,s,r=1,e="",u="",h=[0],p=function(n){1===r&&(n||(e=e.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?h.push(0,n,e):3===r&&(n||e)?(h.push(3,n,e),r=2):2===r&&"..."===e&&n?h.push(4,n,0):2===r&&e&&!n?h.push(5,0,!0,e):r>=5&&((e||!n&&5===r)&&(h.push(r,0,e,s),r=6),n&&(h.push(r,n,0,s),r=6)),e="";},a=0;a<n.length;a++){a&&(1===r&&p(),p(a));for(var l=0;l<n[a].length;l++)t=n[a][l],1===r?"<"===t?(p(),h=[h],r=3):e+=t:4===r?"--"===e&&">"===t?(r=1,e=""):e=t+e[0]:u?t===u?u="":e+=t:'"'===t||"'"===t?u=t:">"===t?(p(),r=1):r&&("="===t?(r=5,s=e,e=""):"/"===t&&(r<5||">"===n[a][l+1])?(p(),3===r&&(h=h[0]),r=h,(h=h[0]).push(2,0,r),r=0):" "===t||"\t"===t||"\n"===t||"\r"===t?(p(),r=2):e+=t),3===r&&"!--"===e&&(r=4,h=h[0]);}return p(),h}(s)),r),arguments,[])).length>1?r:r[0]}
28380
+ var m$3=e$4.bind(h$3);
28381
28381
 
28382
- var m$2=e$3.bind(h$3);
28382
+ var t$3,r$3,u$2,i$4,o$4=0,f$2=[],c$2=[],e$3=l$3.__b,a$3=l$3.__r,v$2=l$3.diffed,l$2=l$3.__c,m$2=l$3.unmount;function d$2(t,u){l$3.__h&&l$3.__h(r$3,t,o$4||u),o$4=0;var i=r$3.__H||(r$3.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({__V:c$2}),i.__[t]}function p$3(n){return o$4=1,y$2(B$1,n)}function y$2(n,u,i){var o=d$2(t$3++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):B$1(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}));}],o.__c=r$3,!r$3.u)){r$3.u=!0;var f=r$3.shouldComponentUpdate;r$3.shouldComponentUpdate=function(n,t,r){if(!o.__c.__H)return !0;var u=o.__c.__H.__.filter(function(n){return n.__c});if(u.every(function(n){return !n.__N}))return !f||f.call(this,n,t,r);var i=!1;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=!0);}}),!(!i&&o.__c.props===n)&&(!f||f.call(this,n,t,r))};}return o.__N||o.__}function h$2(u,i){var o=d$2(t$3++,3);!l$3.__s&&z$2(o.__H,i)&&(o.__=u,o.i=i,r$3.__H.__h.push(o));}function s$2(u,i){var o=d$2(t$3++,4);!l$3.__s&&z$2(o.__H,i)&&(o.__=u,o.i=i,r$3.__h.push(o));}function _$2(n){return o$4=5,F$2(function(){return {current:n}},[])}function F$2(n,r){var u=d$2(t$3++,7);return z$2(u.__H,r)?(u.__V=n(),u.i=r,u.__h=n,u.__V):u.__}function T$3(n,t){return o$4=8,F$2(function(){return n},t)}function b$2(){for(var t;t=f$2.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(k$3),t.__H.__h.forEach(w$3),t.__H.__h=[];}catch(r){t.__H.__h=[],l$3.__e(r,t.__v);}}l$3.__b=function(n){r$3=null,e$3&&e$3(n);},l$3.__r=function(n){a$3&&a$3(n),t$3=0;var i=(r$3=n.__c).__H;i&&(u$2===r$3?(i.__h=[],r$3.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=c$2,n.__N=n.i=void 0;})):(i.__h.forEach(k$3),i.__h.forEach(w$3),i.__h=[])),u$2=r$3;},l$3.diffed=function(t){v$2&&v$2(t);var o=t.__c;o&&o.__H&&(o.__H.__h.length&&(1!==f$2.push(o)&&i$4===l$3.requestAnimationFrame||((i$4=l$3.requestAnimationFrame)||j$3)(b$2)),o.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==c$2&&(n.__=n.__V),n.i=void 0,n.__V=c$2;})),u$2=r$3=null;},l$3.__c=function(t,r){r.some(function(t){try{t.__h.forEach(k$3),t.__h=t.__h.filter(function(n){return !n.__||w$3(n)});}catch(u){r.some(function(n){n.__h&&(n.__h=[]);}),r=[],l$3.__e(u,t.__v);}}),l$2&&l$2(t,r);},l$3.unmount=function(t){m$2&&m$2(t);var r,u=t.__c;u&&u.__H&&(u.__H.__.forEach(function(n){try{k$3(n);}catch(n){r=n;}}),u.__H=void 0,r&&l$3.__e(r,u.__v));};var g$3="function"==typeof requestAnimationFrame;function j$3(n){var t,r=function(){clearTimeout(u),g$3&&cancelAnimationFrame(t),setTimeout(n);},u=setTimeout(r,100);g$3&&(t=requestAnimationFrame(r));}function k$3(n){var t=r$3,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),r$3=t;}function w$3(n){var t=r$3;n.__c=n.__(),r$3=t;}function z$2(n,t){return !n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function B$1(n,t){return "function"==typeof t?t(n):t}
28383
28383
 
28384
28384
  function r$2(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r$2(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r$2(e))&&(n&&(n+=" "),n+=t);return n}
28385
28385
 
@@ -28402,7 +28402,7 @@
28402
28402
  onClick
28403
28403
  } = props;
28404
28404
 
28405
- return m$2`
28405
+ return m$3`
28406
28406
  <li
28407
28407
  class=${ clsx('entry', { selected }) }
28408
28408
  data-id=${ entry.id }
@@ -28415,17 +28415,17 @@
28415
28415
  <span
28416
28416
  class=${ clsx('djs-popup-entry-name', entry.className) }
28417
28417
  >
28418
- ${ entry.imageUrl ? m$2`
28418
+ ${ entry.imageUrl ? m$3`
28419
28419
  <img class="djs-popup-entry-icon" src=${ entry.imageUrl } />
28420
28420
  ` : null }
28421
28421
 
28422
- ${ entry.label ? m$2`
28422
+ ${ entry.label ? m$3`
28423
28423
  <span class="djs-popup-label">
28424
28424
  ${ entry.label }
28425
28425
  </span>
28426
28426
  ` : null }
28427
28427
  </span>
28428
- ${ entry.description && m$2`
28428
+ ${ entry.description && m$3`
28429
28429
  <span
28430
28430
  class="djs-popup-entry-description"
28431
28431
  title=${ entry.description }
@@ -28434,7 +28434,7 @@
28434
28434
  </span>
28435
28435
  ` }
28436
28436
  </div>
28437
- ${ entry.documentationRef && m$2`
28437
+ ${ entry.documentationRef && m$3`
28438
28438
  <div class="djs-popup-entry-docs">
28439
28439
  <a
28440
28440
  href="${ entry.documentationRef }"
@@ -28489,16 +28489,16 @@
28489
28489
  }
28490
28490
  }, [ selectedEntry ]);
28491
28491
 
28492
- return m$2`
28492
+ return m$3`
28493
28493
  <div class="djs-popup-results" ref=${ resultsRef }>
28494
- ${ groups.map(group => m$2`
28495
- ${ group.name && m$2`
28494
+ ${ groups.map(group => m$3`
28495
+ ${ group.name && m$3`
28496
28496
  <div key=${ group.id } class="entry-header" title=${ group.name }>
28497
28497
  ${ group.name }
28498
28498
  </div>
28499
28499
  ` }
28500
28500
  <ul class="djs-popup-group" data-group=${ group.id }>
28501
- ${ group.entries.map(entry => m$2`
28501
+ ${ group.entries.map(entry => m$3`
28502
28502
  <${PopupMenuItem}
28503
28503
  key=${ entry.id }
28504
28504
  entry=${ entry }
@@ -28717,7 +28717,7 @@
28717
28717
 
28718
28718
  const displayHeader = F$2(() => title || headerEntries.length > 0, [ title, headerEntries ]);
28719
28719
 
28720
- return m$2`
28720
+ return m$3`
28721
28721
  <${PopupMenuWrapper}
28722
28722
  onClose=${ onClose }
28723
28723
  onKeyup=${ handleKey }
@@ -28727,10 +28727,10 @@
28727
28727
  width=${ width }
28728
28728
  scale=${ scale }
28729
28729
  >
28730
- ${ displayHeader && m$2`
28730
+ ${ displayHeader && m$3`
28731
28731
  <div class="djs-popup-header">
28732
28732
  <h3 class="djs-popup-title" title=${ title }>${ title }</h3>
28733
- ${ headerEntries.map(entry => m$2`
28733
+ ${ headerEntries.map(entry => m$3`
28734
28734
  <span
28735
28735
  class=${ getHeaderClasses(entry, entry === selectedEntry) }
28736
28736
  onClick=${ event => onSelect(event, entry) }
@@ -28739,21 +28739,21 @@
28739
28739
  onMouseEnter=${ () => setSelectedEntry(entry) }
28740
28740
  onMouseLeave=${ () => setSelectedEntry(null) }
28741
28741
  >
28742
- ${ entry.imageUrl ? m$2`
28742
+ ${ entry.imageUrl ? m$3`
28743
28743
  <img class="djs-popup-entry-icon" src=${ entry.imageUrl } />
28744
28744
  ` : null }
28745
28745
 
28746
- ${ entry.label ? m$2`
28746
+ ${ entry.label ? m$3`
28747
28747
  <span class="djs-popup-label">${ entry.label }</span>
28748
28748
  ` : null }
28749
28749
  </span>
28750
28750
  `) }
28751
28751
  </div>
28752
28752
  ` }
28753
- ${ originalEntries.length > 0 && m$2`
28753
+ ${ originalEntries.length > 0 && m$3`
28754
28754
  <div class="djs-popup-body">
28755
28755
 
28756
- ${ searchable && m$2`
28756
+ ${ searchable && m$3`
28757
28757
  <div class="djs-popup-search">
28758
28758
  <svg class="djs-popup-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
28759
28759
  <path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
@@ -28772,7 +28772,7 @@
28772
28772
  onClick=${ onSelect }
28773
28773
  />
28774
28774
  </div>
28775
- ${ entries.length === 0 && m$2`
28775
+ ${ entries.length === 0 && m$3`
28776
28776
  <div class="djs-popup-no-results">No matching entries found.</div>
28777
28777
  ` }
28778
28778
  ` }
@@ -28825,7 +28825,7 @@
28825
28825
  popupRef.current && popupRef.current.focus();
28826
28826
  }, []);
28827
28827
 
28828
- return m$2`
28828
+ return m$3`
28829
28829
  <div
28830
28830
  class="djs-popup-backdrop"
28831
28831
  onClick=${ checkClose }
@@ -28956,7 +28956,7 @@
28956
28956
  const onSelect = (event, entry) => this.trigger(event, entry);
28957
28957
 
28958
28958
  P$2(
28959
- m$2`
28959
+ m$3`
28960
28960
  <${PopupMenuComponent}
28961
28961
  onClose=${ onClose }
28962
28962
  onSelect=${ onSelect }
@@ -29080,13 +29080,10 @@
29080
29080
 
29081
29081
  PopupMenu.prototype._createContainer = function(config) {
29082
29082
 
29083
- let parent = config && config.parent || 'body';
29084
-
29085
- if (typeof parent === 'string') {
29086
- parent = document.querySelector(parent);
29087
- }
29083
+ var canvas = this._canvas,
29084
+ parent = canvas.getContainer();
29088
29085
 
29089
- const container = domify$1(`<div class="djs-popup-parent djs-parent" data-popup=${config.provider}></div>`);
29086
+ const container = domify$1(`<div class="djs-popup-parent djs-scrollable" data-popup=${config.provider}></div>`);
29090
29087
 
29091
29088
  parent.appendChild(container);
29092
29089
 
@@ -64496,10 +64493,11 @@
64496
64493
  /**
64497
64494
  Create a selection range.
64498
64495
  */
64499
- static range(anchor, head, goalColumn) {
64500
- let goal = (goalColumn !== null && goalColumn !== void 0 ? goalColumn : 33554431 /* RangeFlag.NoGoalColumn */) << 5 /* RangeFlag.GoalColumnOffset */;
64501
- return head < anchor ? SelectionRange.create(head, anchor, 16 /* RangeFlag.Inverted */ | goal | 8 /* RangeFlag.AssocAfter */)
64502
- : SelectionRange.create(anchor, head, goal | (head > anchor ? 4 /* RangeFlag.AssocBefore */ : 0));
64496
+ static range(anchor, head, goalColumn, bidiLevel) {
64497
+ let flags = ((goalColumn !== null && goalColumn !== void 0 ? goalColumn : 33554431 /* RangeFlag.NoGoalColumn */) << 5 /* RangeFlag.GoalColumnOffset */) |
64498
+ (bidiLevel == null ? 3 : Math.min(2, bidiLevel));
64499
+ return head < anchor ? SelectionRange.create(head, anchor, 16 /* RangeFlag.Inverted */ | 8 /* RangeFlag.AssocAfter */ | flags)
64500
+ : SelectionRange.create(anchor, head, (head > anchor ? 4 /* RangeFlag.AssocBefore */ : 0) | flags);
64503
64501
  }
64504
64502
  /**
64505
64503
  @internal
@@ -67329,6 +67327,26 @@
67329
67327
  }
67330
67328
  }
67331
67329
  }
67330
+ function scrollableParent(dom) {
67331
+ let doc = dom.ownerDocument;
67332
+ for (let cur = dom.parentNode; cur;) {
67333
+ if (cur == doc.body) {
67334
+ break;
67335
+ }
67336
+ else if (cur.nodeType == 1) {
67337
+ if (cur.scrollHeight > cur.clientHeight || cur.scrollWidth > cur.clientWidth)
67338
+ return cur;
67339
+ cur = cur.assignedSlot || cur.parentNode;
67340
+ }
67341
+ else if (cur.nodeType == 11) {
67342
+ cur = cur.host;
67343
+ }
67344
+ else {
67345
+ break;
67346
+ }
67347
+ }
67348
+ return null;
67349
+ }
67332
67350
  class DOMSelectionState {
67333
67351
  constructor() {
67334
67352
  this.anchorNode = null;
@@ -68465,7 +68483,9 @@
68465
68483
  super(-200000000 /* Side.Line */, -200000000 /* Side.Line */, null, spec);
68466
68484
  }
68467
68485
  eq(other) {
68468
- return other instanceof LineDecoration && attrsEq(this.spec.attributes, other.spec.attributes);
68486
+ return other instanceof LineDecoration &&
68487
+ this.spec.class == other.spec.class &&
68488
+ attrsEq(this.spec.attributes, other.spec.attributes);
68469
68489
  }
68470
68490
  range(from, to = from) {
68471
68491
  if (to != from)
@@ -68740,6 +68760,7 @@
68740
68760
  this.curLine = null;
68741
68761
  this.breakAtStart = 0;
68742
68762
  this.pendingBuffer = 0 /* Buf.No */;
68763
+ this.bufferMarks = [];
68743
68764
  // Set to false directly after a widget that covers the position after it
68744
68765
  this.atCursorPos = true;
68745
68766
  this.openStart = -1;
@@ -68762,20 +68783,20 @@
68762
68783
  }
68763
68784
  return this.curLine;
68764
68785
  }
68765
- flushBuffer(active) {
68786
+ flushBuffer(active = this.bufferMarks) {
68766
68787
  if (this.pendingBuffer) {
68767
68788
  this.curLine.append(wrapMarks(new WidgetBufferView(-1), active), active.length);
68768
68789
  this.pendingBuffer = 0 /* Buf.No */;
68769
68790
  }
68770
68791
  }
68771
68792
  addBlockWidget(view) {
68772
- this.flushBuffer([]);
68793
+ this.flushBuffer();
68773
68794
  this.curLine = null;
68774
68795
  this.content.push(view);
68775
68796
  }
68776
68797
  finish(openEnd) {
68777
- if (!openEnd)
68778
- this.flushBuffer([]);
68798
+ if (this.pendingBuffer && openEnd <= this.bufferMarks.length)
68799
+ this.flushBuffer();
68779
68800
  else
68780
68801
  this.pendingBuffer = 0 /* Buf.No */;
68781
68802
  if (!this.posCovered())
@@ -68795,8 +68816,9 @@
68795
68816
  this.content[this.content.length - 1].breakAfter = 1;
68796
68817
  else
68797
68818
  this.breakAtStart = 1;
68798
- this.flushBuffer([]);
68819
+ this.flushBuffer();
68799
68820
  this.curLine = null;
68821
+ this.atCursorPos = true;
68800
68822
  length--;
68801
68823
  continue;
68802
68824
  }
@@ -68838,7 +68860,7 @@
68838
68860
  else {
68839
68861
  let view = WidgetView.create(deco.widget || new NullWidget("span"), len, len ? 0 : deco.startSide);
68840
68862
  let cursorBefore = this.atCursorPos && !view.isEditable && openStart <= active.length && (from < to || deco.startSide > 0);
68841
- let cursorAfter = !view.isEditable && (from < to || deco.startSide <= 0);
68863
+ let cursorAfter = !view.isEditable && (from < to || openStart > active.length || deco.startSide <= 0);
68842
68864
  let line = this.getLine();
68843
68865
  if (this.pendingBuffer == 2 /* Buf.IfCursor */ && !cursorBefore)
68844
68866
  this.pendingBuffer = 0 /* Buf.No */;
@@ -68849,7 +68871,9 @@
68849
68871
  }
68850
68872
  line.append(wrapMarks(view, active), openStart);
68851
68873
  this.atCursorPos = cursorAfter;
68852
- this.pendingBuffer = !cursorAfter ? 0 /* Buf.No */ : from < to ? 1 /* Buf.Yes */ : 2 /* Buf.IfCursor */;
68874
+ this.pendingBuffer = !cursorAfter ? 0 /* Buf.No */ : from < to || openStart > active.length ? 1 /* Buf.Yes */ : 2 /* Buf.IfCursor */;
68875
+ if (this.pendingBuffer)
68876
+ this.bufferMarks = active.slice();
68853
68877
  }
68854
68878
  }
68855
68879
  else if (this.doc.lineAt(this.pos).from == this.pos) { // Line decoration
@@ -70523,22 +70547,30 @@
70523
70547
  this.compositionFirstChange = null;
70524
70548
  this.compositionEndedAt = 0;
70525
70549
  this.mouseSelection = null;
70550
+ let handleEvent = (handler, event) => {
70551
+ if (this.ignoreDuringComposition(event))
70552
+ return;
70553
+ if (event.type == "keydown" && this.keydown(view, event))
70554
+ return;
70555
+ if (this.mustFlushObserver(event))
70556
+ view.observer.forceFlush();
70557
+ if (this.runCustomHandlers(event.type, view, event))
70558
+ event.preventDefault();
70559
+ else
70560
+ handler(view, event);
70561
+ };
70526
70562
  for (let type in handlers) {
70527
70563
  let handler = handlers[type];
70528
- view.contentDOM.addEventListener(type, (event) => {
70529
- if (!eventBelongsToEditor(view, event) || this.ignoreDuringComposition(event))
70530
- return;
70531
- if (type == "keydown" && this.keydown(view, event))
70532
- return;
70533
- if (this.mustFlushObserver(event))
70534
- view.observer.forceFlush();
70535
- if (this.runCustomHandlers(type, view, event))
70536
- event.preventDefault();
70537
- else
70538
- handler(view, event);
70564
+ view.contentDOM.addEventListener(type, event => {
70565
+ if (eventBelongsToEditor(view, event))
70566
+ handleEvent(handler, event);
70539
70567
  }, handlerOptions[type]);
70540
70568
  this.registeredEvents.push(type);
70541
70569
  }
70570
+ view.scrollDOM.addEventListener("mousedown", (event) => {
70571
+ if (event.target == view.scrollDOM)
70572
+ handleEvent(handlers.mousedown, event);
70573
+ });
70542
70574
  if (browser.chrome && browser.chrome_version == 102) { // FIXME remove at some point
70543
70575
  // On Chrome 102, viewport updates somehow stop wheel-based
70544
70576
  // scrolling. Turning off pointer events during the scroll seems
@@ -70695,12 +70727,18 @@
70695
70727
  const EmacsyPendingKeys = "dthko";
70696
70728
  // Key codes for modifier keys
70697
70729
  const modifierCodes = [16, 17, 18, 20, 91, 92, 224, 225];
70730
+ function dragScrollSpeed(dist) {
70731
+ return dist * 0.7 + 8;
70732
+ }
70698
70733
  class MouseSelection {
70699
70734
  constructor(view, startEvent, style, mustSelect) {
70700
70735
  this.view = view;
70701
70736
  this.style = style;
70702
70737
  this.mustSelect = mustSelect;
70738
+ this.scrollSpeed = { x: 0, y: 0 };
70739
+ this.scrolling = -1;
70703
70740
  this.lastEvent = startEvent;
70741
+ this.scrollParent = scrollableParent(view.contentDOM);
70704
70742
  let doc = view.contentDOM.ownerDocument;
70705
70743
  doc.addEventListener("mousemove", this.move = this.move.bind(this));
70706
70744
  doc.addEventListener("mouseup", this.up = this.up.bind(this));
@@ -70716,11 +70754,24 @@
70716
70754
  }
70717
70755
  }
70718
70756
  move(event) {
70757
+ var _a;
70719
70758
  if (event.buttons == 0)
70720
70759
  return this.destroy();
70721
70760
  if (this.dragging !== false)
70722
70761
  return;
70723
70762
  this.select(this.lastEvent = event);
70763
+ let sx = 0, sy = 0;
70764
+ let rect = ((_a = this.scrollParent) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect())
70765
+ || { left: 0, top: 0, right: this.view.win.innerWidth, bottom: this.view.win.innerHeight };
70766
+ if (event.clientX <= rect.left)
70767
+ sx = -dragScrollSpeed(rect.left - event.clientX);
70768
+ else if (event.clientX >= rect.right)
70769
+ sx = dragScrollSpeed(event.clientX - rect.right);
70770
+ if (event.clientY <= rect.top)
70771
+ sy = -dragScrollSpeed(rect.top - event.clientY);
70772
+ else if (event.clientY >= rect.bottom)
70773
+ sy = dragScrollSpeed(event.clientY - rect.bottom);
70774
+ this.setScrollSpeed(sx, sy);
70724
70775
  }
70725
70776
  up(event) {
70726
70777
  if (this.dragging == null)
@@ -70730,19 +70781,41 @@
70730
70781
  this.destroy();
70731
70782
  }
70732
70783
  destroy() {
70784
+ this.setScrollSpeed(0, 0);
70733
70785
  let doc = this.view.contentDOM.ownerDocument;
70734
70786
  doc.removeEventListener("mousemove", this.move);
70735
70787
  doc.removeEventListener("mouseup", this.up);
70736
70788
  this.view.inputState.mouseSelection = null;
70737
70789
  }
70790
+ setScrollSpeed(sx, sy) {
70791
+ this.scrollSpeed = { x: sx, y: sy };
70792
+ if (sx || sy) {
70793
+ if (this.scrolling < 0)
70794
+ this.scrolling = setInterval(() => this.scroll(), 50);
70795
+ }
70796
+ else if (this.scrolling > -1) {
70797
+ clearInterval(this.scrolling);
70798
+ this.scrolling = -1;
70799
+ }
70800
+ }
70801
+ scroll() {
70802
+ if (this.scrollParent) {
70803
+ this.scrollParent.scrollLeft += this.scrollSpeed.x;
70804
+ this.scrollParent.scrollTop += this.scrollSpeed.y;
70805
+ }
70806
+ else {
70807
+ this.view.win.scrollBy(this.scrollSpeed.x, this.scrollSpeed.y);
70808
+ }
70809
+ if (this.dragging === false)
70810
+ this.select(this.lastEvent);
70811
+ }
70738
70812
  select(event) {
70739
70813
  let selection = this.style.get(event, this.extend, this.multiple);
70740
70814
  if (this.mustSelect || !selection.eq(this.view.state.selection) ||
70741
70815
  selection.main.assoc != this.view.state.selection.main.assoc)
70742
70816
  this.view.dispatch({
70743
70817
  selection,
70744
- userEvent: "select.pointer",
70745
- scrollIntoView: true
70818
+ userEvent: "select.pointer"
70746
70819
  });
70747
70820
  this.mustSelect = false;
70748
70821
  }
@@ -70933,23 +71006,15 @@
70933
71006
  function basicMouseSelection(view, event) {
70934
71007
  let start = queryPos(view, event), type = getClickType(event);
70935
71008
  let startSel = view.state.selection;
70936
- let last = start, lastEvent = event;
70937
71009
  return {
70938
71010
  update(update) {
70939
71011
  if (update.docChanged) {
70940
71012
  start.pos = update.changes.mapPos(start.pos);
70941
71013
  startSel = startSel.map(update.changes);
70942
- lastEvent = null;
70943
71014
  }
70944
71015
  },
70945
71016
  get(event, extend, multiple) {
70946
- let cur;
70947
- if (lastEvent && event.clientX == lastEvent.clientX && event.clientY == lastEvent.clientY)
70948
- cur = last;
70949
- else {
70950
- cur = last = queryPos(view, event);
70951
- lastEvent = event;
70952
- }
71017
+ let cur = queryPos(view, event);
70953
71018
  let range = rangeForClick(view, cur.pos, cur.bias, type);
70954
71019
  if (start.pos != cur.pos && !extend) {
70955
71020
  let startRange = rangeForClick(view, start.pos, start.bias, type);
@@ -72395,7 +72460,7 @@
72395
72460
  });
72396
72461
  }
72397
72462
  const baseTheme$1$1 = /*@__PURE__*/buildTheme("." + baseThemeID, {
72398
- "&.cm-editor": {
72463
+ "&": {
72399
72464
  position: "relative !important",
72400
72465
  boxSizing: "border-box",
72401
72466
  "&.cm-focused": {
@@ -72426,7 +72491,6 @@
72426
72491
  margin: 0,
72427
72492
  flexGrow: 2,
72428
72493
  flexShrink: 0,
72429
- minHeight: "100%",
72430
72494
  display: "block",
72431
72495
  whiteSpace: "pre",
72432
72496
  wordWrap: "normal",
@@ -72448,14 +72512,13 @@
72448
72512
  "&dark .cm-content": { caretColor: "white" },
72449
72513
  ".cm-line": {
72450
72514
  display: "block",
72451
- padding: "0 2px 0 4px"
72452
- },
72453
- ".cm-selectionLayer": {
72454
- zIndex: -1,
72455
- contain: "size style"
72515
+ padding: "0 2px 0 6px"
72456
72516
  },
72457
- ".cm-selectionBackground": {
72458
- position: "absolute",
72517
+ ".cm-layer": {
72518
+ contain: "size style",
72519
+ "& > *": {
72520
+ position: "absolute"
72521
+ }
72459
72522
  },
72460
72523
  "&light .cm-selectionBackground": {
72461
72524
  background: "#d9d9d9"
@@ -72470,8 +72533,6 @@
72470
72533
  background: "#233"
72471
72534
  },
72472
72535
  ".cm-cursorLayer": {
72473
- zIndex: 100,
72474
- contain: "size style",
72475
72536
  pointerEvents: "none"
72476
72537
  },
72477
72538
  "&.cm-focused .cm-cursorLayer": {
@@ -72483,7 +72544,6 @@
72483
72544
  "@keyframes cm-blink": { "0%": {}, "50%": { opacity: 0 }, "100%": {} },
72484
72545
  "@keyframes cm-blink2": { "0%": {}, "50%": { opacity: 0 }, "100%": {} },
72485
72546
  ".cm-cursor, .cm-dropCursor": {
72486
- position: "absolute",
72487
72547
  borderLeft: "1.2px solid black",
72488
72548
  marginLeft: "-0.6px",
72489
72549
  pointerEvents: "none",
@@ -72577,6 +72637,21 @@
72577
72637
  display: "inline-block",
72578
72638
  verticalAlign: "top",
72579
72639
  },
72640
+ ".cm-highlightSpace:before": {
72641
+ content: "attr(data-display)",
72642
+ position: "absolute",
72643
+ pointerEvents: "none",
72644
+ color: "#888"
72645
+ },
72646
+ ".cm-highlightTab": {
72647
+ backgroundImage: `url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,
72648
+ backgroundSize: "auto 100%",
72649
+ backgroundPosition: "right 90%",
72650
+ backgroundRepeat: "no-repeat"
72651
+ },
72652
+ ".cm-trailingSpace": {
72653
+ backgroundColor: "#ff332255"
72654
+ },
72580
72655
  ".cm-button": {
72581
72656
  verticalAlign: "middle",
72582
72657
  color: "inherit",
@@ -72669,7 +72744,7 @@
72669
72744
  insert: Text.of(domChange.text.slice(diff.from, diff.toB).split(LineBreakPlaceholder)) };
72670
72745
  }
72671
72746
  }
72672
- else if (newSel && (!view.hasFocus || !view.state.facet(editable) || newSel.main.eq(sel))) {
72747
+ else if (newSel && (!view.hasFocus && view.state.facet(editable) || newSel.main.eq(sel))) {
72673
72748
  newSel = null;
72674
72749
  }
72675
72750
  if (!change && !newSel)
@@ -72879,7 +72954,8 @@
72879
72954
  this.lastChange = 0;
72880
72955
  this.scrollTargets = [];
72881
72956
  this.intersection = null;
72882
- this.resize = null;
72957
+ this.resizeScroll = null;
72958
+ this.resizeContent = null;
72883
72959
  this.intersecting = false;
72884
72960
  this.gapIntersection = null;
72885
72961
  this.gaps = [];
@@ -72917,12 +72993,14 @@
72917
72993
  this.onPrint = this.onPrint.bind(this);
72918
72994
  this.onScroll = this.onScroll.bind(this);
72919
72995
  if (typeof ResizeObserver == "function") {
72920
- this.resize = new ResizeObserver(() => {
72996
+ this.resizeScroll = new ResizeObserver(() => {
72921
72997
  var _a;
72922
72998
  if (((_a = this.view.docView) === null || _a === void 0 ? void 0 : _a.lastUpdate) < Date.now() - 75)
72923
72999
  this.onResize();
72924
73000
  });
72925
- this.resize.observe(view.scrollDOM);
73001
+ this.resizeScroll.observe(view.scrollDOM);
73002
+ this.resizeContent = new ResizeObserver(() => this.view.requestMeasure());
73003
+ this.resizeContent.observe(view.contentDOM);
72926
73004
  }
72927
73005
  this.addWindowListeners(this.win = view.win);
72928
73006
  this.start();
@@ -73241,11 +73319,12 @@
73241
73319
  win.document.removeEventListener("selectionchange", this.onSelectionChange);
73242
73320
  }
73243
73321
  destroy() {
73244
- var _a, _b, _c;
73322
+ var _a, _b, _c, _d;
73245
73323
  this.stop();
73246
73324
  (_a = this.intersection) === null || _a === void 0 ? void 0 : _a.disconnect();
73247
73325
  (_b = this.gapIntersection) === null || _b === void 0 ? void 0 : _b.disconnect();
73248
- (_c = this.resize) === null || _c === void 0 ? void 0 : _c.disconnect();
73326
+ (_c = this.resizeScroll) === null || _c === void 0 ? void 0 : _c.disconnect();
73327
+ (_d = this.resizeContent) === null || _d === void 0 ? void 0 : _d.disconnect();
73249
73328
  for (let dom of this.scrollTargets)
73250
73329
  dom.removeEventListener("scroll", this.onScroll);
73251
73330
  this.removeWindowListeners(this.win);
@@ -73344,7 +73423,7 @@
73344
73423
  this.scrollDOM.className = "cm-scroller";
73345
73424
  this.scrollDOM.appendChild(this.contentDOM);
73346
73425
  this.announceDOM = document.createElement("div");
73347
- this.announceDOM.style.cssText = "position: absolute; top: -10000px";
73426
+ this.announceDOM.style.cssText = "position: fixed; top: -10000px";
73348
73427
  this.announceDOM.setAttribute("aria-live", "polite");
73349
73428
  this.dom = document.createElement("div");
73350
73429
  this.dom.appendChild(this.announceDOM);
@@ -73729,6 +73808,8 @@
73729
73808
  if (this.measureScheduled < 0)
73730
73809
  this.measureScheduled = this.win.requestAnimationFrame(() => this.measure());
73731
73810
  if (request) {
73811
+ if (this.measureRequests.indexOf(request) > -1)
73812
+ return;
73732
73813
  if (request.key != null)
73733
73814
  for (let i = 0; i < this.measureRequests.length; i++) {
73734
73815
  if (this.measureRequests[i].key === request.key) {
@@ -74404,6 +74485,8 @@
74404
74485
  if (runFor(scopeObj[prefix + modifiers(name, event, !isChar)]))
74405
74486
  return true;
74406
74487
  if (isChar && (event.altKey || event.metaKey || event.ctrlKey) &&
74488
+ // Ctrl-Alt may be used for AltGr on Windows
74489
+ !(browser.windows && event.ctrlKey && event.altKey) &&
74407
74490
  (baseName = base[event.keyCode]) && baseName != name) {
74408
74491
  if (runFor(scopeObj[prefix + modifiers(baseName, event, true)]))
74409
74492
  return true;
@@ -74641,6 +74724,17 @@
74641
74724
  : pos.bottom + (size.bottom - size.top) + offset.y > space.bottom) &&
74642
74725
  above == (space.bottom - pos.bottom > pos.top - space.top))
74643
74726
  above = !above;
74727
+ let spaceVert = (above ? pos.top - space.top : space.bottom - pos.bottom) - arrowHeight;
74728
+ if (spaceVert < height && tView.resize !== false) {
74729
+ if (spaceVert < this.view.defaultLineHeight) {
74730
+ dom.style.top = Outside;
74731
+ continue;
74732
+ }
74733
+ dom.style.height = (height = spaceVert) + "px";
74734
+ }
74735
+ else if (dom.style.height) {
74736
+ dom.style.height = "";
74737
+ }
74644
74738
  let top = above ? pos.top - height - arrowHeight - offset.y : pos.bottom + arrowHeight + offset.y;
74645
74739
  let right = left + width;
74646
74740
  if (tView.overlap !== true)
@@ -74684,7 +74778,8 @@
74684
74778
  });
74685
74779
  const baseTheme$4 = /*@__PURE__*/EditorView.baseTheme({
74686
74780
  ".cm-tooltip": {
74687
- zIndex: 100
74781
+ zIndex: 100,
74782
+ boxSizing: "border-box"
74688
74783
  },
74689
74784
  "&light .cm-tooltip": {
74690
74785
  border: "1px solid #bbb",
@@ -75249,8 +75344,8 @@
75249
75344
  /// Define a node type.
75250
75345
  static define(spec) {
75251
75346
  let props = spec.props && spec.props.length ? Object.create(null) : noProps;
75252
- let flags = (spec.top ? 1 /* Top */ : 0) | (spec.skipped ? 2 /* Skipped */ : 0) |
75253
- (spec.error ? 4 /* Error */ : 0) | (spec.name == null ? 8 /* Anonymous */ : 0);
75347
+ let flags = (spec.top ? 1 /* NodeFlag.Top */ : 0) | (spec.skipped ? 2 /* NodeFlag.Skipped */ : 0) |
75348
+ (spec.error ? 4 /* NodeFlag.Error */ : 0) | (spec.name == null ? 8 /* NodeFlag.Anonymous */ : 0);
75254
75349
  let type = new NodeType(spec.name || "", props, spec.id, flags);
75255
75350
  if (spec.props)
75256
75351
  for (let src of spec.props) {
@@ -75268,14 +75363,14 @@
75268
75363
  /// the prop isn't present on this node.
75269
75364
  prop(prop) { return this.props[prop.id]; }
75270
75365
  /// True when this is the top node of a grammar.
75271
- get isTop() { return (this.flags & 1 /* Top */) > 0; }
75366
+ get isTop() { return (this.flags & 1 /* NodeFlag.Top */) > 0; }
75272
75367
  /// True when this node is produced by a skip rule.
75273
- get isSkipped() { return (this.flags & 2 /* Skipped */) > 0; }
75368
+ get isSkipped() { return (this.flags & 2 /* NodeFlag.Skipped */) > 0; }
75274
75369
  /// Indicates whether this is an error node.
75275
- get isError() { return (this.flags & 4 /* Error */) > 0; }
75370
+ get isError() { return (this.flags & 4 /* NodeFlag.Error */) > 0; }
75276
75371
  /// When true, this node type doesn't correspond to a user-declared
75277
75372
  /// named node, for example because it is used to cache repetition.
75278
- get isAnonymous() { return (this.flags & 8 /* Anonymous */) > 0; }
75373
+ get isAnonymous() { return (this.flags & 8 /* NodeFlag.Anonymous */) > 0; }
75279
75374
  /// Returns true when this node's name or one of its
75280
75375
  /// [groups](#common.NodeProp^group) matches the given string.
75281
75376
  is(name) {
@@ -75308,7 +75403,7 @@
75308
75403
  }
75309
75404
  }
75310
75405
  /// An empty dummy node type to use when no actual type is available.
75311
- NodeType.none = new NodeType("", Object.create(null), 0, 8 /* Anonymous */);
75406
+ NodeType.none = new NodeType("", Object.create(null), 0, 8 /* NodeFlag.Anonymous */);
75312
75407
  /// A node set holds a collection of node types. It is used to
75313
75408
  /// compactly represent trees by storing their type ids, rather than a
75314
75409
  /// full pointer to the type object, in a numeric array. Each parser
@@ -75517,7 +75612,7 @@
75517
75612
  /// which may have children grouped into subtrees with type
75518
75613
  /// [`NodeType.none`](#common.NodeType^none).
75519
75614
  balance(config = {}) {
75520
- return this.children.length <= 8 /* BranchFactor */ ? this :
75615
+ return this.children.length <= 8 /* Balance.BranchFactor */ ? this :
75521
75616
  balanceRange(NodeType.none, this.children, this.positions, 0, this.children.length, 0, this.length, (children, positions, length) => new Tree(this.type, children, positions, length, this.propValues), config.makeTree || ((children, positions, length) => new Tree(NodeType.none, children, positions, length)));
75522
75617
  }
75523
75618
  /// Build a tree from a postfix-ordered buffer of node information,
@@ -75596,26 +75691,27 @@
75596
75691
  return pick;
75597
75692
  }
75598
75693
  /// @internal
75599
- slice(startI, endI, from, to) {
75694
+ slice(startI, endI, from) {
75600
75695
  let b = this.buffer;
75601
- let copy = new Uint16Array(endI - startI);
75696
+ let copy = new Uint16Array(endI - startI), len = 0;
75602
75697
  for (let i = startI, j = 0; i < endI;) {
75603
75698
  copy[j++] = b[i++];
75604
75699
  copy[j++] = b[i++] - from;
75605
- copy[j++] = b[i++] - from;
75700
+ let to = copy[j++] = b[i++] - from;
75606
75701
  copy[j++] = b[i++] - startI;
75702
+ len = Math.max(len, to);
75607
75703
  }
75608
- return new TreeBuffer(copy, to - from, this.set);
75704
+ return new TreeBuffer(copy, len, this.set);
75609
75705
  }
75610
75706
  }
75611
75707
  function checkSide(side, pos, from, to) {
75612
75708
  switch (side) {
75613
- case -2 /* Before */: return from < pos;
75614
- case -1 /* AtOrBefore */: return to >= pos && from < pos;
75615
- case 0 /* Around */: return from < pos && to > pos;
75616
- case 1 /* AtOrAfter */: return from <= pos && to > pos;
75617
- case 2 /* After */: return to > pos;
75618
- case 4 /* DontCare */: return true;
75709
+ case -2 /* Side.Before */: return from < pos;
75710
+ case -1 /* Side.AtOrBefore */: return to >= pos && from < pos;
75711
+ case 0 /* Side.Around */: return from < pos && to > pos;
75712
+ case 1 /* Side.AtOrAfter */: return from <= pos && to > pos;
75713
+ case 2 /* Side.After */: return to > pos;
75714
+ case 4 /* Side.DontCare */: return true;
75619
75715
  }
75620
75716
  }
75621
75717
  function enterUnfinishedNodesBefore(node, pos) {
@@ -75705,10 +75801,10 @@
75705
75801
  return null;
75706
75802
  }
75707
75803
  }
75708
- get firstChild() { return this.nextChild(0, 1, 0, 4 /* DontCare */); }
75709
- get lastChild() { return this.nextChild(this._tree.children.length - 1, -1, 0, 4 /* DontCare */); }
75710
- childAfter(pos) { return this.nextChild(0, 1, pos, 2 /* After */); }
75711
- childBefore(pos) { return this.nextChild(this._tree.children.length - 1, -1, pos, -2 /* Before */); }
75804
+ get firstChild() { return this.nextChild(0, 1, 0, 4 /* Side.DontCare */); }
75805
+ get lastChild() { return this.nextChild(this._tree.children.length - 1, -1, 0, 4 /* Side.DontCare */); }
75806
+ childAfter(pos) { return this.nextChild(0, 1, pos, 2 /* Side.After */); }
75807
+ childBefore(pos) { return this.nextChild(this._tree.children.length - 1, -1, pos, -2 /* Side.Before */); }
75712
75808
  enter(pos, side, mode = 0) {
75713
75809
  let mounted;
75714
75810
  if (!(mode & IterMode.IgnoreOverlays) && (mounted = this._tree.prop(NodeProp.mounted)) && mounted.overlay) {
@@ -75731,10 +75827,10 @@
75731
75827
  return this._parent ? this._parent.nextSignificantParent() : null;
75732
75828
  }
75733
75829
  get nextSibling() {
75734
- return this._parent && this.index >= 0 ? this._parent.nextChild(this.index + 1, 1, 0, 4 /* DontCare */) : null;
75830
+ return this._parent && this.index >= 0 ? this._parent.nextChild(this.index + 1, 1, 0, 4 /* Side.DontCare */) : null;
75735
75831
  }
75736
75832
  get prevSibling() {
75737
- return this._parent && this.index >= 0 ? this._parent.nextChild(this.index - 1, -1, 0, 4 /* DontCare */) : null;
75833
+ return this._parent && this.index >= 0 ? this._parent.nextChild(this.index - 1, -1, 0, 4 /* Side.DontCare */) : null;
75738
75834
  }
75739
75835
  cursor(mode = 0) { return new TreeCursor(this, mode); }
75740
75836
  get tree() { return this._tree; }
@@ -75796,24 +75892,24 @@
75796
75892
  }
75797
75893
  }
75798
75894
  class BufferNode {
75895
+ get name() { return this.type.name; }
75896
+ get from() { return this.context.start + this.context.buffer.buffer[this.index + 1]; }
75897
+ get to() { return this.context.start + this.context.buffer.buffer[this.index + 2]; }
75799
75898
  constructor(context, _parent, index) {
75800
75899
  this.context = context;
75801
75900
  this._parent = _parent;
75802
75901
  this.index = index;
75803
75902
  this.type = context.buffer.set.types[context.buffer.buffer[index]];
75804
75903
  }
75805
- get name() { return this.type.name; }
75806
- get from() { return this.context.start + this.context.buffer.buffer[this.index + 1]; }
75807
- get to() { return this.context.start + this.context.buffer.buffer[this.index + 2]; }
75808
75904
  child(dir, pos, side) {
75809
75905
  let { buffer } = this.context;
75810
75906
  let index = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.context.start, side);
75811
75907
  return index < 0 ? null : new BufferNode(this.context, this, index);
75812
75908
  }
75813
- get firstChild() { return this.child(1, 0, 4 /* DontCare */); }
75814
- get lastChild() { return this.child(-1, 0, 4 /* DontCare */); }
75815
- childAfter(pos) { return this.child(1, pos, 2 /* After */); }
75816
- childBefore(pos) { return this.child(-1, pos, -2 /* Before */); }
75909
+ get firstChild() { return this.child(1, 0, 4 /* Side.DontCare */); }
75910
+ get lastChild() { return this.child(-1, 0, 4 /* Side.DontCare */); }
75911
+ childAfter(pos) { return this.child(1, pos, 2 /* Side.After */); }
75912
+ childBefore(pos) { return this.child(-1, pos, -2 /* Side.Before */); }
75817
75913
  enter(pos, side, mode = 0) {
75818
75914
  if (mode & IterMode.ExcludeBuffers)
75819
75915
  return null;
@@ -75825,7 +75921,7 @@
75825
75921
  return this._parent || this.context.parent.nextSignificantParent();
75826
75922
  }
75827
75923
  externalSibling(dir) {
75828
- return this._parent ? null : this.context.parent.nextChild(this.context.index + dir, dir, 0, 4 /* DontCare */);
75924
+ return this._parent ? null : this.context.parent.nextChild(this.context.index + dir, dir, 0, 4 /* Side.DontCare */);
75829
75925
  }
75830
75926
  get nextSibling() {
75831
75927
  let { buffer } = this.context;
@@ -75839,7 +75935,7 @@
75839
75935
  let parentStart = this._parent ? this._parent.index + 4 : 0;
75840
75936
  if (this.index == parentStart)
75841
75937
  return this.externalSibling(-1);
75842
- return new BufferNode(this.context, this._parent, buffer.findChild(parentStart, this.index, -1, 0, 4 /* DontCare */));
75938
+ return new BufferNode(this.context, this._parent, buffer.findChild(parentStart, this.index, -1, 0, 4 /* Side.DontCare */));
75843
75939
  }
75844
75940
  cursor(mode = 0) { return new TreeCursor(this, mode); }
75845
75941
  get tree() { return null; }
@@ -75848,8 +75944,8 @@
75848
75944
  let { buffer } = this.context;
75849
75945
  let startI = this.index + 4, endI = buffer.buffer[this.index + 3];
75850
75946
  if (endI > startI) {
75851
- let from = buffer.buffer[this.index + 1], to = buffer.buffer[this.index + 2];
75852
- children.push(buffer.slice(startI, endI, from, to));
75947
+ let from = buffer.buffer[this.index + 1];
75948
+ children.push(buffer.slice(startI, endI, from));
75853
75949
  positions.push(0);
75854
75950
  }
75855
75951
  return new Tree(this.type, children, positions, this.to - this.from);
@@ -75876,6 +75972,8 @@
75876
75972
  /// A tree cursor object focuses on a given node in a syntax tree, and
75877
75973
  /// allows you to move to adjacent nodes.
75878
75974
  class TreeCursor {
75975
+ /// Shorthand for `.type.name`.
75976
+ get name() { return this.type.name; }
75879
75977
  /// @internal
75880
75978
  constructor(node,
75881
75979
  /// @internal
@@ -75899,8 +75997,6 @@
75899
75997
  this.yieldBuf(node.index);
75900
75998
  }
75901
75999
  }
75902
- /// Shorthand for `.type.name`.
75903
- get name() { return this.type.name; }
75904
76000
  yieldNode(node) {
75905
76001
  if (!node)
75906
76002
  return false;
@@ -75945,13 +76041,13 @@
75945
76041
  }
75946
76042
  /// Move the cursor to this node's first child. When this returns
75947
76043
  /// false, the node has no child, and the cursor has not been moved.
75948
- firstChild() { return this.enterChild(1, 0, 4 /* DontCare */); }
76044
+ firstChild() { return this.enterChild(1, 0, 4 /* Side.DontCare */); }
75949
76045
  /// Move the cursor to this node's last child.
75950
- lastChild() { return this.enterChild(-1, 0, 4 /* DontCare */); }
76046
+ lastChild() { return this.enterChild(-1, 0, 4 /* Side.DontCare */); }
75951
76047
  /// Move the cursor to the first child that ends after `pos`.
75952
- childAfter(pos) { return this.enterChild(1, pos, 2 /* After */); }
76048
+ childAfter(pos) { return this.enterChild(1, pos, 2 /* Side.After */); }
75953
76049
  /// Move to the last child that starts before `pos`.
75954
- childBefore(pos) { return this.enterChild(-1, pos, -2 /* Before */); }
76050
+ childBefore(pos) { return this.enterChild(-1, pos, -2 /* Side.Before */); }
75955
76051
  /// Move the cursor to the child around `pos`. If side is -1 the
75956
76052
  /// child may end at that position, when 1 it may start there. This
75957
76053
  /// will also enter [overlaid](#common.MountedTree.overlay)
@@ -75977,19 +76073,19 @@
75977
76073
  if (!this.buffer)
75978
76074
  return !this._tree._parent ? false
75979
76075
  : this.yield(this._tree.index < 0 ? null
75980
- : this._tree._parent.nextChild(this._tree.index + dir, dir, 0, 4 /* DontCare */, this.mode));
76076
+ : this._tree._parent.nextChild(this._tree.index + dir, dir, 0, 4 /* Side.DontCare */, this.mode));
75981
76077
  let { buffer } = this.buffer, d = this.stack.length - 1;
75982
76078
  if (dir < 0) {
75983
76079
  let parentStart = d < 0 ? 0 : this.stack[d] + 4;
75984
76080
  if (this.index != parentStart)
75985
- return this.yieldBuf(buffer.findChild(parentStart, this.index, -1, 0, 4 /* DontCare */));
76081
+ return this.yieldBuf(buffer.findChild(parentStart, this.index, -1, 0, 4 /* Side.DontCare */));
75986
76082
  }
75987
76083
  else {
75988
76084
  let after = buffer.buffer[this.index + 3];
75989
76085
  if (after < (d < 0 ? buffer.buffer.length : buffer.buffer[this.stack[d] + 3]))
75990
76086
  return this.yieldBuf(after);
75991
76087
  }
75992
- return d < 0 ? this.yield(this.buffer.parent.nextChild(this.buffer.index + dir, dir, 0, 4 /* DontCare */, this.mode)) : false;
76088
+ return d < 0 ? this.yield(this.buffer.parent.nextChild(this.buffer.index + dir, dir, 0, 4 /* Side.DontCare */, this.mode)) : false;
75993
76089
  }
75994
76090
  /// Move to this node's next sibling, if any.
75995
76091
  nextSibling() { return this.sibling(1); }
@@ -76026,7 +76122,7 @@
76026
76122
  return true;
76027
76123
  }
76028
76124
  move(dir, enter) {
76029
- if (enter && this.enterChild(dir, 0, 4 /* DontCare */))
76125
+ if (enter && this.enterChild(dir, 0, 4 /* Side.DontCare */))
76030
76126
  return true;
76031
76127
  for (;;) {
76032
76128
  if (this.sibling(dir))
@@ -76036,7 +76132,7 @@
76036
76132
  }
76037
76133
  }
76038
76134
  /// Move to the next node in a
76039
- /// [pre-order](https://en.wikipedia.org/wiki/Tree_traversal#Pre-order_(NLR))
76135
+ /// [pre-order](https://en.wikipedia.org/wiki/Tree_traversal#Pre-order,_NLR)
76040
76136
  /// traversal, going from a node to its first child or, if the
76041
76137
  /// current node is empty or `enter` is false, its next sibling or
76042
76138
  /// the next sibling of the first parent node that has one.
@@ -76152,17 +76248,17 @@
76152
76248
  let lookAheadAtStart = lookAhead;
76153
76249
  while (size < 0) {
76154
76250
  cursor.next();
76155
- if (size == -1 /* Reuse */) {
76251
+ if (size == -1 /* SpecialRecord.Reuse */) {
76156
76252
  let node = reused[id];
76157
76253
  children.push(node);
76158
76254
  positions.push(start - parentStart);
76159
76255
  return;
76160
76256
  }
76161
- else if (size == -3 /* ContextChange */) { // Context change
76257
+ else if (size == -3 /* SpecialRecord.ContextChange */) { // Context change
76162
76258
  contextHash = id;
76163
76259
  return;
76164
76260
  }
76165
- else if (size == -4 /* LookAhead */) {
76261
+ else if (size == -4 /* SpecialRecord.LookAhead */) {
76166
76262
  lookAhead = id;
76167
76263
  return;
76168
76264
  }
@@ -76279,7 +76375,7 @@
76279
76375
  fork.next();
76280
76376
  while (fork.pos > startPos) {
76281
76377
  if (fork.size < 0) {
76282
- if (fork.size == -3 /* ContextChange */)
76378
+ if (fork.size == -3 /* SpecialRecord.ContextChange */)
76283
76379
  localSkipped += 4;
76284
76380
  else
76285
76381
  break scan;
@@ -76315,10 +76411,10 @@
76315
76411
  buffer[--index] = start - bufferStart;
76316
76412
  buffer[--index] = id;
76317
76413
  }
76318
- else if (size == -3 /* ContextChange */) {
76414
+ else if (size == -3 /* SpecialRecord.ContextChange */) {
76319
76415
  contextHash = id;
76320
76416
  }
76321
- else if (size == -4 /* LookAhead */) {
76417
+ else if (size == -4 /* SpecialRecord.LookAhead */) {
76322
76418
  lookAhead = id;
76323
76419
  }
76324
76420
  return index;
@@ -76365,7 +76461,7 @@
76365
76461
  let total = 0;
76366
76462
  for (let i = from; i < to; i++)
76367
76463
  total += nodeSize(balanceType, children[i]);
76368
- let maxChild = Math.ceil((total * 1.5) / 8 /* BranchFactor */);
76464
+ let maxChild = Math.ceil((total * 1.5) / 8 /* Balance.BranchFactor */);
76369
76465
  let localChildren = [], localPositions = [];
76370
76466
  function divide(children, positions, from, to, offset) {
76371
76467
  for (let i = from; i < to;) {
@@ -76426,16 +76522,16 @@
76426
76522
  this.to = to;
76427
76523
  this.tree = tree;
76428
76524
  this.offset = offset;
76429
- this.open = (openStart ? 1 /* Start */ : 0) | (openEnd ? 2 /* End */ : 0);
76525
+ this.open = (openStart ? 1 /* Open.Start */ : 0) | (openEnd ? 2 /* Open.End */ : 0);
76430
76526
  }
76431
76527
  /// Whether the start of the fragment represents the start of a
76432
76528
  /// parse, or the end of a change. (In the second case, it may not
76433
76529
  /// be safe to reuse some nodes at the start, depending on the
76434
76530
  /// parsing algorithm.)
76435
- get openStart() { return (this.open & 1 /* Start */) > 0; }
76531
+ get openStart() { return (this.open & 1 /* Open.Start */) > 0; }
76436
76532
  /// Whether the end of the fragment represents the end of a
76437
76533
  /// full-document parse, or the start of a change.
76438
- get openEnd() { return (this.open & 2 /* End */) > 0; }
76534
+ get openEnd() { return (this.open & 2 /* Open.End */) > 0; }
76439
76535
  /// Create a set of fragments from a freshly parsed tree, or update
76440
76536
  /// an existing set of fragments by replacing the ones that overlap
76441
76537
  /// with a tree with content from the new tree. When `partial` is
@@ -76679,10 +76775,10 @@
76679
76775
  tags = [tags];
76680
76776
  for (let part of prop.split(" "))
76681
76777
  if (part) {
76682
- let pieces = [], mode = 2 /* Normal */, rest = part;
76778
+ let pieces = [], mode = 2 /* Mode.Normal */, rest = part;
76683
76779
  for (let pos = 0;;) {
76684
76780
  if (rest == "..." && pos > 0 && pos + 3 == part.length) {
76685
- mode = 1 /* Inherit */;
76781
+ mode = 1 /* Mode.Inherit */;
76686
76782
  break;
76687
76783
  }
76688
76784
  let m = /^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(rest);
@@ -76694,7 +76790,7 @@
76694
76790
  break;
76695
76791
  let next = part[pos++];
76696
76792
  if (pos == part.length && next == "!") {
76697
- mode = 0 /* Opaque */;
76793
+ mode = 0 /* Mode.Opaque */;
76698
76794
  break;
76699
76795
  }
76700
76796
  if (next != "/")
@@ -76718,8 +76814,8 @@
76718
76814
  this.context = context;
76719
76815
  this.next = next;
76720
76816
  }
76721
- get opaque() { return this.mode == 0 /* Opaque */; }
76722
- get inherit() { return this.mode == 1 /* Inherit */; }
76817
+ get opaque() { return this.mode == 0 /* Mode.Opaque */; }
76818
+ get inherit() { return this.mode == 1 /* Mode.Inherit */; }
76723
76819
  sort(other) {
76724
76820
  if (!other || other.depth < this.depth) {
76725
76821
  this.next = other;
@@ -76730,7 +76826,7 @@
76730
76826
  }
76731
76827
  get depth() { return this.context ? this.context.length : 0; }
76732
76828
  }
76733
- Rule.empty = new Rule([], 2 /* Normal */, null);
76829
+ Rule.empty = new Rule([], 2 /* Mode.Normal */, null);
76734
76830
  /// Define a [highlighter](#highlight.Highlighter) from an array of
76735
76831
  /// tag/class pairs. Classes associated with more specific tags will
76736
76832
  /// take precedence.
@@ -76817,7 +76913,7 @@
76817
76913
  if (cls)
76818
76914
  cls += " ";
76819
76915
  cls += tagCls;
76820
- if (rule.mode == 1 /* Inherit */)
76916
+ if (rule.mode == 1 /* Mode.Inherit */)
76821
76917
  inheritedClass += (inheritedClass ? " " : "") + tagCls;
76822
76918
  }
76823
76919
  this.startSpan(cursor.from, cls);
@@ -76835,7 +76931,7 @@
76835
76931
  if (rangeFrom < rangeTo && hasChild) {
76836
76932
  while (cursor.from < rangeTo) {
76837
76933
  this.highlightRange(cursor, rangeFrom, rangeTo, inheritedClass, highlighters);
76838
- this.startSpan(Math.min(to, cursor.to), cls);
76934
+ this.startSpan(Math.min(rangeTo, cursor.to), cls);
76839
76935
  if (cursor.to >= nextPos || !cursor.nextSibling())
76840
76936
  break;
76841
76937
  }
@@ -78776,6 +78872,7 @@
78776
78872
  closeOnBlur: true,
78777
78873
  maxRenderedOptions: 100,
78778
78874
  defaultKeymap: true,
78875
+ tooltipClass: () => "",
78779
78876
  optionClass: () => "",
78780
78877
  aboveCursor: false,
78781
78878
  icons: true,
@@ -78786,6 +78883,7 @@
78786
78883
  defaultKeymap: (a, b) => a && b,
78787
78884
  closeOnBlur: (a, b) => a && b,
78788
78885
  icons: (a, b) => a && b,
78886
+ tooltipClass: (a, b) => c => joinClass(a(c), b(c)),
78789
78887
  optionClass: (a, b) => c => joinClass(a(c), b(c)),
78790
78888
  addToOptions: (a, b) => a.concat(b)
78791
78889
  });
@@ -78864,14 +78962,17 @@
78864
78962
  key: this
78865
78963
  };
78866
78964
  this.space = null;
78965
+ this.currentClass = "";
78867
78966
  let cState = view.state.field(stateField);
78868
78967
  let { options, selected } = cState.open;
78869
78968
  let config = view.state.facet(completionConfig);
78870
78969
  this.optionContent = optionContent(config);
78871
78970
  this.optionClass = config.optionClass;
78971
+ this.tooltipClass = config.tooltipClass;
78872
78972
  this.range = rangeAroundSelected(options.length, selected, config.maxRenderedOptions);
78873
78973
  this.dom = document.createElement("div");
78874
78974
  this.dom.className = "cm-tooltip-autocomplete";
78975
+ this.updateTooltipClass(view.state);
78875
78976
  this.dom.addEventListener("mousedown", (e) => {
78876
78977
  for (let dom = e.target, match; dom && dom != this.dom; dom = dom.parentNode) {
78877
78978
  if (dom.nodeName == "LI" && (match = /-(\d+)$/.exec(dom.id)) && +match[1] < options.length) {
@@ -78892,12 +78993,25 @@
78892
78993
  var _a, _b, _c;
78893
78994
  let cState = update.state.field(this.stateField);
78894
78995
  let prevState = update.startState.field(this.stateField);
78996
+ this.updateTooltipClass(update.state);
78895
78997
  if (cState != prevState) {
78896
78998
  this.updateSel();
78897
78999
  if (((_a = cState.open) === null || _a === void 0 ? void 0 : _a.disabled) != ((_b = prevState.open) === null || _b === void 0 ? void 0 : _b.disabled))
78898
79000
  this.dom.classList.toggle("cm-tooltip-autocomplete-disabled", !!((_c = cState.open) === null || _c === void 0 ? void 0 : _c.disabled));
78899
79001
  }
78900
79002
  }
79003
+ updateTooltipClass(state) {
79004
+ let cls = this.tooltipClass(state);
79005
+ if (cls != this.currentClass) {
79006
+ for (let c of this.currentClass.split(" "))
79007
+ if (c)
79008
+ this.dom.classList.remove(c);
79009
+ for (let c of cls.split(" "))
79010
+ if (c)
79011
+ this.dom.classList.add(c);
79012
+ this.currentClass = cls;
79013
+ }
79014
+ }
78901
79015
  positioned(space) {
78902
79016
  this.space = space;
78903
79017
  if (this.info)
@@ -79158,13 +79272,13 @@
79158
79272
  if (active.length == this.active.length && active.every((a, i) => a == this.active[i]))
79159
79273
  active = this.active;
79160
79274
  let open = this.open;
79275
+ if (open && tr.docChanged)
79276
+ open = open.map(tr.changes);
79161
79277
  if (tr.selection || active.some(a => a.hasResult() && tr.changes.touchesRange(a.from, a.to)) ||
79162
79278
  !sameResults(active, this.active))
79163
- open = CompletionDialog.build(active, state, this.id, this.open, conf);
79279
+ open = CompletionDialog.build(active, state, this.id, open, conf);
79164
79280
  else if (open && open.disabled && !active.some(a => a.state == 1 /* State.Pending */))
79165
79281
  open = null;
79166
- else if (open && tr.docChanged)
79167
- open = open.map(tr.changes);
79168
79282
  if (!open && active.every(a => a.state != 1 /* State.Pending */) && active.some(a => a.hasResult()))
79169
79283
  active = active.map(a => a.hasResult() ? new ActiveSource(a.source, 0 /* State.Inactive */) : a);
79170
79284
  for (let effect of tr.effects)
@@ -79519,6 +79633,7 @@
79519
79633
  maxWidth: "min(700px, 95vw)",
79520
79634
  minWidth: "250px",
79521
79635
  maxHeight: "10em",
79636
+ height: "100%",
79522
79637
  listStyle: "none",
79523
79638
  margin: 0,
79524
79639
  padding: 0,
@@ -80473,7 +80588,7 @@
80473
80588
  function extendSel(view, how) {
80474
80589
  let selection = updateSel(view.state.selection, range => {
80475
80590
  let head = how(range);
80476
- return EditorSelection.range(range.anchor, head.head, head.goalColumn);
80591
+ return EditorSelection.range(range.anchor, head.head, head.goalColumn, head.bidiLevel || undefined);
80477
80592
  });
80478
80593
  if (selection.eq(view.state.selection))
80479
80594
  return false;
@@ -84446,6 +84561,88 @@
84446
84561
  }
84447
84562
  });
84448
84563
 
84564
+ /**
84565
+ * Create an array of syntax errors in the given tree.
84566
+ *
84567
+ * @param {Tree} syntaxTree
84568
+ * @returns {LintMessage[]} array of syntax errors
84569
+ */
84570
+ function lintSyntax(syntaxTree) {
84571
+
84572
+ const lintMessages = [];
84573
+
84574
+ syntaxTree.iterate({
84575
+ enter: node => {
84576
+ if (node.type.isError) {
84577
+
84578
+ const error = node.toString();
84579
+
84580
+ /* The error has the pattern [⚠ || ⚠(NodeType)]. The regex extracts the node type from inside the brackets */
84581
+ const match = /\((.*?)\)/.exec(error);
84582
+ const nodeType = match && match[1];
84583
+
84584
+ let message;
84585
+
84586
+ if (nodeType) {
84587
+ message = 'unexpected ' + nodeType;
84588
+ } else {
84589
+ message = 'expression expected';
84590
+ }
84591
+
84592
+ lintMessages.push(
84593
+ {
84594
+ from: node.from,
84595
+ to: node.to,
84596
+ severity: 'error',
84597
+ message: message,
84598
+ type: 'syntaxError'
84599
+ }
84600
+ );
84601
+ }
84602
+ }
84603
+ });
84604
+
84605
+ return lintMessages;
84606
+ }
84607
+
84608
+ /**
84609
+ * Generates lint messages for the given syntax tree.
84610
+ *
84611
+ * @param {Tree} syntaxTree
84612
+ * @returns {LintMessage[]} array of all lint messages
84613
+ */
84614
+ function lintAll(syntaxTree) {
84615
+
84616
+ const lintMessages = [
84617
+ ... lintSyntax(syntaxTree)
84618
+ ];
84619
+
84620
+ return lintMessages;
84621
+ }
84622
+
84623
+ /**
84624
+ * CodeMirror extension that provides linting for FEEL expressions.
84625
+ *
84626
+ * @param {EditorView} editorView
84627
+ * @returns {Source} CodeMirror linting source
84628
+ */
84629
+ const cmFeelLinter = () => editorView => {
84630
+
84631
+ // don't lint if the Editor is empty
84632
+ if (editorView.state.doc.length === 0) {
84633
+ return [];
84634
+ }
84635
+
84636
+ const tree = syntaxTree(editorView.state);
84637
+
84638
+ const messages = lintAll(tree);
84639
+
84640
+ return messages.map(message => ({
84641
+ ...message,
84642
+ source: 'syntaxError'
84643
+ }));
84644
+ };
84645
+
84449
84646
  // helpers ///////////////////////////////
84450
84647
 
84451
84648
  function isNodeEmpty(node) {
@@ -84809,9 +85006,10 @@
84809
85006
  label: tag.name,
84810
85007
  type: 'function',
84811
85008
  info: () => {
84812
- const html = domify$1(tag.description);
85009
+ const html = domify$1(`<div class="description">${tag.description}<div>`);
84813
85010
  return html;
84814
- }
85011
+ },
85012
+ boost: -1
84815
85013
  }
84816
85014
  ));
84817
85015
 
@@ -84850,6 +85048,109 @@
84850
85048
  */
84851
85049
  const variablesFacet = Facet.define();
84852
85050
 
85051
+ var pathExpression = context => {
85052
+ const variables = context.state.facet(variablesFacet)[0];
85053
+ const nodeBefore = syntaxTree(context.state).resolve(context.pos, -1);
85054
+
85055
+ if (!isPathExpression(nodeBefore)) {
85056
+ return;
85057
+ }
85058
+
85059
+ const expression = findPathExpression(nodeBefore);
85060
+
85061
+ // if the cursor is directly after the `.`, variable starts at the cursor position
85062
+ const from = nodeBefore === expression ? context.pos : nodeBefore.from;
85063
+
85064
+ const path = getPath(expression, context);
85065
+
85066
+ let options = variables;
85067
+ for (var i = 0; i < path.length - 1; i++) {
85068
+ var childVar = options.find(val => val.name === path[i].name);
85069
+
85070
+ if (!childVar) {
85071
+ return null;
85072
+ }
85073
+
85074
+ // only suggest if variable type matches
85075
+ if (
85076
+ childVar.isList !== 'optional' &&
85077
+ !!childVar.isList !== path[i].isList
85078
+ ) {
85079
+ return;
85080
+ }
85081
+
85082
+ options = childVar.entries;
85083
+ }
85084
+
85085
+ if (!options) return;
85086
+
85087
+ options = options.map(v => ({
85088
+ label: v.name,
85089
+ type: 'variable',
85090
+ info: v.info,
85091
+ detail: v.detail
85092
+ }));
85093
+
85094
+ const result = {
85095
+ from: from,
85096
+ options: options
85097
+ };
85098
+
85099
+ return result;
85100
+ };
85101
+
85102
+
85103
+ function findPathExpression(node) {
85104
+ while (node) {
85105
+ if (node.name === 'PathExpression') {
85106
+ return node;
85107
+ }
85108
+ node = node.parent;
85109
+ }
85110
+ }
85111
+
85112
+ // parses the path expression into a list of variable names with type information
85113
+ // e.g. foo[0].bar => [ { name: 'foo', isList: true }, { name: 'bar', isList: false } ]
85114
+ function getPath(node, context) {
85115
+ let path = [];
85116
+
85117
+ for (let child = node.firstChild; child; child = child.nextSibling) {
85118
+ if (child.name === 'PathExpression') {
85119
+ path.push(...getPath(child, context));
85120
+ } else if (child.name === 'FilterExpression') {
85121
+ path.push(...getFilter(child, context));
85122
+ }
85123
+ else {
85124
+ path.push({
85125
+ name: getNodeContent(child, context),
85126
+ isList: false
85127
+ });
85128
+ }
85129
+ }
85130
+ return path;
85131
+ }
85132
+
85133
+ function getFilter(node, context) {
85134
+ const list = node.firstChild;
85135
+
85136
+ if (list.name === 'PathExpression') {
85137
+ const path = getPath(list, context);
85138
+ const last = path[path.length - 1];
85139
+ last.isList = true;
85140
+
85141
+ return path;
85142
+ }
85143
+
85144
+ return [ {
85145
+ name: getNodeContent(list, context),
85146
+ isList: true
85147
+ } ];
85148
+ }
85149
+
85150
+ function getNodeContent(node, context) {
85151
+ return context.state.sliceDoc(node.from, node.to);
85152
+ }
85153
+
84853
85154
  /**
84854
85155
  * @type {import('@codemirror/autocomplete').CompletionSource}
84855
85156
  */
@@ -84901,7 +85202,8 @@
84901
85202
  override: [
84902
85203
  variables,
84903
85204
  builtins,
84904
- completeFromList(snippets)
85205
+ completeFromList(snippets.map(s => ({ ...s, boost: -1 }))),
85206
+ pathExpression
84905
85207
  ]
84906
85208
  })
84907
85209
  ];
@@ -84911,53 +85213,7 @@
84911
85213
  return new LanguageSupport(feelLanguage, [ ]);
84912
85214
  }
84913
85215
 
84914
- const FeelLinter = function(editorView) {
84915
- const messages = [];
84916
-
84917
- // don't lint if the Editor is empty
84918
- if (editorView.state.doc.length === 0) {
84919
- return messages;
84920
- }
84921
-
84922
- const tree = syntaxTree(editorView.state);
84923
-
84924
- tree.iterate({
84925
- enter: node => {
84926
- if (node.type.isError) {
84927
-
84928
- const error = node.toString();
84929
-
84930
- /* The error has the pattern [⚠ || ⚠(NodeType)]. The regex extracts the node type from inside the brackets */
84931
- const match = /\((.*?)\)/.exec(error);
84932
- const nodeType = match && match[1];
84933
-
84934
- let message;
84935
-
84936
- if (nodeType) {
84937
- message = 'unexpected ' + nodeType;
84938
- } else {
84939
- message = 'expression expected';
84940
- }
84941
-
84942
- messages.push(
84943
- {
84944
- from: node.from,
84945
- to: node.to,
84946
- severity: 'error',
84947
- message: message,
84948
- source: 'syntaxError'
84949
- }
84950
- );
84951
- }
84952
- }
84953
- });
84954
-
84955
- return messages;
84956
- };
84957
-
84958
- var syntaxLinter = linter$1(FeelLinter);
84959
-
84960
- var linter = [ syntaxLinter ];
85216
+ var linter = [ linter$1(cmFeelLinter()) ];
84961
85217
 
84962
85218
  const baseTheme = EditorView.theme({
84963
85219
  '& .cm-content': {
@@ -85025,9 +85281,11 @@
85025
85281
 
85026
85282
  /**
85027
85283
  * @typedef {object} Variable
85028
- * @property {string} name
85029
- * @property {string} [info]
85030
- * @property {string} [detail]
85284
+ * @property {string} name name or key of the variable
85285
+ * @property {string} [info] short information about the variable, e.g. type
85286
+ * @property {string} [detail] longer description of the variable content
85287
+ * @property {boolean} [isList] whether the variable is a list
85288
+ * @property {array<Variable>} [schema] array of child variables if the variable is a context or list
85031
85289
  */
85032
85290
 
85033
85291
  const autocompletionConf = new Compartment();
@@ -86143,7 +86401,7 @@
86143
86401
  label,
86144
86402
  onChange,
86145
86403
  options = [],
86146
- value,
86404
+ value = '',
86147
86405
  disabled,
86148
86406
  onFocus,
86149
86407
  onBlur
@@ -87081,28 +87339,41 @@
87081
87339
 
87082
87340
  // api /////////////////////////
87083
87341
 
87342
+ /**
87343
+ * Extractors add ProcessVariables to the `options.processVariables` parameter.
87344
+ * @callback extractor
87345
+ * @param {Object} options
87346
+ * @param {Array<ModdleElement>} options.elements
87347
+ * @param {ModdleElement} options.containerElement
87348
+ * @param {Array<ProcessVariable>} options.processVariables
87349
+ */
87350
+
87084
87351
  /**
87085
87352
  * Retrieves all process variables for a given container element.
87086
87353
  * @param {ModdleElement} containerElement
87354
+ * @param {Array<extractor>} [additionalExtractors]
87087
87355
  *
87088
- * @returns {Array<ProcessVariable>}
87356
+ * @returns {Promise<Array<ProcessVariable>>}
87089
87357
  */
87090
- function getProcessVariables$1(containerElement) {
87358
+ function getProcessVariables$1(containerElement, additionalExtractors = []) {
87091
87359
  var processVariables = [];
87092
87360
 
87093
87361
  // (1) extract all flow elements inside the container
87094
87362
  var elements = selfAndAllFlowElements$1([ containerElement ], false);
87095
87363
 
87364
+ const allPromises = [];
87365
+
87096
87366
  // (2) extract all variables from the extractors
87097
- minDash$1.forEach(extractors$1, function(extractor) {
87098
- extractor({
87367
+ minDash$1.forEach([ ...extractors$1, ...additionalExtractors ], function(extractor) {
87368
+ allPromises.push(extractor({
87099
87369
  elements: elements,
87100
87370
  containerElement: containerElement,
87101
87371
  processVariables: processVariables
87102
- });
87372
+ }));
87103
87373
  });
87104
87374
 
87105
- return processVariables;
87375
+ return Promise.all(allPromises)
87376
+ .then(() => processVariables);
87106
87377
  }
87107
87378
 
87108
87379
  /**
@@ -87114,12 +87385,13 @@
87114
87385
  *
87115
87386
  * @param {string} scope
87116
87387
  * @param {ModdleElement} rootElement element from where to extract all variables
87388
+ * @param {Array<extractor>} [additionalExtractors]
87117
87389
  *
87118
- * @returns {Array<ProcessVariable>}
87390
+ * @returns {Promise<Array<ProcessVariable>>}
87119
87391
  */
87120
- function getVariablesForScope$1(scope, rootElement) {
87392
+ async function getVariablesForScope$1(scope, rootElement, additionalExtractors = []) {
87121
87393
 
87122
- var allVariables = getProcessVariables$1(rootElement);
87394
+ var allVariables = await getProcessVariables$1(rootElement, additionalExtractors);
87123
87395
 
87124
87396
  var scopeElement = getElement$1(scope, rootElement);
87125
87397
 
@@ -87141,8 +87413,8 @@
87141
87413
  }
87142
87414
 
87143
87415
 
87144
- function getVariablesForElement(element) {
87145
- return getVariablesForScope$1(getScope$2(element), getRootElement(element));
87416
+ function getVariablesForElement(element, additionalExtractors = []) {
87417
+ return getVariablesForScope$1(getScope$2(element), getRootElement(element), additionalExtractors);
87146
87418
  }
87147
87419
 
87148
87420
  function getScope$2(element) {
@@ -87847,30 +88119,46 @@
87847
88119
  * @property {ModdleElement} scope
87848
88120
  */
87849
88121
 
88122
+
88123
+ /**
88124
+ * Extractors add ProcessVariables to the `options.processVariables` parameter.
88125
+ * @callback extractor
88126
+ * @param {Object} options
88127
+ * @param {Array<ModdleElement>} options.elements
88128
+ * @param {ModdleElement} options.containerElement
88129
+ * @param {Array<ProcessVariable>} options.processVariables
88130
+ */
88131
+
87850
88132
  // api /////////////////////////
87851
88133
 
87852
88134
  /**
87853
88135
  * Retrieves all process variables for a given container element.
87854
88136
  * @param {ModdleElement} containerElement
88137
+ * @param {Array<extractor>} additionalExtractors
87855
88138
  *
87856
- * @returns {Array<ProcessVariable>}
88139
+ * @returns {Promise<Array<ProcessVariable>>}
87857
88140
  */
87858
- function getProcessVariables(containerElement) {
88141
+ function getProcessVariables(containerElement, additionalExtractors = []) {
88142
+ const allPromises = [];
88143
+
87859
88144
  var processVariables = [];
87860
88145
 
87861
88146
  // (1) extract all flow elements inside the container
87862
88147
  var elements = selfAndAllFlowElements([ containerElement ], false);
87863
88148
 
87864
88149
  // (2) extract all variables from the extractors
87865
- minDash.forEach(extractors, function(extractor) {
87866
- extractor({
87867
- elements: elements,
87868
- containerElement: containerElement,
87869
- processVariables: processVariables
87870
- });
88150
+ minDash.forEach([ ...extractors, ...additionalExtractors ], function(extractor) {
88151
+ allPromises.push(
88152
+ extractor({
88153
+ elements: elements,
88154
+ containerElement: containerElement,
88155
+ processVariables: processVariables
88156
+ })
88157
+ );
87871
88158
  });
87872
88159
 
87873
- return processVariables;
88160
+ return Promise.all(allPromises)
88161
+ .then(() => processVariables);
87874
88162
  }
87875
88163
 
87876
88164
  /**
@@ -87882,12 +88170,13 @@
87882
88170
  *
87883
88171
  * @param {string} scope
87884
88172
  * @param {ModdleElement} rootElement element from where to extract all variables
88173
+ * @param {Array<extractor>} additionalExtractors
87885
88174
  *
87886
- * @returns {Array<ProcessVariable>}
88175
+ * @returns {Promise<Array<ProcessVariable>>}
87887
88176
  */
87888
- function getVariablesForScope(scope, rootElement) {
88177
+ async function getVariablesForScope(scope, rootElement, additionalExtractors = []) {
87889
88178
 
87890
- var allVariables = getProcessVariables(rootElement);
88179
+ var allVariables = await getProcessVariables(rootElement, additionalExtractors);
87891
88180
 
87892
88181
  var scopeElement = getElement(scope, rootElement);
87893
88182
 
@@ -90292,7 +90581,7 @@
90292
90581
  /**
90293
90582
  * @returns {Array<Entry>} entries
90294
90583
  */
90295
- function ErrorProps$1(props) {
90584
+ function ErrorProps$2(props) {
90296
90585
  const {
90297
90586
  element
90298
90587
  } = props;
@@ -90312,7 +90601,7 @@
90312
90601
  isEdited: isEdited$1
90313
90602
  }, {
90314
90603
  id: 'errorCode',
90315
- component: ErrorCode$1,
90604
+ component: ErrorCode$2,
90316
90605
  isEdited: isEdited$1
90317
90606
  }];
90318
90607
  }
@@ -90428,7 +90717,7 @@
90428
90717
  debounce
90429
90718
  });
90430
90719
  }
90431
- function ErrorCode$1(props) {
90720
+ function ErrorCode$2(props) {
90432
90721
  const {
90433
90722
  element
90434
90723
  } = props;
@@ -91902,7 +92191,7 @@
91902
92191
  id: 'error',
91903
92192
  label: translate('Error'),
91904
92193
  component: Group,
91905
- entries: [...ErrorProps$1({
92194
+ entries: [...ErrorProps$2({
91906
92195
  element
91907
92196
  })]
91908
92197
  };
@@ -92820,7 +93109,7 @@
92820
93109
  // different conditions but same bindings
92821
93110
  return oldProperties.filter(property => !findPropertyWithBinding(newTemplate, property));
92822
93111
  }
92823
- function normalizeReplacer(key, value) {
93112
+ function normalizeReplacer$1(key, value) {
92824
93113
  if (isObject(value)) {
92825
93114
  const keys = Object.keys(value).sort();
92826
93115
  return keys.reduce((obj, key) => {
@@ -92831,7 +93120,7 @@
92831
93120
  return value;
92832
93121
  }
92833
93122
  function equals(a, b) {
92834
- return JSON.stringify(a, normalizeReplacer) === JSON.stringify(b, normalizeReplacer);
93123
+ return JSON.stringify(a, normalizeReplacer$1) === JSON.stringify(b, normalizeReplacer$1);
92835
93124
  }
92836
93125
 
92837
93126
  function unlinkTemplate$1(element, injector) {
@@ -93026,6 +93315,163 @@
93026
93315
 
93027
93316
  document.createElement('form');
93028
93317
 
93318
+ /**
93319
+ * Restores the original order of the template properties
93320
+ * on the moddle element.
93321
+ */
93322
+ class UpdateTemplatePropertiesOrder extends CommandInterceptor {
93323
+ constructor(eventBus, elementTemplates, commandStack, bpmnFactory) {
93324
+ super(eventBus);
93325
+ this._eventBus = eventBus;
93326
+ this._elementTemplates = elementTemplates;
93327
+ this._commandStack = commandStack;
93328
+ this._bpmnFactory = bpmnFactory;
93329
+ this.postExecute(['element.updateProperties', 'element.updateModdleProperties'], this._updatePropertiesOrder, true, this);
93330
+ }
93331
+ _updatePropertiesOrder(context) {
93332
+ const {
93333
+ element
93334
+ } = context;
93335
+ const template = this._elementTemplates.get(element);
93336
+ const businessObject = element.businessObject;
93337
+ const commands = [];
93338
+ if (!template) {
93339
+ return;
93340
+ }
93341
+ const templateProperties = template.properties;
93342
+
93343
+ // zeebe:Property
93344
+ const zeebeProperties = findExtension$1(businessObject, 'zeebe:Properties');
93345
+ if (zeebeProperties) {
93346
+ this._updateZeebePropertiesOrder(zeebeProperties, templateProperties, commands, context);
93347
+ }
93348
+
93349
+ // zeebe:IoMapping
93350
+ const ioMapping = findExtension$1(businessObject, 'zeebe:IoMapping');
93351
+ if (ioMapping) {
93352
+ // zeebe:Input
93353
+ this._updateInputOrder(ioMapping, templateProperties, commands, context);
93354
+
93355
+ // zeebe:Output
93356
+ this._updateOutputOrder(ioMapping, templateProperties, commands, context);
93357
+ }
93358
+
93359
+ // zeebe:TaskHeaders
93360
+ const taskHeaders = findExtension$1(businessObject, 'zeebe:TaskHeaders');
93361
+ if (taskHeaders) {
93362
+ this._updateTaskHeadersOrder(taskHeaders, templateProperties, commands, context);
93363
+ }
93364
+ if (commands.length) {
93365
+ const commandsToExecute = commands.filter(command => command !== null);
93366
+ commandsToExecute.length && this._commandStack.execute('properties-panel.multi-command-executor', commandsToExecute);
93367
+ return;
93368
+ }
93369
+ }
93370
+ _updateZeebePropertiesOrder(zeebeProperties, templateProperties, commands, context) {
93371
+ const findIndex = (properties, propertyToFind) => properties.findIndex(prop => prop.binding.type == 'zeebe:property' && prop.binding.name === propertyToFind.get('name'));
93372
+ const properties = zeebeProperties.get('properties');
93373
+ if (properties.length < 1) return;
93374
+ let newPropertiesOrder = [...properties];
93375
+ sortProperties(newPropertiesOrder, findIndex, templateProperties);
93376
+ if (!arrayEquals(newPropertiesOrder, properties)) {
93377
+ commands.push({
93378
+ cmd: 'element.updateModdleProperties',
93379
+ context: {
93380
+ ...context,
93381
+ moddleElement: zeebeProperties,
93382
+ properties: {
93383
+ properties: newPropertiesOrder
93384
+ }
93385
+ }
93386
+ });
93387
+ }
93388
+ }
93389
+ _updateInputOrder(ioMapping, templateProperties, commands, context) {
93390
+ const findIndex = (properties, propertyToFind) => properties.findIndex(prop => prop.binding.type == 'zeebe:input' && prop.binding.name === propertyToFind.get('target'));
93391
+ const inputParameters = ioMapping.get('inputParameters');
93392
+ if (inputParameters.length < 1) return;
93393
+ let newInputOrder = [...inputParameters];
93394
+ sortProperties(newInputOrder, findIndex, templateProperties);
93395
+ if (!arrayEquals(newInputOrder, inputParameters)) {
93396
+ commands.push({
93397
+ cmd: 'element.updateModdleProperties',
93398
+ context: {
93399
+ ...context,
93400
+ moddleElement: ioMapping,
93401
+ properties: {
93402
+ inputParameters: newInputOrder
93403
+ }
93404
+ }
93405
+ });
93406
+ }
93407
+ }
93408
+ _updateOutputOrder(ioMapping, templateProperties, commands, context) {
93409
+ const findIndex = (properties, propertyToFind) => properties.findIndex(prop => prop.binding.type == 'zeebe:output' && prop.binding.source === propertyToFind.get('source'));
93410
+ const outputParameters = ioMapping.get('outputParameters');
93411
+ if (outputParameters.length < 1) return;
93412
+ let newOutputOrder = [...outputParameters];
93413
+ sortProperties(newOutputOrder, findIndex, templateProperties);
93414
+ if (!arrayEquals(newOutputOrder, outputParameters)) {
93415
+ commands.push({
93416
+ cmd: 'element.updateModdleProperties',
93417
+ context: {
93418
+ ...context,
93419
+ moddleElement: ioMapping,
93420
+ properties: {
93421
+ outputParameters: newOutputOrder
93422
+ }
93423
+ }
93424
+ });
93425
+ }
93426
+ }
93427
+ _updateTaskHeadersOrder(taskHeaders, templateProperties, commands, context) {
93428
+ const findIndex = (properties, propertyToFind) => properties.findIndex(prop => prop.binding.type == 'zeebe:taskHeader' && prop.binding.key === propertyToFind.get('key'));
93429
+ const headers = taskHeaders.get('zeebe:values');
93430
+ if (headers.length < 1) return;
93431
+ let newHeadersOrder = [...headers];
93432
+ sortProperties(newHeadersOrder, findIndex, templateProperties);
93433
+ if (!arrayEquals(newHeadersOrder, headers)) {
93434
+ commands.push({
93435
+ cmd: 'element.updateModdleProperties',
93436
+ context: {
93437
+ ...context,
93438
+ moddleElement: taskHeaders,
93439
+ properties: {
93440
+ values: newHeadersOrder
93441
+ }
93442
+ }
93443
+ });
93444
+ }
93445
+ }
93446
+ }
93447
+ UpdateTemplatePropertiesOrder.$inject = ['eventBus', 'elementTemplates', 'commandStack', 'bpmnFactory'];
93448
+
93449
+ // helpers
93450
+
93451
+ function normalizeReplacer(key, value) {
93452
+ if (isObject(value)) {
93453
+ const keys = Object.keys(value).sort();
93454
+ return keys.reduce((obj, key) => {
93455
+ obj[key] = value[key];
93456
+ return obj;
93457
+ }, {});
93458
+ }
93459
+ return value;
93460
+ }
93461
+ function objectEquals(a, b) {
93462
+ return JSON.stringify(a, normalizeReplacer) === JSON.stringify(b, normalizeReplacer);
93463
+ }
93464
+ function arrayEquals(a, b) {
93465
+ return a.every((element, idx) => objectEquals(element, b[idx]));
93466
+ }
93467
+ function sortProperties(array, findIndex, templateProperties) {
93468
+ return array.sort((a, b) => {
93469
+ const aIndex = findIndex(templateProperties, a);
93470
+ const bIndex = findIndex(templateProperties, b);
93471
+ return aIndex - bIndex;
93472
+ });
93473
+ }
93474
+
93029
93475
  /**
93030
93476
  * This Behavior checks if the new element's type is in
93031
93477
  * the list of elements the template applies to and unlinks