{"version":3,"file":"toolbar.mjs","sources":["../../../../packages/components-wc/src/editor/toolbar.ts"],"sourcesContent":["export const EDITOR_TOOLBAR_ITEMS = [\n  'format',\n  'heading',\n  'align',\n  'code',\n  'link',\n  'image',\n  'list',\n  'blockquote',\n  'table',\n] as const\n\nexport type EditorToolbarItem = (typeof EDITOR_TOOLBAR_ITEMS)[number]\n\nexport const DEFAULT_EDITOR_TOOLBAR: EditorToolbarItem[] = [...EDITOR_TOOLBAR_ITEMS]\n\nexport const SUB_TEXT_EDITOR_TOOLBAR: EditorToolbarItem[] = DEFAULT_EDITOR_TOOLBAR.filter(\n  item => item !== 'table',\n)\n\nconst EDITOR_TOOLBAR_ITEM_SET = new Set<string>(EDITOR_TOOLBAR_ITEMS)\n\nexport function parseEditorToolbarItems(\n  value: string | readonly string[] | null | undefined,\n): EditorToolbarItem[] {\n  if (Array.isArray(value)) {\n    return value.filter((item): item is EditorToolbarItem => EDITOR_TOOLBAR_ITEM_SET.has(item))\n  }\n\n  if (typeof value !== 'string') {\n    return [...DEFAULT_EDITOR_TOOLBAR]\n  }\n\n  const tokens = value\n    .split(/[\\s,|]+/)\n    .map(token => token.trim())\n    .filter(Boolean)\n\n  return tokens.filter((item): item is EditorToolbarItem => EDITOR_TOOLBAR_ITEM_SET.has(item))\n}\n"],"names":["EDITOR_TOOLBAR_ITEMS","DEFAULT_EDITOR_TOOLBAR","SUB_TEXT_EDITOR_TOOLBAR","filter","item","EDITOR_TOOLBAR_ITEM_SET","Set","parseEditorToolbarItems","value","Array","isArray","has","split","map","token","trim","Boolean"],"mappings":"AAAO,MAAMA,EAAuB,CAClC,SACA,UACA,QACA,OACA,OACA,QACA,OACA,aACA,SAKWC,EAA8C,IAAID,GAElDE,EAA+CD,EAAuBE,UAChE,UAATC,GAGJC,EAA0B,IAAIC,IAAYN,GAEzC,SAASO,EACdC,GAEA,GAAIC,MAAMC,QAAQF,GAChB,OAAOA,EAAML,OAAQC,GAAoCC,EAAwBM,IAAIP,IAGvF,GAAqB,iBAAVI,EACT,MAAO,IAAIP,GAQb,OALeO,EACZI,MAAM,WACNC,IAAIC,GAASA,EAAMC,QACnBZ,OAAOa,SAEIb,OAAQC,GAAoCC,EAAwBM,IAAIP,GACxF"}