File: /var/www/vhost/disk-apps/pwa.sports-crowd.com/node_modules/@capacitor/haptics/dist/esm/web.js.map
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAQ9D,MAAM,OAAO,UAAW,SAAQ,SAAS;IAAzC;;QACE,qBAAgB,GAAG,KAAK,CAAC;IA0D3B,CAAC;IAxDC,KAAK,CAAC,MAAM,CAAC,OAAuB;QAClC,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,CAAC,CAAC;QACtD,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,OAA6B;QAC9C,MAAM,OAAO,GAAG,IAAI,CAAC,sBAAsB,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,CAAC,CAAC;QAC3D,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,OAAwB;QACpC,MAAM,QAAQ,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,KAAI,GAAG,CAAC;QAC1C,IAAI,CAAC,kBAAkB,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,cAAc;QAClB,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACzB,IAAI,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SAC/B;IACH,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;IAChC,CAAC;IAEO,gBAAgB,CAAC,QAAqB,WAAW,CAAC,KAAK;QAC7D,IAAI,KAAK,KAAK,WAAW,CAAC,MAAM,EAAE;YAChC,OAAO,CAAC,EAAE,CAAC,CAAC;SACb;aAAM,IAAI,KAAK,KAAK,WAAW,CAAC,KAAK,EAAE;YACtC,OAAO,CAAC,EAAE,CAAC,CAAC;SACb;QACD,OAAO,CAAC,EAAE,CAAC,CAAC;IACd,CAAC;IAEO,sBAAsB,CAC5B,OAAyB,gBAAgB,CAAC,OAAO;QAEjD,IAAI,IAAI,KAAK,gBAAgB,CAAC,OAAO,EAAE;YACrC,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;SAC7B;aAAM,IAAI,IAAI,KAAK,gBAAgB,CAAC,KAAK,EAAE;YAC1C,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;SACrB;QACD,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IACtB,CAAC;IAEO,kBAAkB,CAAC,OAAiB;QAC1C,IAAI,SAAS,CAAC,OAAO,EAAE;YACrB,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;SAC5B;aAAM;YACL,MAAM,IAAI,CAAC,WAAW,CAAC,0CAA0C,CAAC,CAAC;SACpE;IACH,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport { ImpactStyle, NotificationType } from './definitions';\nimport type {\n HapticsPlugin,\n ImpactOptions,\n NotificationOptions,\n VibrateOptions,\n} from './definitions';\n\nexport class HapticsWeb extends WebPlugin implements HapticsPlugin {\n selectionStarted = false;\n\n async impact(options?: ImpactOptions): Promise<void> {\n const pattern = this.patternForImpact(options?.style);\n this.vibrateWithPattern(pattern);\n }\n\n async notification(options?: NotificationOptions): Promise<void> {\n const pattern = this.patternForNotification(options?.type);\n this.vibrateWithPattern(pattern);\n }\n\n async vibrate(options?: VibrateOptions): Promise<void> {\n const duration = options?.duration || 300;\n this.vibrateWithPattern([duration]);\n }\n\n async selectionStart(): Promise<void> {\n this.selectionStarted = true;\n }\n\n async selectionChanged(): Promise<void> {\n if (this.selectionStarted) {\n this.vibrateWithPattern([70]);\n }\n }\n\n async selectionEnd(): Promise<void> {\n this.selectionStarted = false;\n }\n\n private patternForImpact(style: ImpactStyle = ImpactStyle.Heavy): number[] {\n if (style === ImpactStyle.Medium) {\n return [43];\n } else if (style === ImpactStyle.Light) {\n return [20];\n }\n return [61];\n }\n\n private patternForNotification(\n type: NotificationType = NotificationType.Success,\n ): number[] {\n if (type === NotificationType.Warning) {\n return [30, 40, 30, 50, 60];\n } else if (type === NotificationType.Error) {\n return [27, 45, 50];\n }\n return [35, 65, 21];\n }\n\n private vibrateWithPattern(pattern: number[]) {\n if (navigator.vibrate) {\n navigator.vibrate(pattern);\n } else {\n throw this.unavailable('Browser does not support the vibrate API');\n }\n }\n}\n"]}