define(["exports","./common/textencoding.js","./browser.js"],function(_exports,_textencoding,_browser){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0;var windowSize,windowSizeEventsBound,_animationEvent,_transitionEvent,supportsCaptureOption=!1;try{var opts=Object.defineProperty({},"capture",{get:function(){supportsCaptureOption=!0}});window.addEventListener("test",null,opts)}catch(e){}function addEventListenerWithOptions(target,type,handler,options){options=supportsCaptureOption?options:options.capture;target.addEventListener(type,handler,options)}function clearWindowSize(){windowSize=null}function whichAnimationEvent(){if(!_animationEvent){var t,el=document.createElement("div"),animations={animation:"animationend",OAnimation:"oAnimationEnd",MozAnimation:"animationend",WebkitAnimation:"webkitAnimationEnd"};for(t in animations)if(void 0!==el.style[t])return _animationEvent=animations[t];_animationEvent="animationend"}return _animationEvent}function supportsEventListenerOnce(){return supportsCaptureOption}function stripScriptsWithDom(s){for(var div=document.createElement("div"),scripts=(div.innerHTML=s,div.getElementsByTagName("script")),i=scripts.length;i--;)scripts[i].remove();for(var elems=div.getElementsByTagName("*"),i=0,length=elems.length;i<length;i++){var elem=elems[i];!function(elem){for(var whitelist=[],attributes=elem.attributes,i=attributes.length;i--;){var attr=attributes[i];-1===whitelist.indexOf(attr.name)&&elem.removeAttributeNode(attr)}}(elem),"A"===elem.tagName&&0===elem.href.indexOf("javascript")&&elem.setAttribute("href","#")}return div.innerHTML}var deviceMemory,platform,cores,_supportsPointerTypeInClickEvent=!1,isNativeAndroid=(_browser.default.iOS||_browser.default.osx||((opts=document.createElement("button")).addEventListener("click",function(e){_supportsPointerTypeInClickEvent="pointerType"in e}),opts.click()),"android"===globalThis.appMode),allowBackdropFilter=!((cores=navigator.hardwareConcurrency||4)<4||(deviceMemory=navigator.deviceMemory||2)<2||_browser.default.android||_browser.default.chrome||"undefined"!=typeof AndroidAppHost&&!AndroidAppHost.allowBackdropFilter()||!supportsCaptureOption||(platform=(navigator.platform||"").toLowerCase(),isNativeAndroid&&(cores<4||deviceMemory<2||platform.includes("armv7")))),allowFocusScaling=function(){var cores=navigator.hardwareConcurrency||6;return!(cores<6||(2400<=(screen.width||screen.availWidth||0)||1400<=(screen.height||screen.availHeight||0))&&cores<6||(navigator.deviceMemory||4)<4||!document.documentElement.animate||!CSS.supports("display","flow-root")||isNativeAndroid)}();_exports.default={addEventListener:addEventListenerWithOptions,removeEventListener:function(target,type,handler,options){options=supportsCaptureOption?options:options.capture,target.removeEventListener(type,handler,options)},getWindowSize:function(){var win;return windowSize||(win=window,windowSize={innerHeight:win.innerHeight,innerWidth:win.innerWidth},console.log("dom getWindowSize"),windowSizeEventsBound)||(windowSizeEventsBound=!0,addEventListenerWithOptions(window,"orientationchange",clearWindowSize,{passive:!0}),addEventListenerWithOptions(window,"resize",clearWindowSize,{passive:!0})),windowSize},whichTransitionEvent:function(){if(!_transitionEvent){var t,el=document.createElement("div"),transitions={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(t in transitions)if(void 0!==el.style[t])return _transitionEvent=transitions[t];_transitionEvent="transitionend"}return _transitionEvent},whichAnimationEvent:whichAnimationEvent,whichAnimationCancelEvent:function(){return whichAnimationEvent().replace("animationend","animationcancel").replace("AnimationEnd","AnimationCancel")},htmlEncode:_textencoding.default.htmlEncode,supportsEventListenerOnce:supportsEventListenerOnce,stripScripts:function(s){try{return stripScriptsWithDom(s)}catch(err){return _textencoding.default.htmlEncode(s)}},supportsPointerTypeInClickEvent:function(){return _supportsPointerTypeInClickEvent},allowBackdropFilter:function(){return allowBackdropFilter},allowFocusScaling:function(){return allowFocusScaling},supportsAsyncDecodedImages:function(){return!_browser.default.iOS&&!_browser.default.osx}}});