/**
 * Minified by jsDelivr using Terser v5.37.0.
 * Original file: /npm/pinpon-capacitor-video-recorder@5.0.19/dist/plugin.cjs.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@capacitor/core");const VideoRecorderErrors={CAMERA_RESTRICTED:"Camera access restricted",CAMERA_DENIED:"Camera access denied",MICROPHONE_RESTRICTED:"Microphone access restricted",MICROPHONE_DENIED:"Microphone access denied"};exports.VideoRecorderCamera=void 0,function(e){e[e.FRONT=0]="FRONT",e[e.BACK=1]="BACK"}(exports.VideoRecorderCamera||(exports.VideoRecorderCamera={})),exports.VideoRecorderQuality=void 0,function(e){e[e.MAX_480P=0]="MAX_480P",e[e.MAX_720P=1]="MAX_720P",e[e.MAX_1080P=2]="MAX_1080P",e[e.MAX_2160P=3]="MAX_2160P",e[e.HIGHEST=4]="HIGHEST",e[e.LOWEST=5]="LOWEST",e[e.QVGA=6]="QVGA"}(exports.VideoRecorderQuality||(exports.VideoRecorderQuality={}));const VideoRecorder=core.registerPlugin("VideoRecorder",{web:()=>Promise.resolve().then((function(){return web})).then((e=>new e.VideoRecorderWeb))});class DropShadow{constructor(e={}){this.opacity=e.opacity||0,this.radius=e.radius||0,this.color=function(e){e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(e,i,r,o){return i+i+r+r+o+o}));let i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return i?`${parseInt(i[1],16)}, ${parseInt(i[2],16)}, ${parseInt(i[3],16)}`:null}(e.color||"#000000")||"#000000"}}class FrameConfig{constructor(e={}){this.id=e.id,this.stackPosition=e.stackPosition||"back",this.x=e.x||0,this.y=e.y||0,this.width=e.width||"fill",this.height=e.height||"fill",this.borderRadius=e.borderRadius||0,this.dropShadow=new DropShadow(e.dropShadow)}}class VideoRecorderWeb extends core.WebPlugin{constructor(){super({name:"VideoRecorder",platforms:["web"]}),this.previewFrameConfigs=[],this.currentFrameConfig=new FrameConfig({id:"default"})}_initializeCameraView(){this.videoElement=document.createElement("video"),this.videoElement.autoplay=!0,this.videoElement.hidden=!0,this.videoElement.style.cssText="\n\t\t\tobject-fit: cover;\n\t\t\tpointer-events: none;\n\t\t\tposition: absolute;\n\t\t",document.body.appendChild(this.videoElement),this._updateCameraView(this.currentFrameConfig)}_updateCameraView(e){this.videoElement.style.width="fill"===e.width?"100vw":`${e.width}px`,this.videoElement.style.height="fill"===e.height?"100vh":`${e.height}px`,this.videoElement.style.left=`${e.x}px`,this.videoElement.style.top=`${e.y}px`,this.videoElement.style.zIndex="back"===e.stackPosition?"-1":"99999",this.videoElement.style.borderRadius=`${e.borderRadius}px`,this.videoElement.style.boxShadow=`0 0 ${e.dropShadow.radius}px 0 rgba(${e.dropShadow.color}, ${e.dropShadow.opacity})`}async initialize(e){console.warn("VideoRecorder: Web implementation is currently for mock purposes only, recording is not available");let i=e.previewFrames.length>0?e.previewFrames:[{id:"default"}];return this.previewFrameConfigs=i.map((e=>new FrameConfig(e))),this.currentFrameConfig=this.previewFrameConfigs[0],this._initializeCameraView(),!1!==e.autoShow&&(this.videoElement.hidden=!1),navigator.mediaDevices.getUserMedia&&(this.stream=await navigator.mediaDevices.getUserMedia({video:!0}),this.videoElement.srcObject=this.stream),Promise.resolve()}destroy(){return this.videoElement.remove(),this.previewFrameConfigs=[],this.currentFrameConfig=void 0,this.stream.getTracks().forEach((e=>e.stop())),Promise.resolve()}flipCamera(){return console.warn("VideoRecorder: No web mock available for flipCamera"),Promise.resolve()}addPreviewFrameConfig(e){if(this.videoElement){if(!e.id)return Promise.reject("id required");let i=new FrameConfig(e);-1===this.previewFrameConfigs.map((e=>e.id)).indexOf(i.id)?this.previewFrameConfigs.push(i):this.editPreviewFrameConfig(e)}return Promise.resolve()}editPreviewFrameConfig(e){if(this.videoElement){if(!e.id)return Promise.reject("id required");let i=new FrameConfig(e),r=this.previewFrameConfigs.map((e=>e.id)).indexOf(i.id);-1!==r?this.previewFrameConfigs[r]=i:this.addPreviewFrameConfig(e),this.currentFrameConfig.id==e.id&&(this.currentFrameConfig=i,this._updateCameraView(this.currentFrameConfig))}return Promise.resolve()}switchToPreviewFrame(e){if(this.videoElement){if(!e.id)return Promise.reject("id required");let i=this.previewFrameConfigs.filter((i=>i.id===e.id));if(!(i.length>0))return Promise.reject("id not found");this._updateCameraView(i[0])}return Promise.resolve()}showPreviewFrame(){return this.videoElement&&(this.videoElement.hidden=!1),Promise.resolve()}hidePreviewFrame(){return this.videoElement&&(this.videoElement.hidden=!0),Promise.resolve()}startRecording(){return console.warn("VideoRecorder: No web mock available for startRecording"),Promise.resolve()}stopRecording(){return console.warn("VideoRecorder: No web mock available for stopRecording"),Promise.resolve({videoUrl:"some/file/path"})}getDuration(){return Promise.resolve({value:0})}async hideBackground(){}async requestPermission(){}addListener(){console.warn("VideoRecorder: No web mock available for addListener")}}var web=Object.freeze({__proto__:null,VideoRecorderWeb:VideoRecorderWeb});exports.VideoRecorder=VideoRecorder,exports.VideoRecorderErrors=VideoRecorderErrors;
//# sourceMappingURL=/sm/9a8cc055d247e53eeafc256ee6934924df1bafc900575d79ab4fdfe64cba0884.map