cordova.define("cordova-plugin-screen-orientation.screenorientation",function(require,exports,module){var screenOrientation={};window.OrientationType||(window.OrientationType={"portrait-primary":0,"portrait-secondary":180,"landscape-primary":90,"landscape-secondary":-90}),window.OrientationLockType||(window.OrientationLockType={"portrait-primary":1,"portrait-secondary":2,"landscape-primary":4,"landscape-secondary":8,portrait:3,landscape:12,any:15});var screenObject,orientationMask=1;function resolveOrientation(orientation,resolve,reject){if(OrientationLockType.hasOwnProperty(orientation))screenOrientation.setOrientation(orientation),resolve("Orientation set");else{var err=new Error;err.name="NotSupportedError",reject(err)}}screenOrientation.setOrientation=function(orientation){orientationMask=window.OrientationLockType[orientation],cordova.exec(null,null,"CDVOrientation","screenOrientation",[orientationMask,orientation])},screen.orientation||(screen.orientation={}),setOrientationProperties(),((screenObject=screen.orientation).unlock||screenObject.lock)&&(screenObject.nativeLock=screenObject.lock),screenObject.lock=function(orientation){return new Promise(function(resolve,reject){screenObject.nativeLock?screenObject.nativeLock(orientation).then(function(){resolve()},function(){screenObject.nativeLock=null,resolveOrientation(orientation,resolve,reject)}):resolveOrientation(orientation,resolve,reject)})},screenObject.unlock=function(){screenOrientation.setOrientation("any")};var onChangeListener=null;Object.defineProperty(screen.orientation,"onchange",{set:function(listener){onChangeListener&&screen.orientation.removeEventListener("change",onChangeListener),(onChangeListener=listener)&&screen.orientation.addEventListener("change",onChangeListener)},get:function(){return onChangeListener||null},enumerable:!0});var evtTarget=new XMLHttpRequest;function setOrientationProperties(){switch(window.orientation){case 0:screen.orientation.type="portrait-primary";break;case 90:screen.orientation.type="landscape-primary";break;case 180:screen.orientation.type="portrait-secondary";break;case-90:screen.orientation.type="landscape-secondary";break;default:screen.orientation.type="portrait-primary"}screen.orientation.angle=window.orientation||0}screen.orientation.addEventListener=function(a,b,c){return evtTarget.addEventListener(a,b,c)},screen.orientation.removeEventListener=function(a,b,c){return evtTarget.removeEventListener(a,b,c)},window.addEventListener("orientationchange",function(){setOrientationProperties();var event=document.createEvent("Events");event.initEvent("change",!1,!1),evtTarget.dispatchEvent(event)},!0),module.exports=screenOrientation});