var __awaiter=this&&this.__awaiter||function(e,t,n,o){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,r){function l(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o["throw"](e))}catch(e){r(e)}}function c(e){e.done?n(e.value):i(e.value).then(l,a)}c((o=o.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},o,i,r,l;return l={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(l[Symbol.iterator]=function(){return this}),l;function a(e){return function(t){return c([e,t])}}function c(l){if(o)throw new TypeError("Generator is already executing.");while(n)try{if(o=1,i&&(r=l[0]&2?i["return"]:l[0]?i["throw"]||((r=i["return"])&&r.call(i),0):i.next)&&!(r=r.call(i,l[1])).done)return r;if(i=0,r)l=[l[0]&2,r.value];switch(l[0]){case 0:case 1:r=l;break;case 4:n.label++;return{value:l[1],done:false};case 5:n.label++;i=l[1];l=[0];continue;case 7:l=n.ops.pop();n.trys.pop();continue;default:if(!(r=n.trys,r=r.length>0&&r[r.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!r||l[1]>r[0]&&l[1]<r[3])){n.label=l[1];break}if(l[0]===6&&n.label<r[1]){n.label=r[1];r=l;break}if(r&&n.label<r[2]){n.label=r[2];n.ops.push(l);break}if(r[2])n.ops.pop();n.trys.pop();continue}l=t.call(e,n)}catch(e){l=[6,e];i=0}finally{o=r=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:true}}};System.register(["./p-5e377a26.system.js"],(function(e){"use strict";var t,n,o,i,r;return{setters:[function(e){t=e.r;n=e.c;o=e.h;i=e.H;r=e.g}],execute:function(){var l="dvn-field-input-cell-rich-content{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;height:100%}dvn-field-input-cell-rich-content .form-footer{padding:calc(2 * var(--spacing-unit));background-color:var(--color-background-secondary)}";var a=e("dvn_field_input_cell_rich_content",function(){function e(e){t(this,e);this.cellFormCancel=n(this,"cellFormCancel",7);this.cellFormSubmit=n(this,"cellFormSubmit",7);this.isConfirmationDialogShown=false}e.prototype.focus=function(){return __awaiter(this,void 0,void 0,(function(){var e,t;return __generator(this,(function(n){(t=(e=this.el.querySelector("dvn-input"))===null||e===void 0?void 0:e.focus)===null||t===void 0?void 0:t.call(e);return[2]}))}))};e.prototype.render=function(){var e=this;var t=this,n=t.field,r=t.value;var l=r||{version:"0.0.1",content:[{type:"text",id:"form-content",value:{placeholder:n.placeholder,text:""}}]};return o(i,null,o("dvn-side-modal",{shown:true,onDismiss:function(){var t,n;if(JSON.stringify((t=e.value)===null||t===void 0?void 0:t.content)!==JSON.stringify((n=e.internalValue)===null||n===void 0?void 0:n.content)){e.isConfirmationDialogShown=true}else{e.cellFormCancel.emit()}}},o("div",{class:"flex-grow-1 d-flex flex-column mt-3"},o("div",{class:"flex-grow-1"},o("dvn-rich-editor",{key:"editor",onChange:function(t){t.stopImmediatePropagation();var n=t.detail;e.internalValue={version:"0.0.1",content:n}},editorSettings:n.settings||c,value:l.content})),o("div",{class:"form-footer"},o("dvn-button",{leaned:true,onClick:function(t){t.stopImmediatePropagation();e.cellFormSubmit.emit({value:e.internalValue});e.cellFormCancel.emit()}},"Save")))),o("dvn-dialog",{shown:this.isConfirmationDialogShown,title:"You have unsaved changes"},"You're going to loose the changes if you don't save.",o("div",{slot:"actions"},o("dvn-button",{tint:"danger",view:"flat",onClick:function(t){t.stopImmediatePropagation();e.cellFormCancel.emit()}},"Discard Changes"),o("dvn-button",{view:"flat",onClick:function(){return e.isConfirmationDialogShown=false}},"Cancel"))))};Object.defineProperty(e.prototype,"el",{get:function(){return r(this)},enumerable:false,configurable:true});return e}());var c={enableDrag:false,enableBlockCreation:false,enableBlockDeletion:false,hideDragControls:true,blockTypes:[],blockSettings:{text:{textSelectionOptions:["bold","link"]}}};a.style=l}}}));