File: /www/wwwroot/www.waciwang.com/wp-content/plugins/gutenberg/build/scripts/wordcount/index.min.js.map
{
"version": 3,
"sources": ["../../../packages/wordcount/src/defaultSettings.ts", "../../../packages/wordcount/src/stripTags.ts", "../../../packages/wordcount/src/transposeAstralsToCountableChar.ts", "../../../packages/wordcount/src/stripHTMLEntities.ts", "../../../packages/wordcount/src/stripConnectors.ts", "../../../packages/wordcount/src/stripRemovables.ts", "../../../packages/wordcount/src/stripHTMLComments.ts", "../../../packages/wordcount/src/stripShortcodes.ts", "../../../packages/wordcount/src/stripSpaces.ts", "../../../packages/wordcount/src/transposeHTMLEntitiesToCountableChars.ts", "../../../packages/wordcount/src/index.ts"],
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { UserSettings } from './types';\n\n/**\n * Default settings for word counting operations.\n */\nexport const defaultSettings = {\n\tHTMLRegExp: /<\\/?[a-z][^>]*?>/gi,\n\tHTMLcommentRegExp: /<!--[\\s\\S]*?-->/g,\n\tspaceRegExp: / | /gi,\n\tHTMLEntityRegExp: /&\\S+?;/g,\n\n\t// \\u2014 = em-dash.\n\tconnectorRegExp: /--|\\u2014/g,\n\n\t// Characters to be removed from input text.\n\tremoveRegExp: new RegExp(\n\t\t[\n\t\t\t'[',\n\n\t\t\t// Basic Latin (extract)\n\t\t\t'\\u0021-\\u002F\\u003A-\\u0040\\u005B-\\u0060\\u007B-\\u007E',\n\n\t\t\t// Latin-1 Supplement (extract)\n\t\t\t'\\u0080-\\u00BF\\u00D7\\u00F7',\n\n\t\t\t/*\n\t\t\t * The following range consists of:\n\t\t\t * General Punctuation\n\t\t\t * Superscripts and Subscripts\n\t\t\t * Currency Symbols\n\t\t\t * Combining Diacritical Marks for Symbols\n\t\t\t * Letterlike Symbols\n\t\t\t * Number Forms\n\t\t\t * Arrows\n\t\t\t * Mathematical Operators\n\t\t\t * Miscellaneous Technical\n\t\t\t * Control Pictures\n\t\t\t * Optical Character Recognition\n\t\t\t * Enclosed Alphanumerics\n\t\t\t * Box Drawing\n\t\t\t * Block Elements\n\t\t\t * Geometric Shapes\n\t\t\t * Miscellaneous Symbols\n\t\t\t * Dingbats\n\t\t\t * Miscellaneous Mathematical Symbols-A\n\t\t\t * Supplemental Arrows-A\n\t\t\t * Braille Patterns\n\t\t\t * Supplemental Arrows-B\n\t\t\t * Miscellaneous Mathematical Symbols-B\n\t\t\t * Supplemental Mathematical Operators\n\t\t\t * Miscellaneous Symbols and Arrows\n\t\t\t */\n\t\t\t'\\u2000-\\u2BFF',\n\n\t\t\t// Supplemental Punctuation.\n\t\t\t'\\u2E00-\\u2E7F',\n\t\t\t']',\n\t\t].join( '' ),\n\t\t'g'\n\t),\n\n\t// Remove UTF-16 surrogate points, see https://en.wikipedia.org/wiki/UTF-16#U.2BD800_to_U.2BDFFF\n\tastralRegExp: /[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g,\n\twordsRegExp: /\\S\\s+/g,\n\tcharacters_excluding_spacesRegExp: /\\S/g,\n\n\t/*\n\t * Match anything that is not a formatting character, excluding:\n\t * \\f = form feed\n\t * \\n = new line\n\t * \\r = carriage return\n\t * \\t = tab\n\t * \\v = vertical tab\n\t * \\u00AD = soft hyphen\n\t * \\u2028 = line separator\n\t * \\u2029 = paragraph separator\n\t */\n\tcharacters_including_spacesRegExp: /[^\\f\\n\\r\\t\\v\\u00AD\\u2028\\u2029]/g,\n\tl10n: {\n\t\ttype: 'words',\n\t},\n} satisfies UserSettings;\n", "/**\n * Internal dependencies\n */\nimport type { Settings } from './types';\n\n/**\n * Replaces items matched in the regex with new line\n *\n * @param settings The main settings object containing regular expressions\n * @param text The string being counted.\n * @return The manipulated text.\n */\nexport default function stripTags( settings: Settings, text: string ): string {\n\treturn text.replace( settings.HTMLRegExp, '\\n' );\n}\n", "/**\n * Internal dependencies\n */\nimport type { Settings } from './types';\n\n/**\n * Replaces items matched in the regex with a single character.\n *\n * @param settings The main settings object containing regular expressions\n * @param text The string being counted.\n * @return The manipulated text.\n */\nexport default function transposeAstralsToCountableChar(\n\tsettings: Settings,\n\ttext: string\n): string {\n\treturn text.replace( settings.astralRegExp, 'a' );\n}\n", "/**\n * Internal dependencies\n */\nimport type { Settings } from './types';\n\n/**\n * Removes items matched in the regex.\n *\n * @param settings The main settings object containing regular expressions\n * @param text The string being counted.\n * @return The manipulated text.\n */\nexport default function stripHTMLEntities(\n\tsettings: Settings,\n\ttext: string\n): string {\n\treturn text.replace( settings.HTMLEntityRegExp, '' );\n}\n", "/**\n * Internal dependencies\n */\nimport type { Settings } from './types';\n\n/**\n * Replaces items matched in the regex with spaces.\n *\n * @param settings The main settings object containing regular expressions\n * @param text The string being counted.\n * @return The manipulated text.\n */\nexport default function stripConnectors(\n\tsettings: Settings,\n\ttext: string\n): string {\n\treturn text.replace( settings.connectorRegExp, ' ' );\n}\n", "/**\n * Internal dependencies\n */\nimport type { Settings } from './types';\n\n/**\n * Replaces items matched in the regex with spaces.\n *\n * @param settings The main settings object containing regular expressions\n * @param text The string being counted.\n * @return The manipulated text.\n */\nexport default function stripRemovables(\n\tsettings: Settings,\n\ttext: string\n): string {\n\treturn text.replace( settings.removeRegExp, '' );\n}\n", "/**\n * Internal dependencies\n */\nimport type { Settings } from './types';\n\n/**\n * Replaces items matched in the regex with new line.\n *\n * @param settings The main settings object containing regular expressions\n * @param text The string being counted.\n * @return The manipulated text.\n */\nexport default function stripHTMLComments(\n\tsettings: Settings,\n\ttext: string\n): string {\n\treturn text.replace( settings.HTMLcommentRegExp, '' );\n}\n", "/**\n * Internal dependencies\n */\nimport type { Settings } from './types';\n\n/**\n * Replaces items matched in the regex with a new line.\n *\n * @param settings The main settings object containing regular expressions\n * @param text The string being counted.\n * @return The manipulated text.\n */\nexport default function stripShortcodes(\n\tsettings: Settings,\n\ttext: string\n): string {\n\tif ( settings.shortcodesRegExp ) {\n\t\treturn text.replace( settings.shortcodesRegExp, '\\n' );\n\t}\n\treturn text;\n}\n", "/**\n * Internal dependencies\n */\nimport type { Settings } from './types';\n\n/**\n * Replaces items matched in the regex with spaces.\n *\n * @param settings The main settings object containing regular expressions\n * @param text The string being counted.\n * @return The manipulated text.\n */\nexport default function stripSpaces(\n\tsettings: Settings,\n\ttext: string\n): string {\n\treturn text.replace( settings.spaceRegExp, ' ' );\n}\n", "/**\n * Internal dependencies\n */\nimport type { Settings } from './types';\n\n/**\n * Replaces items matched in the regex with a single character.\n *\n * @param settings The main settings object containing regular expressions\n * @param text The string being counted.\n * @return The manipulated text.\n */\nexport default function transposeHTMLEntitiesToCountableChars(\n\tsettings: Settings,\n\ttext: string\n): string {\n\treturn text.replace( settings.HTMLEntityRegExp, 'a' );\n}\n", "/**\n * Internal dependencies\n */\nimport { defaultSettings } from './defaultSettings';\nimport stripTags from './stripTags';\nimport transposeAstralsToCountableChar from './transposeAstralsToCountableChar';\nimport stripHTMLEntities from './stripHTMLEntities';\nimport stripConnectors from './stripConnectors';\nimport stripRemovables from './stripRemovables';\nimport stripHTMLComments from './stripHTMLComments';\nimport stripShortcodes from './stripShortcodes';\nimport stripSpaces from './stripSpaces';\nimport transposeHTMLEntitiesToCountableChars from './transposeHTMLEntitiesToCountableChars';\n\nimport type { Settings, UserSettings, Strategy } from './types';\n\n/**\n * Private function to manage the settings.\n *\n * @param type The type of count to be done.\n * @param userSettings Custom settings for the count.\n * @return The combined settings object to be used.\n */\nfunction loadSettings(\n\ttype: Strategy = 'words',\n\tuserSettings: UserSettings = {}\n): Settings {\n\tconst mergedSettings = { ...defaultSettings, ...userSettings };\n\n\tconst settings: Settings = {\n\t\t...mergedSettings,\n\t\ttype,\n\t\tshortcodes: [],\n\t};\n\n\tsettings.shortcodes = settings.l10n?.shortcodes ?? [];\n\n\tif ( settings.shortcodes && settings.shortcodes.length ) {\n\t\tsettings.shortcodesRegExp = new RegExp(\n\t\t\t'\\\\[\\\\/?(?:' + settings.shortcodes.join( '|' ) + ')[^\\\\]]*?\\\\]',\n\t\t\t'g'\n\t\t);\n\t}\n\n\tif (\n\t\tsettings.type !== 'characters_excluding_spaces' &&\n\t\tsettings.type !== 'characters_including_spaces'\n\t) {\n\t\tsettings.type = 'words';\n\t}\n\n\treturn settings;\n}\n\n/**\n * Count the words in text\n *\n * @param text The text being processed\n * @param regex The regular expression pattern being matched\n * @param settings Settings object containing regular expressions for each strip function\n * @return Count of words.\n */\nfunction countWords( text: string, regex: RegExp, settings: Settings ): number {\n\ttext = [\n\t\tstripTags.bind( null, settings ),\n\t\tstripHTMLComments.bind( null, settings ),\n\t\tstripShortcodes.bind( null, settings ),\n\t\tstripSpaces.bind( null, settings ),\n\t\tstripHTMLEntities.bind( null, settings ),\n\t\tstripConnectors.bind( null, settings ),\n\t\tstripRemovables.bind( null, settings ),\n\t].reduce( ( result, fn ) => fn( result ), text );\n\ttext = text + '\\n';\n\treturn text.match( regex )?.length ?? 0;\n}\n\n/**\n * Count the characters in text\n *\n * @param text The text being processed\n * @param regex The regular expression pattern being matched\n * @param settings Settings object containing regular expressions for each strip function\n * @return Count of characters.\n */\nfunction countCharacters(\n\ttext: string,\n\tregex: RegExp,\n\tsettings: Settings\n): number {\n\ttext = [\n\t\tstripTags.bind( null, settings ),\n\t\tstripHTMLComments.bind( null, settings ),\n\t\tstripShortcodes.bind( null, settings ),\n\t\ttransposeAstralsToCountableChar.bind( null, settings ),\n\t\tstripSpaces.bind( null, settings ),\n\t\ttransposeHTMLEntitiesToCountableChars.bind( null, settings ),\n\t].reduce( ( result, fn ) => fn( result ), text );\n\ttext = text + '\\n';\n\treturn text.match( regex )?.length ?? 0;\n}\n\n/**\n * Count some words.\n *\n * @param text The text being processed\n * @param type The type of count. Accepts 'words', 'characters_excluding_spaces', or 'characters_including_spaces'.\n * @param userSettings Custom settings object.\n *\n * @example\n * ```ts\n * import { count } from '@wordpress/wordcount';\n * const numberOfWords = count( 'Words to count', 'words', {} )\n * ```\n *\n * @return The word or character count.\n */\nexport function count(\n\ttext: string,\n\ttype: Strategy,\n\tuserSettings?: UserSettings\n): number {\n\tconst settings = loadSettings( type, userSettings );\n\tlet matchRegExp: RegExp;\n\tswitch ( settings.type ) {\n\t\tcase 'words':\n\t\t\tmatchRegExp = settings.wordsRegExp;\n\t\t\treturn countWords( text, matchRegExp, settings );\n\t\tcase 'characters_including_spaces':\n\t\t\tmatchRegExp = settings.characters_including_spacesRegExp;\n\t\t\treturn countCharacters( text, matchRegExp, settings );\n\t\tcase 'characters_excluding_spaces':\n\t\t\tmatchRegExp = settings.characters_excluding_spacesRegExp;\n\t\t\treturn countCharacters( text, matchRegExp, settings );\n\t\tdefault:\n\t\t\treturn 0;\n\t}\n}\n\n// Export types for external usage\nexport type * from './types';\n"],
"mappings": "seAQO,IAAMA,EAAkB,CAC9B,WAAY,qBACZ,kBAAmB,mBACnB,YAAa,kBACb,iBAAkB,UAGlB,gBAAiB,aAGjB,aAAc,IAAI,OACjB,CACC,IAGA,eAGA,oBA6BA,gBAGA,gBACA,GACD,EAAE,KAAM,EAAG,EACX,GACD,EAGA,aAAc,kCACd,YAAa,SACb,kCAAmC,MAanC,kCAAmC,mCACnC,KAAM,CACL,KAAM,OACP,CACD,ECxEe,SAARC,EAA4BC,EAAoBC,EAAuB,CAC7E,OAAOA,EAAK,QAASD,EAAS,WAAY;CAAK,CAChD,CCFe,SAARE,EACNC,EACAC,EACS,CACT,OAAOA,EAAK,QAASD,EAAS,aAAc,GAAI,CACjD,CCLe,SAARE,EACNC,EACAC,EACS,CACT,OAAOA,EAAK,QAASD,EAAS,iBAAkB,EAAG,CACpD,CCLe,SAARE,EACNC,EACAC,EACS,CACT,OAAOA,EAAK,QAASD,EAAS,gBAAiB,GAAI,CACpD,CCLe,SAARE,EACNC,EACAC,EACS,CACT,OAAOA,EAAK,QAASD,EAAS,aAAc,EAAG,CAChD,CCLe,SAARE,EACNC,EACAC,EACS,CACT,OAAOA,EAAK,QAASD,EAAS,kBAAmB,EAAG,CACrD,CCLe,SAARE,EACNC,EACAC,EACS,CACT,OAAKD,EAAS,iBACNC,EAAK,QAASD,EAAS,iBAAkB;CAAK,EAE/CC,CAC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,CAAS,CAC5D,EAAE,OAAQ,CAAEY,EAAQC,IAAQA,EAAID,CAAO,EAAGT,CAAK,EAC/CA,EAAOA,EAAO;EACPA,EAAK,MAAOC,CAAM,GAAG,QAAU,CACvC,CAiBO,SAASa,EACfd,EACAL,EACAC,EACS,CACT,IAAMC,EAAWH,EAAcC,EAAMC,CAAa,EAC9CmB,EACJ,OAASlB,EAAS,KAAO,CACxB,IAAK,QACJ,OAAAkB,EAAclB,EAAS,YAChBE,EAAYC,EAAMe,EAAalB,CAAS,EAChD,IAAK,8BACJ,OAAAkB,EAAclB,EAAS,kCAChBc,EAAiBX,EAAMe,EAAalB,CAAS,EACrD,IAAK,8BACJ,OAAAkB,EAAclB,EAAS,kCAChBc,EAAiBX,EAAMe,EAAalB,CAAS,EACrD,QACC,MAAO,EACT,CACD",
"names": ["defaultSettings", "stripTags", "settings", "text", "transposeAstralsToCountableChar", "settings", "text", "stripHTMLEntities", "settings", "text", "stripConnectors", "settings", "text", "stripRemovables", "settings", "text", "stripHTMLComments", "settings", "text", "stripShortcodes", "settings", "text", "stripSpaces", "settings", "text", "transposeHTMLEntitiesToCountableChars", "settings", "text", "loadSettings", "type", "userSettings", "settings", "defaultSettings", "countWords", "text", "regex", "stripTags", "stripHTMLComments", "stripShortcodes", "stripSpaces", "stripHTMLEntities", "stripConnectors", "stripRemovables", "result", "fn", "countCharacters", "transposeAstralsToCountableChar", "transposeHTMLEntitiesToCountableChars", "count", "matchRegExp"]
}