{"version":3,"sources":["../src/index-minimal.ts","../src/addVersion.js","../src/createBrowserWebSpeechPonyfillFactory.ts","../src/createDirectLine.ts","../src/createDirectLineAppServiceExtension.ts","../src/renderWebChat.tsx"],"sourcesContent":["/* eslint dot-notation: [\"error\", { \"allowPattern\": \"^WebChat$\" }] */\n// window['WebChat'] is required for TypeScript\n\nimport { StrictStyleOptions, StyleOptions } from 'botframework-webchat-api';\nimport * as decorator from 'botframework-webchat-api/decorator';\nimport { Constants, createStore, createStoreWithDevTools, createStoreWithOptions } from 'botframework-webchat-core';\n\nimport ReactWebChat, {\n  Components,\n  concatMiddleware,\n  createStyleSet,\n  hooks,\n  withEmoji\n} from 'botframework-webchat-component';\n\nimport addVersion from './addVersion';\nimport createBrowserWebSpeechPonyfillFactory from './createBrowserWebSpeechPonyfillFactory';\nimport defaultCreateDirectLine from './createDirectLine';\nimport defaultCreateDirectLineAppServiceExtension from './createDirectLineAppServiceExtension';\nimport coreRenderWebChat from './renderWebChat';\n\nconst renderWebChat = coreRenderWebChat.bind(null, ReactWebChat);\n\nconst buildTool = process.env.build_tool;\nconst moduleFormat = process.env.module_format;\nconst version = process.env.npm_package_version;\n\nconst buildInfo = { buildTool, moduleFormat, variant: 'minimal', version };\n\nexport const createDirectLine = options => {\n  options.botAgent &&\n    console.warn(\n      'Web Chat: Developers are not currently allowed to set botAgent in the createDirectLine function. See https://github.com/microsoft/BotFramework-WebChat/issues/2119 for more details.'\n    );\n\n  return defaultCreateDirectLine({ ...options, botAgent: `WebChat/${version} (Minimal)` });\n};\n\nexport const createDirectLineAppServiceExtension = options => {\n  options.botAgent &&\n    console.warn(\n      'Web Chat: Developers are not currently allowed to set botAgent in the createDirectLine function. See https://github.com/microsoft/BotFramework-WebChat/issues/2119 for more details.'\n    );\n\n  return defaultCreateDirectLineAppServiceExtension({ ...options, botAgent: `WebChat/${version} (Minimal)` });\n};\n\nexport default ReactWebChat;\n\nexport {\n  Components,\n  Constants,\n  buildInfo,\n  concatMiddleware,\n  createBrowserWebSpeechPonyfillFactory,\n  createStore,\n  createStoreWithDevTools,\n  createStoreWithOptions,\n  createStyleSet,\n  hooks,\n  renderWebChat,\n  version,\n  withEmoji\n};\n\nexport type { StrictStyleOptions, StyleOptions };\n\n// Until we have a development-specific bundle, we are not shipping createStoreWithDevTools in bundle.\nwindow['WebChat'] = {\n  ...window['WebChat'],\n  concatMiddleware,\n  Constants,\n  createBrowserWebSpeechPonyfillFactory,\n  createDirectLine,\n  createDirectLineAppServiceExtension,\n  createStore,\n  createStoreWithOptions,\n  createStyleSet,\n  decorator,\n  hooks,\n  ReactWebChat,\n  renderWebChat,\n  withEmoji\n};\n\naddVersion('minimal');\n","/* global globalThis:readonly, process:readonly */\n/* eslint no-empty: [\"error\", { \"allowEmptyCatch\": true }] */\n\nimport { buildInfo as apiBuildInfo } from 'botframework-webchat-api';\nimport { buildInfo as componentBuildInfo } from 'botframework-webchat-component';\nimport { buildInfo as coreBuildInfo } from 'botframework-webchat-core';\n\nconst bundleVersion = process.env.npm_package_version;\n\nfunction setMetaTag(name, content) {\n  try {\n    const { document } = globalThis;\n\n    if (typeof document !== 'undefined' && document.createElement && document.head && document.head.appendChild) {\n      const meta = document.querySelector(`html meta[name=\"${encodeURI(name)}\"]`) || document.createElement('meta');\n\n      meta.setAttribute('name', name);\n      meta.setAttribute('content', content);\n\n      document.head.appendChild(meta);\n    }\n  } catch (err) {}\n}\n\nexport default function addVersion(variant) {\n  setMetaTag(\n    'botframework-webchat:api',\n    `version=${apiBuildInfo.version}; build-tool=${apiBuildInfo.buildTool}; module-format=${apiBuildInfo.moduleFormat}`\n  );\n  setMetaTag(\n    'botframework-webchat:bundle',\n    `version=${bundleVersion}; variant=${variant}; build-tool=${process.env.build_tool}; module-format=${process.env.module_format}`\n  );\n  setMetaTag(\n    'botframework-webchat:component',\n    `version=${componentBuildInfo.version}; build-tool=${componentBuildInfo.buildTool}; module-format=${componentBuildInfo.moduleFormat}`\n  );\n  setMetaTag(\n    'botframework-webchat:core',\n    `version=${coreBuildInfo.version}; build-tool=${coreBuildInfo.buildTool}; module-format=${coreBuildInfo.moduleFormat}`\n  );\n\n  setMetaTag('botframework-webchat:bundle:variant', variant);\n  setMetaTag('botframework-webchat:bundle:version', process.env.npm_package_version);\n  setMetaTag('botframework-webchat:core:version', coreBuildInfo.version);\n  setMetaTag('botframework-webchat:ui:version', componentBuildInfo.version);\n}\n","import { WebSpeechPonyfill } from 'botframework-webchat-api';\n\nexport default function createBrowserWebSpeechPonyfillFactory(): () => WebSpeechPonyfill {\n  if (!window.SpeechRecognition && !window.webkitSpeechRecognition) {\n    console.warn('Web Chat: This browser does not support Web Speech API Speech Recognition.');\n  }\n\n  if (!window.speechSynthesis) {\n    console.warn('Web Chat: This browser does not support Web Speech API Speech Synthesis.');\n  }\n\n  return () => ({\n    SpeechGrammarList: window.SpeechGrammarList || window.webkitSpeechGrammarList,\n    SpeechRecognition: window.SpeechRecognition || window.webkitSpeechRecognition,\n    speechSynthesis: window.speechSynthesis,\n    SpeechSynthesisUtterance: window.SpeechSynthesisUtterance\n  });\n}\n","import { DirectLine } from 'botframework-directlinejs';\n\ntype CreateDirectLineOptions = {\n  botAgent?: string;\n  conversationId?: string;\n  conversationStartProperties?: any;\n  domain?: string;\n  fetch?: typeof window.fetch;\n  pollingInterval?: number;\n  secret?: string;\n  streamUrl?: string;\n  token?: string;\n  watermark?: string;\n  webSocket?: typeof WebSocket;\n};\n\nexport default function createDirectLine({\n  botAgent,\n  conversationId,\n  conversationStartProperties,\n  domain,\n  fetch,\n  pollingInterval,\n  secret,\n  streamUrl,\n  token,\n  watermark,\n  webSocket\n}: CreateDirectLineOptions) {\n  // TODO: [P3] Checks if DLJS supports ponyfilling fetch.\n  return new DirectLine({\n    botAgent,\n    conversationId,\n    conversationStartProperties,\n    domain,\n    fetch,\n    pollingInterval,\n    secret,\n    streamUrl,\n    token,\n    watermark,\n    webSocket,\n    createFormData: attachments => {\n      const formData = new FormData();\n\n      attachments.forEach(\n        ({\n          contentType,\n          data,\n          filename,\n          name\n        }: {\n          contentType?: string;\n          data: BlobPart[];\n          filename?: string;\n          name?: string;\n        }) => {\n          formData.append(name, new Blob(data, { type: contentType }), filename);\n        }\n      );\n\n      return formData;\n    }\n  } as any);\n}\n","import { DirectLineStreaming } from 'botframework-directlinejs';\n\nexport default function createDirectLineAppServiceExtension({\n  botAgent,\n  conversationId,\n  domain,\n  token\n}: {\n  botAgent?: string;\n  conversationId?: string;\n  domain?: string;\n  token: string;\n}): Promise<any> {\n  return Promise.resolve(\n    new DirectLineStreaming({\n      botAgent,\n      conversationId,\n      domain,\n      token\n    })\n  );\n}\n","import React, { ComponentType } from 'react';\nimport ReactDOM from 'react-dom';\n\nexport default function renderWebChat(ReactWebChat: ComponentType<any>, props: any, element: HTMLElement): void {\n  ReactDOM.render(<ReactWebChat {...props} />, element);\n}\n"],"mappings":"8oBAIA,UAAYA,MAAe,qCAC3B,OAAS,aAAAC,EAAW,eAAAC,EAAa,2BAAAC,GAAyB,0BAAAC,MAA8B,4BAExF,OAAOC,GACL,cAAAC,GACA,oBAAAC,EACA,kBAAAC,EACA,SAAAC,EACA,aAAAC,MACK,iCCVP,OAAS,aAAaC,MAAoB,2BAC1C,OAAS,aAAaC,MAA0B,iCAChD,OAAS,aAAaC,MAAqB,4BAE3C,IAAMC,EAAgB,SAEtB,SAASC,EAAWC,EAAMC,EAAS,CACjC,GAAI,CACF,GAAM,CAAE,SAAAC,CAAS,EAAI,WAErB,GAAI,OAAOA,EAAa,KAAeA,EAAS,eAAiBA,EAAS,MAAQA,EAAS,KAAK,YAAa,CAC3G,IAAMC,EAAOD,EAAS,cAAc,mBAAmB,UAAUF,CAAI,CAAC,IAAI,GAAKE,EAAS,cAAc,MAAM,EAE5GC,EAAK,aAAa,OAAQH,CAAI,EAC9BG,EAAK,aAAa,UAAWF,CAAO,EAEpCC,EAAS,KAAK,YAAYC,CAAI,CAChC,CACF,MAAc,CAAC,CACjB,CAEe,SAARC,EAA4BC,EAAS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EAAS,OAAOI,EAAM,IAAI,KAAKF,EAAM,CAAE,KAAMD,CAAY,CAAC,EAAGE,CAAQ,CACvE,CACF,EAEOH,CACT,CACF,CAAQ,CACV,CChEA,OAAS,uBAAAK,MAA2B,4BAErB,SAARC,EAAqD,CAC1D,SAAAC,EACA,eAAAC,EACA,OAAAC,EACA,MAAAC,CACF,EAKiB,CACf,OAAO,QAAQ,QACb,IAAIL,EAAoB,CACtB,SAAAE,EACA,eAAAC,EACA,OAAAC,EACA,MAAAC,CACF,CAAC,CACH,CACF,CCrBA,OAAOC,MAA8B,QACrC,OAAOC,MAAc,YAEN,SAARC,EAA+BC,EAAkCC,EAAYC,EAA4B,CAC9GJ,EAAS,OAAOD,EAAA,cAACG,EAAA,CAAc,GAAGC,EAAO,EAAIC,CAAO,CACtD,CLgBA,IAAMC,EAAgBA,EAAkB,KAAK,KAAMC,CAAY,EAEzDC,EAAY,OACZC,EAAe,YACfC,EAAU,SAEVC,GAAY,CAAE,UAAAH,EAAW,aAAAC,EAAc,QAAS,UAAW,QAAAC,CAAQ,EAE5DE,EAAmBC,IAC9BA,EAAQ,UACN,QAAQ,KACN,sLACF,EAEKD,EAAwB,CAAE,GAAGC,EAAS,SAAU,WAAWH,CAAO,YAAa,CAAC,GAG5EI,EAAsCD,IACjDA,EAAQ,UACN,QAAQ,KACN,sLACF,EAEKC,EAA2C,CAAE,GAAGD,EAAS,SAAU,WAAWH,CAAO,YAAa,CAAC,GAGrGK,GAAQR,EAqBf,OAAO,QAAa,CAClB,GAAG,OAAO,QACV,iBAAAS,EACA,UAAAC,EACA,sCAAAC,EACA,iBAAAC,EACA,oCAAAC,EACA,YAAAC,EACA,uBAAAC,EACA,eAAAC,EACA,UAAAC,EACA,MAAAC,EACA,aAAAC,EACA,cAAAC,EACA,UAAAC,CACF,EAEAC,EAAW,SAAS","names":["decorator","Constants","createStore","createStoreWithDevTools","createStoreWithOptions","ReactWebChat","Components","concatMiddleware","createStyleSet","hooks","withEmoji","apiBuildInfo","componentBuildInfo","coreBuildInfo","bundleVersion","setMetaTag","name","content","document","meta","addVersion","variant","createBrowserWebSpeechPonyfillFactory","DirectLine","createDirectLine","botAgent","conversationId","conversationStartProperties","domain","fetch","pollingInterval","secret","streamUrl","token","watermark","webSocket","attachments","formData","contentType","data","filename","name","DirectLineStreaming","createDirectLineAppServiceExtension","botAgent","conversationId","domain","token","React","ReactDOM","renderWebChat","ReactWebChat","props","element","renderWebChat","ReactWebChat","buildTool","moduleFormat","version","buildInfo","createDirectLine","options","createDirectLineAppServiceExtension","index_minimal_default","concatMiddleware","Constants","createBrowserWebSpeechPonyfillFactory","createDirectLine","createDirectLineAppServiceExtension","createStore","createStoreWithOptions","createStyleSet","decorator","hooks","ReactWebChat","renderWebChat","withEmoji","addVersion"]}