@progress/kendo-ui
Version:
This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.
28 lines • 60.2 kB
JavaScript
/* @license */
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`kendo.core.min.js`),require(`kendo.textarea.min.js`),require(`kendo.textbox.min.js`),require(`kendo.html.button.min.js`),require(`kendo.icons.min.js`),require(`kendo.speechtotextbutton.min.js`),require(`kendo.upload.min.js`),require(`kendo.licensing.min.js`)):typeof define==`function`&&define.amd?define([`exports`,`kendo.core.min`,`kendo.textarea.min`,`kendo.textbox.min`,`kendo.html.button.min`,`kendo.icons.min`,`kendo.speechtotextbutton.min`,`kendo.upload.min`,`kendo.licensing.min`],t):(e=typeof globalThis<`u`?globalThis:e||self,t((e.kendo=e.kendo||{},e.kendo._globals=e.kendo._globals||{},e.kendo._globals.Promptbox={}),e.kendo._globals.Core,e.kendo._globals.Textarea,e.kendo._globals.Textbox,e.kendo._globals.HtmlButton,e.kendo._globals.Icons,e.kendo._globals.Speechtotextbutton,e.kendo._globals.Upload,e.kendo._globals.Licensing))})(this,function(e,t,n,r,i,a,o,s,c){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var l=Object.create,u=Object.defineProperty,d=Object.getOwnPropertyDescriptor,f=Object.getOwnPropertyNames,p=Object.getPrototypeOf,m=Object.prototype.hasOwnProperty,h=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=f(t),a=0,o=i.length,s;a<o;a++)s=i[a],!m.call(e,s)&&s!==n&&u(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=d(t,s))||r.enumerable});return e};c=((e,t,n)=>(n=e==null?{}:l(p(e)),h(t||!e||!e.__esModule?u(n,`default`,{value:e,enumerable:!0}):n,e)))(c);let g=function(e){return e.Singleton=`singleton`,e.Scoped=`scoped`,e}({}),_=new class{constructor(){this.registrations=new Map}singleton(e,t){this.registrations.set(e,{ctor:e,factory:t??(()=>new e),lifetime:g.Singleton,instance:void 0})}singletonInstance(e,t){this.registrations.set(e,{ctor:e,factory:()=>t,lifetime:g.Singleton,instance:t})}scoped(e,t){this.registrations.set(e,{ctor:e,factory:t??(()=>new e),lifetime:g.Scoped,instance:void 0})}resolve(e){let t=this.registrations.get(e);if(!t)throw Error(`Service ${e.name} is not registered`);return t.lifetime===g.Singleton?(t.instance===void 0&&(t.instance=t.factory()),t.instance):t.factory()}tryResolve(e){if(this.has(e))return this.resolve(e)}has(e){return this.registrations.has(e)}getLifetime(e){return this.registrations.get(e)?.lifetime}};function v(e){return _.resolve(e)}let y=`prefix`;var b=class{constructor(){this.themeColorValues=[`base`,`primary`,`secondary`,`tertiary`,`inherit`,`info`,`success`,`warning`,`error`,`dark`,`light`,`inverse`],this.fillModeValues=[`solid`,`outline`,`flat`],this.shapeValues=[`rectangle`,`square`],this.sizeValues=[[`small`,`sm`],[`medium`,`md`],[`large`,`lg`]],this.roundedValues=[[`small`,`sm`],[`medium`,`md`],[`large`,`lg`],[`full`,`full`],[`none`,`none`]],this.positionModeValues=[`fixed`,`static`,`sticky`,`absolute`],this.resizeValues=[[`both`,`resize`],[`horizontal`,`resize-x`],[`vertical`,`resize-y`]],this.overflowValues=[`auto`,`hidden`,`visible`,`scroll`,`clip`],this.layoutFlowValues=[[`vertical`,`!k-flex-col`],[`horizontal`,`!k-flex-row`]],this.defaultValues={},this.propertyDictionary={},this.propertyToCssClassMap={},this.registerDefaultCssClasses(`themeColor`,this.themeColorValues),this.registerDefaultCssClasses(`fillMode`,this.fillModeValues),this.registerDefaultCssClasses(`shape`,this.shapeValues),this.registerDefaultCssClasses(`size`,this.sizeValues),this.registerDefaultCssClasses(`positionMode`,this.positionModeValues),this.registerDefaultCssClasses(`rounded`,this.roundedValues),this.registerDefaultCssClasses(`resize`,this.resizeValues),this.registerDefaultCssClasses(`overflow`,this.overflowValues),this.registerDefaultCssClasses(`layoutFlow`,this.layoutFlowValues),this.registerCssClasses(`themeColor`,this.themeColorValues),this.registerCssClasses(`fill`,this.fillModeValues),this.registerCssClasses(`shape`,this.shapeValues),this.registerCssClasses(`size`,this.sizeValues),this.registerCssClasses(`positionMode`,this.positionModeValues)}registerPrefix(e,t){this.propertyDictionary[e]||(this.propertyDictionary[e]={}),this.propertyDictionary[e][y]=t}registerValues(e,t){let n,r,i,a,o,s;for(this.propertyDictionary[e]||(this.propertyDictionary[e]={}),n=0;n<t.length;n++)for(i=t[n].prop,o=t[n].values,this.propertyDictionary[e][i]||(this.propertyDictionary[e][i]={}),a=this.propertyDictionary[e][i],r=0;r<o.length;r++)s=o[r],Array.isArray(s)?a[s[0]]=s[1]:a[s]=s}getValidClass(e){let t=e.widget,n=e.propName,r=e.value,i=e.prefix,a=this.defaultValues[n],o=this.propertyDictionary[t];if(!o)return``;let s=o[n],c=s&&s[r]||a&&a[r];if(c){let e;return e=n===`themeColor`?o[y]:n===`positionMode`?`k-pos-`:n===`rounded`?`k-rounded-`:n===`resize`?`k-`:n===`overflow`?`k-overflow-`:n===`layoutFlow`?``:o[y],e=i||e,e+c}else return``}registerDefaultCssClass(e,t,n){this.defaultValues[e]||(this.defaultValues[e]={}),this.defaultValues[e][t]=n||t}registerDefaultCssClasses(e,t){for(let n=0;n<t.length;n++)if(Array.isArray(t[n])){let r=t[n];this.registerDefaultCssClass(e,r[0],r[1])}else this.registerDefaultCssClass(e,t[n])}registerCssClass(e,t,n){this.propertyToCssClassMap[e]||(this.propertyToCssClassMap[e]={}),this.propertyToCssClassMap[e][t]=n||t}registerCssClasses(e,t){for(let n=0;n<t.length;n++)if(Array.isArray(t[n])){let r=t[n];this.registerCssClass(e,r[0],r[1])}else this.registerCssClass(e,t[n])}getValidCssClass(e,t,n){if(n===void 0)return``;let r=this.propertyToCssClassMap[t]?.[n];if(r)return e+r}},x=class{constructor(e,t,n,r,i,a){this.$=e,this.support=t,this.mouseEventNormalizer=n,this.eventMapService=r,this.utils=i,this.originalOn=e.fn.on,this.kendoJQuery=this.createKendoJQuery(a),this.rootjQuery=this.kendoJQuery(document)}createKendoJQuery(e){let t=this.$,n=this,r=function(e,t){return new r.fn.init(e,t)};return e(!0,r,t),r.fn=r.prototype=new t,r.fn.constructor=r,r.fn.init=function(e,i){return i&&i instanceof t&&!(i instanceof r)&&(i=r(i)),t.fn.init.call(this,e,i,n.rootjQuery)},r.fn.init.prototype=r.fn,t.extend(r.fn,{handler:function(e){return this.data(`handler`,e),this},autoApplyNS:function(e){return this.data(`kendoNS`,e||n.utils.guid()),this},on:function(...e){let t=this,r=t.data(`kendoNS`),i=n.originalOn;if(e.length===1)return i.call(t,e[0]);let a=t,o=e.slice();o[o.length-1]===void 0&&o.pop();let s=o[o.length-1],c=n.eventMapService.applyEventMap(o[0],r);if(n.support.mouseAndTouchPresent&&c.search(/mouse|click/)>-1&&this[0]!==document.documentElement){n.mouseEventNormalizer.setupMouseMute();let e=o.length===2?null:o[1],t=c.indexOf(`click`)>-1&&c.indexOf(`touchend`)>-1;i.call(this,{touchstart:e=>n.mouseEventNormalizer.muteMouse(e),touchend:()=>n.mouseEventNormalizer.unMuteMouse()},e,{bustClick:t})}if(o[0].indexOf(`keydown`)!==-1&&o[1]&&o[1].options){o[0]=c;let e=o[1],r=o[o.length-1];return o[o.length-1]=function(t){if(n.keyDownHandler(t,e))return r.apply(this,[t])},i.apply(t,o),t}if(typeof s==`string`){a=t.data(`handler`);let e=a[s];o[o.length-1]=function(t){e.call(a,t)}}return o[0]=c,i.apply(t,o),t},kendoDestroy:function(e){return e||=this.data(`kendoNS`),e&&this.off(`.`+e),this}}),r}getConstructor(){return this.kendoJQuery}create(e,t){return this.kendoJQuery(e,t)}keyDownHandler(e,t){let n=t._events.kendoKeydown;if(!n)return!0;let r=n.slice();e.sender=t,e.preventKendoKeydown=!1;for(let n=0,i=r.length;n<i;n++)r[n].call(t,e);return!e.preventKendoKeydown}},S=class{static extend(e){let t=this,n=function(){};n.prototype=t.prototype;let r=e&&e.init?e.init:function(...e){t.prototype.init&&t.prototype.init.apply(this,e)},i=r.fn=r.prototype=new n;if(e)for(let t in e)e[t]!=null&&e[t].constructor===Object?i[t]=v(x).getConstructor().extend(!0,{},n.prototype[t],e[t]):i[t]=e[t];return i.constructor=r,r.extend=t.extend,r}};S.fn=S.prototype,S.prototype.init=function(...e){},S.prototype._initOptions=function(e){this.options=v(x).getConstructor().extend(!0,{},this.options,e)};let C=`string`,w=`function`;function T(){this._defaultPrevented=!0}function ee(){return this._defaultPrevented===!0}var E=class extends S{constructor(){super(),this._events={}}init(...e){this._events={}}bind(e,t,n){let r=this,i,a,o,s,c=typeof t===w,l;if(t===void 0){let t=e;for(i in t)r.bind(i,t[i]);return r}let u=typeof e===C?[e]:e;for(i=0,a=u.length;i<a;i++){let e=u[i];s=c?t:t[e],s&&(n&&(o=s,s=(function(e,t){let n=function(){r.unbind(e,n),t.apply(r,arguments)};return n.original=t,n})(e,o)),l=r._events[e]=r._events[e]||[],l.push(s))}return r}one(e,t){return this.bind(e,t,!0)}first(e,t){let n=this,r,i=typeof e===C?[e]:e,a=i.length,o,s=typeof t===w,c;for(r=0;r<a;r++){let e=i[r];o=s?t:t[e],o&&(c=n._events[e]=n._events[e]||[],c.unshift(o))}return n}trigger(e,t){let n=this,r=n._events[e],i,a=r?r.length:0;if(r){let e=t||{};for(e.sender=n,e._defaultPrevented=!1,e.preventDefault=T,e.isDefaultPrevented=ee,r=r.slice(),i=0;i<a;i++)r[i].call(n,e);return e._defaultPrevented===!0}return!1}unbind(e,t){let n=this,r=e?n._events[e]:void 0,i;if(e===void 0)n._events={};else if(r)if(t)for(i=r.length-1;i>=0;i--)(r[i]===t||r[i].original===t)&&r.splice(i,1);else n._events[e]=[];return n}};let D=E.prototype;[`init`,`bind`,`one`,`first`,`trigger`,`unbind`].forEach(e=>{let t=D[e];Object.defineProperty(D,e,{value:t,writable:!0,configurable:!0,enumerable:!0})}),E.fn=E.prototype;let O=/%/,te=/(\d+(?:\.?)\d*)px\s*(\d+(?:\.?)\d*)px\s*(\d+(?:\.?)\d*)px\s*(\d+)?/i;var k=class{constructor(e,t,n,r,i){this.supportService=e,this.$=t,this.namespaceService=n,this.utils=r,this.kendo=i,this.animationQueue=[];let a=window;this.animationFrameFn=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame||a.msRequestAnimationFrame||(e=>{setTimeout(e,1e3/60)})}isElement(e){return e instanceof Element||e instanceof HTMLDocument}outerWidth(e,t,n){let r=this.$(e);return n?this.getHiddenDimensions(r,t).width:r.outerWidth(t||!1)||0}outerHeight(e,t,n){let r=this.$(e);return n?this.getHiddenDimensions(r,t).height:r.outerHeight(t||!1)||0}getComputedStyles(e,t){let n={},r;return document.defaultView&&document.defaultView.getComputedStyle?(r=document.defaultView.getComputedStyle(e,``),t&&this.$.each(t,(e,t)=>{n[t]=r.getPropertyValue(t)})):(r=e.currentStyle,t&&this.$.each(t,(e,t)=>{n[t]=r[this.utils.toCamelCase(t)]})),this.utils.size(n)?n:r}isScrollable(e){if(e.dataset[this.namespaceService.ns+`scrollable`]===`false`)return!1;if(typeof e?.className==`string`&&e.className.indexOf(`k-auto-scrollable`)>-1)return!0;let t=this.getComputedStyles(e,[`overflow`]).overflow||``;return t.indexOf(`auto`)>-1||t.indexOf(`scroll`)>-1}scrollLeft(e,t){let n=this.supportService.browser.webkit,r=this.supportService.browser.mozilla,i=this.supportService.browser.version;if(e instanceof this.$&&t!==void 0){e.each((e,n)=>{this.scrollLeft(n,t)});return}let a=e instanceof this.$?e[0]:e;if(!a)return;let o=this.supportService.isRtl(e);if(t!==void 0)o&&n&&(i<85||this.supportService.browser.safari)?a.scrollLeft=a.scrollWidth-a.clientWidth-t:o&&(r||n)&&t>0?a.scrollLeft=-t:a.scrollLeft=t;else if(o&&n&&(i<85||this.supportService.browser.safari))return a.scrollWidth-a.clientWidth-a.scrollLeft;else return Math.abs(a.scrollLeft)}getOffset(e,t=`offset`,n){let r=e[t](),i={top:r.top,right:r.right,bottom:r.bottom,left:r.left};if(this.supportService.browser.msie&&(this.supportService.pointers||this.supportService.msPointers)&&!n){let t=this.supportService.isRtl(e)?1:-1;i.top-=window.pageYOffset-document.documentElement.scrollTop,i.left-=window.pageXOffset+t*document.documentElement.scrollLeft}return i}getHiddenDimensions(e,t){let n=e.clone();n.css(`display`,``),n.css(`visibility`,`hidden`),n.appendTo(this.$(`body`));let r=n.outerWidth(t||!1),i=n.outerHeight(t||!1);return n.remove(),{width:r||0,height:i||0}}parseEffects(e){let t={},n=typeof e==`string`?e.split(` `):e;return this.$.each(n,function(e){t[e]=this}),t}stripWhitespace(e){if(document.createNodeIterator){let t=document.createNodeIterator(e,NodeFilter.SHOW_TEXT,t=>t.parentNode===e?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT);for(;t.nextNode();){let e=t.referenceNode;e&&!e.textContent?.trim()&&e.parentNode?.removeChild(e)}}}animationFrame(e){this.animationFrameFn.call(window,e)}queueAnimation(e){this.animationQueue.push(e),this.animationQueue.length===1&&this.runNextAnimation()}runNextAnimation(){this.animationFrame(()=>{this.animationQueue[0]&&(this.animationQueue.shift()(),this.animationQueue[0]&&this.runNextAnimation())})}parseQueryStringParams(e){let t=e.split(`?`)[1]||``,n={},r=t.split(/&|=/),i=r.length;for(let e=0;e<i;e+=2)r[e]!==``&&(n[decodeURIComponent(r[e])]=decodeURIComponent(r[e+1]));return n}elementUnderCursor(e){return e.x.client===void 0?null:document.elementFromPoint(e.x.client,e.y.client)}wheelDeltaY(e){let t=e.originalEvent,n=t.wheelDeltaY,r;return t.wheelDelta?(n===void 0||n)&&(r=t.wheelDelta):t.detail&&t.axis===t.VERTICAL_AXIS&&(r=-t.detail*10),r}getShadows(e){let t=e.css(`box-shadow`),n=t&&te.exec(t)||[0,0,0,0,0],r=Math.max(+n[3],+(n[4]||0));return{left:-n[1]+r,right:+n[1]+r,bottom:+n[2]+r}}wrap(e,t,n,r=!0,i){let a=e.parent(),o=this.outerWidth(window);if(a.parent().removeClass(`k-animation-container-sm`),a.hasClass(`k-child-animation-container`))this.wrapResize(e,t,r);else{let n=e[0].style.width,r=e[0].style.height,o=O.test(n),s=O.test(r),c=e.hasClass(`k-tooltip`)||e.is(`.k-menu-horizontal.k-context-menu`),l=e.hasClass(`k-tooltip`),u=o||s,d=n,f=r;!o&&(!t||t&&n||c)&&(d=t?this.outerWidth(e,!1,l)+1:this.outerWidth(e,!1,l)),(!s&&(!t||t&&r)||c)&&(f=this.outerHeight(e,!1,l)),e.wrap(this.$(`<div/>`).addClass(`k-child-animation-container`).css({width:i?`auto`:d,height:f})),a=e.parent(),a.wrap(this.$(`<div/>`).addClass(`k-animation-container`).attr(`role`,`region`)),u&&e.css({width:`100%`,height:`100%`})}return a=a.parent(),o<this.outerWidth(a)&&(a.addClass(`k-animation-container-sm`),n=!0),n&&this.wrapResize(e,t,r),a}wrapResize(e,t,n=!0){let r=e.parent(),i=e.closest(`.k-animation-container`),a=e.hasClass(`k-tooltip`),o=e.is(`:visible`),s=r[0].style,c=e[0].style.height;i.is(`:hidden`)&&i.css({display:``,position:``}),O.test(s.width)||O.test(s.height)||(o||e.add(r).show(),n&&r.css(`width`,``),r.css({width:t?this.outerWidth(e,!1,a)+1:this.outerWidth(e,!1,a)}),c===`auto`?e.css({height:this.outerHeight(r)}):r.css({height:this.outerHeight(e)}),o||e.hide())}scrollByDelta(e,t){let n=this.supportService.isRtl(e),r=(n?-this.scrollLeft(e):this.scrollLeft(e))+t,i=e[0].scrollWidth-e[0].clientWidth,a={scrollLeft:r};e.finish().animate(a,`fast`,`linear`);let o=n?-i:i,s=n?Math.max(Math.min(r,0),o):Math.min(Math.max(r,0),o);return{atStart:s===0,atEnd:s===o}}scrollVerticalByDelta(e,t,n={}){let{duration:r=`fast`,easing:i=`linear`}=n,a=(e.scrollTop()||0)+t,o={scrollTop:a};e.finish().animate(o,r,i);let s=e[0].scrollHeight-e[0].clientHeight,c=Math.min(Math.max(a,0),s);return{atTop:c===0,atBottom:c>=s}}scrollToElement(e,t,n={}){if(!e.length||!t.length)return!1;let{duration:r=0,easing:i=`linear`,position:a=`center`,offset:o=0,onComplete:s}=n,c=e.height()||0,l=e.scrollTop()||0,u=e.offset(),d=t.offset(),f=t.outerHeight()||0,p=d.top-u.top+l,m;switch(a){case`top`:m=p+o;break;case`bottom`:m=p-c+f+o;break;default:m=p-c/2+f/2+o;break}let h=e[0].scrollHeight-e[0].clientHeight;return m=Math.min(Math.max(m,0),h),e.finish().animate({scrollTop:m},r,i,s),!0}addAttribute(e,t,n){let r=e.attr(t)||``;r.indexOf(n)<0&&e.attr(t,(r+` `+n).trim())}removeAttribute(e,t){e.removeAttr(t)}toggleAttribute(e,t,n){let r=(e.attr(t)||``).indexOf(n)<0,i=[`disabled`,`readonly`].indexOf(t)>-1;r&&!i||i&&n?this.addAttribute(e,t,n):this.removeAttribute(e,t)}onResize(e){let t=e;return this.supportService.mobileOS&&this.supportService.mobileOS.android&&(t=function(){setTimeout(e,600)}),this.$(window).on(this.supportService.resize,t),t}unbindResize(e){this.$(window).off(this.supportService.resize,e)}attrValue(e,t){return e.data(this.namespaceService.ns+t)}attr(e){return`data-`+this.namespaceService.ns+e}dimensions(e,t){let n=e[0];return t&&e.css(t),{width:n.offsetWidth,height:n.offsetHeight}}triggeredByInput(e){return/^(label|input|textarea|select)$/i.test(e.target.tagName)}applyStylesFromKendoAttributes(e,t){let n=this.$,r=t.map(e=>`[${this.attr(`style-${e}`)}]`).join(`,`);e.find(r).addBack(r).each((e,r)=>{let i=n(r);t.forEach(e=>{let t=this.attr(`style-${e}`);i.attr(t)&&(i.css(e,i.attr(t)),i.removeAttr(t))})})}progress(e,t,n){let r=e.find(`.k-loading-mask`),i=this.supportService.browser,a=this.$.extend({},{width:`100%`,height:`100%`,top:e.scrollTop(),opacity:!1},n),o=a.opacity?`k-loading-mask k-opaque`:`k-loading-mask`;if(t){if(!r.length){let t=this.supportService.isRtl(e),n=t?`right`:`left`,r=this.scrollLeft(e),s=0;i.webkit&&t&&(s=e[0].scrollWidth-(e.width()||0)-2*r);let c=this.kendo.ui?.progress?.messages?.loading||`Loading...`;this.$(`<div class='${o}'><span role='alert' aria-live='polite' class='k-loading-text'>${c}</span><div class='k-loading-image'></div><div class='k-loading-color'></div></div>`).width(a.width).height(a.height).css(`top`,a.top).css(n,Math.abs(r)+s).prependTo(e)}}else r&&r.remove()}eventTarget(e){if(!this.supportService.touch)return e.target;let t=e.originalEvent?.changedTouches||e.changedTouches;return t&&t.length>0?document.elementFromPoint(t[0].clientX,t[0].clientY):e.target}createDragToScrollHandler(e,t){return new A(this.$,e,t)}},A=class e{static{this.DRAG_THRESHOLD=5}constructor(e,t,n){this.isDragging=!1,this.hasDragged=!1,this.dragStartX=0,this.scrollStartLeft=0,this.currentDragTarget=null,this.$=e,this.scrollContainer=t,this.namespace=n.namespace,this.captureElement=n.captureElement,this.delegateSelector=n.delegateSelector,this.onDragStart=this.onDragStart.bind(this),this.onDragMove=this.onDragMove.bind(this),this.onDragEnd=this.onDragEnd.bind(this),this.preventClickOnce=this.preventClickOnce.bind(this)}attach(){this.captureElement&&(this.delegateSelector?this.scrollContainer.on(`mousedown`+this.namespace,this.delegateSelector,this.onDragStart).on(`touchstart`+this.namespace,this.delegateSelector,this.onDragStart):this.scrollContainer.on(`mousedown`+this.namespace,this.onDragStart).on(`touchstart`+this.namespace,this.onDragStart),this.bindCaptureEvents())}destroy(){this.scrollContainer.off(this.namespace),this.captureElement&&this.unbindCaptureEvents(),this.scrollContainer[0].removeEventListener(`click`,this.preventClickOnce,!0)}getClientX(e){if(e.type.indexOf(`touch`)!==-1){let t=e.originalEvent?.touches?.[0]||e.originalEvent?.changedTouches?.[0];return t?t.clientX:0}return e.clientX||e.originalEvent?.clientX||0}preventClickOnce(e){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.scrollContainer[0].removeEventListener(`click`,this.preventClickOnce,!0)}onDragStart(e){let t=this.$(e.currentTarget);t.length&&(this.isDragging=!0,this.hasDragged=!1,this.currentDragTarget=t[0],this.dragStartX=this.getClientX(e),this.scrollStartLeft=t[0].scrollLeft,t.css(`cursor`,`grabbing`),t.css(`user-select`,`none`))}onDragMove(t){if(!this.isDragging||!this.currentDragTarget)return;let n=this.getClientX(t),r=this.dragStartX-n;!this.hasDragged&&Math.abs(r)>=e.DRAG_THRESHOLD&&(this.hasDragged=!0),this.hasDragged&&(t.preventDefault(),this.currentDragTarget.scrollLeft=this.scrollStartLeft+r)}onDragEnd(){if(this.isDragging){if(this.currentDragTarget){let e=this.$(this.currentDragTarget);e.css(`cursor`,``),e.css(`user-select`,``)}this.hasDragged&&this.scrollContainer[0].addEventListener(`click`,this.preventClickOnce,!0),this.isDragging=!1,this.hasDragged=!1,this.currentDragTarget=null}}bindCaptureEvents(){this.captureElement&&this.$(document).on(`mousemove`+this.namespace,this.onDragMove).on(`touchmove`+this.namespace,this.onDragMove).on(`mouseup`+this.namespace,this.onDragEnd).on(`touchend`+this.namespace,this.onDragEnd)}unbindCaptureEvents(){this.$(document).off(this.namespace)}};let j=`object`;var M=class{constructor(e){this.kendo=e,this.keys={INSERT:45,DELETE:46,BACKSPACE:8,TAB:9,ENTER:13,ESC:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,END:35,HOME:36,SPACEBAR:32,PAGEUP:33,PAGEDOWN:34,F2:113,F10:121,F12:123,SHIFT:16,NUMPAD_PLUS:107,NUMPAD_MINUS:109,NUMPAD_DOT:110},this.days={Sunday:0,Monday:1,Tuesday:2,Wednesday:3,Thursday:4,Friday:5,Saturday:6}}get kendoData(){return this.kendo.data||{}}toHyphens(e){return e.replace(/([a-z][A-Z])/g,e=>e.charAt(0)+`-`+e.charAt(1).toLowerCase())}toCamelCase(e){return e.replace(/\-(\w)/g,(e,t)=>t.toUpperCase())}size(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&n!==`toJSON`&&t++;return t}deepExtend(e,...t){for(let n=0;n<t.length;n++)this.deepExtendOne(e,t[n]);return e}deepExtendOne(e,t){let n=this.kendoData.ObservableArray,r=this.kendoData.LazyObservableArray,i=this.kendoData.DataSource,a=this.kendoData.HierarchicalDataSource;for(let o in t){if(o===`__proto__`||o===`constructor`||o===`prototype`)continue;let s=t[o],c=typeof s,l=null;c===j&&s!==null&&(l=s.constructor);let u=l?.name===`RegExp`,d=l?.name===`ArrayBuffer`,f=l?.name===`Date`;if(l&&!Array.isArray(s)&&l!==n&&l!==r&&l!==i&&l!==a&&!u&&(!this.isFunction(window.ArrayBuffer)||!d)&&!(s instanceof HTMLElement))if(f)e[o]=new Date(s.getTime());else if(this.isCloneable(s))e[o]=s.clone();else{let t=e[o];typeof t===j?e[o]=t||{}:e[o]={},this.deepExtendOne(e[o],s)}else c!==`undefined`&&(e[o]=s)}return e}isCloneable(e){return typeof e.clone==`function`}throttle(e,t){if(!t||t<=0)return e;let n,r=0,i=function(...i){let a=this,o=+new Date-r;function s(){let t=e.apply(a,i);return r=+new Date,t}if(!r||(n&&clearTimeout(n),o>t))return s();n=setTimeout(s,t-o)};return i.cancel=function(){n&&=(clearTimeout(n),void 0)},i}guid(){let e=window.crypto;try{return e.randomUUID()}catch{return e.getRandomValues(new Uint8Array(16)).reduce((e,t,n)=>((n===4||n===6||n===8||n===10)&&(e+=`-`),e+=t.toString(16).padStart(2,`0`),e),``)}}trim(e){return e?e.toString().trim():``}isPresent(e){return e!=null}isBlank(e){return e==null}isEmpty(e){return e.length===0}isString(e){return typeof e==`string`}isInteger(e){return Number.isInteger(e)}isNumeric(e){return!isNaN(e-parseFloat(e))}isDate(e){return e&&e.getTime}isFunction(e){return typeof e==`function`}isObject(e){return e!==null&&typeof e===j}logToConsole(e,t){let n=window.console;!this.kendo.suppressLog&&n!==void 0&&n.log&&n[t||`log`](e)}whenAll(e){let t=window.jQuery,n=arguments.length===1&&Array.isArray(e)?e:Array.prototype.slice.call(arguments),r=n.length,i=r,a=t.Deferred(),o=0,s=0,c=Array(r),l=Array(r),u=Array(r),d,f=(e,t,r)=>function(){r!==n&&s++,a.notifyWith(t[e]=this,r[e]=Array.prototype.slice.call(arguments)),--i||a[(s?`reject`:`resolve`)+`With`](t,r)};for(;o<r;o++)d=n[o],d&&this.isFunction(d.promise)?d.promise().done(f(o,u,n)).fail(f(o,c,l)):(a.notifyWith(this,d),--i);return i||a.resolveWith(u,n),a.promise()}isLocalUrl(e){return e&&!/^([a-z]+:)?\/\//i.test(e)}getAllMethods(e){let t=Object.getOwnPropertyNames(e).filter(t=>typeof e[t]==`function`),n=Object.getOwnPropertyNames(Object.getPrototypeOf(new e({}))).filter(e=>e!==`constructor`);return t.concat(n)}getBaseClass(e){if(e instanceof Function){let t=e,n=Object.getPrototypeOf(t);if(n&&n!==Object&&n.name)return n}return null}createProxyMember(e,t){e.fn[t]=function(){let e=this._instance;if(e)return e[t].apply(e,arguments)}}convertPromiseToDeferred(e){let t=$.Deferred();return e.finally(t.always).then(t.resolve).catch(t.reject),t.promise()}};let N=[`themeColor`,`fillMode`,`shape`,`size`,`rounded`,`positionMode`],P=`aria-labelledby`,F=`aria-label`;var I=class e extends E{static call(t,n,r){e.fn.init.call(t,n,r)}static apply(t,n){e.fn.init.apply(t,n)}constructor(e,t){super(),e!==void 0&&this.init(e,t)}init(e,t){let n=this;c.validatePackage()||(n._showWatermarkOverlay=c.addWatermarkOverlayAndBanner);let r=v(x).getConstructor();n.element=r(e).handler(n),E.fn.init.call(n);let i=t?t.dataSource:null,a;t&&(a=(n.componentTypes||{})[t.componentType]),i&&(t=r.extend({},t,{dataSource:{}})),t=n.options=r.extend(!0,{},n.options,n.defaults,a||{},t),i&&(t.dataSource=i);let o=v(k).attr(`role`);n.element.attr(o)||n.element.attr(o,(t.name||``).toLowerCase()),n.element.data(`kendo`+t.prefix+t.name,n),n.bind(n.events,t)}_hasBindingTarget(){return!!this.element[0].kendoBindingTarget}_tabindex(e){e||=this.wrapper;let t=this.element,n=`tabindex`,r=e.attr(n)||t.attr(n);t.removeAttr(n),e.attr(n,isNaN(r)?0:r)}setOptions(e){this._clearCssClasses(e),this._setEvents(e),v(x).getConstructor().extend(this.options,e),this._applyCssClasses()}_setEvents(e){let t=this,n=0,r=t.events.length,i;for(;n<r;n++)i=t.events[n],t.options[i]&&e[i]&&(t.unbind(i,t.options[i]),t._events&&t._events[i]&&delete t._events[i]);t.bind(t.events,e)}resize(e){let t=this.getSize(),n=this._size;(e||(t.width>0||t.height>0)&&(!n||t.width!==n.width||t.height!==n.height))&&(this._size=t,this._resize(t,e),this.trigger(`resize`,t))}getSize(){return v(k).dimensions(this.element)}size(e){if(e)this.setSize(e);else return this.getSize()}setSize(e){}_resize(e,t){}destroy(){let e=this;e.element.removeData(`kendo`+e.options.prefix+e.options.name),e.element.removeData(`handler`),e.unbind()}_destroy(){this.destroy()}_applyCssClasses(e){let t=this.__proto__.options,n=this.options,r=e||this.wrapper||this.element,i=[],a,o,s,c,l=v(b);if(s=this.options._altname||t.name,c=l.propertyDictionary[s],!(!l||!c)){for(a=0;a<N.length;a++)o=N[a],s=this.options._altname||t.name,(o in t||o in n)&&i.push(l.getValidClass({widget:s,propName:o,value:n[o]}));r.addClass(i.join(` `))}}_ariaLabel(e){let t=this,n=t.element,r=n.attr(`id`),i=v(x).getConstructor()(`label[for="`+r+`"]`),a=n.attr(F),o=n.attr(P),s;if(e[0]!==n[0]){if(a)e.attr(F,a);else if(o)e.attr(P,o);else if(i.length){let n=v(M).guid();s=i.attr(`id`)||t._generateLabelId(i,r||n),e.attr(P,s)}}}_clearCssClasses(e,t){let n=this.__proto__.options,r=this.options,i=t||this.wrapper||this.element,a,o,s,c,l=v(b);if(s=this.options._altname||n.name,c=l.propertyDictionary[s],!(!l||!c))for(a=0;a<N.length;a++)o=N[a],(o in n||o in r)&&e.hasOwnProperty(o)&&(o===`themeColor`?i.removeClass(l.getValidClass({widget:s,propName:o,value:r[o],fill:r.fillMode})):(o===`fillMode`&&i.removeClass(l.getValidClass({widget:s,propName:`themeColor`,value:r.themeColor,fill:r.fillMode})),i.removeClass(l.getValidClass({widget:s,propName:o,value:r[o]}))))}_generateLabelId(e,t){let n=t+`_label`;return e.attr(`id`,n),n}};I.fn=I.prototype,I.prototype.options={prefix:``},I.prototype.events=[];let ne=/&/g,re=/</g,ie=/"/g,ae=/'/g,oe=/>/g,se=[`http:`,`https:`];var ce=class{decode(e){let t={"&":`&`,"<":`<`,">":`>`,""":`"`,"'":`'`};return e.replace(/&(?:amp|lt|gt|quot|#39);/g,function(e){return t[e]})}encode(e,t){return t===!0&&(e=this.decode(e)),(``+e).replace(ne,`&`).replace(re,`<`).replace(oe,`>`).replace(ie,`"`).replace(ae,`'`)}sanitizeLink(e){let t=``;try{let n=new URL(e,window.location.origin);if(se.includes(n.protocol))t=e;else throw Error(`Invalid protocol`)}catch{t=`#INVALIDLINK`}return this.encode(t)}convertTextUrlToLink(e,t){return(t?e:this.encode(e)).replace(/((https?:\/\/[^\s"'<>]+)|(www\.[^\s"'<>]+))/gi,(e,t,n,r,i,a)=>{let o=a.lastIndexOf(`>`,i-1),s=a.substring(o+1,i);if(/\w+\s*=\s*["']$/.test(s))return e;let c=e.trim(),l=e.trim();/^www\./i.test(c)&&(c=`https://`+c);try{return c=new URL(c).href,`<a href="${c}" target="_blank" rel="noopener noreferrer">${l}</a>`}catch{return e}})}unescape(e){let t;try{t=window.decodeURIComponent(e)}catch{t=e.replace(/%u([\dA-F]{4})|%([\dA-F]{2})/gi,function(e,t,n){return String.fromCharCode(parseInt(`0x`+(t||n),16))})}return t}},le=class{constructor(e,t,n){this.$=e,this.support=t,this.inputService=n,this._fileGroupMap=this.createFileGroupMap(),this.fileSaver=document.createElement(`a`),this.downloadAttribute=`download`in this.fileSaver&&!this.support.browser.edge}createFileGroupMap(){return{audio:[`.aif`,`.iff`,`.m3u`,`.m4a`,`.mid`,`.mp3`,`.mpa`,`.wav`,`.wma`,`.ogg`,`.wav`,`.wma`,`.wpl`],video:[`.3g2`,`.3gp`,`.avi`,`.asf`,`.flv`,`.m4u`,`.rm`,`.h264`,`.m4v`,`.mkv`,`.mov`,`.mp4`,`.mpg`,`.rm`,`.swf`,`.vob`,`.wmv`],image:[`.ai`,`.dds`,`.heic`,`.jpe`,`jfif`,`.jif`,`.jp2`,`.jps`,`.eps`,`.bmp`,`.gif`,`.jpeg`,`.jpg`,`.png`,`.ps`,`.psd`,`.svg`,`.svgz`,`.tif`,`.tiff`],txt:[`.doc`,`.docx`,`.log`,`.pages`,`.tex`,`.wpd`,`.wps`,`.odt`,`.rtf`,`.text`,`.txt`,`.wks`],presentation:[`.key`,`.odp`,`.pps`,`.ppt`,`.pptx`],data:[`.xlr`,`.xls`,`.xlsx`],programming:`.tmp,.bak,.msi,.cab,.cpl,.cur,.dll,.dmp,.drv,.icns,.ico,.link,.sys,.cfg,.ini,.asp,.aspx,.cer,.csr,.css,.dcr,.htm,.html,.js,.php,.rss,.xhtml`.split(`,`),pdf:[`.pdf`],config:[`.apk`,`.app`,`.bat`,`.cgi`,`.com`,`.exe`,`.gadget`,`.jar`,`.wsf`],zip:[`.7z`,`.cbr`,`.gz`,`.sitx`,`.arj`,`.deb`,`.pkg`,`.rar`,`.rpm`,`.tar.gz`,`.z`,`.zip`,`.zipx`],"disc-image":[`.dmg`,`.iso`,`.toast`,`.vcd`,`.bin`,`.cue`,`.mdf`]}}get fileGroupMap(){return this._fileGroupMap}getFileGroup(e,t){let n=this._fileGroupMap,r=Object.keys(n),i=`file`;if(e===void 0||!e.length)return i;let a=e.toLowerCase();a.startsWith(`.`)||(a=`.`+a);for(let e=0;e<r.length;e+=1)if(n[r[e]].indexOf(a)>-1)return t?`file-`+r[e]:r[e];return i}getFileSizeMessage(e){let t=[`Bytes`,`KB`,`MB`,`GB`,`TB`];if(e===0)return`0 Byte`;let n=parseInt(String(Math.floor(Math.log(e)/Math.log(1024))),10);return Math.round(e/1024**n)+` `+t[n]}postToProxy(e,t,n,r){let i=this.$,a=i(`<form>`).attr({action:n,method:`POST`,target:r}),o=this.inputService.antiForgeryTokens();o.fileName=t;let s=e.split(`;base64,`);for(let e in o.contentType=s[0].replace(`data:`,``),o.base64=s[1],o)Object.prototype.hasOwnProperty.call(o,e)&&i(`<input>`).attr({value:o[e],name:e,type:`hidden`}).appendTo(a);a.appendTo(`body`).submit().remove()}saveAsBlob(e,t){let n=e;if(typeof e==`string`){let t=e.split(`;base64,`),r=t[0],i=atob(t[1]),a=new Uint8Array(i.length);for(let e=0;e<i.length;e++)a[e]=i.charCodeAt(e);n=new Blob([a.buffer],{type:r})}navigator.msSaveBlob(n,t)}saveAsDataURI(e,t){let n=e;window.Blob&&e instanceof Blob&&(n=URL.createObjectURL(e)),this.fileSaver.download=t,this.fileSaver.href=n;let r=document.createEvent(`MouseEvents`);r.initMouseEvent(`click`,!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.fileSaver.dispatchEvent(r),setTimeout(function(){URL.revokeObjectURL(n)})}saveAs(e){let t=this.postToProxy.bind(this);e.forceProxy||(this.downloadAttribute?t=this.saveAsDataURI.bind(this):navigator.msSaveBlob&&(t=this.saveAsBlob.bind(this))),t(e.dataURI,e.fileName,e.proxyURL,e.proxyTarget)}};let L=`.kendoPromptBox`,R={SINGLE:`single`,MULTI:`multi`,AUTO:`auto`},ue={send:`paper-plane`,stop:`stop-sm`,attachment:`paperclip-outline-alt-right`},z={promptBox:`k-prompt-box`,promptBoxContent:`k-prompt-box-content`,promptBoxHeader:`k-prompt-box-header`,promptBoxAffix:`k-prompt-box-affix`,promptBoxTextarea:`k-prompt-box-textarea`,promptBoxInput:`k-prompt-box-input`,promptBoxSingleline:`k-prompt-box-singleline`,promptBoxMultiline:`k-prompt-box-multiline`,input:`k-input`,inputInner:`k-input-inner`,disabled:`k-disabled`,hidden:`k-hidden`,focus:`k-focus`,generating:`k-generating`,active:`k-active`,speechToTextButton:`k-speech-to-text-button`,fileSelectButton:`k-file-select-button`,fileBoxWrapper:`k-file-box-wrapper`,fileBoxWrapperScrollableStart:`k-file-box-wrapper-scrollable-start`,filesScroll:`k-files-scroll`,fileBox:`k-file-box`,fileInfo:`k-file-info`,fileName:`k-file-name`,fileSize:`k-file-size`,spacer:`k-spacer`},B={sendButton:`ref-promptbox-send-button`,fileSelectButton:`ref-promptbox-file-select-button`,fileInput:`ref-promptbox-file-input`,attachmentsHost:`ref-promptbox-attachments-host`,attachmentRemoveButton:`ref-promptbox-attachment-remove-button`,input:`ref-promptbox-input`,header:`ref-promptbox-header`,startAffix:`ref-promptbox-start-affix`,endAffix:`ref-promptbox-end-affix`,topAffix:`ref-promptbox-top-affix`,affixSpacer:`ref-promptbox-affix-spacer`},V={valueChange:`valueChange`,input:`input`,promptAction:`promptAction`,fileSelect:`fileSelect`,fileRemove:`fileRemove`,speechToTextClick:`speechToTextClick`,speechToTextStart:`speechToTextStart`,speechToTextEnd:`speechToTextEnd`,speechToTextError:`speechToTextError`,speechToTextResult:`speechToTextResult`,focus:`focus`,blur:`blur`,inputFocus:`inputFocus`,inputBlur:`inputBlur`,multilineStateChange:`multilineStateChange`},H=`click`,de=(e,t=!1)=>{let n=``;if(e&&(n=e()),!n&&!t)return``;let r=n?``:` ${z.hidden}`;return`<div class="${z.promptBoxHeader}${r}" ${B.header}><div ${B.attachmentsHost}></div>${n}</div>`},U=e=>e?e():``,W=(e,t=!0,n)=>{let r=t?``:` ${z.disabled}`,i=t?``:` aria-disabled="true"`,a={icon:n?.icon||`arrow-up-outline`,size:n?.size||`small`,rounded:n?.rounded||`full`};return n?.fillMode&&(a.fillMode=n.fillMode),n?.themeColor&&(a.themeColor=n.themeColor),kendo.html.renderButton(`<button title="${e.actionButton}" aria-label="${e.actionButton}" aria-live="polite" class="${r}"${i} ${B.sendButton} type="button"></button>`,a)},G=(e,t,n,r,i=!0,a)=>{let o=n?` multiple`:``,s=t?` accept="${t}"`:``,c=i?``:` disabled`,l=i?``:` aria-disabled="true"`,u=i?``:` ${z.disabled}`,d=r?.text||a?.fileSelectButton||`Attach file`,f={icon:r?.icon||ue.attachment,fillMode:r?.fillMode||`clear`};return r?.size&&(f.size=r.size),r?.rounded&&(f.rounded=r.rounded),r?.themeColor&&(f.themeColor=r.themeColor),`${kendo.html.renderButton(`<button title="${d}" aria-label="${d}" class="${u}" ${B.fileSelectButton} type="button"${c}${l}></button>`,f)}<input type="file" id="${e}" class="${z.hidden}" ${B.fileInput}${o}${s} />`},K=e=>`<button class="${z.speechToTextButton}" type="button"></button>`,fe=e=>{let t=U(e);return t?`<div class="${z.promptBoxAffix}" ${B.startAffix}>${t}</div>`:``},pe=(e,t,n=!0,r,i,a)=>{let o=U(r),s=i?.enable!==!1,c=i?G(i.fileInputId,i.accept,i.multiple,i.settings,s,e):``,l=i?.showSpacer?`<div class="${z.spacer}"></div>`:``,u=n?K(a?.speechToTextButtonSettings):``,d=t?W(e,!0,a?.actionButtonSettings):``;return`${o}${c}${l}${u}${d}`.trim()?`<div class="${z.promptBoxAffix}" ${B.endAffix}>
${o}
${c}
${l}
${u}
${d}
</div>`:``},me=(e,t,n=!0,r,i,a,o)=>{let s=U(r),c=U(i),l=a?.enable!==!1,u=a?G(a.fileInputId,a.accept,a.multiple,a.settings,l,e):``,d=n?K(o?.speechToTextButtonSettings):``,f=t?W(e,!0,o?.actionButtonSettings):``,p=`<div class="${z.spacer}"></div>`;return a?.showSpacer?`<div class="${z.promptBoxAffix}" ${B.endAffix}>
${u}
${s}
${p}
${c}
${d}
${f}
</div>`:`<div class="${z.promptBoxAffix}" ${B.endAffix}>
${s}
${p}
${c}
${u}
${d}
${f}
</div>`},he=e=>{let t=U(e);return t?`<div class="${z.promptBoxAffix}" ${B.topAffix}>${t}</div>`:``},ge=(e,t,n,r,i=!0,a={})=>{let{affixConfig:o={},fileSelectButtonConfig:s,buttonSettingsConfig:c}=a,l=de(e,!!s),u=r===R.MULTI?he(o.topAffixTemplate):``,d=r===R.MULTI,f=d?``:fe(o.startAffixTemplate),p=d?me(t,n,i,o.startAffixTemplate,o.endAffixTemplate,s,c):pe(t,n,i,o.endAffixTemplate,s,c);return`${l}
<div class="${z.promptBoxContent}">
${u}
${f}
<span ${B.input}></span>
${p}
</div>`};var _e=class{constructor(e){this.context=e}applyInitial(){let e=this.context.getOptions();this.context.getInputElement().attr(`aria-label`,e.messages?.messageBoxTitle||`Message`),e.enable||this.context.wrapper.attr(`aria-disabled`,`true`),e.readonly&&this.updateInputAccessibility(),e.loading&&this.context.wrapper.attr(`aria-busy`,`true`)}updateInputAccessibility(){let e=this.context.getOptions(),t=this.context.getInputElement();t&&(t.attr(`aria-label`,e.messages?.messageBoxTitle||`Message`),e.readonly?t.attr(`aria-readonly`,`true`):t.removeAttr(`aria-readonly`),e.enable?t.removeAttr(`aria-disabled`):t.attr(`aria-disabled`,`true`))}updateWrapper(e){e.disabled!==void 0&&(e.disabled?this.context.wrapper.attr(`aria-disabled`,`true`):this.context.wrapper.removeAttr(`aria-disabled`)),e.loading!==void 0&&(e.loading?this.context.wrapper.attr(`aria-busy`,`true`):this.context.wrapper.removeAttr(`aria-busy`))}},ve=class{constructor(e){this.context=e}getSendButton(){return this.context.wrapper.find(`[${B.sendButton}]`)}setLoading(e){let t=this.getSendButton(),n=this.context.getMessages(),r=this.context.getSettings();if(e){t.addClass(`${z.generating} ${z.active}`),t.attr(`title`,n.actionButtonLoading),t.attr(`aria-label`,n.actionButtonLoading);let e=t.find(`.k-icon, .k-svg-icon`);if(e.length){let t=r?.loadingIcon||`stop-sm`;kendo.ui.icon(e,{icon:t})}}else{t.removeClass(`${z.generating} ${z.active}`),t.attr(`title`,n.actionButton),t.attr(`aria-label`,n.actionButton);let e=t.find(`.k-icon, .k-svg-icon`);if(e.length){let t=r?.icon||`arrow-up-outline`;kendo.ui.icon(e,{icon:t})}}this.updateState()}updateState(){let e=this.getSendButton();if(this.context.isDisabled()){e.addClass(z.disabled),e.attr(`aria-disabled`,`true`);return}if(e.removeAttr(`aria-disabled`),this.context.isLoading()){e.removeClass(z.disabled);return}this.context.hasContent()?e.removeClass(z.disabled):e.addClass(z.disabled)}updateMessages(){let e=this.getSendButton(),t=this.context.getMessages();this.context.isLoading()?(e.attr(`title`,t.actionButtonLoading),e.attr(`aria-label`,t.actionButtonLoading)):(e.attr(`title`,t.actionButton),e.attr(`aria-label`,t.actionButton))}},ye=class{constructor(e){this.instance=null,this.context=e}init(){let e=this.context.getSpeechToTextButtonOption();if(e===!1)return;let t=this.context.wrapper.find(`.`+z.speechToTextButton);if(!t.length)return;let n={fillMode:`flat`,size:`small`,enable:!0},r=typeof e==`object`&&e?e:{},i=r.enable!==!1,a={...n,...r,start:e=>this.context.callbacks.onStart(e),end:e=>this.context.callbacks.onEnd(e),result:e=>this.context.callbacks.onResult(e),error:e=>this.context.callbacks.onError(e)};this.instance=new kendo.ui.SpeechToTextButton(t,a),i||this.instance.enable(!1)}enable(e){this.instance&&this.instance.enable(e)}destroy(){this.instance&&=(this.instance.destroy(),null)}},q=class{constructor(e){this.files=[],this._dragHandler=null,this.context=e}initUpload(){let e=this.context.getOptions();if(!this.showFileSelectButton(e))return;let t=this.context.wrapper.find(`[${B.fileInput}]`);if(t.length===0)return;let n=this.getFileSelectButtonSettings(e)?.multiple!==!1,r=new kendo.ui.Upload(t,{multiple:n,async:!1,uniqueFileUids:!0,select:this.onUploadSelect.bind(this)});r?.wrapper?.addClass(z.hidden),this.uploadInstance=r}getFiles(){return[...this.files]}setFiles(e){this.files=[...e],this.renderAttachments(),this.context.callbacks.onFilesChanged()}clearFiles(){this.files=[],this.renderAttachments(),this.context.callbacks.onFilesChanged()}hasFiles(){return this.files.length>0}handleFileSelectClick(){let e=this.context.getOptions(),t=this.getFileSelectButtonSettings(e);if(!e.enable||e.readonly||t?.enable===!1)return;let n=this.uploadInstance?.element?.[0]||this.context.wrapper.find(`[${B.fileInput}]`)[0];n&&typeof n.click==`function`&&n.click()}removeAttachmentByUid(e){let t=this.files.find(t=>this.getFileUid(t)===e),n=this.files.filter(t=>this.getFileUid(t)!==e);n.length!==this.files.length&&(this.files=n,this.renderAttachments(),this.context.callbacks.onFilesChanged(),t&&this.context.callbacks.onFileRemove(t,[...this.files]))}renderAttachments(){this._destroyDragHandler();let e=this.context.wrapper.find(`[${B.header}]`),t=this.context.wrapper.find(`[${B.attachmentsHost}]`);if(t.length===0)return;if(!this.files.length){t.empty(),this.context.getOptions().headerTemplate||e.addClass(z.hidden);return}e.removeClass(z.hidden);let n=`<ul class="${z.fileBoxWrapper} ${z.fileBoxWrapperScrollableStart}">`;n+=`<div class="${z.filesScroll}">`;for(let e=0;e<this.files.length;e++){let t=this.files[e],r=t?.rawFile||t,i=this.getFileUid(t),a=r?.name||t?.name||``,o=r?.size||t?.size||0,s=a.lastIndexOf(`.`)>-1?a.substring(a.lastIndexOf(`.`)).toLowerCase():``,c=this.context.fileUtilsService.getFileGroup(s,!0),l=this.context.fileUtilsService.getFileSizeMessage(o),u=kendo.ui.icon({icon:c,size:`xlarge`}),d=kendo.html.renderButton(`<button type="button" ${B.attachmentRemoveButton} data-uid="${this.context.htmlService.encode(i)}" aria-label="Remove attachment" title="Remove attachment"></button>`,{icon:`x-mark-sm-outline`,fillMode:`flat`});n+=`<li class="${z.fileBox}">`,n+=u,n+=`<div class="${z.fileInfo}">`,n+=`<span class="${z.fileName}">${this.context.htmlService.encode(a)}</span>`,n+=`<span class="${z.fileSize}">${this.context.htmlService.encode(l)}</span>`,n+=`</div>`,n+=d,n+=`</li>`}n+=`</div></ul>`,t.html(n),this._attachDragToScroll()}_attachDragToScroll(){let e=this.context.wrapper.find(`[${B.attachmentsHost}]`).find(`.`+z.filesScroll);e.length&&(this._dragHandler=this.context.domUtilsService.createDragToScrollHandler(e,{namespace:L+`.promptBoxFileDrag`,captureElement:this.context.wrapper}),this._dragHandler.attach())}_destroyDragHandler(){this._dragHandler&&=(this._dragHandler.destroy(),null)}destroy(){this._destroyDragHandler(),this.uploadInstance&&=(this.uploadInstance.destroy(),null)}onUploadSelect(e){e.preventDefault();let t=e.files,n=this.context.getOptions(),r=this.getFileSelectButtonSettings(n),i=this.validateFiles(t,r);i.length>0&&(this.files=[...this.files,...i],this.renderAttachments(),this.context.callbacks.onFilesChanged(),this.context.callbacks.onFileSelect(i))}validateFiles(e,t){let n=[],r=t?.restrictions;for(let t=0;t<e.length;t++){let i=e[t],a=i.rawFile||i,o=!0;if(r){if(r.allowedExtensions&&r.allowedExtensions.length>0){let e=a.name.split(`.`).pop()?.toLowerCase()||``;r.allowedExtensions.map(e=>e.toLowerCase().replace(`.`,``)).includes(e)||(o=!1)}r.maxFileSize&&a.size>r.maxFileSize&&(o=!1),r.minFileSize&&a.size<r.minFileSize&&(o=!1)}o&&n.push(i)}return n}getFileUid(e){return e?(e.uid||=this.context.utilsService.guid(),e.uid):``}showFileSelectButton(e){return e.fileSelectButton===!0||typeof e.fileSelectButton==`object`&&e.fileSelectButton!==null}getFileSelectButtonSettings(e){if(typeof e.fileSelectButton==`object`&&e.fileSelectButton!==null)return e.fileSelectButton}};let J={placeholder:`Type a message...`,actionButton:`Send`,actionButtonLoading:`Stop`,messageBoxTitle:`Message`};var be=class{constructor(e){this.inputInstance=null,this.singleRowHeight=0,this.singleLineWidth=0,this.initialHeight=0,this.minMultiRowHeight=0,this.multiline=!1,this.context=e}init(){let e=this.context.wrapper.find(`[${B.input}]`),t=this.context.getMode(),n=this.createInputElement(t);e.replaceWith(n);let r=this.context.getOptions().value||``;r&&n.val(r),this.captureInitialDimensions(),this.attachInputEvents()}getElement(){return this.inputInstance?.element||null}getValue(){return this.inputInstance?this.inputInstance.value():``}setValue(e){this.inputInstance&&this.inputInstance.value(e),this.updateAutoResize(),this.updateMultiResize()}enable(e){this.inputInstance&&this.inputInstance.enable(e)}setReadonly(e){this.inputInstance?.element&&this.inputInstance.element.prop(`readonly`,e)}focus(){this.inputInstance&&this.inputInstance.focus()}blur(){this.inputInstance?.element&&this.inputInstance.element.blur()}isMultiline(){return this.multiline}updateAutoResize(){if(this.context.getMode()!==R.AUTO||!this.inputInstance)return;let e=this.inputInstance.element;if(!e.is(`textarea`))return;let t=e[0];this.multiline?(this.updateHeight(),this.shouldCollapse()&&(this.updateMultilineState(!1),e.css(`height`,``))):(t.scrollWidth>t.clientWidth||t.scrollHeight>t.clientHeight)&&(this.updateMultilineState(!0),this.updateHeight())}updateMultiResize(){if(this.context.getMode()!==R.MULTI||!this.inputInstance)return;let e=this.inputInstance.element;if(!e.is(`textarea`))return;let t=e[0],n=this.context.getOptions();e.css(`overflow`,`hidden`),e.css(`height`,this.initialHeight+`px`);let r=t.scrollHeight,i=this.calculateMultiHeight(r,n.maxTextAreaHeight);i===n.maxTextAreaHeight&&e.css(`overflow`,``),e.css(`height`,i+`px`)}updatePlaceholder(){let e=this.context.getOptions(),t=$.extend({},J,e.messages),n=e.placeholder||t.placeholder;this.inputInstance?.element&&this.inputInstance.element.attr(`placeholder`,n)}destroy(){this.inputInstance&&=(this.inputInstance.element.off(L),this.inputInstance.destroy(),null)}createInputElement(e){let t=this.context.getOptions(),n=$.extend({},J,t.messages),r=t.title?`title="${t.title}"`:``,i=t.readonly?`readonly`:``,a;if(e===R.SINGLE)a=$(`<input type="text" class="${z.promptBoxInput} ${z.inputInner}" placeholder="${t.placeholder||n.placeholder}" autocomplete="off" ${r} ${i} />`),this.inputInstance={element:a,value:e=>{if(e===void 0)return a.val();a.val(e)},enable:e=>{a.prop(`disabled`,!e)},focus:()=>a.trigger(`focus`),destroy:()=>{}};else{let o=e===R.AUTO?1:t.rows||1;a=$(`<textarea class="${z.promptBoxTextarea} ${z.inputInner}" placeholder="${t.placeholder||n.placeholder}" rows="${o}" aria-multiline="true" ${r} ${i}></textarea>`),t.maxTextAreaHeight&&(a.css(`max-height`,t.maxTextAreaHeight+`px`),a.css(`overflow-y`,`auto`)),this.inputInstance={element:a,value:e=>{if(e===void 0)return a.val();a.val(e)},enable:e=>{a.prop(`disabled`,!e)},focus:()=>a.trigger(`focus`),destroy:()=>{}}}return a}captureInitialDimensions(){if(this.context.getMode()===R.SINGLE||!this.inputInstance)return;let e=this.inputInstance.element;if(!e.is(`textarea`))return;let t=e[0],n=window.getComputedStyle(t),r=parseFloat(n.lineHeight)||20,i=parseFloat(n.paddingTop)||0,a=parseFloat(n.paddingBottom)||0,o=this.context.getOptions().rows||1;this.singleRowHeight=r+i+a,this.initialHeight=t.offsetHeight||this.singleRowHeight,this.singleLineWidth=t.offsetWidth,this.minMultiRowHeight=r*o+i+a}shouldCollapse(){if(!this.inputInstance||this.singleLineWidth<=0)return!1;let e=this.inputInstance.element;if(!e.is(`textarea`))return!1;let t=e[0],n=t.style.height;e.css({overflow:`hidden`,width:this.singleLineWidth+`px`,whiteSpace:`nowrap`,height:this.initialHeight+`px`});let r=t.scrollWidth<=this.singleLineWidth&&t.scrollHeight<=this.initialHeight;return e.css({overflow:``,width:``,whiteSpace:``}),n?e.css(`height`,n):e.css(`height`,``),r}updateHeight(){let e=this.context.getOptions();if(!this.inputInstance)return;let t=this.inputInstance.element;if(!t.is(`textarea`))return;let n=t[0];t.css(`overflow`,`hidden`),t.css(`height`,this.initialHeight+`px`);let r=n.scrollHeight,i=e.maxTextAreaHeight?Math.min(r,e.maxTextAreaHeight):r;i===e.maxTextAreaHeight&&t.css(`overflow`,``),t.css(`height`,i+`px`)}calculateMultiHeight(e,t){return t&&e>t?t:Math.max(this.minMultiRowHeight,e)}updateMultilineState(e){if(this.context.getMode()!==R.AUTO||this.multiline===e)return;let t=this.multiline;this.multiline=e,e?this.context.wrapper.addClass(z.promptBoxMultiline):this.context.wrapper.removeClass(z.promptBoxMultiline),this.context.callbacks.onMultilineStateChange(e,t)}attachInputEvents(){if(!this.inputInstance)return;let e=this.inputInstance.element;e.on(`input`+L,()=>{this.updateAutoResize(),this.updateMultiResize(),this.context.callbacks.onInput()}),e.on(`keydown`+L,e=>{this.context.callbacks.onKeyDown(e)}),e.on(`focus`+L,()=>{this.context.callbacks.onFocus()}),e.on(`blur`+L,()=>{this.context.callbacks.onBlur()})}};let Y={placeholder:`Type a message...`,actionButton:`Send`,actionButtonLoading:`Stop`,messageBoxTitle:`Message`,fileSelectButton:`Attach file`};var X=class e extends I{static{this.options={name:`PromptBox`,prefix:``,mode:R.AUTO,placeholder:``,value:``,enable:!0,readonly:!1,title:``,fillMode:void 0,maxTextAreaHeight:void 0,rows:1,headerTemplate:null,loading:!1,actionButton:null,fileSelectButton:!1,speechToTextButton:!0,startAffixTemplate:null,endAffixTemplate:null,topAffixTemplate:null,messages:Y}}constructor(t,n,r=v(M),i=v(ce),a=v(le),o=v(k)){super(t,$.extend(!0,{},e.options,n)),this.events=[V.valueChange,V.input,V.promptAction,V.fileSelect,V.fileRemove,V.speechToTextClick,V.speechToTextStart,V.speechToTextEnd,V.speechToTextError,V.speechToTextResult,V.focus,V.blur,V.inputFocus,V.inputBlur,V.multilineStateChange],this._value=``,this._loading=!1,this._readonly=!1,this._hasFocus=!1,this._fileInputId=``,this.utilsService=r,this.htmlService=i,this.fileUtilsService=a,this.domUtilsService=o,this._value=this.options.value||``,this._loading=this.options.loading||!1,this._fileInputId=`promptbox_file_`+this.utilsService.guid(),this._initWrapper(),this._initInputManager(),this._initSpeechHandler(),this._initFileHandler(),this._attachEvents(),this.fileHandler.renderAttachments(),this._initAccessibilityManager(),this._initActionButtonManager(),this.bind(this.events,this.options),this.options.enable||this.enable(!1),this.options.readonly&&this.readonly(!0),this._value&&this._getMode()===R.AUTO&&this.inputManager.updateAutoResize(),this.actionButtonManager.updateState()}value(e){if(e===void 0)return this._value;this._value=e,this.inputManager.setValue(e),this.actionButtonManager.updateState()}enable(e=!0){let t=this.options;t.enable=e,e?(this._readonly=!1,t.readonly=!1,this.inputManager.setReadonly(!1),this.wrapper.removeClass(z.disabled)):this.wrapper.addClass(z.disabled),this.inputManager.enable(e),this.speechHandler.enable(e),this._updateFileSelectButtonState(),this.actionButtonManager.updateState(),this.accessibilityManager.updateWrapper({disabled:!e}),this.accessibilityManager.updateInputAccessibility()}readonly(e){if(e===void 0)return this._readonly;this._readonly=e;let t=this.options;t.readonly=e,this.inputManager.setReadonly(e),this.accessibilityManager.updateInputAccessibility(),this.actionButtonManager.updateState(),this.speechHandler.enable(!e),this._updateFileSelectButtonState()}loading(e){if(e===void 0)return this._loading;this._loading=e,this.accessibilityManager.updateWrapper({loading:e}),this.actionButtonManager.setLoading(e)}focus(){this.inputManager.focus()}blur(){this.inputManager.blur()}files(e){if(e===void 0)return this.fileHandler.getFiles();this.fileHandler.setFiles(e)}clearFiles(){this.fileHandler.clearFiles()}destroy(){this._detachEvents(),this._destroyCollaborators(),super.destroy()}_destroyCollaborators(){this.fileHandler.destroy(),this.speechHandler.destroy(),this.inputManager.destroy()}setOptions(e){if(e.headerTemplate!==void 0||e.startAffixTemplate!==void 0||e.endAffixTemplate!==void 0||e.topAffixTemplate!