pacem 0.40.1 → 0.40.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/css/pacem-dark-content.min.css +2 -2
  2. package/dist/css/pacem-dark-shell.min.css +2 -2
  3. package/dist/css/pacem-dark.min.css +2 -2
  4. package/dist/css/pacem-light-content.min.css +2 -2
  5. package/dist/css/pacem-light-shell.min.css +2 -2
  6. package/dist/css/pacem-light.min.css +2 -2
  7. package/dist/css/pacem-phousys-content.min.css +2 -2
  8. package/dist/css/pacem-phousys-shell.min.css +2 -2
  9. package/dist/css/pacem-phousys.min.css +2 -2
  10. package/dist/js/azure-maps.d.ts +2 -2
  11. package/dist/js/pacem-2d.d.ts +2 -2
  12. package/dist/js/pacem-2d.js +2 -2
  13. package/dist/js/pacem-2d.min.js +2 -2
  14. package/dist/js/pacem-3d.d.ts +2 -2
  15. package/dist/js/pacem-3d.js +2 -2
  16. package/dist/js/pacem-3d.min.js +2 -2
  17. package/dist/js/pacem-charts.d.ts +2 -2
  18. package/dist/js/pacem-charts.js +2 -2
  19. package/dist/js/pacem-charts.min.js +2 -2
  20. package/dist/js/pacem-cms.d.ts +2 -2
  21. package/dist/js/pacem-cms.js +2 -2
  22. package/dist/js/pacem-cms.min.js +2 -2
  23. package/dist/js/pacem-core.d.ts +2 -2
  24. package/dist/js/pacem-core.js +2 -2
  25. package/dist/js/pacem-core.min.js +2 -2
  26. package/dist/js/pacem-foundation.d.ts +2 -2
  27. package/dist/js/pacem-foundation.js +2 -2
  28. package/dist/js/pacem-foundation.min.js +2 -2
  29. package/dist/js/pacem-fx.d.ts +2 -2
  30. package/dist/js/pacem-fx.js +2 -2
  31. package/dist/js/pacem-fx.min.js +2 -2
  32. package/dist/js/pacem-logging.d.ts +2 -2
  33. package/dist/js/pacem-logging.js +2 -2
  34. package/dist/js/pacem-logging.min.js +2 -2
  35. package/dist/js/pacem-maps.d.ts +2 -2
  36. package/dist/js/pacem-maps.js +2 -2
  37. package/dist/js/pacem-maps.min.js +2 -2
  38. package/dist/js/pacem-media.d.ts +2 -2
  39. package/dist/js/pacem-media.js +2 -2
  40. package/dist/js/pacem-media.min.js +2 -2
  41. package/dist/js/pacem-networking.js +2 -2
  42. package/dist/js/pacem-networking.min.js +2 -2
  43. package/dist/js/pacem-numerical.d.ts +2 -2
  44. package/dist/js/pacem-numerical.js +2 -2
  45. package/dist/js/pacem-numerical.min.js +2 -2
  46. package/dist/js/pacem-plus.d.ts +2 -2
  47. package/dist/js/pacem-plus.js +2 -2
  48. package/dist/js/pacem-plus.min.js +2 -2
  49. package/dist/js/pacem-scaffolding.d.ts +2 -2
  50. package/dist/js/pacem-scaffolding.js +2 -2
  51. package/dist/js/pacem-scaffolding.min.js +2 -2
  52. package/dist/js/pacem-ui.d.ts +2 -2
  53. package/dist/js/pacem-ui.js +2 -2
  54. package/dist/js/pacem-ui.min.js +2 -2
  55. package/dist/js/swagger-types.d.ts +2 -2
  56. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
1
  /**
2
- * pacem v0.40.1 (https://js.pacem.it)
2
+ * pacem v0.40.2 (https://js.pacem.it)
3
3
  * Copyright 2023 Pacem (https://pacem.it)
4
- * Licensed under MIT
4
+ * Licensed under SEE LICENSE IN LICENSE
5
5
  */
6
6
  var Pacem,__decorate=this&&this.__decorate||function(e,t,a,i){var n,s=arguments.length,r=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,a):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,a,i);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(r=(s<3?n(r):s>3?n(t,a,r):n(t,a))||r);return s>3&&r&&Object.defineProperty(t,a,r),r},__classPrivateFieldGet=this&&this.__classPrivateFieldGet||function(e,t,a,i){if("a"===a&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===a?i:"a"===a?i.call(e):i?i.value:t.get(e)},__classPrivateFieldSet=this&&this.__classPrivateFieldSet||function(e,t,a,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(e,a):n?n.value=a:t.set(e,a),a},__awaiter=this&&this.__awaiter||function(e,t,a,i){return new(a||(a=Promise))((function(n,s){function r(e){try{l(i.next(e))}catch(e){s(e)}}function o(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(r,o)}l((i=i.apply(e,t||[])).next())}))};!function(e){!function(t){!function(a){var i;const n="pacem:model:original-value";class PacemFormRelevantElement extends t.PacemElement{viewActivatedCallback(){super.viewActivatedCallback(),this.form=e.CustomElementUtils.findAncestorOfType(this,a.PacemFormElement)}}__decorate([e.Watch({converter:e.PropertyConverters.Element})],PacemFormRelevantElement.prototype,"form",void 0),a.PacemFormRelevantElement=PacemFormRelevantElement;class PacemModelElement extends PacemFormRelevantElement{viewActivatedCallback(){super.viewActivatedCallback(),this._registerFieldConditionally(),this._setAsOriginalValue(this.value)}_registerFieldConditionally(){const t=this.name,a=this.form;if(!(e.Utils.isNullOrEmpty(t)||e.Utils.isNull(a)||this.hasAttribute("autobind")&&("off"===this.getAttribute("autobind")||"false"===this.getAttribute("autobind"))||(a.registerField(t,this),this.hasAttribute("value")))){const i=a.id=a.id||"frm_"+e.Utils.uniqueCode();this.setAttribute("value",`{{ #${i}.entity.${t}, twoway }}`)}}propertyChangedCallback(t,a,i,n){switch(super.propertyChangedCallback(t,a,i,n),t){case"value":this.viewValue=this.getViewValue(i);break;case"valid":i?e.Utils.removeClass(this,e.PCSS+"-invalid"):e.Utils.addClass(this,e.PCSS+"-invalid");break;case"dirty":i?e.Utils.addClass(this,e.PCSS+"-dirty"):e.Utils.removeClass(this,e.PCSS+"-dirty");break;case"name":let t=this.form;null!=t&&a&&t.unregisterField(a),this._registerFieldConditionally();break;case"form":let n=this.name;e.Utils.isNullOrEmpty(n)||null!=a&&a.unregisterField(n),this._registerFieldConditionally()}}disconnectedCallback(){let t=this.name,a=this.form;e.Utils.isNullOrEmpty(t)||e.Utils.isNull(a)||a.unregisterField(t),super.disconnectedCallback()}get originalValue(){return e.CustomElementUtils.getAttachedPropertyValue(this,n)}_setAsOriginalValue(t){e.CustomElementUtils.setAttachedPropertyValue(this,n,t)}reset(){this.value=this.originalValue,this.dirty=!1}setPristine(){this._setAsOriginalValue(this.value),this.dirty=!1}setDirty(){this.dirty=!0}}__decorate([e.Watch({converter:e.PropertyConverters.String})],PacemModelElement.prototype,"viewValue",void 0),__decorate([e.Watch({converter:{convert:(e,t)=>t instanceof PacemModelElement?t.convertValueAttributeToProperty(e):e,convertBack:e=>e.toString()}})],PacemModelElement.prototype,"value",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Boolean})],PacemModelElement.prototype,"dirty",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Boolean})],PacemModelElement.prototype,"valid",void 0),__decorate([e.Watch({converter:e.PropertyConverters.String})],PacemModelElement.prototype,"name",void 0),a.PacemModelElement=PacemModelElement;class PacemBaseElement extends PacemModelElement{constructor(){super(...arguments),this.focusHandler=t=>{const a=(t=!0)=>{e.Utils.is(this.parentElement,"."+e.PCSS+"-fieldgroup")&&(t?e.Utils.addClass:e.Utils.removeClass).apply(this,[this.parentElement,e.PCSS+"-focus"])};switch(t.type){case"focus":e.Utils.addClass(this,e.PCSS+"-focus"),a(),this._preFocusValue=this.value;break;case"blur":e.Utils.removeClass(this,e.PCSS+"-focus"),a(!1)}t.bubbles?this.emit(t):this.dispatchEvent(new FocusEvent(t.type))},this.changeHandler=e=>{const t=this.value;this.onChange(e).then((e=>{this.compareValuePropertyValues(t,e)||(this.dispatchEvent(new Event("change")),this.dirty=!0)}),(e=>{}))},this.keydownHandler=t=>{e.stopPropagationHandler(t)},this.keyupHandler=t=>{switch(t.keyCode){case 27:e.stopPropagationHandler(t),this.compareValuePropertyValues(this.originalValue,this._preFocusValue)?this.reset():this.value=this._preFocusValue,this.blur();break;case 13:this.preventKeyboardSubmit&&e.stopPropagationHandler(t)}}}compareValuePropertyValues(t,a){return e.DefaultComparer(t,a)}get preventKeyboardSubmit(){return!1}propertyChangedCallback(t,a,i,n){switch(super.propertyChangedCallback(t,a,i,n),t){case"required":case"disabled":case"autofocus":case"placeholder":case"readonly":for(let e of this.inputFields)i?e.setAttribute(t,i):e.removeAttribute(t);break;case"tabOrder":for(let e of this.inputFields)e.setAttribute("tabindex",i);break;case"value":this.acceptValue(i)}if("required"===t||"disabled"===t||"readonly"===t){let a=`${e.PCSS}-${t}`;i?e.Utils.addClass(this,a):e.Utils.removeClass(this,a)}"readonly"===t?this.toggleReadonlyView(i):"required"===t?this.aria.attributes.set("required",!!i+""):"valid"===t&&this.aria.attributes.set("invalid",(!i&&!!this.dirty)+"")}viewActivatedCallback(){if(super.viewActivatedCallback(),this.toggleReadonlyView(this.readonly||!1),!e.Utils.isNullOrEmpty(this.id)){const e=document.querySelector(`label[for=${this.id}]`);e?e.id?this.aria.attributes.set("labelledby",e.id):this.aria.attributes.set("label",e.textContent):(this.aria.attributes.remove("labelledby"),this.aria.attributes.remove("label"))}for(let t of this.inputFields)t.addEventListener("focus",this.focusHandler,!1),t.addEventListener("blur",this.focusHandler,!1),t.addEventListener("change",this.changeHandler,!1),t.addEventListener("keydown",this.keydownHandler,!1),t.addEventListener("keyup",this.keyupHandler,!1),t.addEventListener("mousedown",e.stopPropagationHandler,!1),t.addEventListener("touchstart",e.stopPropagationHandler,{passive:!1,capture:!1})}disconnectedCallback(){for(let t of this.inputFields)e.Utils.isNull(t)||(t.removeEventListener("touchstart",e.stopPropagationHandler,{capture:!1}),t.removeEventListener("keydown",this.keydownHandler,!1),t.removeEventListener("keyup",this.keyupHandler,!1),t.removeEventListener("mousedown",e.stopPropagationHandler,!1),t.removeEventListener("change",this.changeHandler,!1),t.removeEventListener("focus",this.focusHandler,!1),t.removeEventListener("blur",this.focusHandler,!1));super.disconnectedCallback()}focus(){const e=this.inputFields;e&&e.length&&e[0].focus()}blur(){const t=this.inputFields;if(!e.Utils.isNullOrEmpty(t))for(let e of t)e.blur()}}__decorate([e.Watch({converter:e.PropertyConverters.Boolean})],PacemBaseElement.prototype,"required",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Boolean})],PacemBaseElement.prototype,"autofocus",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Boolean})],PacemBaseElement.prototype,"readonly",void 0),__decorate([e.Watch({converter:e.PropertyConverters.String})],PacemBaseElement.prototype,"name",void 0),__decorate([e.Watch({converter:e.PropertyConverters.String})],PacemBaseElement.prototype,"placeholder",void 0),a.PacemBaseElement=PacemBaseElement;class PacemItemElement extends t.PacemElement{constructor(){super(...arguments),i.set(this,void 0)}findContainer(){return e.CustomElementUtils.findAncestor(this,(e=>e instanceof PacemItemsContainerBaseElement))}get container(){return __classPrivateFieldGet(this,i,"f")}viewActivatedCallback(){super.viewActivatedCallback();const t=__classPrivateFieldSet(this,i,this.findContainer(),"f");e.Utils.isNull(t)||t.register(this)}disconnectedCallback(){e.Utils.isNull(__classPrivateFieldGet(this,i,"f"))||__classPrivateFieldGet(this,i,"f").unregister(this),super.disconnectedCallback()}}i=new WeakMap,a.PacemItemElement=PacemItemElement;class PacemItemsContainerBaseElement extends PacemBaseElement{register(t){let a=!0;return e.Utils.isNull(this.items)?this.items=[t]:-1===this.items.indexOf(t)?this.items.push(t):a=!1,a}unregister(t){const a=!e.Utils.isNull(this.items)&&this.items.indexOf(t);return a>=0&&(this.items.splice(a,1)[0],!0)}}__decorate([e.Watch()],PacemItemsContainerBaseElement.prototype,"items",void 0),a.PacemItemsContainerBaseElement=PacemItemsContainerBaseElement;let s=class PacemDataItemElement extends PacemItemElement{};__decorate([e.Watch({converter:{convert:(t,a)=>{if("true"===t)return!0;if("false"===t)return!1;let i=parseFloat(t);if(!isNaN(i))return i;let n=e.Utils.Dates.parse(t);return e.Utils.Dates.isDate(n)?n:t},convertBack:e=>e.toString()}})],s.prototype,"value",void 0),__decorate([e.Watch({converter:e.PropertyConverters.String})],s.prototype,"label",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Boolean})],s.prototype,"disabled",void 0),s=__decorate([e.CustomElement({tagName:e.P+"-data-item"})],s),a.PacemDataItemElement=s;class PacemDataSourceElement extends PacemItemsContainerBaseElement{constructor(e=!1){super(),this.multipleChoice=e,this._itemPropertyChangedHandler=e=>{this.databind()}}register(t){const a=super.register(t);return a&&t.addEventListener(e.PropertyChangeEventName,this._itemPropertyChangedHandler,!1),a}unregister(t){const a=super.register(t);return a&&t.removeEventListener(e.PropertyChangeEventName,this._itemPropertyChangedHandler,!1),a}buildAdaptedDatasource(e=this.datasource){return e&&e.map((e=>this.mapEntityToItem(e)))}databind(t=this.buildAdaptedDatasource(this.datasource)){if(e.Utils.isNull(t)&&e.Utils.isNull(this.adaptedDatasource))return;const a=this.adaptedDatasource=t||[];e.Utils.isNullOrEmpty(a.filter((e=>this.isDataSourceItemSelected(e))))&&this.handleDatasourceMismatch(a)}handleDatasourceMismatch(e){this.value=void 0}isItemSelected(t,a=this.value){if(e.Utils.isNullOrEmpty(a))return!1;const i=this.mapEntityToValue(t),n=this.compareBy;return this.multipleChoice&&e.Utils.isArray(a)?!e.Utils.isNull(a.find((t=>t==i||"object"==typeof t&&!e.Utils.isNullOrEmpty(n)&&n in i&&n in t&&i[n]==t[n]))):!this.multipleChoice&&(a==i||"object"==typeof a&&!e.Utils.isNullOrEmpty(n)&&n in i&&n in a&&i[n]==a[n])}isDataSourceItemSelected(t,a=this.value){if(e.Utils.isNullOrEmpty(a))return!1;if(t.disabled)return!1;const i=this.compareBy;if(this.multipleChoice&&e.Utils.isArray(a)){let n=a.find((a=>a==t.value||"object"==typeof a&&!e.Utils.isNullOrEmpty(i)&&i in a&&!e.Utils.isNullOrEmpty(t.value)&&i in t.value&&a[i]==t.value[i]));return!e.Utils.isNull(n)}return!this.multipleChoice&&!e.Utils.isNullOrEmpty(t.value)&&(a==t.value||"object"==typeof a&&!e.Utils.isNullOrEmpty(i)&&i in a&&!e.Utils.isNullOrEmpty(t.value)&&i in t.value&&a[i]==t.value[i])}mapEntityToValue(e){if(null==e)throw"entity cannot be null";if(e instanceof s)return e.value;let t,a=e;return(t=this.valueProperty)&&(a=e[t]),a}mapEntityToViewValue(e){if(null==e)throw"entity cannot be null";if(e instanceof s)return e.label||e.value;let t,a=e.toString();return(t=this.textProperty)&&(a=e[t]),a}mapEntityToItem(t){if(null==t)throw"entity cannot be null";if(t instanceof s)return{value:t.value,viewValue:t.label||t.value,disabled:t.disabled,data:t};let a=!1;const i=this.disabledProperty;return e.Utils.isNullOrEmpty(i)||(a=t[i]||!1),{value:this.mapEntityToValue(t),viewValue:this.mapEntityToViewValue(t),disabled:a,data:t}}propertyChangedCallback(e,t,a,i){switch(super.propertyChangedCallback(e,t,a,i),e){case"datasource":case"textProperty":case"disabledProperty":case"valueProperty":cancelAnimationFrame(this._handle),this._handle=requestAnimationFrame((()=>{this.databind(),this.viewValue=this.getViewValue(this.value)}));break;case"items":cancelAnimationFrame(this._handleItems),this._handleItems=requestAnimationFrame((()=>{this.datasource=this.items}))}}getViewValue(t){if(!e.Utils.isNullOrEmpty(this.datasource))return this.datasource.filter((e=>this.isItemSelected(e))).map((e=>this.mapEntityToViewValue(e))).join(", ")}convertValueAttributeToProperty(e){return this.multipleChoice?e.split(",").map((e=>e.trim())):e}compareValuePropertyValues(t,a){return e.DefaultComparer(t,a)}}__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Json})],PacemDataSourceElement.prototype,"datasource",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],PacemDataSourceElement.prototype,"valueProperty",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],PacemDataSourceElement.prototype,"textProperty",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],PacemDataSourceElement.prototype,"disabledProperty",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],PacemDataSourceElement.prototype,"compareBy",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Json})],PacemDataSourceElement.prototype,"adaptedDatasource",void 0),__decorate([e.Debounce(!0)],PacemDataSourceElement.prototype,"databind",null),a.PacemDataSourceElement=PacemDataSourceElement}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(a){var i;const n={convert:(t,a)=>/\{.+\}/.test(t)?e.PropertyConverters.Json.convert(t):e.PropertyConverters.String.convert(t),convertBack:(t,a)=>"string"==typeof t?t:e.PropertyConverters.Json.convertBack(t,a)};let s=class PacemCalendarMonthPickerElement extends t.PacemElement{propertyChangedCallback(t,a,i,n){if(super.propertyChangedCallback(t,a,i,n),"viewYear"===t)this.dispatchEvent(new CustomEvent("viewyearchange",{detail:new Date(i,0,1),bubbles:!1,cancelable:!1})),e.Utils.removeClass(this,"viewyear-next viewyear-previous"),requestAnimationFrame((()=>{e.Utils.addClass(this,a>i?"viewyear-previous":"viewyear-next")}))}_getMonthLabel(t){const a=(new Date).getFullYear();return new Date(a,t,1).toLocaleString(e.Utils.lang(this),{month:"short"})}_isThisMonth(e,t=this.viewYear){return this._isSelectedMonth(e,new Date,t)}_isSelectedMonth(t,a=this.month,i=this.viewYear){const n=e.Utils.parseDate(a);if(!e.Utils.Dates.isDate(n))return!1;const s=null!=i?i:(new Date).getFullYear();return n.getMonth()===t&&n.getFullYear()===s}_setMonth(e){const t=this.viewYear,a=new Date(t,e,1);this.month=a,this.dispatchEvent(new CustomEvent("monthselect",{detail:a,bubbles:!1,cancelable:!1}))}};__decorate([e.Watch({converter:e.PropertyConverters.Date})],s.prototype,"month",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Date})],s.prototype,"viewYear",void 0),s=__decorate([e.CustomElement({tagName:e.P+"-calendar-month-picker",shadow:e.Defaults.USE_SHADOW_ROOT,template:`<div class="${e.PCSS}-month-picker">${function(){let t="";for(let a=0;a<12;a++)t+=`<div class="calendar-month month-${a+1}"><${e.P}-span class="month-button text-ellipsed" on-click=":host._setMonth(${a})" css-class="{{ { 'selected-month': :host._isSelectedMonth(${a}, :host.month, :host.viewYear), 'this-month': :host._isThisMonth(${a}, :host.viewYear) } }}" text="{{ :host._getMonthLabel(${a}) }}"></${e.P}-span></div>`;return t}()}</div>`})],s),a.PacemCalendarMonthPickerElement=s;class CalendarDateUnselectEvent extends e.Components.UI.DateSelectEvent{constructor(){super(void 0)}}a.CalendarDateUnselectEvent=CalendarDateUnselectEvent;function r(e){return e-e%10}let o=class PacemCalendarYearPickerElement extends t.PacemElement{propertyChangedCallback(t,a,i,n){if(super.propertyChangedCallback(t,a,i,n),"viewYear"===t)this.dispatchEvent(new CustomEvent("viewyearchange",{detail:new Date(i,0,1),bubbles:!1,cancelable:!1})),e.Utils.removeClass(this,"viewyear-next viewyear-previous"),requestAnimationFrame((()=>{e.Utils.addClass(this,a>i?"viewyear-previous":"viewyear-next")}))}_getYearLabel(e,t=this.viewYear){return""+(r(t)+e)}_isThisYear(e,t=this.viewYear){return this._isSelectedYear(e,new Date,t)}_isSelectedYear(t,a=this.year,i=this.viewYear){const n=e.Utils.parseDate(a);if(!e.Utils.Dates.isDate(n))return!1;const s=r(i)+t;return n.getFullYear()===s}_setYear(e){const t=r(this.viewYear),a=new Date(t+e,0,1);this.year=a,this.dispatchEvent(new CustomEvent("yearselect",{detail:a,bubbles:!1,cancelable:!1}))}};__decorate([e.Watch({converter:e.PropertyConverters.Date})],o.prototype,"year",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Date})],o.prototype,"viewYear",void 0),o=__decorate([e.CustomElement({tagName:e.P+"-calendar-year-picker",shadow:e.Defaults.USE_SHADOW_ROOT,template:`<div class="${e.PCSS}-year-picker">${function(){let t="";for(let a=0;a<12;a++)t+=`<div class="calendar-year year-${a+1}"><${e.P}-span class="year-button text-ellipsed" on-click=":host._setYear(${a})" css-class="{{ { 'selected-year': :host._isSelectedYear(${a}, :host.year, :host.viewYear), 'this-year': :host._isThisYear(${a}, :host.viewYear) } }}" text="{{ :host._getYearLabel(${a}, :host.viewYear) }}"></${e.P}-span></div>`;return t}()}</div>`})],o),a.PacemCalendarYearPickerElement=o;let l=class PacemCalendarPickerElement extends a.PacemBaseElement{constructor(){super(...arguments),this.viewmode="calendar",i.set(this,!1),this._swipeHandler=e=>{switch(e.detail.direction){case"left":this._next(e);break;case"right":this._prev(e)}},this._clearBtnHandler=t=>{t.preventDefault(),this._viewDate=new Date,this.changeHandler(new e.Components.Scaffolding.CalendarDateUnselectEvent)},this._viewDateChangeHandler=e=>{this._onViewDateChange(e)},this._popCalendarHandler=t=>{if(__classPrivateFieldGet(this,i,"f"))return;this.viewmode="calendar";const a=e.Utils.parseDate(this.value);this._calendar.viewDate=this._monthPicker.month=this._yearPicker.year=e.Utils.Dates.isDate(a)?a:this._calendar.viewDate;const n=e.Utils.offset(this._input),s=this._dropdown;s.style.top=n.top+n.height+"px",s.style.left=n.left+"px",s.hidden=!1,requestAnimationFrame((()=>{e.Utils.addClass(s,"dropdown-in")}))},this._hideCalendarHandler=e=>{const t=e.composedPath()||[];t.indexOf(this._input)>=0||t.indexOf(this._dropdown)>=0||this._hideCalendar()}}propertyChangedCallback(e,t,a,i){switch(super.propertyChangedCallback(e,t,a,i),e){case"viewmode":case"_viewDate":this._onViewDateChange(this._viewDate)}}viewActivatedCallback(){super.viewActivatedCallback();const t=this._dropdown=this._proxy.dom[0],a=this._calendar=t.querySelector(e.P+"-calendar"),i=this._monthPicker=t.querySelector(e.P+"-calendar-month-picker"),n=this._yearPicker=t.querySelector(e.P+"-calendar-year-picker");this._monthLabel=t.querySelector(".calendar-month"),this._yearLabel=t.querySelector(".calendar-year"),this._rangeLabel=t.querySelector(".calendar-year-range");const s=this._calendar.now=new Date,r=e.Utils.Dates.parse(this.value),o=e.Utils.Dates.isDate(r)?r:s;a.dayLabelFormatter=t=>e.Utils.parseDate(t).toLocaleString(e.Utils.lang(this),{day:"numeric"}),i.addEventListener("viewyearchange",this._viewDateChangeHandler,!1),n.addEventListener("viewyearchange",this._viewDateChangeHandler,!1),a.addEventListener("viewdatechange",this._viewDateChangeHandler,!1),a.viewDate=o,a.date=r;const l=this._input;l.addEventListener("focus",this._popCalendarHandler,!1),l.addEventListener("mousedown",this._popCalendarHandler,!1),t.addEventListener("mousedown",e.stopPropagationHandler,!1),window.document.body.addEventListener("mousedown",this._hideCalendarHandler,!0),this._clearButton.addEventListener("mousedown",this._clearBtnHandler,!1);const d=new e.Components.PacemSwipeElement;a.behaviors.push(d),i.behaviors.push(d),n.behaviors.push(d),d.addEventListener("swipe",this._swipeHandler,!1);const c=e.CustomElementUtils.findAncestorShell(this);this._swiper=c.appendChild(d)}disconnectedCallback(){const t=this._input;e.Utils.isNull(t)||(this._clearButton.removeEventListener("mousedown",this._clearBtnHandler,!1),t.removeEventListener("focus",this._popCalendarHandler,!1),t.removeEventListener("mousedown",this._popCalendarHandler,!1),this._dropdown.removeEventListener("mousedown",e.stopPropagationHandler,!1),window.document.body.removeEventListener("mousedown",this._hideCalendarHandler,!0),this._calendar.removeEventListener("viewdatechange",this._viewDateChangeHandler,!1),this._monthPicker.removeEventListener("viewyearchange",this._viewDateChangeHandler,!1),this._yearPicker.removeEventListener("viewyearchange",this._viewDateChangeHandler,!1));const a=this._swiper;if(!e.Utils.isNull(a)){const e=this._calendar,t=this._monthPicker,i=this._yearPicker;for(let n of[e,t,i]){const e=n.behaviors.indexOf(a);e>=0&&n.behaviors.splice(e,1)}a.removeEventListener("swipe",this._swipeHandler,!1),a.remove(),this._swiper=null}super.disconnectedCallback()}_getHeaderLabel(t,a=this.viewmode){const i=e.Utils.parseDate(t);return e.Utils.Dates.isDate(i)?i.toLocaleString(e.Utils.lang(this),{weekday:"narrow"}):"..."}_prev(e){let t=-1;switch(this.viewmode){case"month":t=-12;break;case"year":t=-120}this._jumpMonths(t)}_next(e){let t=1;switch(this.viewmode){case"month":t=12;break;case"year":t=120}this._jumpMonths(t)}_jumpMonths(t){const a=e.Utils.parseDate(this._viewDate);this._viewDate=e.Utils.Dates.addMonths(a,t)}_setMonth(e){this._viewDate=e.detail,this.viewmode="calendar"}_setYear(e){this._viewDate=e.detail,this.viewmode="month"}_onViewDateChange(t){if(e.Utils.isNullOrEmpty(t))return;const a=e.Utils.parseDate(this._viewDate);if(e.Utils.Dates.isDate(a)&&!e.Utils.isNull(this._monthLabel))switch(this.viewmode){case"month":this._yearLabel.text=a.toLocaleString(e.Utils.lang(this),{year:"numeric"});break;case"year":const t=r(a.getFullYear());this._rangeLabel.text=`${t} - ${t+12-1}`;break;default:this._monthLabel.text=a.toLocaleString(e.Utils.lang(this),{month:"long",year:"numeric"})}}_hideCalendar(){e.Utils.removeClass(this._dropdown,"dropdown-in"),e.Utils.addAnimationEndCallback(this._dropdown,(t=>{this._dropdown.hidden=!0,e.Utils.removeClass(this._dropdown,"dropdown-select")}),250)}get inputFields(){return[this._input]}toggleReadonlyView(e){this.isReady&&(this._input.readOnly=!0,this._input.hidden=e,this._span.hide=!e)}onChange(t){return new Promise(((a,n)=>{if(e.CustomEventUtils.isInstanceOf(t,e.Components.UI.DateSelectEvent)){e.Utils.addClass(this._dropdown,"dropdown-select");e.CustomEventUtils.isInstanceOf(t,e.Components.Scaffolding.CalendarDateUnselectEvent)&&__classPrivateFieldSet(this,i,!0,"f"),this.focus(),__classPrivateFieldSet(this,i,!1,"f"),this._hideCalendar(),a(this.value=t.detail)}else a(this.value)}))}acceptValue(t){this._input.value=this.viewValue;const a=this._calendar;if(!e.Utils.isNull(a)){const i=e.Utils.parseDate(t);e.Utils.Dates.isDate(i)?a.viewDate=a.date=i:a.date=void 0}}getViewValue(t){const a=e.Utils.Dates.parse(t);return e.Utils.Dates.isDate(a)?e.Utils.core.date(a,this.format||"short",e.Utils.lang(this)):""}compareValuePropertyValues(t,a){const i=e.Utils.parseDate(t),n=e.Utils.parseDate(a);return!(!e.Utils.isNullOrEmpty(i)||!e.Utils.isNullOrEmpty(n))||!e.Utils.isNullOrEmpty(i)&&!e.Utils.isNullOrEmpty(n)&&i.valueOf()==n.valueOf()}convertValueAttributeToProperty(t){return e.PropertyConverters.Datetime.convert(t)}};i=new WeakMap,__decorate([e.ViewChild("input[type=text]")],l.prototype,"_input",void 0),__decorate([e.ViewChild(`.${e.PCSS}-readonly`)],l.prototype,"_span",void 0),__decorate([e.ViewChild(`${e.P}-button[clear]`)],l.prototype,"_clearButton",void 0),__decorate([e.ViewChild(e.P+"-shell-proxy")],l.prototype,"_proxy",void 0),__decorate([e.Watch({emit:!1,converter:n})],l.prototype,"format",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Eval})],l.prototype,"disabledRanges",void 0),__decorate([e.Watch({converter:e.PropertyConverters.String})],l.prototype,"weekStart",void 0),__decorate([e.Watch({converter:e.PropertyConverters.String})],l.prototype,"viewmode",void 0),__decorate([e.Watch()],l.prototype,"_week",void 0),__decorate([e.Watch()],l.prototype,"_viewDate",void 0),l=__decorate([e.CustomElement({tagName:e.P+"-calendar-picker",shadow:e.Defaults.USE_SHADOW_ROOT,template:`<div class="${e.PCSS}-calendar-picker">\n <input type="text" class="${e.PCSS}-input" /><${e.P}-span text="{{ :host.viewValue }}" class="${e.PCSS}-readonly"></${e.P}-span>\n <${e.P}-button class="button-flat ${e.PCSS}-anim anim-pop anim-sudden anim-quick pos-absolute absolute-right absolute-top display-block ${e.PCSS}-margin margin-0"\n tab-order="-1"\n hide="{{ :host.readonly || :host.required || !Pacem.Utils.Dates.isDate(Pacem.Utils.Dates.parse(:host.value)) }}"\n icon-glyph="close"\n clear></${e.P}-button>\n</div>\n<${e.P}-shell-proxy>\n <div class="${e.PCSS}-calendar-picker-dropdown" pacem hidden>\n <${e.P}-collapse collapse="false">\n <div class="dropdown-grid">\n <div class="calendar-title">\n <${e.P}-span class="calendar-month calendar-zoom" on-click=":host.viewmode = 'month'" hide="{{ :host.viewmode !== 'calendar' }}"></${e.P}-span>\n <${e.P}-span class="calendar-year calendar-zoom" on-click=":host.viewmode = 'year'" hide="{{ :host.viewmode !== 'month' }}"></${e.P}-span>\n <${e.P}-span class="calendar-year-range" hide="{{ :host.viewmode !== 'year' }}"></${e.P}-span>\n </div>\n <div class="calendar-month-nav ${e.PCSS}-buttonset buttons">\n <div class="buttonset-left">\n <${e.P}-button class="button button-size size-auto" on-click=":host._prev($event)" icon-glyph="chevron_left"></${e.P}-button>\n <${e.P}-button class="button button-size size-auto" on-click=":host._next($event)" icon-glyph="chevron_right"></${e.P}-button>\n </div>\n </div>\n ${function(){let t="";for(let a=0;a<7;a++)t+=`<${e.P}-span class="calendar-heading day-${a+1} text-ellipsed" text="{{ :host._getHeaderLabel(:host._week[${a}]) }}"></${e.P}-span>`;return`<${e.P}-panel hide="{{ :host.viewmode !== 'calendar' }}" class="calendar-header">${t}</${e.P}-panel>`}()}\n <${e.P}-calendar hide="{{ :host.viewmode !== 'calendar' }}" week="{{ :host._week, twoway }}" view-date="{{ :host._viewDate, twoway }}" week-start="{{ :host.weekStart }}" disabled-ranges="{{ :host.disabledRanges }}" on-dateselect="{{ :host.changeHandler($event) }}"></${e.P}-calendar>\n <${e.P}-calendar-month-picker hide="{{ :host.viewmode !== 'month' }}" on-monthselect=":host._setMonth($event)" month="{{ :host.value || Date.now() }}" view-year="{{ :host._viewDate && :host._viewDate.getFullYear() }}"></${e.P}-calendar-month-picker>\n <${e.P}-calendar-year-picker hide="{{ :host.viewmode !== 'year' }}" on-yearselect=":host._setYear($event)" year="{{ :host.value || Date.now() }}" view-year="{{ :host._viewDate && :host._viewDate.getFullYear() }}"></${e.P}-calendar-year-picker>\n </div>\n <${e.P}-collapse>\n </div>\n</${e.P}-shell-proxy>`})],l),a.PacemCalendarPickerElement=l}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(a){a.CHAR_COUNTER_CHILD=`<${e.P}-char-count hide="{{ :host.readonly || !(:host.minlength > 0 || :host.maxlength > 0) }}" minlength="{{ :host.minlength }}" maxlength="{{ :host.maxlength }}" string="{{ :host.value }}"></${e.P}-char-count>`;let i=class PacemCharCountElement extends t.PacemElement{_isValid(e){const t=this._length(e);return!(this.minlength>0&&t<this.minlength)&&!(this.maxlength>0&&t>this.maxlength)}_length(e){return e&&e.length||0}};__decorate([e.Watch({converter:e.PropertyConverters.Number})],i.prototype,"minlength",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Number})],i.prototype,"maxlength",void 0),__decorate([e.Watch({converter:e.PropertyConverters.String})],i.prototype,"string",void 0),i=__decorate([e.CustomElement({tagName:e.P+"-char-count",shadow:e.Defaults.USE_SHADOW_ROOT,template:`<${e.P}-panel class="${e.PCSS}-char-count" css-class="{{ {'valid': :host._isValid(:host.string), 'invalid': !:host._isValid(:host.string) } }}">\n <${e.P}-span hide="{{ !(:host.minlength > 0) }}" class="${e.PCSS}-char-min" content="{{ :host.minlength }}"></${e.P}-span>\n <${e.P}-span class="${e.PCSS}-char-curr" content="{{ :host._length(:host.string) || '0' }}"></${e.P}-span>\n <${e.P}-span hide="{{ !(:host.maxlength > 0) }}" class="${e.PCSS}-char-max" content="{{ :host.maxlength }}"></${e.P}-span>\n</${e.P}-panel>`})],i),a.PacemCharCountElement=i}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){let a=class PacemCheckboxListElement extends t.PacemDataSourceElement{acceptValue(e){}constructor(){super(!0),this._selectedUiItems=[],this.key="_"+e.Utils.uniqueCode()}get inputFields(){return[]}propertyChangedCallback(e,t,a,i){super.propertyChangedCallback(e,t,a,i),"disabled"===e&&(this._disable.model=a)}viewActivatedCallback(){super.viewActivatedCallback(),this._disable.model=this.disabled}toggleReadonlyView(e){this._span.hidden=!e,this._repeater.hidden=e}_selectionChanged(e,t,a){if("selected"===e.detail.propertyName){let a,i=this._selectedUiItems;!0===e.detail.currentValue?i.push(this.datasource[t]):-1!==(a=i.indexOf(this.datasource[t]))&&i.splice(a,1)}}onChange(t){const a=this.value=this._selectedUiItems.map((e=>this.mapEntityToValue(e)));return e.Utils.fromResult(a)}};__decorate([e.ViewChild(`span.${e.PCSS}-readonly`)],a.prototype,"_span",void 0),__decorate([e.ViewChild(e.P+"-repeater")],a.prototype,"_repeater",void 0),__decorate([e.ViewChild(e.P+"-data")],a.prototype,"_disable",void 0),a=__decorate([e.CustomElement({tagName:e.P+"-checkbox-list",template:`<${e.P}-repeater datasource="{{ :host.adaptedDatasource }}">\n <ol class="${e.PCSS}-checkbox-list ${e.PCSS}-viewfinder" pacem>\n <template>\n <li><${e.P}-checkbox disabled="{{ ::_disable.model || ^item.disabled }}" name="{{ :host.key, once }}" autobind="off" caption="{{ ^item.viewValue }}" true-value="{{ ^item.value }}" selected="{{ :host.isDataSourceItemSelected(^item, :host.value) }}"\non-focus=":host.focusHandler($event)" on-blur=":host.focusHandler($event)"\non-${e.PropertyChangeEventName}=":host._selectionChanged($event, ^index, ^item)" on-change=":host.changeHandler($event)"></${e.P}-checkbox></li>\n </template>\n </ol>\n</${e.P}-repeater><span class="${e.PCSS}-readonly"><${e.P}-text text="{{ :host.viewValue }}"></${e.P}-text></span><${e.P}-data></${e.P}-data><${e.P}-content></${e.P}-content>`,shadow:e.Defaults.USE_SHADOW_ROOT})],a),t.PacemCheckboxListElement=a}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){const a={convert:e=>"true"===e||"false"!==e&&e,convertBack:e=>e.toString()};let i=class PacemCheckboxElement extends t.PacemBaseElement{constructor(){super("checkbox"),this.caption="",this._key="_"+e.Utils.uniqueCode()}convertValueAttributeToProperty(e){a.convert(e)===this.trueValue?this.trueValue:this.falseValue}toggleReadonlyView(e){this.span.hidden=!e,this._checkbox.hidden=this._label.hidden=e}get inputFields(){return[this._checkbox]}onChange(t){this.selected=this._checkbox.checked;const a=this.value=this.selected?this.trueValue:this.falseValue;return e.Utils.fromResult(a)}viewActivatedCallback(){super.viewActivatedCallback(),this._checkbox.id=this._label.htmlFor=this._key,this._synchronizeUi(),this.value==this.trueValue?this.selected=!0:this.value==this.falseValue&&(this.selected=!1)}propertyChangedCallback(t,a,i,n){if(super.propertyChangedCallback(t,a,i,n),this.isReady)switch(t){case"caption":this._label.hidden=e.Utils.isNullOrEmpty(i);break;case"name":this._checkbox.name=i;break;case"selected":this._synchronizeUi()}}_synchronizeUi(t=this.selected){(this._checkbox.checked=t)?(this.value=this.trueValue,e.Utils.addClass(this,e.PCSS+"-selected"),this.aria.attributes.set("checked","true")):(this.value=this.falseValue,e.Utils.removeClass(this,e.PCSS+"-selected"),this.aria.attributes.set("checked","false"))}acceptValue(e){this.selected=e==this.trueValue}getViewValue(t){return e.Utils.isNull(t)?"":this.caption}};__decorate([e.ViewChild("input[type=checkbox]")],i.prototype,"_checkbox",void 0),__decorate([e.ViewChild("label")],i.prototype,"_label",void 0),__decorate([e.ViewChild(`.${e.PCSS}-readonly`)],i.prototype,"span",void 0),__decorate([e.Watch({converter:e.PropertyConverters.String})],i.prototype,"caption",void 0),__decorate([e.Watch({emit:!1,converter:a})],i.prototype,"trueValue",void 0),__decorate([e.Watch({emit:!1,converter:a})],i.prototype,"falseValue",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Boolean})],i.prototype,"selected",void 0),i=__decorate([e.CustomElement({tagName:e.P+"-checkbox",template:`<${e.P}-span class="${e.PCSS}-readonly ${e.PCSS}-checkbox" text="{{ :host.caption }}"></${e.P}-span>\n<input type="checkbox" class="${e.PCSS}-input" /><label class="${e.PCSS}-label ${e.PCSS}-checkbox ${e.PCSS}-viewfinder" pacem><${e.P}-span content="{{ :host.caption }}"></${e.P}-span></label>`,shadow:e.Defaults.USE_SHADOW_ROOT})],i),t.PacemCheckboxElement=i}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(a){var i;a.FormSubmitEventName="submit",a.FormResetEventName="reset";class FormSubmitEvent extends e.CustomTypedEvent{constructor(e){super(a.FormSubmitEventName,e,{bubbles:!0,cancelable:!0})}}a.FormSubmitEvent=FormSubmitEvent;class FormResetEvent extends Event{constructor(){super(a.FormResetEventName,{bubbles:!0,cancelable:!0})}}a.FormResetEvent=FormResetEvent;const n=["download",e.CommandEventName];class FormEventEmitter{constructor(t){this._element=t,this._itemEmitHandler=t=>{if(this._element.handle(t),t.type===e.CommandEventName){const e=t;this._element.handle(new CustomEvent("item"+e.detail.commandName.toLowerCase(),{detail:e.detail.commandArgument}))}}}start(){n.forEach((e=>this._element.addEventListener(e,this._itemEmitHandler,!1)))}stop(){n.forEach((e=>this._element.removeEventListener(e,this._itemEmitHandler,!1)))}}a.FormEventEmitter=FormEventEmitter;let s=class PacemFormElement extends a.PacemFormRelevantElement{constructor(){super("form"),this.method=e.Net.HttpMethod.Post,this._emitter=null,this._buttons={submit:void 0,reset:void 0},i.set(this,!1),this._keyupHandler=t=>{if(!(13!==t.keyCode||t.shiftKey||t.ctrlKey||t.altKey||t.metaKey)){let a=t.currentTarget.querySelector(e.P+"-button[type=submit]");e.Utils.isNull(a)||!e.Utils.isVisible(a)||a.disabled||a.click()}},this._submit=(t,a)=>{e.Utils.isNull(a)||e.avoidHandler(a),Promise.all(this._validateAllFields()).then((e=>{-1===e.findIndex((e=>!1===e))&&this.submit(t).then((e=>{this.setPristine()}),(e=>{}))}))},this._reset=t=>{e.Utils.isNull(t)||e.avoidHandler(t);var i=new FormResetEvent;if(this.dispatchEvent(i),!i.defaultPrevented){for(var n in this._fields){var s=this._fields[n];s instanceof a.PacemModelElement&&s.reset()}for(var r of this._subForms)r._reset()}},this._fields={},this._validators={},this._subForms=[],this._fieldPropertyChanged=e=>{switch(e.detail.propertyName){case"value":let t=e.target;this._checkFieldValidity(t.name);break;case"dirty":this._checkDirtyness();break;case"valid":this._checkValidity()}},this._validatorPropertyChanged=e=>{const t=e.target,a=t.watch;if("invalid"===e.detail.propertyName){let e=this._fields[t.watch];t.invalid?e.valid=!1:this._checkFieldValidity(a)}else this._checkFieldValidity(a)},this.suddenValidation=!0,this.resettable=!0,this._emitter=new FormEventEmitter(this)}propertyChangedCallback(t,a,i,n){super.propertyChangedCallback(t,a,i,n),("method"===t&&!0===this.autogenerate&&!e.Utils.isNullOrEmpty(this.metadata)||"metadata"===t&&!0===this.autogenerate||"autogenerate"===t&&!0===i&&this.metadata&&(this.metadata.props||this.metadata).length>0)&&this._buildUpForm()}viewActivatedCallback(){super.viewActivatedCallback(),this.form&&this.form.registerSubForm(this),this._checkValidity(),this.addEventListener("keyup",this._keyupHandler,!1),this._emitter.start()}disconnectedCallback(){this._emitter.stop(),this.removeEventListener("keyup",this._keyupHandler,!1),this.form&&this.form.unregisterSubForm(this),super.disconnectedCallback()}_buildUpForm(){const t="_"+e.Utils.uniqueCode(),a=this.id=this.id||t,i="fetch"+t,n=document.createElement("form");n.id="form"+t,n.className=e.PCSS+"-form",n.setAttribute("pacem",""),n.setAttribute("novalidate","");const s=`<${e.P}-repeater class="${e.PCSS}-animatable-list ${e.PCSS}-list-bottom" datasource="{{ #${a}.metadata && (#${a}.metadata.props || #${a}.metadata) }}">\n <${e.P}-panel css="{{ #${a}.metadata.display && #${a}.metadata.display.css }}" css-class="{{ (#${a}.metadata.display && #${a}.metadata.display.cssClass || []).concat(#${a}.suddenValidation ? [] : ['lazy-validation']) }}">\n <template>\n <${e.P}-form-field css-class="{{ ^item.display && ^item.display.cssClass }}" css="{{ ^item.display && ^item.display.css }}"\n fetch-credentials="{{ #${a}.fetchCredentials }}" fetch-headers="{{ #${a}.fetchHeaders }}"\n logger="{{ #${a}.logger }}" entity="{{ #${a}.entity, twoway }}" metadata="{{ ^item }}" readonly="{{ #${a}.readonly || ^item.isReadOnly }}"></${e.P}-form-field>\n </template>\n </${e.P}-panel>\n</${e.P}-repeater>\n<${e.P}-fetch logger="{{ #${a}.logger }}" id="${i}" method="${this.method}" credentials="{{ #${a}.fetchCredentials }}" headers="{{ #${a}.fetchHeaders }}"></${e.P}-fetch> \n<div class="${e.PCSS}-buttonset buttons">\n <div class="buttonset-left">\n <${e.P}-button logger="{{ #${a}.logger }}" on-click="#${a}._submit(#${a}.fetcher || #${i}, $event)" type="submit" hide="{{ #${a}.readonly || $pacem.isNullOrEmpty(#${a}.action) || !$pacem.isNull(#${a}.form) }}"\nclass="button primary button-size size-small"\ncss-class="{{ {'buttonset-last': !#${a}.resettable || !#${a}.dirty || !$pacem.isNull(#${a}.form) } }}" \ndisabled="{{ (#${a}.suddenValidation && (!(#${a}.valid && #${a}.dirty))) || #${a}.fetching }}">\n <${e.P}-panel class="submit-spinner ${e.PCSS}-anim anim-pop" hide="{{ !#${a}.fetching }}"><i class="${e.PCSS}-icon ${e.PCSS}-anim anim-rotate rotate-uniform display-block">refresh</i></${e.P}-panel>\n <${e.P}-text text="{{ #${a}.submitCaption || 'OK' }}"></${e.P}-text>\n </${e.P}-button>\n <${e.P}-button logger="{{ #${a}.logger }}" on-click="#${a}._reset($event)" type="reset" class="button button-size size-small" css-class="{{ {'buttonset-first': #${a}.readonly || Pacem.Utils.isNullOrEmpty(#${a}.action) || !Pacem.Utils.isNull(#${a}.form)} }}" hide="{{ !#${a}.resettable || #${a}.readonly || !#${a}.dirty || !Pacem.Utils.isNull(#${a}.form) }}" disabled="{{ #${a}.fetching }}">\n <${e.P}-text text="{{ #${a}.resetCaption || 'Reset' }}"></${e.P}-text>\n </${e.P}-button>\n</div></div>`;n.innerHTML=s,this.innerHTML="",this.appendChild(n),n.addEventListener("submit",e.avoidHandler,!1);const r=this._buttons,o=this._buttons={submit:n.lastElementChild.firstElementChild.firstElementChild,reset:n.lastElementChild.firstElementChild.lastElementChild};this.dispatchEvent(new e.PropertyChangeEvent({propertyName:"formButtons",currentValue:o,oldValue:r}))}get formButtons(){return this._buttons}get fetching(){return __classPrivateFieldGet(this,i,"f")}submit(t){if(e.Utils.isNull(t))throw"Fetcher cannot be null while submitting a form.";var a=e.DeferPromise.defer();return this._submitInternally(t).then((e=>{this.dispatchEvent(new CustomEvent("success",{detail:e})),a.resolve(e)}),(e=>{false!==e&&this.dispatchEvent(new CustomEvent("fail",{detail:e})),a.reject(e)})),a.promise}reset(){this._reset()}_submitInternally(a,n){if(e.Utils.isNull(a))throw"Fetcher cannot be null while submitting a form.";var s=e.DeferPromise.defer();const r=this.entity,o=this.entityName;var l={};e.Utils.isNullOrEmpty(o)?l=r:l[o]=r;n={parameters:l,fields:this._getAllFields()};var d=new FormSubmitEvent(n);if(this.dispatchEvent(d),d.defaultPrevented)s.reject(false);else{a.parameters=e.Utils.extend({},d.detail.parameters);const n=t=>{a.removeEventListener(e.Net.FetchSuccessEventName,n,!1),a.removeEventListener(e.Net.FetchErrorEventName,o,!1);const i=t.detail;if(e.Net.Fetcher.isEmpty(i)&&(a.removeEventListener(e.Net.FetchResultEventName,r,!1),this.success=!0,s.resolve({})),205===i.status)this._reset()},r=t=>{a.removeEventListener(e.Net.FetchResultEventName,r,!1);var i=t.detail;"object"==typeof i&&i.hasOwnProperty("success")?!0===i.success?(this.success=!0,s.resolve(i.result||{})):(this.fail=!0,s.reject(i.error)):(this.success=!0,s.resolve(i))},o=t=>{a.removeEventListener(e.Net.FetchSuccessEventName,n,!1),a.removeEventListener(e.Net.FetchResultEventName,r,!1),a.removeEventListener(e.Net.FetchErrorEventName,o,!1),this.fail=!0;const i=t.detail;s.reject(i)},l=t=>{if("fetching"===t.detail.propertyName)!0===t.detail.currentValue?(e.Utils.addClass(this,e.PCSS+"-fetching"),__classPrivateFieldSet(this,i,!0,"f"),this.dispatchEvent(new e.PropertyChangeEvent({currentValue:!0,oldValue:!1,propertyName:"fetching"}))):(__classPrivateFieldSet(this,i,!1,"f"),this.dispatchEvent(new e.PropertyChangeEvent({currentValue:!1,oldValue:!0,propertyName:"fetching"})),e.Utils.removeClass(this,e.PCSS+"-fetching"),a.removeEventListener(e.PropertyChangeEventName,l,!1))};a.addEventListener(e.PropertyChangeEventName,l,!1),a.addEventListener(e.Net.FetchSuccessEventName,n,!1),a.addEventListener(e.Net.FetchResultEventName,r,!1),a.addEventListener(e.Net.FetchErrorEventName,o,!1),e.Utils.isNullOrEmpty(this.action)||(a.url=this.action),a instanceof t.PacemFetchElement&&!a.autofetch&&a.fetch(),this.success=this.fail=!1}return s.promise}_getAllFields(t={}){for(var a of(e.Utils.extend(t,this._fields),this._subForms))a._getAllFields(t);return t}apply(t){if(!e.Utils.isNullOrEmpty(t)){this.entity=e.Utils.extend({},this.entity,t);for(let e in t)this.setDirty(e)}}setPristine(e){this._setAs(!1,e)}setDirty(e){this._setAs(!0,e)}_setAs(t,i){const n=!e.Utils.isNullOrEmpty(i);for(let e in this._fields)if(!n||i===e){const i=this._fields[e];i instanceof a.PacemModelElement&&(t?i.setDirty():i.setPristine())}for(let e of this._subForms)t?e.setDirty(i):e.setPristine(i)}_checkFieldValidity(e){return e in this._fields?this._validateField(e,!1):Promise.resolve(!1)}validate(t){return e.Utils.isNullOrEmpty(t)?Promise.all(this._validateAllFields()).then((e=>!e.some((e=>!1===e)))):this._checkFieldValidity(t)}_validateAllFields(e=!0){const t=[];for(let a in this._fields)t.push(this._validateField(a,e));for(let a of this._subForms)Array.prototype.push.apply(t,a._validateAllFields(e));return t}_validateField(t,a){var i=e.DeferPromise.defer(),n=this._fields[t];if(n){var s=this._validators[n.name];s&&s.length>0?(this.log(e.Logging.LogLevel.Log,`Computing "${n.name}" validity.`),Promise.all(s.map((e=>e.validate(n.value).then((t=>!(e.invalid=!t)))))).then((t=>{let s=!0;for(var r of t)if(!1===r){s=!1,a&&n.setDirty();break}this.log(e.Logging.LogLevel.Log,`Property "${n.name}" turns out to be ${s?"":"not "}valid.`),i.resolve(n.valid=s)}))):(this.log(e.Logging.LogLevel.Log,`Property "${n.name}" has no validators.`),i.resolve(n.valid=!0))}else this.log(e.Logging.LogLevel.Log,`Property "${t}" has no fields in this form.`),i.resolve(!0);return i.promise}_checkDirtyness(){let e=!1;for(var t in this._fields)if(!0===this._fields[t].dirty){e=!0;break}if(!1===e)for(var a of this._subForms)if(a.dirty){e=!0;break}this.dirty=e}_checkValidity(){let t=!0;for(var a in this._fields)if(this.log(e.Logging.LogLevel.Log,`Checking "${a}" validity.`),!1===this._fields[a].valid){this.log(e.Logging.LogLevel.Log,`"${a}" is not valid.`),t=!1;break}if(!0===t)for(var i of this._subForms)if(!i.valid){t=!1;break}this.valid=t}registerSubForm(t){let a=this._subForms;-1==a.indexOf(t)&&(t.addEventListener(e.PropertyChangeEventName,this._fieldPropertyChanged,!1),a.push(t),this._checkValidity(),this._checkDirtyness())}unregisterSubForm(t){let a=this._subForms,i=a.indexOf(t);i>=0&&(t.removeEventListener(e.PropertyChangeEventName,this._fieldPropertyChanged,!1),a.splice(i,1),this._checkValidity(),this._checkDirtyness())}registerField(t,a){var i=this._fields;i[t]!=a&&(this.unregisterField(t,!1),i[t]=a,this.log(e.Logging.LogLevel.Log,`Registering "${t}" field.`),a instanceof HTMLElement&&a.addEventListener(e.PropertyChangeEventName,this._fieldPropertyChanged,!1),this._checkFieldValidity(t),this._checkDirtyness())}unregisterField(t,a=!0){var i=this._fields,n=i[t];n instanceof HTMLElement&&n.removeEventListener(e.PropertyChangeEventName,this._fieldPropertyChanged,!1),delete i[t],n&&!0===a&&(this._checkValidity(),this._checkDirtyness())}registerValidator(t,a){var i=this._validators[t]=this._validators[t]||[];-1==i.indexOf(a)&&(i.push(a),a instanceof HTMLElement&&a.addEventListener(e.PropertyChangeEventName,this._validatorPropertyChanged,!1),this.log(e.Logging.LogLevel.Log,`Calling "${t}" validity check after validator registration.`),this._checkFieldValidity(t))}unregisterValidator(e,t){this._unregisterValidator(e,t,!0)}_unregisterValidator(t,a,i){var n=this._validators[t]=this._validators[t]||[],s=n.indexOf(a);s>=0&&(a instanceof HTMLElement&&a.removeEventListener(e.PropertyChangeEventName,this._validatorPropertyChanged,!1),n.splice(s,1),i&&this._checkFieldValidity(t))}};i=new WeakMap,__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Element})],s.prototype,"fetcher",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],s.prototype,"fetchCredentials",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Json})],s.prototype,"fetchHeaders",void 0),__decorate([e.Watch({reflectBack:!0,converter:e.PropertyConverters.String})],s.prototype,"method",void 0),__decorate([e.Watch({reflectBack:!0,converter:e.PropertyConverters.String})],s.prototype,"submitCaption",void 0),__decorate([e.Watch({reflectBack:!0,converter:e.PropertyConverters.String})],s.prototype,"resetCaption",void 0),__decorate([e.Debounce(100)],s.prototype,"_buildUpForm",null),__decorate([e.Watch({reflectBack:!0,converter:e.PropertyConverters.Boolean})],s.prototype,"valid",void 0),__decorate([e.Watch({reflectBack:!0,converter:e.PropertyConverters.Boolean})],s.prototype,"dirty",void 0),__decorate([e.Watch({reflectBack:!0,converter:e.PropertyConverters.Boolean})],s.prototype,"readonly",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Boolean})],s.prototype,"success",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Boolean})],s.prototype,"fail",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Json})],s.prototype,"entity",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],s.prototype,"entityName",void 0),__decorate([e.Watch()],s.prototype,"metadata",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Boolean})],s.prototype,"autogenerate",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Boolean})],s.prototype,"suddenValidation",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Boolean})],s.prototype,"resettable",void 0),__decorate([e.Watch({converter:e.PropertyConverters.String})],s.prototype,"action",void 0),s=__decorate([e.CustomElement({tagName:e.P+"-form"})],s),a.PacemFormElement=s}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(a){let i=class PacemChildFormPropagatorElement extends t.PacemEventTarget{propertyChangedCallback(e,t,a,i){super.propertyChangedCallback(e,t,a,i),("watch"===e||"property"===e||"model"===e&&a&&a.length>(t&&t.length||0))&&this._synchronize()}viewActivatedCallback(){super.viewActivatedCallback(),this._synchronize()}_synchronize(){const t=this.model,a=this.property,i=this.watch;if(!e.Utils.isNullOrEmpty(t)&&!e.Utils.isNullOrEmpty(a))if(e.Utils.isArray(t)){for(let e of t)e[a]=i;t.splice(t.length)}else t[a]=i,this.model=e.Utils.clone(t)}};__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],i.prototype,"property",void 0),__decorate([e.Watch({emit:!1})],i.prototype,"watch",void 0),__decorate([e.Watch({emit:!1})],i.prototype,"model",void 0),i=__decorate([e.CustomElement({tagName:e.P+"-childform-propagator"})],i),a.PacemChildFormPropagatorElement=i;let n=class PacemChildFormElement extends a.PacemBaseElement{constructor(){super(...arguments),this._model=[],this._subForms=[]}get inputFields(){return[]}toggleReadonlyView(e){}onChange(e){return new Promise(((e,t)=>{var a=this._modelToEntity();e(this.value=a)}))}acceptValue(e){this._entityToModel(e)}getViewValue(e){return""}convertValueAttributeToProperty(t){return e.PropertyConverters.Json.convert(t,this)}propertyChangedCallback(e,t,a,i){if(super.propertyChangedCallback(e,t,a,i),"mode"===e)this._entityToModel()}_dragStart(t){var a=t.detail;const i=e.Utils.offset(a.element),n=a.floater;n.style.width=i.width+"px",n.style.height=i.height+"px"}_dragEnd(e){"array"===this.mode&&this._triggerChange()}reset(){super.reset(),this._subForms.forEach((e=>{e.setPristine()}))}_itemCreate(t){const a=t.detail.index,i=this._subForms;t.detail.dom[0].childNodes.forEach((t=>{t instanceof Element&&t.localName===e.P+"-form"&&i.splice(a,i.length-a,t)}))}_itemChange(t,a){"entity"===a.detail.propertyName&&e.Utils.Json.stringify(this._model[t])!==e.Utils.Json.stringify(a.detail.currentValue)&&(this._model.splice(t,1,a.detail.currentValue),this._triggerChange())}_deleteAt(t){e.avoidHandler(t.srcEvent);const a=this._model;"array"===this.mode?a.splice(t.detail,1):a.splice(0,a.length),this._triggerChange()}_addItem(e){const t=this.mode,a=this._model;"array"===t?a.push({}):a.splice(0,a.length,{}),this._triggerChange()}_triggerChange(){this.changeHandler(new Event("change"))}_entityToModel(t=this.value){if("array"===this.mode){let a=t||[];e.Utils.isArray(a)&&this._model.cloneFrom(a)}else{const a=this._model,i=a.length;1===i&&a[0]===t||(e.Utils.isNull(t)?a.splice(0,i):a.splice(0,i,t))}}_modelToEntity(t=this._model){return"array"===this.mode?e.Utils.clone(t):t&&t.length&&t[0]||null}};__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],n.prototype,"fetchCredentials",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Json})],n.prototype,"fetchHeaders",void 0),__decorate([e.ViewChild("."+e.PCSS+"-childform")],n.prototype,"_container",void 0),__decorate([e.ViewChild(e.P+"-drag-drop")],n.prototype,"_dragger",void 0),__decorate([e.ViewChild("."+e.PCSS+"-childform-item-floater")],n.prototype,"_floater",void 0),__decorate([e.Watch({converter:e.PropertyConverters.String})],n.prototype,"mode",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Boolean})],n.prototype,"lockItems",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Json})],n.prototype,"metadata",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Json})],n.prototype,"_model",void 0),n=__decorate([e.CustomElement({tagName:e.P+"-childform",shadow:e.Defaults.USE_SHADOW_ROOT,template:`<${e.P}-repeater datasource="{{ :host._model }}" on-itemdelete=":host._deleteAt($event)" on-${t.RepeaterItemCreateEventName}=":host._itemCreate($event)">\n <div class="${e.PCSS}-childform">\n <template>\n <${e.P}-panel class="${e.PCSS}-childform-item" behaviors="{{ [::_dragger] }}">\n <${e.P}-panel class="childform-item-handle ${e.PCSS}-margin margin-right-1" hide="{{ :host.lockItems || :host.readonly || :host.mode !== 'array' || !(:host._model && :host._model.length > 1) }}"><i class="${e.PCSS}-icon drag-handle">drag_handle</i></${e.P}-panel>\n <${e.P}-panel class="childform-item-index text-small"><${e.P}-span hide="{{ !:host.readonly || :host.mode !== 'array' }}" class="${e.PCSS}-margin margin-right-1" text="{{ ^index+1 }}"></${e.P}-span></${e.P}-panel>\n <${e.P}-form entity="{{ ^item }}" fetch-headers="{{ :host.fetchHeaders }}" fetch-credentials="{{ :host.fetchCredentials }}" on-${e.PropertyChangeEventName}=":host._itemChange(^index, $event)" readonly="{{ :host.readonly }}" metadata="{{ :host.metadata }}" autogenerate="true" logger="{{ :host.logger }}"></${e.P}-form>\n <${e.P}-button tab-order="-1" class="flat circular circle-small clear ${e.PCSS}-margin margin-left-1" hide="{{ :host.lockItems || :host.readonly }}" command-name="delete" command-argument="{{ ^index }}"></${e.P}-button>\n </${e.P}-panel>\n </template>\n </div>\n <${e.P}-button tab-order="-1" class="flat circular circle-small add" hide="{{ :host.lockItems || :host.readonly || !(:host.mode === 'array' || $pacem.isNullOrEmpty(:host._model)) }}" on-click=":host._addItem($event)"></${e.P}-button>\n</${e.P}-repeater>\n<div class="${e.PCSS}-childform-item-floater ${e.PCSS}-panel panel-border">\n <div class="corner top-left"></div><div class="corner top-right"></div><div class="corner bottom-left"></div><div class="corner bottom-right"></div>\n</div>\n<${e.P}-drag-drop floater="{{ ::_floater }}" disabled="{{ :host.lockItems }}"\n on-${e.UI.DragDropEventType.Start}=":host._dragStart($event)"\n on-${e.UI.DragDropEventType.End}=":host._dragEnd($event)" \n drop-behavior="${e.UI.DropBehavior.InsertChild}" mode="${e.UI.DragDataMode.Alias}" handle-selector=".drag-handle" drop-targets="{{ [::_container] }}"></${e.P}-drag-drop>`})],n),a.PacemChildFormElement=n}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){var a,i,n,s;function r(e){return e instanceof HTMLDivElement&&"true"===e.contentEditable&&e.hasAttribute("pacem")&&e.hasAttribute("role")&&"presenter"===e.attributes.role.value}a=new WeakMap,i=new WeakMap,n=new WeakMap,s=new WeakMap,t.ContenteditableDOMObserver=class ContenteditableDOMObserver{constructor(e,t,r="*[contenteditable=false]"){a.set(this,void 0),i.set(this,void 0),n.set(this,void 0),s.set(this,void 0),__classPrivateFieldSet(this,i,t,"f"),__classPrivateFieldSet(this,a,r,"f"),__classPrivateFieldSet(this,s,new MutationObserver((e=>{const a=(e,i)=>{e.childNodes.forEach((e=>a(e,i))),t(e,i)};for(let t of e){const e=t.addedNodes,i=t.removedNodes;for(let t=0;t<e.length;t++){const i=e.item(t);a(i,!1)}for(let e=0;e<i.length;e++){const t=i.item(e);a(t,!0)}}})),"f"),this._initContainer(e)}_initContainer(e){e.querySelectorAll(__classPrivateFieldGet(this,a,"f")).forEach((e=>__classPrivateFieldGet(this,i,"f").call(this,e))),__classPrivateFieldGet(this,s,"f").observe(e,{subtree:!0,childList:!0}),__classPrivateFieldSet(this,n,e,"f")}_disposeContainer(t){const n=__classPrivateFieldGet(this,s,"f");e.Utils.isNull(n)||n.disconnect(),t.querySelectorAll(__classPrivateFieldGet(this,a,"f")).forEach((e=>__classPrivateFieldGet(this,i,"f").call(this,e,!0)))}dispose(){this._disposeContainer(__classPrivateFieldGet(this,n,"f"))}};class ContenteditableUtils{static getDefaultDashboard(){const a=new DocumentFragment,i=document.createElement("div");e.Utils.addClass(i,e.PCSS+"-contenteditable-toolbar");const n=new t.PacemContenteditableHistoryCommandElement;n.command="undo",n.keyboardShortcut="Ctrl+Z";const s=new t.PacemContenteditableHistoryCommandElement;s.command="redo",s.keyboardShortcut="Ctrl+Y",i.append(n,s);const r=document.createElement("div");e.Utils.addClass(r,e.PCSS+"-contenteditable-separator");const o=document.createElement("div");e.Utils.addClass(o,e.PCSS+"-contenteditable-toolbar");const l=new t.PacemContenteditableExecCommandElement;l.command=t.KnownExecCommand.Bold,l.keyboardShortcut="Ctrl+B";const d=new t.PacemContenteditableExecCommandElement;d.command=t.KnownExecCommand.Italic,d.keyboardShortcut="Ctrl+I";const c=new t.PacemContenteditableExecCommandElement;c.command=t.KnownExecCommand.Underline,c.keyboardShortcut="Ctrl+U";const h=new t.PacemContenteditableExecCommandElement;h.command=t.KnownExecCommand.StrikeThrough,c.keyboardShortcut="Ctrl+K";const p=new t.PacemContenteditableExecCommandElement;p.command=t.KnownExecCommand.UnorderedList;const u=new t.PacemContenteditableExecCommandElement;u.command=t.KnownExecCommand.OrderedList;const m=new t.PacemContenteditableAlignCommandElement;m.align="left";const v=new t.PacemContenteditableAlignCommandElement;v.align="center";const _=new t.PacemContenteditableAlignCommandElement;_.align="right";const g=new t.PacemContenteditableAlignCommandElement;g.align="justify",o.append(l,d,c,h,p,u,m,v,_,g);const y=document.createElement("div");e.Utils.addClass(y,e.PCSS+"-contenteditable-separator");const f=document.createElement("div");e.Utils.addClass(f,e.PCSS+"-contenteditable-toolbar");const P=new t.PacemContenteditableLinkCommandElement,C=new t.PacemContenteditableImageCommandElement;return f.append(P,C),a.append(i,r,o,y,f),a}static findSurroundingNode(t,a){for(var i=t instanceof Node?t:t.commonAncestorContainer;i&&!("string"==typeof a&&i instanceof Element&&i.tagName===a.toUpperCase()||"function"==typeof a&&e.Utils.isNull(a.prototype)&&a(i)||"function"==typeof a&&!e.Utils.isNull(a.prototype)&&i instanceof a);){const e=i.parentNode;if(r(e)){i=null;break}i=e}return i}static findSurroundingBlockElement(e){return this.findSurroundingNode(e,ContenteditableUtils.isBlockElement)}static findSurroundingSiblingBlockElements(e){let t=[];if(r(e.startContainer)){if(!e.collapsed){const a=e.startContainer;for(let i=e.startOffset;i<=e.endOffset;i++){const e=a.children.item(i);this.isBlockElement(e)&&t.push(a.children.item(i))}}return t}if(e.startContainer===e.endContainer){let t=e.startContainer;for(;!ContenteditableUtils.isBlockElement(t)&&"true"!=t.parentElement.contentEditable;)t=t.parentElement;return t instanceof Element?[t]:"true"===t.parentElement.contentEditable?[]:[t.parentElement]}let a=e.commonAncestorContainer,i=!1;for(let n=0;n<a.childNodes.length;n++){const s=a.childNodes.item(n);if((!i&&s.contains(e.startContainer)||i)&&ContenteditableUtils.isBlockElement(s)&&(t.push(s),i=!0,s.contains(e.endContainer)))break}return i?t:a instanceof Element&&!r(a)?[a]:[]}static findContainingRootElements(e){const t=e.cloneRange(),a=e.cloneRange();t.collapse(!0),a.collapse();let i=this.findSurroundingNode(t,(e=>"true"===e.parentElement.contentEditable));const n=[i];for(;!i.contains(a.startContainer);)n.push(i=i.nextElementSibling);return n}static isBlockElement(e){return e instanceof Element&&!getComputedStyle(e).display.startsWith("inline")}static select(e,t=!1){const a=document.createRange();t?(a.setStart(e,0),a.setEnd(e,e.childNodes.length)):(a.setStartBefore(e),a.setEndAfter(e));const i=document.getSelection();return i.removeAllRanges(),i.addRange(a),a}static copyAttributes(e,t){const a=t.attributes;for(let t=0;t<a.length;t++){const i=a.item(t);e.setAttribute(i.name,i.value)}}static testInertElementWrapping(t){if(!e.Utils.isNull(t)){const e=t.startContainer,i=t.startOffset;var a;if(e===t.endContainer&&i==t.endOffset-1&&(a=e.childNodes.item(i))instanceof HTMLElement&&"false"===a.contentEditable)return{result:!0,element:a}}return{result:!1}}}t.ContenteditableUtils=ContenteditableUtils}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){var a;const i="execute",n="<p><br></p>";class ContenteditableChangeEvent extends e.CustomTypedEvent{constructor(e){super("contenteditablechange",{html:e})}}class PacemContenteditableCommandElement extends t.PacemItemElement{constructor(){super(...arguments),this._containerPropChangeHandler=e=>{const t=e.detail;this.containerPropertyChangedCallback(t.propertyName,t.oldValue,t.currentValue,t.firstChange)}}execCommand(...e){const t=this;t.disabled||t.exec.apply(t,e).then((e=>{t.dispatchEvent(new Event(i))}),(e=>{console.error(e)}))}connectedCallback(){super.connectedCallback(),e.Utils.addClass(this,e.PCSS+"-contenteditable-command")}viewActivatedCallback(){super.viewActivatedCallback();const t=this.container;e.Utils.isNull(t)||(this.contentElement=t.contentElement,t.addEventListener(e.PropertyChangeEventName,this._containerPropChangeHandler,!1))}disconnectedCallback(){const t=this.container;e.Utils.isNull(t)||t.removeEventListener(e.PropertyChangeEventName,this._containerPropChangeHandler,!1),super.disconnectedCallback()}containerPropertyChangedCallback(e,t,a,i){"range"===e&&(this.range=a)}}function s(e){return(null==e?void 0:e.nodeType)==Node.ELEMENT_NODE}__decorate([e.Watch()],PacemContenteditableCommandElement.prototype,"range",void 0),__decorate([e.Watch()],PacemContenteditableCommandElement.prototype,"contentElement",void 0),t.PacemContenteditableCommandElement=PacemContenteditableCommandElement;let r=class PacemContenteditableElement extends t.PacemItemsContainerBaseElement{constructor(){super("rich text editor"),a.set(this,void 0),this._focusHandler=e=>{this._ensureInteractiveMarkup()},this._blurHandler=e=>{const t=this._container;for(let e of this.items)e.cleanUp(t);this._checkChangedHandler(e)},this._pasteHandler=t=>{t.preventDefault();const a=this.range,i=t.clipboardData.files;if(e.Utils.isNull(a)||0!==i.length)for(let e=0;e<i.length;e++){const a=i.item(e);for(let e of this.items)(n=e)instanceof PacemContenteditableCommandElement&&"pasteCallback"in n&&"function"==typeof n.pasteCallback&&e.pasteCallback(a).then((e=>this._checkChangedHandler(t)),(e=>{}))}else{const e=t.clipboardData.getData("text/plain").replace(/</gi,"&lt;").replace(/\n/gi,"<br />"),i=a.createContextualFragment(e);a.deleteContents(),a.insertNode(i),this._checkChangedHandler(t)}var n},this._shortcutHandler=e=>{var t;e.ctrlKey&&-1===["C","V","X"].indexOf(null===(t=e.key)||void 0===t?void 0:t.toUpperCase())&&e.preventDefault()},this._inputHandler=e=>{this._fixRangeMarkup(),this._checkChangedHandler(e)},this._checkChangedHandler=t=>{const i=this._container,s=i.innerHTML;var r=s;(e.Utils.isNullOrEmpty(s)||"<br>"===s||s===n)&&(i.innerHTML=n,r=""),r!=this.value&&(this.changeHandler(new ContenteditableChangeEvent(r)),this.value!=__classPrivateFieldGet(this,a,"f").current&&this._updateHistory()),this._fireHistoryChange()},this._selectionChangeHandler=e=>{const t=document.getSelection();if(t&&t.anchorNode&&this._container.contains(t.anchorNode)){const e=t.getRangeAt(0);this.range=e.cloneRange()}else this.range=null}}get history(){return __classPrivateFieldGet(this,a,"f")}reset(){super.reset(),__classPrivateFieldGet(this,a,"f").reset(),this._fireHistoryChange()}_fireHistoryChange(){const t=__classPrivateFieldGet(this,a,"f");this.dispatchEvent(new e.PropertyChangeEvent({propertyName:"history",oldValue:t,currentValue:t}))}convertValueAttributeToProperty(e){return e}toggleReadonlyView(e){this._dashboard.hidden=e,e?this._container.removeAttribute("contenteditable"):(this._container.setAttribute("contenteditable","true"),document.execCommand("defaultParagraphSeparator",!1,"p"))}register(e){return!!super.register(e)&&(e.addEventListener(i,this._checkChangedHandler,!1),!0)}unregister(e){return!!super.unregister(e)&&(e.removeEventListener(i,this._checkChangedHandler,!1),!0)}get preventKeyboardSubmit(){return!0}get inputFields(){return[this._container]}get contentElement(){return this._container}onChange(t){return new Promise(((a,i)=>{if(e.CustomEventUtils.isInstanceOf(t,ContenteditableChangeEvent)){a(this.value=t.detail.html),this._selectionChangeHandler(t)}else a(this.value)}))}_fixRangeMarkup(){const t=this.range,a=e=>{e.childNodes.forEach((e=>a(e))),s(e)&&"SPAN"===e.tagName?Element.prototype.replaceWith.apply(e,Array.from(e.childNodes)):e instanceof HTMLElement&&e.removeAttribute("style")};e.Utils.isNull(t)||(e=>{let t=e;s(t)||(t=e.parentElement),a(t)})(t.commonAncestorContainer)}_ensureInteractiveMarkup(){const t=this._container,a=t.childNodes,i=a.length;if(0==i||t.innerHTML===n)t.innerHTML=n;else{let t,n;const s=e=>{n.setEndAfter(e);const t=document.createElement("p");n.surroundContents(t)};for(let r=0;r<i;r++)t=a.item(r),t instanceof Element?n&&(s(t.previousSibling),n=null):e.Utils.isNull(n)&&(n=document.createRange(),n.setStartBefore(t));e.Utils.isNull(n)||s(t)}}_updateHistory(){__classPrivateFieldGet(this,a,"f").push(this.value),this._fireHistoryChange()}acceptValue(t){e.Utils.isNull(this._container)||t==this._container.innerHTML||(this._container.innerHTML=t)}viewActivatedCallback(){super.viewActivatedCallback();const t=this._container;__classPrivateFieldSet(this,a,new e.HistoryService(this.value),"f"),t.addEventListener("blur",this._blurHandler,!1),t.addEventListener("keydown",this._shortcutHandler,!1),t.addEventListener("focus",this._focusHandler,!1),t.addEventListener("input",this._inputHandler,!1),t.addEventListener("paste",this._pasteHandler,!1),document.addEventListener("selectionchange",this._selectionChangeHandler,!1)}disconnectedCallback(){document.removeEventListener("selectionchange",this._selectionChangeHandler,!1);const t=this._container;e.Utils.isNull(t)||(t.removeEventListener("keydown",this._shortcutHandler,!1),t.removeEventListener("blur",this._blurHandler,!1),t.removeEventListener("focus",this._focusHandler,!1),t.removeEventListener("input",this._inputHandler,!1),t.removeEventListener("paste",this._pasteHandler,!1)),super.disconnectedCallback()}getViewValue(e){return e}};a=new WeakMap,__decorate([e.ViewChild("div[pacem]")],r.prototype,"_container",void 0),__decorate([e.ViewChild("div[dashboard]")],r.prototype,"_dashboard",void 0),__decorate([e.Watch()],r.prototype,"range",void 0),__decorate([e.Debounce(500)],r.prototype,"_updateHistory",null),r=__decorate([e.CustomElement({tagName:e.P+"-contenteditable",shadow:e.Defaults.USE_SHADOW_ROOT,template:`<div class="${e.PCSS}-contenteditable ${e.PCSS}-viewfinder">\n <div contenteditable="true" role="presenter" pacem></div>\n</div>${t.CHAR_COUNTER_CHILD}\n<div dashboard>\n <${e.P}-content></${e.P}-content>\n</div>`})],r),t.PacemContenteditableElement=r}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){const a={convert:(t,a)=>/\{.+\}/.test(t)?e.PropertyConverters.Json.convert(t):e.PropertyConverters.String.convert(t),convertBack:(t,a)=>"string"==typeof t?t:e.PropertyConverters.Json.convertBack(t,a)};let i=class PacemDatetimePickerElement extends t.PacemBaseElement{constructor(){super(),this.precision="day",this._months=[],this._dates=[],this._a24=[],this._a60=[],this._years=[],this.hours="00",this.minutes="00",this.seconds="00"}get inputFields(){return[this._yearel,this._monthel,this._dateel,this._hourel,this._minel,this._secel]}toggleReadonlyView(e){this._allFields.hidden=e}convertValueAttributeToProperty(t){return e.PropertyConverters.Datetime.convert(t)}connectedCallback(){super.connectedCallback();const t=new Date;let a=this.year=t.getFullYear();this.min=new Date(a-100,0,1),this.max=new Date(a+10,11,31),this.month=t.getMonth();let i=[],n=[],s=[],r=e.Utils.leftPad;for(let t=0;t<12;t++){let n=new Date(a,t,1),s=n.toLocaleString(e.Utils.lang(this),{month:"short"});i.push({value:t,date:n,label:s})}this._months=i;for(let e=0;e<24;e++)n.push(r(e,2,"0"));this._a24=n;for(let e=0;e<60;e++)s.push(r(e,2,"0"));this._a60=s}propertyChangedCallback(t,a,i,n){switch(super.propertyChangedCallback(t,a,i,n),t){case"dateValue":this.log(e.Logging.LogLevel.Log,`dateValue changed from ${a} to ${i}`),this._disassembleDate(i);break;case"min":case"max":e.Utils.isNullOrEmpty(this.min)||e.Utils.isNullOrEmpty(this.max)||this._setupYears();break;case"year":case"month":this._buildupDates();break;case"date":case"hours":case"minutes":case"seconds":this._buildup()}}acceptValue(t){this.dateValue=e.Utils.parseDate(t)}_disassembleDate(t){if(!t)return void(this.date=void 0);"string"==typeof t&&(t=e.Utils.parseDate(t));const a=t=>e.Utils.leftPad(t,2,"0");this.year=t.getFullYear(),this.month=t.getMonth(),this.date=t.getDate(),this.hours=a(t.getHours()),this.minutes=a(t.getMinutes()),this.seconds=a(t.getSeconds())}_setupYears(){let t=[];const a=e.Utils.parseDate(this.min),i=e.Utils.parseDate(this.max);for(let e=a.getFullYear();e<=i.getFullYear();e++)t.push(e);this._years=t}onChange(e){return new Promise(((e,t)=>{e(this.value=this._computeValue())}))}_buildupDates(t){t&&t.stopPropagation();const a=this,i={weekday:"short",day:"numeric"},n=e=>{try{let t=+a.month;return new Date(+a.year,+a.month,e).getMonth()==t}catch(e){return!1}};var s=[];if(!e.Utils.isNullOrEmpty(a.year)&&!e.Utils.isNullOrEmpty(a.month)){let t=1;do{let n=new Date(+a.year,+a.month,t),r=n.toLocaleString(e.Utils.lang(this),i);s.push({value:t,date:n,label:r,disabled:n<this.min||n>this.max})}while(n(++t))}this._dates=s,n(+this.date)?this._buildup():this.date=""}_computeValue(){const t=this;if(e.Utils.isNullOrEmpty(t.year)||e.Utils.isNullOrEmpty(t.month)||e.Utils.isNullOrEmpty(t.date))return null;try{let e=new Date(+t.year,+t.month,+t.date);return e.setHours(+t.hours),e.setMinutes(+t.minutes),e.setSeconds(+t.seconds),e.setMilliseconds(0),Number.isNaN(e.valueOf())?null:e}catch(e){return null}}_buildup(e){e&&e.stopPropagation(),this.dateValue=this._computeValue()}getViewValue(t){const a=t;return a?e.Utils.core.date(a,this.format||("day"!=this.precision?"full":"short"),e.Utils.lang(this)):""}};__decorate([e.ViewChild("."+e.PCSS+"-datetime-picker-year > "+e.P+"-select")],i.prototype,"_yearel",void 0),__decorate([e.ViewChild("."+e.PCSS+"-datetime-picker-month > "+e.P+"-select")],i.prototype,"_monthel",void 0),__decorate([e.ViewChild("."+e.PCSS+"-datetime-picker-date > "+e.P+"-select")],i.prototype,"_dateel",void 0),__decorate([e.ViewChild("."+e.PCSS+"-datetime-picker-hours > "+e.P+"-select")],i.prototype,"_hourel",void 0),__decorate([e.ViewChild("."+e.PCSS+"-datetime-picker-minutes > "+e.P+"-select")],i.prototype,"_minel",void 0),__decorate([e.ViewChild("."+e.PCSS+"-datetime-picker-seconds > "+e.P+"-select")],i.prototype,"_secel",void 0),__decorate([e.ViewChild(`div.${e.PCSS}-datetime-picker-fields`)],i.prototype,"_allFields",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Datetime})],i.prototype,"dateValue",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Datetime})],i.prototype,"min",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Datetime})],i.prototype,"max",void 0),__decorate([e.Watch({converter:e.PropertyConverters.String})],i.prototype,"precision",void 0),__decorate([e.Watch({emit:!1,converter:a})],i.prototype,"format",void 0),__decorate([e.Watch()],i.prototype,"_dates",void 0),__decorate([e.Watch()],i.prototype,"_years",void 0),__decorate([e.Watch()],i.prototype,"year",void 0),__decorate([e.Watch()],i.prototype,"month",void 0),__decorate([e.Watch()],i.prototype,"date",void 0),__decorate([e.Watch()],i.prototype,"hours",void 0),__decorate([e.Watch()],i.prototype,"minutes",void 0),__decorate([e.Watch()],i.prototype,"seconds",void 0),__decorate([e.Debounce(10)],i.prototype,"_buildup",null),i=__decorate([e.CustomElement({tagName:e.P+"-datetime-picker",shadow:e.Defaults.USE_SHADOW_ROOT,template:`<div class="${e.PCSS}-datetime-picker">\n <div class="${e.PCSS}-datetime-picker-fields ${e.PCSS}-viewfinder">\n\n <div class="${e.PCSS}-datetime-picker-year">\n <${e.P}-select value="{{ :host.year, twoway }}" placeholder="..." datasource="{{ :host._years }}">\n </${e.P}-select></div>\n\n <div class="${e.PCSS}-datetime-picker-month">\n <${e.P}-select value="{{ :host.month, twoway }}" placeholder="..." value-property="value" text-property="label" datasource="{{ :host._months }}">\n </${e.P}-select></div>\n\n <div class="${e.PCSS}-datetime-picker-date">\n <${e.P}-select value="{{ :host.date, twoway }}" placeholder="..." value-property="value" text-property="label" datasource="{{ :host._dates }}">\n </${e.P}-select></div>\n\n <${e.P}-panel class="${e.PCSS}-datetime-picker-hours" hide="{{ :host.precision === 'day' }}">\n <${e.P}-select value="{{ :host.hours, twoway }}" datasource="{{ :host._a24 }}">\n </${e.P}-select></${e.P}-panel>\n\n <${e.P}-panel class="${e.PCSS}-datetime-picker-minutes" hide="{{ :host.precision === 'day' }}">\n <${e.P}-select value="{{ :host.minutes, twoway }}" datasource="{{ :host._a60 }}">\n </${e.P}-select></${e.P}-panel>\n\n <${e.P}-panel class="${e.PCSS}-datetime-picker-seconds" hide="{{ :host.precision !== 'second' }}">\n <${e.P}-select value="{{ :host.seconds, twoway }}" datasource="{{ :host._a60 }}">\n </${e.P}-select></${e.P}-panel>\n\n </div>\n <${e.P}-panel class="${e.PCSS}-datetime-picker-preview" hide="{{ Pacem.Utils.isNullOrEmpty(:host.dateValue) || :host.precision === 'day' || :host.readonly }}">\n <dl>\n <dt>local:</dt><dd><${e.P}-text text="{{ :host.viewValue }}"></${e.P}-text></dd>\n <dt>iso:</dt><dd><${e.P}-text text="{{ (:host.dateValue && :host.dateValue.toISOString()) || '' }}"></${e.P}-text></dd>\n </dl>\n </${e.P}-panel>\n <${e.P}-span class="${e.PCSS}-readonly" css-class="{{ { 'date': :host.precision === 'day', 'datetime': :host.precision !== 'day' } }}" content="{{ :host.viewValue }}" hide="{{ !:host.readonly }}"></${e.P}-span>\n</div>`})],i),t.PacemDatetimePickerElement=i}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(a){function i(e){return new RegExp(e).source}let n=class PacemFormFieldElement extends t.PacemElement{constructor(t=new e.MarkdownService){super(),this._md=t,this._entityPropertyChangeHandler=t=>{this.dispatchEvent(new e.PropertyChangeEvent({propertyName:"entity",currentValue:this.entity}))},this._labelClickHandler=e=>{document.getElementById(this._label.htmlFor).focus()},this._key="_"+e.Utils.uniqueCode()}get key(){return this._key}get fetcher(){return this._fetcher}get field(){return this._field}viewActivatedCallback(){super.viewActivatedCallback(),this._buildUpForm(),this._buildUpFetcher()}propertyChangedCallback(t,a,i,n){switch(super.propertyChangedCallback(t,a,i,n),t){case"readonly":this._ensureBalloon();break;case"metadata":this._ensureBalloon(),this._buildUpLabel(),this._buildUpField();break;case"entity":a instanceof HTMLElement&&a.removeEventListener(e.PropertyChangeEventName,this._entityPropertyChangeHandler,!1),i instanceof HTMLElement&&i.addEventListener(e.PropertyChangeEventName,this._entityPropertyChangeHandler,!1)}}disconnectedCallback(){this.entity instanceof HTMLElement&&this.entity.removeEventListener(e.PropertyChangeEventName,this._entityPropertyChangeHandler,!1),e.Utils.isNull(this._label)||this._label.removeEventListener("click",this._labelClickHandler,!1),e.Utils.isNull(this._balloon)||this._balloon.remove(),super.disconnectedCallback()}_normalizeTooltip(){const e=this.metadata&&this.metadata.extra&&this.metadata.extra.tooltip||!1;return"object"==typeof e?e:{type:e}}_ensureBalloon(){var a,i;const n=this.readonly||!1===(i=this._normalizeTooltip()).type||e.Utils.isNullOrEmpty(a=this.metadata&&this.metadata.display&&this.metadata.display.description);if(e.Utils.isNull(this._balloon)&&!n){let a=document.createElement(e.P+"-balloon");a.options={behavior:t.UI.BalloonBehavior.Tooltip,trigger:i.trigger||t.UI.BalloonTrigger.Hover,position:i.position||t.UI.BalloonPosition.Top,hoverDelay:200,hoverTimeout:50,align:i.align||t.UI.BalloonAlignment.Auto},e.Utils.addClass(a,e.PCSS+"-field-tooltip"),e.CustomElementUtils.findAncestorShell(this).appendChild(this._balloon=a)}const s=this._balloon;if(!(e.Utils.isNull(s)||(s.target=this._label,s.disabled=n))){const e=a||"";switch(i.type){case"md":case"markdown":s.innerHTML=this._md.toHtml(e);break;case"html":s.innerHTML=e;break;default:s.innerText=e}}}_buildUpLabel(){var t;const a=this._label,i=a.firstElementChild;let n=this.metadata;a.htmlFor=this._key,e.Utils.addClass(a,e.PCSS+"-label");const s=this.metadata.validators;if(s&&s.find((e=>"required"===e.type))?e.Utils.addClass(a,e.PCSS+"-required"):e.Utils.removeClass(a,e.PCSS+"-required"),e.Utils.isNull(this._balloon)||this._balloon.disabled?e.Utils.removeClass(a,e.PCSS+"-tooltip"):e.Utils.addClass(a,e.PCSS+"-tooltip"),"function"==typeof(null===(t=n.display)||void 0===t?void 0:t.name)){const e=n.display.name(this,":host",":host.entity","::_form");i.setAttribute("content",e.contentAttr)}else i.removeAttribute("content"),i.content=n.display&&n.display.name||n.prop;a.setAttribute("id","label"+this._key),a.addEventListener("click",this._labelClickHandler,!1)}_isValueNullOrEmpty(t=this.entity,a=this.metadata){return e.Utils.isNullOrEmpty(t&&a&&t[a.prop])}_handleValueChange(t){if("value"===t.detail.propertyName){const a=t.detail.currentValue,i=this.metadata.prop;if(this.entity instanceof HTMLElement){let t=e.CustomElementUtils.camelToKebab(i);e.Utils.isNullOrEmpty(a)?this.entity.removeAttribute(t):this.entity.setAttribute(t,a.toString())}else this.entity[i]=a}}_adjustDependencyValue(t){return e.Utils.Dates.isDate(t)?e.Utils.Dates.parse(t).toISOString():t}_broadcastFetchResult(e){this.dispatchEvent(new CustomEvent("fetch",{detail:e,bubbles:!0,cancelable:!1}))}_buildUpFetcher(){var e=this._fetcher;e.setAttribute("id","fetch"+this._key),e.setAttribute("on-fetchresult",":host._broadcastFetchResult($event.detail)")}_buildUpForm(){this._form.setAttribute("id","form"+this._key)}_buildUpField(){var t,n,s,r,o,l,d,c,h,p,u,m,v,_;this._field&&this._field.remove(),this._fetcher.removeAttribute("parameters"),this._fetcher.result=this._fetcher.url=null;for(var g=this._validators.children.length-1;g>=0;g--)this._validators.children[g].remove();var y=this.metadata;let f=e.P+"-input-text",P=e.P+(y.display&&"slider"===y.display.ui?"-slider":"-input-number"),C={id:this._key,name:y.prop,readonly:"{{ :host.readonly || :host.metadata.isReadOnly || ::_form.readonly }}",value:`{{ :host.entity.${y.prop}, twoway }}`,placeholder:`${y.display&&y.display.watermark||""}`},b=y.extra||{},E={},S="false",w="",$="",k="",U=[];if(!e.Utils.isNullOrEmpty(b.dependsOn))if("function"==typeof b.dependsOn){const I=b.dependsOn(this,":host",":host.entity","$this.entity"),W=I.hideAttr;if(e.Utils.isNullOrEmpty(W)||this.setAttribute("hide",W),e.Utils.isNullOrEmpty(I.disabledAttr)||(S=I.disabledAttr,e.CustomElementUtils.isBindingAttribute(S)&&($=e.CustomElementUtils.extractBindingAttributeExpression(S))),!e.Utils.isNullOrEmpty(I.parameterAttrs)){const B=I.parameterAttrs,R=[];for(let M in B){const q=B[M];R.push(`${M}: ${q}`),U.push({prop:q})}k=R.join(", ")}}else{U=b.dependsOn;let z={empty:[],notEqual:{}},j={empty:[],notEqual:{}},G=[],J=[];for(var N of U){let K=":host.entity."+N.prop,X="$this.entity."+N.prop;if(e.Utils.isNullOrEmpty(N.value)){if(!N.optional){let Z=e=>"$pacem.isNullOrEmpty("+e+")";z.empty.push(Z(K)),N.hide&&j.empty.push(Z(X))}}else{let Q=e=>e+" !== "+JSON.stringify(N.value);(z.notEqual[K]=z.notEqual[K]||[]).push(Q(K)),N.hide&&(j.notEqual[X]=j.notEqual[X]||[]).push(Q(X))}J.push(K),G.push(`${N.alias||N.prop}: :host._adjustDependencyValue(${K})`),N.optional||(w+=`!$pacem.isNullOrEmpty(${K}) && `)}k=G.join(", ");let Y=t=>{let a="false",i="false";if(!e.Utils.isNullOrEmpty(t.notEqual)){const e=[];for(let a in t.notEqual)e.push("("+t.notEqual[a].join(" && ")+")");a="("+e.join(" || ")+")"}return e.Utils.isNullOrEmpty(t.empty)||(i="("+t.empty.join(" || ")+")"),a+" || "+i};$=Y(z),S=`{{ ${$} }}`,this.setAttribute("hide",`{{ ${Y(j)} }}`)}const x="fn",V=this[x]=this[x]||{},O=(t=[])=>{let a=(U||[]).map((e=>":host.entity."+e.prop)).join(", ");const i="fn"+e.Utils.uniqueCode();if("function"==typeof t)V[i]=t;else{if(!e.Utils.isArray(t))throw"Unsupported source format.";V[i]=()=>t}return`{{ :host.${x}.${i}(${a}) }}`},D=new DocumentFragment;let A;if("function"==typeof y.type){var T=y.type(this,":host",":host.entity");if(-1===T.tagName.indexOf("-"))this.log(e.Logging.LogLevel.Error,`${f} is not an allowed form-field`);else{function ee(t,a){if(!e.Utils.isNullOrEmpty(a))for(let i of a){if(-1===i.tagName.indexOf("-")){this.log(e.Logging.LogLevel.Error,`${i.tagName} is not an allowed child element for form-field ${f}`);continue}const a=document.createElement(i.tagName);if(!e.Utils.isNullOrEmpty(i.attrs))for(let e in i.attrs){const t=i.attrs[e];a.setAttribute(e,t)}e.Utils.isNullOrEmpty(i.children)||ee(a,i.children),t.appendChild(a)}}f=T.tagName,e.Utils.extend(C,T.attrs||{}),ee(D,T.children)}}else switch(A=y.display&&y.display.ui){case"contentEditable":console.warn("`contentEditable` ui hint is deprecated. Lean on `dataType` equal to 'HTML' instead."),f=e.P+"-contenteditable",D.append(a.ContenteditableUtils.getDefaultDashboard());break;case"snapshot":f=e.P+"-snapshot",b.width>0&&(C.width=""+b.width),b.height>0&&(C.height=""+b.height),b.quality>=0&&(C.quality=""+b.quality);break;case"oneToMany":case"dropdown":case"radioList":case"checkboxList":case"manyToMany":"oneToMany"===A||"dropdown"===A?(f=e.P+"-select",C["on-wheel"]="$event.preventDefault()"):(delete C.placeholder,f=e.P+("radioList"===A?"-radio-list":"-checkbox-list")),e.Utils.isNullOrEmpty(b.textProperty)||(C["text-property"]=b.textProperty),e.Utils.isNullOrEmpty(b.disabledProperty)||(C["disabled-property"]=b.disabledProperty),e.Utils.isNullOrEmpty(b.valueProperty)||(y.isComplexType?C["compare-by"]=b.valueProperty:C["value-property"]=b.valueProperty),e.Utils.isNullOrEmpty(b.source)?(this._fetcher.id=`fetch${this._key}`,this._fetcher.url=b.sourceUrl,this._fetcher.method=b.verb,E.parameters=`{{ { ${k} } }}`,E.disabled=S,C.datasource=`{{ ${w}Pacem.Utils.getApiResult(#fetch${this._key}.result) || null }}`):C.datasource=O(b.source);break;case"suggest":case"tags":case"autocomplete":const te="tags"===y.display.ui;f=e.P+(te?"-tags":"-suggest"),this._fetcher.id=`fetch${this._key}`,e.Utils.isNullOrEmpty(b.textProperty)||(C["text-property"]=b.textProperty);let ae=`#${this._key}.value`;if(e.Utils.isNullOrEmpty(b.valueProperty)||(C["compare-by"]=b.valueProperty,te?ae=`(${ae} && ${ae}.${b.valueProperty}) || ''`:y.isComplexType?ae+=` && ${ae}.${b.valueProperty}`:C["value-property"]=b.valueProperty),e.Utils.isNullOrEmpty(b.sourceUrl)?C.datasource=O(b.source):(E.url=`${b.sourceUrl}`,this._fetcher.method=b.verb,e.Utils.isNullOrEmpty(b.dependsOn)?E.parameters=`{{ {q: #${this._key}.hint || '', ${b.valueProperty||"value"}: ${ae} || '' } }}`:(E.parameters=`{{ { ${k}, q: #${this._key}.hint || '', ${b.valueProperty||"value"}: ${ae} || '' } }}`,E.disabled=S),C.datasource=`{{ ${w}Pacem.Utils.getApiResult(#fetch${this._key}.result) || null }}`),te)C["allow-new"]=(!0===y.extra.allowNew).toString(),C["allow-duplicates"]=(!0===y.extra.allowDuplicates).toString();else{if(e.Utils.isNullOrEmpty(b.disabledProperty)||(C["disabled-property"]=b.disabledProperty),!e.Utils.isNullOrEmpty(b.itemtemplate)){const se=b.itemtemplate;se instanceof HTMLElement?(C.itemtemplate="{{ #"+(se.id=se.id||this._key+"_itemtmpl")+" }}",se.isConnected||this.append(se)):C.itemtemplate=se}if(!e.Utils.isNullOrEmpty(b.filterFields)){const re=b.filterFields;C["filter-fields"]=e.Utils.isArray(re)?re.join(" "):re}e.Utils.isNullOrEmpty(b.maxSuggestions)||(C["max-suggestions"]=b.maxSuggestions.toString())}break;case"calendar":f=e.P+"-calendar-picker";const ie=null!==(n=null===(t=y.display)||void 0===t?void 0:t.format)&&void 0!==n?n:null===(s=y.extra)||void 0===s?void 0:s.format;e.Utils.isNullOrEmpty(ie)||(C.format="{{ "+JSON.stringify(ie)+" }}"),e.Utils.isNullOrEmpty(b.disabledRanges)||(C["disabled-ranges"]="{{ "+JSON.stringify(b.disabledRanges)+" }}");break;case"dictionary":f=e.P+"-namevalue-list",C.dictionary="true";break;case"switcher":if("boolean"!==(y.type||"").toLowerCase())break;C.class="checkbox-switch";default:let ne=(y.dataType||y.type||"").toLowerCase();switch(ne){case"upload":f=e.P+"-upload";let oe=y.extra||{};C.url=oe.uploadUrl,C.parallelism=""+oe.parallelism,C["chunk-size"]=""+oe.chunkSize,C["max-image-width"]=""+oe.maxImageWidth,C["max-image-height"]=""+oe.maxImageHeight;break;case"html":f=e.P+"-contenteditable",D.append(a.ContenteditableUtils.getDefaultDashboard());break;case"enumeration":f=e.P+"-radio-list",C.class=e.PCSS+"-radio-list",C["value-property"]="value",C["text-property"]="caption",C.datasource="{{ "+JSON.stringify(y.extra.enum)+" }}",delete C.placeholder;break;case"password":f=e.P+"-input-password";break;case"emailaddress":f=e.P+"-input-email";break;case"color":f=e.P+"-input-color";break;case"time":case"date":case"datetime":f=e.P+"-datetime-picker",delete C.placeholder,"datetime"===ne&&(C.precision="minute");const le=null!==(o=null===(r=y.display)||void 0===r?void 0:r.format)&&void 0!==o?o:null===(l=y.extra)||void 0===l?void 0:l.format;e.Utils.isNullOrEmpty(le)||(C.format="{{ "+JSON.stringify(le)+" }}"),e.Utils.isNullOrEmpty(b.disabledRanges)||(C["disabled-ranges"]="{{ "+JSON.stringify(b.disabledRanges)+" }}");break;case"url":f=e.P+"-input-url";break;case"phonenumber":f=e.P+"-input-tel";break;case"multilinetext":f=e.P+"-textarea";break;case"markdown":f=e.P+"-textarea-markdown";break;case"latlng":f=e.P+"-latlng",e.Utils.isNullOrEmpty(y.extra)||"object"!=typeof y.extra||e.Utils.isArray(y.extra)||(C.options=JSON.stringify(y.extra));break;case"percent":case"percentage":case"currency":let de="currency"===ne?{style:"currency",currency:"EUR"}:{style:"percent",maximumFractionDigits:2},ce=null!==(c=null===(d=y.display)||void 0===d?void 0:d.format)&&void 0!==c?c:de;C.format=JSON.stringify(ce);default:switch((y.type||"").toLowerCase()){case"boolean":f=e.P+"-checkbox",C["true-value"]="{{ true }}",C["false-value"]="{{ false }}",C.caption=C.placeholder,delete C.placeholder;break;case"byte":C.min="0",C.max="255";case"int16":case"int32":case"int64":case"short":case"integer":case"int":case"long":C.step=""+(null!==(p=null===(h=y.extra)||void 0===h?void 0:h.step)&&void 0!==p?p:"1"),f=P;const he=null===(u=y.display)||void 0===u?void 0:u.format;e.Utils.isNullOrEmpty(he)||(C.format=JSON.stringify(he));break;case"double":case"decimal":case"float":case"single":case"number":f=P,C.step=""+(null!==(v=null===(m=y.extra)||void 0===m?void 0:m.step)&&void 0!==v?v:"any");const pe=null===(_=y.display)||void 0===_?void 0:_.format;e.Utils.isNullOrEmpty(pe)||(C.format=JSON.stringify(pe));break;default:if(("array"===y.type||"object"===y.type)&&!e.Utils.isNullOrEmpty(y.props)){if(f=e.P+"-childform",delete C.placeholder,C.metadata=e.Utils.Json.stringify(y.props,{functions:e.JsonFunctionConversion.Reference}),C.mode=y.type,C["lock-items"]=""+(y.extra&&y.extra.lockItems||!1),C.logger="{{ :host.logger }}",!e.Utils.isNullOrEmpty(U)){var H="";for(let ue of U)H+=`<${e.P}-childform-propagator model="${C.value}" watch="{{ :host.entity.${ue.prop} }}" property="${ue.alias||ue.prop}"></${e.P}-childform-propagator>\n`;this._container.innerHTML=H}C["fetch-credentials"]="{{ :host.fetchCredentials }}",C["fetch-headers"]="{{ :host.fetchHeaders }}"}}}}if(!e.Utils.isNullOrEmpty(y.commands)){e.Utils.addClass(this._container,e.PCSS+"-fieldgroup");const me=this._container.appendChild(document.createElement("div")),ve=this._container.appendChild(document.createElement("div"));e.Utils.addClass(me,`fieldgroup-prepend ${e.PCSS}-buttonset buttons`),e.Utils.addClass(ve,`fieldgroup-append ${e.PCSS}-buttonset buttons`);const _e=$||"false";y.commands.forEach((t=>{const a=document.createElement(e.P+"-button");a.setAttribute("icon-glyph",t.icon),a.setAttribute("command-name",t.name),t.dependsOnValue?(a.setAttribute("disabled",`{{ (${_e}) || !::_form.valid || $pacem.isNullOrEmpty(:host.entity.${y.prop}) }}`),a.setAttribute("command-argument",`{{ :host.entity.${y.prop} }}`)):a.setAttribute("disabled",S),a.setAttribute("tooltip",t.tooltip),e.Utils.isNullOrEmpty(t.cssClass)||e.Utils.addClass(a,t.cssClass.join(" ")),(t.prepend?me:ve).appendChild(a)}))}e.Utils.isNullOrEmpty(y.validators)||y.validators.forEach((t=>{var n,s={},r={};switch(function(e){return"errorMessage"in e}(t)&&(s=t.params||{},r["error-message"]=t.errorMessage),function(e){return"attributes"in e&&"function"==typeof e.attributes}(t)&&(r=t.attributes(this,":host",":host.entity")),t.type){case"required":C.required="true",n=new a.PacemRequiredValidatorElement;break;case"length":let o=new a.PacemLengthValidatorElement;n=o;let l=s&&s.max,d=s&&s.min;null!=l?C.maxlength=""+(o.max=l):"max"in r&&(C.max=r.max),null!=d?C.minlength=""+(o.min=d):"min"in r&&(C.minlength=r.min);break;case"range":let c=new a.PacemRangeValidatorElement;n=c;let h=s&&s.max,p=s&&s.min,u=f===e.P+"-datetime-picker";null!=h?(c.max=h,C.max="{{ "+(u?"'"+h+"'":h)+" }}"):"max"in r&&(C.max=r.max),null!=p?(c.min=p,C.min="{{ "+(u?"'"+p+"'":p)+" }}"):"min"in r&&(C.min=r.min);break;case"email":let m=new a.PacemRegexValidatorElement;n=m,C.pattern=i(m.pattern=/^[\w\-\.]+@[\w\-\.]+\.[a-zA-Z0-9]{2,6}$/);break;case"regex":let v=new a.PacemRegexValidatorElement;n=v;let _=s.pattern;_||(_=r.pattern),C.pattern=i(_),v.pattern=_;break;case"binary":let g=new a.PacemBinaryValidatorElement;n=g;let P=s.pattern;null!=P?(C.pattern=i(P),g.pattern=P):"pattern"in r&&(C.pattern=r.pattern);let b=s&&s.maxSize;null!=b?(g.maxSize=b,C["max-size"]=""+b):"max-size"in r&&(C["max-size"]=r["max-size"]);break;case"compare":let E=new a.PacemCompareValidatorElement;n=E;let S="";if("value"in s)S=JSON.stringify(s.value);else{S=`:host.entity.${"to"in s?s.to:s.toProperty}`}const w=`{{ ${S} }}`;E.setAttribute("to",w);let $=E.operator=s.operator||r.operator||"equal";if(f===e.P+"-datetime-picker")switch($){case"lessOrEqual":case"less":C.max=w;break;case"greaterOrEqual":case"greater":C.min=w}break;case"async":let k=new a.PacemAsyncValidatorElement;n=k,k.url=s.url;let N=[],x=s.dependsOn||U;N.push(`${y.prop}: :host._adjustDependencyValue(:host.entity.${y.prop})`);for(let e of x||[])N.push(`${e.alias||e.prop}: :host._adjustDependencyValue(:host.entity.${e.prop})`);k.setAttribute("parameters",`{{ { ${N.join(", ")} } }}`),k.method=s.verb||e.Net.HttpMethod.Get,k.setAttribute("fetch-credentials","{{ :host.fetchCredentials }}"),k.setAttribute("fetch-headers","{{ :host.fetchHeaders }}");break;case"custom":n=new a.PacemCustomValidatorElement;break;default:if(!e.Utils.isNullOrEmpty(t.type)&&t.type.indexOf("-")>0){const e=t.type,i=document.createElement(e);i instanceof a.PacemBaseValidatorElement&&(n=i)}}if(e.Utils.isNull(n))throw`Cannot generate a formfield validator based on type: ${t.type}.`;n.watch=y.prop,n.setAttribute("hide","{{ !this.invalid }}"),n.setAttribute("disabled",S);for(let e in r)n.setAttribute(e,r[e]);this._validators.appendChild(n)}));let L=document.createElement(f);for(var F in C){let ge;e.Utils.isNullOrEmpty(ge=C[F])||L.setAttribute(F,ge)}for(var F in L.append(D),this._field=L,this._container.insertBefore(L,this._container.firstElementChild),E){let ye;e.Utils.isNullOrEmpty(ye=E[F])||this._fetcher.setAttribute(F,ye)}this.dispatchEvent(new e.PropertyChangeEvent({propertyName:"field",currentValue:L}))}};__decorate([e.ViewChild("label")],n.prototype,"_label",void 0),__decorate([e.ViewChild(`div.${e.PCSS}-input-container`)],n.prototype,"_container",void 0),__decorate([e.ViewChild(e.P+"-fetch")],n.prototype,"_fetcher",void 0),__decorate([e.ViewChild(e.P+"-form")],n.prototype,"_form",void 0),__decorate([e.ViewChild(e.P+"-panel."+e.PCSS+"-validators")],n.prototype,"_validators",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Json})],n.prototype,"metadata",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Json})],n.prototype,"fetchHeaders",void 0),__decorate([e.Watch({converter:e.PropertyConverters.String})],n.prototype,"fetchCredentials",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Boolean})],n.prototype,"readonly",void 0),__decorate([e.Watch()],n.prototype,"entity",void 0),n=__decorate([e.CustomElement({tagName:e.P+"-form-field",template:`<${e.P}-form class="${e.PCSS}-field" logger="{{ :host.logger }}" \ncss-class="{{ {'${e.PCSS}-fetching': ::_fetcher.fetching, '${e.PCSS}-dirty': this.dirty, '${e.PCSS}-invalid': !this.valid, '${e.PCSS}-editable': !:host.readonly, '${e.PCSS}-readonly': :host.readonly, '${e.PCSS}-pristine': !this.dirty, '${e.PCSS}-valid': this.valid, '${e.PCSS}-has-value': !:host._isValueNullOrEmpty(:host.entity, :host.metadata) } }}">\n <label class="${e.PCSS}-label"><${e.P}-span></${e.P}-span></label>\n <div class="${e.PCSS}-input-container"></div>\n <${e.P}-fetch debounce="300" logger="{{ :host.logger }}" credentials="{{ :host.fetchCredentials }}" headers="{{ :host.fetchHeaders }}" diff-by-values="true"\n on-fetchresult=":host._broadcastFetchResult($event.detail)"></${e.P}-fetch>\n <${e.P}-panel class="${e.PCSS}-validators" hide="{{ ::_form.valid || !::_form.dirty || :host.readonly }}"></${e.P}-panel>\n</${e.P}-form>`})],n),a.PacemFormFieldElement=n}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(a){var i,n,s,r,o,l;class HierarchyChangeEvent extends CustomEvent{constructor(e){super("hierarchychange",{detail:e,bubbles:!1,cancelable:!1})}}const d="hierarchy-item",c=d+" "+e.PCSS+"-anim anim-fade-in anim-sudden",h="{{ { 'item-disabled' : ^item.disabled } }}",p="pacemHierarchy",u="item-content",m="item-link",v=m+" icon-rotate rotate-135",_="link",g="item-move",y="drag_indicator",f="parents";let P=class PacemHierarchyElement extends a.PacemBaseElement{getViewValue(e){return""}convertValueAttributeToProperty(t){return e.Utils.Json.parse(t)}constructor(){super(),i.set(this,void 0),n.set(this,new Map),s.set(this,void 0),r.set(this,void 0),o.set(this,new Map),l.set(this,void 0),this.unlinkCaption="Delete",this._binderClickHandler=t=>{const a=t.originalEvent.type;if("mousedown"===a&&1===t.originalEvent.button){e.avoidHandler(t.originalEvent);const a=t.srcElement;this._unlink(a)}else if("click"===a||"contextmenu"===a){e.avoidHandler(t.originalEvent),__classPrivateFieldSet(this,r,t.srcElement,"f");const a=this._balloon;a.target={x:t.pageX,y:t.pageY},a.popup()}},this._dragInitHandler=t=>{let a=t.detail;const i=this._dragger;i.floater=document.createElement("span"),i.dropTargets=Array.from(__classPrivateFieldGet(this,o,"f").keys()).filter((e=>e!==a.element)),e.Utils.isNull(__classPrivateFieldGet(this,s,"f"))||__classPrivateFieldGet(this,s,"f").remove();const n=__classPrivateFieldSet(this,s,new e.Components.UI.PacemBinderElement,"f");n.from=a.element,__classPrivateFieldGet(this,l,"f").appendChild(n)},this._dragStartHandler=t=>{e.Utils.addClass(t.detail.element,"item-drag")},this._dragHandler=e=>{__classPrivateFieldGet(this,s,"f").to=e.detail.currentPosition},this._dragEndHandler=t=>{e.Utils.removeClass(t.detail.element,"item-drag"),__classPrivateFieldGet(this,s,"f").remove(),__classPrivateFieldSet(this,s,null,"f")},this._dropHandler=e=>{const t=e.detail.data,a=__classPrivateFieldGet(this,o,"f").get(e.detail.target);this._isInAncestors(t,a)||this._isInDescendants(t,a)||this._compileHierarchy({source:t,target:a})},this._dragOverHandler=e=>{const t=e.detail.data,a=__classPrivateFieldGet(this,o,"f").get(e.detail.target);(a.disabled||this._isInAncestors(t,a)||this._isInDescendants(t,a))&&e.preventDefault()},this._dragOutHandler=e=>{},this._popoutHandler=e=>{this._balloon.popout()},__classPrivateFieldSet(this,i,e.Utils.uniqueCode(),"f")}get inputFields(){return[]}toggleReadonlyView(t){this._dragger.disabled=t,e.Utils.isNull(this._adaptedDatasource)||this._databind()}onChange(t){return new Promise(((a,i)=>{e.CustomEventUtils.isInstanceOf(t,HierarchyChangeEvent)&&a(this.value=t.detail),a(this.value)}))}acceptValue(e){}viewActivatedCallback(){super.viewActivatedCallback(),__classPrivateFieldSet(this,l,e.CustomElementUtils.findAncestorShell(this),"f"),this._setupItemTemplate(),this._setupDragger(),this._setupBalloon()}propertyChangedCallback(e,t,a,i){switch(super.propertyChangedCallback(e,t,a,i),e){case"datasource":case"textProperty":case"disabledProperty":case"valueProperty":cancelAnimationFrame(this._handle),this._handle=requestAnimationFrame((()=>{this._buildAdaptedDatasource()}));break;case"itemtemplate":i||this._setupItemTemplate();break;case"_adaptedDatasource":case"value":cancelAnimationFrame(this._handle2),this._handle2=requestAnimationFrame((()=>{this._databind()}))}}disconnectedCallback(){this._disposeDragger(),this._disposeBalloon(),super.disconnectedCallback()}_buildAdaptedDatasource(e=this.datasource){this._adaptedDatasource=e&&e.map((e=>this._mapEntityToItem(e)))}_mapEntityToValue(e){let t,a=e;return(t=this.valueProperty)&&(a=e[t]),a}_mapEntityToViewValue(e){let t,a=e.toString();return(t=this.textProperty)&&(a=e[t]),a}_mapEntityToItem(t){if(null==t)throw new Error("Entity cannot be null");let a=!1;const i=this.disabledProperty;return e.Utils.isNullOrEmpty(i)||(a=t[i]||!1),{value:this._mapEntityToValue(t),viewValue:this._mapEntityToViewValue(t),disabled:a,data:t}}_unlink(e){var a;e instanceof t.UI.PacemBinderElement?a=e:(e.preventDefault(),e.stopPropagation(),a=__classPrivateFieldGet(this,r,"f"));const{parent:i,child:n}=JSON.parse(a.dataset[p]),s=this._adaptedDatasource,o=s.find((e=>e.value===i)),l=s.find((e=>e.value===n));o.disabled||l.disabled||this._compileHierarchy({source:o,target:l},!0)}_buildHierarchyItemDomId(e){return`hierarchyitem_${__classPrivateFieldGet(this,i,"f")}_${e}`}_itemCreate(a){const i=a.detail.dom.find((e=>e instanceof HTMLElement&&e.classList.contains(d))),s=(a.detail.index,a.detail.item);i.id=this._buildHierarchyItemDomId(s.value),s.disabled?i.setAttribute("behaviors","{{ [#"+this._dragger2.id+"] }}"):i.setAttribute("behaviors","{{ [#"+this._dragger.id+", #"+this._dragger2.id+"] }}");for(let a of s.parents||[]){const r=new e.Components.UI.PacemBinderElement;r.to=i,r.toAnchor=t.UI.BinderAnchor.Top,r.toEnd=t.UI.BinderEnd.Arrow,r.setAttribute("from","{{ #"+this._buildHierarchyItemDomId(a.value)+" }}"),r.fromAnchor=t.UI.BinderAnchor.Bottom,r.cssClass=["hierarchy-binder"],r.interactive=!this.readonly&&!s.disabled&&!a.disabled,r.addEventListener(t.UI.BinderInteractionEventName,this._binderClickHandler,!1),r.dataset[p]=JSON.stringify({parent:a.value,child:s.value}),__classPrivateFieldGet(this,n,"f").set(s.value,r),__classPrivateFieldGet(this,l,"f").appendChild(r)}__classPrivateFieldGet(this,o,"f").has(i)||__classPrivateFieldGet(this,o,"f").set(i,s)}_itemRemove(e){const a=e.detail.dom.find((e=>e instanceof HTMLElement&&e.classList.contains(d))),i=e.detail.item,s=__classPrivateFieldGet(this,n,"f");if(s.has(i.value)){const e=s.get(i.value);e.removeEventListener(t.UI.BinderInteractionEventName,this._binderClickHandler,!1),e.remove(),s.delete(i.value)}__classPrivateFieldGet(this,o,"f").has(a)&&__classPrivateFieldGet(this,o,"f").delete(a)}_setupItemTemplate(){if(this.itemtemplate instanceof HTMLTemplateElement){const a=this.itemtemplate.cloneNode(!0).content,i=document.createElement("template"),n=document.createElement(e.P+"-panel");n.className=c,n.setAttribute("css-class",h);const s=new t.UI.PacemIconElement;s.setAttribute("icon",y),s.className=g,n.appendChild(s);const r=document.createElement("div");r.className=u,r.append(a),n.appendChild(r);const o=new t.UI.PacemIconElement;o.setAttribute("icon",_),o.className=v,n.appendChild(o),i.content.appendChild(n),this._template=i}else this._template=this._defaultTemplate}_compileHierarchy(t,a=!1){const i=e.Utils.clone(this.value||[]),n=t.source.value,s=t.target.value,r=this.parentsProperty||f;var o=i.find((e=>e[this.valueProperty]===s));if(a){if(!e.Utils.isNull(o)){const e=o[r]||[],t=e.indexOf(n);t>=0&&e.splice(t,1)}}else e.Utils.isNull(o)&&((o={})[this.valueProperty]=s,o[r]=[],i.push(o)),o[r].push(n);this._cleanupHierarchy(i),this.changeHandler(new HierarchyChangeEvent(i))}_cleanupHierarchy(t=[]){const a=this.valueProperty,i=this.parentsProperty||f,n=(s,r)=>{const o=t.find((e=>e[a]==r));if(e.Utils.isNull(o)||e.Utils.isNullOrEmpty(o[i]))return!1;const l=o[i];return l.indexOf(s)>=0||l.some((e=>n(s,e)))};for(let e of t){const t=e[i]||[];for(let e=t.length-1;e>=0;e--){const a=t[e],i=t.filter((e=>e!==a));for(let s of i)if(n(a,s)){t.splice(e,1);break}}}}_setupDragger(){const t=this._dragger;t.id="hierarchy_link_"+__classPrivateFieldGet(this,i,"f"),t.handleSelector="."+m,t.dropBehavior=e.UI.DropBehavior.None,t.spillBehavior=e.UI.DropTargetMissedBehavior.None,t.mode=e.UI.DragDataMode.Copy,t.addEventListener(e.UI.DragDropEventType.Drop,this._dropHandler,!1),t.addEventListener(e.UI.DragDropEventType.Drag,this._dragHandler,!1),t.addEventListener(e.UI.DragDropEventType.Init,this._dragInitHandler,!1),t.addEventListener(e.UI.DragDropEventType.Start,this._dragStartHandler,!1),t.addEventListener(e.UI.DragDropEventType.End,this._dragEndHandler,!1),t.addEventListener(e.UI.DragDropEventType.Over,this._dragOverHandler,!1),t.addEventListener(e.UI.DragDropEventType.Out,this._dragOutHandler,!1);const a=this._dragger2;a.id="hierarchy_move_"+__classPrivateFieldGet(this,i,"f"),a.mode=e.UI.DragDataMode.Self,a.dropBehavior=e.UI.DropBehavior.None,a.spillBehavior=e.UI.DropTargetMissedBehavior.None,a.handleSelector="."+g}_disposeDragger(){const t=this._dragger;e.Utils.isNull(t)||(t.removeEventListener(e.UI.DragDropEventType.Drop,this._dropHandler,!1),t.removeEventListener(e.UI.DragDropEventType.Drag,this._dragHandler,!1),t.removeEventListener(e.UI.DragDropEventType.Init,this._dragInitHandler,!1),t.removeEventListener(e.UI.DragDropEventType.Start,this._dragStartHandler,!1),t.removeEventListener(e.UI.DragDropEventType.End,this._dragEndHandler,!1),t.removeEventListener(e.UI.DragDropEventType.Over,this._dragOverHandler,!1),t.removeEventListener(e.UI.DragDropEventType.Out,this._dragOutHandler,!1))}_setupBalloon(){this._balloon=this._shellProxy.dom.find((e=>e instanceof t.UI.PacemBalloonElement)),window.addEventListener("mousedown",this._popoutHandler,!1)}_disposeBalloon(){window.removeEventListener("mousedown",this._popoutHandler,!1)}_isInAncestors(t,a){return!e.Utils.isNull(a)&&!e.Utils.isNullOrEmpty(a.parents)&&(a.parents.indexOf(t)>=0||a.parents.some((e=>this._isInAncestors(t,e))))}_isInDescendants(e,t){return this._isInAncestors(t,e)}_databind(){this._repeater.datasource=[];const t=this.valueProperty;if(e.Utils.isNullOrEmpty(t))throw new Error("Missing valueProperty.");const a=e.Utils.clone(this._adaptedDatasource||[]),i=this.value||[],n=this.parentsProperty||f;for(let s of a){const r=i.find((e=>e[t]===s.value));e.Utils.isNull(r)||(s.parents=(r[n]||[]).map((e=>a.find((t=>t.value===e)))).filter((t=>!e.Utils.isNull(t))))}this._databindByParents(a)}_databindByParents(t){const a=[];do{if(e.Utils.isNullOrEmpty(a)){const i=t.filter((t=>e.Utils.isNullOrEmpty(t.parents)));a.push(i)}else{const i=Array.prototype.concat.apply([],a),n=a[a.length-1],s=t.filter((t=>!e.Utils.isNullOrEmpty(t.parents)&&(t.parents.every((e=>i.indexOf(e)>=0))&&t.parents.some((e=>n.indexOf(e)>=0)))));a.push(s)}}while(a.reduce(((e,t)=>e+t.length),0)<t.length);this._repeater.datasource=a}};i=new WeakMap,n=new WeakMap,s=new WeakMap,r=new WeakMap,o=new WeakMap,l=new WeakMap,__decorate([e.ViewChild("template[default]")],P.prototype,"_defaultTemplate",void 0),__decorate([e.ViewChild(e.P+"-repeater")],P.prototype,"_repeater",void 0),__decorate([e.ViewChild(e.P+"-drag-drop")],P.prototype,"_dragger",void 0),__decorate([e.ViewChild(e.P+"-drag-drop[move]")],P.prototype,"_dragger2",void 0),__decorate([e.ViewChild(e.P+"-shell-proxy")],P.prototype,"_shellProxy",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Json})],P.prototype,"datasource",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],P.prototype,"valueProperty",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],P.prototype,"textProperty",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],P.prototype,"disabledProperty",void 0),__decorate([e.Watch({converter:e.PropertyConverters.String})],P.prototype,"unlinkCaption",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Json})],P.prototype,"_adaptedDatasource",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Element})],P.prototype,"itemtemplate",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Element})],P.prototype,"_template",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],P.prototype,"parentsProperty",void 0),P=__decorate([e.CustomElement({tagName:e.P+"-hierarchy",shadow:e.Defaults.USE_SHADOW_ROOT,template:`<${e.P}-repeater>\n <template>\n <${e.P}-repeater on-${t.RepeaterItemCreateEventName}=":host._itemCreate($event)" on-${t.RepeaterItemRemoveEventName}=":host._itemRemove($event)" datasource="{{ ^item }}">\n <div class="hierarchy-level">\n <${e.P}-template-proxy target="{{ :host._template }}"></${e.P}-template-proxy>\n </div>\n </${e.P}-repeater>\n </template>\n </div>\n</${e.P}-repeater><${e.P}-content></${e.P}-content>\n<${e.P}-drag-drop></${e.P}-drag-drop>\n<${e.P}-drag-drop move></${e.P}-drag-drop>\n<template default>\n <${e.P}-panel class="${c} item-default" css-class="${h}">\n <${e.P}-icon class="${g}" icon="${y}"></${e.P}-icon>\n <pacem-span class="${u}" content="{{ ^item.viewValue }}"></${e.P}-span>\n <${e.P}-icon class="${v}" icon="${_}"></${e.P}-icon>\n </${e.P}-panel>\n</template>\n<${e.P}-shell-proxy>\n <${e.P}-balloon options="{{ { behavior: Pacem.Components.UI.BalloonBehavior.Inert } }}">\n <${e.P}-button icon-glyph="link_off" class="${e.PCSS}-margin margin-0 button-flat display-flex flex-middle icon-rotate rotate-135"\n on-click=":host._unlink($event)"\n on-mousedown="$event.stopPropagation()"\n on-mouseup="::_balloon.popout()"><${e.P}-text class="${e.PCSS}-margin margin-left-1" text="{{ :host.unlinkCaption }}"></${e.P}-text></${e.P}-button>\n </${e.P}-balloon>\n</${e.P}-shell-proxy>`})],P),a.PacemHierarchyElement=P}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){let a;!function(e){e.Input="input",e.Blur="blur"}(a=t.ChangePolicy||(t.ChangePolicy={}));class PacemBaseInputElement extends t.PacemBaseElement{constructor(){super(...arguments),this.debounce=!1,this.changePolicy=a.Input,this._focusHandler=t=>{this.autoselect&&!e.Utils.isNull(this.inputField)&&this.inputField.select()}}propertyChangedCallback(e,t,a,i){if(super.propertyChangedCallback(e,t,a,i),"placeholder"===e)this.inputField&&this.inputField.setAttribute(e,a)}acceptValue(t){this.inputField&&t!==this.inputField.value&&(this.inputField.value=e.Utils.isNullOrEmpty(t)?"":t)}get inputField(){return this.inputFields[0]}onChange(t){var i=e.DeferPromise.defer();if(this.readonly)i.resolve(this.value);else if("input"===t.type&&this.changePolicy===a.Blur)i.resolve(this.value);else{const e=()=>{const e=this.getValue(this.inputField.value);e!==this.value&&(this.value=e),i.resolve(e)},t=this.debounce;"number"==typeof t&&t>0?(clearTimeout(this._handle),this._handle=setTimeout(e,t)):!0===t?(cancelAnimationFrame(this._handle),this._handle=requestAnimationFrame(e)):requestAnimationFrame(e)}return i.promise}viewActivatedCallback(){super.viewActivatedCallback();let e=this.inputField;e.size=1,e.autocomplete="off",e.addEventListener("input",this.changeHandler,!1),e.addEventListener("focus",this._focusHandler,!1)}disconnectedCallback(){let t=this.inputField;e.Utils.isNull(t)||(t.removeEventListener("focus",this._focusHandler,!1),t.removeEventListener("input",this.changeHandler,!1)),super.disconnectedCallback()}}__decorate([e.Watch({emit:!1,converter:{convert:e=>{switch(e){case"true":return!0;case"false":return!1;default:return parseFloat(e)}},convertBack:e=>e.toString()}})],PacemBaseInputElement.prototype,"debounce",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],PacemBaseInputElement.prototype,"changePolicy",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Boolean})],PacemBaseInputElement.prototype,"autoselect",void 0),t.PacemBaseInputElement=PacemBaseInputElement;class PacemOrdinalInputElement extends PacemBaseInputElement{convertValueAttributeToProperty(e){return parseFloat(e)}propertyChangedCallback(e,t,a,i){switch(super.propertyChangedCallback(e,t,a,i),e){case"min":case"max":case"step":null!=a?this.inputField.setAttribute(e,a):this.inputField.removeAttribute(e)}}}__decorate([e.Watch({converter:e.PropertyConverters.Number})],PacemOrdinalInputElement.prototype,"min",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Number})],PacemOrdinalInputElement.prototype,"max",void 0),__decorate([e.Watch({converter:{convert:e=>{const t=parseFloat(e);return isNaN(t)?"any":t},convertBack:e=>e.toString()}})],PacemOrdinalInputElement.prototype,"step",void 0),t.PacemOrdinalInputElement=PacemOrdinalInputElement;class PacemTextualInputElement extends PacemBaseInputElement{convertValueAttributeToProperty(e){return e}propertyChangedCallback(e,t,a,i){switch(super.propertyChangedCallback(e,t,a,i),e){case"pattern":case"maxlength":case"minlength":null!=a?this.inputField.setAttribute(e,a):this.inputField.removeAttribute(e)}}getValue(t){return e.Utils.isNullOrEmpty(t)?null:t}getViewValue(e){return e}}__decorate([e.Watch({converter:e.PropertyConverters.String})],PacemTextualInputElement.prototype,"pattern",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Number})],PacemTextualInputElement.prototype,"minlength",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Number})],PacemTextualInputElement.prototype,"maxlength",void 0),t.PacemTextualInputElement=PacemTextualInputElement}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){let a=class PacemColorInputElement extends t.PacemBaseElement{acceptValue(e){const t=this._parseValue(e);null!=t&&(this._tint.value=t.tint,this._alpha.value=t.alpha.toString())}convertValueAttributeToProperty(e){return e}onChange(t){const a=this._alpha.valueAsNumber||parseInt(this._alpha.value),i=this._tint.value,n=this.value=this._getValue(i,a);return e.Utils.fromResult(n)}constructor(){super()}toggleReadonlyView(e){this._wrapper.hidden=e,this._span.hidden=!e}_getValue(t,a){if(isNaN(a)||100===a)return t;const i=e.Colors.parse(t);return i.a=.01*a,e.Colors.stringify(i)}_parseValue(t){const a=e.Colors.parse(t);return e.Utils.isNullOrEmpty(a)?null:{tint:e.Colors.stringify({r:a.r,g:a.g,b:a.b}),alpha:100*a.a}}getViewValue(e){return e}get inputFields(){return[this._tint,this._alpha]}};__decorate([e.ViewChild("input[type=color]")],a.prototype,"_tint",void 0),__decorate([e.ViewChild("input[type=number]")],a.prototype,"_alpha",void 0),__decorate([e.ViewChild(`.${e.PCSS}-viewfinder`)],a.prototype,"_wrapper",void 0),__decorate([e.ViewChild(`.${e.PCSS}-readonly`)],a.prototype,"_span",void 0),a=__decorate([e.CustomElement({tagName:e.P+"-input-color",template:`<div class="${e.PCSS}-viewfinder">\n<${e.P}-panel class="${e.PCSS}-input-color" css="{{ { 'background-color': :host.viewValue } }}"><input type="color" class="${e.PCSS}-input" /></${e.P}-panel>\n<input class="${e.PCSS}-input" type="number" min="0" max="100" step="1" value="100" />\n</div>\n<${e.P}-span class="${e.PCSS}-readonly" css="{{ { 'background-color': :host.viewValue } }}"></${e.P}-span>`,shadow:e.Defaults.USE_SHADOW_ROOT})],a),t.PacemColorInputElement=a}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){let a=class PacemEmailInputElement extends t.PacemTextualInputElement{toggleReadonlyView(e){this.input.hidden=e,this.anchor.hidden=!e}get inputFields(){return[this.input]}};__decorate([e.ViewChild("input[type=email]")],a.prototype,"input",void 0),__decorate([e.ViewChild(e.P+"-a")],a.prototype,"anchor",void 0),a=__decorate([e.CustomElement({tagName:e.P+"-input-email",template:`<input type="email" class="${e.PCSS}-input ${e.PCSS}-viewfinder" />${t.CHAR_COUNTER_CHILD}<${e.P}-a class="${e.PCSS}-readonly" disabled="{{ $pacem.isNullOrEmpty(:host.value) }}" href="{{ 'mailto:'+ :host.value }}"><${e.P}-text text="{{ :host.viewValue }}"></${e.P}-text></${e.P}-a>`,shadow:e.Defaults.USE_SHADOW_ROOT})],a),t.PacemEmailInputElement=a}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){t.FileUploadEventName="fileupload",t.FileChangeEventName="filechange";class FileUploadEvent extends e.CustomTypedEvent{constructor(e){super(t.FileUploadEventName,e)}}t.FileUploadEvent=FileUploadEvent;class FileChangeEvent extends e.CustomTypedEvent{constructor(e){super(t.FileChangeEventName,e)}}t.FileChangeEvent=FileChangeEvent;let a=class PacemUploadElement extends t.PacemBaseElement{constructor(t=new e.Animations.TweenService){super(),this._tweener=t,this.undoCaption="undo",this.retryCaption="retry",this.clearCaption="clear",this.uploading=!1,this.size=0,this.percentage=0,this.complete=!1,this.failed=!1,this.invalidFile=!1,this._fields={parallelism:3,uid:"",ongoing:0,enqueuer:null,blob:null,retryFrom:0,chunkSize:131072,undone:!1}}convertValueAttributeToProperty(e){return e}acceptValue(e){this.percentage=0,this.uploading=!1,this._fileupload.value=""}_getMimeIcon(t=this.value,a=this.uploading){if(a)return"sync";var i=t;if(e.Utils.isNullOrEmpty(t))return"file_upload";"object"==typeof t&&(i=t.name);const n=/\.([\w]+)(\s|$)/.exec(i);if(n&&n.length)switch(n[1].toLowerCase()){case"pdf":return"picture_as_pdf";case"jpg":case"jpeg":case"gif":case"png":return"filter"}return"filter_none"}get blob(){return this._fields.blob}get inputFields(){return[this._fileupload]}getViewValue(t){const a=this._localValue||t;return e.Utils.isNullOrEmpty(a)||"object"!=typeof a?a:`${a.name}\n(${e.Utils.core.size(a.size)})`}toggleReadonlyView(e){this._fileupload.hidden=e}viewActivatedCallback(){super.viewActivatedCallback(),this._fileupload.addEventListener("click",e.stopPropagationHandler,!1)}disconnectedCallback(){this._fileupload&&this._fileupload.removeEventListener("click",e.stopPropagationHandler,!1),super.disconnectedCallback()}_dispatchDownload(t){e.avoidHandler(t);const a=this._localValue||this.value,i=e=>{this.dispatchEvent(new CustomEvent("download",{detail:e,bubbles:!0,cancelable:!1}))};e.Utils.isNullOrEmpty(a)||("string"==typeof a?i(a):e.Utils.isNullOrEmpty(a.content)?i(a.name):e.Utils.download(e.Utils.dataURLToBlob("data:application/download;base64,"+a.content),a.name,a.type))}reset(){super.reset(),this._localValue=null,this.invalidFile=!1}_validate(e=this._fileupload.files[0],t){e instanceof File&&(t=e.name),t=t.substr(t.lastIndexOf("\\")+1);const a=this.maxSize;if(a>0&&a<e.size)return this.invalidFile=!0,!1;const i=this.pattern;return i&&!new RegExp(i,"i").test(t)?(this.invalidFile=!0,!1):(this.invalidFile=!1,!0)}upload(e,t,a){if(this._validate(e,t))return this._upload(e,t,a)}_upload(e,t,a){return __awaiter(this,void 0,void 0,(function*(){var i=this,n=i._fields;if(!e)return;!t&&e instanceof File&&(t=e.name),i.failed=!1,n.undone=!1,n.ongoing=0;const s=e,r=i.size=s.size;t=t.substr(t.lastIndexOf("\\")+1),i.percentage=0,i.complete=!1;var o={filename:t,length:r,action:"start",state:a,type:e.type};i.uploading=!0;try{var l=yield i._fetch(o);if(l.ok){var d=yield l.json();n.retryFrom=0,n.blob=s,n.uid=d.uid,i._manage()}else i.uploading=!1;return l}catch(e){i.uploading=!1}}))}_blobToBase64(t){return __awaiter(this,void 0,void 0,(function*(){const a=yield e.Utils.blobToDataURL(t);return a.substr(a.indexOf("base64,")+7)}))}_doUpload(e,t){return __awaiter(this,void 0,void 0,(function*(){var a=this,i=a._fields;i.ongoing++;var n={chunk:yield this._blobToBase64(e),uid:i.uid,position:t,action:"do"};try{const e=yield a._fetch(n);if(e.ok){if(i.ongoing--,i.undone)return;const t=yield e.json();t.percentage>this.percentage&&(yield a._tweenPercentage(Math.round(Math.max(1,t.percentage)),200)),a.complete!=t.complete&&(a.complete=t.complete,!0===a.complete&&(a.uploading=!1,a.changeHandler(new FileUploadEvent(t))))}else i.retryFrom=t,a.failed=!0,a.uploading=!1}catch(e){i.retryFrom=t,a.failed=!0,a.uploading=!1}}))}_manage(){const e=this._fields,t=this.size,a=e.blob,i=this.chunkSize||e.chunkSize;var n=e.retryFrom,s=n+i;e.enqueuer=setInterval((()=>{if(n<t&&!this.failed){const t=this.parallelism||e.parallelism;if(e.ongoing>=t)return;this._doUpload(a.slice(n,s),n),s=(n=s)+i}else{this._fileupload.value="",window.clearInterval(e.enqueuer)}}),100)}_buildLocalValue(t,a=t.name,i=t){return __awaiter(this,void 0,void 0,(function*(){return this._localValue={name:a,size:i.size,type:t.type,lastModified:e.Utils.parseDate(t.lastModified).toISOString(),content:yield this._blobToBase64(i)}}))}onChange(t){return new Promise(((a,i)=>__awaiter(this,void 0,void 0,(function*(){if(e.CustomEventUtils.isInstanceOf(t,FileUploadEvent)){const e=this.value=t.detail.filename;this.dispatchEvent(t),a(e)}else{let t=this._fileupload;if(0===t.files.length)a(this.value=null);else{var i=t.files[0],n=i.name,s=i;this._validate(i)||e.Utils.isNullOrEmpty(this.url)?(/\.(jpe?g|png)$/i.test(n)&&this.maxImageWidth>0&&this.maxImageHeight>0&&(s=yield e.Utils.resizeImage(s,this.maxImageWidth,this.maxImageHeight,.8)),yield this._buildLocalValue(i,n,s),e.Utils.isNullOrEmpty(this.url)?(this.uploading=!0,e.Utils.isNullOrEmpty(this.value)?yield e.Utils.idle(250):(this.percentage=0,yield e.Utils.waitForAnimationEnd(this._tuner)),yield this._tweener.run(0,100,500,0,e.Animations.Easings.sineInOut,((e,t)=>{this.percentage=t})),this.percentage=0,this.uploading=!1,a(this.value=this._localValue)):(this._upload(s,t.value),a(this.value))):a(this.value=yield this._buildLocalValue(i)),this.dispatchEvent(new FileChangeEvent({valid:!this.invalidFile,file:i}))}}}))))}_fetch(t){return fetch(this.url,{method:"POST",credentials:this.fetchCredentials,headers:e.Utils.extend({Accept:"application/json","Content-Type":"application/json"},this.fetchHeaders||{}),body:JSON.stringify(t)})}_undo(e){return __awaiter(this,void 0,void 0,(function*(){e.preventDefault(),e.stopPropagation();var t=this,a=t._fields,i=t._fileupload;clearInterval(a.enqueuer);var n={action:"undo",uid:a.uid};try{var s=yield t._fetch(n);return s.ok&&(a.undone=!0,t.size=0,t._tweenPercentage(0,300)),s}catch(e){}finally{return i.value="",t.uploading=!1,s}}))}_tweenPercentage(t,a=500){const i=this.percentage;return this._tweener.run(i,t,a,0,e.Animations.Easings.sineInOut,((e,t)=>{this.percentage=t}))}_retry(e){e.preventDefault(),e.stopPropagation(),this.failed=!1,this._manage()}_clear(e){e.preventDefault(),e.stopPropagation(),this.invalidFile=!1;const t=this.inputFields[0];t.value="",/safari/i.test(navigator.userAgent)||(t.type="",t.type="file"),this.changeHandler(null)}};__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Json})],a.prototype,"fetchCredentials",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],a.prototype,"fetchHeaders",void 0),__decorate([e.ViewChild("input[type=file]")],a.prototype,"_fileupload",void 0),__decorate([e.ViewChild(`${e.P}-tuner`)],a.prototype,"_tuner",void 0),__decorate([e.Watch({converter:e.PropertyConverters.String})],a.prototype,"undoCaption",void 0),__decorate([e.Watch({converter:e.PropertyConverters.String})],a.prototype,"retryCaption",void 0),__decorate([e.Watch({converter:e.PropertyConverters.String})],a.prototype,"clearCaption",void 0),__decorate([e.Watch({emit:!1,reflectBack:!0,converter:e.PropertyConverters.String})],a.prototype,"pattern",void 0),__decorate([e.Watch({emit:!1,reflectBack:!0,converter:e.PropertyConverters.String})],a.prototype,"url",void 0),__decorate([e.Watch({emit:!1,reflectBack:!0,converter:e.PropertyConverters.Number})],a.prototype,"maxImageWidth",void 0),__decorate([e.Watch({emit:!1,reflectBack:!0,converter:e.PropertyConverters.Number})],a.prototype,"parallelism",void 0),__decorate([e.Watch({emit:!1,reflectBack:!0,converter:e.PropertyConverters.Number})],a.prototype,"chunkSize",void 0),__decorate([e.Watch({emit:!1,reflectBack:!0,converter:e.PropertyConverters.Number})],a.prototype,"maxImageHeight",void 0),__decorate([e.Watch({emit:!1,reflectBack:!0,converter:e.PropertyConverters.Number})],a.prototype,"maxSize",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Boolean})],a.prototype,"uploading",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Number})],a.prototype,"size",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Number})],a.prototype,"percentage",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Boolean})],a.prototype,"complete",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Boolean})],a.prototype,"failed",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Boolean})],a.prototype,"invalidFile",void 0),a=__decorate([e.CustomElement({tagName:e.P+"-upload",shadow:e.Defaults.USE_SHADOW_ROOT,template:`<${e.P}-button on-click=":host._dispatchDownload($event)" class="${e.PCSS}-upload ${e.PCSS}-viewfinder flat" css-class="{{ {'upload-chosen': !Pacem.Utils.isNullOrEmpty(:host.value) && !:host.uploading, 'upload-error': !Pacem.Utils.isNullOrEmpty(:host.value) && :host.invalidFile && Pacem.Utils.isNullOrEmpty(:host.url), 'upload-readonly': :host.readonly } }}">\n\n <${e.P}-panel class="upload-button" hide="{{ (:host.uploading || :host.failed) && !Pacem.Utils.isNullOrEmpty(:host.url) }}">\n <${e.P}-button tooltip="{{ :host.readonly ? :host.viewValue : 'upload' }}" class="button-circle pos-relative overflow-hidden" icon-glyph="{{ :host._getMimeIcon(:host.value, :host.uploading) }}" \n on-mouseover="$this.iconGlyph = :host._getMimeIcon(:host.readonly ? :host.value : '', :host.uploading)" on-mouseout="$this.iconGlyph = :host._getMimeIcon(:host.value, :host.uploading)"\n css-class="{{ {'${e.PCSS}-anim anim-rotate': :host.uploading, 'button-error': :host.invalidFile, 'button-primary': Pacem.Utils.isNullOrEmpty(:host.value) && !:host.invalidFile, 'button-success': !Pacem.Utils.isNullOrEmpty(:host.value) && !:host.invalidFile } }}">\n <input type="file" class="${e.PCSS}-transparent ${e.PCSS}-clickable pos-absolute absolute-left absolute-right absolute-top absolute-bottom" />\n </${e.P}-button>\n </${e.P}-panel>\n <${e.P}-panel class="upload-button" hide="{{ !:host.failed }}">\n <${e.P}-button class="button-circle button-flat" icon-glyph="refresh"\n tooltip="{{ :host.retryCaption }}" on-click=":host._retry($event)"><${e.P}-text text="{{ :host.retryCaption }}"></${e.P}-text></${e.P}-button>\n </${e.P}-panel>\n <${e.P}-panel class="upload-button" hide="{{ !:host.uploading || Pacem.Utils.isNullOrEmpty(:host.url) }}">\n <${e.P}-button class="button-circle button-flat" icon-glyph="clear" tooltip="{{ :host.undoCaption }}" \n on-click=":host._undo($event)"><${e.P}-text text="{{ :host.undoCaption }}"></${e.P}-text></${e.P}-button>\n </${e.P}-panel>\n\n <${e.P}-span tooltip="{{ :host.viewValue }}"\n hide="{{ $pacem.isNullOrEmpty(:host.value) || :host.uploading }}" class="upload-data readonly text-reset display-block ${e.PCSS}-anim text-truncate text-left ${e.PCSS}-pad pad-right-3" text="{{ :host.viewValue }}"></${e.P}-span>\n\n <${e.P}-panel class="upload-progress hit-none" hide="{{ :host.readonly || (!Pacem.Utils.isNullOrEmpty(:host.value) && !:host.uploading) }}">\n <${e.P}-tuner value="{{ :host.percentage }}" css-class="{{ {'tuner-success': !:host.invalidFile, 'tuner-error': :host.invalidFile} }}" interactive="false"></${e.P}-tuner>\n </${e.P}-panel>\n\n <${e.P}-button class="button-circle button-flat clear-button" icon-glyph="clear" hide="{{ $pacem.isNullOrEmpty(:host.value) || :host.uploading }}" tooltip="{{ :host.clearCaption }}" on-click=":host._clear($event)"></${e.P}-button>\n \n</${e.P}-button>`})],a),t.PacemUploadElement=a}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){let a=class PacemHiddenInputElement extends t.PacemTextualInputElement{constructor(){super()}toggleReadonlyView(e){}get inputFields(){return[this.input]}};__decorate([e.ViewChild("input[type=hidden]")],a.prototype,"input",void 0),a=__decorate([e.CustomElement({tagName:e.P+"-input-hidden",template:'<input type="hidden" />',shadow:e.Defaults.USE_SHADOW_ROOT})],a),t.PacemHiddenInputElement=a}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){const a=e.Utils.getUserMediaFunctions();let i;!function(e){e.Start="start",e.Taking="taking",e.Confirm="confirm"}(i=t.SnapshotStep||(t.SnapshotStep={}));class ConfirmSnapshotEvent extends e.CustomUIEvent{constructor(e){super("confirmsnapshot",{buffer:e})}}let n=class PacemSnapshotElement extends t.PacemBaseElement{constructor(){super(...arguments),this.step=i.Start,this._canUseWebcam=a.length>0,this._countdown=0,this._webcamInitialized=!1,this._grabberChangeHandler=t=>{const a=this._grabber;a.files.length>0&&e.Utils.blobToDataURL(a.files[0]).then((t=>{e.Utils.loadImage(t).then((e=>{this._shutter(e)}))}))},this._snapshooterClickHandler=t=>{e.avoidHandler(t),this.step=i.Taking},this._pickerClickHandler=t=>{e.avoidHandler(t),this._grabber.click()},this._takerClickHandler=t=>{e.avoidHandler(t),this._countdown=0,this._shutter()},this._timerClickHandler=t=>{e.avoidHandler(t),this._countdown=3,this._shutter()},this._confirmerClickHandler=t=>{e.avoidHandler(t),this.changeHandler(new ConfirmSnapshotEvent(this._buffer))}}get inputFields(){return[]}toggleReadonlyView(e){}onChange(t){return new Promise(((a,n)=>{e.CustomEventUtils.isInstanceOf(t,ConfirmSnapshotEvent)?(a(this.value=t.detail.buffer),this.step=i.Start):a(this.value)}))}acceptValue(e){this._renderValue(e)}getViewValue(e){return e}convertValueAttributeToProperty(t){return e.PropertyConverters.String.convert(t,this)}get _getUserMedia(){return this._canUseWebcam&&a[0]}propertyChangedCallback(e,t,a,n){switch(super.propertyChangedCallback(e,t,a,n),e){case"step":switch(a){case i.Start:this._buffer=null;const e=this._grabber;e.value="",/safari/i.test(navigator.userAgent)||(e.type="",e.type="file");break;case i.Taking:this._ensureWebcamRunning()}break;case"_buffer":this._renderValue(a||this.value);break;case"width":case"height":this._syncSize()}}viewActivatedCallback(){super.viewActivatedCallback(),this._syncSize(),this._picker.addEventListener("click",this._pickerClickHandler,!1),this._snapshooter.addEventListener("click",this._snapshooterClickHandler,!1),this._taker.addEventListener("click",this._takerClickHandler,!1),this._timer.addEventListener("click",this._timerClickHandler,!1),this._confirmer.addEventListener("click",this._confirmerClickHandler,!1),this._grabber.addEventListener("change",this._grabberChangeHandler,!1)}disconnectedCallback(){this.isReady&&(this._picker.removeEventListener("click",this._pickerClickHandler,!1),this._snapshooter.removeEventListener("click",this._snapshooterClickHandler,!1),this._taker.removeEventListener("click",this._takerClickHandler,!1),this._timer.removeEventListener("click",this._timerClickHandler,!1),this._confirmer.removeEventListener("click",this._confirmerClickHandler,!1),this._grabber.removeEventListener("change",this._grabberChangeHandler,!1)),super.disconnectedCallback()}_syncSize(){const t=this._stage,a=this._player;e.Utils.isNull(t)||e.Utils.isNull(a)||(t.style.width=a.style.width=this.width&&this.width+"px"||"",t.style.height=a.style.height=this.height&&this.height+"px"||"",this._renderValue(this._buffer||this.value))}_shutter(t){const a=this,i=this._player,n=this._stage;var s,r;if(a._confirmer.disabled=!0,e.Utils.isNull(t)&&(t=a._player),t instanceof HTMLVideoElement?(s=t.videoWidth,r=t.videoHeight):(s=t.naturalWidth,r=t.naturalHeight),a._countdown<=0){var o=document.createElement("canvas");o.width=this.width||n.clientWidth,o.height=this.height||n.clientHeight;var l=o.getContext("2d");e.Utils.cropImageOntoCanvas(t,l,s,r);let d=a._root;d.insertBefore(o,i),o.className="snapshot-brightout",setTimeout((function(){d.removeChild(o)}),1e3),a._refreshBuffer(o.toDataURL()).then((e=>{a._setToBeConfirmed(e),a._confirmer.disabled=!1}))}else setTimeout((()=>{a._countdown--,this._shutter()}),1e3)}_renderValue(t=this.value){let a=this._stage;if(!e.Utils.isNull(a)){a.width=a.clientWidth,a.height=a.clientHeight;let i=a.getContext("2d");e.Utils.isNullOrEmpty(t)?i.clearRect(0,0,a.width,a.height):e.Utils.loadImage(t).then((t=>{e.Utils.cropImageOntoCanvas(t,i,t.width,t.height)}))}}_setToBeConfirmed(e){this.step=i.Confirm,this._buffer=e}_refreshBuffer(t){var a=this._stage;let i;return a.width=a.clientWidth,a.height=a.clientHeight,this.quality>0&&(i=Math.min(1,Math.max(0,this.quality))),e.Utils.cropImage(t,a.width,a.height,i)}_ensureWebcamRunning(){if(this._canUseWebcam&&!this._webcamInitialized){var t=this;t._webcamInitialized=!0,t._getUserMedia.apply(navigator,[{video:!0},function(e){t._player.srcObject=e},function(a){t.log(e.Logging.LogLevel.Error,(a||a.message).toString())}])}}};__decorate([e.ViewChild("."+e.PCSS+"-snapshot")],n.prototype,"_root",void 0),__decorate([e.ViewChild("canvas")],n.prototype,"_stage",void 0),__decorate([e.ViewChild("input[type=file]")],n.prototype,"_grabber",void 0),__decorate([e.ViewChild("video")],n.prototype,"_player",void 0),__decorate([e.ViewChild(e.P+"-button.button.snapshot-upload")],n.prototype,"_picker",void 0),__decorate([e.ViewChild(e.P+"-button.button.snapshot-camera")],n.prototype,"_snapshooter",void 0),__decorate([e.ViewChild(e.P+"-button.button.snapshot-take")],n.prototype,"_taker",void 0),__decorate([e.ViewChild(e.P+"-button.button.snapshot-timer3s")],n.prototype,"_timer",void 0),__decorate([e.ViewChild(e.P+"-button.button.snapshot-confirm")],n.prototype,"_confirmer",void 0),__decorate([e.Watch({converter:e.PropertyConverters.String})],n.prototype,"step",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],n.prototype,"width",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],n.prototype,"height",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],n.prototype,"quality",void 0),__decorate([e.Watch()],n.prototype,"_countdown",void 0),__decorate([e.Watch({emit:!1})],n.prototype,"_buffer",void 0),n=__decorate([e.CustomElement({tagName:e.P+"-snapshot",shadow:e.Defaults.USE_SHADOW_ROOT,template:`<${e.P}-panel class="${e.PCSS}-snapshot" \ncss-class="{{ { \n'snapshot-start': :host.step === '${i.Start}',\n'snapshot-taking': :host.step === '${i.Taking}', \n'snapshot-confirm': :host.step === '${i.Confirm}' } }}">\n \n <canvas class="${e.PCSS}-viewfinder"></canvas>\n\n <video autoplay="autoplay"></video>\n\n <input type="file" accept="image/*" />\n\n <div class="${e.PCSS}-buttonset snapshot-step step-start">\n <div class="buttonset-center">\n <${e.P}-button class="button snapshot-upload" icon-glyph="upload"></${e.P}-button>\n <${e.P}-button class="button snapshot-camera" icon-glyph="photo_camera"></${e.P}-button> \n </div>\n </div>\n\n <div class="${e.PCSS}-buttonset snapshot-step step-taking">\n <div class="buttonset-center">\n <${e.P}-button class="button snapshot-undo" icon-glyph="undo" on-click=":host.step = '${i.Start}'"></${e.P}-button>\n <${e.P}-button class="button snapshot-take" icon-glyph="camera"></${e.P}-button>\n <${e.P}-button class="button snapshot-timer3s" icon-glyph="timer_3"></${e.P}-button>\n </div>\n </div>\n\n <div class="${e.PCSS}-buttonset snapshot-step step-confirm">\n <div class="buttonset-center">\n <${e.P}-button class="button snapshot-undo" icon-glyph="undo" on-click=":host.step = '${i.Start}'"></${e.P}-button>\n <${e.P}-button class="button snapshot-confirm" icon-glyph="done"></${e.P}-button>\n </div>\n </div>\n\n <${e.P}-span class="snapshot-countdown" text="{{ :host._countdown }}" hide="{{ :host.step !== '${i.Taking}' || !(:host._countdown > 0) }}"></${e.P}-span>\n <${e.P}-span hide="{{ :host._canUseWebcam }}"><${e.P}-content></${e.P}-content></${e.P}-span>\n\n</${e.P}-panel>`})],n),t.PacemSnapshotElement=n}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){let a=class PacemUrlInputElement extends t.PacemTextualInputElement{constructor(){super()}toggleReadonlyView(e){this.input.hidden=e,this.anchor.hidden=!e}get inputFields(){return[this.input]}};__decorate([e.ViewChild("input[type=url]")],a.prototype,"input",void 0),__decorate([e.ViewChild(e.P+"-a")],a.prototype,"anchor",void 0),a=__decorate([e.CustomElement({tagName:e.P+"-input-url",template:`<input type="url" class="${e.PCSS}-input" />${t.CHAR_COUNTER_CHILD}<${e.P}-a class="${e.PCSS}-readonly" disabled="{{ $pacem.isNullOrEmpty(:host.value) }}" href="{{ :host.value }}" target="_blank"><${e.P}-text text="{{ :host.viewValue }}"></${e.P}-text></${e.P}-a>`,shadow:e.Defaults.USE_SHADOW_ROOT})],a),t.PacemUrlInputElement=a}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(a){a.Picture=class Picture{},a.ImageFetchRequestEventName="imagefetchrequest";class ImageFetchRequestEvent extends e.CustomTypedEvent{constructor(e){super(a.ImageFetchRequestEventName,e,{bubbles:!0})}}a.ImageFetchRequestEvent=ImageFetchRequestEvent;let i=class PacemEditImageElement extends t.PacemElement{constructor(){super(...arguments),this._index=0,this.hint=""}_uploaderPropertyChangedCallback(e){const t=e.detail.currentValue;switch(e.detail.propertyName){case"percentage":this._progressbar.percentage=100*t;break;case"uploading":t&&this._done(!0)}}_thumbnailUploaderPropertyChangedCallback(e){const t=e.detail.currentValue;switch(e.detail.propertyName){case"percentage":this._progressbar.percentage=100*t;break;case"uploading":this._done(t)}}_uploaderFileUploadCallback(t){const a=this._uploader,i=this._thumbUploader,n=i.maxImageWidth,s=i.maxImageHeight;if(n>0&&s>0){var r=a.blob;const o=t.detail.uid;e.Utils.resizeImage(r,n,s).then((e=>{e==r?this._done(!1):i.upload(e,"thumbnail.jpg",o)}))}else this._done(!1)}_done(e){e||this._imagefetch(0),this._repeater.hidden=e,this._progressbar.hidden=!e}_snapshotPropertyChangedCallback(t){if("value"===t.detail.propertyName){const a=e.Utils.dataURLToBlob(t.detail.currentValue);this._uploader.upload(a,"snapshot.jpg")}}reset(){this._snapshot.step=a.SnapshotStep.Start}propertyChangedCallback(t,a,i,n){switch(super.propertyChangedCallback(t,a,i,n),t){case"imageSet":let t=i||{skip:0,set:[]};e.Utils.isNullOrEmpty(this._images)||0===t.skip?this._images=t.set:e.Utils.isNull(this._images)||Array.prototype.splice.apply(this._images,[t.skip,this._images.length-t.skip].concat(t.set)),this._fetching=!1;break;case"hint":n||this._imagefetch(0)}}_imagefetchSuddenly(e){this._fetching=!0,this._imagefetch(e)}_imagefetch(e){e>=0||(e=this._images&&this._images.length||0),this.dispatchEvent(new ImageFetchRequestEvent({hint:this.hint,skip:e,take:18}))}};__decorate([e.Watch({converter:e.PropertyConverters.String})],i.prototype,"uploadUrl",void 0),__decorate([e.Watch({converter:e.PropertyConverters.String})],i.prototype,"hint",void 0),__decorate([e.Watch()],i.prototype,"imageSet",void 0),__decorate([e.Watch({converter:e.PropertyConverters.String})],i.prototype,"value",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Number})],i.prototype,"maxWidth",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Number})],i.prototype,"maxHeight",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Number})],i.prototype,"maxThumbnailWidth",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Number})],i.prototype,"maxThumbnailHeight",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Boolean})],i.prototype,"allowSnapshot",void 0),__decorate([e.Watch()],i.prototype,"_fetching",void 0),__decorate([e.Watch()],i.prototype,"_images",void 0),__decorate([e.ViewChild(e.P+"-repeater")],i.prototype,"_repeater",void 0),__decorate([e.ViewChild(e.P+"-upload[main]")],i.prototype,"_uploader",void 0),__decorate([e.ViewChild(e.P+"-upload[thumb]")],i.prototype,"_thumbUploader",void 0),__decorate([e.ViewChild(e.P+"-snapshot")],i.prototype,"_snapshot",void 0),__decorate([e.ViewChild(e.P+"-progressbar")],i.prototype,"_progressbar",void 0),__decorate([e.Debounce(500)],i.prototype,"_imagefetch",null),i=__decorate([e.CustomElement({tagName:e.P+"-edit-image",shadow:e.Defaults.USE_SHADOW_ROOT,template:`<${e.P}-panel class="${e.PCSS}-edit-image"\n css-class="{{ {'${e.PCSS}-snapshot': ::_snapshot.step != '${a.SnapshotStep.Start}', '${e.PCSS}-uploading': ::_uploader.uploading, '${e.PCSS}-upload-enabled': !Pacem.Utils.isNullOrEmpty(:host.uploadUrl), '${e.PCSS}-snapshot-enabled': !Pacem.Utils.isNullOrEmpty(:host.uploadUrl) && :host.allowSnapshot} }}">\n <div>\n <${e.P}-input-search value="{{ :host.hint, twoway }}"></${e.P}-input-search>\n <${e.P}-upload main pattern=".+.(jpe?g|png|svg|ico)$" url="{{ :host.uploadUrl }}"\n max-image-width="{{ :host.maxWidth }}" max-image-height="{{ :host.maxHeight }}"\n on-${a.FileUploadEventName}=":host._uploaderFileUploadCallback($event)"\n on-${e.PropertyChangeEventName}=":host._uploaderPropertyChangedCallback($event)" hide="{{ Pacem.Utils.isNullOrEmpty(:host.uploadUrl) || ::_thumbUploader.uploading }}"></${e.P}-upload>\n <${e.P}-upload thumb pattern=".+.(jpe?g|png|svg|ico)$" url="{{ :host.uploadUrl }}" hide="{{ !::_thumbUploader.uploading }}"\n max-image-width="{{ :host.maxThumbnailWidth }}" max-image-height="{{ :host.maxThumbnailHeight }}"\n on-${e.PropertyChangeEventName}=":host._thumbnailUploaderPropertyChangedCallback($event)"></${e.P}-upload>\n <${e.P}-button class="${e.PCSS}-snapshot" on-click="Pacem.avoidHandler($event); ::_snapshot.step = '${a.SnapshotStep.Taking}'" hide="{{ Pacem.Utils.isNullOrEmpty(:host.uploadUrl) || !:host.allowSnapshot }}"></${e.P}-button>\n <${e.P}-infinite-scroller container="{{ ::_repeater }}" on-fetchmore=":host._imagefetchSuddenly()" disabled="{{ :host._fetching || :host.disabled || :host._images.length >= :host.imageSet.total }}"></${e.P}-infinite-scroller>\n <${e.P}-repeater datasource="{{ :host._images }}">\n <template>\n <${e.P}-img css-class="{{ {'${e.PCSS}-selected': ^item.src === :host.value } }}" on-click=":host.value = ^item.src" src="{{ ^item.thumb }}" adapt="contain"></${e.P}-img>\n </template>\n </${e.P}-repeater>\n <${e.P}-progressbar class="progressbar-smaller progressbar-accent" caption="{{ ::_thumbUploader.uploading ? 'thumbnail...' : 'uploading...' }}"></${e.P}-progressbar>\n </div>\n <div>\n <${e.P}-snapshot hide="{{ !:host.allowSnapshot }}" on-${e.PropertyChangeEventName}=":host._snapshotPropertyChangedCallback($event)"></${e.P}-snapshot>\n </div>\n </${e.P}-panel>`})],i),a.PacemEditImageElement=i;let n=class PacemImageInputElement extends a.PacemBaseElement{constructor(){super(...arguments),this._broadcastFetchRequestEventName=e=>{this.dispatchEvent(new ImageFetchRequestEvent(e.detail))},this._innerValueChangedHandler=t=>{"value"!==t.detail.propertyName||e.Utils.isNull(this._dialog)||(this._dialog.state=t.detail.currentValue)}}convertValueAttributeToProperty(e){return e}getViewValue(e){return e}get inputFields(){return[]}_clear(e){this.changeHandler(e)}onChange(a){let i=this.value;return e.CustomEventUtils.isInstanceOf(a,t.UI.DialogResultEvent)&&a.detail.button===t.UI.DialogButton.Ok?i=this.value=a.detail.state:a.target===this._input?i=this.value=this._input.value:a.target===this._clearBtn&&(i=this.value=void 0),e.Utils.fromResult(i)}toggleReadonlyView(e){this._input.hidden=this._editBtn.hide=this._clearBtn.hide=e}_addDialog(){var a=document.createElement(e.P+"-dialog");return a.buttons=t.UI.DialogButtons.OkCancel,a.addEventListener(t.UI.DialogResultEventName,this.changeHandler,!1),a.appendChild(this._addEditImage()),document.body.appendChild(a),this._dialog=a}_removeDialog(){this._removeEditImage(),e.Utils.isNull(this._dialog)||(this._dialog.removeEventListener(t.UI.DialogResultEventName,this.changeHandler,!1),this._dialog.remove())}_addEditImage(){var t=document.createElement(e.P+"-edit-image");return t.disabled=!0,t.addEventListener(e.PropertyChangeEventName,this._innerValueChangedHandler,!1),t.addEventListener(a.ImageFetchRequestEventName,this._broadcastFetchRequestEventName,!1),t.uploadUrl=this.uploadUrl,t.allowSnapshot=this.allowSnapshot,t.maxWidth=this.maxWidth,t.maxHeight=this.maxHeight,t.maxThumbnailHeight=this.maxThumbnailHeight,t.maxThumbnailWidth=this.maxThumbnailWidth,this._editImage=t}_removeEditImage(){e.Utils.isNull(this._editImage)||(this._editImage.removeEventListener(e.PropertyChangeEventName,this._innerValueChangedHandler,!1),this._editImage.removeEventListener(a.ImageFetchRequestEventName,this._broadcastFetchRequestEventName,!1))}connectedCallback(){super.connectedCallback(),this._addDialog()}disconnectedCallback(){this._removeDialog(),super.disconnectedCallback()}propertyChangedCallback(t,a,i,n){switch(super.propertyChangedCallback(t,a,i,n),t){case"uploadUrl":e.Utils.isNull(this._editImage)||(this._editImage.uploadUrl=i);break;case"allowSnapshot":e.Utils.isNull(this._editImage)||(this._editImage.allowSnapshot=i);break;case"imageSet":e.Utils.isNull(this._editImage)||(this._editImage.imageSet=i);break;case"maxThumbnailHeight":e.Utils.isNull(this._editImage)||(this._editImage.maxThumbnailHeight=i);break;case"maxThumbnailWidth":e.Utils.isNull(this._editImage)||(this._editImage.maxThumbnailWidth=i);break;case"maxHeight":e.Utils.isNull(this._editImage)||(this._editImage.maxHeight=i);break;case"maxWidth":e.Utils.isNull(this._editImage)||(this._editImage.maxWidth=i)}}acceptValue(t){e.Utils.isNull(this._editImage)||(this._editImage.value=t)}_update(e){this._image.src=e}_retrieve(){return this.value}_edit(a){e.avoidHandler(a);var i=this._editImage,n=this.value;i.disabled=!1,i.reset(),i.value=n,this._dialog.open(n).then((e=>{switch(e.button){case t.UI.DialogButton.Cancel:this._update(this.value);break;case t.UI.DialogButton.Ok:this._update(e.state)}this._editImage.disabled=!0}))}};__decorate([e.ViewChild(e.P+"-img")],n.prototype,"_image",void 0),__decorate([e.ViewChild(e.P+"-button."+e.PCSS+"-edit")],n.prototype,"_editBtn",void 0),__decorate([e.ViewChild(e.P+"-button."+e.PCSS+"-clear")],n.prototype,"_clearBtn",void 0),__decorate([e.ViewChild(e.P+"-input-url")],n.prototype,"_input",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],n.prototype,"uploadUrl",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Json})],n.prototype,"imageSet",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],n.prototype,"maxWidth",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],n.prototype,"maxHeight",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],n.prototype,"maxThumbnailWidth",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],n.prototype,"maxThumbnailHeight",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Boolean})],n.prototype,"allowSnapshot",void 0),n=__decorate([e.CustomElement({tagName:e.P+"-input-image",shadow:e.Defaults.USE_SHADOW_ROOT,template:`<div class="${e.PCSS}-input-image"><${e.P}-img src="{{ :host.value }}" adapt="contain"></${e.P}-img><div class="${e.PCSS}-input-image-dashboard">\n <${e.P}-button on-click=":host._edit($event)" hide="{{ :host.disabled }}" class="${e.PCSS}-edit">Edit</${e.P}-button>\n <${e.P}-button on-click=":host._clear($event)" hide="{{ :host.disabled }}" class="${e.PCSS}-clear">Clear</${e.P}-button>\n</div><${e.P}-input-url placeholder="{{ :host.placeholder }}" on-change=":host.changeHandler($event)" value="{{ :host.value }}"></${e.P}-input-url>\n\n <${e.P}-panel hide="{{ Pacem.Utils.isNullOrEmpty(:host.value) }}">\n <dl class="${e.PCSS}-input-image-preview">\n <dt>dimensions:</dt><dd><${e.P}-text text="{{ ::_image.size.width +'x'+ ::_image.size.height }}"></${e.P}-text></dd>\n <dt>size:</dt><dd><${e.P}-text text="{{ $pacem.size(::_image.size.weight) }}"></${e.P}-text></dd>\n </dl></${e.P}-panel>\n\n</div>`})],n),a.PacemImageInputElement=n}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){let a=class PacemNumberInputElement extends t.PacemOrdinalInputElement{toggleReadonlyView(e){this._span.hidden=!e,this._input.hidden=e}get inputFields(){return[this._input]}getViewValue(e){return null!=this.value?this._format(this.value):void 0}_format(t=this.value){const a=this.format;return e.Utils.isNullOrEmpty(a)?t.toString():new Intl.NumberFormat(e.Utils.lang(this),a).format(t)}getValue(e){const t=this.inputField.valueAsNumber||parseFloat(this.inputField.value);return isNaN(t)?void 0:t}};__decorate([e.ViewChild("input[type=number]")],a.prototype,"_input",void 0),__decorate([e.ViewChild(`span.${e.PCSS}-readonly`)],a.prototype,"_span",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Json})],a.prototype,"format",void 0),a=__decorate([e.CustomElement({tagName:e.P+"-input-number",template:`<input type="number" class="${e.PCSS}-input ${e.PCSS}-viewfinder" /><span class="${e.PCSS}-readonly"><${e.P}-text text="{{ :host.viewValue }}"></${e.P}-text></span>`,shadow:e.Defaults.USE_SHADOW_ROOT})],a),t.PacemNumberInputElement=a}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){let a=class PacemPasswordInputElement extends t.PacemTextualInputElement{constructor(){super(),this._togglerMousedownHandler=t=>{0==t.button&&(e.avoidHandler(t),this.toggleVisibility())}}get inputFields(){return[this._input]}viewActivatedCallback(){var t;super.viewActivatedCallback();const a=null!==(t=this.id)&&void 0!==t?t:"_"+e.Utils.uniqueCode(),i=this._input.id=a+"_ctrl";this._toggler.setAttribute("aria-controls",i),this._toggler.setAttribute("role","button"),this._syncToggler(),this._toggler.addEventListener("mousedown",this._togglerMousedownHandler,!1)}disconnectedCallback(){e.Utils.isNull(this._toggler)||this._toggler.removeEventListener("mousedown",this._togglerMousedownHandler,!1)}toggleVisibility(){const e=this._input.type;this._input.type="password"===e?"text":"password",this._syncToggler()}_syncToggler(){const e="password"===this._input.type;this._toggler.innerText=e?"visibility_off":"visibility",this._toggler.setAttribute("aria-expanded",(!e).toString())}toggleReadonlyView(e){this._input.hidden=this._toggler.hidden=e,this._span.hidden=!e}getViewValue(t){return e.Utils.leftPad("",Math.floor(8+3*Math.random()),"•")}};__decorate([e.ViewChild("input[type=password]")],a.prototype,"_input",void 0),__decorate([e.ViewChild(`span.${e.PCSS}-readonly`)],a.prototype,"_span",void 0),__decorate([e.ViewChild(`i.${e.PCSS}-icon.${e.PCSS}-clickable`)],a.prototype,"_toggler",void 0),a=__decorate([e.CustomElement({tagName:e.P+"-input-password",template:`<input type="password" class="${e.PCSS}-input ${e.PCSS}-viewfinder" /><i class="${e.PCSS}-icon ${e.PCSS}-clickable"></i>\n${t.CHAR_COUNTER_CHILD}<span class="${e.PCSS}-readonly"><${e.P}-text text="{{ :host.viewValue }}"></${e.P}-text></span>`,shadow:e.Defaults.USE_SHADOW_ROOT})],a),t.PacemPasswordInputElement=a}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){let a=class PacemSearchInputElement extends t.PacemTextualInputElement{constructor(){super()}get inputFields(){return[this.input]}toggleReadonlyView(e){}};__decorate([e.ViewChild("input[type=search]")],a.prototype,"input",void 0),a=__decorate([e.CustomElement({tagName:e.P+"-input-search",template:'<input type="search" class="'+e.PCSS+'-input" />',shadow:e.Defaults.USE_SHADOW_ROOT})],a),t.PacemSearchInputElement=a}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){let a=class PacemTelInputElement extends t.PacemTextualInputElement{constructor(){super()}toggleReadonlyView(e){this.input.hidden=e,this.anchor.hidden=!e}get inputFields(){return[this.input]}};__decorate([e.ViewChild("input[type=tel]")],a.prototype,"input",void 0),__decorate([e.ViewChild(e.P+"-a")],a.prototype,"anchor",void 0),a=__decorate([e.CustomElement({tagName:e.P+"-input-tel",template:`<input type="tel" class="${e.PCSS}-input" /><${e.P}-a class="${e.PCSS}-readonly" disabled="{{ $pacem.isNullOrEmpty(:host.value) }}" href="{{ 'tel:'+ :host.value }}"><${e.P}-text text="{{ :host.viewValue }}"></${e.P}-text></${e.P}-a>`,shadow:e.Defaults.USE_SHADOW_ROOT})],a),t.PacemTelInputElement=a}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){let a=class PacemTextInputElement extends t.PacemTextualInputElement{constructor(){super()}toggleReadonlyView(e){this._span.hidden=!e,this._input.hidden=e}get inputFields(){return[this._input]}};__decorate([e.ViewChild("input[type=text]")],a.prototype,"_input",void 0),__decorate([e.ViewChild("span."+e.PCSS+"-readonly")],a.prototype,"_span",void 0),a=__decorate([e.CustomElement({tagName:e.P+"-input-text",template:`<input type="text" class="${e.PCSS}-input" />${t.CHAR_COUNTER_CHILD}<span class="${e.PCSS}-readonly"><${e.P}-text text="{{ :host.viewValue }}"></${e.P}-text></span>`,shadow:e.Defaults.USE_SHADOW_ROOT})],a),t.PacemTextInputElement=a}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){t.DEFAULT_TILES="",t.DEFAULT_ATTRIBUTION="";let a=class PacemLatLngElement extends t.PacemBaseElement{convertValueAttributeToProperty(e){const t=/^\s*([+-]?\d+\.?\d+)[,\s]\s*([+-]?\d+\.?\d+)\s*$/.exec(e);if(t&&3===t.length)return{lat:parseFloat(t[1]),lng:parseFloat(t[2])};throw`Invalid coordinates format for "${e}"`}compareValuePropertyValues(e,t){return!(!e||"number"!=typeof e.lat||"number"!=typeof e.lng||!t||"number"!=typeof t.lat||"number"!=typeof t.lng)&&(e.lat===t.lat&&e.lng===t.lng)}getViewValue(e){return this._getViewValue(e)}_getViewValue(e,t=8){return e&&"number"==typeof e.lat&&"number"==typeof e.lng&&e.lat.toFixed(t)+","+e.lng.toFixed(t)||""}get inputFields(){return[this._latInput,this._lngInput]}toggleReadonlyView(e){this._inputContainer.hidden=e}acceptValue(e){let t=this._ensureValue(e);this._lat=t.lat,this._lng=t.lng}_ensureValue(t){return t&&"number"==typeof t.lat&&"number"==typeof t.lng?t:e.Components.Maps.MapConsts.DEFAULT_COORDS}onChange(t){if(t&&"dragend"===t.type){var a=t;this._lat=a.detail.position.lat,this._lng=a.detail.position.lng}const i=this._lat,n=this._lng;return e.Utils.isNull(i)||e.Utils.isNull(n)?e.Utils.fromResult(this.value):e.Utils.fromResult(this.value={lat:i,lng:n})}propertyChangedCallback(t,a,i,n){if(super.propertyChangedCallback(t,a,i,n),"options"===t&&!n){const t=e.Utils.clone(i||{provider:"osm"});this._synchronizeOptions(t)}}viewActivatedCallback(){super.viewActivatedCallback(),this._synchronizeOptions()}_synchronizeOptions(t=this.options||{provider:"osm"}){const a=this._marker,i=this._map;switch(a.icon=t.icon,t&&t.provider){case"azure":this._azureAdapter.subscriptionKey=t.apiKey,i.adapter=this._azureAdapter;break;case"google":case"gmaps":this._googleAdapter.apiKey=t.apiKey,i.adapter=this._googleAdapter;break;default:e.Utils.isNullOrEmpty(t.attribution)||(this._leafletAdapter.attribution=t.attribution),e.Utils.isNullOrEmpty(t.tiles)||(this._leafletAdapter.tiles=t.tiles),i.adapter=this._leafletAdapter}delete t.provider,delete t.icon,delete t.apiKey,delete t.attribution,delete t.tiles;for(let e in t)e in i&&(i[e]=t[e])}};__decorate([e.ViewChild(e.P+"-map-adapter-leaflet")],a.prototype,"_leafletAdapter",void 0),__decorate([e.ViewChild(e.P+"-map-adapter-azure")],a.prototype,"_azureAdapter",void 0),__decorate([e.ViewChild(e.P+"-map-adapter-google")],a.prototype,"_googleAdapter",void 0),__decorate([e.ViewChild(e.P+"-map")],a.prototype,"_map",void 0),__decorate([e.ViewChild(e.P+"-map-marker")],a.prototype,"_marker",void 0),__decorate([e.ViewChild(e.P+"-input-number:nth-child(1)")],a.prototype,"_latInput",void 0),__decorate([e.ViewChild(e.P+"-input-number:nth-child(2)")],a.prototype,"_lngInput",void 0),__decorate([e.ViewChild(`.${e.PCSS}-latlng-fields`)],a.prototype,"_inputContainer",void 0),__decorate([e.ViewChild(e.P+"-fetch")],a.prototype,"_fetcher",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Json,emit:!1})],a.prototype,"options",void 0),__decorate([e.Watch()],a.prototype,"_lat",void 0),__decorate([e.Watch()],a.prototype,"_lng",void 0),a=__decorate([e.CustomElement({tagName:e.P+"-latlng",shadow:e.Defaults.USE_SHADOW_ROOT,template:`<div class="${e.PCSS}-latlng">\n <div class="${e.PCSS}-latlng-fields ${e.PCSS}-viewfinder">\n <${e.P}-input-number class="${e.PCSS}-lat" value="{{ :host._lat, twoway }}" min="-90" max="90" step="{{ 'any' }}"></${e.P}-input-number>\n <${e.P}-input-number class="${e.PCSS}-lng" value="{{ :host._lng, twoway }}" min="-180" max="180" step="{{ 'any' }}"></${e.P}-input-number>\n </div>\n <${e.P}-panel hide="{{ Pacem.Utils.isNull(:host.value) || :host.readonly }}">\n <dl class="${e.PCSS}-latlng-preview">\n <dt>decimals:</dt><dd><${e.P}-text text="{{ :host._getViewValue(:host.value, 12) }}"></${e.P}-text></dd>\n <dt>address:</dt><dd><${e.P}-text text="{{ ::_fetcher.result.display_name || '?' }}"></${e.P}-text></dd>\n <dt>degrees:</dt><dd><${e.P}-span css-class="{{ {'${e.PCSS}-lat-north': :host._lat > 0, '${e.PCSS}-lat-south': :host._lat < 0} }}" content="{{ $pacem.decToDeg(Math.abs(:host._lat)) }}"></${e.P}-span>,\n <${e.P}-span css-class="{{ {'${e.PCSS}-lng-east': :host._lng > 0, '${e.PCSS}-lng-west': :host._lng < 0} }}" content="{{ $pacem.decToDeg(Math.abs(:host._lng)) }}"></${e.P}-span></dd>\n </dl>\n </${e.P}-panel>\n <${e.P}-span class="${e.PCSS}-readonly" hide="{{ !:host.readonly }}" content="{{ :host.viewValue + ($pacem.isNullOrEmpty(::_fetcher.result.display_name) ? '' : (' <small>'+ ::_fetcher.result.display_name +'</small>')) }}"></${e.P}-span>\n\n <${e.P}-map-adapter-leaflet></${e.P}-map-adapter-leaflet>\n <${e.P}-map-adapter-azure></${e.P}-map-adapter-azure>\n <${e.P}-map-adapter-google></${e.P}-map-adapter-google>\n\n <${e.P}-map adapter="{{ ::_adapter }}">\n <${e.P}-map-marker position="{{ :host._ensureValue(:host.value) }}" on-dragend=":host.changeHandler($event)" draggable="{{ !:host.readonly }}"></${e.P}-map-marker>\n </${e.P}-map>\n <${e.P}-fetch disabled="{{ $pacem.isNull(:host.value) }}" parameters="{{ { format: 'json', lat: :host._lat, lon: :host._lng } }}" url="https://nominatim.openstreetmap.org/reverse"></${e.P}-fetch>\n</div>`})],a),t.PacemLatLngElement=a}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){const a=`change-policy="${t.ChangePolicy.Blur}" readonly="{{ :host.readonly }}"`;function i(t){return e.Utils.isNullOrEmpty(t&&t.name)}let n=class PacemNameValueListElement extends t.PacemBaseElement{constructor(){super(...arguments),this.inputFields=[],this._bag=[]}toggleReadonlyView(e){}onChange(e){return new Promise(((e,t)=>{let a=this._bagToValue(this._bag);this.compareValuePropertyValues(a,this.value)?t():e(this.value=a)}))}acceptValue(e){this._bag=this._valueToBag(e)}getViewValue(e){return""}compareValuePropertyValues(t,a){return e.Utils.Json.stringify(t)===e.Utils.Json.stringify(a)}convertValueAttributeToProperty(t){return e.PropertyConverters.Json.convert(t)}propertyChangedCallback(e,t,a,i){super.propertyChangedCallback(e,t,a,i),"dictionary"!==e||i||(this.value=this._bagToValue())}_bagToValue(e=this._bag){if(!this.dictionary){let t=[];for(let a of e||[])i(a)||t.find((e=>e.name===a.name&&e.value===a.value))||t.push(a);return t}let t={};for(let a of e||[])a.name in t||(t[a.name]=a.value);return t}_valueToBag(t=this.value){const a=[];if(!e.Utils.isNullOrEmpty(t)&&"object"==typeof t)if(this.dictionary&&!e.Utils.isArray(t))for(let e in t)a.push({name:e,value:t[e]});else!this.dictionary&&e.Utils.isArray(t)&&Array.prototype.splice.apply(a,[0,0].concat(t.map((t=>e.Utils.clone(t)))));return e.Utils.isNullOrEmpty(a)?[{name:"",value:""}]:a}_deleteAt(e){this._bag.splice(e.detail,1),this.changeHandler(e)}_addItem(t){const a=this._bag,n=this._bag[this._bag.length-1];!e.Utils.isEmpty(a)&&i(n)||a.push({name:"",value:""})}};__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Boolean})],n.prototype,"dictionary",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Json})],n.prototype,"_bag",void 0),n=__decorate([e.CustomElement({tagName:e.P+"-namevalue-list",shadow:e.Defaults.USE_SHADOW_ROOT,template:`<${e.P}-repeater datasource="{{ :host._bag }}" on-itemdelete=":host._deleteAt($event)">\n <template>\n <div class="${e.PCSS}-fieldset ${e.PCSS}-margin margin-bottom-1">\n <div class="fieldset-auto">\n <div class="${e.PCSS}-fieldgroup">\n <${e.P}-input-text ${a} value="{{ ^item.name, twoway }}" on-change=":host.changeHandler($event)"></${e.P}-input-text>\n <div class="fieldgroup-prepend"></div>\n </div>\n <div class="${e.PCSS}-fieldgroup">\n <${e.P}-input-text ${a} value="{{ ^item.value, twoway }}" on-change=":host.changeHandler($event)"></${e.P}-input-text>\n <div class="fieldgroup-append">\n <${e.P}-button class="${e.PCSS}-cell cols-2 flat delete" hide="{{ :host.readonly }}" command-name="delete" command-argument="{{ ^index }}"></${e.P}-button>\n </div>\n </div>\n </div>\n </div>\n </template>\n <${e.P}-button class="flat add" hide="{{ :host.readonly }}" on-click=":host._addItem($event)"></${e.P}-button>\n</${e.P}-repeater>`})],n),t.PacemNameValueListElement=n}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){let a=class PacemPropertyPickerElement extends t.PacemBaseElement{get inputFields(){return[this._select]}toggleReadonlyView(e){this._select.readonly=e}onChange(t){return e.Utils.fromResult(this.value=this._select.value)}acceptValue(e){this._select.value=e}getViewValue(e){return this._select.viewValue}convertValueAttributeToProperty(t){return e.PropertyConverters.Element.convert(t)}viewActivatedCallback(){super.viewActivatedCallback(),this._databind()}propertyChangedCallback(e,t,a,i){if(super.propertyChangedCallback(e,t,a,i),!i&&"target"===e)this._databind()}_databind(){const t=[],a=(i,n,s)=>{const r=i[n];if("object"==typeof r&&null!=r&&!e.Utils.isArray(r))for(let e of Object.keys(r)){const i=s+"."+e;t.push(i),a(r,e,i)}};let i=this.target;if(!e.Utils.isNull(i)){let n=e.CustomElementUtils.getWatchedProperties(i);for(let e of n){let n=e.name;t.push(n),a(i,n,n)}}this._select.datasource=t.sort()}};__decorate([e.ViewChild(e.P+"-select")],a.prototype,"_select",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Element})],a.prototype,"target",void 0),a=__decorate([e.CustomElement({tagName:e.P+"-property-picker",shadow:e.Defaults.USE_SHADOW_ROOT,template:`<${e.P}-select></${e.P}-select>`})],a),t.PacemPropertyPickerElement=a}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){let a=class PacemRadioListElement extends t.PacemDataSourceElement{acceptValue(e){}constructor(){super(),this.key="_"+e.Utils.uniqueCode()}get inputFields(){return[]}propertyChangedCallback(e,t,a,i){super.propertyChangedCallback(e,t,a,i),"disabled"===e&&(this._disable.model=a)}viewActivatedCallback(){super.viewActivatedCallback(),this._disable.model=this.disabled}toggleReadonlyView(e){this._repeater.hidden=e,this._span.hidden=!e}_selectionChanged(e,t,a){"selected"===e.detail.propertyName&&!0===e.detail.currentValue&&(this._selectedValue=this.mapEntityToValue(this.datasource[t]),this.changeHandler(e))}onChange(t){return this.value=this._selectedValue,this.databind(),e.Utils.fromResult(this._selectedValue)}};__decorate([e.ViewChild(e.P+"-repeater")],a.prototype,"_repeater",void 0),__decorate([e.ViewChild(e.P+"-data")],a.prototype,"_disable",void 0),__decorate([e.ViewChild(`span.${e.PCSS}-readonly`)],a.prototype,"_span",void 0),a=__decorate([e.CustomElement({tagName:e.P+"-radio-list",template:`<${e.P}-repeater datasource="{{ :host.adaptedDatasource }}">\n <ol class="${e.PCSS}-radio-list ${e.PCSS}-viewfinder" pacem>\n <template>\n <li><${e.P}-radio disabled="{{ ::_disable.model || ^item.disabled }}" name="{{ :host.key, once }}" autobind="off" caption="{{ ^item.viewValue }}" value="{{ ^item.value }}" selected="{{ :host.isDataSourceItemSelected(^item, :host.value) }}"\non-focus=":host.focusHandler($event)" on-blur=":host.focusHandler($event)"\non-${e.PropertyChangeEventName}=":host._selectionChanged($event, ^index, ^item)"></${e.P}-radio></li>\n </template>\n </ol>\n</${e.P}-repeater><span class="${e.PCSS}-readonly ${e.PCSS}-radio"><${e.P}-text text="{{ :host.viewValue }}"></${e.P}-text></span><${e.P}-data></${e.P}-data><${e.P}-content></${e.P}-content>`,shadow:e.Defaults.USE_SHADOW_ROOT})],a),t.PacemRadioListElement=a}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){let a=class PacemRadioElement extends t.PacemBaseElement{convertValueAttributeToProperty(e){return e}constructor(){super(),this._key="_"+e.Utils.uniqueCode()}toggleReadonlyView(e){this.span.hidden=!e,this._radio.hidden=e}get inputFields(){return[this._radio]}onChange(t){this.selected=this._radio.checked;const a=this.selected?this._radio.value:void 0;return e.Utils.fromResult(a)}viewActivatedCallback(){super.viewActivatedCallback(),this._radio.id=this._label.htmlFor=this._key}propertyChangedCallback(t,a,i,n){switch(super.propertyChangedCallback(t,a,i,n),t){case"name":this._radio.name=i;break;case"selected":(this._radio.checked=i)?e.Utils.addClass(this,e.PCSS+"-selected"):e.Utils.removeClass(this,e.PCSS+"-selected")}}acceptValue(t){this._radio.value=e.Utils.isNullOrEmpty(t)?"":t}getViewValue(t){return e.Utils.isNull(t)?"":this.caption}};__decorate([e.ViewChild("input[type=radio]")],a.prototype,"_radio",void 0),__decorate([e.ViewChild("label")],a.prototype,"_label",void 0),__decorate([e.ViewChild(`.${e.PCSS}-readonly`)],a.prototype,"span",void 0),__decorate([e.Watch({converter:e.PropertyConverters.String})],a.prototype,"caption",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Boolean})],a.prototype,"selected",void 0),a=__decorate([e.CustomElement({tagName:e.P+"-radio",template:`<${e.P}-span class="${e.PCSS}-readonly ${e.PCSS}-radio" text="{{ :host.caption }}"></${e.P}-span><input type="radio" class="${e.PCSS}-input" /><label class="${e.PCSS}-label ${e.PCSS}-radio ${e.PCSS}-viewfinder"><${e.P}-text text="{{ :host.caption }}"></${e.P}-text></label>`,shadow:e.Defaults.USE_SHADOW_ROOT})],a),t.PacemRadioElement=a}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(a){let i=class PacemSelectElement extends a.PacemDataSourceElement{constructor(){super(...arguments),this.emptyOption=!0}toggleReadonlyView(e){this._repeater.hidden=e,this._span.hidden=!e}get inputFields(){return[this._select]}_manageDom(t){const a=t.detail,i=a.item;let n=a.dom.find((e=>e instanceof HTMLOptionElement));n.value=i.value,n.textContent=i.viewValue,n.disabled=i.disabled,n.selected=this.isDataSourceItemSelected(i),(e.Utils.isNullOrEmpty(n.value)?e.Utils.addClass:e.Utils.removeClass).apply(this,[n,e.PCSS+"-watermark"])}onChange(t){let a,i=this._select.selectedIndex,n=this.adaptedDatasource,s=i>=0&&n[i];return a=null!=s?s.value:void 0,e.Utils.fromResult(this.value=a)}propertyChangedCallback(e,t,a,i){switch(super.propertyChangedCallback(e,t,a,i),e){case"placeholder":case"emptyOption":this.databind()}}buildAdaptedDatasource(e=this.datasource){let t=super.buildAdaptedDatasource(e);return t&&this.emptyOption&&t.splice(0,0,{viewValue:this.placeholder||"",value:"",data:null}),t}handleDatasourceMismatch(t){this.emptyOption?super.handleDatasourceMismatch(t):e.Utils.isNullOrEmpty(t)?this.value=void 0:this.value=t[0].value}acceptValue(t){const a=this.adaptedDatasource,i=a&&a.filter((e=>this.isDataSourceItemSelected(e,t)));if(i&&1==i.length)this._select.selectedIndex=a.indexOf(i[0]);else{this._select.value=void 0;let t=this._select.options;t.length>0&&e.Utils.isNullOrEmpty(t[0].value)&&(this._select.selectedIndex=0)}}viewActivatedCallback(){super.viewActivatedCallback();this._select.addEventListener("wheel",this.emitHandler,{capture:!1,passive:!1})}disconnectedCallback(){if(!e.Utils.isNull(this._select)){this._select.removeEventListener("wheel",this.emitHandler,{capture:!1,passive:!1})}super.disconnectedCallback()}};__decorate([e.ViewChild("select")],i.prototype,"_select",void 0),__decorate([e.ViewChild(e.P+"-repeater")],i.prototype,"_repeater",void 0),__decorate([e.ViewChild(`span.${e.PCSS}-readonly`)],i.prototype,"_span",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Boolean})],i.prototype,"emptyOption",void 0),i=__decorate([e.CustomElement({tagName:e.P+"-select",template:`<${e.P}-repeater datasource="{{ :host.adaptedDatasource }}" on-${t.RepeaterItemCreateEventName}=":host._manageDom($event)">\n <select class="${e.PCSS}-select ${e.PCSS}-viewfinder">\n <template>\n <option></option>\n </template>\n </select>\n</${e.P}-repeater><span class="${e.PCSS}-readonly"><${e.P}-text text="{{ :host.viewValue }}"></${e.P}-text></span><${e.P}-content></${e.P}-content>`,shadow:e.Defaults.USE_SHADOW_ROOT})],i),a.PacemSelectElement=i}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(a){let i=class PacemSliderElement extends a.PacemBaseElement{constructor(){super(...arguments),this.inputFields=[],this._dragHandler=e=>{e.preventDefault(),this._computeAndAssignValue(e.detail.currentPosition.x,"end"!==this.changePolicy)},this._endHandler=e=>{e.preventDefault(),this._computeAndAssignValue(e.detail.currentPosition.x,"end"===this.changePolicy)},this._startHandler=e=>{this._thumb.focus()},this._downHandler=t=>{const a=t instanceof MouseEvent?t.clientX:t.touches&&t.touches.length&&t.touches[0].clientX,i=this._trackSize;e.Utils.isNullOrEmpty(i)||this._computeAndAssignValue(a,!0)},this._keydownHandler=t=>{switch(t.keyCode){case 39:case 37:e.avoidHandler(t);let a=39===t.keyCode,i=("number"!=typeof this.step?1:this.step)*(a?1:-1),n=!1,s=t=>{n=!0,window.removeEventListener("keyup",s,!1),e.Utils.removeClass(this,"slider-keydown")};window.addEventListener("keyup",s,!1),e.Utils.addClass(this,"slider-keydown"),e.Utils.accelerateCallback((e=>{(e.cancel=n)||this._setValue(this.value+i)}))}}}onChange(e){return new Promise(((t,a)=>{"slide"===e.type&&t(this.value=e.detail),t(this.value)}))}_draw(t=this.value){const a=this._trackSize;if(e.Utils.isNull(a))return;let i=parseFloat(t)||this.min,n=Math.min(1,Math.max(0,(i-this.min)/(this.max-this.min)));this._progress.style.transform=`scale(${n}, 1)`,this._thumb.style.transform=`translateX(${Math.round(n*a.width)}px)`}_format(t){const a=this.format;if(!e.Utils.isNullOrEmpty(a))return new Intl.NumberFormat(e.Utils.lang(this),a).format(t);let i="-";e.Utils.isNull(t)||(i=t.toLocaleString());let n=new CustomEvent("formatvalue",{detail:{value:t}});return this.dispatchEvent(n),e.Utils.isNull(n.detail.output)?i:n.detail.output}acceptValue(e){this._draw(e)}getViewValue(e){return this._format(e)}convertValueAttributeToProperty(e){return parseFloat(e)}toggleReadonlyView(e){this._thumb.hidden=e}_setTrackSize(e){const t=e.detail;this._trackSize={x:t.left,y:t.top,width:t.width,height:t.height},this._draw(this.value)}_computeAndAssignValue(e,t){if(this.readonly||this.disabled)return;const a=this._trackSize,i=this.step;let n=(e-a.x)/a.width,s=(this.max-this.min)*n+this.min;"number"==typeof i&&(s=Math.round(s/i)*i),t?this._setValue(s):this._draw(s)}_setValue(e){e=Math.min(this.max,Math.max(this.min,e)),isNaN(e)&&(e=void 0),this.changeHandler(new CustomEvent("slide",{detail:e}))}connectedCallback(){super.connectedCallback(),this.addEventListener("mousedown",this._downHandler,!1),this.addEventListener("touchstart",this._downHandler,{passive:!1,capture:!1})}viewActivatedCallback(){super.viewActivatedCallback(),this._dragger.addEventListener(e.UI.DragDropEventType.Init,this._startHandler,!1),this._dragger.addEventListener(e.UI.DragDropEventType.Drag,this._dragHandler,!1),this._dragger.addEventListener(e.UI.DragDropEventType.End,this._endHandler,!1),this._thumb.addEventListener("keydown",this._keydownHandler,!1),this._min.text=this._format(this.min),this._max.text=this._format(this.max);const a=this._shellProxy.dom[0];e.Utils.isNull(a)||(a.target=this._thumb,a.options={trigger:t.UI.BalloonTrigger.Focus,trackPosition:!0,position:t.UI.BalloonPosition.Top,align:t.UI.BalloonAlignment.Center,behavior:t.UI.BalloonBehavior.Tooltip,hoverDelay:0,hoverTimeout:0},this._syncThumbLabel()),this._thumb.tabIndex=0}_syncThumbLabel(t=this.thumbLabel){const a=this._shellProxy.dom[0];(t?e.Utils.addClass:e.Utils.removeClass).apply(this,[this,"slider-thumblabel"]),a.disabled=!t}disconnectedCallback(){this.removeEventListener("mousedown",this._downHandler,!1),this.removeEventListener("touchstart",this._downHandler,{capture:!1}),e.Utils.isNull(this._dragger)||(this._dragger.removeEventListener(e.UI.DragDropEventType.End,this._endHandler,!1),this._dragger.removeEventListener(e.UI.DragDropEventType.Drag,this._dragHandler,!1),this._dragger.removeEventListener(e.UI.DragDropEventType.Init,this._startHandler,!1)),e.Utils.isNull(this._thumb)||this._thumb.removeEventListener("keydown",this._keydownHandler,!1),super.disconnectedCallback()}propertyChangedCallback(t,a,i,n){if(super.propertyChangedCallback(t,a,i,n),!n)switch(t){case"thumbLabel":this._syncThumbLabel(i);break;case"min":case"max":e.Utils.isNull(this._max)||e.Utils.isNull(this._min)||(this._min.text=this._format(this.min),this._max.text=this._format(this.max)),this._setValue(this.value),this._draw()}}};__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],i.prototype,"min",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],i.prototype,"max",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Boolean})],i.prototype,"thumbLabel",void 0),__decorate([e.Watch({emit:!1,converter:{convert:e=>{let t=parseFloat(e);return isNaN(t)?"any":t},convertBack:e=>(e||"").toString()}})],i.prototype,"step",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],i.prototype,"changePolicy",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Json})],i.prototype,"format",void 0),__decorate([e.ViewChild(".slider-track")],i.prototype,"_track",void 0),__decorate([e.ViewChild(".slider-progress")],i.prototype,"_progress",void 0),__decorate([e.ViewChild(".slider-thumb")],i.prototype,"_thumb",void 0),__decorate([e.ViewChild(`${e.P}-text[min]`)],i.prototype,"_min",void 0),__decorate([e.ViewChild(`${e.P}-text[max]`)],i.prototype,"_max",void 0),__decorate([e.ViewChild(`${e.P}-drag-drop`)],i.prototype,"_dragger",void 0),__decorate([e.ViewChild(`${e.P}-shell-proxy`)],i.prototype,"_shellProxy",void 0),i=__decorate([e.CustomElement({tagName:e.P+"-slider",template:`<div class="${e.PCSS}-viewfinder ${e.PCSS}-slider"><${e.P}-text text="{{ :host._format(:host.min) }}" min></${e.P}-text>\n <div class="slider-track"><div class="slider-progress"></div></div>\n <${e.P}-panel class="${e.PCSS}-clickable slider-thumb" behaviors="{{ [::_dragger] }}">\n <div class="thumb-label"></div>\n </${e.P}-panel>\n <${e.P}-text text="{{ :host._format(:host.max) }}" max></${e.P}-text>\n <div class="slider-footer"><${e.P}-text text="{{ :host.viewValue }}"></${e.P}-text></div>\n </div>\n<${e.P}-drag-drop lock-timeout="0"></${e.P}-drag-drop><${e.P}-resize watch-position="true" on-${t.ResizeEventName}=":host._setTrackSize($event)" target="{{ ::_track }}"></${e.P}-resize>\n<${e.P}-shell-proxy><${e.P}-balloon class="text-center"><${e.P}-text text="{{ :host.viewValue }}"></${e.P}-text></${e.P}-balloon></${e.P}-shell-proxy>\n`,shadow:e.Defaults.USE_SHADOW_ROOT})],i),a.PacemSliderElement=i}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(a){var i,n;class SuggestionSelectEvent extends e.CustomTypedEvent{constructor(e){super("suggestionselect",{selectedValue:e})}}let s=class PacemSuggestElement extends a.PacemDataSourceElement{constructor(){super(...arguments),i.set(this,void 0),this._toggleBtnHandler=e=>{e.preventDefault(),this.disabled||this._balloon.toggle()},this._clearBtnHandler=e=>{e.preventDefault(),this.hint=this._input.value="",this.value=void 0,this._focus(null),this.changeHandler(new SuggestionSelectEvent(null))},this._balloonPopupHandler=t=>{e.Utils.addClass(this._btnArrow,"rotate-180")},this._balloonPopoutHandler=t=>{e.Utils.removeClass(this._btnArrow,"rotate-180")},this._inputHandler=e=>{switch(e.keyCode){case 9:case 13:break;default:this._focus(null),this.hint=this._input.value,this.changeHandler(new SuggestionSelectEvent(null))}},this._focusHandler=e=>{if(this.preventFocus){e.preventDefault();this._balloon.visible?this.popout():this.popup()}const t=this._input.value;this.viewValue!=t&&this._databind()},this._blurHandler=e=>{this._undo()},this._keydownHandler=t=>{if(e.Utils.isNull(__classPrivateFieldGet(this,n,"f"))){const a=this._findFirstAvailableListItem();if(!e.Utils.isNull(a))switch(t.keyCode){case 40:e.avoidHandler(t),this._focus(a);break;case 13:e.avoidHandler(t),1===__classPrivateFieldGet(this,i,"f").length?this._select(a):this._focus(a)}}else{var a,s=__classPrivateFieldGet(this,n,"f"),r=s;const i=t=>!e.Utils.isNull(t)&&"li"===t.localName&&"true"===t.dataset.pacemDisabled,o=t=>!e.Utils.isNull(t)&&"li"===t.localName&&"true"!==t.dataset.pacemDisabled;switch(t.keyCode){case 38:e.avoidHandler(t);do{if(o(r=r.previousElementSibling)){a=r;break}}while(i(r));null!=a||(a=s);break;case 40:e.avoidHandler(t);do{if(o(r=r.nextElementSibling)){a=r;break}}while(i(r));null!=a||(a=s);break;case 27:e.avoidHandler(t),this._undo(),this.popout();break;case 9:case 13:e.avoidHandler(t),this._select()}this._focus(a)}},this._selectHandler=t=>{e.avoidHandler(t),this._select(t.currentTarget)},n.set(this,void 0)}get inputFields(){return[this._input]}acceptValue(t){/*!this._isTyping && */!this.allowNew&&e.Utils.isNullOrEmpty(this.datasource)||(this._input.value=this.getViewValue(t)||(this._isTyping?this._input.value:""))}getViewValue(t){var a=super.getViewValue(t);return e.Utils.isNullOrEmpty(a)&&this.allowNew&&!e.Utils.isNullOrEmpty(t)&&(a=this.mapEntityToViewValue(t)),a}onChange(e){return new Promise(((t,a)=>{if("suggestionselect"===e.type){const a=e.detail.selectedValue;this.value=a,a&&this.popout(),t(a)}else t(this.value)}))}viewActivatedCallback(){super.viewActivatedCallback(),this._setDropdownMode(),this._setupItemTemplate();var t=this._createBalloon();t.appendChild(this._repeater),this._checkBalloon(t);e.CustomElementUtils.findAncestorShell(this).appendChild(t),this._balloon=t,this._input.addEventListener("mousedown",this._focusHandler,!1),this._input.addEventListener("keydown",this._keydownHandler,!1),this._input.addEventListener("focus",this._focusHandler,!1),this._input.addEventListener("blur",this._blurHandler,!1),this._input.addEventListener("input",this._inputHandler,!1),this._btnClear.addEventListener("mousedown",this._clearBtnHandler,!1),this._btnArrow.addEventListener("mousedown",this._toggleBtnHandler,!1),this._databind(),this._syncButtons()}propertyChangedCallback(t,a,i,s){if(super.propertyChangedCallback(t,a,i,s),e.Utils.isNull(this._balloon))return;const r=this._isTyping;switch(t){case"adaptedDatasource":e.Utils.isNullOrEmpty(i)?this.popout():r?this.popup():this._input.value=this.getViewValue(this.value);break;case"hint":r||i===this._input.value||(this._input.value=i,__classPrivateFieldSet(this,n,null,"f"));break;case"readonly":this._setDropdownMode();case"disabled":case"value":this._checkBalloon();break;case"itemtemplate":s||this._setupItemTemplate();break;case"allowTyping":s||this._setDropdownMode()}["adaptedDatasource","hint","value"].indexOf(t)>=0&&this._databind(),["allowTyping","value","hint"].indexOf(t)>=0&&this._syncButtons()}disconnectedCallback(){e.Utils.isNull(this._balloon)||(this._balloon.removeEventListener("popup",this._balloonPopupHandler,!1),this._balloon.removeEventListener("popout",this._balloonPopoutHandler,!1),this._balloon.remove()),e.Utils.isNull(this._input)||(this._input.removeEventListener("mousedown",this._focusHandler,!1),this._input.removeEventListener("focus",this._focusHandler,!1),this._input.removeEventListener("blur",this._blurHandler,!1),this._input.removeEventListener("keydown",this._keydownHandler,!1),this._input.removeEventListener("input",this._inputHandler,!1)),e.Utils.isNull(this._btnClear)||this._btnClear.removeEventListener("mousedown",this._clearBtnHandler,!1),e.Utils.isNull(this._btnArrow)||this._btnArrow.addEventListener("mousedown",this._toggleBtnHandler,!1),super.disconnectedCallback()}_databind(){if(!e.Utils.isNull(this._repeater)){const e=__classPrivateFieldSet(this,i,this._filter(this.adaptedDatasource,this._input.value),"f");this._repeater.datasource=e}}_syncButtons(){e.Utils.isNull(this._btnArrow)||(this._btnArrow.hide=!1!==this.allowTyping||!e.Utils.isNullOrEmpty(this._input.value||this.value)),e.Utils.isNull(this._btnClear)||(this._btnClear.hide=this.readonly||e.Utils.isNullOrEmpty(this._input.value||this.value))}get _isTyping(){return e.Utils.is(this._input,":focus")}_undo(){this._focus(null),this.hint=this._input.value=this.getViewValue(this.value)||""}_findFirstAvailableListItem(){var t;if(!0===this._balloon.visible&&!e.Utils.isNull(t=this._repeater.querySelector("ol > li")))for(;!e.Utils.isNull(t)&&"true"===t.dataset.pacemDisabled&&"li"===t.localName;)t=t.nextElementSibling;return t}_setDropdownMode(e=this.allowTyping){this._input.readOnly=!(null==e||e)}_setupItemTemplate(){if(this.itemtemplate instanceof HTMLTemplateElement){const e=this.itemtemplate.cloneNode(!0).content,t=document.createElement("template"),a=document.createElement("li");a.append(e),t.content.appendChild(a),this._tmplProxy.target=t}else this._tmplProxy.target=this._defaultTemplate}_focus(t){if(this.preventFocus)return;if(e.Utils.isNull(t))return void __classPrivateFieldSet(this,n,null,"f");const a=t.parentElement.children;for(let e=0;e<a.length;e++){const i=a.item(e);if(i===t){i.dataset.pacemFocused="true",__classPrivateFieldSet(this,n,i,"f");const e=this._input,t=e.value=JSON.parse(i.dataset.pacemViewValue);e.setSelectionRange(t.length,t.length)}else delete i.dataset.pacemFocused}}_select(e=__classPrivateFieldGet(this,n,"f")){const t=JSON.parse(e.dataset.pacemValue);"true"===e.dataset.pacemDisabled||this.changeHandler(new SuggestionSelectEvent(t))}_filter(t,a,i=this.value){let n=t||[];if(!e.Utils.isNullOrEmpty(a&&a.trim())){const t=a.toLowerCase().split(" ");let i=n.filter((a=>{for(let i of t){if(a.viewValue.toLowerCase().indexOf(i)>=0)return!0;const t=this.filterFields;if(!e.Utils.isNullOrEmpty(t)){const n=a.data;if("object"==typeof n&&!e.Utils.isNullOrEmpty(n))for(let a in n){if(-1===t.indexOf(a))continue;const s=n[a];if(!e.Utils.isNullOrEmpty(s)&&s.toString().toLowerCase().indexOf(i)>=0)return!0}}}return!1}));n=this.allowNew&&e.Utils.isNullOrEmpty(this.valueProperty)&&e.Utils.isNullOrEmpty(this.textProperty)&&(e.Utils.isNullOrEmpty(i)||e.Utils.isNull(i.find((e=>e.viewValue===a))))?[{value:a,viewValue:a,data:a}].concat(i):i}let s=n;return!1!==this.allowTyping&&(s=n.slice(0,this.maxSuggestions||10)),this._isTyping&&this.popup(),this._balloon.style.opacity=e.Utils.isNullOrEmpty(s)?"0":"",this.log(e.Logging.LogLevel.Log,`${s.length} dropdown suggestion(s), given hint '${a}' and ${(t||[]).length} datasource items`),s}_itemCreate(e){const t=e.detail.dom.find((e=>e instanceof HTMLLIElement)),a=e.detail.item,i=(e.detail.index,!0===a.disabled);t.tabIndex=i?-1:0,t.dataset.pacemValue=JSON.stringify(a.value),t.dataset.pacemViewValue=JSON.stringify(a.viewValue),t.dataset.pacemDisabled=i.toString(),t.addEventListener("mousedown",this._selectHandler,!1)}_itemRemove(e){e.detail.dom.find((e=>e instanceof HTMLLIElement)).removeEventListener("mousedown",this._selectHandler,!1)}toggleReadonlyView(e){this.span.hidden=!e,this._input.hidden=e,e?this._btnClear.hide=this._btnArrow.hide=!0:this._syncButtons()}popup(t=100){var a;e.Utils.isNullOrEmpty(this.adaptedDatasource)||null===(a=this._balloon)||void 0===a||a.popup(t)}popout(e=0){var t;__classPrivateFieldSet(this,n,null,"f"),null===(t=this._balloon)||void 0===t||t.popout(e)}_checkBalloon(t=this._balloon){if(!e.Utils.isNull(t)){const a=!e.Utils.isNullOrEmpty(this.value)&&!e.Utils.isNullOrEmpty(this._input.value);t.disabled=a||this.readonly||this.disabled||!1}}_createBalloon(){const a=document.createElement(e.P+"-balloon");return e.Utils.addClass(a,"suggest dropdown"),a.options={trackPosition:!0,trigger:t.UI.BalloonTrigger.Focus,position:t.UI.BalloonPosition.VerticalAuto,size:t.UI.BalloonSizing.Match,align:t.UI.BalloonAlignment.Start,behavior:t.UI.BalloonBehavior.Menu,hoverDelay:100,hoverTimeout:0},a.addEventListener("popup",this._balloonPopupHandler,!1),a.addEventListener("popout",this._balloonPopoutHandler,!1),a.target=this._input,a}};i=new WeakMap,n=new WeakMap,__decorate([e.ViewChild("input[type=text]")],s.prototype,"_input",void 0),__decorate([e.ViewChild(e.P+"-repeater")],s.prototype,"_repeater",void 0),__decorate([e.ViewChild(`span.${e.PCSS}-readonly`)],s.prototype,"span",void 0),__decorate([e.ViewChild("template")],s.prototype,"_defaultTemplate",void 0),__decorate([e.ViewChild(e.P+"-template-proxy")],s.prototype,"_tmplProxy",void 0),__decorate([e.ViewChild(`${e.P}-button[toggle]`)],s.prototype,"_btnArrow",void 0),__decorate([e.ViewChild(`${e.P}-button[clear]`)],s.prototype,"_btnClear",void 0),__decorate([e.Watch({converter:e.PropertyConverters.String})],s.prototype,"hint",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],s.prototype,"maxSuggestions",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Boolean})],s.prototype,"allowTyping",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Boolean})],s.prototype,"preventFocus",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Element})],s.prototype,"itemtemplate",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.StringArray})],s.prototype,"filterFields",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Boolean})],s.prototype,"allowNew",void 0),s=__decorate([e.CustomElement({tagName:e.P+"-suggest",shadow:e.Defaults.USE_SHADOW_ROOT,template:`<div class="${e.PCSS}-relative"><input type="text" class="${e.PCSS}-input" />\n<${e.P}-button clear tab-order="-1"\nclass="button-flat ${e.PCSS}-anim anim-pop anim-sudden anim-quick pos-absolute absolute-right absolute-top display-block ${e.PCSS}-margin margin-0" \n icon-glyph="highlight_off"></${e.P}-button>\n<${e.P}-button \nclass="button-flat icon-rotate ${e.PCSS}-anim anim-pop anim-sudden anim-quick pos-absolute absolute-right absolute-top display-block ${e.PCSS}-margin margin-0" \n icon-glyph="arrow_drop_down" tab-order="-1" toggle></${e.P}-button>\n</div>\n<span class="${e.PCSS}-readonly"><${e.P}-text text="{{ :host.viewValue }}"></${e.P}-text></span>\n<${e.P}-repeater on-${t.RepeaterItemCreateEventName}=":host._itemCreate($event)" on-${t.RepeaterItemRemoveEventName}=":host._itemRemove($event)">\n <ol>\n <${e.P}-template-proxy></${e.P}-template-proxy>\n </ol>\n</${e.P}-repeater><${e.P}-content></${e.P}-content>\n<template>\n <li><${e.P}-span content="{{ $pacem.highlight(^item.viewValue, :host.hint) }}"></${e.P}-span></li>\n</template>`})],s),a.PacemSuggestElement=s}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(a){class TagRemoveEvent extends e.CustomTypedEvent{constructor(e){super("tagremove",{index:e})}}class TagAddEvent extends e.CustomTypedEvent{constructor(e){super("tagadd",{value:e})}}let i=class PacemTagElement extends t.PacemElement{propertyChangedCallback(t,a,i,n){switch(super.propertyChangedCallback(t,a,i,n),t){case"readonly":let t=!!i;(t?e.Utils.addClass:e.Utils.removeClass)(this,"tag-readonly"),this._btn.disabled=this._btn.hide=t;break;case"tag":e.Utils.removeClass(this,"tag-out")}}_remove(){e.Utils.addClass(this,"tag-out"),e.Utils.addAnimationEndCallback(this,(()=>{this.dispatchEvent(new Event("remove"))}))}};__decorate([e.Watch({converter:e.PropertyConverters.String})],i.prototype,"tag",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Boolean})],i.prototype,"readonly",void 0),__decorate([e.ViewChild(e.P+"-button")],i.prototype,"_btn",void 0),i=__decorate([e.CustomElement({tagName:e.P+"-tag",shadow:e.Defaults.USE_SHADOW_ROOT,template:`<${e.P}-text text="{{ :host.tag }}"></${e.P}-text>\n <${e.P}-button on-click=":host._remove()"></${e.P}-button>`})],i),a.PacemTagElement=i;let n=class PacemTagsElement extends a.PacemDataSourceElement{constructor(){super(!0),this.inputFields=[]}toggleReadonlyView(e){this._suggest.readonly=e,this.querySelector(".tag-new").hidden=e}_tagRemove(e){this.changeHandler(new TagRemoveEvent(e))}_tagAdd(e){this.changeHandler(new TagAddEvent(e))}handleDatasourceMismatch(){}propertyChangedCallback(t,a,i,n){switch(super.propertyChangedCallback(t,a,i,n),t){case"datasource":case"textProperty":this._suggest[t]=i;break;case"valueProperty":if(!e.Utils.isNullOrEmpty(i))throw`Cannot set 'valueProperty' on ${this.constructor.name}s.`;break;case"value":this._tags.datasource=i}}onChange(t){return new Promise(((a,i)=>{switch(t.type){case"tagremove":this._justAddedIndex=-1;const i=t.detail.index,n=e.Utils.clone(this.value),s=n.splice(i+1),r=n.splice(0,i);a(this.value=r.concat(s));break;case"tagadd":const o=t.detail.value,l=e.Utils.clone(this.value);if(!e.Utils.isNullOrEmpty(o)&&(this.allowDuplicates||e.Utils.isNullOrEmpty(l&&l.find((e=>this.mapEntityToViewValue(e)==this.mapEntityToViewValue(o)))))){let e=(l||[]).concat([o]);a(this.value=e),this._justAddedIndex=this.value.length-1,setTimeout((()=>{this._suggest.focus()}),250),this._suggest.blur(),this._suggest.hint="",this._suggest.reset()}break;default:a(this.value)}}))}acceptValue(e){}};__decorate([e.Watch({converter:e.PropertyConverters.String})],n.prototype,"hint",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Boolean})],n.prototype,"allowDuplicates",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Boolean})],n.prototype,"allowNew",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Number})],n.prototype,"_justAddedIndex",void 0),__decorate([e.ViewChild(e.P+"-suggest")],n.prototype,"_suggest",void 0),__decorate([e.ViewChild(e.P+"-repeater."+e.PCSS+"-tags")],n.prototype,"_tags",void 0),n=__decorate([e.CustomElement({tagName:e.P+"-tags",shadow:e.Defaults.USE_SHADOW_ROOT,template:`<${e.P}-repeater class="${e.PCSS}-tags">\n <ul class="${e.PCSS}-tags ${e.PCSS}-viewfinder ${e.PCSS}-list list-unstyled list-inline">\n <template>\n <li class="${e.PCSS}-tag">\n <${e.P}-tag on-remove=":host._tagRemove(^index)" css-class="{{ { 'tag-in': :host._justAddedIndex === ^index } }}" tag="{{ :host.mapEntityToViewValue(^item) }}" readonly="{{ :host.readonly }}"></${e.P}-tag>\n </li>\n </template>\n <li class="tag-new">\n <${e.P}-suggest logger="{{ :host.logger }}" placeholder="{{ :host.placeholder }}" allow-new="{{ :host.allowNew }}" class="${e.PCSS}-tags" on-change=":host._tagAdd($this.value)" hint="{{ :host.hint, twoway }}">\n <${e.P}-content></${e.P}-content>\n </${e.P}-suggest>\n </li>\n </ul>\n</${e.P}-repeater>`})],n),a.PacemTagsElement=n}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){let a=class PacemMarkdownTextAreaElement extends t.PacemTextualInputElement{constructor(t=new e.MarkdownService){super(),this._md=t,this.rows=5,this.cols=50,this._keydownHandler=t=>{if(9===t.keyCode){const i=this.input,n=i.value;var a=i.selectionStart;i.value=n.substr(0,a)+" "+n.substr(a),e.preventDefaultHandler(t)}}}toggleReadonlyView(e){this.input.hidden=e}get preventKeyboardSubmit(){return!0}get inputFields(){return[this.input]}getViewValue(e){return this._md.toHtml(e)}propertyChangedCallback(e,t,a,i){super.propertyChangedCallback(e,t,a,i),"rows"===e||"cols"===e?this.inputField.setAttribute(e,a):"viewValue"==e&&(this._markdown.innerHTML=a)}viewActivatedCallback(){super.viewActivatedCallback(),this.input.addEventListener("keydown",this._keydownHandler,!1)}disconnectedCallback(){this.input&&this.input.removeEventListener("keydown",this._keydownHandler,!1),super.disconnectedCallback()}};__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],a.prototype,"rows",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],a.prototype,"cols",void 0),__decorate([e.ViewChild("textarea")],a.prototype,"input",void 0),__decorate([e.ViewChild(`div.${e.PCSS}-readonly`)],a.prototype,"_markdown",void 0),a=__decorate([e.CustomElement({tagName:e.P+"-textarea-markdown",template:`<textarea class="${e.PCSS}-input" pacem></textarea>${t.CHAR_COUNTER_CHILD}<div class="${e.PCSS}-readonly ${e.PCSS}-markdown"></div>`,shadow:e.Defaults.USE_SHADOW_ROOT})],a),t.PacemMarkdownTextAreaElement=a}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){let a=class PacemTextAreaElement extends t.PacemTextualInputElement{constructor(){super(...arguments),this.rows=5,this.cols=50}get preventKeyboardSubmit(){return!0}toggleReadonlyView(e){this._span.hidden=!e,this._input.hidden=e}get inputFields(){return[this._input]}propertyChangedCallback(e,t,a,i){super.propertyChangedCallback(e,t,a,i),"rows"!==e&&"cols"!==e||this.inputField.setAttribute(e,a)}};__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],a.prototype,"rows",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],a.prototype,"cols",void 0),__decorate([e.ViewChild("textarea")],a.prototype,"_input",void 0),__decorate([e.ViewChild(`span.${e.PCSS}-readonly`)],a.prototype,"_span",void 0),a=__decorate([e.CustomElement({tagName:e.P+"-textarea",template:`<textarea class="${e.PCSS}-input" pacem></textarea>${t.CHAR_COUNTER_CHILD}<span class="${e.PCSS}-readonly"><${e.P}-text text="{{ :host.viewValue }}"></${e.P}-text></span>`,shadow:e.Defaults.USE_SHADOW_ROOT})],a),t.PacemTextAreaElement=a}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){var a,i;class PacemBaseValidatorElement extends t.PacemFormRelevantElement{constructor(){super(),a.set(this,void 0)}viewActivatedCallback(){super.viewActivatedCallback(),e.Utils.addClass(this,e.PCSS+"-validator")}propertyChangedCallback(t,a,i,n){super.propertyChangedCallback(t,a,i,n);let s=this.form;switch(t){case"watch":a&&s&&s.unregisterValidator(i,this),s&&s.registerValidator(i,this);break;case"invalid":break;case"form":let t=this.watch;e.Utils.isNullOrEmpty(t)||(null!=a&&a.unregisterValidator(t,this),null!=i&&i.registerValidator(t,this));break;case"disabled":this.triggerFormFieldValidation()}}triggerFormFieldValidation(){const t=this.form,i=this.watch;e.Utils.isNull(t)||e.Utils.isNullOrEmpty(i)||(cancelAnimationFrame(__classPrivateFieldGet(this,a,"f")),__classPrivateFieldSet(this,a,requestAnimationFrame((()=>{t.validate(i)})),"f"))}validate(t){return this.disabled?e.Utils.fromResult(!0):this.evaluate(t)}}function n(t){return e.Utils.isNullOrEmpty(t)}a=new WeakMap,__decorate([e.Watch({converter:e.PropertyConverters.Boolean})],PacemBaseValidatorElement.prototype,"invalid",void 0),__decorate([e.Watch({converter:e.PropertyConverters.String})],PacemBaseValidatorElement.prototype,"errorMessage",void 0),__decorate([e.Watch({emit:!1,reflectBack:!0,converter:e.PropertyConverters.String})],PacemBaseValidatorElement.prototype,"watch",void 0),t.PacemBaseValidatorElement=PacemBaseValidatorElement,t.BASIC_VALIDATOR_TEMPLATE=`<${e.P}-span part="error-message" hide="{{ !:host.invalid }}" text="{{ :host.errorMessage }}"></${e.P}-span>`;let s=class PacemRequiredValidatorElement extends PacemBaseValidatorElement{evaluate(t){let a=!n(t);return e.Utils.fromResult(a)}};s=__decorate([e.CustomElement({tagName:e.P+"-required-validator",template:t.BASIC_VALIDATOR_TEMPLATE,shadow:e.Defaults.USE_SHADOW_ROOT})],s),t.PacemRequiredValidatorElement=s;let r=class PacemRegexValidatorElement extends PacemBaseValidatorElement{propertyChangedCallback(e,t,a,i){super.propertyChangedCallback(e,t,a,i),i||"pattern"!==e||this.triggerFormFieldValidation()}evaluate(t){let a=!0,i=this.pattern;return n(t)||(a=new RegExp(i).test(t)),e.Utils.fromResult(a)}};__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],r.prototype,"pattern",void 0),r=__decorate([e.CustomElement({tagName:e.P+"-regex-validator",template:t.BASIC_VALIDATOR_TEMPLATE,shadow:e.Defaults.USE_SHADOW_ROOT})],r),t.PacemRegexValidatorElement=r;let o=class PacemLengthValidatorElement extends PacemBaseValidatorElement{propertyChangedCallback(e,t,a,i){super.propertyChangedCallback(e,t,a,i),i||"min"!==e&&"max"!==e||this.triggerFormFieldValidation()}evaluate(t){let a=!0;return n(t)||(this.min>=0&&(a=a&&(t||"").toString().length>=this.min),this.max>=0&&(a=a&&(t||"").toString().length<=this.max)),e.Utils.fromResult(a)}};__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],o.prototype,"min",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],o.prototype,"max",void 0),o=__decorate([e.CustomElement({tagName:e.P+"-length-validator",template:t.BASIC_VALIDATOR_TEMPLATE,shadow:e.Defaults.USE_SHADOW_ROOT})],o),t.PacemLengthValidatorElement=o;let l=class PacemRangeValidatorElement extends PacemBaseValidatorElement{propertyChangedCallback(e,t,a,i){super.propertyChangedCallback(e,t,a,i),i||"min"!==e&&"max"!==e||this.triggerFormFieldValidation()}evaluate(t){let a=!0;if(!n(t)){let i=t;t instanceof Date||"number"!=typeof t&&(i=e.Utils.parseDate(t))instanceof Date&&isFinite(i.valueOf())?(null!=this.min&&(a=a&&i.valueOf()>=e.Utils.parseDate(this.min).valueOf()),null!=this.max&&(a=a&&i.valueOf()<=e.Utils.parseDate(this.max).valueOf())):(null!=this.min&&(a=a&&t>=this.min),null!=this.max&&(a=a&&t<=this.max))}return e.Utils.fromResult(a)}};__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],l.prototype,"min",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],l.prototype,"max",void 0),l=__decorate([e.CustomElement({tagName:e.P+"-range-validator",template:t.BASIC_VALIDATOR_TEMPLATE,shadow:e.Defaults.USE_SHADOW_ROOT})],l),t.PacemRangeValidatorElement=l;let d=class PacemCompareValidatorElement extends PacemBaseValidatorElement{propertyChangedCallback(e,t,a,i){super.propertyChangedCallback(e,t,a,i),i||"operator"!==e&&"to"!==e||this.triggerFormFieldValidation()}_prepareValuesForComparison(t,a){return e.Utils.Dates.isDate(t)||e.Utils.Dates.isDate(a)?[e.Utils.parseDate(t),e.Utils.parseDate(a)]:[t,a]}evaluate(t){let a=!0,i=this.to;if(!n(t)&&!n(i)){const e=this._prepareValuesForComparison(t,i);switch(t=e[0],i=e[1],this.operator){case"lessOrEqual":a=t<=i;break;case"less":a=t<i;break;case"greaterOrEqual":a=t>=i;break;case"greater":a=t>i;break;case"notEqual":a=t!==i;break;default:a=t===i}}return e.Utils.fromResult(a)}};__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],d.prototype,"operator",void 0),__decorate([e.Watch({emit:!1,reflectBack:!0})],d.prototype,"to",void 0),d=__decorate([e.CustomElement({tagName:e.P+"-compare-validator",template:t.BASIC_VALIDATOR_TEMPLATE,shadow:e.Defaults.USE_SHADOW_ROOT})],d),t.PacemCompareValidatorElement=d;let c=class PacemBinaryValidatorElement extends PacemBaseValidatorElement{propertyChangedCallback(e,t,a,i){super.propertyChangedCallback(e,t,a,i),i||"pattern"!==e&&"maxSize"!==e||this.triggerFormFieldValidation()}evaluate(t){let a=!0,i=this.pattern,s=this.maxSize;if(!n(t)){if(!e.Utils.isNullOrEmpty(i)){let e="string"==typeof t?t:t.name;a=new RegExp(i,"i").test(e)}!e.Utils.isNull(s)&&"object"==typeof t&&t.size>0&&(a=a&&t.size<=s)}return e.Utils.fromResult(a)}};__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],c.prototype,"pattern",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],c.prototype,"maxSize",void 0),c=__decorate([e.CustomElement({tagName:e.P+"-binary-validator",template:t.BASIC_VALIDATOR_TEMPLATE,shadow:e.Defaults.USE_SHADOW_ROOT})],c),t.PacemBinaryValidatorElement=c;let h=class PacemAsyncValidatorElement extends PacemBaseValidatorElement{constructor(){super(...arguments),i.set(this,void 0),this._deferredToken=null}_evaluateResult(){const t=this._fetcher.result;switch(t){case"true":return!0;case"false":return!1;default:try{let a=JSON.parse(t);return e.Utils.getApiResult(a)||!1}catch(e){return!1}}}_fetch(t){const a=this._deferredToken,n=this._fetcher;var s=this.parameters||{};s[this.watch]=t;const r={parameters:s,url:this.url,as:"text",method:this.method},o=e.Utils.jsonSortStringify(r),l=__classPrivateFieldGet(this,i,"f");let d=!1;if(e.Utils.isNullOrEmpty(l)||(d=o===l),d){const e=this._evaluateResult();a.resolve(e)}else e.Utils.extend(n,r),clearTimeout(this._debouncer),this._debouncer=setTimeout((()=>{n.fetch().then((e=>{const t=this._evaluateResult();a.resolve(t),__classPrivateFieldSet(this,i,o,"f")}),(e=>{a.resolve(!1)}))}),1e3);return a.promise}evaluate(t){return e.Utils.isNullOrEmpty(t)?e.Utils.fromResult(!0):(this._deferredToken=this._deferredToken=e.DeferPromise.defer(),this._fetch(t).then((e=>(this._deferredToken=null,e)),(e=>(this._deferredToken=null,!1))))}propertyChangedCallback(e,t,a,i){if(super.propertyChangedCallback(e,t,a,i),!i)switch(e){case"parameters":case"url":case"method":case"fetchCredentials":case"fetchHeaders":this.triggerFormFieldValidation()}}};i=new WeakMap,__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Json})],h.prototype,"parameters",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Json})],h.prototype,"fetchCredentials",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Json})],h.prototype,"fetchHeaders",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],h.prototype,"url",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],h.prototype,"method",void 0),__decorate([e.ViewChild(e.P+"-fetch")],h.prototype,"_fetcher",void 0),h=__decorate([e.CustomElement({tagName:e.P+"-async-validator",template:t.BASIC_VALIDATOR_TEMPLATE+`<${e.P}-fetch autofetch="false" throttle="true" credentials="{{ :host.fetchCredentials }}" headers="{{ :host.fetchHeaders }}"></${e.P}-fetch>`,shadow:e.Defaults.USE_SHADOW_ROOT})],h),t.PacemAsyncValidatorElement=h;let p=class PacemCustomValidatorElement extends PacemBaseValidatorElement{propertyChangedCallback(e,t,a,i){super.propertyChangedCallback(e,t,a,i),i||"isValid"!==e||this.triggerFormFieldValidation()}evaluate(t){let a=!0;return n(t)||(a=!!this.isValid),e.Utils.fromResult(a)}};__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Boolean})],p.prototype,"isValid",void 0),p=__decorate([e.CustomElement({tagName:e.P+"-custom-validator",template:t.BASIC_VALIDATOR_TEMPLATE,shadow:e.Defaults.USE_SHADOW_ROOT})],p),t.PacemCustomValidatorElement=p}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){class PacemContenteditableButtonCommandElement extends t.PacemContenteditableCommandElement{cleanUp(e){}propertyChangedCallback(t,a,i,n){super.propertyChangedCallback(t,a,i,n),"range"===t&&(this.active=!e.Utils.isNull(i))}getTooltip(t=this.altText,a=this.keyboardShortcut){const i=t;return e.Utils.isNullOrEmpty(a)?i:`${i} (${a})`}}__decorate([e.Watch({converter:e.PropertyConverters.String})],PacemContenteditableButtonCommandElement.prototype,"icon",void 0),__decorate([e.Watch({converter:e.PropertyConverters.String})],PacemContenteditableButtonCommandElement.prototype,"keyboardShortcut",void 0),__decorate([e.Watch({converter:e.PropertyConverters.String})],PacemContenteditableButtonCommandElement.prototype,"altText",void 0),__decorate([e.Watch({converter:e.PropertyConverters.Boolean})],PacemContenteditableButtonCommandElement.prototype,"active",void 0),t.PacemContenteditableButtonCommandElement=PacemContenteditableButtonCommandElement,t.CONTENTELEMENT_BUTTONCOMMAND_TEMPLATE=`<${e.P}-button disabled="{{ !:host.active }}" css-class="{{ {'text-primary': :host.isRelevant(:host.range)} }}" tooltip="{{ :host.getTooltip(:host.altText, :host.keyboardShortcut) }}" class="button" on-click=":host.execCommand()"><${e.P}-icon class="text-rootsize" icon="{{ :host.icon }}"></${e.P}-icon></${e.P}-button>\n <${e.P}-shortcut disabled="{{ !:host.active }}" target="{{ :host.contentElement }}" combination="{{ :host.keyboardShortcut }}" on-execute=":host.execCommand()"></${e.P}-shortcut>`}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){function a(e){return"format_align_"+e}let i=class PacemContenteditableAlignCommandElement extends t.PacemContenteditableButtonCommandElement{isRelevant(a){const i=t.ContenteditableUtils.findSurroundingSiblingBlockElements(a);if(e.Utils.isNullOrEmpty(i))return!1;const n=i[0];return getComputedStyle(n).textAlign==this.align}propertyChangedCallback(t,i,n,s){super.propertyChangedCallback(t,i,n,s),"align"===t&&((e.Utils.isNullOrEmpty(this.icon)||this.icon===a(i))&&(this.icon=a(n)),(e.Utils.isNullOrEmpty(this.altText)||this.altText===i)&&(this.altText=n))}exec(){const a=t.ContenteditableUtils.findSurroundingSiblingBlockElements(this.range);let i;for(let n of a)t.ContenteditableUtils.isBlockElement(n)&&n instanceof HTMLElement&&(e.Utils.isNull(i)&&(i=e.Utils.hasClass(n,"text-"+this.align)?"":this.align),n.style.textAlign="",e.Utils.removeClass(n,"text-left text-right text-center text-justify"),e.Utils.isEmpty(i)||e.Utils.addClass(n,"text-"+i));return Promise.resolve()}};__decorate([e.Watch({converter:e.PropertyConverters.String})],i.prototype,"align",void 0),i=__decorate([e.CustomElement({tagName:e.P+"-contenteditable-aligncommand",shadow:e.Defaults.USE_SHADOW_ROOT,template:t.CONTENTELEMENT_BUTTONCOMMAND_TEMPLATE})],i),t.PacemContenteditableAlignCommandElement=i}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){let a;function i(e){const t=null==e?void 0:e.toLowerCase();switch(t){case"bold":case"italic":return"format_"+t;case"underline":return"format_underlined";case"strikethrough":return"strikethrough_s";case"insertorderedlist":return"format_list_numbered";case"insertunorderedlist":return"format_list_bulleted";case"justifyleft":case"justifyright":case"justifycenter":return"format_align_"+t.substr(7);case"justifyfull":return"format_align_justify";default:return"help_outline"}}function n(e,t){switch(null==e?void 0:e.toLowerCase()){case"bold":return["b","strong"];case"italic":return["i","em"];case"underline":return["u"];case"strikethrough":return["strike","s","del"];case"insertorderedlist":return["ol"];case"insertunorderedlist":return["ul"];case"justifyleft":return[{style:{name:"text-align",value:"left"}}];case"justifyright":return[{style:{name:"text-align",value:"right"}}];case"justifycenter":return[{style:{name:"text-align",value:"center"}}];case"justifyfull":return[{style:{name:"text-align",value:"justify"}}];case"formatblock":return[t];default:return["none"]}}!function(e){e.Bold="bold",e.Italic="italic",e.Underline="underline",e.StrikeThrough="strikeThrough",e.OrderedList="insertOrderedList",e.UnorderedList="insertUnorderedList",e.JustifyLeft="justifyLeft",e.JustifyCenter="justifyCenter",e.JustifyRight="justifyRight",e.JustifyFull="justifyFull"}(a=t.KnownExecCommand||(t.KnownExecCommand={}));let s=class PacemContenteditableExecCommandElement extends t.PacemContenteditableButtonCommandElement{_matchRelevance(a,i){const n="object"==typeof i?t.ContenteditableUtils.findSurroundingNode(a,(t=>t instanceof HTMLElement&&(e.Utils.isNullOrEmpty(i.tagName)||t.tagName===i.tagName.toUpperCase())&&t.style[i.style.name]===i.style.value)):t.ContenteditableUtils.findSurroundingNode(a,i);return!e.Utils.isNull(n)}isRelevant(e){const t=n(this.command,this.argument);for(let a of t)if(this._matchRelevance(e,a))return!0;return!1}propertyChangedCallback(t,a,n,s){super.propertyChangedCallback(t,a,n,s),"command"===t&&((e.Utils.isNullOrEmpty(this.icon)||this.icon===i(a))&&(this.icon=i(n)),(e.Utils.isNullOrEmpty(this.altText)||this.altText===a)&&(this.altText=n))}exec(){return new Promise(((a,i)=>{const s=this.range,r=n(this.command,this.argument)[0];if(!e.Utils.isNull(s)){const a=t.ContenteditableUtils.testInertElementWrapping(s);if(a.result&&"string"==typeof r&&["b","i","strike","u"].indexOf(r)>=0){const i=t.ContenteditableUtils.findSurroundingNode(s,r);if(e.Utils.isNull(i)||1!==i.childNodes.length){const e=document.createElement(r),i=a.element,n=s.extractContents();s.insertNode(e),e.append(n),t.ContenteditableUtils.select(i)}else{const e=i.childNodes.item(0),n=a.element;i.parentElement.replaceChild(e,i),t.ContenteditableUtils.select(n)}}else document.execCommand(this.command,!1,this.argument)}a()}))}};__decorate([e.Watch({converter:e.PropertyConverters.String})],s.prototype,"command",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],s.prototype,"argument",void 0),s=__decorate([e.CustomElement({tagName:e.P+"-contenteditable-execcommand",shadow:e.Defaults.USE_SHADOW_ROOT,template:t.CONTENTELEMENT_BUTTONCOMMAND_TEMPLATE})],s),t.PacemContenteditableExecCommandElement=s}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){let a=class PacemContenteditableHistoryCommandElement extends t.PacemContenteditableButtonCommandElement{exec(){return new Promise(((t,a)=>{var i;const n=null===(i=this.container)||void 0===i?void 0:i.history;if(!e.Utils.isNull(n)){if("redo"===this.command)n.canRedo&&(n.redo(),t());else n.canUndo&&(n.undo(),t());this.contentElement.innerHTML=n.current}}))}isRelevant(e){return!1}propertyChangedCallback(e,t,a,i){if(super.propertyChangedCallback(e,t,a,i),"command"===e)this.icon=this.icon||a,this.altText=a,this.keyboardShortcut=this.keyboardShortcut||"Ctrl+"+("redo"===a?"Y":"Z")}containerPropertyChangedCallback(t,a,i,n){super.containerPropertyChangedCallback(t,a,i,n);const s=this.container,r=s.history;"range"!==t&&"history"!==t||(this.active=!e.Utils.isNull(s.range)&&("redo"===this.command&&(null==r?void 0:r.canRedo)||"redo"!==this.command&&(null==r?void 0:r.canUndo)))}};__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String,reflectBack:!0})],a.prototype,"command",void 0),a=__decorate([e.CustomElement({tagName:e.P+"-contenteditable-historycommand",shadow:e.Defaults.USE_SHADOW_ROOT,template:t.CONTENTELEMENT_BUTTONCOMMAND_TEMPLATE})],a),t.PacemContenteditableHistoryCommandElement=a}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){var a;function i(t,a){return new Promise(((i,n)=>{e.Utils.blobToDataURL(a).then(e.Utils.loadImage).then((e=>{const a=document.createElement("picture");a.setAttribute("contenteditable","false"),e.tabIndex=0,a.appendChild(e),t.deleteContents(),t.insertNode(a),i(a)}))}))}let n=class PacemContenteditableImageCommandElement extends t.PacemContenteditableButtonCommandElement{constructor(){super(...arguments),a.set(this,void 0),this._setBehaviorHandler=e=>{const a=e.target.parentElement;this.range=t.ContenteditableUtils.select(a)},this._disposeBehaviorHandler=e=>{}}pasteCallback(e){return e.type.startsWith("image")?i(this.range,e):Promise.reject()}cleanUp(t){t.querySelectorAll("picture[contenteditable=false]").forEach((e=>{for(let t=e.childNodes.length-1;t>0;t--)e.childNodes.item(t).remove()})),t.querySelectorAll("div."+e.PCSS+"-rescale").forEach((e=>e.remove()))}isRelevant(e){return!1}viewActivatedCallback(){super.viewActivatedCallback(),e.Utils.isNullOrEmpty(this.altText)&&(this.altText="insert image"),e.Utils.isNullOrEmpty(this.icon)&&(this.icon="insert_photo"),e.Utils.isNullOrEmpty(this.keyboardShortcut)&&(this.keyboardShortcut="Ctrl+Shift+I"),this._rescale.addEventListener("rescale",this._rescaleImg,!1)}disconnectedCallback(){e.Utils.isNull(this._rescale)||(this._rescale.removeEventListener("rescale",this._rescaleImg,!1),this._disposeContainer()),super.disconnectedCallback()}propertyChangedCallback(t,a,i,n){switch(super.propertyChangedCallback(t,a,i,n),t){case"disabled":e.Utils.isNull(this._rescale)||(this._rescale.disabled=i);break;case"contentElement":a&&this._disposeContainer(a),i&&this._initContainer(i);break;case"range":this._rangeChangeCallback(a,i)}}exec(){return new Promise(((t,a)=>{const n=this._file,s=this.range;n.onchange=a=>{const r=n.files[0];e.Utils.isNull(r)?t():i(s,r).then((e=>{n.value="",t()}))},n.click()}))}_rescaleImg(e){e.preventDefault();const t=e.detail.element,a=e.detail.targetRect,i=t.firstElementChild;i.style.width=a.width+"px",i.style.height=a.height+"px"}_rangeChangeCallback(t,a){if(!e.Utils.isNull(t)&&!t.collapsed&&t.commonAncestorContainer instanceof Element&&t.commonAncestorContainer===t.startContainer&&t.commonAncestorContainer===t.endContainer&&t.startOffset===t.endOffset-1){const e=t.commonAncestorContainer.childNodes.item(t.startOffset);e instanceof HTMLPictureElement&&this._rescale.unregister(e)}if(!e.Utils.isNull(a)&&!a.collapsed&&a.commonAncestorContainer instanceof Element&&a.commonAncestorContainer===a.startContainer&&a.commonAncestorContainer===a.endContainer&&a.startOffset===a.endOffset-1){const e=a.commonAncestorContainer.childNodes.item(a.startOffset);e instanceof HTMLPictureElement&&this._rescale.register(e)}}_enhancePictureElement(e){e.firstElementChild&&(e.firstElementChild.addEventListener("focus",this._setBehaviorHandler,!1),e.firstElementChild.addEventListener("blur",this._disposeBehaviorHandler,!1))}_downgradePictureElement(e){e.firstElementChild&&(e.firstElementChild.removeEventListener("focus",this._setBehaviorHandler,!1),e.firstElementChild.removeEventListener("blur",this._disposeBehaviorHandler,!1))}_initContainer(e=this.contentElement){__classPrivateFieldSet(this,a,new t.ContenteditableDOMObserver(e,((e,t)=>{e instanceof HTMLPictureElement&&(t?this._downgradePictureElement(e):this._enhancePictureElement(e))}),"picture"),"f")}_disposeContainer(t=this.contentElement){const i=__classPrivateFieldGet(this,a,"f");e.Utils.isNull(i)||i.dispose()}};a=new WeakMap,__decorate([e.ViewChild("input[type=file]")],n.prototype,"_file",void 0),__decorate([e.ViewChild(e.P+"-rescale")],n.prototype,"_rescale",void 0),n=__decorate([e.CustomElement({tagName:e.P+"-contenteditable-imagecommand",shadow:e.Defaults.USE_SHADOW_ROOT,template:`<input type="file" accept="image/png, image/gif, image/jpeg, image/bmp, image/x-icon" class="${e.PCSS}-trasparent ${e.PCSS}-inert" pacem hidden>`+t.CONTENTELEMENT_BUTTONCOMMAND_TEMPLATE+`<${e.P}-rescale keep-proportions="true"></${e.P}-rescale>`})],n),t.PacemContenteditableImageCommandElement=n}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){let a=class PacemContenteditableLinkCommandElement extends t.PacemContenteditableButtonCommandElement{isRelevant(a){return!e.Utils.isNull(t.ContenteditableUtils.findSurroundingNode(a,HTMLAnchorElement))}viewActivatedCallback(){super.viewActivatedCallback(),e.Utils.isNullOrEmpty(this.altText)&&(this.altText="insert link"),e.Utils.isNullOrEmpty(this.icon)&&(this.icon="insert_link"),e.Utils.isNullOrEmpty(this.keyboardShortcut)&&(this.keyboardShortcut="Ctrl+H")}exec(e,a=this.target){return new Promise(((i,n)=>{var s=this.range,r=t.ContenteditableUtils.findSurroundingNode(s,HTMLAnchorElement),o="http://",l=/<a.*href=\"([^\"]*)/;if(r&&l.test(r.outerHTML)&&(o=l.exec(r.outerHTML)[1]),"current"===e)return"http://"==o?"":o;var d=e||void 0===e&&window.prompt("link (empty to unlink):",o);d?(document.execCommand("createLink",!1,d),(r=t.ContenteditableUtils.findSurroundingNode(s,HTMLAnchorElement))&&r.setAttribute("target",a||"_blank")):document.execCommand("unlink"),i()}))}};__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],a.prototype,"target",void 0),a=__decorate([e.CustomElement({tagName:e.P+"-contenteditable-linkcommand",shadow:e.Defaults.USE_SHADOW_ROOT,template:t.CONTENTELEMENT_BUTTONCOMMAND_TEMPLATE})],a),t.PacemContenteditableLinkCommandElement=a}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){var a,i,n;function s(e){return e instanceof HTMLModElement&&"INS"===e.tagName}let r=class PacemContenteditablePlaceholderElement extends t.PacemContenteditableCommandElement{constructor(){super(...arguments),a.set(this,void 0),i.set(this,void 0),n.set(this,void 0),this._focusHandler=e=>{const a=e.target;this.range=t.ContenteditableUtils.select(a)}}cleanUp(t){t.querySelectorAll("ins[contenteditable=false]").forEach((t=>{e.Utils.removeClass(t,"placeholder-selected")}))}exec(e){const a=function(e,t){const a=document.createElement("ins");return a.textContent=t,a.setAttribute("contenteditable","false"),a.tabIndex=0,e.deleteContents(),e.insertNode(a),a}(this.range,e);return t.ContenteditableUtils.select(a).collapse(!1),Promise.resolve(a)}isRelevant(e){var t,i;return null!==(i=null===(t=__classPrivateFieldGet(this,a,"f"))||void 0===t?void 0:t.result)&&void 0!==i&&i}viewActivatedCallback(){super.viewActivatedCallback(),this._fillDropdown(),this._initContainer()}propertyChangedCallback(e,t,a,i){if(super.propertyChangedCallback(e,t,a,i),!i)switch(e){case"datasource":this._fillDropdown();break;case"contentElement":t&&this._disposeContainer(t),a&&this._initContainer(a);break;case"range":this._changeRelevancy()}}disconnectedCallback(){this._disposeContainer(),super.disconnectedCallback()}_changeRelevancy(i=this.range){const n=__classPrivateFieldGet(this,a,"f");e.Utils.isNull(null==n?void 0:n.element)||e.Utils.removeClass(n.element,"placeholder-selected");const r=__classPrivateFieldSet(this,a,function(e){const a=t.ContenteditableUtils.testInertElementWrapping(e);if(a.result&&s(a.element)){const e=a.element;return{result:!0,element:e,placeholder:e.textContent}}return{result:!1}}(i),"f");e.Utils.isNull(null==r?void 0:r.element)||e.Utils.addClass(r.element,"placeholder-selected"),r.result?this._dropdown.value=r.placeholder:(this._dropdown.popout(),this._dropdown.value=void 0)}_fillDropdown(e=this.datasource||[]){const t=__classPrivateFieldSet(this,i,e.map((e=>"string"==typeof e?{placeholder:e,definition:e}:e)),"f"),a=this._dropdown;a.textProperty=a.valueProperty="placeholder",a.datasource=t}_initContainer(e=this.contentElement){__classPrivateFieldSet(this,n,new t.ContenteditableDOMObserver(e,((e,t)=>{s(e)&&(t?this._downgradePlaceholderElement(e):this._enhancePlaceholderElement(e))}),"ins[contenteditable=false]"),"f")}_disposeContainer(t=this.contentElement){const a=__classPrivateFieldGet(this,n,"f");e.Utils.isNull(a)||a.dispose()}_enhancePlaceholderElement(e){e.addEventListener("focus",this._focusHandler,!1)}_downgradePlaceholderElement(e){e.removeEventListener("focus",this._focusHandler,!1)}};a=new WeakMap,i=new WeakMap,n=new WeakMap,__decorate([e.ViewChild("template")],r.prototype,"_itemtemplate",void 0),__decorate([e.ViewChild(e.P+"-suggest")],r.prototype,"_dropdown",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Json})],r.prototype,"datasource",void 0),r=__decorate([e.CustomElement({tagName:e.P+"-contenteditable-placeholder",shadow:e.Defaults.USE_SHADOW_ROOT,template:`<template>\n<${e.P}-span text="{{ ^item.viewValue }}" class="text-tech"></${e.P}-span>\n<${e.P}-markdown hide="{{ $pacem.isNullOrEmpty(^item.data.definition) || ^item.viewValue === ^item.data.definition }}" class="${e.PCSS}-margin margin-0 text-small" value="{{ ^item.data.definition }}"></${e.P}-markdown>\n</template>\n<${e.P}-suggest placeholder="Placeholder" class="pacem-button button" disabled="{{ $pacem.isNull(:host.range) }}"\n on-change=":host.execCommand($this.value)"\n css-class="{{ {'text-primary': :host.isRelevant(:host.range)} }}" \n compare-by="placeholder" text-property="placeholder" itemtemplate="{{ ::_itemtemplate }}" prevent-focus="true" allow-typing="false"></${e.P}-suggest>`})],r),t.PacemContenteditablePlaceholderElement=r}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){let a=class PacemContenteditableWrapCommandElement extends t.PacemContenteditableButtonCommandElement{isRelevant(a){return!e.Utils.isNull(t.ContenteditableUtils.findSurroundingNode(a,this.tagname))}exec(){return new Promise(((a,i)=>{const n=this.tagname;if(!e.Utils.isNullOrEmpty(n)){const a=this.range,i=t.ContenteditableUtils.findSurroundingNode(a,n)||t.ContenteditableUtils.findSurroundingNode(a.startContainer,n)||t.ContenteditableUtils.findSurroundingNode(a.endContainer,n);if(e.Utils.isNull(i)){const i=t.ContenteditableUtils.findSurroundingSiblingBlockElements(a);if(!e.Utils.isNullOrEmpty(i)){const e=document.createElement(n);if(1===i.length){const n=i[0];a.setStart(n,0),a.setEnd(n,n.childNodes.length);const s=a.extractContents();e.append(s),t.ContenteditableUtils.copyAttributes(e,n),n.parentElement.insertBefore(e,n),n.remove()}else{a.setStartBefore(i[0]),a.setEndAfter(i[i.length-1]);const t=a.extractContents();e.append(t),a.insertNode(e)}t.ContenteditableUtils.select(e,!0).collapse()}}else{a.setStart(i,0),a.setEnd(i,i.childNodes.length);let e=!1;const n=i.childNodes;for(let a=0;a<n.length;a++){const i=n.item(a);if(!t.ContenteditableUtils.isBlockElement(i)){e=!0;break}}if(e){const e=document.createElement("p");t.ContenteditableUtils.copyAttributes(e,i),e.append(a.extractContents()),i.parentNode.replaceChild(e,i);t.ContenteditableUtils.select(e,!0).collapse()}else{i.parentNode.replaceChild(a.extractContents(),i);t.ContenteditableUtils.select(a.endContainer,!0).collapse()}}}a()}))}};__decorate([e.Watch({converter:e.PropertyConverters.String})],a.prototype,"tagname",void 0),a=__decorate([e.CustomElement({tagName:e.P+"-contenteditable-wrapcommand",shadow:e.Defaults.USE_SHADOW_ROOT,template:t.CONTENTELEMENT_BUTTONCOMMAND_TEMPLATE})],a),t.PacemContenteditableWrapCommandElement=a}(t.Scaffolding||(t.Scaffolding={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(e){!function(e){let t;!function(e){e.String="string",e.Number="number",e.Datetime="datetime",e.Boolean="boolean",e.Binary="binary",e.Object="object"}(t=e.ApiParameterType||(e.ApiParameterType={}));e.ApiParserBase=class ApiParserBase{load(e,t){return __awaiter(this,void 0,void 0,(function*(){let a=yield fetch(e,{mode:"cors",credentials:"omit",headers:t});try{let t=yield a.json();return this.parse(t,e)}catch(e){return null}}))}};const a=/^#\/(definitions|components\/schemas)\/(.+)$/;e.getOpenApiDefinition=function(e,t){var i=a.exec(t);return i&&i.length>2?{name:i[2],schema:e.definitions[i[2]]}:null}}(e.OpenApi||(e.OpenApi={}))}(e.Scaffolding||(e.Scaffolding={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){class OpenApi3Parser extends t.ApiParserBase{parse(e,t){let a=e;"string"==typeof a&&(a=JSON.parse(a));const i=a,n=[],s=this._gatherDefinitions(new Map,i.components.schemas);for(let e in i.paths)for(let t in i.paths[e]){const a=i.paths[e][t];n.push({path:e,method:t.toUpperCase(),parameters:this._convertToApiParameters(a.parameters),response:this._tryGetResponse(s,a.responses)})}return{endpoints:n,definitions:s,baseUrl:t}}_convertToApiParameters(e=[]){const t=[];for(let a of e){const e=a.schema;"type"in e&&t.push({name:a.name,required:a.required,type:this._translateType(e.type,e.format)})}return t}_translateType(e,a){switch(e){case"number":case"integer":return t.ApiParameterType.Number;case"boolean":return t.ApiParameterType.Boolean;case"string":switch(a){case"date":case"date-time":return t.ApiParameterType.Datetime;case"byte":return t.ApiParameterType.Binary;case"binary":throw"Binary octets not supported."}return t.ApiParameterType.String}return t.ApiParameterType.String}_gatherDefinitions(e,t){const a={};for(let i in t)a[i]=this._findDefinition(e,t,i);return a}_findDefinition(e,t,a){if(e.has(a))return e.get(a);if(a in t){const i=t[a];return e.set(a,i),i}return null}_findDefinitionName(e){var t=/#\/components\/schemas\/(.+)/.exec(e);return null==t||t.length<2?e:t[1]}_tryGetResponse(t,a){let i,n={responses:a}.responses[200];if(e.Utils.isNullOrEmpty(n&&n.content))return null;for(let e in n.content){i=n.content[e].schema;break}let s,r,o="object";return"$ref"in i?(r=this._findDefinitionName(i.$ref),s=t[r]):(o=i.type,s=i,"array"===i.type&&("$ref"in i.items?(r=this._findDefinitionName(i.items.$ref),s=t[r]):s=i.items)),{type:o,fullType:r,meta:s}}}t.OpenApi3Parser=OpenApi3Parser}(t.OpenApi||(t.OpenApi={}))}(e.Scaffolding||(e.Scaffolding={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){const a=e.Net.HttpMethod;class SwaggerParser extends t.ApiParserBase{_findDefinitionName(e){var t=/#\/definitions\/(.+)/.exec(e);return null==t||t.length<2?e:t[1]}parse(e,t){let i=e;"string"==typeof i&&(i=JSON.parse(i));const n=i;let s={};for(let e in n.definitions){s[this._findDefinitionName(e)]=n.definitions[e]}let r="";if(n.host&&n.schemes.length>0)r=n.schemes[0]+"://"+n.host+n.basePath;else if(t){let e=/^(https?):\/\/([^\/]+)/.exec(t);e&&e.length&&(!n.schemes&&e.length>1&&(n.schemes=[e[1]]),!n.host&&e.length>2&&(n.host=e[2],n.basePath=""),r=e[0])}else console.warn("Not able to find a base url from the OpenApi specs.");let o={endpoints:[],definitions:s,baseUrl:r};for(let e in n.paths){let t=n.paths[e];for(let i of[a.Get,a.Delete,a.Post,a.Put]){let a=t[i.toLowerCase()];if(a){let t=this._tryGetEndpoint(n,a,e,i);o.endpoints.push(t)}}}return o}_tryGetEndpoint(e,t,a,i){return{response:this._tryGetResponse(e,t),path:a,method:i,parameters:this._tryGetParameters(e,t)}}_translateType(e,a){switch(e){case"number":case"integer":return t.ApiParameterType.Number;case"boolean":return t.ApiParameterType.Boolean;case"string":switch(a){case"date":case"date-time":return t.ApiParameterType.Datetime;case"byte":return t.ApiParameterType.Binary;case"binary":throw"Binary octets not supported."}return t.ApiParameterType.String}return t.ApiParameterType.String}_tryGetParameters(e,a){return(a.parameters||[]).map((a=>{const i=a;let n={name:i.name,required:i.required||!1},s=a.type;if(a.schema){let i=a;n.type=t.ApiParameterType.Object;let s=n.fullType=this._findDefinitionName(i.schema.$ref);n.meta=e.definitions[s]}else s&&(n.type=this._translateType(s,a.format));return n}))}_tryGetResponse(e,t){let a=t.responses[200];if(!a||!a.schema)return null;let i,n,s=a.schema.type||"object";return a.schema.$ref?(n=this._findDefinitionName(a.schema.$ref),i=e.definitions[n]):(i=a.schema,a.schema.items&&(a.schema.items.hasOwnProperty("$ref")?(n=this._findDefinitionName(a.schema.items.$ref),i=e.definitions[n]):i=a.schema.items)),{type:s,fullType:n,meta:i}}}t.SwaggerParser=SwaggerParser}(t.OpenApi||(t.OpenApi={}))}(e.Scaffolding||(e.Scaffolding={}))}(Pacem||(Pacem={})),function(e){!function(e){!function(e){class OpenApiParser extends e.ApiParserBase{constructor(t=new e.OpenApi3Parser,a=new e.SwaggerParser){super(),this._openApi3=t,this._swagger=a}parse(e,t){let a=e;"string"==typeof a&&(a=JSON.parse(a));const i=a;return"openapi"in i?this._openApi3.parse(i,t):this._swagger.parse(i,t)}}e.OpenApiParser=OpenApiParser}(e.OpenApi||(e.OpenApi={}))}(e.Scaffolding||(e.Scaffolding={}))}(Pacem||(Pacem={}));