input.utils-40504d6d.js 1.5 KB

1234
  1. /*!
  2. * (C) Ionic http://ionicframework.com - MIT License
  3. */
  4. import{w as win}from"./index-a5d50daf.js";import{r as raf}from"./helpers-d94bc8ad.js";import{d as printIonError}from"./index-cfd9c1f2.js";var createSlotMutationController=function(r,t,n){var e;var o;if(win!==undefined&&"MutationObserver"in win){var i=Array.isArray(t)?t:[t];e=new MutationObserver((function(r){for(var t=0,e=r;t<e.length;t++){var o=e[t];var u=function(r){if(r.nodeType===Node.ELEMENT_NODE&&i.includes(r.slot)){n();raf((function(){return a(r)}));return{value:void 0}}};for(var f=0,d=o.addedNodes;f<d.length;f++){var v=d[f];var c=u(v);if(typeof c==="object")return c.value}}}));e.observe(r,{childList:true,subtree:true})}var a=function(r){var e;if(o){o.disconnect();o=undefined}o=new MutationObserver((function(r){n();for(var e=0,o=r;e<o.length;e++){var i=o[e];for(var a=0,u=i.removedNodes;a<u.length;a++){var d=u[a];if(d.nodeType===Node.ELEMENT_NODE&&d.slot===t){f()}}}}));o.observe((e=r.parentElement)!==null&&e!==void 0?e:r,{subtree:true,childList:true})};var u=function(){if(e){e.disconnect();e=undefined}f()};var f=function(){if(o){o.disconnect();o=undefined}};return{destroy:u}};var getCounterText=function(r,t,n){var e=r==null?0:r.toString().length;var o=defaultCounterFormatter(e,t);if(n===undefined){return o}try{return n(e,t)}catch(r){printIonError("[ion-input] - Exception in provided `counterFormatter`:",r);return o}};var defaultCounterFormatter=function(r,t){return"".concat(r," / ").concat(t)};export{createSlotMutationController as c,getCounterText as g};