!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/forms")):"function"==typeof define&&define.amd?define("@postfinance/ngx-ace-editor-wrapper",["exports","@angular/core","@angular/forms"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).postfinance=t.postfinance||{},t.postfinance["ngx-ace-editor-wrapper"]={}),t.ng.core,t.ng.forms)}(this,(function(t,e,o){"use strict";var n=function(){function t(t,o){var n=this;this.zone=o,this.style={},this.textChanged=new e.EventEmitter,this.textChange=new e.EventEmitter,this._options={},this._readOnly=!1,this._theme="",this._mode="html",this._autoUpdateContent=!0,this._durationBeforeCallback=0,this._text="",this._onChange=function(t){};var i=t.nativeElement;this.zone.runOutsideAngular((function(){n.editor=ace.edit(i)})),this.editor.$blockScrolling=1/0}return Object.defineProperty(t.prototype,"options",{set:function(t){this.setOptions(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"readOnly",{set:function(t){this.setReadOnly(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"theme",{set:function(t){this.setTheme(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mode",{set:function(t){this.setMode(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"autoUpdateContent",{set:function(t){this.setAutoUpdateContent(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"durationBeforeCallback",{set:function(t){this.setDurationBeforeCallback(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"text",{get:function(){return this._text},set:function(t){this.setText(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this.text},set:function(t){this.setText(t)},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){this.init(),this.initEvents()},t.prototype.ngOnDestroy=function(){this.editor.destroy()},t.prototype.init=function(){this.setOptions(this._options||{}),this.setTheme(this._theme),this.setMode(this._mode),this.setReadOnly(this._readOnly)},t.prototype.initEvents=function(){var t=this;this.editor.on("change",(function(){return t.updateText()})),this.editor.on("paste",(function(){return t.updateText()}))},t.prototype.updateText=function(){var t=this,e=this.editor.getValue();e!==this.oldText&&(this._durationBeforeCallback?(this.timeoutSaving&&clearTimeout(this.timeoutSaving),this.timeoutSaving=setTimeout((function(){t._text=e,t.zone.run((function(){t.textChange.emit(e),t.textChanged.emit(e)})),t.timeoutSaving=null}),this._durationBeforeCallback)):(this._text=e,this.zone.run((function(){t.textChange.emit(e),t.textChanged.emit(e)})),this._onChange(e)),this.oldText=e)},t.prototype.setOptions=function(t){this._options=t,this.editor.setOptions(t||{})},t.prototype.setReadOnly=function(t){this._readOnly=t,this.editor.setReadOnly(t)},t.prototype.setTheme=function(t){this._theme=t,this.editor.setTheme("ace/theme/"+t)},t.prototype.setMode=function(t){this._mode=t,"object"==typeof this._mode?this.editor.getSession().setMode(this._mode):this.editor.getSession().setMode("ace/mode/"+this._mode)},t.prototype.writeValue=function(t){this.setText(t)},t.prototype.registerOnChange=function(t){this._onChange=t},t.prototype.registerOnTouched=function(t){},t.prototype.setText=function(t){null==t&&(t=""),this._text!==t&&!0===this._autoUpdateContent&&(this._text=t,this.editor.setValue(t),this._onChange(t),this.editor.clearSelection())},t.prototype.setAutoUpdateContent=function(t){this._autoUpdateContent=t},t.prototype.setDurationBeforeCallback=function(t){this._durationBeforeCallback=t},t.prototype.getEditor=function(){return this.editor},t}();n.decorators=[{type:e.Component,args:[{selector:"ngx-ace-editor",template:"",providers:[{provide:o.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return n})),multi:!0}],styles:[":host { display: block; width: 100%; }"]}]}],n.ctorParameters=function(){return[{type:e.ElementRef},{type:e.NgZone}]},n.propDecorators={style:[{type:e.Input}],textChanged:[{type:e.Output}],textChange:[{type:e.Output}],options:[{type:e.Input}],readOnly:[{type:e.Input}],theme:[{type:e.Input}],mode:[{type:e.Input}],autoUpdateContent:[{type:e.Input}],durationBeforeCallback:[{type:e.Input}],text:[{type:e.Input}],value:[{type:e.Input}]};var i=function(){function t(t,o){var n=this;this.zone=o,this.textChanged=new e.EventEmitter,this.textChange=new e.EventEmitter,this._options={},this._readOnly=!1,this._theme="",this._mode="html",this._autoUpdateContent=!0,this._durationBeforeCallback=0,this._text="";var i=t.nativeElement;this.zone.runOutsideAngular((function(){n.editor=ace.edit(i)})),this.editor.$blockScrolling=1/0}return Object.defineProperty(t.prototype,"options",{set:function(t){this._options=t,this.editor.setOptions(t||{})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"readOnly",{set:function(t){this._readOnly=t,this.editor.setReadOnly(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"theme",{set:function(t){this.setTheme(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mode",{set:function(t){this.setMode(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"autoUpdateContent",{set:function(t){this._autoUpdateContent=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"durationBeforeCallback",{set:function(t){this.setDurationBeforeCallback(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"text",{get:function(){return this._text},set:function(t){this.setText(t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"aceEditor",{get:function(){return this.editor},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){this.init(),this.initEvents()},t.prototype.ngOnDestroy=function(){this.editor.destroy()},t.prototype.init=function(){this.editor.setOptions(this._options||{}),this.setTheme(this._theme),this.setMode(this._mode),this.editor.setReadOnly(this._readOnly)},t.prototype.initEvents=function(){var t=this;this.editor.on("change",(function(){return t.updateText()})),this.editor.on("paste",(function(){return t.updateText()}))},t.prototype.updateText=function(){var t=this,e=this.editor.getValue();e!==this.oldText&&(this._durationBeforeCallback?(null!=this.timeoutSaving&&clearTimeout(this.timeoutSaving),this.timeoutSaving=setTimeout((function(){t._text=e,t.zone.run((function(){t.textChange.emit(e),t.textChanged.emit(e)})),t.timeoutSaving=null}),this._durationBeforeCallback)):(this._text=e,this.zone.run((function(){t.textChange.emit(e),t.textChanged.emit(e)}))),this.oldText=e)},t.prototype.setTheme=function(t){this._theme=t,this.editor.setTheme("ace/theme/"+t)},t.prototype.setMode=function(t){this._mode=t,"object"==typeof this._mode?this.editor.getSession().setMode(this._mode):this.editor.getSession().setMode("ace/mode/"+this._mode)},t.prototype.setText=function(t){this._text!==t&&(null==t&&(t=""),!0===this._autoUpdateContent&&(this._text=t,this.editor.setValue(t),this.editor.clearSelection()))},t.prototype.setDurationBeforeCallback=function(t){this._durationBeforeCallback=t},t}();i.decorators=[{type:e.Directive,args:[{selector:"[ngxAceEditor]"}]}],i.ctorParameters=function(){return[{type:e.ElementRef},{type:e.NgZone}]},i.propDecorators={textChanged:[{type:e.Output}],textChange:[{type:e.Output}],options:[{type:e.Input}],readOnly:[{type:e.Input}],theme:[{type:e.Input}],mode:[{type:e.Input}],autoUpdateContent:[{type:e.Input}],durationBeforeCallback:[{type:e.Input}],text:[{type:e.Input}]};Object.create;function r(t,e){var o="function"==typeof Symbol&&t[Symbol.iterator];if(!o)return t;var n,i,r=o.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(n=r.next()).done;)s.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(o=r.return)&&o.call(r)}finally{if(i)throw i.error}}return s}Object.create;var s=[n,i],a=function(){};a.decorators=[{type:e.NgModule,args:[{declarations:function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(r(arguments[e]));return t}(s),exports:s}]}],t.AceEditorComponent=n,t.AceEditorDirective=i,t.AceEditorModule=a,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=postfinance-ngx-ace-editor-wrapper.umd.min.js.map