{"version":3,"file":"string_helpers-DoDjStZL.js","sources":["../../../app/javascript/helpers/string_helpers.js"],"sourcesContent":["const stringHelpers = {\n\n toCamelCase(str, { upper } = { upper: false }) {\n const result = str.replace(/[-_\\s](.)/g, (_, char) => char.toUpperCase())\n return upper ? result.charAt(0).toUpperCase() + result.slice(1) : result\n },\n\n /**\n * Check if a HTML string is empty or contains only white spaces\n * @param str\n * @returns {boolean}\n */\n isEmptyHtml(str) {\n return (str || \"\").replace(/<\\/?[^>]+(>|$)/g, \"\").trim() === \"\"\n },\n\n capitalize(str) {\n return str.charAt(0).toUpperCase() + str.slice(1)\n },\n\n /**\n * Sanitize a string by removing invalid UTF-8 characters\n * @param {string} str - The string to sanitize\n * @returns {string} - The sanitized string\n */\n sanitizeString(str) {\n if (!str || typeof str !== \"string\") return str\n\n // Remove only invalid UTF-8 characters\n return [...str].filter(char => {\n const code = char.charCodeAt(0)\n // Keep all printable characters\n // Remove:\n // - Control characters (0-31)\n // - Replacement character (0xFFFD) which often appears with invalid encoding\n // - Incomplete UTF-16 surrogate pairs (0xD800-0xDFFF)\n // - Invalid BOM markers (0xFFFE, 0xFFFF)\n // - Zero-width spaces and other invisible formatting characters (0x200B-0x200F, 0x2028-0x202F)\n return !(code <= 31 ||\n code === 0xFFFD ||\n (code >= 0xD800 && code <= 0xDFFF) ||\n code === 0xFFFE ||\n code === 0xFFFF ||\n (code >= 0x200B && code <= 0x200F) || // Zero-width spaces, RTL/LTR marks\n (code >= 0x2028 && code <= 0x202F)) // Line/paragraph separators, narrow no-break spaces\n }).join(\"\")\n },\n}\n\nexport default stringHelpers\n"],"names":["n","stringHelpers","str","upper","result","_","char","code"],"mappings":"AAAK,GAAA,CAAA,IAAA,EAAA,OAAA,QAAA,YAAA,OAAA,OAAA,QAAA,YAAA,OAAA,OAAA,YAAA,YAAA,WAAA,OAAA,MAAA,YAAA,KAAA,CAAA,EAAAA,EAAA,IAAA,EAAA,QAAA,MAAAA,IAAA,EAAA,gBAAA,EAAA,iBAAA,CAAA,EAAA,EAAA,gBAAAA,CAAA,EAAA,uCAAA,EAAA,yBAAA,mDAAA,OAAA,EAAA,CAAA,CAAA,MAACC,EAAgB,CAEpB,YAAYC,EAAK,CAAE,MAAAC,CAAO,EAAG,CAAE,MAAO,IAAS,CAC7C,MAAMC,EAASF,EAAI,QAAQ,aAAc,CAACG,EAAGC,IAASA,EAAK,YAAa,CAAA,EACxE,OAAOH,EAAQC,EAAO,OAAO,CAAC,EAAE,YAAW,EAAKA,EAAO,MAAM,CAAC,EAAIA,CACnE,EAOD,YAAYF,EAAK,CACf,OAAQA,GAAO,IAAI,QAAQ,kBAAmB,EAAE,EAAE,SAAY,EAC/D,EAED,WAAWA,EAAK,CACd,OAAOA,EAAI,OAAO,CAAC,EAAE,cAAgBA,EAAI,MAAM,CAAC,CACjD,EAOD,eAAeA,EAAK,CAClB,MAAI,CAACA,GAAO,OAAOA,GAAQ,SAAiBA,EAGrC,CAAC,GAAGA,CAAG,EAAE,OAAOI,GAAQ,CAC7B,MAAMC,EAAOD,EAAK,WAAW,CAAC,EAQ9B,MAAO,EAAEC,GAAQ,IACRA,IAAS,OACRA,GAAQ,OAAUA,GAAQ,OAC3BA,IAAS,OACTA,IAAS,OACRA,GAAQ,MAAUA,GAAQ,MAC1BA,GAAQ,MAAUA,GAAQ,KAC1C,CAAK,EAAE,KAAK,EAAE,CACX,CACH"}