balm-ui
Version:
A modular and customizable UI library based on Material Design and Vue 3
1 lines • 32.4 kB
JavaScript
!function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e(require("vue")):"function"===typeof define&&define.amd?define("UiCheckbox",["vue"],e):"object"===typeof exports?exports.UiCheckbox=e(require("vue")):t.UiCheckbox=e(t.Vue)}("undefined"!==typeof self?self:this,(function(t){return function(){"use strict";var e={744:function(t){var e=function(t){return function(t){return!!t&&"object"===typeof t}(t)&&!function(t){var e=Object.prototype.toString.call(t);return"[object RegExp]"===e||"[object Date]"===e||function(t){return t.$$typeof===n}(t)}(t)};var n="function"===typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function r(t,e){return!1!==e.clone&&e.isMergeableObject(t)?c((n=t,Array.isArray(n)?[]:{}),t,e):t;var n}function i(t,e,n){return t.concat(e).map((function(t){return r(t,n)}))}function a(t){return Object.keys(t).concat(function(t){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter((function(e){return Object.propertyIsEnumerable.call(t,e)})):[]}(t))}function o(t,e){try{return e in t}catch(n){return!1}}function s(t,e,n){var i={};return n.isMergeableObject(t)&&a(t).forEach((function(e){i[e]=r(t[e],n)})),a(e).forEach((function(a){(function(t,e){return o(t,e)&&!(Object.hasOwnProperty.call(t,e)&&Object.propertyIsEnumerable.call(t,e))})(t,a)||(o(t,a)&&n.isMergeableObject(e[a])?i[a]=function(t,e){if(!e.customMerge)return c;var n=e.customMerge(t);return"function"===typeof n?n:c}(a,n)(t[a],e[a],n):i[a]=r(e[a],n))})),i}function c(t,n,a){(a=a||{}).arrayMerge=a.arrayMerge||i,a.isMergeableObject=a.isMergeableObject||e,a.cloneUnlessOtherwiseSpecified=r;var o=Array.isArray(n);return o===Array.isArray(t)?o?a.arrayMerge(t,n,a):s(t,n,a):r(n,a)}c.all=function(t,e){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce((function(t,n){return c(t,n,e)}),{})};var u=c;t.exports=u},154:function(e){e.exports=t}},n={};function r(t){var i=n[t];if(void 0!==i)return i.exports;var a=n[t]={exports:{}};return e[t](a,a.exports,r),a.exports}r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,{a:e}),e},r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};var i={};r.d(i,{default:function(){return Z}});var a=r(744),o=r.n(a);const s=/(?:^\[object\s(.*?)\]$)/;var c=t=>Object.prototype.toString.call(t).replace(s,"$1").toLowerCase();const u=t=>{let{componentProps:e,propName:n,props:r}=t,i=r[n];if("object"===c(i)){const t=e[n].default;e[n].default=()=>o()(t,i)}else Array.isArray(i)?e[n].default=()=>i:e[n].default=i},d=t=>{let{componentMixins:e,propName:n,props:r}=t;if(e.length){let t=e.length;for(;t--;)if(e[t].props&&void 0!==e[t].props[n]){u({componentProps:e[t].props,propName:n,props:r});break}}};var l=(t,e)=>{for(const n of Object.keys(e))t.props?void 0===t.props[n]?d({componentMixins:t.mixins,propName:n,props:e}):u({componentProps:t.props,propName:n,props:e}):d({componentMixins:t.mixins,propName:n,props:e})};var p=t=>{const e={install(e){l(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),e.component(t.name,t)}};return e},f=r(154),h=function(t,e){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},h(t,e)};function v(t,e){if("function"!==typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}h(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var m=function(){return m=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},m.apply(this,arguments)};Object.create;function y(t){var e="function"===typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"===typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function b(t,e){var n="function"===typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,a=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(r=a.next()).done;)o.push(r.value)}catch(s){i={error:s}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}return o}function A(t,e,n){if(n||2===arguments.length)for(var r,i=0,a=e.length;i<a;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}Object.create;"function"===typeof SuppressedError&&SuppressedError;var E={animationend:{cssProperty:"animation",prefixed:"webkitAnimationEnd",standard:"animationend"},animationiteration:{cssProperty:"animation",prefixed:"webkitAnimationIteration",standard:"animationiteration"},animationstart:{cssProperty:"animation",prefixed:"webkitAnimationStart",standard:"animationstart"},transitionend:{cssProperty:"transition",prefixed:"webkitTransitionEnd",standard:"transitionend"}};function C(t){return Boolean(t.document)&&"function"===typeof t.document.createElement}function g(t,e){if(C(t)&&e in E){var n=t.document.createElement("div"),r=E[e],i=r.standard,a=r.prefixed;return r.cssProperty in n.style?i:a}return e}var T=function(){function t(t){void 0===t&&(t={}),this.adapter=t}return Object.defineProperty(t,"cssClasses",{get:function(){return{}},enumerable:!1,configurable:!0}),Object.defineProperty(t,"strings",{get:function(){return{}},enumerable:!1,configurable:!0}),Object.defineProperty(t,"numbers",{get:function(){return{}},enumerable:!1,configurable:!0}),Object.defineProperty(t,"defaultAdapter",{get:function(){return{}},enumerable:!1,configurable:!0}),t.prototype.init=function(){},t.prototype.destroy=function(){},t}(),N=function(){function t(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];this.root=t,this.initialize.apply(this,A([],b(n))),this.foundation=void 0===e?this.getDefaultFoundation():e,this.foundation.init(),this.initialSyncWithDOM()}return t.attachTo=function(e){return new t(e,new T({}))},t.prototype.initialize=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e]},t.prototype.getDefaultFoundation=function(){throw new Error("Subclasses must override getDefaultFoundation to return a properly configured foundation class")},t.prototype.initialSyncWithDOM=function(){},t.prototype.destroy=function(){this.foundation.destroy()},t.prototype.listen=function(t,e,n){this.root.addEventListener(t,e,n)},t.prototype.unlisten=function(t,e,n){this.root.removeEventListener(t,e,n)},t.prototype.emit=function(t,e,n){var r;void 0===n&&(n=!1),"function"===typeof CustomEvent?r=new CustomEvent(t,{bubbles:n,detail:e}):(r=document.createEvent("CustomEvent")).initCustomEvent(t,n,!1,e),this.root.dispatchEvent(r)},t}();function I(t){return void 0===t&&(t=window),!!function(t){void 0===t&&(t=window);var e=!1;try{var n={get passive(){return e=!0,!1}},r=function(){};t.document.addEventListener("test",r,n),t.document.removeEventListener("test",r,n)}catch(i){e=!1}return e}(t)&&{passive:!0}}function _(t,e){return(t.matches||t.webkitMatchesSelector||t.msMatchesSelector).call(t,e)}var S,D={BG_FOCUSED:"mdc-ripple-upgraded--background-focused",FG_ACTIVATION:"mdc-ripple-upgraded--foreground-activation",FG_DEACTIVATION:"mdc-ripple-upgraded--foreground-deactivation",ROOT:"mdc-ripple-upgraded",UNBOUNDED:"mdc-ripple-upgraded--unbounded"},k={VAR_FG_SCALE:"--mdc-ripple-fg-scale",VAR_FG_SIZE:"--mdc-ripple-fg-size",VAR_FG_TRANSLATE_END:"--mdc-ripple-fg-translate-end",VAR_FG_TRANSLATE_START:"--mdc-ripple-fg-translate-start",VAR_LEFT:"--mdc-ripple-left",VAR_TOP:"--mdc-ripple-top"},O={DEACTIVATION_TIMEOUT_MS:225,FG_DEACTIVATION_MS:150,INITIAL_ORIGIN_SCALE:.6,PADDING:10,TAP_DELAY_MS:300};var x=["touchstart","pointerdown","mousedown","keydown"],R=["touchend","pointerup","mouseup","contextmenu"],w=[],H=function(t){function e(n){var r=t.call(this,m(m({},e.defaultAdapter),n))||this;return r.activationAnimationHasEnded=!1,r.activationTimer=0,r.fgDeactivationRemovalTimer=0,r.fgScale="0",r.frame={width:0,height:0},r.initialSize=0,r.layoutFrame=0,r.maxRadius=0,r.unboundedCoords={left:0,top:0},r.activationState=r.defaultActivationState(),r.activationTimerCallback=function(){r.activationAnimationHasEnded=!0,r.runDeactivationUXLogicIfReady()},r.activateHandler=function(t){r.activateImpl(t)},r.deactivateHandler=function(){r.deactivateImpl()},r.focusHandler=function(){r.handleFocus()},r.blurHandler=function(){r.handleBlur()},r.resizeHandler=function(){r.layout()},r}return v(e,t),Object.defineProperty(e,"cssClasses",{get:function(){return D},enumerable:!1,configurable:!0}),Object.defineProperty(e,"strings",{get:function(){return k},enumerable:!1,configurable:!0}),Object.defineProperty(e,"numbers",{get:function(){return O},enumerable:!1,configurable:!0}),Object.defineProperty(e,"defaultAdapter",{get:function(){return{addClass:function(){},browserSupportsCssVars:function(){return!0},computeBoundingRect:function(){return{top:0,right:0,bottom:0,left:0,width:0,height:0}},containsEventTarget:function(){return!0},deregisterDocumentInteractionHandler:function(){},deregisterInteractionHandler:function(){},deregisterResizeHandler:function(){},getWindowPageOffset:function(){return{x:0,y:0}},isSurfaceActive:function(){return!0},isSurfaceDisabled:function(){return!0},isUnbounded:function(){return!0},registerDocumentInteractionHandler:function(){},registerInteractionHandler:function(){},registerResizeHandler:function(){},removeClass:function(){},updateCssVariable:function(){}}},enumerable:!1,configurable:!0}),e.prototype.init=function(){var t=this,n=this.supportsPressRipple();if(this.registerRootHandlers(n),n){var r=e.cssClasses,i=r.ROOT,a=r.UNBOUNDED;requestAnimationFrame((function(){t.adapter.addClass(i),t.adapter.isUnbounded()&&(t.adapter.addClass(a),t.layoutInternal())}))}},e.prototype.destroy=function(){var t=this;if(this.supportsPressRipple()){this.activationTimer&&(clearTimeout(this.activationTimer),this.activationTimer=0,this.adapter.removeClass(e.cssClasses.FG_ACTIVATION)),this.fgDeactivationRemovalTimer&&(clearTimeout(this.fgDeactivationRemovalTimer),this.fgDeactivationRemovalTimer=0,this.adapter.removeClass(e.cssClasses.FG_DEACTIVATION));var n=e.cssClasses,r=n.ROOT,i=n.UNBOUNDED;requestAnimationFrame((function(){t.adapter.removeClass(r),t.adapter.removeClass(i),t.removeCssVars()}))}this.deregisterRootHandlers(),this.deregisterDeactivationHandlers()},e.prototype.activate=function(t){this.activateImpl(t)},e.prototype.deactivate=function(){this.deactivateImpl()},e.prototype.layout=function(){var t=this;this.layoutFrame&&cancelAnimationFrame(this.layoutFrame),this.layoutFrame=requestAnimationFrame((function(){t.layoutInternal(),t.layoutFrame=0}))},e.prototype.setUnbounded=function(t){var n=e.cssClasses.UNBOUNDED;t?this.adapter.addClass(n):this.adapter.removeClass(n)},e.prototype.handleFocus=function(){var t=this;requestAnimationFrame((function(){return t.adapter.addClass(e.cssClasses.BG_FOCUSED)}))},e.prototype.handleBlur=function(){var t=this;requestAnimationFrame((function(){return t.adapter.removeClass(e.cssClasses.BG_FOCUSED)}))},e.prototype.supportsPressRipple=function(){return this.adapter.browserSupportsCssVars()},e.prototype.defaultActivationState=function(){return{activationEvent:void 0,hasDeactivationUXRun:!1,isActivated:!1,isProgrammatic:!1,wasActivatedByPointer:!1,wasElementMadeActive:!1}},e.prototype.registerRootHandlers=function(t){var e,n;if(t){try{for(var r=y(x),i=r.next();!i.done;i=r.next()){var a=i.value;this.adapter.registerInteractionHandler(a,this.activateHandler)}}catch(o){e={error:o}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}this.adapter.isUnbounded()&&this.adapter.registerResizeHandler(this.resizeHandler)}this.adapter.registerInteractionHandler("focus",this.focusHandler),this.adapter.registerInteractionHandler("blur",this.blurHandler)},e.prototype.registerDeactivationHandlers=function(t){var e,n;if("keydown"===t.type)this.adapter.registerInteractionHandler("keyup",this.deactivateHandler);else try{for(var r=y(R),i=r.next();!i.done;i=r.next()){var a=i.value;this.adapter.registerDocumentInteractionHandler(a,this.deactivateHandler)}}catch(o){e={error:o}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}},e.prototype.deregisterRootHandlers=function(){var t,e;try{for(var n=y(x),r=n.next();!r.done;r=n.next()){var i=r.value;this.adapter.deregisterInteractionHandler(i,this.activateHandler)}}catch(a){t={error:a}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.adapter.deregisterInteractionHandler("focus",this.focusHandler),this.adapter.deregisterInteractionHandler("blur",this.blurHandler),this.adapter.isUnbounded()&&this.adapter.deregisterResizeHandler(this.resizeHandler)},e.prototype.deregisterDeactivationHandlers=function(){var t,e;this.adapter.deregisterInteractionHandler("keyup",this.deactivateHandler);try{for(var n=y(R),r=n.next();!r.done;r=n.next()){var i=r.value;this.adapter.deregisterDocumentInteractionHandler(i,this.deactivateHandler)}}catch(a){t={error:a}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}},e.prototype.removeCssVars=function(){var t=this,n=e.strings;Object.keys(n).forEach((function(e){0===e.indexOf("VAR_")&&t.adapter.updateCssVariable(n[e],null)}))},e.prototype.activateImpl=function(t){var e=this;if(!this.adapter.isSurfaceDisabled()){var n=this.activationState;if(!n.isActivated){var r=this.previousActivationEvent;if(!(r&&void 0!==t&&r.type!==t.type))n.isActivated=!0,n.isProgrammatic=void 0===t,n.activationEvent=t,n.wasActivatedByPointer=!n.isProgrammatic&&(void 0!==t&&("mousedown"===t.type||"touchstart"===t.type||"pointerdown"===t.type)),void 0!==t&&w.length>0&&w.some((function(t){return e.adapter.containsEventTarget(t)}))?this.resetActivationState():(void 0!==t&&(w.push(t.target),this.registerDeactivationHandlers(t)),n.wasElementMadeActive=this.checkElementMadeActive(t),n.wasElementMadeActive&&this.animateActivation(),requestAnimationFrame((function(){w=[],n.wasElementMadeActive||void 0===t||" "!==t.key&&32!==t.keyCode||(n.wasElementMadeActive=e.checkElementMadeActive(t),n.wasElementMadeActive&&e.animateActivation()),n.wasElementMadeActive||(e.activationState=e.defaultActivationState())})))}}},e.prototype.checkElementMadeActive=function(t){return void 0===t||"keydown"!==t.type||this.adapter.isSurfaceActive()},e.prototype.animateActivation=function(){var t=this,n=e.strings,r=n.VAR_FG_TRANSLATE_START,i=n.VAR_FG_TRANSLATE_END,a=e.cssClasses,o=a.FG_DEACTIVATION,s=a.FG_ACTIVATION,c=e.numbers.DEACTIVATION_TIMEOUT_MS;this.layoutInternal();var u="",d="";if(!this.adapter.isUnbounded()){var l=this.getFgTranslationCoordinates(),p=l.startPoint,f=l.endPoint;u=p.x+"px, "+p.y+"px",d=f.x+"px, "+f.y+"px"}this.adapter.updateCssVariable(r,u),this.adapter.updateCssVariable(i,d),clearTimeout(this.activationTimer),clearTimeout(this.fgDeactivationRemovalTimer),this.rmBoundedActivationClasses(),this.adapter.removeClass(o),this.adapter.computeBoundingRect(),this.adapter.addClass(s),this.activationTimer=setTimeout((function(){t.activationTimerCallback()}),c)},e.prototype.getFgTranslationCoordinates=function(){var t,e=this.activationState,n=e.activationEvent;return{startPoint:t={x:(t=e.wasActivatedByPointer?function(t,e,n){if(!t)return{x:0,y:0};var r,i,a=e.x,o=e.y,s=a+n.left,c=o+n.top;if("touchstart"===t.type){var u=t;r=u.changedTouches[0].pageX-s,i=u.changedTouches[0].pageY-c}else{var d=t;r=d.pageX-s,i=d.pageY-c}return{x:r,y:i}}(n,this.adapter.getWindowPageOffset(),this.adapter.computeBoundingRect()):{x:this.frame.width/2,y:this.frame.height/2}).x-this.initialSize/2,y:t.y-this.initialSize/2},endPoint:{x:this.frame.width/2-this.initialSize/2,y:this.frame.height/2-this.initialSize/2}}},e.prototype.runDeactivationUXLogicIfReady=function(){var t=this,n=e.cssClasses.FG_DEACTIVATION,r=this.activationState,i=r.hasDeactivationUXRun,a=r.isActivated;(i||!a)&&this.activationAnimationHasEnded&&(this.rmBoundedActivationClasses(),this.adapter.addClass(n),this.fgDeactivationRemovalTimer=setTimeout((function(){t.adapter.removeClass(n)}),O.FG_DEACTIVATION_MS))},e.prototype.rmBoundedActivationClasses=function(){var t=e.cssClasses.FG_ACTIVATION;this.adapter.removeClass(t),this.activationAnimationHasEnded=!1,this.adapter.computeBoundingRect()},e.prototype.resetActivationState=function(){var t=this;this.previousActivationEvent=this.activationState.activationEvent,this.activationState=this.defaultActivationState(),setTimeout((function(){return t.previousActivationEvent=void 0}),e.numbers.TAP_DELAY_MS)},e.prototype.deactivateImpl=function(){var t=this,e=this.activationState;if(e.isActivated){var n=m({},e);e.isProgrammatic?(requestAnimationFrame((function(){t.animateDeactivation(n)})),this.resetActivationState()):(this.deregisterDeactivationHandlers(),requestAnimationFrame((function(){t.activationState.hasDeactivationUXRun=!0,t.animateDeactivation(n),t.resetActivationState()})))}},e.prototype.animateDeactivation=function(t){var e=t.wasActivatedByPointer,n=t.wasElementMadeActive;(e||n)&&this.runDeactivationUXLogicIfReady()},e.prototype.layoutInternal=function(){var t=this;this.frame=this.adapter.computeBoundingRect();var n=Math.max(this.frame.height,this.frame.width);this.maxRadius=this.adapter.isUnbounded()?n:Math.sqrt(Math.pow(t.frame.width,2)+Math.pow(t.frame.height,2))+e.numbers.PADDING;var r=Math.floor(n*e.numbers.INITIAL_ORIGIN_SCALE);this.adapter.isUnbounded()&&r%2!==0?this.initialSize=r-1:this.initialSize=r,this.fgScale=""+this.maxRadius/this.initialSize,this.updateLayoutCssVars()},e.prototype.updateLayoutCssVars=function(){var t=e.strings,n=t.VAR_FG_SIZE,r=t.VAR_LEFT,i=t.VAR_TOP,a=t.VAR_FG_SCALE;this.adapter.updateCssVariable(n,this.initialSize+"px"),this.adapter.updateCssVariable(a,this.fgScale),this.adapter.isUnbounded()&&(this.unboundedCoords={left:Math.round(this.frame.width/2-this.initialSize/2),top:Math.round(this.frame.height/2-this.initialSize/2)},this.adapter.updateCssVariable(r,this.unboundedCoords.left+"px"),this.adapter.updateCssVariable(i,this.unboundedCoords.top+"px"))},e}(T),M=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.disabled=!1,e}return v(e,t),e.attachTo=function(t,n){void 0===n&&(n={isUnbounded:void 0});var r=new e(t);return void 0!==n.isUnbounded&&(r.unbounded=n.isUnbounded),r},e.createAdapter=function(t){return{addClass:function(e){return t.root.classList.add(e)},browserSupportsCssVars:function(){return function(t,e){void 0===e&&(e=!1);var n,r=t.CSS;if("boolean"===typeof S&&!e)return S;if(!r||"function"!==typeof r.supports)return!1;var i=r.supports("--css-vars","yes"),a=r.supports("(--css-vars: yes)")&&r.supports("color","#00000000");return n=i||a,e||(S=n),n}(window)},computeBoundingRect:function(){return t.root.getBoundingClientRect()},containsEventTarget:function(e){return t.root.contains(e)},deregisterDocumentInteractionHandler:function(t,e){return document.documentElement.removeEventListener(t,e,I())},deregisterInteractionHandler:function(e,n){return t.root.removeEventListener(e,n,I())},deregisterResizeHandler:function(t){return window.removeEventListener("resize",t)},getWindowPageOffset:function(){return{x:window.pageXOffset,y:window.pageYOffset}},isSurfaceActive:function(){return _(t.root,":active")},isSurfaceDisabled:function(){return Boolean(t.disabled)},isUnbounded:function(){return Boolean(t.unbounded)},registerDocumentInteractionHandler:function(t,e){return document.documentElement.addEventListener(t,e,I())},registerInteractionHandler:function(e,n){return t.root.addEventListener(e,n,I())},registerResizeHandler:function(t){return window.addEventListener("resize",t)},removeClass:function(e){return t.root.classList.remove(e)},updateCssVariable:function(e,n){return t.root.style.setProperty(e,n)}}},Object.defineProperty(e.prototype,"unbounded",{get:function(){return Boolean(this.isUnbounded)},set:function(t){this.isUnbounded=Boolean(t),this.setUnbounded()},enumerable:!1,configurable:!0}),e.prototype.activate=function(){this.foundation.activate()},e.prototype.deactivate=function(){this.foundation.deactivate()},e.prototype.layout=function(){this.foundation.layout()},e.prototype.getDefaultFoundation=function(){return new H(e.createAdapter(this))},e.prototype.initialSyncWithDOM=function(){var t=this.root;this.isUnbounded="mdcRippleIsUnbounded"in t.dataset},e.prototype.setUnbounded=function(){this.foundation.setUnbounded(Boolean(this.isUnbounded))},e}(N),P={ANIM_CHECKED_INDETERMINATE:"mdc-checkbox--anim-checked-indeterminate",ANIM_CHECKED_UNCHECKED:"mdc-checkbox--anim-checked-unchecked",ANIM_INDETERMINATE_CHECKED:"mdc-checkbox--anim-indeterminate-checked",ANIM_INDETERMINATE_UNCHECKED:"mdc-checkbox--anim-indeterminate-unchecked",ANIM_UNCHECKED_CHECKED:"mdc-checkbox--anim-unchecked-checked",ANIM_UNCHECKED_INDETERMINATE:"mdc-checkbox--anim-unchecked-indeterminate",BACKGROUND:"mdc-checkbox__background",CHECKED:"mdc-checkbox--checked",CHECKMARK:"mdc-checkbox__checkmark",CHECKMARK_PATH:"mdc-checkbox__checkmark-path",DISABLED:"mdc-checkbox--disabled",INDETERMINATE:"mdc-checkbox--indeterminate",MIXEDMARK:"mdc-checkbox__mixedmark",NATIVE_CONTROL:"mdc-checkbox__native-control",ROOT:"mdc-checkbox",SELECTED:"mdc-checkbox--selected",UPGRADED:"mdc-checkbox--upgraded"},U={ARIA_CHECKED_ATTR:"aria-checked",ARIA_CHECKED_INDETERMINATE_VALUE:"mixed",DATA_INDETERMINATE_ATTR:"data-indeterminate",NATIVE_CONTROL_SELECTOR:".mdc-checkbox__native-control",TRANSITION_STATE_CHECKED:"checked",TRANSITION_STATE_INDETERMINATE:"indeterminate",TRANSITION_STATE_INIT:"init",TRANSITION_STATE_UNCHECKED:"unchecked"},V={ANIM_END_LATCH_MS:250},j=function(t){function e(n){var r=t.call(this,m(m({},e.defaultAdapter),n))||this;return r.currentCheckState=U.TRANSITION_STATE_INIT,r.currentAnimationClass="",r.animEndLatchTimer=0,r.enableAnimationEndHandler=!1,r}return v(e,t),Object.defineProperty(e,"cssClasses",{get:function(){return P},enumerable:!1,configurable:!0}),Object.defineProperty(e,"strings",{get:function(){return U},enumerable:!1,configurable:!0}),Object.defineProperty(e,"numbers",{get:function(){return V},enumerable:!1,configurable:!0}),Object.defineProperty(e,"defaultAdapter",{get:function(){return{addClass:function(){},forceLayout:function(){},hasNativeControl:function(){return!1},isAttachedToDOM:function(){return!1},isChecked:function(){return!1},isIndeterminate:function(){return!1},removeClass:function(){},removeNativeControlAttr:function(){},setNativeControlAttr:function(){},setNativeControlDisabled:function(){}}},enumerable:!1,configurable:!0}),e.prototype.init=function(){this.currentCheckState=this.determineCheckState(),this.updateAriaChecked(),this.adapter.addClass(P.UPGRADED)},e.prototype.destroy=function(){clearTimeout(this.animEndLatchTimer)},e.prototype.setDisabled=function(t){this.adapter.setNativeControlDisabled(t),t?this.adapter.addClass(P.DISABLED):this.adapter.removeClass(P.DISABLED)},e.prototype.handleAnimationEnd=function(){var t=this;this.enableAnimationEndHandler&&(clearTimeout(this.animEndLatchTimer),this.animEndLatchTimer=setTimeout((function(){t.adapter.removeClass(t.currentAnimationClass),t.enableAnimationEndHandler=!1}),V.ANIM_END_LATCH_MS))},e.prototype.handleChange=function(){this.transitionCheckState()},e.prototype.transitionCheckState=function(){if(this.adapter.hasNativeControl()){var t=this.currentCheckState,e=this.determineCheckState();if(t!==e){this.updateAriaChecked();var n=P.SELECTED;e===U.TRANSITION_STATE_UNCHECKED?this.adapter.removeClass(n):this.adapter.addClass(n),this.currentAnimationClass.length>0&&(clearTimeout(this.animEndLatchTimer),this.adapter.forceLayout(),this.adapter.removeClass(this.currentAnimationClass)),this.currentAnimationClass=this.getTransitionAnimationClass(t,e),this.currentCheckState=e,this.adapter.isAttachedToDOM()&&this.currentAnimationClass.length>0&&(this.adapter.addClass(this.currentAnimationClass),this.enableAnimationEndHandler=!0)}}},e.prototype.determineCheckState=function(){var t=U.TRANSITION_STATE_INDETERMINATE,e=U.TRANSITION_STATE_CHECKED,n=U.TRANSITION_STATE_UNCHECKED;return this.adapter.isIndeterminate()?t:this.adapter.isChecked()?e:n},e.prototype.getTransitionAnimationClass=function(t,n){var r=U.TRANSITION_STATE_INIT,i=U.TRANSITION_STATE_CHECKED,a=U.TRANSITION_STATE_UNCHECKED,o=e.cssClasses,s=o.ANIM_UNCHECKED_CHECKED,c=o.ANIM_UNCHECKED_INDETERMINATE,u=o.ANIM_CHECKED_UNCHECKED,d=o.ANIM_CHECKED_INDETERMINATE,l=o.ANIM_INDETERMINATE_CHECKED,p=o.ANIM_INDETERMINATE_UNCHECKED;switch(t){case r:return n===a?"":n===i?l:p;case a:return n===i?s:c;case i:return n===a?u:d;default:return n===i?l:p}},e.prototype.updateAriaChecked=function(){this.adapter.isIndeterminate()?this.adapter.setNativeControlAttr(U.ARIA_CHECKED_ATTR,U.ARIA_CHECKED_INDETERMINATE_VALUE):this.adapter.removeNativeControlAttr(U.ARIA_CHECKED_ATTR)},e}(T),L=["checked","indeterminate"],F=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.rippleSurface=e.createRipple(),e}return v(e,t),e.attachTo=function(t){return new e(t)},Object.defineProperty(e.prototype,"ripple",{get:function(){return this.rippleSurface},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"checked",{get:function(){return this.getNativeControl().checked},set:function(t){this.getNativeControl().checked=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"indeterminate",{get:function(){return this.getNativeControl().indeterminate},set:function(t){this.getNativeControl().indeterminate=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"disabled",{get:function(){return this.getNativeControl().disabled},set:function(t){this.foundation.setDisabled(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this.getNativeControl().value},set:function(t){this.getNativeControl().value=t},enumerable:!1,configurable:!0}),e.prototype.initialize=function(){var t=U.DATA_INDETERMINATE_ATTR;this.getNativeControl().indeterminate="true"===this.getNativeControl().getAttribute(t),this.getNativeControl().removeAttribute(t)},e.prototype.initialSyncWithDOM=function(){var t=this;this.handleChange=function(){t.foundation.handleChange()},this.handleAnimationEnd=function(){t.foundation.handleAnimationEnd()},this.getNativeControl().addEventListener("change",this.handleChange),this.listen(g(window,"animationend"),this.handleAnimationEnd),this.installPropertyChangeHooks()},e.prototype.destroy=function(){this.rippleSurface.destroy(),this.getNativeControl().removeEventListener("change",this.handleChange),this.unlisten(g(window,"animationend"),this.handleAnimationEnd),this.uninstallPropertyChangeHooks(),t.prototype.destroy.call(this)},e.prototype.getDefaultFoundation=function(){var t=this;return new j({addClass:function(e){return t.root.classList.add(e)},forceLayout:function(){return t.root.offsetWidth},hasNativeControl:function(){return!!t.getNativeControl()},isAttachedToDOM:function(){return Boolean(t.root.parentNode)},isChecked:function(){return t.checked},isIndeterminate:function(){return t.indeterminate},removeClass:function(e){t.root.classList.remove(e)},removeNativeControlAttr:function(e){t.getNativeControl().removeAttribute(e)},setNativeControlAttr:function(e,n){t.getNativeControl().setAttribute(e,n)},setNativeControlDisabled:function(e){t.getNativeControl().disabled=e}})},e.prototype.createRipple=function(){var t=this,e=m(m({},M.createAdapter(this)),{deregisterInteractionHandler:function(e,n){t.getNativeControl().removeEventListener(e,n,I())},isSurfaceActive:function(){return _(t.getNativeControl(),":active")},isUnbounded:function(){return!0},registerInteractionHandler:function(e,n){t.getNativeControl().addEventListener(e,n,I())}});return new M(this.root,new H(e))},e.prototype.installPropertyChangeHooks=function(){var t,e,n=this,r=this.getNativeControl(),i=Object.getPrototypeOf(r),a=function(t){var e=Object.getOwnPropertyDescriptor(i,t);if(!B(e))return{value:void 0};var a=e.get,o={configurable:e.configurable,enumerable:e.enumerable,get:a,set:function(t){e.set.call(r,t),n.foundation.handleChange()}};Object.defineProperty(r,t,o)};try{for(var o=y(L),s=o.next();!s.done;s=o.next()){var c=a(s.value);if("object"===typeof c)return c.value}}catch(u){t={error:u}}finally{try{s&&!s.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}},e.prototype.uninstallPropertyChangeHooks=function(){var t,e,n=this.getNativeControl(),r=Object.getPrototypeOf(n);try{for(var i=y(L),a=i.next();!a.done;a=i.next()){var o=a.value,s=Object.getOwnPropertyDescriptor(r,o);if(!B(s))return;Object.defineProperty(n,o,s)}}catch(c){t={error:c}}finally{try{a&&!a.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}},e.prototype.getNativeControl=function(){var t=U.NATIVE_CONTROL_SELECTOR,e=this.root.querySelector(t);if(!e)throw new Error("Checkbox component requires a "+t+" element");return e},e}(N);function B(t){return!!t&&"function"===typeof t.set}const K=["checked","disabled"],G=(0,f.createStaticVNode)('<div class="mdc-checkbox__background"><svg class="mdc-checkbox__checkmark" viewBox="0 0 24 24"><path class="mdc-checkbox__checkmark-path" fill="none" d="M1.73,12.91 8.1,19.28 22.79,4.59"></path></svg><div class="mdc-checkbox__mixedmark"></div></div><div class="mdc-checkbox__ripple"></div><div class="mdc-checkbox__focus-ring"></div>',3),z={name:"MdcCheckbox",customOptions:{}};var q=Object.assign(z,{props:{checked:{type:[Boolean,null],default:null},indeterminate:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},setup(t,e){let{expose:n}=e;const r=t,i=(0,f.ref)(null),a=(0,f.ref)(null);return(0,f.onMounted)((()=>{r.indeterminate&&(a.value.indeterminate=r.indeterminate),r.disabled&&(a.value.disabled=r.disabled),(0,f.watch)((()=>r.indeterminate),(t=>a.value.indeterminate=t)),(0,f.watch)((()=>r.disabled),(t=>a.value.disabled=t))})),n({mdcCheckbox:i,reset:function(){a.value.indeterminate?a.value.indeterminate=!1:a.value.checked=!1}}),(e,n)=>((0,f.openBlock)(),(0,f.createElementBlock)("div",{ref_key:"mdcCheckbox",ref:i,class:"mdc-checkbox"},[(0,f.renderSlot)(e.$slots,"default",{},(()=>[(0,f.createElementVNode)("input",{ref_key:"checkbox",ref:a,type:"checkbox",class:"mdc-checkbox__native-control",checked:t.checked,disabled:t.disabled},null,8,K)])),G],512))}});const $={inputId:{type:[String,null],default:null},attrs:{type:Object,default:()=>({})}},X=["id","value","disabled","data-indeterminate"],W={cssClasses:{touch:"mdc-checkbox--touch"},EVENTS:{CHANGE:"update:modelValue"}},Y={name:"UiCheckbox",customOptions:{UI_CHECKBOX:W}};var Z=p(Object.assign(Y,{props:{modelValue:{type:null,default:!1},indeterminate:{type:Boolean,default:!1},...$,value:{type:[String,Number],default:""},disabled:{type:Boolean,default:!1}},emits:[W.EVENTS.CHANGE],setup(t,e){let{emit:n}=e;const r=t,i=n,a=(0,f.getCurrentInstance)().parent,o=(0,f.ref)(null),s=(0,f.reactive)({$checkbox:null,selectedValue:l(r.modelValue)}),{selectedValue:c}=(0,f.toRefs)(s),u=(0,f.computed)((()=>{const t=o.value;return t&&t.mdcCheckbox.classList.contains(W.cssClasses.touch)})),d=(0,f.computed)((()=>({"mdc-checkbox--disabled":r.disabled,"mdc-checkbox--touch":u.value})));function l(t){return Array.isArray(t)?[...t]:!!t}function p(){i(W.EVENTS.CHANGE,s.selectedValue)}return(0,f.onMounted)((()=>{(0,f.nextTick)((()=>{var t;const e=o.value;s.$checkbox=new F(e.mdcCheckbox),s.$checkbox.indeterminate=r.indeterminate;const n=null===a||void 0===a||null===(t=a.exposed)||void 0===t?void 0:t.$formField.value;n&&(n.input=s.$checkbox)})),(0,f.watch)((()=>r.modelValue),(t=>s.selectedValue=l(t))),(0,f.watch)((()=>r.indeterminate),(t=>s.$checkbox.indeterminate=t)),(0,f.watch)((()=>r.disabled),(t=>s.$checkbox.disabled=t))})),(e,n)=>((0,f.openBlock)(),(0,f.createBlock)(q,{ref_key:"checkbox",ref:o,class:(0,f.normalizeClass)(d.value)},{default:(0,f.withCtx)((()=>[(0,f.withDirectives)((0,f.createElementVNode)("input",(0,f.mergeProps)({id:e.inputId,"onUpdate:modelValue":n[0]||(n[0]=t=>(0,f.isRef)(c)?c.value=t:null),type:"checkbox",class:"mdc-checkbox__native-control",value:t.value,disabled:t.disabled,"data-indeterminate":t.indeterminate},e.attrs,{onChange:p}),null,16,X),[[f.vModelCheckbox,(0,f.unref)(c)]])])),_:1},8,["class"]))}}));return i=i.default}()}));