/*! espocrm 2026-01-16 */ define("di",["exports"],function(e){Object.defineProperty(e,"__esModule",{value:!0});e.container=void 0;e.inject=function(i){return function(e,t){t.addInitializer(function(){let e=a.get(i);if(!e){e=Reflect.construct(i,s.get(i));a.set(i,e)}this[t.name]=e})}};e.register=function(){let t=0{this.once("ready",()=>e())})}addActionHandler(e,t){var i=`click [data-action="${e}"]`;this.events[i]=e=>{t.call(this,e.originalEvent,e.currentTarget)}}escapeString(e){return Handlebars.Utils.escapeExpression(e)}notify(e,t,i,s){if(e){s=s||null;i=i||2e3;t||(i=void 0);var a=this.getLanguage().translate(e,"labels",s);Espo.Ui.notify(a,t,i)}else Espo.Ui.notify(!1)}getHelper(){return this._helper}getUser(){return this._helper.user}getPreferences(){return this._helper.preferences}getConfig(){return this._helper.settings}getAcl(){return this._helper.acl}getModelFactory(){return this._helper.modelFactory}getCollectionFactory(){return this._helper.collectionFactory}getRouter(){return this._helper.router}getStorage(){return this._helper.storage}getSessionStorage(){return this._helper.sessionStorage}getLanguage(){return this._helper.language}getMetadata(){return this._helper.metadata}getCache(){return this._helper.cache}getDateTime(){return this._helper.dateTime}getNumberUtil(){return this._helper.numberUtil}getFieldManager(){return this._helper.fieldManager}getBaseController(){return this._helper.baseController}getThemeManager(){return this._helper.themeManager}updatePageTitle(){var e=this.getConfig().get("applicationName")||"EspoCRM";this.setPageTitle(e)}setPageTitle(e){this.getHelper().pageTitle.setTitle(e)}translate(e,t,i){return this.getLanguage().translate(e,t,i)}getBasePath(){return this._helper.basePath||""}confirm(e,t,i){let s;if("string"==typeof e||e instanceof String){s=e;e={}}else{e=e||{};s=e.message}s=s&&this.getHelper().transformMarkdownText(s,{linksInNewTab:!0}).toString();var a=e.confirmText||this.translate("Yes"),r=e.confirmStyle||null,o=e.cancelText||this.translate("Cancel");return Espo.Ui.confirm(s,{confirmText:a,cancelText:o,confirmStyle:r,backdrop:!("backdrop"in e)||e.backdrop,isHtml:!0,cancelCallback:e.cancelCallback},t,i)}}e.default=i});define("date-time",["exports","moment"],function(e,a){Object.defineProperty(e,"__esModule",{value:!0});e.default=void 0;a=(t=a,t&&t.__esModule?t:{default:t});var t;e.default=class{constructor(){}internalDateFormat="YYYY-MM-DD";internalDateTimeFormat="YYYY-MM-DD HH:mm";internalDateTimeFullFormat="YYYY-MM-DD HH:mm:ss";dateFormat="MM/DD/YYYY";timeFormat="HH:mm";timeZone=null;systemTimeZone;weekStart=1;readableDateFormatMap={"DD.MM.YYYY":"DD MMM","DD/MM/YYYY":"DD MMM"};readableShortDateFormatMap={"DD.MM.YYYY":"D MMM","DD/MM/YYYY":"D MMM"};hasMeridian(){return new RegExp("A","i").test(this.timeFormat)}getDateFormat(){return this.dateFormat}getTimeFormat(){return this.timeFormat}getDateTimeFormat(){return this.dateFormat+" "+this.timeFormat}getReadableDateFormat(){return this.readableDateFormatMap[this.getDateFormat()]||"MMM DD"}getReadableShortDateFormat(){return this.readableShortDateFormatMap[this.getDateFormat()]||"MMM D"}getReadableDateTimeFormat(){return this.getReadableDateFormat()+" "+this.timeFormat}getReadableShortDateTimeFormat(){return this.getReadableShortDateFormat()+" "+this.timeFormat}fromDisplayDate(e){var t=(0,a.default)(e,this.dateFormat);return t.isValid()?t.format(this.internalDateFormat):-1}getTimeZone(){return this.timeZone||"UTC"}toDisplayDate(e){var t;return e&&"string"==typeof e&&(t=(0,a.default)(e,this.internalDateFormat),t.isValid())?t.format(this.dateFormat):""}fromDisplay(e){let t;t=this.timeZone?a.default.tz(e,this.getDateTimeFormat(),this.timeZone).utc():a.default.utc(e,this.getDateTimeFormat());return t.isValid()?t.format(this.internalDateTimeFormat)+":00":-1}toDisplay(e){return e?this.toMoment(e).format(this.getDateTimeFormat()):""}getNowMoment(){return(0,a.default)().tz(this.getTimeZone())}toMomentDate(e){return a.default.tz(e,this.internalDateFormat,this.systemTimeZone)}toMoment(e){let t=a.default.utc(e,this.internalDateTimeFullFormat);this.timeZone&&(t=t.tz(this.timeZone));return t}fromIso(e){var t;return e?(t=(0,a.default)(e).utc(),t.format(this.internalDateTimeFormat)):""}toIso(e){return this.toMoment(e).format()}getToday(){return(0,a.default)().tz(this.getTimeZone()).format(this.internalDateFormat)}getDateTimeShiftedFromNow(e,t,i){if(!i)return a.default.utc().add(e,t).format(this.internalDateTimeFormat);var s=(0,a.default)().unix();s-=s%(60*i);return a.default.unix(s).utc().add(e,t).format(this.internalDateTimeFormat)}getDateShiftedFromToday(e,t){return a.default.tz(this.getTimeZone()).add(e,t).format(this.internalDateFormat)}getNow(e){if(!e)return a.default.utc().format(this.internalDateTimeFormat);var t=(0,a.default)().unix();t-=t%(60*e);return a.default.unix(t).utc().format(this.internalDateTimeFormat)}setSettingsAndPreferences(e,t){e.has("dateFormat")&&(this.dateFormat=e.get("dateFormat"));e.has("timeFormat")&&(this.timeFormat=e.get("timeFormat"));if(e.has("timeZone")){this.timeZone=e.get("timeZone")||null;this.systemTimeZone=this.timeZone||"UTC";"UTC"===this.timeZone&&(this.timeZone=null)}e.has("weekStart")&&(this.weekStart=e.get("weekStart"));t.on("change",e=>{e.has("dateFormat")&&e.get("dateFormat")&&(this.dateFormat=e.get("dateFormat"));e.has("timeFormat")&&e.get("timeFormat")&&(this.timeFormat=e.get("timeFormat"));e.has("timeZone")&&e.get("timeZone")&&(this.timeZone=e.get("timeZone"));e.has("weekStart")&&-1!==e.get("weekStart")&&(this.weekStart=e.get("weekStart"));"UTC"===this.timeZone&&(this.timeZone=null)})}setLanguage(e){a.default.updateLocale("en",{months:e.translatePath(["Global","lists","monthNames"]),monthsShort:e.translatePath(["Global","lists","monthNamesShort"]),weekdays:e.translatePath(["Global","lists","dayNames"]),weekdaysShort:e.translatePath(["Global","lists","dayNamesShort"]),weekdaysMin:e.translatePath(["Global","lists","dayNamesMin"])});a.default.locale("en")}}});define("helpers/site/shortcut-manager",["exports","di"],function(e,t){Object.defineProperty(e,"__esModule",{value:!0});e.default=void 0;let i,s;function a(d,t,h,i,c,e){var D,P,u,m,p,s,a=Symbol.metadata||Symbol.for("Symbol.metadata"),k=Object.defineProperty,r=Object.create,F=[r(null),r(null)],o=t.length;function _(s,a,r){return function(e,t){a&&(t=e,e=d);for(var i=0;i{if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0===i)return("string"===t?String:Number)(e);i=i.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")})(i,"string"),"symbol"==typeof a?a:a+""),o,o<2?[]:e?m=m||[]:u=u||[],p,!!e,l,t,e&&l?function(e){return(e=>{if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(null!==e?typeof e:"null"));return e})(e)===d}:c)}}},s(8,0),s(0,0),s(8,1),s(0,1),r(u),r(m),P=p,o||n(d),{e:P,get c(){var e=[];return o&&[n(d=f(d,[t],i,d.name,5,e)),_(e,1)]}}}function I(e,t,i){"symbol"==typeof t&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch(e){}return e}var r=e.default=void 0;(class{static#_=(i=[r,s]=a(this,[(0,t.register)()],[]).c,e.default=r,i);level=0;items;constructor(){this.items=[];document.addEventListener("keydown",e=>this.handle(e),{capture:!0})}add(t,e){var i=2e.view===t)){i.stack&&this.level++;this.items.push({view:t,keys:e,level:this.level})}}remove(t){var i=this.items.findIndex(e=>e.view===t);if(!(i<0)){this.items.splice(i,1);let e=0;for(var s of this.items)s.level>e&&(e=s.level);this.level=e}}handle(e){var t=this.items.filter(e=>e.level===this.level);if(0!==t.length){var i,s=Espo.Utils.getKeyFromKeyEvent(e);for(i of t){var a=i.keys[s];if(a){if("function"==typeof a){a.call(i.view,e);break}e.preventDefault();e.stopPropagation();a="action"+Espo.Utils.upperCaseFirst(a);if("function"==typeof i.view[a]){i.view[a]();break}}}}}static#_2=s()})});define("helpers/site/modal-bar-provider",["exports","di"],function(e,t){Object.defineProperty(e,"__esModule",{value:!0});e.default=void 0;let i,s;function a(d,t,h,i,c,e){var D,P,u,m,p,s,a=Symbol.metadata||Symbol.for("Symbol.metadata"),k=Object.defineProperty,r=Object.create,F=[r(null),r(null)],o=t.length;function _(s,a,r){return function(e,t){a&&(t=e,e=d);for(var i=0;i{if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0===i)return("string"===t?String:Number)(e);i=i.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")})(i,"string"),"symbol"==typeof a?a:a+""),o,o<2?[]:e?m=m||[]:u=u||[],p,!!e,l,t,e&&l?function(e){return(e=>{if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(null!==e?typeof e:"null"));return e})(e)===d}:c)}}},s(8,0),s(0,0),s(8,1),s(0,1),r(u),r(m),P=p,o||n(d),{e:P,get c(){var e=[];return o&&[n(d=f(d,[t],i,d.name,5,e)),_(e,1)]}}}function I(e,t,i){"symbol"==typeof t&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch(e){}return e}var r=e.default=void 0;(class{static#_=(i=[r,s]=a(this,[(0,t.register)()],[]).c,e.default=r,i);view=null;get(){return this.view}set(e){this.view=e}static#_2=s()})});define("utils",["exports"],function(e){Object.defineProperty(e,"__esModule",{value:!0});e.default=void 0;let i=/Mac/.test(navigator.userAgent),s=(Espo.Utils={handleAction:function(i,s,e,t){t=t||{};var a=$(e),r=t.action||a.data("action");let o=a.data("name")||r,n,l;if(o&&t.actionItems&&(!t.className||e.classList.contains(t.className))){let e=t.actionItems.find(e=>e.name===o||e.action===o);if(e&&e.onClick)return e.onClick(),!0;if(e){l=e.handler;n=e.actionFunction}}if(!r&&!t.actionFunction&&!n)return!1;if(s.ctrlKey||s.metaKey||s.shiftKey){var d=a.attr("href");if(d&&"javascript:"!==d)return!1}let h=a.data();n=t.actionFunction||n||"action"+Espo.Utils.upperCaseFirst(r);l=t.handler||l||h.handler;let c=!1;if(l){s.preventDefault();s.stopPropagation();c=!0;Espo.loader.require(l,e=>{var t=new e(i);t[n].call(t,h,s)})}else if("function"==typeof i[n]){if(null!=i&&i.events[`click [data-action="${r}"]`])return!1;i[n].call(i,h,s);s.preventDefault();s.stopPropagation();c=!0}if(!c)return!1;this._processAfterActionDropdown(a);return!0},_processAfterActionDropdown:function(e){var t=e.closest(".dropdown-menu");if(t.length){t=t.parent().find('[data-toggle="dropdown"]');if(t.length){let e=!1;if(t.attr("disabled")){e=!0;t.removeAttr("disabled").removeClass("disabled")}t.dropdown("toggle");t.focus();e&&t.attr("disabled","disabled").addClass("disabled")}}},checkActionAvailability:function(e,s){var a=e.config;if(s.configCheck){let e=s.configCheck,t=!1;if("!"===e.substring(0,1)){t=!0;e=e.substring(1)}let i=a.getByPath(e.split("."));t&&(i=!i);if(!i)return!1}return!0},checkActionAccess:function(e,t,i,s){let a=!0;i.acl?a=i.aclScope?e.check(i.aclScope,i.acl):t?"string"==typeof t||t instanceof String?e.check(t,i.acl):e.checkModel(t,i.acl,s):e.check(i.scope,i.acl):i.aclScope&&(a=e.checkScope(i.aclScope));return a},checkAccessDataList:function(e,t,s,a,r){if(e&&e.length)for(var o in e){let i=e[o];if(i.scope){if(i.action){if(!t.check(i.scope,i.action))return!1}else if(!t.checkScope(i.scope))return!1}else if(i.action&&a&&!t.check(a,i.action))return!1;if(i.teamIdList&&s&&(!r||!s.isAdmin())){let t=!1;s.getLinkMultipleIdList("teams").forEach(e=>{~i.teamIdList.indexOf(e)&&(t=!0)});if(!t)return!1}if(i.portalIdList&&s&&(!r||!s.isAdmin())){let t=!1;s.getLinkMultipleIdList("portals").forEach(e=>{~i.portalIdList.indexOf(e)&&(t=!0)});if(!t)return!1}if(i.isPortalOnly){if(s&&(!r||!s.isAdmin())&&!s.isPortal())return!1}else if(i.inPortalDisabled&&s&&(!r||!s.isAdmin())&&s.isPortal())return!1;if(i.isAdminOnly&&s&&!s.isAdmin())return!1}return!0},convert:function(e,t){if(null===e)return e;let i=e;switch(t){case"c-h":case"C-h":i=Espo.Utils.camelCaseToHyphen(e);break;case"h-c":i=Espo.Utils.hyphenToCamelCase(e);break;case"h-C":i=Espo.Utils.hyphenToUpperCamelCase(e)}return i},isObject:function(e){return null!==e&&"object"==typeof e},clone:function(e){return Espo.Utils.isObject(e)?_.isArray(e)?e.slice():_.extend({},e):e},cloneDeep:function(e){e=Espo.Utils.clone(e);if(Espo.Utils.isObject(e)||_.isArray(e))for(var t in e)e[t]=this.cloneDeep(e[t]);return e},areEqual:function(e,t){return _.isEqual(e,t)},composeClassName:function(e,t,i){if(e){e=this.camelCaseToHyphen(e);t=this.camelCaseToHyphen(t).split(".").join("/");i=this.camelCaseToHyphen(i||"");return e+":"+i+"/"+t}return t=this.camelCaseToHyphen(t).split(".").join("/"),i+"/"+t},composeViewClassName:function(e){var t,i;return e&&e[0]===e[0].toLowerCase()?e:-1!==e.indexOf(":")?(i=e.split(":"),t=i[0],i=i[1],t=this.camelCaseToHyphen(t),i=this.camelCaseToHyphen(i).split(".").join("/"),t+":views/"+i):(e=this.camelCaseToHyphen(e).split(".").join("/"),"views/"+e)},toDom:function(e){return Espo.Utils.convert(e,"c-h").split(".").join("-")},lowerCaseFirst:function(e){return null===e?e:e.charAt(0).toLowerCase()+e.slice(1)},upperCaseFirst:function(e){return null===e?e:e.charAt(0).toUpperCase()+e.slice(1)},hyphenToUpperCamelCase:function(e){return null===e?e:this.upperCaseFirst(e.replace(/-([a-z])/g,function(e){return e[1].toUpperCase()}))},hyphenToCamelCase:function(e){return null===e?e:e.replace(/-([a-z])/g,function(e){return e[1].toUpperCase()})},camelCaseToHyphen:function(e){return null===e?e:e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()},trimSlash:function(e){return"/"===e.slice(-1)?e.slice(0,-1):e},parseUrlOptionsParam:function(e){if(!e)return{};if(-1===e.indexOf("&")&&-1===e.indexOf("="))return{};let i={};void 0!==e&&e.split("&").forEach(e=>{var t=e.split("=");i[t[0]]=!0;1{i.includes(e)&&(s=!0)});return s}checkIsShared(e){var t;return e.has("collaboratorsIds")?(t=e.getLinkMultipleIdList("collaborators"),t.includes(this.user.id)):!!this.collaboratorsFieldIsForbidden||!!e.hasField("collaborators")&&null}getPermissionLevel(e){return this._aclManager.getPermissionLevel(e)}}i.extend=t.View.extend;e.default=i});define("views/modal",["exports","view","di","helpers/site/modal-bar-provider","helpers/site/shortcut-manager"],function(e,t,i,s,a){Object.defineProperty(e,"__esModule",{value:!0});e.default=void 0;t=d(t);s=d(s);a=d(a);let r,o,n,l;function d(e){return e&&e.__esModule?e:{default:e}}function h(d,t,h,i,c,e){var D,P,u,m,p,s,a=Symbol.metadata||Symbol.for("Symbol.metadata"),k=Object.defineProperty,r=Object.create,F=[r(null),r(null)],o=t.length;function _(s,a,r){return function(e,t){a&&(t=e,e=d);for(var i=0;i{if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0===i)return("string"===t?String:Number)(e);i=i.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")})(i,"string"),"symbol"==typeof a?a:a+""),o,o<2?[]:e?m=m||[]:u=u||[],p,!!e,l,t,e&&l?function(e){return(e=>{if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(null!==e?typeof e:"null"));return e})(e)===d}:c)}}},s(8,0),s(0,0),s(8,1),s(0,1),r(u),r(m),P=p,o||n(d),{e:P,get c(){var e=[];return o&&[n(d=f(d,[t],i,d.name,5,e)),_(e,1)]}}}function I(e,t,i){"symbol"==typeof t&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch(e){}return e}class c extends t.default{static#_=[r,o,n,l]=h(this,[],[[(0,i.inject)(s.default),0,"modalBarProvider"],[(0,i.inject)(a.default),0,"shortcutManager"]],0,void 0,t.default).e;constructor(e){super(e),l(this)}cssName="modal-dialog";className="dialog";header;headerHtml;$header;headerElement;headerText;dialog;containerSelector="";scope=null;backdrop="static";buttonList=[];dropdownItemList=[];buttons=[];width=null;fitHeight=!1;noFullHeight=!1;escapeDisabled=!1;isDraggable=!1;isCollapsible=!1;isMaximizable=!1;isCollapsed=!1;bodyElement;events={"click .action":function(e){Espo.Utils.handleAction(this,e.originalEvent,e.currentTarget)}};footerAtTheTop=null;shortcutKeys=null;containerElement;modalBarProvider=r(this);shortcutManager=(o(this),n(this));init(){let s=this.cssName+"-container-"+Math.floor(1e4*Math.random()+1).toString();this.containerSelector="#"+s;this.header=this.options.header||this.header;this.headerHtml=this.options.headerHtml||this.headerHtml;this.$header=this.options.$header||this.$header;this.headerElement=this.options.headerElement||this.headerElement;this.headerText=this.options.headerText||this.headerText;this.backdrop=this.options.backdrop||this.backdrop;this.setSelector(this.containerSelector);this.buttonList=this.options.buttonList||this.buttonList;this.dropdownItemList=this.options.dropdownItemList||this.dropdownItemList;this.buttonList=Espo.Utils.cloneDeep(this.buttonList);this.dropdownItemList=Espo.Utils.cloneDeep(this.dropdownItemList);this.shortcutKeys&&(this.shortcutKeys=Espo.Utils.cloneDeep(this.shortcutKeys));this.options.collapseDisabled&&(this.isCollapsible=!1);this.on("render",()=>{this.dialog&&this.dialog.close();this.element=void 0;this.isCollapsed=!1;$(this.containerSelector).remove();$("
").css("display","none").attr("id",s).addClass("modal-container").appendTo("body");let e=92,t=(null!==this.getThemeManager().getParam("modalBodyDiffHeight")&&(e=this.getThemeManager().getParam("modalBodyDiffHeight")),this.headerHtml||this.header);this.$header&&this.$header.length&&(t=this.$header.get(0).outerHTML);this.headerElement&&(t=this.headerElement.outerHTML);this.headerText&&(t=Handlebars.Utils.escapeExpression(this.headerText));var i=null!==this.footerAtTheTop?this.footerAtTheTop:this.getThemeManager().getParam("modalFooterAtTheTop");this.dialog=new Espo.Ui.Dialog({backdrop:this.backdrop,header:t,container:this.containerSelector,body:"",buttonList:this.getDialogButtonList(),dropdownItemList:this.getDialogDropdownItemList(),width:this.width,keyboard:!this.escapeDisabled,fitHeight:this.fitHeight,draggable:this.isDraggable,className:this.className,bodyDiffHeight:e,footerAtTheTop:i,fullHeight:!this.noFullHeight&&this.getThemeManager().getParam("modalFullHeight"),screenWidthXs:this.getThemeManager().getParam("screenWidthXs"),fixedHeaderHeight:this.fixedHeaderHeight,closeButton:!this.noCloseButton,collapseButton:this.isCollapsible,maximizeButton:this.isMaximizable&&!this.getHelper().isXsScreen(),onRemove:()=>this.onDialogClose(),onBackdropClick:()=>this.onBackdropClick(),onMaximize:()=>this.onMaximize(),onMinimize:()=>this.onMinimize()});this.containerElement=document.querySelector(this.containerSelector);this.setElement(this.containerSelector+" .body");this.bodyElement=this.element});this.on("after:render",()=>{this.element=void 0;this.setElement(this.containerSelector);$(this.containerSelector).show();this.dialog.show();this.fixedHeaderHeight&&this.flexibleHeaderFontSize&&this.adjustHeaderFontSize();this.adjustButtons();this.noFullHeight||this.initBodyScrollListener();this.getParentView()&&this.getParentView().trigger("modal-shown");this.initShortcuts()});this.once("remove",()=>{this.dialog&&this.dialog.close();$(this.containerSelector).remove()});this.isCollapsible&&this.addActionHandler("collapseModal",()=>this.collapse());this.on("after:expand",()=>this.afterExpand())}initShortcuts(){this.shortcutManager.add(this,this.shortcutKeys??{},{stack:!0});this.once("remove",()=>{this.shortcutManager.remove(this)})}setupFinal(){this.initShortcuts()}getDialogButtonList(){let i=[];this.buttons.forEach(e=>{var t=Espo.Utils.clone(e);!("text"in t)&&"label"in t&&(t.text=this.getLanguage().translate(t.label));i.push(t)});this.buttonList.forEach(e=>{let s={};if("string"==typeof e)s.name=e;else{if("object"!=typeof e)return;s=e}s.text||(s.labelTranslation?s.text=this.getLanguage().translatePath(s.labelTranslation):"label"in s?s.text=this.translate(s.label,"labels",this.scope):s.text=this.translate(s.name,"modalActions",this.scope));s.iconHtml&&!s.html?s.html=s.iconHtml+""+this.getHelper().escapeString(s.text)+"":s.iconClass&&!s.html&&(s.html=``+""+this.getHelper().escapeString(s.text)+"");s.onClick=s.onClick||((e,t)=>{var i=s.handler||(s.data||{}).handler;Espo.Utils.handleAction(this,t.originalEvent,t.currentTarget,{action:s.name,handler:i,actionFunction:s.actionFunction})});i.push(s)});return i}getDialogDropdownItemList(){let t=[],i=(this.dropdownItemList.forEach(e=>{let s={};if("string"==typeof e)s.name=e;else{if("object"!=typeof e)return;s=e}s.text||(s.labelTranslation?s.text=this.getLanguage().translatePath(s.labelTranslation):"label"in s?s.text=this.translate(s.label,"labels",this.scope):s.text=this.translate(s.name,"modalActions",this.scope));s.onClick=s.onClick||((e,t)=>{var i=s.handler||(s.data||{}).handler;Espo.Utils.handleAction(this,t.originalEvent,t.currentTarget,{action:s.name,handler:i,actionFunction:s.actionFunction})});t.push(s)}),[]),s=(t.forEach(e=>{if(!1!==e){var t=(void 0===e.groupIndex?9999:e.groupIndex)+100;void 0===i[t]&&(i[t]=[]);i[t].push(e)}}),[]);i.forEach(e=>{e.forEach(e=>s.push(e));s.push(!1)});return s}updateDialog(){this.dialog&&this.dialog.setActionItems(this.getDialogButtonList(),this.getDialogDropdownItemList())}onDialogClose(){if(!this.isBeingRendered()&&!this.isCollapsed){this.trigger("close");this.remove()}this.shortcutManager.remove(this)}onBackdropClick(){}actionCancel(){this.trigger("cancel");this.close()}actionClose(){this.actionCancel()}close(){this.dialog.close();if(this.getParentView()){var e=this.getParentView().getViewKey(this);e&&this.getParentView().clearView(e)}}disableButton(t){this.buttonList.forEach(e=>{e.name===t&&(e.disabled=!0)});this.isRendered()&&this.containerElement&&$(this.containerElement).find(`footer button[data-name="${t}"]`).addClass("disabled").attr("disabled","disabled")}enableButton(t){this.buttonList.forEach(e=>{e.name===t&&(e.disabled=!1)});this.isRendered()&&this.containerElement&&$(this.containerElement).find('footer button[data-name="'+t+'"]').removeClass("disabled").removeAttr("disabled")}addButton(i,s,e){let a=-1;this.buttonList.forEach((e,t)=>{e.name===i.name&&(a=t)});if(!~a){if(!0===s)this.buttonList.unshift(i);else if("string"==typeof s){a=-1;this.buttonList.forEach((e,t)=>{e.name===s&&(a=t)});~a?this.buttonList.splice(a,0,i):this.buttonList.push(i)}else this.buttonList.push(i);!e&&this.isRendered()&&this.reRenderFooter()}}addDropdownItem(e,t,i){if(e){var s=e.name;if(s){for(var a of this.dropdownItemList)if(a.name===s)return;t?this.dropdownItemList.unshift(e):this.dropdownItemList.push(e);!i&&this.isRendered()&&this.reRenderFooter()}}}reRenderFooter(){if(this.dialog){this.updateDialog();var e=this.dialog.getFooter();$(this.containerElement).find("footer.modal-footer").empty().append(e);this.dialog.initButtonEvents()}}removeButton(e,t){let i=-1;for(var[s,a]of this.buttonList.entries())if(a.name===e){i=s;break}~i&&this.buttonList.splice(i,1);for(var[r,o]of this.dropdownItemList.entries())if(o.name===e){this.dropdownItemList.splice(r,1);break}this.isRendered()&&$(this.containerElement).find(`.modal-footer [data-name="${e}"]`).remove();!t&&this.isRendered()&&this.reRender()}showButton(e){for(var t of this.buttonList)if(t.name===e){t.hidden=!1;break}if(this.isRendered()&&this.containerElement){$(this.containerElement).find(`footer button[data-name="${e}"]`).removeClass("hidden");this.adjustButtons()}}hideButton(e){for(var t of this.buttonList)if(t.name===e){t.hidden=!0;break}if(this.isRendered()&&this.containerElement){$(this.containerElement).find(`footer button[data-name="${e}"]`).addClass("hidden");this.adjustButtons()}}showActionItem(e){for(var t of this.buttonList)if(t.name===e){t.hidden=!1;break}for(var i of this.dropdownItemList)if(i.name===e){i.hidden=!1;break}if(this.isRendered()&&this.containerElement){var s=$(this.containerElement);s.find(`footer button[data-name="${e}"]`).removeClass("hidden");s.find(`footer li > a[data-name="${e}"]`).parent().removeClass("hidden");if(!this.isDropdownItemListEmpty()){s=s.find("footer .main-btn-group > .btn-group");s.removeClass("hidden");s.find("> button").removeClass("hidden")}this.adjustButtons()}}hideActionItem(e){for(var t of this.buttonList)if(t.name===e){t.hidden=!0;break}for(var i of this.dropdownItemList)if(i.name===e){i.hidden=!0;break}if(this.isRendered()){var s=$(this.containerElement);s.find(`footer button[data-name="${e}"]`).addClass("hidden");s.find(`footer li > a[data-name="${e}"]`).parent().addClass("hidden");if(this.isDropdownItemListEmpty()){s=s.find("footer .main-btn-group > .btn-group");s.addClass("hidden");s.find("> button").addClass("hidden")}this.adjustButtons()}}hasActionItem(t){var e=-1!==this.buttonList.findIndex(e=>e.name===t);return e||-1!==this.dropdownItemList.findIndex(e=>e.name===t)}hasAvailableActionItem(t){var e=-1!==this.buttonList.findIndex(e=>e.name===t&&!e.disabled&&!e.hidden);return e||-1!==this.dropdownItemList.findIndex(e=>e.name===t&&!e.disabled&&!e.hidden)}isDropdownItemListEmpty(){if(0===this.dropdownItemList.length)return!0;let t=!0;this.dropdownItemList.forEach(e=>{e.hidden||(t=!1)});return t}adjustHeaderFontSize(e){e=e||0;e||(this.fontSizePercentage=100);if(this.containerElement){var t=$(this.containerElement).find(".modal-title > .modal-title-text"),s=t.parent().width();let i=0;t.children().each((e,t)=>{i+=$(t).outerWidth(!0)});if(s{$(t).removeAttr("title")})}else{this.fontSizePercentage-=4;$(this.containerElement).find(".modal-title .font-size-flexible").css("font-size",this.fontSizePercentage+"%");this.adjustHeaderFontSize(e+1)}}}async collapse(){var e=await this.beforeCollapse();if(!this.getParentView())throw new Error("Can't collapse w/o parent view.");this.isCollapsed=!0;e=e||{};let t;if(e.title)t=e.title;else{e=this.containerElement.querySelector(".modal-header .modal-title .modal-title-text");e&&(t=e.textContent)}this.dialog.close();let i=this;for(;i.getParentView();)i=i.getParentView();this.unchainFromParent();e=this.modalBarProvider.get();e&&await e.addModalView(this,{title:t})}unchainFromParent(){var e=this.getParentView().getViewKey(this);this.getParentView().unchainView(e)}beforeCollapse(){return new Promise(e=>e())}afterExpand(){}adjustButtons(){this.adjustLeftButtons();this.adjustRightButtons()}adjustLeftButtons(){var e=$(this.containerElement).find("footer.modal-footer > .main-btn-group button.btn"),e=(e.removeClass("radius-left").removeClass("radius-right"),e.filter("button:not(.hidden)"));e.first().addClass("radius-left");e.last().addClass("radius-right")}adjustRightButtons(){var e=$(this.containerElement).find("footer.modal-footer > .additional-btn-group button.btn:not(.btn-text)"),e=(e.removeClass("radius-left").removeClass("radius-right").removeClass("margin-right"),e.filter("button:not(.hidden)"));e.first().addClass("radius-left");e.last().addClass("radius-right");e.last().next().hasClass("btn-text")&&e.last().addClass("margin-right")}initBodyScrollListener(){let e=$(this.containerElement).find("> .dialog > .modal-dialog > .modal-content > .modal-body"),t=e.parent().find("> .modal-footer");if(t.length){e.off("scroll.footer-shadow");e.on("scroll.footer-shadow",()=>{e.scrollTop()?t.addClass("shadowed"):t.removeClass("shadowed")})}}onMaximize(){}onMinimize(){}}e.default=c});define("helpers/model/default-value-provider",["exports","date-time","di"],function(e,t,i){Object.defineProperty(e,"__esModule",{value:!0});e.default=void 0;t=(s=t,s&&s.__esModule?s:{default:s});var s;let a,r;function o(d,t,h,i,c,e){var D,P,u,m,p,s,a=Symbol.metadata||Symbol.for("Symbol.metadata"),k=Object.defineProperty,r=Object.create,F=[r(null),r(null)],o=t.length;function _(s,a,r){return function(e,t){a&&(t=e,e=d);for(var i=0;i{if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0===i)return("string"===t?String:Number)(e);i=i.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")})(i,"string"),"symbol"==typeof a?a:a+""),o,o<2?[]:e?m=m||[]:u=u||[],p,!!e,l,t,e&&l?function(e){return(e=>{if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(null!==e?typeof e:"null"));return e})(e)===d}:c)}}},s(8,0),s(0,0),s(8,1),s(0,1),r(u),r(m),P=p,o||n(d),{e:P,get c(){var e=[];return o&&[n(d=f(d,[t],i,d.name,5,e)),_(e,1)]}}}function I(e,t,i){"symbol"==typeof t&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch(e){}return e}let n=/return this\.dateTime\.getNow\(([0-9]+)\);/,l=/return this\.dateTime\.getDateShiftedFromToday\(([0-9]+), '([a-z]+)'\);/,d=/return this\.dateTime\.getDateTimeShiftedFromNow\(([0-9]+), '([a-z]+)', ([0-9]+)\);/;class h{static#_=[a,r]=o(this,[],[[(0,i.inject)(t.default),0,"dateTime"]]).e;constructor(){r(this)}dateTime=a(this);get(e){var t,i,s;return"return this.dateTime.getToday();"===e?this.dateTime.getToday():(t=e.match(n),t?(t=parseInt(t[1]),this.dateTime.getNow(t)):(t=e.match(l),t?(s=parseInt(t[1]),t=t[2],this.dateTime.getDateShiftedFromToday(s,t)):(s=e.match(d),s?(t=parseInt(s[1]),i=s[2],s=parseInt(s[3]),this.dateTime.getDateTimeShiftedFromNow(t,i,s)):void 0)))}}e.default=h});define("storage",["exports"],function(e){Object.defineProperty(e,"__esModule",{value:!0});e.default=void 0;e.default=class{constructor(){}prefix="espo";storageObject=localStorage;composeFullPrefix(e){return this.prefix+"-"+e}composeKey(e,t){return this.composeFullPrefix(e)+"-"+t}checkType(e){if(void 0===e&&"[object String]"!==toString.call(e)||"cache"===e)throw new TypeError('Bad type "'+e+'" passed to Espo.Storage.')}has(e,t){this.checkType(e);var i=this.composeKey(e,t);return null!==this.storageObject.getItem(i)}get(e,t){this.checkType(e);var i=this.composeKey(e,t);let s;try{s=this.storageObject.getItem(i)}catch(e){console.error(e);return null}if(s){let t=s;if(9{var t=this.options.routes[e];i.push({route:e,resolution:t.resolution||"defaultRoute",order:t.order||0});this.routeParams[e]=t.params||{}});this.routeList=Espo.Utils.clone(this.routeList);i.forEach(e=>{this.routeList.push(e)});this.routeList=this.routeList.sort((e,t)=>(e.order||0)-(t.order||0))}this.routeList.reverse().forEach(e=>{this.route(e.route,e.resolution)})},_last:null,confirmLeaveOut:!1,backProcessed:!1,confirmLeaveOutMessage:"Are you sure?",confirmLeaveOutConfirmText:"Yes",confirmLeaveOutCancelText:"No",initialize:function(e){this.options=e||{};this.setupRoutes();this._isReturn=!1;this.history=[];let t=[window.location.hash];window.addEventListener("hashchange",()=>{var e=window.location.hash;if(1this.backProcessed=!1,50)}else t.push(e)});this.on("route",()=>{this.history.push(l.default.history.fragment)});window.addEventListener("beforeunload",e=>{e=e||window.event;if(this.confirmLeaveOut||this._leaveOutMap.size||this._windowLeaveOutMap.size){e.preventDefault();e.returnValue=this.confirmLeaveOutMessage;return this.confirmLeaveOutMessage}});this._leaveOutMap=new Map;this._windowLeaveOutMap=new Map},getCurrentUrl:function(){return"#"+l.default.history.fragment},hasConfirmLeaveOut(){return this.confirmLeaveOut||this._leaveOutMap.size||this._windowLeaveOutMap.size},addLeaveOutObject(e){this._leaveOutMap.set(e,!0)},removeLeaveOutObject(e){this._leaveOutMap.delete(e)},addWindowLeaveOutObject(e){this._windowLeaveOutMap.set(e,!0)},removeWindowLeaveOutObject(e){this._windowLeaveOutMap.delete(e)},checkConfirmLeaveOut:function(e,t,i){if(this.confirmLeaveOutDisplayed){this.navigateBack({trigger:!1});this.confirmLeaveOutCanceled=!0}else{t=t||this;if(this.confirmLeaveOut||this._leaveOutMap.size){this.confirmLeaveOutDisplayed=!0;this.confirmLeaveOutCanceled=!1;Espo.Ui.confirm(this.confirmLeaveOutMessage,{confirmText:this.confirmLeaveOutConfirmText,cancelText:this.confirmLeaveOutCancelText,backdrop:!0,cancelCallback:()=>{this.confirmLeaveOutDisplayed=!1;i&&this.navigateBack({trigger:!1})}},()=>{this.confirmLeaveOutDisplayed=!1;this.confirmLeaveOut=!1;this._leaveOutMap.clear();this.confirmLeaveOutCanceled||e.call(t)})}else e.call(t)}},route:function(t,a){let r=t;_.isRegExp(t)||(t=this._routeToRegExp(t));let o,n=(o=this["_"+a],this);l.default.history.route(t,function(e){let i=n._extractParameters(t,e),s={};if("defaultRoute"===a){let t=[];r.split("/").forEach(e=>{e&&0===e.indexOf(":")&&t.push(e.substr(1))});t.forEach((e,t)=>{s[e]=i[t]})}n.execute(o,i,a,r,s);n.trigger.apply(n,["route:"+a].concat(i));n.trigger("route",a,i);l.default.history.trigger("route",n,a,i)});return this},execute:function(e,t,i,s,a){this.checkConfirmLeaveOut(()=>{"defaultRoute"===i?this._defaultRoute(this.routeParams[s],a):l.default.Router.prototype.execute.call(this,e,t,i)},null,!0)},navigate:function(e){var t=1{var t=e.split("=");i[t[0]]=!0;1{s.textStatus=t;s.errorThrown=i;o&&o.call(s.context,e,t,i)};var n=r?JSON.stringify(r):null,n=s.bypassRequest?Promise.resolve():Espo.Ajax.request(a,i,n,s);s.xhr=n.xhr;t.trigger("request",a,i,r,n,s);return n}set(e,t,i){if(null==e)return this;var s;if("object"==typeof e)return this.setMultiple(e,t);s={};s[e]=t;return this.setMultiple(s,i)}setMultiple(e,t){this.idAttribute in e&&(this.id=e[this.idAttribute]);t=t||{};t.ui&&!t.action&&(t.action="ui");t.ui||"ui"!==t.action||(t.ui=!0);var i=[],s=this._changing;this._changing=!0;if(!s){this._previousAttributes=h.default.clone(this.attributes);this.changed={}}var a,r=this.attributes,o=this.changed,n=this._previousAttributes;for(a in e){var l=e[a];h.default.isEqual(r[a],l)||i.push(a);h.default.isEqual(n[a],l)?delete o[a]:o[a]=l;t.unset?delete r[a]:r[a]=l}if(!t.silent){i.length&&(this._pending=t);for(let e=0;e{var t=this.prepareAttributes(e,i);this.set(t,i);s&&s.call(i.context,this,e,i);this.trigger("sync",this,e,i);this.collection&&this.collection.trigger("model-sync",this,i)};this.lastSyncPromise=this.sync("read",this,i);return this.lastSyncPromise}save(e,i){i={...i};e&&!i.wait&&this.setMultiple(e,i);let s=i.success,a=this.attributes,t=(i.success=e=>{this.attributes=a;let t=this.prepareAttributes(e,i);i.wait&&(t={...a,...t});i.action="save";t&&this.setMultiple(t,i);s&&s.call(i.context,this,e,i);this.trigger("sync",this,e,i);this.collection&&this.collection.trigger("model-sync",this,i)},i.error);i.error=e=>{t&&t.call(i.context,this,e,i);this.trigger("error",this,e,i)};e&&i.wait&&(this.attributes={...a,...e});var r=this.isNew()?"create":i.patch?"patch":"update",r=("patch"==r&&(i.attributes=e),this.sync(r,this,i));this.attributes=a;return r}destroy(){let i=0{this.stopListening();this.trigger("destroy",this,a,i)};i.success=e=>{i.wait&&r();s&&s.call(i.context,this,e,i);if(!this.isNew()){var t={...i};t.action="destroy";this.trigger("sync",this,e,t);a&&a.trigger("model-sync",this,t)}};if(this.isNew()){h.default.defer(i.success);i.wait||r();return Promise.resolve()}let t=i.error;i.error=e=>{t&&t.call(i.context,this,e,i);this.trigger("error",this,e,i)};var e=this.sync("delete",this,i);i.wait||r();return e}composeSyncUrl(){if(this.url)return this.url;let e=this.urlRoot;!e&&this.collection&&(e=this.collection.urlRoot);var t;if(e)return this.isNew()?e:(t=this.get(this.idAttribute),e.replace(/[^\/]$/,"$&/")+encodeURIComponent(t));throw new Error("No urlRoot.")}prepareAttributes(e,t){return e}clone(){return new this.constructor(Espo.Utils.cloneDeep(this.attributes),{entityType:this.entityType,urlRoot:this.urlRoot,url:this.url,defs:this.defs})}setDefs(e){this.defs=e||{};this.defs.fields||(this.defs.fields={})}getClonedAttributes(){return Espo.Utils.cloneDeep(this.attributes)}populateDefaults(){let e={};var t,i,s=this.defs.fields;for(t in s){if(this.hasFieldParam(t,"default"))try{e[t]=this.parseDefaultValue(this.getFieldParam(t,"default"))}catch(e){console.error(e)}var a=this.getFieldParam(t,"defaultAttributes");if(a)for(var r in a)e[r]=a[r]}e=Espo.Utils.cloneDeep(e);for(i in e)this.has(i)&&delete e[i];this.set(e,{silent:!0})}parseDefaultValue(e){if("string"==typeof e&&0===e.indexOf("javascript:")){var t=e.substring(11).trim(),i=new s.default;e=i.get(t)}return e}getLinkMultipleColumn(e,t,i){return((this.get(e+"Columns")||{})[i]||{})[t]}setRelate(e){let t=e=>{var t=e.link,i=e.model;if(!t||!i)throw new Error("Bad related options");var s=this.defs.links[t].type;switch(s){case"belongsToParent":this.set(t+"Id",i.id);this.set(t+"Type",i.entityType);this.set(t+"Name",i.get("name"));break;case"belongsTo":this.set(t+"Id",i.id);this.set(t+"Name",i.get("name"));break;case"hasMany":var a=[],r=(a.push(i.id),{});r[i.id]=i.get("name");this.set(t+"Ids",a);this.set(t+"Names",r)}};"[object Array]"===Object.prototype.toString.call(e)?e.forEach(e=>{t(e)}):t(e)}getFieldList(){return this.defs&&this.defs.fields?Object.keys(this.defs.fields):[]}getFieldType(e){return this.defs&&this.defs.fields&&e in this.defs.fields&&this.defs.fields[e].type||null}getFieldParam(e,t){return this.defs&&this.defs.fields&&e in this.defs.fields&&t in this.defs.fields[e]?this.defs.fields[e][t]:null}hasFieldParam(e,t){return!(!this.defs||!this.defs.fields)&&e in this.defs.fields&&t in this.defs.fields[e]}getLinkType(e){return this.defs&&this.defs.links&&e in this.defs.links&&this.defs.links[e].type||null}getLinkParam(e,t){return this.defs&&this.defs.links&&e in this.defs.links&&t in this.defs.links[e]?this.defs.links[e][t]:null}isFieldReadOnly(e){return this.getFieldParam(e,"readOnly")||!1}isRequired(e){return this.getFieldParam(e,"required")||!1}getLinkMultipleIdList(e){return this.get(e+"Ids")||[]}getTeamIdList(){return this.get("teamsIds")||[]}hasField(e){return"defs"in this&&"fields"in this.defs&&e in this.defs.fields}hasLink(e){return"defs"in this&&"links"in this.defs&&e in this.defs.links}isEditable(){return!0}isRemovable(){return!0}getEntityType(){return this.name}abortLastFetch(){this.lastSyncPromise&&this.lastSyncPromise.getReadyState()<4&&this.lastSyncPromise.abort()}}Object.assign(a.prototype,t.Events);a.extend=t.View.extend;e.default=a});define("metadata",["exports","bullbone"],function(e,t){Object.defineProperty(e,"__esModule",{value:!0});e.default=void 0;class i{constructor(e){this.cache=e||null;this.data={}}url="Metadata";load(e,t){if(t||!this.loadFromCache())return this.fetch().then(()=>{e&&e()});this.trigger("sync");e&&e();return Promise.resolve()}loadSkipCache(){return this.load(null,!0)}fetch(){return Espo.Ajax.getRequest(this.url).then(e=>{this.data=e;this.storeToCache();this.trigger("sync")})}get(e,t){t=t||null;let i,s=(i=Array&&Array.isArray&&Array.isArray(e)?e:e.split("."),this.data),a=t;for(let e=0;e{this.data=e;this.storeToCache(t);this.trigger("sync")})}sortFieldList(i,e){return e.sort((e,t)=>this.translate(e,"fields",i).localeCompare(this.translate(t,"fields",i)))}sortEntityList(e,t){let i="scopeNames";t&&(i+="Plural");return e.sort((e,t)=>this.translate(e,i).localeCompare(this.translate(t,i)))}translatePath(e){("string"==typeof e||e instanceof String)&&(e=e.split("."));let t=this.data;e.forEach(e=>{e in t&&(t=t[e])});return t}setScopeData(e,t){this.data[e]=t}}Object.assign(i.prototype,t.Events);e.default=i});define("acl-manager",["exports","acl","utils","bullbone"],function(e,s,l,t){Object.defineProperty(e,"__esModule",{value:!0});e.default=void 0;s=i(s);l=i(l);function i(e){return e&&e.__esModule?e:{default:e}}class a{data=null;fieldLevelList=["yes","no"];constructor(e,t,i){this.setEmpty();this.user=e||null;this.implementationClassMap=t||{};this.aclAllowDeleteCreated=i}setEmpty(){this.data={table:{},fieldTable:{},fieldTableQuickAccess:{}};this.implementationHash={};this.forbiddenFieldsCache={};this.implementationClassMap={};this.forbiddenAttributesCache={}}getImplementation(t){if(!(t in this.implementationHash)){let e=s.default;t in this.implementationClassMap&&(e=this.implementationClassMap[t]);var i=this.getScopeForbiddenFieldList(t),i={aclAllowDeleteCreated:this.aclAllowDeleteCreated,teamsFieldIsForbidden:i.includes("teams"),forbiddenFieldList:i};this.implementationHash[t]=new e(this.getUser(),t,i,this)}return this.implementationHash[t]}getUser(){return this.user}set(e){e=e||{};this.data=e;this.data.table=this.data.table||{};this.data.fieldTable=this.data.fieldTable||{};this.data.attributeTable=this.data.attributeTable||{}}get(e){return this.data[e]||null}getPermissionLevel(e){let t=e;"Permission"!==e.slice(-10)&&(t=e+"Permission");return this.data[t]||"no"}getLevel(e,t){var i;return e in this.data.table&&(i=this.data.table[e],"object"==typeof i)&&t in i?i[t]:null}clear(){this.setEmpty()}checkScopeHasAcl(e){var t=(this.data.table||{})[e];return void 0!==t}checkScope(e,t,i){let s=(this.data.table||{})[e];void 0===s&&(s=null);return this.getImplementation(e).checkScope(s,t,i)}checkModel(e,t,i){var s=e.entityType;if("edit"===t&&!e.isEditable())return!1;if("delete"===t&&!e.isRemovable())return!1;let a=(this.data.table||{})[s];void 0===a&&(a=null);s=this.getImplementation(s);if(t){var r="checkModel"+l.default.upperCaseFirst(t);if(r in s)return s[r](e,a,i)}return s.checkModel(e,a,t,i)}check(e,t,i){return"string"==typeof e?this.checkScope(e,t,i):this.checkModel(e,t,i)}checkIsOwner(e){return this.getImplementation(e.entityType).checkIsOwner(e)}checkInTeam(e){return this.getImplementation(e.entityType).checkInTeam(e)}checkIsShared(e){return this.getImplementation(e.entityType).checkIsShared(e)}checkAssignmentPermission(e){return this.checkPermission("assignmentPermission",e)}checkUserPermission(e){return this.checkPermission("userPermission",e)}checkPermission(e,i){if(this.getUser().isAdmin())return!0;var s=this.getPermissionLevel(e);if("no"===s)return i.id===this.getUser().id;if("team"!==s)return"all"===s||"yes"===s;{if(!i.has("teamsIds"))return null;let t=!1;s=i.get("teamsIds")||[];s.forEach(e=>{(this.getUser().get("teamsIds")||[]).includes(e)&&(t=!0)});return t}}getScopeForbiddenFieldList(e,t,i){t=t||"read";i=i||"no";var s=e+"_"+t+"_"+i;if(s in this.forbiddenFieldsCache)return l.default.clone(this.forbiddenFieldsCache[s]);var a=this.fieldLevelList.slice(this.fieldLevelList.indexOf(i)),r=this.data.fieldTableQuickAccess||{},r=r[e]||{},r=r.fields||{};let o=r[t]||{},n=[];a.forEach(e=>{var t=o[e]||[];t.forEach(e=>{n.includes(e)||n.push(e)})});this.forbiddenFieldsCache[s]=n;return l.default.clone(n)}getScopeForbiddenAttributeList(e,t,i){t=t||"read";i=i||"no";var s=e+"_"+t+"_"+i;if(s in this.forbiddenAttributesCache)return l.default.clone(this.forbiddenAttributesCache[s]);var a=this.fieldLevelList.slice(this.fieldLevelList.indexOf(i)),r=this.data.fieldTableQuickAccess||{},r=r[e]||{},r=r.attributes||{};let o=r[t]||{},n=[];a.forEach(e=>{var t=o[e]||[];t.forEach(e=>{n.includes(e)||n.push(e)})});this.forbiddenAttributesCache[s]=n;return l.default.clone(n)}checkTeamAssignmentPermission(e){return"all"===this.getPermissionLevel("assignmentPermission")||this.getUser().getLinkMultipleIdList("teams").includes(e)}checkField(e,t,i){return!this.getScopeForbiddenFieldList(e,i).includes(t)}}a.extend=t.View.extend;e.default=a});define("views/modals/edit",["exports","views/modal","backbone"],function(e,t,r){Object.defineProperty(e,"__esModule",{value:!0});e.default=void 0;t=i(t);r=i(r);function i(e){return e&&e.__esModule?e:{default:e}}class s extends t.default{template="modals/edit";cssName="edit-modal";saveDisabled=!1;fullFormDisabled=!1;editView=null;escapeDisabled=!0;className="dialog dialog-record";sideDisabled=!1;bottomDisabled=!1;isCollapsible=!0;wasModified=!1;nameAttribute;shortcutKeys={"Control+Enter":function(e){if(!this.saveDisabled&&-1!==this.buttonList.findIndex(e=>"save"===e.name&&!e.hidden&&!e.disabled)){e.preventDefault();e.stopPropagation();document.activeElement instanceof HTMLInputElement&&document.activeElement.dispatchEvent(new Event("change",{bubbles:!0}));this.actionSave()}},"Control+KeyS":function(e){if(!this.saveDisabled&&-1!==this.buttonList.findIndex(e=>"save"===e.name&&!e.hidden&&!e.disabled)){e.preventDefault();e.stopPropagation();this.actionSaveAndContinueEditing()}},Escape:function(e){if(!this.saveDisabled){e.stopPropagation();e.preventDefault();var t=this.getRecordView().getFocusedFieldView();t&&this.model.set(t.fetch(),{skipReRender:!0});this.getRecordView().isChanged?this.confirm(this.translate("confirmLeaveOutMessage","messages")).then(()=>this.actionClose()):this.actionClose()}},"Control+Backslash":function(e){this.getRecordView().handleShortcutKeyControlBackslash(e)}};constructor(e){super(e)}setup(){this.buttonList=[];"saveDisabled"in this.options&&(this.saveDisabled=this.options.saveDisabled);this.saveDisabled||this.buttonList.push({name:"save",label:"Save",style:"primary",title:"Ctrl+Enter",onClick:()=>this.actionSave()});this.fullFormDisabled=this.options.fullFormDisabled||this.fullFormDisabled;this.layoutName=this.options.layoutName||this.layoutName;this.fullFormDisabled||this.buttonList.push({name:"fullForm",label:"Full Form",onClick:()=>this.actionFullForm()});this.buttonList.push({name:"cancel",label:"Cancel",title:"Esc"});this.scope=this.scope||this.options.scope||this.options.entityType;this.entityType=this.options.entityType||this.scope;this.id=this.options.id;this.nameAttribute=this.getMetadata().get(`clientDefs.${this.entityType}.nameAttribute`)||"name";if(void 0!==this.options.headerText){this.headerHtml=void 0;this.headerText=this.options.headerText}this.sourceModel=this.model;this.waitForView("edit");this.getModelFactory().create(this.entityType,e=>{if(this.id){if(this.sourceModel)e=this.model=this.sourceModel.clone();else{this.model=e;e.id=this.id}e.fetch().then(()=>{this.headerText||(this.headerHtml=this.composeHeaderHtml());this.createRecordView(e)})}else{this.model=e;this.options.relate&&e.setRelate(this.options.relate);this.options.attributes&&e.set(this.options.attributes);this.headerText||(this.headerHtml=this.composeHeaderHtml());this.createRecordView(e)}});this.listenTo(this.model,"change",(e,t)=>{t.ui&&(this.wasModified=!0)})}createRecordView(i,e){var t=this.editView||this.getMetadata().get(["clientDefs",i.entityType,"recordViews","editSmall"])||this.getMetadata().get(["clientDefs",i.entityType,"recordViews","editQuick"])||"views/record/edit-small",s={model:i,fullSelector:this.containerSelector+" .edit-container",type:"editSmall",layoutName:this.layoutName||"detailSmall",buttonsDisabled:!0,sideDisabled:this.sideDisabled,bottomDisabled:this.bottomDisabled,focusForCreate:this.options.focusForCreate,recordHelper:this.options.recordHelper,webSocketDisabled:!0,exit:()=>{}};this.handleRecordViewOptions(s);this.createView("edit",t,s,e).then(e=>{this.listenTo(e,"before:save",()=>this.trigger("before:save",i));if(this.options.relate&&"link"in this.options.relate){var t=this.options.relate.link;i.hasField(t)&&["link"].includes(i.getFieldType(t))&&e.setFieldReadOnly(t)}})}handleRecordViewOptions(e){}getRecordView(){return this.getView("edit")}onBackdropClick(){this.getRecordView().isChanged||this.close()}composeHeaderHtml(){let e;if(this.id){var t=document.createElement("span"),i=document.createElement("span"),s=(i.textContent=this.getLanguage().translate(this.scope,"scopeNames"),document.createElement("span")),a=(s.classList.add("chevron-right"),this.model.attributes[this.nameAttribute]);t.append(document.createTextNode(this.getLanguage().translate("Edit")+" · "),i);a&&t.append(" ",s," ",a);e=t.outerHTML}else e=$("").text(this.getLanguage().translate("Create "+this.scope,"labels",this.scope)).get(0).outerHTML;if(!this.fullFormDisabled){i=this.id?"#"+this.scope+"/edit/"+this.id:"#"+this.scope+"/create";e=$("").attr("href",i).addClass("action").attr("title",this.translate("Full Form")).attr("data-action","fullForm").append(e).get(0).outerHTML}e=this.getHelper().getScopeColorIconHtml(this.scope)+e;return e}actionSave(){let i=0{var e=!this.id;e&&(this.id=s.id);this.trigger("after:save",s,{bypassClose:i.bypassClose});if(i.bypassClose){$(this.containerElement).find(".modal-header .modal-title-text").html(this.composeHeaderHtml());a.removeClass("disabled").removeAttr("disabled")}else{this.dialog.close();if(e){var e=`#${this.scope}/view/`+s.id,t=s.attributes[this.nameAttribute]||this.model.id,t=this.translate("Created")+"\n"+`[${t}](${e})`;Espo.Ui.notify(t,"success",4e3,{suppress:!0})}}}).catch(()=>{a.removeClass("disabled").removeAttr("disabled")})}actionSaveAndContinueEditing(){this.actionSave({bypassClose:!0})}actionFullForm(){let e,t=this.getRouter(),i,s,a;if(this.id){e=this.options.fullFormUrl||`#${this.scope}/edit/`+this.id;i=this.getRecordView().fetch();s=this.getRecordView().model;i={...i,...s.getClonedAttributes()};a={attributes:i,returnUrl:this.options.returnUrl||r.default.history.fragment,returnDispatchParams:this.options.returnDispatchParams||null,model:this.sourceModel,id:this.id};this.options.rootUrl&&(a.rootUrl=this.options.rootUrl);setTimeout(()=>{t.dispatch(this.scope,"edit",a);t.navigate(e,{trigger:!1})},10)}else{e=this.options.fullFormUrl||`#${this.scope}/create`;i=this.getRecordView().fetch();s=this.getRecordView().model;i={...i,...s.getClonedAttributes()};a={attributes:i,relate:this.options.relate,returnUrl:this.options.returnUrl||r.default.history.fragment,returnDispatchParams:this.options.returnDispatchParams||null};this.options.rootUrl&&(a.rootUrl=this.options.rootUrl);setTimeout(()=>{t.dispatch(this.scope,"create",a);t.navigate(e,{trigger:!1})},10)}this.trigger("leave");this.dialog.close()}async beforeCollapse(){if(this.wasModified){this.getRecordView().setConfirmLeaveOut(!1);this.getRouter().addWindowLeaveOutObject(this)}}afterExpand(){this.wasModified&&this.getRecordView().setConfirmLeaveOut(!0);this.getRouter().removeWindowLeaveOutObject(this)}}e.default=s});define("view-helper",["exports","marked","dompurify","handlebars"],function(e,i,s,g){Object.defineProperty(e,"__esModule",{value:!0});e.default=void 0;s=t(s);g=t(g);function t(e){return e&&e.__esModule?e:{default:e}}e.default=class{constructor(){this._registerHandlebarsHelpers();this.mdBeforeList=[{regex:/`([\s\S]*?)`/g,value:(e,t)=>"`"+t.replace(/\\\{if("style"===t.attrName){var i=t.attrValue.split(";").map(e=>e.trim()).filter(e=>{var[t,i]=e.split(":").map(e=>e.trim().toLowerCase());return"position"!==t||!["absolute","fixed","sticky"].includes(i)});t.attrValue=i.join("; ")}})}layoutManager=null;settings=null;config=null;user=null;preferences=null;acl=null;modelFactory=null;collectionFactory=null;router=null;storage=null;sessionStorage=null;dateTime=null;language=null;metadata=null;fieldManager=null;cache=null;themeManager=null;webSocketManager=null;numberUtil=null;pageTitle=null;broadcastChannel=null;basePath="";appParams=null;_registerHandlebarsHelpers(){g.default.registerHelper("img",e=>new g.default.SafeString(`img`));g.default.registerHelper("prop",(e,t)=>{if(void 0===e)console.warn("Undefined value passed to 'prop' helper.");else if(t in e)return e[t]});g.default.registerHelper("var",(e,t,i)=>{if(void 0===t)return null;let s=t[e];i.hash.trim&&(s=s.trim());return new g.default.SafeString(s)});g.default.registerHelper("concat",function(e,t){return e+t});g.default.registerHelper("ifEqual",function(e,t,i){return e==t?i.fn(this):i.inverse(this)});g.default.registerHelper("ifNotEqual",function(e,t,i){return e!=t?i.fn(this):i.inverse(this)});g.default.registerHelper("ifPropEquals",function(e,t,i,s){return e[t]==i?s.fn(this):s.inverse(this)});g.default.registerHelper("ifAttrEquals",function(e,t,i,s){return e.get(t)==i?s.fn(this):s.inverse(this)});g.default.registerHelper("ifAttrNotEmpty",function(e,t,i){var s=e.get(t);return null!=s?i.fn(this):i.inverse(this)});g.default.registerHelper("get",(e,t)=>e.get(t));g.default.registerHelper("length",e=>e.length);g.default.registerHelper("translate",(e,t)=>{var i=t.hash.scope||null,s=t.hash.category||null;return"null"===e?"":this.language.translate(e,s,i)});g.default.registerHelper("dropdownItem",(e,t)=>{var i=t.hash.scope||null,s=t.hash.label,a=t.hash.labelTranslation,r=t.hash.data,o=t.hash.hidden,n=t.hash.disabled,l=t.hash.title,d=t.hash.link,h=t.hash.action||e;let c=t.hash.iconHtml;var u=t.hash.iconClass;let m=t.hash.html||t.hash.text||(a?this.language.translatePath(a):this.language.translate(s,"labels",i));t.hash.html||(m=this.escapeString(m));if(c)m=c+" "+m;else if(u){let e=$("").addClass(u).get(0).outerHTML;m=e+" "+m}var a=$("
  • ").addClass(o?"hidden":"").addClass(n?"disabled":""),p=$("").attr("role","button").attr("tabindex","0").attr("data-name",e).addClass(t.hash.className||"").addClass("action").html(m);h&&p.attr("data-action",h);a.append(p);d?p.attr("href",d):p.attr("role","button");if(r)for(var f in r)p.attr("data-"+Espo.Utils.camelCaseToHyphen(f),r[f]);n&&a.attr("disabled","disabled");l&&p.attr("title",l);return new g.default.SafeString(a.get(0).outerHTML)});g.default.registerHelper("button",(e,t)=>{var i=t.hash.style||"default",s=t.hash.scope||null,a=t.hash.label||e,r=t.hash.labelTranslation,o=t.hash.link;let n=t.hash.iconHtml;var l=t.hash.iconClass;let d=t.hash.html||t.hash.text||(r?this.language.translatePath(r):this.language.translate(a,"labels",s));t.hash.html||(d=this.escapeString(d));if(n)d=n+" "+d+"";else if(l){let e=$("").addClass(l).get(0).outerHTML;d=e+" "+d+""}r=o?"":" {{/each}}
  • `;disabled=!1;constructor(e){super(e);this.modeList=e.modeList;this.mode=e.mode;this.scope=e.scope;this.hiddenMap={}}data(){return{disabled:this.disabled,modeDataList:this.modeList.filter(e=>!this.hiddenMap[e]||e===this.mode).map(e=>({name:e,active:e===this.mode,label:this.translate(e,"detailViewModes",this.scope)}))}}changeMode(e){this.mode=e;return this.reRender()}async hideMode(e){this.hiddenMap[e]=!0;await this.reRender()}async showMode(e){delete this.hiddenMap[e];await this.reRender()}disable(){this.disabled=!0;return this.reRender()}enable(){this.disabled=!1;return this.reRender()}}e.default=s});define("helpers/file-upload",["exports","di","models/settings"],function(e,t,i){Object.defineProperty(e,"__esModule",{value:!0});e.default=void 0;i=(s=i,s&&s.__esModule?s:{default:s});var s;let a,r;function o(d,t,h,i,c,e){var D,P,u,m,p,s,a=Symbol.metadata||Symbol.for("Symbol.metadata"),k=Object.defineProperty,r=Object.create,F=[r(null),r(null)],o=t.length;function _(s,a,r){return function(e,t){a&&(t=e,e=d);for(var i=0;i{if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0===i)return("string"===t?String:Number)(e);i=i.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")})(i,"string"),"symbol"==typeof a?a:a+""),o,o<2?[]:e?m=m||[]:u=u||[],p,!!e,l,t,e&&l?function(e){return(e=>{if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(null!==e?typeof e:"null"));return e})(e)===d}:c)}}},s(8,0),s(0,0),s(8,1),s(0,1),r(u),r(m),P=p,o||n(d),{e:P,get c(){var e=[];return o&&[n(d=f(d,[t],i,d.name,5,e)),_(e,1)]}}}function I(e,t,i){"symbol"==typeof t&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch(e){}return e}class n{static#_=[a,r]=o(this,[],[[(0,t.inject)(i.default),0,"config"]]).e;constructor(){r(this)}config=a(this);upload(s,a,e){e=e||{};e.afterChunkUpload=e.afterChunkUpload||(()=>{});e.afterAttachmentSave=e.afterAttachmentSave||(()=>{});e.mediator=e.mediator||{};a.set("name",s.name);a.set("type",s.type||"text/plain");a.set("size",s.size);return this._useChunks(s)?this._uploadByChunks(s,a,e):new Promise((t,i)=>{var e=new FileReader;e.onload=e=>{a.set("file",e.target.result);a.save({},{timeout:0}).then(()=>t()).catch(()=>i())};e.readAsDataURL(s)})}_uploadByChunks(i,s,a){return new Promise((e,t)=>{s.set("isBeingUploaded",!0);s.save().then(()=>{a.afterAttachmentSave(s);return this._uploadChunks(i,s,e,t,a)}).catch(()=>t())})}_uploadChunks(t,i,s,a,r,e){e=e||0;let o=e+this._getChunkSize()+1;o>t.size&&(o=t.size);if(r.mediator.isCanceled)a();else{var n=t.slice(e,o),l=new FileReader;l.onloadend=e=>{e.target.readyState===FileReader.DONE&&Espo.Ajax.postRequest("Attachment/chunk/"+i.id,e.target.result,{headers:{contentType:"multipart/form-data"}}).then(()=>{r.afterChunkUpload(o);o===t.size?s():this._uploadChunks(t,i,s,a,r,o)}).catch(()=>a())};l.readAsDataURL(n)}}_useChunks(e){var t=this._getChunkSize();return!!t&&e.size>t}_getChunkSize(){return 1024*(this.config.get("attachmentUploadChunkSize")||0)*1024}}e.default=n});define("helpers/record/select-related",["exports","di","metadata"],function(e,t,i){Object.defineProperty(e,"__esModule",{value:!0});e.default=void 0;i=(s=i,s&&s.__esModule?s:{default:s});var s;let a,r;function o(d,t,h,i,c,e){var D,P,u,m,p,s,a=Symbol.metadata||Symbol.for("Symbol.metadata"),k=Object.defineProperty,r=Object.create,F=[r(null),r(null)],o=t.length;function _(s,a,r){return function(e,t){a&&(t=e,e=d);for(var i=0;i{if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0===i)return("string"===t?String:Number)(e);i=i.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")})(i,"string"),"symbol"==typeof a?a:a+""),o,o<2?[]:e?m=m||[]:u=u||[],p,!!e,l,t,e&&l?function(e){return(e=>{if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(null!==e?typeof e:"null"));return e})(e)===d}:c)}}},s(8,0),s(0,0),s(8,1),s(0,1),r(u),r(m),P=p,o||n(d),{e:P,get c(){var e=[];return o&&[n(d=f(d,[t],i,d.name,5,e)),_(e,1)]}}}function I(e,t,i){"symbol"==typeof t&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch(e){}return e}class n{static#_=[a,r]=o(this,[],[[(0,t.inject)(i.default),0,"metadata"]]).e;metadata=a(this);constructor(e){r(this);this.view=e}process(r,o){let n=2{a?Espo.loader.requirePromise(a).then(e=>new e(this.view.getHelper())).then(e=>{e.getFilters(r).then(e=>t(e))}):t({})}).then(e=>{c={...c,...e.advanced||{}};(m||e.bool)&&(m=[...m||[],...e.bool||[]]);e.primary&&!u&&(u=e.primary);var t=e.orderBy||d.selectOrderBy,i=e.orderBy?e.order:d.selectOrderDirection,s=!0===n.hasCreate&&void 0!==n.onCreate;let a;this.view.createView("dialogSelectRelated",p,{scope:l,multiple:!0,filters:c,massRelateEnabled:h,primaryFilterName:u,boolFilterList:m,mandatorySelectAttributeList:d.selectMandatoryAttributeList,layoutName:d.selectLayout,orderBy:t,orderDirection:i,createButton:s,onCreate:()=>{a.close();n.onCreate&&n.onCreate()}},e=>{a=e;e.render();Espo.Ui.notify(!1);this.view.listenToOnce(e,"select",e=>{var i={};if("[object Array]"===Object.prototype.toString.call(e)){let t=[];e.forEach(e=>t.push(e.id));i.ids=t}else if(e.massRelate){i.massRelate=!0;i.where=e.where;i.searchParams=e.searchParams}else i.id=e.id;var t=r.entityType+`/${r.id}/`+o;Espo.Ajax.postRequest(t,i).then(()=>{Espo.Ui.success(this.view.translate("Linked"));r.trigger("update-related:"+o);r.trigger("after:relate");r.trigger("after:relate:"+o)})})})})}}e.default=n});define("helpers/record/create-related",["exports","di","metadata","helpers/record-modal"],function(e,t,i,l){Object.defineProperty(e,"__esModule",{value:!0});e.default=void 0;i=r(i);l=r(l);let s,a;function r(e){return e&&e.__esModule?e:{default:e}}function o(d,t,h,i,c,e){var D,P,u,m,p,s,a=Symbol.metadata||Symbol.for("Symbol.metadata"),k=Object.defineProperty,r=Object.create,F=[r(null),r(null)],o=t.length;function _(s,a,r){return function(e,t){a&&(t=e,e=d);for(var i=0;i{if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0===i)return("string"===t?String:Number)(e);i=i.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")})(i,"string"),"symbol"==typeof a?a:a+""),o,o<2?[]:e?m=m||[]:u=u||[],p,!!e,l,t,e&&l?function(e){return(e=>{if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(null!==e?typeof e:"null"));return e})(e)===d}:c)}}},s(8,0),s(0,0),s(8,1),s(0,1),r(u),r(m),P=p,o||n(d),{e:P,get c(){var e=[];return o&&[n(d=f(d,[t],i,d.name,5,e)),_(e,1)]}}}function I(e,t,i){"symbol"==typeof t&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch(e){}return e}class n{static#_=[s,a]=o(this,[],[[(0,t.inject)(i.default),0,"metadata"]]).e;metadata=s(this);constructor(e){a(this);this.view=e}async process(t,i){let s=2n[o[e]]=t.get(e));if(r){r=await Espo.loader.requirePromise(r),r=new r(this.view.getHelper()),r=await r.getAttributes(t,i);n={...n,...r}}r=new l.default;await r.showCreate(this.view,{entityType:e,relate:{model:t,link:a},attributes:n,afterSave:e=>{s.afterSave&&s.afterSave(e);t.trigger("update-related:"+i);t.trigger("after:relate");t.trigger("after:relate:"+i)}})}}e.default=n});define("helpers/misc/stored-text-search",["exports"],function(e){Object.defineProperty(e,"__esModule",{value:!0});e.default=void 0;e.default=class{constructor(e,t,i){this.scope=e;this.storage=t;this.key="textSearches";this.maxCount=i||100;this.list=null}match(e,t){e=e.toLowerCase().trim();var i,s=this.get(),a=[];for(i of s){i.toLowerCase().startsWith(e)&&a.push(i);if(void 0!==t&&a.length===t)break}return a}get(){null===this.list&&(this.list=this.getFromStorage());return this.list}getFromStorage(){return this.storage.get(this.key,this.scope)||[]}store(e){e=e.trim();let t=this.getFromStorage();var i=t.indexOf(e);-1!==i&&t.splice(i,1);t.unshift(e);t.length>this.maxCount&&(t=t.slice(0,this.maxCount));this.list=t;this.storage.set(this.key,this.scope,t)}remove(e){e=e.trim();var t=this.getFromStorage(),i=t.indexOf(e);if(-1!==i){t.splice(i,1);this.list=t;this.storage.set(this.key,this.scope,t)}}}});define("helpers/misc/foreign-field",["exports"],function(e){Object.defineProperty(e,"__esModule",{value:!0});e.default=void 0;e.default=class{entityType;constructor(e){this.view=e;var t=e.getMetadata(),i=e.model,s=e.params.field,a=e.params.link,a=t.get(["entityDefs",i.entityType,"links",a,"entity"])||i.entityType;this.entityType=a;let r=t.get(["entityDefs",a,"fields",s])||{};i=r.type;let o=["default","audited","readOnly","required"];this.foreignParams={};e.getFieldManager().getParamList(i).forEach(e=>{var t=e.name;o.includes(t)||(this.foreignParams[t]=r[t]||null)})}getForeignParams(){return Espo.Utils.cloneDeep(this.foreignParams)}getEntityType(){return this.entityType}}});define("helpers/misc/attachment-insert-from-source",["exports","di","metadata","model-factory"],function(e,t,i,s){Object.defineProperty(e,"__esModule",{value:!0});e.default=void 0;i=l(i);s=l(s);let a,r,o,n;function l(e){return e&&e.__esModule?e:{default:e}}function d(d,t,h,i,c,e){var D,P,u,m,p,s,a=Symbol.metadata||Symbol.for("Symbol.metadata"),k=Object.defineProperty,r=Object.create,F=[r(null),r(null)],o=t.length;function _(s,a,r){return function(e,t){a&&(t=e,e=d);for(var i=0;i{if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0===i)return("string"===t?String:Number)(e);i=i.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")})(i,"string"),"symbol"==typeof a?a:a+""),o,o<2?[]:e?m=m||[]:u=u||[],p,!!e,l,t,e&&l?function(e){return(e=>{if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(null!==e?typeof e:"null"));return e})(e)===d}:c)}}},s(8,0),s(0,0),s(8,1),s(0,1),r(u),r(m),P=p,o||n(d),{e:P,get c(){var e=[];return o&&[n(d=f(d,[t],i,d.name,5,e)),_(e,1)]}}}function I(e,t,i){"symbol"==typeof t&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch(e){}return e}class h{static#_=[a,r,o,n]=d(this,[],[[(0,t.inject)(i.default),0,"metadata"],[(0,t.inject)(s.default),0,"modelFactory"]]).e;constructor(e){n(this);this.view=e;this.model=e.model}metadata=a(this);modelFactory=(r(this),o(this));insert(r){let o=r.source;var e=this.metadata.get(["clientDefs","Attachment","sourceDefs",o,"insertModalView"])||this.metadata.get(["clientDefs",o,"modalViews","select"])||"views/modals/select-records";let t={};"getSelectFilters"+o in this.view&&(t=this.view["getSelectFilters"+o]()||{});this.model.attributes.parentId&&"Account"===this.model.attributes.parentType&&"link"===this.metadata.get(`entityDefs.${o}.fields.account.type`)&&"Account"===this.metadata.get(`entityDefs.${o}.links.account.entity`)&&(t={account:{type:"equals",attribute:"accountId",value:this.model.attributes.parentId,data:{type:"is",idValue:this.model.attributes.parentId,nameValue:this.model.attributes.parentType}},...t});let i=this.metadata.get(`clientDefs.Attachment.sourceDefs.${o}.boolFilterList`),s=("getSelectBoolFilterList"+o in this.view&&(i=this.view["getSelectBoolFilterList"+o]()),this.metadata.get(`clientDefs.Attachment.sourceDefs.${o}.primaryFilter`));"getSelectPrimaryFilterName"+o in this.view&&(s=this.view["getSelectPrimaryFilterName"+o]());var a={entityType:o,createButton:!1,filters:t,boolFilterList:i,primaryFilterName:s,multiple:!0,onSelect:e=>{e.forEach(async e=>{if("Attachment"===e.entityType)r.onInsert([e]);else{var t,i=await Espo.Ajax.postRequest(o+"/action/getAttachmentList",{id:e.id,field:this.view.name,parentType:this.view.entityType}),s=await this.modelFactory.create("Attachment");for(t of i){var a=s.clone();a.set(t);r.onInsert([a])}}})}};Espo.Ui.notifyWait();this.view.createView("modal",e,a,e=>{e.render();Espo.Ui.notify()})}}e.default=h});define("ui",["exports","marked","dompurify","jquery"],function(e,l,d,m){Object.defineProperty(e,"__esModule",{value:!0});e.default=void 0;d=t(d);m=t(m);function t(e){return e&&e.__esModule?e:{default:e}}let i=[];class c{height;fitHeight;onRemove;onClose;onBackdropClick;buttons;screenWidthXs;backdropClassName;maximizeButton=!1;maximizeButtonElement;minimizeButtonElement;onMaximize;onMinimize;constructor(a){a=a||{};this.className="dialog-confirm";this.backdrop="static";this.closeButton=!0;this.collapseButton=!1;this.header=null;this.body="";this.width=null;this.buttonList=[];this.dropdownItemList=[];this.removeOnClose=!0;this.draggable=!1;this.container="body";this.options=a;this.keyboard=!0;this.activeElement=document.activeElement;["className","backdrop","keyboard","closeButton","collapseButton","header","body","width","height","fitHeight","buttons","buttonList","dropdownItemList","removeOnClose","draggable","container","onRemove","onClose","onBackdropClick","maximizeButton","backdropClassName"].forEach(e=>{e in a&&(this[e]=a[e])});a.onMaximize&&(this.onMaximize=a.onMaximize);a.onMinimize&&(this.onMinimize=a.onMinimize);this.onCloseIsCalled=!1;this.buttons&&this.buttons.length&&(this.buttonList=this.buttons);this.id="dialog-"+Math.floor(1e5*Math.random());void 0===this.backdrop&&(this.backdrop="static");var e=this.getHeader(),t=this.getFooter(),i=(0,m.default)("
    ").addClass("modal-body body").html(this.body),s=(0,m.default)("
    ").addClass("modal-content");e&&s.append(e);t&&this.options.footerAtTheTop&&s.append(t);s.append(i);t&&!this.options.footerAtTheTop&&s.append(t);e=(0,m.default)("
    ").addClass("modal-dialog").append(s),i=(0,m.default)(this.container);(0,m.default)("
    ").attr("id",this.id).attr("class",this.className+" modal").attr("role","dialog").attr("tabindex","-1").append(e).appendTo(i);this.$el=(0,m.default)("#"+this.id);this.el=this.$el.get(0);this.$el.find("header a.close").on("click",()=>{});this.initButtonEvents();if(this.draggable){this.$el.find("header").css("cursor","pointer");this.$el.draggable({handle:"header"})}t=this.$el.find(".modal-content");if(this.width){t.css("width",this.width);t.css("margin-left","-"+parseInt(this.width.replace("px",""))/5+"px")}this.removeOnClose&&this.$el.on("hidden.bs.modal",e=>{if(this.$el.get(0)===e.target){this.onCloseIsCalled||this.close();this.skipRemove||this.remove()}});let r=(0,m.default)(window),o=(this.$el.on("shown.bs.modal",()=>{(0,m.default)(".modal-backdrop").not(".stacked").addClass("stacked");var e=this.$el.find(".modal-header").outerHeight()||0,t=this.$el.find(".modal-footer").outerHeight()||0;let s=e+t;a.fullHeight||(s+=a.bodyDiffHeight);if(this.fitHeight||a.fullHeight){e=()=>{var e=window.innerHeight,t=r.width();if(!a.fullHeight&&e<512)this.$el.find("div.modal-body").css({maxHeight:"none",overflow:"auto",height:"none"});else{var i={overflow:"auto"};if(a.fullHeight){i.height=e-s+"px";this.$el.css("paddingRight",0)}else t<=a.screenWidthXs?i.maxHeight="none":i.maxHeight=e-s+"px";this.$el.find("div.modal-body").css(i)}};r.off("resize.modal-height");r.on("resize.modal-height",e);e()}}),(0,m.default)(document.body));this.$el.on("hidden.bs.modal",()=>{0<(0,m.default)(".modal:visible").length&&o.addClass("modal-open")})}getElement(){return this.el}setHeaderText(e){var t=this.el.querySelector(".modal-header .modal-title");t&&(t.textContent=e)}callOnClose(){this.onClose&&this.onClose()}callOnBackdropClick(){this.onBackdropClick&&this.onBackdropClick()}callOnRemove(){this.onRemove&&this.onRemove()}setActionItems(e,t){this.buttonList=e;this.dropdownItemList=t}initButtonEvents(){this.buttonList.forEach(t=>{if("function"==typeof t.onClick){var e=(0,m.default)("#"+this.id+' .modal-footer button[data-name="'+t.name+'"]');e.on("click",e=>t.onClick(this,e))}});this.dropdownItemList.forEach(t=>{if(!1!==t&&"function"==typeof t.onClick){var e=(0,m.default)("#"+this.id+' .modal-footer a[data-name="'+t.name+'"]');e.on("click",e=>t.onClick(this,e))}})}getHeader(){if(!this.header)return null;var e=(0,m.default)("
    ").addClass("modal-header").addClass(this.options.fixedHeaderHeight?"fixed-height":"").append((0,m.default)("

    ").addClass("modal-title").append((0,m.default)("").addClass("modal-title-text").html(this.header)));this.collapseButton&&e.prepend((0,m.default)("").addClass("collapse-button").attr("role","button").attr("tabindex","-1").attr("data-action","collapseModal").append((0,m.default)("").addClass("fas fa-minus")));if(this.maximizeButton){var t=document.createElement("a");t.classList.add("maximize-button");t.role="button";t.tabIndex=-1;t.setAttribute("data-action","maximizeModal");var i=document.createElement("span");i.classList.add("far","fa-window-maximize");t.append(i);e.prepend(t);this.maximizeButtonElement=t;t.addEventListener("click",()=>{this.maximizeButtonElement.classList.add("hidden");this.minimizeButtonElement.classList.remove("hidden");this.el.querySelector(".modal-dialog").classList.add("maximized");this.onMaximize&&this.onMaximize();this.getElement().focus()});i=document.createElement("a");i.classList.add("minimize-button","hidden");i.role="button";i.tabIndex=-1;i.setAttribute("data-action","minimizeModal");t=document.createElement("span");t.classList.add("far","fa-window-minimize");i.append(t);e.prepend(i);this.minimizeButtonElement=i;i.addEventListener("click",()=>{this.minimizeButtonElement.classList.add("hidden");this.maximizeButtonElement.classList.remove("hidden");this.el.querySelector(".modal-dialog").classList.remove("maximized");this.onMinimize&&this.onMinimize();this.getElement().focus()})}this.closeButton&&e.prepend((0,m.default)("").addClass("close").attr("data-dismiss","modal").attr("role","button").attr("tabindex","-1").append((0,m.default)("").attr("aria-hidden","true").html("×")));return e}getFooter(){if(!this.buttonList.length&&!this.dropdownItemList.length)return null;var e=(0,m.default)("