Files
tehran_taj/apps/user-app/dist/assets/PortalWrapper-CrHC4WVo.js
T
2026-09-10 12:17:47 +03:30

2 lines
6.9 KiB
JavaScript

import{P as $,a4 as Q,a5 as ee,e as b,h as j,y as A,f as te,T as ne,l as D}from"./classCallCheck-DqWZIipa.js";import{H as I,k as S,J as re,d as K,A as oe,D as M,Z as U,G,K as z,g as V,U as ae,z as ie,j as T,P as le}from"./index-ZjGZzoKB.js";var se=!1;try{var B=Object.defineProperty({},"passive",{get:function(){se=!0}});window.addEventListener("testPassive",null,B),window.removeEventListener("testPassive",null,B)}catch{}var ce=Symbol("TriggerContextKey"),Ce=function(e){return e?I(ce,{setPortal:function(){},popPortal:!1}):{setPortal:function(){},popPortal:!1}},q=Symbol("PortalContextKey"),ue=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{inTriggerContext:!0};re(q,{inTriggerContext:r.inTriggerContext,shouldRender:S(function(){var t=e||{},o=t.sPopupVisible,n=t.popupRef,l=t.forceRender,s=t.autoDestroy,i=!1;return(o||n||l)&&(i=!0),!o&&s&&(i=!1),i})})},fe=function(){ue({},{inTriggerContext:!1});var e=I(q,{shouldRender:S(function(){return!1}),inTriggerContext:!1});return{shouldRender:S(function(){return e.shouldRender.value||e.inTriggerContext===!1})}};const ve=K({compatConfig:{MODE:3},name:"Portal",inheritAttrs:!1,props:{getContainer:$.func.isRequired,didUpdate:Function},setup:function(e,r){var t=r.slots,o=!0,n,l=fe(),s=l.shouldRender;oe(function(){o=!1,s.value&&(n=e.getContainer())});var i=M(s,function(){s.value&&!n&&(n=e.getContainer()),n&&i()});return U(function(){G(function(){if(s.value){var a;(a=e.didUpdate)===null||a===void 0||a.call(e,e)}})}),z(function(){n&&n.parentNode&&n.parentNode.removeChild(n)}),function(){if(!s.value)return null;if(o){var a;return(a=t.default)===null||a===void 0?void 0:a.call(t)}return n?V(ae,{to:n},t):null}}});var ye={TAB:9,ENTER:13,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40},R;function F(c){if(typeof document>"u")return 0;if(c||R===void 0){var e=document.createElement("div");e.style.width="100%",e.style.height="200px";var r=document.createElement("div"),t=r.style;t.position="absolute",t.top="0",t.left="0",t.pointerEvents="none",t.visibility="hidden",t.width="200px",t.height="150px",t.overflow="hidden",r.appendChild(e),document.body.appendChild(r);var o=e.offsetWidth;r.style.overflow="scroll";var n=e.offsetWidth;o===n&&(n=r.clientWidth),document.body.removeChild(r),R=o-n}return R}function C(c){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=e.element,t=r===void 0?document.body:r,o={},n=Object.keys(c);return n.forEach(function(l){o[l]=t.style[l]}),n.forEach(function(l){t.style[l]=c[l]}),o}function de(){return document.body.scrollHeight>(window.innerHeight||document.documentElement.clientHeight)&&window.innerWidth>document.body.offsetWidth}var k={};const H=function(c){if(!(!de()&&!c)){var e="ant-scrolling-effect",r=new RegExp("".concat(e),"g"),t=document.body.className;if(c){if(!r.test(t))return;C(k),k={},document.body.className=t.replace(r,"").trim();return}var o=F();if(o&&(k=C({position:"relative",width:"calc(100% - ".concat(o,"px)")}),!r.test(t))){var n="".concat(t," ").concat(e);document.body.className=n.trim()}}};var v=[],X="ant-scrolling-effect",x=new RegExp("".concat(X),"g"),ge=0,_=new Map,me=Q(function c(e){var r=this;ee(this,c),b(this,"getContainer",function(){var t;return(t=r.options)===null||t===void 0?void 0:t.container}),b(this,"reLock",function(t){var o=v.find(function(n){var l=n.target;return l===r.lockTarget});o&&r.unLock(),r.options=t,o&&(o.options=t,r.lock())}),b(this,"lock",function(){var t;if(!v.some(function(i){var a=i.target;return a===r.lockTarget})){if(v.some(function(i){var a,g=i.options;return(g==null?void 0:g.container)===((a=r.options)===null||a===void 0?void 0:a.container)})){v=[].concat(j(v),[{target:r.lockTarget,options:r.options}]);return}var o=0,n=((t=r.options)===null||t===void 0?void 0:t.container)||document.body;(n===document.body&&window.innerWidth-document.documentElement.clientWidth>0||n.scrollHeight>n.clientHeight)&&(o=F());var l=n.className;if(v.filter(function(i){var a,g=i.options;return(g==null?void 0:g.container)===((a=r.options)===null||a===void 0?void 0:a.container)}).length===0&&_.set(n,C({width:o!==0?"calc(100% - ".concat(o,"px)"):void 0,overflow:"hidden",overflowX:"hidden",overflowY:"hidden"},{element:n})),!x.test(l)){var s="".concat(l," ").concat(X);n.className=s.trim()}v=[].concat(j(v),[{target:r.lockTarget,options:r.options}])}}),b(this,"unLock",function(){var t,o=v.find(function(s){var i=s.target;return i===r.lockTarget});if(v=v.filter(function(s){var i=s.target;return i!==r.lockTarget}),!(!o||v.some(function(s){var i,a=s.options;return(a==null?void 0:a.container)===((i=o.options)===null||i===void 0?void 0:i.container)}))){var n=((t=r.options)===null||t===void 0?void 0:t.container)||document.body,l=n.className;x.test(l)&&(C(_.get(n),{element:n}),_.delete(n),n.className=n.className.replace(x,"").trim())}}),this.lockTarget=ge++,this.options=e}),p=0,P=ne(),N={},h=function(e){if(!P)return null;if(e){if(typeof e=="string")return document.querySelectorAll(e)[0];if(typeof e=="function")return e();if(te(e)==="object"&&e instanceof window.HTMLElement)return e}return document.body};const Pe=K({compatConfig:{MODE:3},name:"PortalWrapper",inheritAttrs:!1,props:{wrapperClassName:String,forceRender:{type:Boolean,default:void 0},getContainer:$.any,visible:{type:Boolean,default:void 0}},setup:function(e,r){var t=r.slots,o=T(),n=T(),l=T(),s=new me({container:h(e.getContainer)}),i=function(){var u,d;(u=o.value)===null||u===void 0||(d=u.parentNode)===null||d===void 0||d.removeChild(o.value)},a=function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(u||o.value&&!o.value.parentNode){var d=h(e.getContainer);return d?(d.appendChild(o.value),!0):!1}return!0},g=function(){return P?(o.value||(o.value=document.createElement("div"),a(!0)),L(),o.value):null},L=function(){var u=e.wrapperClassName;o.value&&u&&u!==o.value.className&&(o.value.className=u)};U(function(){L(),a()});var Y=function(){p===1&&!Object.keys(N).length?(H(),N=C({overflow:"hidden",overflowX:"hidden",overflowY:"hidden"})):p||(C(N),N={},H(!0))},J=le();return ie(function(){var f=!1;M([function(){return e.visible},function(){return e.getContainer}],function(u,d){var w=D(u,2),y=w[0],m=w[1],W=D(d,2),O=W[0],E=W[1];if(P&&h(e.getContainer)===document.body&&(y&&!O?p+=1:f&&(p-=1)),f){var Z=typeof m=="function"&&typeof E=="function";(Z?m.toString()!==E.toString():m!==E)&&i(),y&&y!==O&&P&&h(m)!==s.getContainer()&&s.reLock({container:h(m)})}f=!0},{immediate:!0,flush:"post"}),G(function(){a()||(l.value=A(function(){J.update()}))})}),z(function(){var f=e.visible,u=e.getContainer;P&&h(u)===document.body&&(p=f&&p?p-1:p),i(),A.cancel(l.value)}),function(){var f=e.forceRender,u=e.visible,d=null,w={getOpenCount:function(){return p},getContainer:g,switchScrollingEffect:Y,scrollLocker:s};return(f||u||n.value)&&(d=V(ve,{getContainer:g,ref:n},{default:function(){var m;return(m=t.default)===null||m===void 0?void 0:m.call(t,w)}})),d}}});export{ye as K,Pe as P,ve as a,Ce as b,F as g,se as s,ue as u};