@seven.io/counter
Advanced tools
Comparing version 1.9.0 to 1.10.0
@@ -1,1 +0,1 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).SevenCounter={})}(this,(function(t){"use strict";var n=function(){return n=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var o in n=arguments[e])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t},n.apply(this,arguments)};function e(t){var n="function"==typeof Symbol&&Symbol.iterator,e=n&&t[n],r=0;if(e)return e.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(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function r(t,n){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,o,i=e.call(t),a=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return a}function o(t,n,e){if(e||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return t.concat(r||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var i,a=function(t,n){var e=t.offsetWidth-n.offsetWidth;n.style.left="".concat(e,"px");var r=t.offsetHeight-n.offsetHeight;n.style.top="".concat(r,"px")},c=Object.freeze(["0","1","2","3","4","5","6","7","8","9","@","Δ"," ","s","\n","¡","P","¿","p","£","_","!","A","Q","a","q","$","Φ",'"',"B","R","b","r","¥","Γ","#","C","S","c","s","è","Λ","¤","D","T","d","t","é","Ω","%","E","U","e","u","ù","Π","&","F","V","f","v","ì","Ψ","'","G","W","g","w","ò","Σ","(","H","X","h","x","Ç","Θ",")","I","Y","i","y","Ξ","*",":","J","Z","j","z","Ø","+",";","K","Ä","k","ä","ø","Æ",",","<","L","Ö","l","ö","æ","-","=","M","Ñ","m","ñ","Å","ß",".",">","N","Ü","n","ü","å","É","/","?","O","§","o","à"]),u=Object.freeze(["^","|","€","{","}","[","]","~","\\"]),l=Object.freeze(o(o([],r(c),!1),r(u),!1));t.CharLimit=void 0,(i=t.CharLimit||(t.CharLimit={}))[i.GSM7=160]="GSM7",i[i.GSM7_REDUCED=153]="GSM7_REDUCED",i[i.UCS2=70]="UCS2",i[i.UCS2_REDUCED=67]="UCS2_REDUCED";var s=function(t,n){var e=1;return"GSM7"===t&&u.includes(n)&&e++,e},f=function(t){return l.includes(t)},d="ESC";var h=function(t){var n,i,a=t.charLimit,c=t.encoding,h=t.isMulti,v=t.letters,C=t.msgCount,p=[],y=0,S=!1,m=function(t,n){var e,i=1,m=y+a,E=(e=t,["05","00","03","CC","0".concat(C.toString(16)),"0".concat(e.toString(16))]),g=E.length;v.slice(y,m).forEach((function(t){var e,r,o=g-1+i;S||(e=t,l.includes(e))||(S=!0),S||(r=t,u.includes(r)&&(console.log("extension character in a non-unicode message, ADDING ESCAPE CHARACTER",{charIndex:o,char:t,msg:n}),n.push(d))),n.push(t),i++})),y=m,h&&n.splice.apply(n,o([0,0],r(E),!1)),p.push(o([],r(n.filter((function(t){return t})).map((function(t){var n,e=t.length>1&&d!==t;return{character:t,encoding:e?"GSM7":(n=s(c,t),1===n?"GSM7":"UCS2"),escape:!e&&d===t,gsm7:!!e||f(t),length:1,udh:e,unicode:!e&&S}}))),!1))};try{for(var E=e(Array(C).entries()),g=E.next();!g.done;g=E.next()){var U=r(g.value,2),b=U[0],D=U[1];m(b,void 0===D?[]:D)}}catch(t){n={error:t}}finally{try{g&&!g.done&&(i=E.return)&&i.call(E)}finally{if(n)throw n.error}}return p};var v=function(n){var r=("string"==typeof n?n:n.value).split(""),o=function(t){var n,r;try{for(var o=e(t),i=o.next();!i.done;i=o.next()){var a=i.value;if(!l.includes(a))return"UCS2"}}catch(t){n={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return"GSM7"}(r),i=function(t,n){var r,o,i=0;try{for(var a=e(n),c=a.next();!c.done;c=a.next()){var u=c.value;i+=s(t,u)}}catch(t){r={error:t}}finally{try{c&&!c.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}return i}(o,r),a=function(n,e){var r={GSM7:t.CharLimit.GSM7,UCS2:t.CharLimit.UCS2};return r[n]<e&&(r.GSM7=t.CharLimit.GSM7_REDUCED,r.UCS2=t.CharLimit.UCS2_REDUCED),r}(o,i),c=function(t,n,e){var r=t/n[e];return 1>=r?r=1:(r=Number.parseFloat(String(r)),r=Math.floor(r),r++),r}(i,a,o),u=c>1,f=function(n,e){return"GSM7"===e?n?t.CharLimit.GSM7_REDUCED:t.CharLimit.GSM7:n?t.CharLimit.UCS2_REDUCED:t.CharLimit.UCS2}(u,o);return{charCount:i,charLimit:f,encoding:o,messages:h({encoding:o,isMulti:u,letters:r,msgCount:c,charLimit:f}),msgCount:c}},C=function(t,n){return t.textContent=(r=(e=n).charCount,o=e.encoding,i=e.msgCount,"".concat(r,"/").concat(i," [").concat(o,"]"));var e,r,o,i},p=function(t){Array.from(document.querySelectorAll(t.selector)).forEach((function(n){var e,r=!1;!1!==t.stats&&(!0===t.stats?((e=document.createElement("span")).style.position="absolute",n.insertAdjacentElement(t.position,e),r=!0,a(n,e)):(e="string"==typeof t.stats?document.querySelector(t.stats):t.stats,r=!1),e&&C(e,v(n))),n.addEventListener("input",(function(){return function(t,n,e){var r=v(t);n&&(C(n,r),e&&a(t,n)),document.dispatchEvent(new CustomEvent("seven_counter_input",{detail:r}))}(n,e,r)}))}))},y="window"in globalThis,S=n({initEvent:"DOMContentLoaded",position:"afterend",selector:"*[data-seven-sms]",standalone:!1,stats:!0},y&&window.SEVEN_COUNTER_OPTIONS||{});y&&!S.standalone&&function(t){document.addEventListener(t.initEvent,(function(){return p(t)}),{once:!0})}(S),t.getCounterStats=v})); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).SevenCounter={})}(this,(function(t){"use strict";var n=function(){return n=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var o in n=arguments[e])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t},n.apply(this,arguments)};function e(t){var n="function"==typeof Symbol&&Symbol.iterator,e=n&&t[n],r=0;if(e)return e.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(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function r(t,n){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,o,i=e.call(t),a=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return a}function o(t,n,e){if(e||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return t.concat(r||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var i,a=function(t,n){var e=t.offsetWidth-n.offsetWidth;n.style.left="".concat(e,"px");var r=t.offsetHeight-n.offsetHeight;n.style.top="".concat(r,"px")},c=Object.freeze(["0","1","2","3","4","5","6","7","8","9","@","Δ"," ","s","\n","¡","P","¿","p","£","_","!","A","Q","a","q","$","Φ",'"',"B","R","b","r","¥","Γ","#","C","S","c","s","è","Λ","¤","D","T","d","t","é","Ω","%","E","U","e","u","ù","Π","&","F","V","f","v","ì","Ψ","'","G","W","g","w","ò","Σ","(","H","X","h","x","Ç","Θ",")","I","Y","i","y","Ξ","*",":","J","Z","j","z","Ø","+",";","K","Ä","k","ä","ø","Æ",",","<","L","Ö","l","ö","æ","-","=","M","Ñ","m","ñ","Å","ß",".",">","N","Ü","n","ü","å","É","/","?","O","§","o","à"]),u=Object.freeze(["^","|","€","{","}","[","]","~","\\"]),l=Object.freeze(o(o([],r(c),!1),r(u),!1));t.CharLimit=void 0,(i=t.CharLimit||(t.CharLimit={}))[i.GSM7=160]="GSM7",i[i.GSM7_REDUCED=153]="GSM7_REDUCED",i[i.UCS2=70]="UCS2",i[i.UCS2_REDUCED=67]="UCS2_REDUCED";var s=function(t,n){var e=1;return"GSM7"===t&&u.includes(n)&&e++,e},f=function(t){return l.includes(t)},d="ESC";var h=function(t){var n,i,a=t.charLimit,c=t.encoding,h=t.isMulti,v=t.letters,C=t.msgCount,p=[],y=0,S=!1,m=function(t,n){var e=1,i=y+a,m=function(t,n){var e=t.toString(16);1===e.length&&(e="0".concat(e));var r=n.toString(16);1===r.length&&(r="0".concat(r));return["05","00","03","CC",e,r]}(C,t),g=m.length;v.slice(y,i).forEach((function(t){var r,o,i=g-1+e;S||(r=t,l.includes(r))||(S=!0),S||(o=t,u.includes(o)&&(console.log("extension character in a non-unicode message, ADDING ESCAPE CHARACTER",{charIndex:i,char:t,msg:n}),n.push(d))),n.push(t),e++})),y=i,h&&n.splice.apply(n,o([0,0],r(m),!1)),p.push(o([],r(n.filter((function(t){return t})).map((function(t){var n,e=t.length>1&&d!==t;return{character:t,encoding:e?"GSM7":(n=s(c,t),1===n?"GSM7":"UCS2"),escape:!e&&d===t,gsm7:!!e||f(t),length:1,udh:e,unicode:!e&&S}}))),!1))};try{for(var g=e(Array(C).entries()),E=g.next();!E.done;E=g.next()){var U=r(E.value,2),b=U[0],D=U[1];m(b,void 0===D?[]:D)}}catch(t){n={error:t}}finally{try{E&&!E.done&&(i=g.return)&&i.call(g)}finally{if(n)throw n.error}}return p};var v=function(n){var r=("string"==typeof n?n:n.value).split(""),o=function(t){var n,r;try{for(var o=e(t),i=o.next();!i.done;i=o.next()){var a=i.value;if(!l.includes(a))return"UCS2"}}catch(t){n={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return"GSM7"}(r),i=function(t,n){var r,o,i=0;try{for(var a=e(n),c=a.next();!c.done;c=a.next()){var u=c.value;i+=s(t,u)}}catch(t){r={error:t}}finally{try{c&&!c.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}return i}(o,r),a=function(n,e){var r={GSM7:t.CharLimit.GSM7,UCS2:t.CharLimit.UCS2};return r[n]<e&&(r.GSM7=t.CharLimit.GSM7_REDUCED,r.UCS2=t.CharLimit.UCS2_REDUCED),r}(o,i),c=function(t,n,e){var r=t/n[e];return 1>=r?r=1:(r=Number.parseFloat(String(r)),r=Math.floor(r),r++),r}(i,a,o),u=c>1,f=function(n,e){return"GSM7"===e?n?t.CharLimit.GSM7_REDUCED:t.CharLimit.GSM7:n?t.CharLimit.UCS2_REDUCED:t.CharLimit.UCS2}(u,o);return{charCount:i,charLimit:f,encoding:o,messages:h({encoding:o,isMulti:u,letters:r,msgCount:c,charLimit:f}),msgCount:c}},C=function(t,n){return t.textContent=(r=(e=n).charCount,o=e.encoding,i=e.msgCount,"".concat(r,"/").concat(i," [").concat(o,"]"));var e,r,o,i},p=function(t){Array.from(document.querySelectorAll(t.selector)).forEach((function(n){var e,r=!1;!1!==t.stats&&(!0===t.stats?((e=document.createElement("span")).style.position="absolute",n.insertAdjacentElement(t.position,e),r=!0,a(n,e)):(e="string"==typeof t.stats?document.querySelector(t.stats):t.stats,r=!1),e&&C(e,v(n))),n.addEventListener("input",(function(){return function(t,n,e){var r=v(t);n&&(C(n,r),e&&a(t,n)),document.dispatchEvent(new CustomEvent("seven_counter_input",{detail:r}))}(n,e,r)}))}))},y="window"in globalThis,S=n({initEvent:"DOMContentLoaded",position:"afterend",selector:"*[data-seven-sms]",standalone:!1,stats:!0},y&&window.SEVEN_COUNTER_OPTIONS||{});y&&!S.standalone&&function(t){document.addEventListener(t.initEvent,(function(){return p(t)}),{once:!0})}(S),t.getCounterStats=v})); |
@@ -47,3 +47,3 @@ { | ||
"types": "dist/index.d.ts", | ||
"version": "1.9.0" | ||
"version": "1.10.0" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11628