{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var ImpactStyle;\n(function (ImpactStyle) {\n /**\n * A collision between large, heavy user interface elements\n *\n * @since 1.0.0\n */\n ImpactStyle[\"Heavy\"] = \"HEAVY\";\n /**\n * A collision between moderately sized user interface elements\n *\n * @since 1.0.0\n */\n ImpactStyle[\"Medium\"] = \"MEDIUM\";\n /**\n * A collision between small, light user interface elements\n *\n * @since 1.0.0\n */\n ImpactStyle[\"Light\"] = \"LIGHT\";\n})(ImpactStyle || (ImpactStyle = {}));\nexport var NotificationType;\n(function (NotificationType) {\n /**\n * A notification feedback type indicating that a task has completed successfully\n *\n * @since 1.0.0\n */\n NotificationType[\"Success\"] = \"SUCCESS\";\n /**\n * A notification feedback type indicating that a task has produced a warning\n *\n * @since 1.0.0\n */\n NotificationType[\"Warning\"] = \"WARNING\";\n /**\n * A notification feedback type indicating that a task has failed\n *\n * @since 1.0.0\n */\n NotificationType[\"Error\"] = \"ERROR\";\n})(NotificationType || (NotificationType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst Haptics = registerPlugin('Haptics', {\n web: () => import('./web').then((m) => new m.HapticsWeb()),\n});\nexport * from './definitions';\nexport { Haptics };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { ImpactStyle, NotificationType } from './definitions';\nexport class HapticsWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.selectionStarted = false;\n }\n async impact(options) {\n const pattern = this.patternForImpact(options === null || options === void 0 ? void 0 : options.style);\n this.vibrateWithPattern(pattern);\n }\n async notification(options) {\n const pattern = this.patternForNotification(options === null || options === void 0 ? void 0 : options.type);\n this.vibrateWithPattern(pattern);\n }\n async vibrate(options) {\n const duration = (options === null || options === void 0 ? void 0 : options.duration) || 300;\n this.vibrateWithPattern([duration]);\n }\n async selectionStart() {\n this.selectionStarted = true;\n }\n async selectionChanged() {\n if (this.selectionStarted) {\n this.vibrateWithPattern([70]);\n }\n }\n async selectionEnd() {\n this.selectionStarted = false;\n }\n patternForImpact(style = ImpactStyle.Heavy) {\n if (style === ImpactStyle.Medium) {\n return [43];\n }\n else if (style === ImpactStyle.Light) {\n return [20];\n }\n return [61];\n }\n patternForNotification(type = NotificationType.Success) {\n if (type === NotificationType.Warning) {\n return [30, 40, 30, 50, 60];\n }\n else if (type === NotificationType.Error) {\n return [27, 45, 50];\n }\n return [35, 65, 21];\n }\n vibrateWithPattern(pattern) {\n if (navigator.vibrate) {\n navigator.vibrate(pattern);\n }\n else {\n throw this.unavailable('Browser does not support the vibrate API');\n }\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["ImpactStyle","NotificationType","registerPlugin","WebPlugin"],"mappings":";;;;AAAWA;AACX,CAAC,UAAU,WAAW,EAAE;AACxB;AACA;AACA;AACA;AACA;AACA,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO;AAClC;AACA;AACA;AACA;AACA;AACA,IAAI,WAAW,CAAC,QAAQ,CAAC,GAAG,QAAQ;AACpC;AACA;AACA;AACA;AACA;AACA,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO;AAClC,CAAC,EAAEA,mBAAW,KAAKA,mBAAW,GAAG,EAAE,CAAC,CAAC;AAC1BC;AACX,CAAC,UAAU,gBAAgB,EAAE;AAC7B;AACA;AACA;AACA;AACA;AACA,IAAI,gBAAgB,CAAC,SAAS,CAAC,GAAG,SAAS;AAC3C;AACA;AACA;AACA;AACA;AACA,IAAI,gBAAgB,CAAC,SAAS,CAAC,GAAG,SAAS;AAC3C;AACA;AACA;AACA;AACA;AACA,IAAI,gBAAgB,CAAC,OAAO,CAAC,GAAG,OAAO;AACvC,CAAC,EAAEA,wBAAgB,KAAKA,wBAAgB,GAAG,EAAE,CAAC,CAAC;;ACxC1C,MAAC,OAAO,GAAGC,mBAAc,CAAC,SAAS,EAAE;AAC1C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IA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