UNPKG

jenesius-vue-modal

Version:

The progressive and simple modal system for Vue.js v3

8 lines (7 loc) 21.7 kB
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".modal-container{position:fixed;left:0;top:0;height:100%;width:100%;display:flex;align-items:center;justify-content:center;background-color:#3e3e3e21;cursor:pointer}.modal-item{cursor:default}.modal-list-enter-active,.modal-list-leave-active,.modal-list-enter-active .modal-item,.modal-list-leave-active .modal-item{transition:all .2s ease}.modal-list-enter-from,.modal-list-leave-to{opacity:0!important}.modal-list-enter-from .modal-item,.modal-list-leave-to .modal-item{transform:translateY(-60px)}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})(); "use strict";/*! * jenesius-vue-modal v1.11.9 * (c) 2024 Jenesius * @license MIT */Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("vue");var D=function(n,e){return D=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])},D(n,e)};function ne(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");D(n,e);function t(){this.constructor=n}n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function F(n,e,t,r){function i(o){return o instanceof t?o:new t(function(l){l(o)})}return new(t||(t=Promise))(function(o,l){function f(a){try{s(r.next(a))}catch(u){l(u)}}function c(a){try{s(r.throw(a))}catch(u){l(u)}}function s(a){a.done?o(a.value):i(a.value).then(f,c)}s((r=r.apply(n,e||[])).next())})}function M(n,e){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,l;return l={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function f(s){return function(a){return c([s,a])}}function c(s){if(r)throw new TypeError("Generator is already executing.");for(;l&&(l=0,s[0]&&(t=0)),t;)try{if(r=1,i&&(o=s[0]&2?i.return:s[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;switch(i=0,o&&(s=[s[0]&2,o.value]),s[0]){case 0:case 1:o=s;break;case 4:return t.label++,{value:s[1],done:!1};case 5:t.label++,i=s[1],s=[0];continue;case 7:s=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){t=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){t.label=s[1];break}if(s[0]===6&&t.label<o[1]){t.label=o[1],o=s;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(s);break}o[2]&&t.ops.pop(),t.trys.pop();continue}s=e.call(n,t)}catch(a){s=[6,a],i=0}finally{r=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}var v=function(n){ne(e,n);function e(t,r){r===void 0&&(r=null);var i=n.call(this)||this;return i.isModalError=!0,i.message=t,i.details=r,i}return e.Undefined=function(t){return new e("Modal with id: ".concat(t," not founded. The modal window may have been closed earlier."))},e.UndefinedGuardName=function(t){return new e("Guard's name ".concat(t," is not declaration."))},e.NextReject=function(t){return new e("Guard returned false. Modal navigation was stopped. Modal id ".concat(t))},e.GuardDeclarationType=function(t){return new e("Guard's type should be a function. Provided:",t)},e.RejectedByBeforeEach=function(){return new e("The opening of the modal was stopped in beforeEach")},e.ConfigurationType=function(t){return new e("Configuration type must be an Object. Provided",t)},e.ConfigurationUndefinedParam=function(t,r){return new e("In configuration founded unknown parameter: ".concat(t,". Available are ").concat(r.join(", ")," "))},e.QueueNoEmpty=function(){return new e("Modal's queue is not empty. Probably some modal reject closing by onClose hook.")},e.EmptyModalQueue=function(){return new e("Modal queue is empty.")},e.NotInitialized=function(t){return new e("Modal Container not found. Put container from jenesius-vue-modal in App's template. Namespace: ".concat(t,". Check documentation for more information https://modal.jenesius.com/docs.html/installation#getting-started."))},e.ModalComponentNotProvided=function(){return new e("The first parameter(VueComponent) was not specified.")},e.DuplicatedRouterIntegration=function(){return new e("useModalRouter.init should escaped only once.")},e.ModalRouterIntegrationNotInitialized=function(){return new e("The integration was not initialized. Please, use useModalRouter.init(router). For more information: https://modal.jenesius.com/docs.html/integration-vue-router#installation")},e.ModalEventNameMustBeString=function(t){return new e("Event name must be a string. Provided: ".concat(t))},e.ModalNotFoundByID=function(t){return new e("Modal with ID ".concat(t," was not found."))},e.ModalNotExistsInStore=function(t){return new e("Provided name(".concat(t,") don't exist in the store. Has the given name been added to the store?"))},e}(Error),P=function(){function n(){this.state=new Map,n.instance=this}return n.prototype.getByName=function(e){return e===void 0&&(e=n.DEFAULT_NAMESPACE),this.state.has(e)||this.state.set(e,{queue:h.reactive([]),initialized:!1}),this.state.get(e)},n.prototype.forceClean=function(){this.state.forEach(function(e){e.queue.splice(0,e.queue.length)})},n.DEFAULT_NAMESPACE="default",n}(),X=function(){var n=new P,e={scrollLock:!0,animation:"modal-list",backgroundClose:!0,escClose:!0,store:{},skipInitCheck:!1,draggable:!1,appear:!0,singleShow:!1,beforeEach:function(){}},t=n.getByName().queue;return h.watch(function(){return t},function(){e.scrollLock&&(t.length?document.body.style.overflowY="hidden":document.body.style.overflowY="auto")},{deep:!0}),{namespaceStore:n,configuration:e}}();function b(n){return X.namespaceStore.getByName(n)}var C=X.configuration;function re(n){return!!n&&typeof n=="object"&&!!n.component}function W(n){var e={backgroundClose:C.backgroundClose,isRoute:!1,namespace:P.DEFAULT_NAMESPACE,draggable:C.draggable};return n.backgroundClose!==void 0&&(e.backgroundClose=n.backgroundClose),n.isRoute&&(e.isRoute=n.isRoute),n.namespace&&(e.namespace=n.namespace),n.draggable!==void 0&&(e.draggable=n.draggable),e}function G(n){n===void 0&&(n={});var e={background:!1,esc:!1};return Object.assign(e,n)}function H(n){return n||(n={}),n}function T(n,e){e===void 0&&(e={});var t=O.STORE.get(n);if(!t)return Promise.reject(v.ModalNotFoundByID(n));var r=b(t.namespace),i=r.queue.findIndex(function(l){return l.id===n});if(i===-1)return Promise.reject(v.Undefined(n));var o=_.get(n,"close").map(function(l){return ie(l,n,G(e))});return Z(o).then(function(){r.queue.splice(i,1)}).then(function(){_.get(n,"destroy").forEach(function(l){return l(G(e))})}).then(function(){_.delete(n)})}var O=function(){function n(e,t,r){var i=this;this.events=h.reactive({}),this.backgroundClose=!0,this.isRoute=!1,this.id=n.modalId++,this.component=e,this.props=h.ref(t),this.closed=h.computed(function(){return!b(r.namespace).queue.includes(i)}),e.beforeModalClose&&_.add(this.id,"close",e.beforeModalClose);var o=W(r);this.backgroundClose=o.backgroundClose,this.isRoute=o.isRoute,this.namespace=o.namespace,this.draggable=o.draggable,n.STORE.set(this.id,this)}return n.prototype.close=function(){return T(this.id)},Object.defineProperty(n.prototype,"onclose",{set:function(e){_.add(this.id,"close",e)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"ondestroy",{set:function(e){_.add(this.id,"destroy",e)},enumerable:!1,configurable:!0}),n.prototype.on=function(e,t){var r=this;return Array.isArray(this.events[e])||(this.events[e]=[]),this.events[e].push(t),function(){var i=r.events[e].indexOf(t);i!==-1&&r.events[e].splice(i,1)}},n.STORE=new Map,n.modalId=0,n.EVENT_PROMPT="jenesius-vue-modal:____P____R____O____M____P____T",n}();function J(n){return O.STORE.get(n)}var oe={store:{},add:function(n,e,t){var r,i;if(typeof t!="function")throw v.GuardDeclarationType(t);this.store[n]||(this.store[n]=(r={},r[e]=[],r)),this.store[n][e]||(this.store[n][e]=[]),(i=this.store[n][e])===null||i===void 0||i.push(t)},get:function(n,e){return n in this.store?e in this.store[n]?this.store[n][e]||[]:[]:[]},delete:function(n){n in this.store&&delete this.store[n]}};const _=oe;function Z(n){return n.reduce(function(e,t){return e.then(function(){return t()})},Promise.resolve())}function ie(n,e,t){return function(){return new Promise(function(r,i){var o,l=function(f){f===void 0&&(f=!0),f===!1&&i(v.NextReject(e)),r()};Promise.resolve(n.call((o=J(e))===null||o===void 0?void 0:o.instance,t)).then(l).catch(function(f){return i(f)})})}}function V(n){return n=H(n),Z(b(n.namespace).queue.map(function(e){return function(){return e.close()}}))}function q(n){var e=b(n),t=e.queue;if(t.length!==0)return t[t.length-1]}function ae(n){n=H(n);var e=q(n.namespace);return e?e.close():Promise.resolve()}function ue(n,e,t){return F(this,void 0,void 0,function(){var r,i,o,l,f;return M(this,function(c){switch(c.label){case 0:if(r=W(t),i=b(r.namespace),r.namespace===P.DEFAULT_NAMESPACE&&!i.initialized&&!C.skipInitCheck)throw v.NotInitialized(r.namespace);return[4,C.beforeEach()];case 1:if(c.sent()===!1)throw v.RejectedByBeforeEach();if(typeof n!="string")return[3,5];if(o=ee(n),!o)throw v.ModalNotExistsInStore(n);return re(o)?(n=o.component,Object.assign(r,o),l=o.beforeEach,l?[4,o.beforeEach()]:[3,3]):[3,4];case 2:l=c.sent()===!1,c.label=3;case 3:if(l)throw v.RejectedByBeforeEach();return[3,5];case 4:n=o,c.label=5;case 5:if(!n)throw v.ModalComponentNotProvided();return f=new O(n,e,r),i.queue.push(h.markRaw(f)),[2,f]}})})}function L(n,e,t){return e===void 0&&(e={}),t===void 0&&(t={}),Promise.resolve().then(function(){return ue(n,e,t)})}function K(n,e,t){return e===void 0&&(e={}),t===void 0&&(t={}),V({namespace:t.namespace}).then(function(){var r=b(t.namespace);if(r.queue.length)throw v.QueueNoEmpty()}).then(function(){return L(n,e,t)})}function se(n){if(typeof n!="object")throw v.ConfigurationType(n);Object.assign(C,n)}function ce(n){var e,t,r,i=h.getCurrentInstance(),o=String(((e=i==null?void 0:i.props)===null||e===void 0?void 0:e.modalId)||((t=i==null?void 0:i.props)===null||t===void 0?void 0:t["modal-id"])||((r=i==null?void 0:i.attrs)===null||r===void 0?void 0:r.modalId)),l=o.replace(/[^0-9]/g,"");_.add(Number(l),"close",n)}function le(n,e,t){return e===void 0&&(e={}),t===void 0&&(t={}),F(this,void 0,void 0,function(){var r,i,o=this;return M(this,function(l){switch(l.label){case 0:return[4,L(n,e,t)];case 1:return r=l.sent(),i=!1,[2,new Promise(function(f){r.on(O.EVENT_PROMPT,function(c){return F(o,void 0,void 0,function(){return M(this,function(s){return i=!0,[2,r.close().then(function(){return f(c)}).catch(function(){return i=!1})]})})}),r.ondestroy=function(){i||f(null)}})]}})})}function ee(n){return C.store[n]||void 0}function de(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var B={exports:{}},x,Q;function fe(){if(Q)return x;Q=1;var n=1e3,e=n*60,t=e*60,r=t*24,i=r*7,o=r*365.25;x=function(a,u){u=u||{};var d=typeof a;if(d==="string"&&a.length>0)return l(a);if(d==="number"&&isFinite(a))return u.long?c(a):f(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))};function l(a){if(a=String(a),!(a.length>100)){var u=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(a);if(u){var d=parseFloat(u[1]),p=(u[2]||"ms").toLowerCase();switch(p){case"years":case"year":case"yrs":case"yr":case"y":return d*o;case"weeks":case"week":case"w":return d*i;case"days":case"day":case"d":return d*r;case"hours":case"hour":case"hrs":case"hr":case"h":return d*t;case"minutes":case"minute":case"mins":case"min":case"m":return d*e;case"seconds":case"second":case"secs":case"sec":case"s":return d*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return d;default:return}}}}function f(a){var u=Math.abs(a);return u>=r?Math.round(a/r)+"d":u>=t?Math.round(a/t)+"h":u>=e?Math.round(a/e)+"m":u>=n?Math.round(a/n)+"s":a+"ms"}function c(a){var u=Math.abs(a);return u>=r?s(a,u,r,"day"):u>=t?s(a,u,t,"hour"):u>=e?s(a,u,e,"minute"):u>=n?s(a,u,n,"second"):a+" ms"}function s(a,u,d,p){var E=u>=d*1.5;return Math.round(a/d)+" "+p+(E?"s":"")}return x}function he(n){t.debug=t,t.default=t,t.coerce=c,t.disable=o,t.enable=i,t.enabled=l,t.humanize=fe(),t.destroy=s,Object.keys(n).forEach(a=>{t[a]=n[a]}),t.names=[],t.skips=[],t.formatters={};function e(a){let u=0;for(let d=0;d<a.length;d++)u=(u<<5)-u+a.charCodeAt(d),u|=0;return t.colors[Math.abs(u)%t.colors.length]}t.selectColor=e;function t(a){let u,d=null,p,E;function g(...m){if(!g.enabled)return;const y=g,S=Number(new Date),R=S-(u||S);y.diff=R,y.prev=u,y.curr=S,u=S,m[0]=t.coerce(m[0]),typeof m[0]!="string"&&m.unshift("%O");let w=0;m[0]=m[0].replace(/%([a-zA-Z%])/g,(k,A)=>{if(k==="%%")return"%";w++;const I=t.formatters[A];if(typeof I=="function"){const j=m[w];k=I.call(y,j),m.splice(w,1),w--}return k}),t.formatArgs.call(y,m),(y.log||t.log).apply(y,m)}return g.namespace=a,g.useColors=t.useColors(),g.color=t.selectColor(a),g.extend=r,g.destroy=t.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(p!==t.namespaces&&(p=t.namespaces,E=t.enabled(a)),E),set:m=>{d=m}}),typeof t.init=="function"&&t.init(g),g}function r(a,u){const d=t(this.namespace+(typeof u>"u"?":":u)+a);return d.log=this.log,d}function i(a){t.save(a),t.namespaces=a,t.names=[],t.skips=[];let u;const d=(typeof a=="string"?a:"").split(/[\s,]+/),p=d.length;for(u=0;u<p;u++)d[u]&&(a=d[u].replace(/\*/g,".*?"),a[0]==="-"?t.skips.push(new RegExp("^"+a.slice(1)+"$")):t.names.push(new RegExp("^"+a+"$")))}function o(){const a=[...t.names.map(f),...t.skips.map(f).map(u=>"-"+u)].join(",");return t.enable(""),a}function l(a){if(a[a.length-1]==="*")return!0;let u,d;for(u=0,d=t.skips.length;u<d;u++)if(t.skips[u].test(a))return!1;for(u=0,d=t.names.length;u<d;u++)if(t.names[u].test(a))return!0;return!1}function f(a){return a.toString().substring(2,a.toString().length-2).replace(/\.\*\?$/,"*")}function c(a){return a instanceof Error?a.stack||a.message:a}function s(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}var me=he;(function(n,e){e.formatArgs=r,e.save=i,e.load=o,e.useColors=t,e.storage=l(),e.destroy=(()=>{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function t(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function r(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+n.exports.humanize(this.diff),!this.useColors)return;const s="color: "+this.color;c.splice(1,0,s,"color: inherit");let a=0,u=0;c[0].replace(/%[a-zA-Z%]/g,d=>{d!=="%%"&&(a++,d==="%c"&&(u=a))}),c.splice(u,0,s)}e.log=console.debug||console.log||(()=>{});function i(c){try{c?e.storage.setItem("debug",c):e.storage.removeItem("debug")}catch{}}function o(){let c;try{c=e.storage.getItem("debug")}catch{}return!c&&typeof process<"u"&&"env"in process&&(c=process.env.DEBUG),c}function l(){try{return localStorage}catch{}}n.exports=me(e);const{formatters:f}=n.exports;f.j=function(c){try{return JSON.stringify(c)}catch(s){return"[UnexpectedJSONParseError]: "+s.message}}})(B,B.exports);var ve=B.exports;const ge=de(ve);function pe(n){return ge("jenesius-vue-modal:".concat(n))}const Ce=["onPointerdown"],Y=h.defineComponent({__name:"WidgetModalContainerItem",props:{id:{},show:{type:Boolean}},setup(n){const e=pe("modal-item"),t=n,r=J(t.id),i=h.ref(),o=h.ref();function l(){if(r.backgroundClose)return T(r.id,{background:!0}).catch(()=>{})}h.watch(()=>o.value,c=>{var s;if(r.instance=c,e(`Modal(${r.id}) instance is saved.`),r.draggable){const a=`[modalid=_modal_${t.id}]`,u=typeof r.draggable=="string"?r.draggable:a;e(`The modal window is movable(${u}).`),i.value?(e("Finding an item to drag: %s",u),f((s=i.value)==null?void 0:s.querySelector(a),i.value.querySelector(u))):e("The modal container is not mounted. Modal id %d.",r.id)}}),h.onMounted(()=>{e(`Modal(${r.id}) is mounted`)});function f(c,s){if(!s){e("draggable item not found.");return}if(!c){e("HTML modal is not founded.");return}s.addEventListener("pointerdown",a=>{var k;const u=(k=c.getAttribute("style"))==null?void 0:k.match(/transform: translate\((.*)px,\s*(.*)px\)/),d=u==null?void 0:u[1],p=u==null?void 0:u[2];let E=typeof d=="string"?Number.parseInt(d):0,g=typeof p=="string"?Number.parseInt(p):0;const{clientX:m,clientY:y}=a,S=m,R=y;e(`movement started at (${R}, ${R})`),document.addEventListener("pointermove",w,{passive:!0}),document.addEventListener("pointerup",$,{once:!0});function w(A){const{clientX:I,clientY:j}=A,z=E+I-S,U=g+j-R;e(`move at (${z}, ${U})`),c.style.transform=`translate(${z}px,${U}px)`}function $(A){e("movement completed"),document.removeEventListener("pointermove",w),A.preventDefault()}})}return(c,s)=>h.withDirectives((h.openBlock(),h.createElementBlock("div",{class:"widget__modal-container__item modal-container",onPointerdown:h.withModifiers(l,["self","stop"]),ref_key:"modalContainerRef",ref:i},[(h.openBlock(),h.createBlock(h.resolveDynamicComponent(h.unref(r).component),h.mergeProps(h.unref(r).props.value,{class:"modal-item widget__modal-wrap",modalId:`_modal_${c.id}`,ref_key:"modalRef",ref:o},h.toHandlers(h.unref(r).events)),null,16,["modalId"]))],40,Ce)),[[h.vShow,c.show]])}});function ye(n){n===void 0&&(n=P.DEFAULT_NAMESPACE);var e=P.instance.getByName(n);e.initialized=!0,n===P.DEFAULT_NAMESPACE&&document.addEventListener("keyup",function(t){if(C.escClose&&(t.key==="Escape"||t.code==="Escape")){var r=q(n);if(!r)return;T(r.id,{esc:!0}).catch(function(){})}})}const be={props:{namespace:String},setup(n){return h.onMounted(()=>{ye(n.namespace)}),()=>{const e=b(n.namespace);return h.h(h.TransitionGroup,{name:C.animation,tag:"div",appear:C.appear},{default:()=>e.queue.map((t,r,i)=>h.h(Y,{key:t.id,id:t.id,show:C.singleShow===!0?r===i.length-1:!0}))})}},components:{WidgetContainerModalItem:Y}};var N={router:null};function we(n){var e=this;if(N.router)throw v.DuplicatedRouterIntegration();N.router=n;function t(r){for(var i=r.matched.length-1;i>=0;i--){var o=r.matched[i].components,l=Object.values(o).find(function(f){return f._isModal});if(l)return l}return null}n.beforeEach(function(r,i){return F(e,void 0,void 0,function(){var o,l,f;return M(this,function(c){switch(c.label){case 0:return c.trys.push([0,3,,4]),o=t(i),o&&!(!((f=(l=o.getModalObject())===null||l===void 0?void 0:l.closed)===null||f===void 0)&&f.value)?[4,o.close(!0)]:[3,2];case 1:c.sent(),c.label=2;case 2:return[3,4];case 3:return c.sent(),[2,!1];case 4:return[2]}})})}),n.afterEach(function(r){return F(e,void 0,void 0,function(){var i;return M(this,function(o){switch(o.label){case 0:return i=t(r),i?[4,i.initialize()]:[3,2];case 1:o.sent(),o.label=2;case 2:return[2]}})})})}function te(n){var e=null,t=!1;function r(){return F(this,void 0,void 0,function(){return M(this,function(i){switch(i.label){case 0:if(!N.router)throw v.ModalRouterIntegrationNotInitialized();return t=!1,e=null,[4,K(n,h.computed(function(){var o;return(o=N.router)===null||o===void 0?void 0:o.currentRoute.value.params}),{isRoute:!0})];case 1:return e=i.sent(),e.onclose=function(){var o;t||(o=N.router)===null||o===void 0||o.back()},[2]}})})}return{getModalObject:function(){return e},_isModal:!0,close:function(i){return i===void 0&&(i=!1),F(this,void 0,void 0,function(){return M(this,function(o){switch(o.label){case 0:return t=i,e?[4,e.close()]:[3,2];case 1:return[2,o.sent()];case 2:return[2]}})})},initialize:r,setup:function(){return function(){return null}}}}te.init=we;var _e=b().queue;function Fe(n){return b(n).queue}exports.Modal=O;exports.closeById=T;exports.closeModal=V;exports.config=se;exports.container=be;exports.getComponentFromStore=ee;exports.getCurrentModal=q;exports.getQueueByNamespace=Fe;exports.modalQueue=_e;exports.onBeforeModalClose=ce;exports.openModal=K;exports.popModal=ae;exports.promptModal=le;exports.pushModal=L;exports.useModalRouter=te; //# sourceMappingURL=jenesius-vue-modal.cjs.js.map