@opengis/admin 0.3.90 → 0.3.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{add-page-D5ZyV8Tj.js → add-page-Dr3rQ8kI.js} +1 -1
- package/dist/{admin-interface-CqOP91gU.js → admin-interface-jy2dmnPp.js} +1 -1
- package/dist/{admin-view-SROmTWmw.js → admin-view-DpEpA1mk.js} +1 -1
- package/dist/admin.js +1 -1
- package/dist/admin.umd.cjs +1 -1
- package/dist/{card-view-BgRwf727.js → card-view-Cf8CLLnb.js} +1 -1
- package/dist/{edit-page-pneZvDrF.js → edit-page-BPBLgXKs.js} +1 -1
- package/dist/{import-file-Cxjw40cM.js → import-file-CImNR4DJ.js} +424 -418
- package/dist/{profile-page-B_tZzwq3.js → profile-page-CRzcrXZ9.js} +1 -1
- package/package.json +2 -2
package/dist/admin.umd.cjs
CHANGED
@@ -622,7 +622,7 @@ uniform ${$} ${j} u_${X};
|
|
622
622
|
<div class="fancybox__carousel"></div>
|
623
623
|
<div class="fancybox__footer"></div>
|
624
624
|
</div>`},trapFocus:!0,wheel:"zoom"};var $r,xi;(function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Closing=2]="Closing",t[t.CustomClosing=3]="CustomClosing",t[t.Destroy=4]="Destroy"})($r||($r={})),function(t){t[t.Loading=0]="Loading",t[t.Opening=1]="Opening",t[t.Ready=2]="Ready",t[t.Closing=3]="Closing"}(xi||(xi={}));let q2="",Sh=!1,bm=!1,Xl=null;const G2=()=>{let t="",e="";const n=An.getInstance();if(n){const r=n.carousel,i=n.getSlide();if(r&&i){let s=i.slug||void 0,a=i.triggerEl||void 0;e=s||n.option("slug")||"",!e&&a&&a.dataset&&(e=a.dataset.fancybox||""),e&&e!=="true"&&(t="#"+e+(!s&&r.slides.length>1?"-"+(i.index+1):""))}}return{hash:t,slug:e,index:1}},_m=()=>{const t=new URL(document.URL).hash,e=t.slice(1).split("-"),n=e[e.length-1],r=n&&/^\+?\d+$/.test(n)&&parseInt(e.pop()||"1",10)||1;return{hash:t,slug:e.join("-"),index:r}},Y2=()=>{const{slug:t,index:e}=_m();if(!t)return;let n=document.querySelector(`[data-slug="${t}"]`);if(n&&n.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})),An.getInstance())return;const r=document.querySelectorAll(`[data-fancybox="${t}"]`);r.length&&(n=r[e-1],n&&n.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})))},Z2=()=>{if(An.defaults.Hash===!1)return;const t=An.getInstance();if((t==null?void 0:t.options.Hash)===!1)return;const{slug:e,index:n}=_m(),{slug:r}=G2();t&&(e===r?t.jumpTo(n-1):(Sh=!0,t.close())),Y2()},X2=()=>{Xl&&clearTimeout(Xl),queueMicrotask(()=>{Z2()})},K2=()=>{window.addEventListener("hashchange",X2,!1),setTimeout(()=>{Z2()},500)};Eh&&(/complete|interactive|loaded/.test(document.readyState)?K2():document.addEventListener("DOMContentLoaded",K2));const xm="is-zooming-in";class J2 extends io{onCreateSlide(e,n,r){const i=this.instance.optionFor(r,"src")||"";r.el&&r.type==="image"&&typeof i=="string"&&this.setImage(r,i)}onRemoveSlide(e,n,r){r.panzoom&&r.panzoom.destroy(),r.panzoom=void 0,r.imageEl=void 0}onChange(e,n,r,i){Fn(this.instance.container,xm);for(const s of n.slides){const a=s.panzoom;a&&s.index!==r&&a.reset(.35)}}onClose(){var e;const n=this.instance,r=n.container,i=n.getSlide();if(!r||!r.parentElement||!i)return;const{el:s,contentEl:a,panzoom:o,thumbElSrc:f}=i;if(!s||!f||!a||!o||o.isContentLoading||o.state===Un.Init||o.state===Un.Destroy)return;o.updateMetrics();let g=this.getZoomInfo(i);if(!g)return;this.instance.state=$r.CustomClosing,r.classList.remove(xm),r.classList.add("is-zooming-out"),a.style.backgroundImage=`url('${f}')`;const y=r.getBoundingClientRect();(((e=window.visualViewport)===null||e===void 0?void 0:e.scale)||1)===1&&Object.assign(r.style,{position:"absolute",top:`${r.offsetTop+window.scrollY}px`,left:`${r.offsetLeft+window.scrollX}px`,bottom:"auto",right:"auto",width:`${y.width}px`,height:`${y.height}px`,overflow:"hidden"});const{x:v,y:w,scale:T,opacity:D}=g;if(D){const O=((B,L,U,Z)=>{const Y=L-B,ue=Z-U;return fe=>U+((fe-B)/Y*ue||0)})(o.scale,T,1,0);o.on("afterTransform",()=>{a.style.opacity=O(o.scale)+""})}o.on("endAnimation",()=>{n.destroy()}),o.target.a=T,o.target.b=0,o.target.c=0,o.target.d=T,o.panTo({x:v,y:w,scale:T,friction:D?.2:.33,ignoreBounds:!0}),o.isResting&&n.destroy()}setImage(e,n){const r=this.instance;e.src=n,this.process(e,n).then(i=>{const{contentEl:s,imageEl:a,thumbElSrc:o,el:f}=e;if(r.isClosing()||!s||!a)return;s.offsetHeight;const g=!!r.isOpeningSlide(e)&&this.getZoomInfo(e);if(this.option("protected")&&f){f.addEventListener("contextmenu",w=>{w.preventDefault()});const v=document.createElement("div");Bt(v,"fancybox-protected"),s.appendChild(v)}if(o&&g){const v=i.contentRect,w=Math.max(v.fullWidth,v.fullHeight);let T=null;!g.opacity&&w>1200&&(T=document.createElement("img"),Bt(T,"fancybox-ghost"),T.src=o,s.appendChild(T));const D=()=>{T&&(Bt(T,"f-fadeFastOut"),setTimeout(()=>{T&&(T.remove(),T=null)},200))};(y=o,new Promise((O,B)=>{const L=new Image;L.onload=O,L.onerror=B,L.src=y})).then(()=>{r.hideLoading(e),e.state=xi.Opening,this.instance.emit("reveal",e),this.zoomIn(e).then(()=>{D(),this.instance.done(e)},()=>{}),T&&setTimeout(()=>{D()},w>2500?800:200)},()=>{r.hideLoading(e),r.revealContent(e)})}else{const v=this.optionFor(e,"initialSize"),w=this.optionFor(e,"zoom"),T={event:r.prevMouseMoveEvent||r.options.event,friction:w?.12:0};let D=r.optionFor(e,"showClass")||void 0,O=!0;r.isOpeningSlide(e)&&(v==="full"?i.zoomToFull(T):v==="cover"?i.zoomToCover(T):v==="max"?i.zoomToMax(T):O=!1,i.stop("current")),O&&D&&(D=i.isDragging?"f-fadeIn":""),r.hideLoading(e),r.revealContent(e,D)}var y},()=>{r.setError(e,"{{IMAGE_ERROR}}")})}process(e,n){return new Promise((r,i)=>{var s;const a=this.instance,o=e.el;a.clearContent(e),a.showLoading(e);let f=this.optionFor(e,"content");if(typeof f=="string"&&(f=wo(f)),!f||!es(f)){if(f=document.createElement("img"),f instanceof HTMLImageElement){let g="",y=e.caption;g=typeof y=="string"&&y?y.replace(/<[^>]+>/gi,"").substring(0,1e3):`Image ${e.index+1} of ${((s=a.carousel)===null||s===void 0?void 0:s.pages.length)||1}`,f.src=n||"",f.alt=g,f.draggable=!1,e.srcset&&f.setAttribute("srcset",e.srcset),this.instance.isOpeningSlide(e)&&(f.fetchPriority="high")}e.sizes&&f.setAttribute("sizes",e.sizes)}Bt(f,"fancybox-image"),e.imageEl=f,a.setContent(e,f,!1),e.panzoom=new Ed(o,Qi({transformParent:!0},this.option("Panzoom")||{},{content:f,width:(g,y)=>a.optionFor(e,"width","auto",y)||"auto",height:(g,y)=>a.optionFor(e,"height","auto",y)||"auto",wheel:()=>{const g=a.option("wheel");return(g==="zoom"||g=="pan")&&g},click:(g,y)=>{var v,w;if(a.isCompact||a.isClosing()||e.index!==((v=a.getSlide())===null||v===void 0?void 0:v.index))return!1;if(y){const D=y.composedPath()[0];if(["A","BUTTON","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].includes(D.nodeName))return!1}let T=!y||y.target&&((w=e.contentEl)===null||w===void 0?void 0:w.contains(y.target));return a.option(T?"contentClick":"backdropClick")||!1},dblClick:()=>a.isCompact?"toggleZoom":a.option("contentDblClick")||!1,spinner:!1,panOnlyZoomed:!0,wheelLimit:1/0,on:{ready:g=>{r(g)},error:()=>{i()},destroy:()=>{i()}}}))})}zoomIn(e){return new Promise((n,r)=>{const i=this.instance,s=i.container,{panzoom:a,contentEl:o,el:f}=e;a&&a.updateMetrics();const g=this.getZoomInfo(e);if(!(g&&f&&o&&a&&s))return void r();const{x:y,y:v,scale:w,opacity:T}=g,D=()=>{e.state!==xi.Closing&&(T&&(o.style.opacity=Math.max(Math.min(1,1-(1-a.scale)/(1-w)),0)+""),a.scale>=1&&a.scale>a.targetScale-.1&&n(a))},O=U=>{(U.scale<.99||U.scale>1.01)&&!U.isDragging||(Fn(s,xm),o.style.opacity="",U.off("endAnimation",O),U.off("touchStart",O),U.off("afterTransform",D),n(U))};a.on("endAnimation",O),a.on("touchStart",O),a.on("afterTransform",D),a.on(["error","destroy"],()=>{r()}),a.panTo({x:y,y:v,scale:w,friction:0,ignoreBounds:!0}),a.stop("current");const B={event:a.panMode==="mousemove"?i.prevMouseMoveEvent||i.options.event:void 0},L=this.optionFor(e,"initialSize");Bt(s,xm),i.hideLoading(e),L==="full"?a.zoomToFull(B):L==="cover"?a.zoomToCover(B):L==="max"?a.zoomToMax(B):a.reset(.172)})}getZoomInfo(e){const{el:n,imageEl:r,thumbEl:i,panzoom:s}=e,a=this.instance,o=a.container;if(!n||!r||!i||!s||H2(i)<3||!this.optionFor(e,"zoom")||!o||a.state===$r.Destroy||getComputedStyle(o).getPropertyValue("--f-images-zoom")==="0")return!1;const f=window.visualViewport||null;if((f?f.scale:1)!==1)return!1;let{top:g,left:y,width:v,height:w}=i.getBoundingClientRect(),{top:T,left:D,fitWidth:O,fitHeight:B}=s.contentRect;if(!(v&&w&&O&&B))return!1;const L=s.container.getBoundingClientRect();D+=L.left,T+=L.top;const U=-1*(D+.5*O-(y+.5*v)),Z=-1*(T+.5*B-(g+.5*w)),Y=v/O;let ue=this.option("zoomOpacity")||!1;return ue==="auto"&&(ue=Math.abs(v/w-O/B)>.1),{x:U,y:Z,scale:Y,opacity:ue}}attach(){const e=this,n=e.instance;n.on("Carousel.change",e.onChange),n.on("Carousel.createSlide",e.onCreateSlide),n.on("Carousel.removeSlide",e.onRemoveSlide),n.on("close",e.onClose)}detach(){const e=this,n=e.instance;n.off("Carousel.change",e.onChange),n.off("Carousel.createSlide",e.onCreateSlide),n.off("Carousel.removeSlide",e.onRemoveSlide),n.off("close",e.onClose)}}Object.defineProperty(J2,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{initialSize:"fit",Panzoom:{maxScale:1},protected:!1,zoom:!0,zoomOpacity:"auto"}}),typeof SuppressedError=="function"&&SuppressedError;const Mb="html",Q2="image",Db="map",ia="youtube",Kl="vimeo",Ch="html5video",eE=(t,e={})=>{const n=new URL(t),r=new URLSearchParams(n.search),i=new URLSearchParams;for(const[o,f]of[...r,...Object.entries(e)]){let g=f+"";if(o==="t"){let y=g.match(/((\d*)m)?(\d*)s?/);y&&i.set("start",60*parseInt(y[2]||"0")+parseInt(y[3]||"0")+"")}else i.set(o,g)}let s=i+"",a=t.match(/#t=((.*)?\d+s)/);return a&&(s+=`#t=${a[1]}`),s},G5={ajax:null,autoSize:!0,iframeAttr:{allow:"autoplay; fullscreen",scrolling:"auto"},preload:!0,videoAutoplay:!0,videoRatio:16/9,videoTpl:`<video class="fancybox__html5video" playsinline controls controlsList="nodownload" poster="{{poster}}">
|
625
|
-
<source src="{{src}}" type="{{format}}" />Sorry, your browser doesn't support embedded videos.</video>`,videoFormat:"",vimeo:{byline:1,color:"00adef",controls:1,dnt:1,muted:0},youtube:{controls:1,enablejsapi:1,nocookie:1,rel:0,fs:1}},Y5=["image","html","ajax","inline","clone","iframe","map","pdf","html5video","youtube","vimeo"];class tE extends io{onBeforeInitSlide(e,n,r){this.processType(r)}onCreateSlide(e,n,r){this.setContent(r)}onClearContent(e,n){n.xhr&&(n.xhr.abort(),n.xhr=null);const r=n.iframeEl;r&&(r.onload=r.onerror=null,r.src="//about:blank",n.iframeEl=null);const i=n.contentEl,s=n.placeholderEl;if(n.type==="inline"&&i&&s)i.classList.remove("fancybox__content"),getComputedStyle(i).getPropertyValue("display")!=="none"&&(i.style.display="none"),setTimeout(()=>{s&&(i&&s.parentNode&&s.parentNode.insertBefore(i,s),s.remove())},0),n.contentEl=void 0,n.placeholderEl=void 0;else for(;n.el&&n.el.firstChild;)n.el.removeChild(n.el.firstChild)}onSelectSlide(e,n,r){r.state===xi.Ready&&this.playVideo()}onUnselectSlide(e,n,r){var i,s;if(r.type===Ch){try{(s=(i=r.el)===null||i===void 0?void 0:i.querySelector("video"))===null||s===void 0||s.pause()}catch{}return}let a;r.type===Kl?a={method:"pause",value:"true"}:r.type===ia&&(a={event:"command",func:"pauseVideo"}),a&&r.iframeEl&&r.iframeEl.contentWindow&&r.iframeEl.contentWindow.postMessage(JSON.stringify(a),"*"),r.poller&&clearTimeout(r.poller)}onDone(e,n){e.isCurrentSlide(n)&&!e.isClosing()&&this.playVideo()}onRefresh(e,n){n.slides.forEach(r=>{r.el&&(this.resizeIframe(r),this.setAspectRatio(r))})}onMessage(e){try{let n=JSON.parse(e.data);if(e.origin==="https://player.vimeo.com"){if(n.event==="ready")for(let r of Array.from(document.getElementsByClassName("fancybox__iframe")))r instanceof HTMLIFrameElement&&r.contentWindow===e.source&&(r.dataset.ready="true")}else if(e.origin.match(/^https:\/\/(www.)?youtube(-nocookie)?.com$/)&&n.event==="onReady"){const r=document.getElementById(n.id);r&&(r.dataset.ready="true")}}catch{}}loadAjaxContent(e){const n=this.instance.optionFor(e,"src")||"";this.instance.showLoading(e);const r=this.instance,i=new XMLHttpRequest;r.showLoading(e),i.onreadystatechange=function(){i.readyState===XMLHttpRequest.DONE&&r.state===$r.Ready&&(r.hideLoading(e),i.status===200?r.setContent(e,i.responseText):r.setError(e,i.status===404?"{{AJAX_NOT_FOUND}}":"{{AJAX_FORBIDDEN}}"))};const s=e.ajax||null;i.open(s?"POST":"GET",n+""),i.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),i.setRequestHeader("X-Requested-With","XMLHttpRequest"),i.send(s),e.xhr=i}setInlineContent(e){let n=null;if(es(e.src))n=e.src;else if(typeof e.src=="string"){const r=e.src.split("#",2).pop();n=r?document.getElementById(r):null}if(n){if(e.type==="clone"||n.closest(".fancybox__slide")){n=n.cloneNode(!0);const r=n.dataset.animationName;r&&(n.classList.remove(r),delete n.dataset.animationName);let i=n.getAttribute("id");i=i?`${i}--clone`:`clone-${this.instance.id}-${e.index}`,n.setAttribute("id",i)}else if(n.parentNode){const r=document.createElement("div");r.classList.add("fancybox-placeholder"),n.parentNode.insertBefore(r,n),e.placeholderEl=r}this.instance.setContent(e,n)}else this.instance.setError(e,"{{ELEMENT_NOT_FOUND}}")}setIframeContent(e){const{src:n,el:r}=e;if(!n||typeof n!="string"||!r)return;r.classList.add("is-loading");const i=this.instance,s=document.createElement("iframe");s.className="fancybox__iframe",s.setAttribute("id",`fancybox__iframe_${i.id}_${e.index}`);for(const[o,f]of Object.entries(this.optionFor(e,"iframeAttr")||{}))s.setAttribute(o,f);s.onerror=()=>{i.setError(e,"{{IFRAME_ERROR}}")},e.iframeEl=s;const a=this.optionFor(e,"preload");if(e.type!=="iframe"||a===!1)return s.setAttribute("src",e.src+""),i.setContent(e,s,!1),this.resizeIframe(e),void i.revealContent(e);i.showLoading(e),s.onload=()=>{if(!s.src.length)return;const o=s.dataset.ready!=="true";s.dataset.ready="true",this.resizeIframe(e),o?i.revealContent(e):i.hideLoading(e)},s.setAttribute("src",n),i.setContent(e,s,!1)}resizeIframe(e){const{type:n,iframeEl:r}=e;if(n===ia||n===Kl)return;const i=r==null?void 0:r.parentElement;if(!r||!i)return;let s=e.autoSize;s===void 0&&(s=this.optionFor(e,"autoSize"));let a=e.width||0,o=e.height||0;a&&o&&(s=!1);const f=i&&i.style;if(e.preload!==!1&&s!==!1&&f)try{const g=window.getComputedStyle(i),y=parseFloat(g.paddingLeft)+parseFloat(g.paddingRight),v=parseFloat(g.paddingTop)+parseFloat(g.paddingBottom),w=r.contentWindow;if(w){const T=w.document,D=T.getElementsByTagName(Mb)[0],O=T.body;f.width="",O.style.overflow="hidden",a=a||D.scrollWidth+y,f.width=`${a}px`,O.style.overflow="",f.flex="0 0 auto",f.height=`${O.scrollHeight}px`,o=D.scrollHeight+v}}catch{}if(a||o){const g={flex:"0 1 auto",width:"",height:""};a&&a!=="auto"&&(g.width=`${a}px`),o&&o!=="auto"&&(g.height=`${o}px`),Object.assign(f,g)}}playVideo(){const e=this.instance.getSlide();if(!e)return;const{el:n}=e;if(!n||!n.offsetParent||!this.optionFor(e,"videoAutoplay"))return;if(e.type===Ch)try{const i=n.querySelector("video");if(i){const s=i.play();s!==void 0&&s.then(()=>{}).catch(a=>{i.muted=!0,i.play()})}}catch{}if(e.type!==ia&&e.type!==Kl)return;const r=()=>{if(e.iframeEl&&e.iframeEl.contentWindow){let i;if(e.iframeEl.dataset.ready==="true")return i=e.type===ia?{event:"command",func:"playVideo"}:{method:"play",value:"true"},i&&e.iframeEl.contentWindow.postMessage(JSON.stringify(i),"*"),void(e.poller=void 0);e.type===ia&&(i={event:"listening",id:e.iframeEl.getAttribute("id")},e.iframeEl.contentWindow.postMessage(JSON.stringify(i),"*"))}e.poller=setTimeout(r,250)};r()}processType(e){if(e.html)return e.type=Mb,e.src=e.html,void(e.html="");const n=this.instance.optionFor(e,"src","");if(!n||typeof n!="string")return;let r=e.type,i=null;if(i=n.match(/(youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(?:watch\?(?:.*&)?v=|v\/|u\/|shorts\/|embed\/?)?(videoseries\?list=(?:.*)|[\w-]{11}|\?listType=(?:.*)&list=(?:.*))(?:.*)/i)){const s=this.optionFor(e,ia),{nocookie:a}=s,o=function(v,w){var T={};for(var D in v)Object.prototype.hasOwnProperty.call(v,D)&&w.indexOf(D)<0&&(T[D]=v[D]);if(v!=null&&typeof Object.getOwnPropertySymbols=="function"){var O=0;for(D=Object.getOwnPropertySymbols(v);O<D.length;O++)w.indexOf(D[O])<0&&Object.prototype.propertyIsEnumerable.call(v,D[O])&&(T[D[O]]=v[D[O]])}return T}(s,["nocookie"]),f=`www.youtube${a?"-nocookie":""}.com`,g=eE(n,o),y=encodeURIComponent(i[2]);e.videoId=y,e.src=`https://${f}/embed/${y}?${g}`,e.thumbSrc=e.thumbSrc||`https://i.ytimg.com/vi/${y}/mqdefault.jpg`,r=ia}else if(i=n.match(/^.+vimeo.com\/(?:\/)?([\d]+)((\/|\?h=)([a-z0-9]+))?(.*)?/)){const s=eE(n,this.optionFor(e,Kl)),a=encodeURIComponent(i[1]),o=i[4]||"";e.videoId=a,e.src=`https://player.vimeo.com/video/${a}?${o?`h=${o}${s?"&":""}`:""}${s}`,r=Kl}if(!r&&e.triggerEl){const s=e.triggerEl.dataset.type;Y5.includes(s)&&(r=s)}r||typeof n=="string"&&(n.charAt(0)==="#"?r="inline":(i=n.match(/\.(mp4|mov|ogv|webm)((\?|#).*)?$/i))?(r=Ch,e.videoFormat=e.videoFormat||"video/"+(i[1]==="ogv"?"ogg":i[1])):n.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)?r=Q2:n.match(/\.(pdf)((\?|#).*)?$/i)&&(r="pdf")),(i=n.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:(?:(?:maps\/(?:place\/(?:.*)\/)?\@(.*),(\d+.?\d+?)z))|(?:\?ll=))(.*)?/i))?(e.src=`https://maps.google.${i[1]}/?ll=${(i[2]?i[2]+"&z="+Math.floor(parseFloat(i[3]))+(i[4]?i[4].replace(/^\//,"&"):""):i[4]+"").replace(/\?/,"&")}&output=${i[4]&&i[4].indexOf("layer=c")>0?"svembed":"embed"}`,r=Db):(i=n.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:maps\/search\/)(.*)/i))&&(e.src=`https://maps.google.${i[1]}/maps?q=${i[2].replace("query=","q=").replace("api=1","")}&output=embed`,r=Db),r=r||this.instance.option("defaultType"),e.type=r,r===Q2&&(e.thumbSrc=e.thumbSrc||e.src)}setContent(e){const n=this.instance.optionFor(e,"src")||"";if(e&&e.type&&n){switch(e.type){case Mb:this.instance.setContent(e,n);break;case Ch:const r=this.option("videoTpl");r&&this.instance.setContent(e,r.replace(/\{\{src\}\}/gi,n+"").replace(/\{\{format\}\}/gi,this.optionFor(e,"videoFormat")||"").replace(/\{\{poster\}\}/gi,e.poster||e.thumbSrc||""));break;case"inline":case"clone":this.setInlineContent(e);break;case"ajax":this.loadAjaxContent(e);break;case"pdf":case Db:case ia:case Kl:e.preload=!1;case"iframe":this.setIframeContent(e)}this.setAspectRatio(e)}}setAspectRatio(e){const n=e.contentEl;if(!(e.el&&n&&e.type&&[ia,Kl,Ch].includes(e.type)))return;let r,i=e.width||"auto",s=e.height||"auto";if(i==="auto"||s==="auto"){r=this.optionFor(e,"videoRatio");const g=(r+"").match(/(\d+)\s*\/\s?(\d+)/);r=g&&g.length>2?parseFloat(g[1])/parseFloat(g[2]):parseFloat(r+"")}else i&&s&&(r=i/s);if(!r)return;n.style.aspectRatio="",n.style.width="",n.style.height="",n.offsetHeight;const a=n.getBoundingClientRect(),o=a.width||1,f=a.height||1;n.style.aspectRatio=r+"",r<o/f?(s=s==="auto"?f:Math.min(f,s),n.style.width="auto",n.style.height=`${s}px`):(i=i==="auto"?o:Math.min(o,i),n.style.width=`${i}px`,n.style.height="auto")}attach(){const e=this,n=e.instance;n.on("Carousel.beforeInitSlide",e.onBeforeInitSlide),n.on("Carousel.createSlide",e.onCreateSlide),n.on("Carousel.selectSlide",e.onSelectSlide),n.on("Carousel.unselectSlide",e.onUnselectSlide),n.on("Carousel.Panzoom.refresh",e.onRefresh),n.on("done",e.onDone),n.on("clearContent",e.onClearContent),window.addEventListener("message",e.onMessage)}detach(){const e=this,n=e.instance;n.off("Carousel.beforeInitSlide",e.onBeforeInitSlide),n.off("Carousel.createSlide",e.onCreateSlide),n.off("Carousel.selectSlide",e.onSelectSlide),n.off("Carousel.unselectSlide",e.onUnselectSlide),n.off("Carousel.Panzoom.refresh",e.onRefresh),n.off("done",e.onDone),n.off("clearContent",e.onClearContent),window.removeEventListener("message",e.onMessage)}}Object.defineProperty(tE,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:G5});const vm="play",wm="pause",Th="ready";class nE extends io{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:Th}),Object.defineProperty(this,"inHover",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"progressBar",{enumerable:!0,configurable:!0,writable:!0,value:null})}get isActive(){return this.state!==Th}onReady(e){this.option("autoStart")&&(e.isInfinite||e.page<e.pages.length-1)&&this.start()}onChange(){this.removeProgressBar(),this.pause()}onSettle(){this.resume()}onVisibilityChange(){document.visibilityState==="visible"?this.resume():this.pause()}onMouseEnter(){this.inHover=!0,this.pause()}onMouseLeave(){var e;this.inHover=!1,!((e=this.instance.panzoom)===null||e===void 0)&&e.isResting&&this.resume()}onTimerEnd(){const e=this.instance;this.state==="play"&&(e.isInfinite||e.page!==e.pages.length-1?e.slideNext():e.slideTo(0))}removeProgressBar(){this.progressBar&&(this.progressBar.remove(),this.progressBar=null)}createProgressBar(){var e;if(!this.option("showProgress"))return null;this.removeProgressBar();const n=this.instance,r=((e=n.pages[n.page])===null||e===void 0?void 0:e.slides)||[];let i=this.option("progressParentEl");if(i||(i=(r.length===1?r[0].el:null)||n.viewport),!i)return null;const s=document.createElement("div");return Bt(s,"f-progress"),i.prepend(s),this.progressBar=s,s.offsetHeight,s}set(){const e=this,n=e.instance;if(n.pages.length<2||e.timer)return;const r=e.option("timeout");e.state=vm,Bt(n.container,"has-autoplay");let i=e.createProgressBar();i&&(i.style.transitionDuration=`${r}ms`,i.style.transform="scaleX(1)"),e.timer=setTimeout(()=>{e.timer=null,e.inHover||e.onTimerEnd()},r),e.emit("set")}clear(){const e=this;e.timer&&(clearTimeout(e.timer),e.timer=null),e.removeProgressBar()}start(){const e=this;if(e.set(),e.state!==Th){if(e.option("pauseOnHover")){const n=e.instance.container;n.addEventListener("mouseenter",e.onMouseEnter,!1),n.addEventListener("mouseleave",e.onMouseLeave,!1)}document.addEventListener("visibilitychange",e.onVisibilityChange,!1),e.emit("start")}}stop(){const e=this,n=e.state,r=e.instance.container;e.clear(),e.state=Th,r.removeEventListener("mouseenter",e.onMouseEnter,!1),r.removeEventListener("mouseleave",e.onMouseLeave,!1),document.removeEventListener("visibilitychange",e.onVisibilityChange,!1),Fn(r,"has-autoplay"),n!==Th&&e.emit("stop")}pause(){const e=this;e.state===vm&&(e.state=wm,e.clear(),e.emit(wm))}resume(){const e=this,n=e.instance;if(n.isInfinite||n.page!==n.pages.length-1)if(e.state!==vm){if(e.state===wm&&!e.inHover){const r=new Event("resume",{bubbles:!0,cancelable:!0});e.emit("resume",r),r.defaultPrevented||e.set()}}else e.set();else e.stop()}toggle(){this.state===vm||this.state===wm?this.stop():this.start()}attach(){const e=this,n=e.instance;n.on("ready",e.onReady),n.on("Panzoom.startAnimation",e.onChange),n.on("Panzoom.endAnimation",e.onSettle),n.on("Panzoom.touchMove",e.onChange)}detach(){const e=this,n=e.instance;n.off("ready",e.onReady),n.off("Panzoom.startAnimation",e.onChange),n.off("Panzoom.endAnimation",e.onSettle),n.off("Panzoom.touchMove",e.onChange),e.stop()}}Object.defineProperty(nE,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{autoStart:!0,pauseOnHover:!0,progressParentEl:null,showProgress:!0,timeout:3e3}});class rE extends io{constructor(){super(...arguments),Object.defineProperty(this,"ref",{enumerable:!0,configurable:!0,writable:!0,value:null})}onPrepare(e){const n=e.carousel;if(!n)return;const r=e.container;r&&(n.options.Autoplay=Qi({autoStart:!1},this.option("Autoplay")||{},{pauseOnHover:!1,timeout:this.option("timeout"),progressParentEl:()=>this.option("progressParentEl")||null,on:{start:()=>{e.emit("startSlideshow")},set:i=>{var s;r.classList.add("has-slideshow"),((s=e.getSlide())===null||s===void 0?void 0:s.state)!==xi.Ready&&i.pause()},stop:()=>{r.classList.remove("has-slideshow"),e.isCompact||e.endIdle(),e.emit("endSlideshow")},resume:(i,s)=>{var a,o,f;!s||!s.cancelable||((a=e.getSlide())===null||a===void 0?void 0:a.state)===xi.Ready&&(!((f=(o=e.carousel)===null||o===void 0?void 0:o.panzoom)===null||f===void 0)&&f.isResting)||s.preventDefault()}}}),n.attachPlugins({Autoplay:nE}),this.ref=n.plugins.Autoplay)}onReady(e){const n=e.carousel,r=this.ref;r&&n&&this.option("playOnStart")&&(n.isInfinite||n.page<n.pages.length-1)&&r.start()}onDone(e,n){const r=this.ref,i=e.carousel;if(!r||!i)return;const s=n.panzoom;s&&s.on("startAnimation",()=>{e.isCurrentSlide(n)&&r.stop()}),e.isCurrentSlide(n)&&r.resume()}onKeydown(e,n){var r;const i=this.ref;i&&n===this.option("key")&&((r=document.activeElement)===null||r===void 0?void 0:r.nodeName)!=="BUTTON"&&i.toggle()}attach(){const e=this,n=e.instance;n.on("Carousel.init",e.onPrepare),n.on("Carousel.ready",e.onReady),n.on("done",e.onDone),n.on("keydown",e.onKeydown)}detach(){const e=this,n=e.instance;n.off("Carousel.init",e.onPrepare),n.off("Carousel.ready",e.onReady),n.off("done",e.onDone),n.off("keydown",e.onKeydown)}}Object.defineProperty(rE,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{key:" ",playOnStart:!1,progressParentEl:t=>{var e;return((e=t.instance.container)===null||e===void 0?void 0:e.querySelector(".fancybox__toolbar [data-fancybox-toggle-slideshow]"))||t.instance.container},timeout:3e3}});const iE={classes:{container:"f-thumbs f-carousel__thumbs",viewport:"f-thumbs__viewport",track:"f-thumbs__track",slide:"f-thumbs__slide",isResting:"is-resting",isSelected:"is-selected",isLoading:"is-loading",hasThumbs:"has-thumbs"},minCount:2,parentEl:null,thumbTpl:'<button class="f-thumbs__slide__button" tabindex="0" type="button" aria-label="{{GOTO}}" data-carousel-index="%i"><img class="f-thumbs__slide__img" data-lazy-src="{{%s}}" alt="" /></button>',type:"modern"};var sa;(function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Hidden=2]="Hidden"})(sa||(sa={}));const sE="isResting",km="thumbWidth",Sd="thumbHeight",Eo="thumbClipWidth";let oE=class extends io{constructor(){super(...arguments),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:"modern"}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"thumbWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbClipWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbHeight",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbExtraGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:sa.Init})}get isModern(){return this.type==="modern"}onInitSlide(t,e){const n=e.el?e.el.dataset:void 0;n&&(e.thumbSrc=n.thumbSrc||e.thumbSrc||"",e[Eo]=parseFloat(n[Eo]||"")||e[Eo]||0,e[Sd]=parseFloat(n.thumbHeight||"")||e[Sd]||0),this.addSlide(e)}onInitSlides(){this.build()}onChange(){var t;if(!this.isModern)return;const e=this.container,n=this.instance,r=n.panzoom,i=this.carousel,s=i?i.panzoom:null,a=n.page;if(r&&i&&s){if(r.isDragging){Fn(e,this.cn(sE));let o=((t=i.pages[a])===null||t===void 0?void 0:t.pos)||0;o+=n.getProgress(a)*(this[Eo]+this.thumbGap);let f=s.getBounds();-1*o>f.x.min&&-1*o<f.x.max&&s.panTo({x:-1*o,friction:.12})}else ko(e,this.cn(sE),r.isResting);this.shiftModern()}}onRefresh(){this.updateProps();for(const t of this.instance.slides||[])this.resizeModernSlide(t);this.shiftModern()}isDisabled(){const t=this.option("minCount")||0;if(t){const n=this.instance;let r=0;for(const i of n.slides||[])i.thumbSrc&&r++;if(r<t)return!0}const e=this.option("type");return["modern","classic"].indexOf(e)<0}getThumb(t){const e=this.option("thumbTpl")||"";return{html:this.instance.localize(e,[["%i",t.index],["%d",t.index+1],["%s",t.thumbSrc||"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"]])}}addSlide(t){const e=this.carousel;e&&e.addSlide(t.index,this.getThumb(t))}getSlides(){const t=[];for(const e of this.instance.slides||[])t.push(this.getThumb(e));return t}resizeModernSlide(t){this.isModern&&(t[km]=t[Eo]&&t[Sd]?Math.round(this[Sd]*(t[Eo]/t[Sd])):this[km])}updateProps(){const t=this.container;if(!t)return;const e=n=>parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-"+n))||0;this.thumbGap=e("gap"),this.thumbExtraGap=e("extra-gap"),this[km]=e("width")||40,this[Eo]=e("clip-width")||40,this[Sd]=e("height")||40}build(){const t=this;if(t.state!==sa.Init)return;if(t.isDisabled())return void t.emit("disabled");const e=t.instance,n=e.container,r=t.getSlides(),i=t.option("type");t.type=i;const s=t.option("parentEl"),a=t.cn("container"),o=t.cn("track");let f=s==null?void 0:s.querySelector("."+a);f||(f=document.createElement("div"),Bt(f,a),s?s.appendChild(f):n.after(f)),Bt(f,`is-${i}`),Bt(n,t.cn("hasThumbs")),t.container=f,t.updateProps();let g=f.querySelector("."+o);g||(g=document.createElement("div"),Bt(g,t.cn("track")),f.appendChild(g)),t.track=g;const y=Qi({},{track:g,infinite:!1,center:!0,fill:i==="classic",dragFree:!0,slidesPerPage:1,transition:!1,preload:.25,friction:.12,Panzoom:{maxVelocity:0},Dots:!1,Navigation:!1,classes:{container:"f-thumbs",viewport:"f-thumbs__viewport",track:"f-thumbs__track",slide:"f-thumbs__slide"}},t.option("Carousel")||{},{Sync:{target:e},slides:r}),v=new e.constructor(f,y);v.on("createSlide",(w,T)=>{t.setProps(T.index),t.emit("createSlide",T,T.el)}),v.on("ready",()=>{t.shiftModern(),t.emit("ready")}),v.on("refresh",()=>{t.shiftModern()}),v.on("Panzoom.click",(w,T,D)=>{t.onClick(D)}),t.carousel=v,t.state=sa.Ready}onClick(t){t.preventDefault(),t.stopPropagation();const e=this.instance,{pages:n,page:r}=e,i=O=>{if(O){const B=O.closest("[data-carousel-index]");if(B)return[parseInt(B.dataset.carouselIndex||"",10)||0,B]}return[-1,void 0]},s=(O,B)=>{const L=document.elementFromPoint(O,B);return L?i(L):[-1,void 0]};let[a,o]=i(t.target);if(a>-1)return;const f=this[Eo],g=t.clientX,y=t.clientY;let[v,w]=s(g-f,y),[T,D]=s(g+f,y);w&&D?(a=Math.abs(g-w.getBoundingClientRect().right)<Math.abs(g-D.getBoundingClientRect().left)?v:T,a===r&&(a=a===v?T:v)):w?a=v:D&&(a=T),a>-1&&n[a]&&e.slideTo(a)}getShift(t){var e;const n=this,{instance:r}=n,i=n.carousel;if(!r||!i)return 0;const s=n[km],a=n[Eo],o=n.thumbGap,f=n.thumbExtraGap;if(!(!((e=i.slides[t])===null||e===void 0)&&e.el))return 0;const g=.5*(s-a),y=r.pages.length-1;let v=r.getProgress(0),w=r.getProgress(y),T=r.getProgress(t,!1,!0),D=0,O=g+f+o;const B=v<0&&v>-1,L=w>0&&w<1;return t===0?(D=O*Math.abs(v),L&&v===1&&(D-=O*Math.abs(w))):t===y?(D=O*Math.abs(w)*-1,B&&w===-1&&(D+=O*Math.abs(v))):B||L?(D=-1*O,D+=O*Math.abs(v),D+=O*(1-Math.abs(w))):D=O*T,D}setProps(t){var e;const n=this;if(!n.isModern)return;const{instance:r}=n,i=n.carousel;if(r&&i){const s=(e=i.slides[t])===null||e===void 0?void 0:e.el;if(s&&s.childNodes.length){let a=yt(1-Math.abs(r.getProgress(t))),o=yt(n.getShift(t));s.style.setProperty("--progress",a?a+"":""),s.style.setProperty("--shift",o+"")}}}shiftModern(){const t=this;if(!t.isModern)return;const{instance:e,track:n}=t,r=e.panzoom,i=t.carousel;if(!(e&&n&&r&&i)||r.state===Un.Init||r.state===Un.Destroy)return;for(const a of e.slides)t.setProps(a.index);let s=(t[Eo]+t.thumbGap)*(i.slides.length||0);n.style.setProperty("--width",s+"")}cleanup(){const t=this;t.carousel&&t.carousel.destroy(),t.carousel=null,t.container&&t.container.remove(),t.container=null,t.track&&t.track.remove(),t.track=null,t.state=sa.Init,Fn(t.instance.container,t.cn("hasThumbs"))}attach(){const t=this,e=t.instance;e.on("initSlide",t.onInitSlide),e.state===Mr.Init?e.on("initSlides",t.onInitSlides):t.onInitSlides(),e.on(["change","Panzoom.afterTransform"],t.onChange),e.on("Panzoom.refresh",t.onRefresh)}detach(){const t=this,e=t.instance;e.off("initSlide",t.onInitSlide),e.off("initSlides",t.onInitSlides),e.off(["change","Panzoom.afterTransform"],t.onChange),e.off("Panzoom.refresh",t.onRefresh),t.cleanup()}};Object.defineProperty(oE,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:iE});const Z5=Object.assign(Object.assign({},iE),{key:"t",showOnStart:!0,parentEl:null}),aE="is-masked",lE="aria-hidden";class cE extends io{constructor(){super(...arguments),Object.defineProperty(this,"ref",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"hidden",{enumerable:!0,configurable:!0,writable:!0,value:!1})}get isEnabled(){const e=this.ref;return e&&!e.isDisabled()}get isHidden(){return this.hidden}onClick(e,n){n.stopPropagation()}onCreateSlide(e,n){var r,i,s;const a=((s=(i=(r=this.instance)===null||r===void 0?void 0:r.carousel)===null||i===void 0?void 0:i.slides[n.index])===null||s===void 0?void 0:s.type)||"",o=n.el;if(o&&a){let f=`for-${a}`;["video","youtube","vimeo","html5video"].includes(a)&&(f+=" for-video"),Bt(o,f)}}onInit(){var e;const n=this,r=n.instance,i=r.carousel;if(n.ref||!i)return;const s=n.option("parentEl")||r.footer||r.container;if(!s)return;const a=Qi({},n.options,{parentEl:s,classes:{container:"f-thumbs fancybox__thumbs"},Carousel:{Sync:{friction:r.option("Carousel.friction")||0}},on:{ready:o=>{const f=o.container;f&&this.hidden&&(n.refresh(),f.style.transition="none",n.hide(),f.offsetHeight,queueMicrotask(()=>{f.style.transition="",n.show()}))}}});a.Carousel=a.Carousel||{},a.Carousel.on=Qi(((e=n.options.Carousel)===null||e===void 0?void 0:e.on)||{},{click:this.onClick,createSlide:this.onCreateSlide}),i.options.Thumbs=a,i.attachPlugins({Thumbs:oE}),n.ref=i.plugins.Thumbs,n.option("showOnStart")||(n.ref.state=sa.Hidden,n.hidden=!0)}onResize(){var e;const n=(e=this.ref)===null||e===void 0?void 0:e.container;n&&(n.style.maxHeight="")}onKeydown(e,n){const r=this.option("key");r&&r===n&&this.toggle()}toggle(){const e=this.ref;if(e&&!e.isDisabled())return e.state===sa.Hidden?(e.state=sa.Init,void e.build()):void(this.hidden?this.show():this.hide())}show(){const e=this.ref;if(!e||e.isDisabled())return;const n=e.container;n&&(this.refresh(),n.offsetHeight,n.removeAttribute(lE),n.classList.remove(aE),this.hidden=!1)}hide(){const e=this.ref,n=e&&e.container;n&&(this.refresh(),n.offsetHeight,n.classList.add(aE),n.setAttribute(lE,"true")),this.hidden=!0}refresh(){const e=this.ref;if(!e||!e.state)return;const n=e.container,r=(n==null?void 0:n.firstChild)||null;n&&r&&r.childNodes.length&&(n.style.maxHeight=`${r.getBoundingClientRect().height}px`)}attach(){const e=this,n=e.instance;n.state===$r.Init?n.on("Carousel.init",e.onInit):e.onInit(),n.on("resize",e.onResize),n.on("keydown",e.onKeydown)}detach(){var e;const n=this,r=n.instance;r.off("Carousel.init",n.onInit),r.off("resize",n.onResize),r.off("keydown",n.onKeydown),(e=r.carousel)===null||e===void 0||e.detachPlugins(["Thumbs"]),n.ref=null}}Object.defineProperty(cE,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:Z5});const Ib={panLeft:{icon:'<svg><path d="M5 12h14M5 12l6 6M5 12l6-6"/></svg>',change:{panX:-100}},panRight:{icon:'<svg><path d="M5 12h14M13 18l6-6M13 6l6 6"/></svg>',change:{panX:100}},panUp:{icon:'<svg><path d="M12 5v14M18 11l-6-6M6 11l6-6"/></svg>',change:{panY:-100}},panDown:{icon:'<svg><path d="M12 5v14M18 13l-6 6M6 13l6 6"/></svg>',change:{panY:100}},zoomIn:{icon:'<svg><circle cx="11" cy="11" r="7.5"/><path d="m21 21-4.35-4.35M11 8v6M8 11h6"/></svg>',action:"zoomIn"},zoomOut:{icon:'<svg><circle cx="11" cy="11" r="7.5"/><path d="m21 21-4.35-4.35M8 11h6"/></svg>',action:"zoomOut"},toggle1to1:{icon:'<svg><path d="M3.51 3.07c5.74.02 11.48-.02 17.22.02 1.37.1 2.34 1.64 2.18 3.13 0 4.08.02 8.16 0 12.23-.1 1.54-1.47 2.64-2.79 2.46-5.61-.01-11.24.02-16.86-.01-1.36-.12-2.33-1.65-2.17-3.14 0-4.07-.02-8.16 0-12.23.1-1.36 1.22-2.48 2.42-2.46Z"/><path d="M5.65 8.54h1.49v6.92m8.94-6.92h1.49v6.92M11.5 9.4v.02m0 5.18v0"/></svg>',action:"toggleZoom"},toggleZoom:{icon:'<svg><g><line x1="11" y1="8" x2="11" y2="14"></line></g><circle cx="11" cy="11" r="7.5"/><path d="m21 21-4.35-4.35M8 11h6"/></svg>',action:"toggleZoom"},iterateZoom:{icon:'<svg><g><line x1="11" y1="8" x2="11" y2="14"></line></g><circle cx="11" cy="11" r="7.5"/><path d="m21 21-4.35-4.35M8 11h6"/></svg>',action:"iterateZoom"},rotateCCW:{icon:'<svg><path d="M15 4.55a8 8 0 0 0-6 14.9M9 15v5H4M18.37 7.16v.01M13 19.94v.01M16.84 18.37v.01M19.37 15.1v.01M19.94 11v.01"/></svg>',action:"rotateCCW"},rotateCW:{icon:'<svg><path d="M9 4.55a8 8 0 0 1 6 14.9M15 15v5h5M5.63 7.16v.01M4.06 11v.01M4.63 15.1v.01M7.16 18.37v.01M11 19.94v.01"/></svg>',action:"rotateCW"},flipX:{icon:'<svg style="stroke-width: 1.3"><path d="M12 3v18M16 7v10h5L16 7M8 7v10H3L8 7"/></svg>',action:"flipX"},flipY:{icon:'<svg style="stroke-width: 1.3"><path d="M3 12h18M7 16h10L7 21v-5M7 8h10L7 3v5"/></svg>',action:"flipY"},fitX:{icon:'<svg><path d="M4 12V6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v6M10 18H3M21 18h-7M6 15l-3 3 3 3M18 15l3 3-3 3"/></svg>',action:"fitX"},fitY:{icon:'<svg><path d="M12 20H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h6M18 14v7M18 3v7M15 18l3 3 3-3M15 6l3-3 3 3"/></svg>',action:"fitY"},reset:{icon:'<svg><path d="M20 11A8.1 8.1 0 0 0 4.5 9M4 5v4h4M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"/></svg>',action:"reset"},toggleFS:{icon:'<svg><g><path d="M14.5 9.5 21 3m0 0h-6m6 0v6M3 21l6.5-6.5M3 21v-6m0 6h6"/></g><g><path d="m14 10 7-7m-7 7h6m-6 0V4M3 21l7-7m0 0v6m0-6H4"/></g></svg>',action:"toggleFS"}};var Jl;(function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Disabled=2]="Disabled"})(Jl||(Jl={}));const X5={absolute:"auto",display:{left:["infobar"],middle:[],right:["iterateZoom","slideshow","fullscreen","thumbs","close"]},enabled:"auto",items:{infobar:{tpl:'<div class="fancybox__infobar" tabindex="-1"><span data-fancybox-current-index></span>/<span data-fancybox-count></span></div>'},download:{tpl:'<a class="f-button" title="{{DOWNLOAD}}" data-fancybox-download href="javasript:;"><svg><path d="M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2M7 11l5 5 5-5M12 4v12"/></svg></a>'},prev:{tpl:'<button class="f-button" title="{{PREV}}" data-fancybox-prev><svg><path d="m15 6-6 6 6 6"/></svg></button>'},next:{tpl:'<button class="f-button" title="{{NEXT}}" data-fancybox-next><svg><path d="m9 6 6 6-6 6"/></svg></button>'},slideshow:{tpl:'<button class="f-button" title="{{TOGGLE_SLIDESHOW}}" data-fancybox-toggle-slideshow><svg><g><path d="M8 4v16l13 -8z"></path></g><g><path d="M8 4v15M17 4v15"/></g></svg></button>'},fullscreen:{tpl:'<button class="f-button" title="{{TOGGLE_FULLSCREEN}}" data-fancybox-toggle-fullscreen><svg><g><path d="M4 8V6a2 2 0 0 1 2-2h2M4 16v2a2 2 0 0 0 2 2h2M16 4h2a2 2 0 0 1 2 2v2M16 20h2a2 2 0 0 0 2-2v-2"/></g><g><path d="M15 19v-2a2 2 0 0 1 2-2h2M15 5v2a2 2 0 0 0 2 2h2M5 15h2a2 2 0 0 1 2 2v2M5 9h2a2 2 0 0 0 2-2V5"/></g></svg></button>'},thumbs:{tpl:'<button class="f-button" title="{{TOGGLE_THUMBS}}" data-fancybox-toggle-thumbs><svg><circle cx="5.5" cy="5.5" r="1"/><circle cx="12" cy="5.5" r="1"/><circle cx="18.5" cy="5.5" r="1"/><circle cx="5.5" cy="12" r="1"/><circle cx="12" cy="12" r="1"/><circle cx="18.5" cy="12" r="1"/><circle cx="5.5" cy="18.5" r="1"/><circle cx="12" cy="18.5" r="1"/><circle cx="18.5" cy="18.5" r="1"/></svg></button>'},close:{tpl:'<button class="f-button" title="{{CLOSE}}" data-fancybox-close><svg><path d="m19.5 4.5-15 15M4.5 4.5l15 15"/></svg></button>'}},parentEl:null},K5={tabindex:"-1",width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},dE="has-toolbar",Pb="fancybox__toolbar";class uE extends io{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:Jl.Init}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null})}onReady(e){var n;if(!e.carousel)return;let r=this.option("display"),i=this.option("absolute"),s=this.option("enabled");if(s==="auto"){const g=this.instance.carousel;let y=0;if(g)for(const v of g.slides)(v.panzoom||v.type==="image")&&y++;y||(s=!1)}s||(r=void 0);let a=0;const o={left:[],middle:[],right:[]};if(r)for(const g of["left","middle","right"])for(const y of r[g]){const v=this.createEl(y);v&&((n=o[g])===null||n===void 0||n.push(v),a++)}let f=null;if(a&&(f=this.createContainer()),f){for(const[g,y]of Object.entries(o)){const v=document.createElement("div");Bt(v,Pb+"__column is-"+g);for(const w of y)v.appendChild(w);i!=="auto"||g!=="middle"||y.length||(i=!0),f.appendChild(v)}i===!0&&Bt(f,"is-absolute"),this.state=Jl.Ready,this.onRefresh()}else this.state=Jl.Disabled}onClick(e){var n,r;const i=this.instance,s=i.getSlide(),a=s==null?void 0:s.panzoom,o=e.target,f=o&&es(o)?o.dataset:null;if(!f)return;if(f.fancyboxToggleThumbs!==void 0)return e.preventDefault(),e.stopPropagation(),void((n=i.plugins.Thumbs)===null||n===void 0||n.toggle());if(f.fancyboxToggleFullscreen!==void 0)return e.preventDefault(),e.stopPropagation(),void this.instance.toggleFullscreen();if(f.fancyboxToggleSlideshow!==void 0){e.preventDefault(),e.stopPropagation();const v=(r=i.carousel)===null||r===void 0?void 0:r.plugins.Autoplay;let w=v.isActive;return a&&a.panMode==="mousemove"&&!w&&a.reset(),void(w?v.stop():v.start())}const g=f.panzoomAction,y=f.panzoomChange;if((y||g)&&(e.preventDefault(),e.stopPropagation()),y){let v={};try{v=JSON.parse(y)}catch{}a&&a.applyChange(v)}else g&&a&&a[g]&&a[g]()}onChange(){this.onRefresh()}onRefresh(){if(this.instance.isClosing())return;const e=this.container;if(!e)return;const n=this.instance.getSlide();if(!n||n.state!==xi.Ready)return;const r=n&&!n.error&&n.panzoom;for(const a of e.querySelectorAll("[data-panzoom-action]"))r?(a.removeAttribute("disabled"),a.removeAttribute("tabindex")):(a.setAttribute("disabled",""),a.setAttribute("tabindex","-1"));let i=r&&r.canZoomIn(),s=r&&r.canZoomOut();for(const a of e.querySelectorAll('[data-panzoom-action="zoomIn"]'))i?(a.removeAttribute("disabled"),a.removeAttribute("tabindex")):(a.setAttribute("disabled",""),a.setAttribute("tabindex","-1"));for(const a of e.querySelectorAll('[data-panzoom-action="zoomOut"]'))s?(a.removeAttribute("disabled"),a.removeAttribute("tabindex")):(a.setAttribute("disabled",""),a.setAttribute("tabindex","-1"));for(const a of e.querySelectorAll('[data-panzoom-action="toggleZoom"],[data-panzoom-action="iterateZoom"]')){s||i?(a.removeAttribute("disabled"),a.removeAttribute("tabindex")):(a.setAttribute("disabled",""),a.setAttribute("tabindex","-1"));const o=a.querySelector("g");o&&(o.style.display=i?"":"none")}}onDone(e,n){var r;(r=n.panzoom)===null||r===void 0||r.on("afterTransform",()=>{this.instance.isCurrentSlide(n)&&this.onRefresh()}),this.instance.isCurrentSlide(n)&&this.onRefresh()}createContainer(){const e=this.instance.container;if(!e)return null;const n=this.option("parentEl")||e;let r=n.querySelector("."+Pb);return r||(r=document.createElement("div"),Bt(r,Pb),n.prepend(r)),r.addEventListener("click",this.onClick,{passive:!1,capture:!0}),e&&Bt(e,dE),this.container=r,r}createEl(e){const n=this.instance,r=n.carousel;if(!r||e==="toggleFS"||e==="fullscreen"&&!W2())return null;let i=null;const s=r.slides.length||0;let a=0,o=0;for(const g of r.slides)(g.panzoom||g.type==="image")&&a++,(g.type==="image"||g.downloadSrc)&&o++;if(s<2&&["infobar","prev","next"].includes(e))return i;if(Ib[e]!==void 0&&!a||e==="download"&&!o)return null;if(e==="thumbs"){const g=n.plugins.Thumbs;if(!g||!g.isEnabled)return null}if(e==="slideshow"&&(!r.plugins.Autoplay||s<2))return null;if(Ib[e]!==void 0){const g=Ib[e];i=document.createElement("button"),i.setAttribute("title",this.instance.localize(`{{${e.toUpperCase()}}}`)),Bt(i,"f-button"),g.action&&(i.dataset.panzoomAction=g.action),g.change&&(i.dataset.panzoomChange=JSON.stringify(g.change)),i.appendChild(wo(this.instance.localize(g.icon)))}else{const g=(this.option("items")||[])[e];g&&(i=wo(this.instance.localize(g.tpl)),typeof g.click=="function"&&i.addEventListener("click",y=>{y.preventDefault(),y.stopPropagation(),typeof g.click=="function"&&g.click.call(this,this,y)}))}const f=i==null?void 0:i.querySelector("svg");if(f)for(const[g,y]of Object.entries(K5))f.getAttribute(g)||f.setAttribute(g,String(y));return i}removeContainer(){const e=this.container;e&&e.remove(),this.container=null,this.state=Jl.Disabled;const n=this.instance.container;n&&Fn(n,dE)}attach(){const e=this,n=e.instance;n.on("Carousel.initSlides",e.onReady),n.on("done",e.onDone),n.on(["reveal","Carousel.change"],e.onChange),e.onReady(e.instance)}detach(){const e=this,n=e.instance;n.off("Carousel.initSlides",e.onReady),n.off("done",e.onDone),n.off(["reveal","Carousel.change"],e.onChange),e.removeContainer()}}Object.defineProperty(uE,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:X5});const J5={Hash:class extends io{onReady(){Sh=!1}onChange(t){Xl&&clearTimeout(Xl);const{hash:e}=G2(),{hash:n}=_m(),r=t.isOpeningSlide(t.getSlide());r&&(q2=n===e?"":n),e&&e!==n&&(Xl=setTimeout(()=>{try{if(t.state===$r.Ready){let i="replaceState";r&&!bm&&(i="pushState",bm=!0),window.history[i]({},document.title,window.location.pathname+window.location.search+e)}}catch{}},300))}onClose(t){if(Xl&&clearTimeout(Xl),!Sh&&bm)return bm=!1,Sh=!1,void window.history.back();if(!Sh)try{window.history.replaceState({},document.title,window.location.pathname+window.location.search+(q2||""))}catch{}}attach(){const t=this.instance;t.on("ready",this.onReady),t.on(["Carousel.ready","Carousel.change"],this.onChange),t.on("close",this.onClose)}detach(){const t=this.instance;t.off("ready",this.onReady),t.off(["Carousel.ready","Carousel.change"],this.onChange),t.off("close",this.onClose)}static parseURL(){return _m()}static startFromUrl(){Y2()}static destroy(){window.removeEventListener("hashchange",X2,!1)}},Html:tE,Images:J2,Slideshow:rE,Thumbs:cE,Toolbar:uE},hE="with-fancybox",Nb="hide-scrollbar",pE="--fancybox-scrollbar-compensate",fE="--fancybox-body-margin",Rb="aria-hidden",Ob="is-using-tab",Bb="is-animated",mE="is-compact",gE="is-loading",Vb="is-opening",Em="has-caption",Cd="disabled",Ql="tabindex",yE="download",zb="href",Td="src",Ga=t=>typeof t=="string",bE=function(){var t=window.getSelection();return!!t&&t.type==="Range"};let zs,Ls=null,ec=null,_E=0,xE=0,vE=0,wE=0;const Ad=new Map;let Q5=0;class An extends vb{get isIdle(){return this.idle}get isCompact(){return this.option("compact")}constructor(e=[],n={},r={}){super(n),Object.defineProperty(this,"userSlides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"idle",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"idleTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"pwt",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"ignoreFocusChange",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"startedFs",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:$r.Init}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"footer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"lastFocus",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"prevMouseMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),zs||(zs=W2()),this.id=n.id||++Q5,Ad.set(this.id,this),this.userSlides=e,this.userPlugins=r,queueMicrotask(()=>{this.init()})}init(){if(this.state===$r.Destroy)return;this.state=$r.Init,this.attachPlugins(Object.assign(Object.assign({},An.Plugins),this.userPlugins)),this.emit("init"),this.emit("attachPlugins"),this.option("hideScrollbar")===!0&&(()=>{if(!Eh)return;const n=document,r=n.body,i=n.documentElement;if(r.classList.contains(Nb))return;let s=window.innerWidth-i.getBoundingClientRect().width;const a=parseFloat(window.getComputedStyle(r).marginRight);s<0&&(s=0),i.style.setProperty(pE,`${s}px`),a&&r.style.setProperty(fE,`${a}px`),r.classList.add(Nb)})(),this.initLayout(),this.scale();const e=()=>{this.initCarousel(this.userSlides),this.state=$r.Ready,this.attachEvents(),this.emit("ready"),setTimeout(()=>{this.container&&this.container.setAttribute(Rb,"false")},16)};this.option("Fullscreen.autoStart")&&zs&&!zs.isFullscreen()?zs.request().then(()=>{this.startedFs=!0,e()}).catch(()=>e()):e()}initLayout(){var e,n;const r=this.option("parentEl")||document.body,i=wo(this.localize(this.option("tpl.main")||""));if(i){if(i.setAttribute("id",`fancybox-${this.id}`),i.setAttribute("aria-label",this.localize("{{MODAL}}")),i.classList.toggle(mE,this.isCompact),Bt(i,this.option("mainClass")||""),Bt(i,Vb),this.container=i,this.footer=i.querySelector(".fancybox__footer"),r.appendChild(i),Bt(document.documentElement,hE),Ls&&ec||(Ls=document.createElement("span"),Bt(Ls,"fancybox-focus-guard"),Ls.setAttribute(Ql,"0"),Ls.setAttribute(Rb,"true"),Ls.setAttribute("aria-label","Focus guard"),ec=Ls.cloneNode(),(e=i.parentElement)===null||e===void 0||e.insertBefore(Ls,i),(n=i.parentElement)===null||n===void 0||n.append(ec)),i.addEventListener("mousedown",s=>{_E=s.pageX,xE=s.pageY,Fn(i,Ob)}),this.option("closeExisting"))for(const s of Ad.values())s.id!==this.id&&s.close();else this.option("animated")&&(Bt(i,Bb),setTimeout(()=>{this.isClosing()||Fn(i,Bb)},350));this.emit("initLayout")}}initCarousel(e){const n=this.container;if(!n)return;const r=n.querySelector(".fancybox__carousel");if(!r)return;const i=this.carousel=new kh(r,Qi({},{slides:e,transition:"fade",Panzoom:{lockAxis:this.option("dragToClose")?"xy":"x",infinite:!!this.option("dragToClose")&&"y"},Dots:!1,Navigation:{classes:{container:"fancybox__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"}},initialPage:this.option("startIndex"),l10n:this.option("l10n")},this.option("Carousel")||{}));i.on("*",(s,a,...o)=>{this.emit(`Carousel.${a}`,s,...o)}),i.on(["ready","change"],()=>{this.manageCaption()}),this.on("Carousel.removeSlide",(s,a,o)=>{this.clearContent(o),o.state=void 0}),i.on("Panzoom.touchStart",()=>{var s,a;this.isCompact||this.endIdle(),!((s=document.activeElement)===null||s===void 0)&&s.closest(".f-thumbs")&&((a=this.container)===null||a===void 0||a.focus())}),i.on("settle",()=>{this.idleTimer||this.isCompact||!this.option("idle")||this.setIdle(),this.option("autoFocus")&&!this.isClosing&&this.checkFocus()}),this.option("dragToClose")&&(i.on("Panzoom.afterTransform",(s,a)=>{const o=this.getSlide();if(o&&yb(o.el))return;const f=this.container;if(f){const g=Math.abs(a.current.f),y=g<1?"":Math.max(.5,Math.min(1,1-g/a.contentRect.fitHeight*1.5));f.style.setProperty("--fancybox-ts",y?"0s":""),f.style.setProperty("--fancybox-opacity",y+"")}}),i.on("Panzoom.touchEnd",(s,a,o)=>{var f;const g=this.getSlide();if(g&&yb(g.el)||a.isMobile&&document.activeElement&&["TEXTAREA","INPUT"].indexOf((f=document.activeElement)===null||f===void 0?void 0:f.nodeName)!==-1)return;const y=Math.abs(a.dragOffset.y);a.lockedAxis==="y"&&(y>=200||y>=50&&a.dragOffset.time<300)&&(o&&o.cancelable&&o.preventDefault(),this.close(o,"f-throwOut"+(a.current.f<0?"Up":"Down")))})),i.on("change",s=>{var a;let o=(a=this.getSlide())===null||a===void 0?void 0:a.triggerEl;if(o){const f=new CustomEvent("slideTo",{bubbles:!0,cancelable:!0,detail:s.page});o.dispatchEvent(f)}}),i.on(["refresh","change"],s=>{const a=this.container;if(!a)return;for(const g of a.querySelectorAll("[data-fancybox-current-index]"))g.innerHTML=s.page+1;for(const g of a.querySelectorAll("[data-fancybox-count]"))g.innerHTML=s.pages.length;if(!s.isInfinite){for(const g of a.querySelectorAll("[data-fancybox-next]"))s.page<s.pages.length-1?(g.removeAttribute(Cd),g.removeAttribute(Ql)):(g.setAttribute(Cd,""),g.setAttribute(Ql,"-1"));for(const g of a.querySelectorAll("[data-fancybox-prev]"))s.page>0?(g.removeAttribute(Cd),g.removeAttribute(Ql)):(g.setAttribute(Cd,""),g.setAttribute(Ql,"-1"))}const o=this.getSlide();if(!o)return;let f=o.downloadSrc||"";f||o.type!=="image"||o.error||!Ga(o[Td])||(f=o[Td]);for(const g of a.querySelectorAll("[data-fancybox-download]")){const y=o.downloadFilename;f?(g.removeAttribute(Cd),g.removeAttribute(Ql),g.setAttribute(zb,f),g.setAttribute(yE,y||f),g.setAttribute("target","_blank")):(g.setAttribute(Cd,""),g.setAttribute(Ql,"-1"),g.removeAttribute(zb),g.removeAttribute(yE))}}),this.emit("initCarousel")}attachEvents(){const e=this,n=e.container;if(!n)return;n.addEventListener("click",e.onClick,{passive:!1,capture:!1}),n.addEventListener("wheel",e.onWheel,{passive:!1,capture:!1}),document.addEventListener("keydown",e.onKeydown,{passive:!1,capture:!0}),document.addEventListener("visibilitychange",e.onVisibilityChange,!1),document.addEventListener("mousemove",e.onMousemove),e.option("trapFocus")&&document.addEventListener("focus",e.onFocus,!0),window.addEventListener("resize",e.onResize);const r=window.visualViewport;r&&(r.addEventListener("scroll",e.onResize),r.addEventListener("resize",e.onResize))}detachEvents(){const e=this,n=e.container;if(!n)return;document.removeEventListener("keydown",e.onKeydown,{passive:!1,capture:!0}),n.removeEventListener("wheel",e.onWheel,{passive:!1,capture:!1}),n.removeEventListener("click",e.onClick,{passive:!1,capture:!1}),document.removeEventListener("mousemove",e.onMousemove),window.removeEventListener("resize",e.onResize);const r=window.visualViewport;r&&(r.removeEventListener("resize",e.onResize),r.removeEventListener("scroll",e.onResize)),document.removeEventListener("visibilitychange",e.onVisibilityChange,!1),document.removeEventListener("focus",e.onFocus,!0)}scale(){const e=this.container;if(!e)return;const n=window.visualViewport,r=Math.max(1,(n==null?void 0:n.scale)||1);let i="",s="",a="";if(n&&r>1){let o=`${n.offsetLeft}px`,f=`${n.offsetTop}px`;i=n.width*r+"px",s=n.height*r+"px",a=`translate3d(${o}, ${f}, 0) scale(${1/r})`}e.style.transform=a,e.style.width=i,e.style.height=s}onClick(e){var n;const{container:r,isCompact:i}=this;if(!r||this.isClosing())return;!i&&this.option("idle")&&this.resetIdle();const s=e.composedPath()[0];if(s.closest(".fancybox-spinner")||s.closest("[data-fancybox-close]"))return e.preventDefault(),void this.close(e);if(s.closest("[data-fancybox-prev]"))return e.preventDefault(),void this.prev();if(s.closest("[data-fancybox-next]"))return e.preventDefault(),void this.next();if(e.type==="click"&&e.detail===0||Math.abs(e.pageX-_E)>30||Math.abs(e.pageY-xE)>30)return;const a=document.activeElement;if(bE()&&a&&r.contains(a))return;if(i&&((n=this.getSlide())===null||n===void 0?void 0:n.type)==="image")return void(this.clickTimer?(clearTimeout(this.clickTimer),this.clickTimer=null):this.clickTimer=setTimeout(()=>{this.toggleIdle(),this.clickTimer=null},350));if(this.emit("click",e),e.defaultPrevented)return;let o=!1;if(s.closest(".fancybox__content")){if(a){if(a.closest("[contenteditable]"))return;s.matches(Tb)||a.blur()}if(bE())return;o=this.option("contentClick")}else s.closest(".fancybox__carousel")&&!s.matches(Tb)&&(o=this.option("backdropClick"));o==="close"?(e.preventDefault(),this.close(e)):o==="next"?(e.preventDefault(),this.next()):o==="prev"&&(e.preventDefault(),this.prev())}onWheel(e){const n=e.target;let r=this.option("wheel",e);n.closest(".fancybox__thumbs")&&(r="slide");const i=r==="slide",s=[-e.deltaX||0,-e.deltaY||0,-e.detail||0].reduce(function(f,g){return Math.abs(g)>Math.abs(f)?g:f}),a=Math.max(-1,Math.min(1,s)),o=Date.now();this.pwt&&o-this.pwt<300?i&&e.preventDefault():(this.pwt=o,this.emit("wheel",e,a),e.defaultPrevented||(r==="close"?(e.preventDefault(),this.close(e)):r==="slide"&&(dm(n)||(e.preventDefault(),this[a>0?"prev":"next"]()))))}onScroll(){window.scrollTo(vE,wE)}onKeydown(e){if(!this.isTopmost())return;this.isCompact||!this.option("idle")||this.isClosing()||this.resetIdle();const n=e.key,r=this.option("keyboard");if(!r)return;const i=e.composedPath()[0],s=document.activeElement&&document.activeElement.classList,a=s&&s.contains("f-button")||i.dataset.carouselPage||i.dataset.carouselIndex;if(n!=="Escape"&&!a&&es(i)&&(i.isContentEditable||["TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].indexOf(i.nodeName)!==-1)||(e.key==="Tab"?Bt(this.container,Ob):Fn(this.container,Ob),e.ctrlKey||e.altKey||e.shiftKey))return;this.emit("keydown",n,e);const o=r[n];o&&typeof this[o]=="function"&&(e.preventDefault(),this[o]())}onResize(){const e=this.container;if(!e)return;const n=this.isCompact;e.classList.toggle(mE,n),this.manageCaption(this.getSlide()),this.isCompact?this.clearIdle():this.endIdle(),this.scale(),this.emit("resize")}onFocus(e){this.isTopmost()&&this.checkFocus(e)}onMousemove(e){this.prevMouseMoveEvent=e,!this.isCompact&&this.option("idle")&&this.resetIdle()}onVisibilityChange(){document.visibilityState==="visible"?this.checkFocus():this.endIdle()}manageCloseBtn(e){const n=this.optionFor(e,"closeButton")||!1;if(n==="auto"){const i=this.plugins.Toolbar;if(i&&i.state===Jl.Ready)return}if(!n||!e.contentEl||e.closeBtnEl)return;const r=this.option("tpl.closeButton");if(r){const i=wo(this.localize(r));e.closeBtnEl=e.contentEl.appendChild(i),e.el&&Bt(e.el,"has-close-btn")}}manageCaption(e=void 0){var n,r;const i="fancybox__caption",s=this.container;if(!s)return;Fn(s,Em);const a=this.isCompact||this.option("commonCaption"),o=!a;if(this.caption&&this.stop(this.caption),o&&this.caption&&(this.caption.remove(),this.caption=null),a&&!this.caption)for(const v of((n=this.carousel)===null||n===void 0?void 0:n.slides)||[])v.captionEl&&(v.captionEl.remove(),v.captionEl=void 0,Fn(v.el,Em),(r=v.el)===null||r===void 0||r.removeAttribute("aria-labelledby"));if(e||(e=this.getSlide()),!e||a&&!this.isCurrentSlide(e))return;const f=e.el;let g=this.optionFor(e,"caption","");if(!g)return void(a&&this.caption&&this.animate(this.caption,"f-fadeOut",()=>{this.caption&&(this.caption.innerHTML="")}));let y=null;if(o){if(y=e.captionEl||null,f&&!y){const v=i+`_${this.id}_${e.index}`;y=document.createElement("div"),Bt(y,i),y.setAttribute("id",v),e.captionEl=f.appendChild(y),Bt(f,Em),f.setAttribute("aria-labelledby",v)}}else y=this.caption,y||(y=s.querySelector("."+i)),!y&&(y=document.createElement("div"),y.dataset.fancyboxCaption="",Bt(y,i),(this.footer||s).prepend(y)),Bt(s,Em),this.caption=y;y&&(y.innerHTML="",Ga(g)||typeof g=="number"?y.innerHTML=g+"":g instanceof HTMLElement&&y.appendChild(g))}checkFocus(e){this.focus(e)}focus(e){var n;if(this.ignoreFocusChange)return;const r=document.activeElement||null,i=(e==null?void 0:e.target)||null,s=this.container,a=(n=this.carousel)===null||n===void 0?void 0:n.viewport;if(!s||!a||!e&&r&&s.contains(r))return;const o=this.getSlide(),f=o&&o.state===xi.Ready?o.el:null;if(!f||f.contains(r)||s===r)return;e&&e.cancelable&&e.preventDefault(),this.ignoreFocusChange=!0;const g=Array.from(s.querySelectorAll(Tb));let y=[],v=null;for(let T of g){const D=!T.offsetParent||!!T.closest('[aria-hidden="true"]'),O=f&&f.contains(T),B=!a.contains(T);if(T===s||(O||B)&&!D){y.push(T);const L=T.dataset.origTabindex;L!==void 0&&L&&(T.tabIndex=parseFloat(L)),T.removeAttribute("data-orig-tabindex"),!T.hasAttribute("autoFocus")&&v||(v=T)}else{const L=T.dataset.origTabindex===void 0?T.getAttribute("tabindex")||"":T.dataset.origTabindex;L&&(T.dataset.origTabindex=L),T.tabIndex=-1}}let w=null;e?(!i||y.indexOf(i)<0)&&(w=v||s,y.length&&(r===ec?w=y[0]:this.lastFocus!==s&&r!==Ls||(w=y[y.length-1]))):w=o&&o.type==="image"?s:v||s,w&&U2(w),this.lastFocus=document.activeElement,this.ignoreFocusChange=!1}next(){const e=this.carousel;e&&e.pages.length>1&&e.slideNext()}prev(){const e=this.carousel;e&&e.pages.length>1&&e.slidePrev()}jumpTo(...e){this.carousel&&this.carousel.slideTo(...e)}isTopmost(){var e;return((e=An.getInstance())===null||e===void 0?void 0:e.id)==this.id}animate(e=null,n="",r){if(!e||!n)return void(r&&r());this.stop(e);const i=s=>{s.target===e&&e.dataset.animationName&&(e.removeEventListener("animationend",i),delete e.dataset.animationName,r&&r(),Fn(e,n))};e.dataset.animationName=n,e.addEventListener("animationend",i),Bt(e,n)}stop(e){e&&e.dispatchEvent(new CustomEvent("animationend",{bubbles:!1,cancelable:!0,currentTarget:e}))}setContent(e,n="",r=!0){if(this.isClosing())return;const i=e.el;if(!i)return;let s=null;if(es(n)?s=n:(s=wo(n+""),es(s)||(s=document.createElement("div"),s.innerHTML=n+"")),["img","picture","iframe","video","audio"].includes(s.nodeName.toLowerCase())){const a=document.createElement("div");a.appendChild(s),s=a}es(s)&&e.filter&&!e.error&&(s=s.querySelector(e.filter)),s&&es(s)?(Bt(s,"fancybox__content"),e.id&&s.setAttribute("id",e.id),i.classList.add(`has-${e.error?"error":e.type||"unknown"}`),i.prepend(s),s.style.display==="none"&&(s.style.display=""),getComputedStyle(s).getPropertyValue("display")==="none"&&(s.style.display=e.display||this.option("defaultDisplay")||"flex"),e.contentEl=s,r&&this.revealContent(e),this.manageCloseBtn(e),this.manageCaption(e)):this.setError(e,"{{ELEMENT_NOT_FOUND}}")}revealContent(e,n){const r=e.el,i=e.contentEl;r&&i&&(this.emit("reveal",e),this.hideLoading(e),e.state=xi.Opening,(n=this.isOpeningSlide(e)?n===void 0?this.optionFor(e,"showClass"):n:"f-fadeIn")?this.animate(i,n,()=>{this.done(e)}):this.done(e))}done(e){this.isClosing()||(e.state=xi.Ready,this.emit("done",e),Bt(e.el,"is-done"),this.isCurrentSlide(e)&&this.option("autoFocus")&&queueMicrotask(()=>{var n;(n=e.panzoom)===null||n===void 0||n.updateControls(),this.option("autoFocus")&&this.focus()}),this.isOpeningSlide(e)&&(Fn(this.container,Vb),!this.isCompact&&this.option("idle")&&this.setIdle()))}isCurrentSlide(e){const n=this.getSlide();return!(!e||!n)&&n.index===e.index}isOpeningSlide(e){var n,r;return((n=this.carousel)===null||n===void 0?void 0:n.prevPage)===null&&e&&e.index===((r=this.getSlide())===null||r===void 0?void 0:r.index)}showLoading(e){e.state=xi.Loading;const n=e.el;n&&(Bt(n,gE),this.emit("loading",e),e.spinnerEl||setTimeout(()=>{if(!this.isClosing()&&!e.spinnerEl&&e.state===xi.Loading){let r=wo(wb);Bt(r,"fancybox-spinner"),e.spinnerEl=r,n.prepend(r),this.animate(r,"f-fadeIn")}},250))}hideLoading(e){const n=e.el;if(!n)return;const r=e.spinnerEl;this.isClosing()?r==null||r.remove():(Fn(n,gE),r&&this.animate(r,"f-fadeOut",()=>{r.remove()}),e.state===xi.Loading&&(this.emit("loaded",e),e.state=xi.Ready))}setError(e,n){if(this.isClosing())return;const r=new Event("error",{bubbles:!0,cancelable:!0});if(this.emit("error",r,e),r.defaultPrevented)return;e.error=n,this.hideLoading(e),this.clearContent(e);const i=document.createElement("div");i.classList.add("fancybox-error"),i.innerHTML=this.localize(n||"<p>{{ERROR}}</p>"),this.setContent(e,i)}clearContent(e){if(e.state===void 0)return;this.emit("clearContent",e),e.contentEl&&(e.contentEl.remove(),e.contentEl=void 0);const n=e.el;n&&(Fn(n,"has-error"),Fn(n,"has-unknown"),Fn(n,`has-${e.type||"unknown"}`)),e.closeBtnEl&&e.closeBtnEl.remove(),e.closeBtnEl=void 0,e.captionEl&&e.captionEl.remove(),e.captionEl=void 0,e.spinnerEl&&e.spinnerEl.remove(),e.spinnerEl=void 0}getSlide(){var e;const n=this.carousel;return((e=n==null?void 0:n.pages[n==null?void 0:n.page])===null||e===void 0?void 0:e.slides[0])||void 0}close(e,n){if(this.isClosing())return;const r=new Event("shouldClose",{bubbles:!0,cancelable:!0});if(this.emit("shouldClose",r,e),r.defaultPrevented)return;e&&e.cancelable&&(e.preventDefault(),e.stopPropagation());const i=()=>{this.proceedClose(e,n)};this.startedFs&&zs&&zs.isFullscreen()?Promise.resolve(zs.exit()).then(()=>i()):i()}clearIdle(){this.idleTimer&&clearTimeout(this.idleTimer),this.idleTimer=null}setIdle(e=!1){const n=()=>{this.clearIdle(),this.idle=!0,Bt(this.container,"is-idle"),this.emit("setIdle")};if(this.clearIdle(),!this.isClosing())if(e)n();else{const r=this.option("idle");r&&(this.idleTimer=setTimeout(n,r))}}endIdle(){this.clearIdle(),this.idle&&!this.isClosing()&&(this.idle=!1,Fn(this.container,"is-idle"),this.emit("endIdle"))}resetIdle(){this.endIdle(),this.setIdle()}toggleIdle(){this.idle?this.endIdle():this.setIdle(!0)}toggleFullscreen(){zs&&(zs.isFullscreen()?zs.exit():zs.request().then(()=>{this.startedFs=!0}))}isClosing(){return[$r.Closing,$r.CustomClosing,$r.Destroy].includes(this.state)}proceedClose(e,n){var r,i;this.state=$r.Closing,this.clearIdle(),this.detachEvents();const s=this.container,a=this.carousel,o=this.getSlide(),f=o&&this.option("placeFocusBack")?o.triggerEl||this.option("triggerEl"):null;if(f&&(H2(f)?U2(f):f.focus()),s&&(Fn(s,Vb),Bt(s,"is-closing"),s.setAttribute(Rb,"true"),this.option("animated")&&Bt(s,Bb),s.style.pointerEvents="none"),a){a.clearTransitions(),(r=a.panzoom)===null||r===void 0||r.destroy(),(i=a.plugins.Navigation)===null||i===void 0||i.detach();for(const g of a.slides){g.state=xi.Closing,this.hideLoading(g);const y=g.contentEl;y&&this.stop(y);const v=g==null?void 0:g.panzoom;v&&(v.stop(),v.detachEvents(),v.detachObserver()),this.isCurrentSlide(g)||a.emit("removeSlide",g)}}vE=window.scrollX,wE=window.scrollY,window.addEventListener("scroll",this.onScroll),this.emit("close",e),this.state!==$r.CustomClosing?(n===void 0&&o&&(n=this.optionFor(o,"hideClass")),n&&o?(this.animate(o.contentEl,n,()=>{a&&a.emit("removeSlide",o)}),setTimeout(()=>{this.destroy()},500)):this.destroy()):setTimeout(()=>{this.destroy()},500)}destroy(){var e;if(this.state===$r.Destroy)return;window.removeEventListener("scroll",this.onScroll),this.state=$r.Destroy,(e=this.carousel)===null||e===void 0||e.destroy();const n=this.container;n&&n.remove(),Ad.delete(this.id);const r=An.getInstance();r?r.focus():(Ls&&(Ls.remove(),Ls=null),ec&&(ec.remove(),ec=null),Fn(document.documentElement,hE),(()=>{if(!Eh)return;const i=document,s=i.body;s.classList.remove(Nb),s.style.setProperty(fE,""),i.documentElement.style.setProperty(pE,"")})(),this.emit("destroy"))}static bind(e,n,r){if(!Eh)return;let i,s="",a={};if(e===void 0?i=document.body:Ga(e)?(i=document.body,s=e,typeof n=="object"&&(a=n||{})):(i=e,Ga(n)&&(s=n),typeof r=="object"&&(a=r||{})),!i||!es(i))return;s=s||"[data-fancybox]";const o=An.openers.get(i)||new Map;o.set(s,a),An.openers.set(i,o),o.size===1&&i.addEventListener("click",An.fromEvent)}static unbind(e,n){let r,i="";if(Ga(e)?(r=document.body,i=e):(r=e,Ga(n)&&(i=n)),!r)return;const s=An.openers.get(r);s&&i&&s.delete(i),i&&s||(An.openers.delete(r),r.removeEventListener("click",An.fromEvent))}static destroy(){let e;for(;e=An.getInstance();)e.destroy();for(const n of An.openers.keys())n.removeEventListener("click",An.fromEvent);An.openers=new Map}static fromEvent(e){if(e.defaultPrevented||e.button&&e.button!==0||e.ctrlKey||e.metaKey||e.shiftKey)return;let n=e.composedPath()[0];const r=n.closest("[data-fancybox-trigger]");if(r){const D=r.dataset.fancyboxTrigger||"",O=document.querySelectorAll(`[data-fancybox="${D}"]`),B=parseInt(r.dataset.fancyboxIndex||"",10)||0;n=O[B]||n}if(!(n&&n instanceof Element))return;let i,s,a,o;if([...An.openers].reverse().find(([D,O])=>!(!D.contains(n)||![...O].reverse().find(([B,L])=>{let U=n.closest(B);return!!U&&(i=D,s=B,a=U,o=L,!0)}))),!i||!s||!a)return;o=o||{},e.preventDefault(),n=a;let f=[],g=Qi({},Ab,o);g.event=e,g.triggerEl=n,g.delegate=r;const y=g.groupAll,v=g.groupAttr,w=v&&n?n.getAttribute(`${v}`):"";if((!n||w||y)&&(f=[].slice.call(i.querySelectorAll(s))),n&&!y&&(f=w?f.filter(D=>D.getAttribute(`${v}`)===w):[n]),!f.length)return;const T=An.getInstance();return T&&T.options.triggerEl&&f.indexOf(T.options.triggerEl)>-1?void 0:(n&&(g.startIndex=f.indexOf(n)),An.fromNodes(f,g))}static fromSelector(e,n,r){let i=null,s="",a={};if(Ga(e)?(i=document.body,s=e,typeof n=="object"&&(a=n||{})):e instanceof HTMLElement&&Ga(n)&&(i=e,s=n,typeof r=="object"&&(a=r||{})),!i||!s)return!1;const o=An.openers.get(i);return!!o&&(a=Qi({},o.get(s)||{},a),!!a&&An.fromNodes(Array.from(i.querySelectorAll(s)),a))}static fromNodes(e,n){n=Qi({},Ab,n||{});const r=[];for(const i of e){const s=i.dataset||{},a=s[Td]||i.getAttribute(zb)||i.getAttribute("currentSrc")||i.getAttribute(Td)||void 0;let o;const f=n.delegate;let g;f&&r.length===n.startIndex&&(o=f instanceof HTMLImageElement?f:f.querySelector("img:not([aria-hidden])")),o||(o=i instanceof HTMLImageElement?i:i.querySelector("img:not([aria-hidden])")),o&&(g=o.currentSrc||o[Td]||void 0,!g&&o.dataset&&(g=o.dataset.lazySrc||o.dataset[Td]||void 0));const y={src:a,triggerEl:i,thumbEl:o,thumbElSrc:g,thumbSrc:g};for(const v in s){let w=s[v]+"";w=w!=="false"&&(w==="true"||w),y[v]=w}r.push(y)}return new An(r,n)}static getInstance(e){return e?Ad.get(e):Array.from(Ad.values()).reverse().find(n=>!n.isClosing()&&n)||null}static getSlide(){var e;return((e=An.getInstance())===null||e===void 0?void 0:e.getSlide())||null}static show(e=[],n={}){return new An(e,n)}static next(){const e=An.getInstance();e&&e.next()}static prev(){const e=An.getInstance();e&&e.prev()}static close(e=!0,...n){if(e)for(const r of Ad.values())r.close(...n);else{const r=An.getInstance();r&&r.close(...n)}}}Object.defineProperty(An,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.36"}),Object.defineProperty(An,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:Ab}),Object.defineProperty(An,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:J5}),Object.defineProperty(An,"openers",{enumerable:!0,configurable:!0,writable:!0,value:new Map});const Sm=Object.freeze(Object.defineProperty({__proto__:null,Carousel:kh,Fancybox:An,Panzoom:Ed},Symbol.toStringTag,{value:"Module"})),{Fancybox:Cm}=Sm,eL={props:{options:Object},mounted(){Cm.defaults={...this.options||{}}},updated(){Cm.close(),Cm.defaults={...this.options||{}}},unmounted(){Cm.close()}},tL={ref:"container"};function nL(t,e,n,r,i,s){return d.openBlock(),d.createElementBlock("div",tL,[d.renderSlot(t.$slots,"default")],512)}const rL=Le(eL,[["render",nL]]),iL={},sL={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-file"};function oL(t,e,n,r,i,s){return d.openBlock(),d.createElementBlock("svg",sL,e[0]||(e[0]=[d.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),d.createElementVNode("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"},null,-1),d.createElementVNode("path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"},null,-1)]))}const kE=Le(iL,[["render",oL]]),aL={componens:{IconFile:kE},props:{item:null},computed:{createDate(){try{const t=_t(this.item.cdate,"YYYY-MM-DD");return new Date(t).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}}},methods:{formatBytes(t){if(t<1024)return`${t} B`;const e=t/1024;return e<1024?`${e.toFixed(2)} KB`:`${(e/1024).toFixed(2)} MB`}}},lL={class:"max-w-[55vw]"},cL={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},dL={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},uL={class:"px-[5px]"},hL={class:""};function pL(t,e,n,r,i,s){var a,o;return d.openBlock(),d.createElementBlock(d.Fragment,null,[e[1]||(e[1]=d.createStaticVNode('<div class="flex items-center justify-center h-[30px] w-[30px]"><svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-file"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path></svg></div>',1)),d.createElementVNode("div",lL,[d.createElementVNode("p",cL,d.toDisplayString(n.item.uploaded_name),1),d.createElementVNode("p",dL,[d.createElementVNode("span",null,d.toDisplayString(n.item.username),1),d.withDirectives(d.createElementVNode("span",uL,"|",512),[[d.vShow,(a=n.item)==null?void 0:a.username]]),d.createElementVNode("span",null,d.toDisplayString(s.createDate),1),e[0]||(e[0]=d.createElementVNode("span",{class:"px-[5px]"},"|",-1)),d.createElementVNode("span",hL,d.toDisplayString(s.formatBytes((o=n.item)==null?void 0:o.size)),1)])])],64)}const fL=Le(aL,[["render",pL]]),mL={},gL={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function yL(t,e,n,r,i,s){return d.openBlock(),d.createElementBlock("svg",gL,e[0]||(e[0]=[d.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),d.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),d.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),d.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const EE=Le(mL,[["render",yL]]),bL={},_L={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-trash"};function xL(t,e,n,r,i,s){return d.openBlock(),d.createElementBlock("svg",_L,e[0]||(e[0]=[d.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7l16 0"></path><path d="M10 11l0 6"></path><path d="M14 11l0 6"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>',6)]))}const SE=Le(bL,[["render",xL]]),vL={components:{Fancybox:rL,VsWidgetFileInfo:fL,IconDownload:EE,IconTrash:SE},props:{item:null,prefix:{type:String,default:"/api"},disabled:{type:Boolean,default:!1}},data(){return{optionsFile:{defaultType:"iframe"}}},computed:{createDate(){try{const t=_t(this.item.cdate,"YYYY-MM-DD");return new Date(t).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}}},methods:{isSupportedFile(t){return["pdf","json"].includes(t.ext)},isSupportedAllFile(t){return["ppt","pptx","doc","docx","xls","xlsx"].includes(t.ext)},async downloadFile(t){const e=document.createElement("a");e.setAttribute("download",t.uploaded_name),e.href=t.file_path,e.click()},confirnDeleteFile(){this.$emit("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:this.deleteFile,updateListOnConfirm:!0})},async deleteFile(){try{await Ue.delete(`${this.prefix}/widget/file/${this.item.entity_id}/${this.item.file_id}`),this.$emit("update")}catch(t){console.error(t)}}}},wL={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},kL={key:0,class:"flex w-full gap-x-3 items-center"},EL=["href"],SL={key:1,class:"flex gap-x-3 w-full items-center"},CL=["href"],TL={key:2,class:"flex gap-x-3 w-full items-center"},AL=["href"],ML={key:3,class:"flex gap-x-3 w-full items-center"},DL={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},IL={class:"p-0.5 sm:p-1 inline-flex items-center gap-0.5 bg-white rounded-lg dark:bg-neutral-800 dark:border-neutral-700"},PL={class:"inline-block"},NL=["disabled"],RL={class:"inline-block"},OL=["disabled"];function BL(t,e,n,r,i,s){const a=d.resolveComponent("VsWidgetFileInfo"),o=d.resolveComponent("Fancybox"),f=d.resolveComponent("IconDownload"),g=d.resolveComponent("IconTrash");return d.openBlock(),d.createElementBlock("div",wL,[n.item.ext==="jpg"||n.item.ext==="png"?(d.openBlock(),d.createElementBlock("div",kL,[d.createVNode(o,null,{default:d.withCtx(()=>[d.createElementVNode("a",{"data-fancybox":"gallery",href:n.item.file_path,target:"_blank",class:"flex gap-x-3 w-full items-center"},[d.createVNode(a,{item:n.item},null,8,["item"])],8,EL)]),_:1})])):s.isSupportedFile(n.item)?(d.openBlock(),d.createElementBlock("div",SL,[d.createVNode(o,{options:i.optionsFile},{default:d.withCtx(()=>[d.createElementVNode("a",{"data-fancybox":"gallery",href:n.item.file_path,target:"_blank",class:"flex gap-x-3 w-full items-center"},[d.createVNode(a,{item:n.item},null,8,["item"])],8,CL)]),_:1},8,["options"])])):s.isSupportedAllFile(n.item)?(d.openBlock(),d.createElementBlock("div",TL,[d.createElementVNode("a",{href:`/api/file-preview?id=${n.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[d.createVNode(a,{item:n.item},null,8,["item"])],8,AL)])):(d.openBlock(),d.createElementBlock("div",ML,[d.createVNode(a,{item:n.item},null,8,["item"])])),d.createElementVNode("div",DL,[d.createElementVNode("div",IL,[d.createElementVNode("div",PL,[d.createElementVNode("button",{class:"inline-flex p-[6px] justify-center items-center gap-x-2 rounded-lg border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-400 focus:outline-none focus:bg-gray-100 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[0]||(e[0]=y=>s.downloadFile(n.item)),disabled:n.disabled},[d.createVNode(f,{height:"14",width:"14"})],8,NL)]),e[2]||(e[2]=d.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),d.createElementVNode("div",RL,[d.createElementVNode("button",{type:"button",class:"size-[30px] inline-flex justify-center items-center gap-x-2 rounded-lg border border-transparent text-red-600 hover:bg-red-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-red-100 dark:text-red-500 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",onClick:e[1]||(e[1]=y=>s.confirnDeleteFile()),disabled:n.disabled},[d.createVNode(g,{height:"14",width:"14"})],8,OL)])])])])}const VL=Le(vL,[["render",BL]]),zL={props:["text"]},LL={class:"pl-3 text-sm font-medium text-gray-600"};function FL(t,e,n,r,i,s){return d.openBlock(),d.createElementBlock("div",null,[d.createElementVNode("p",LL,d.toDisplayString(n.text),1)])}const CE=Le(zL,[["render",FL]]),$L={},jL={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-upload"};function HL(t,e,n,r,i,s){return d.openBlock(),d.createElementBlock("svg",jL,e[0]||(e[0]=[d.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),d.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),d.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),d.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const UL=Le($L,[["render",HL]]),{Fancybox:WL}=Sm,qL={components:{VsWidgetFileItem:VL,VsEmptyWidget:CE,IconUpload:UL},props:{id:{type:String,default(){return""}},prefilledData:{},prefix:{type:String,default:"/api"},disabled:{type:Boolean,default:!1}},data(){return{isModalVisible:!1,modal:{},files:"",searchValue:""}},mounted(){this.getFileList()},computed:{filteredFiles(){return this.searchValue===""?this.files:this.files.filter(e=>e.uploaded_name.includes(this.searchValue))}},methods:{async getFileList(){if(this.prefilledData){this.files=this.prefilledData.rows;return}try{const{data:t}=await Ue.get(`${this.prefix}/widget/file/${this.id}`);WL.bind("[data-fancybox='gallery']"),this.files=t==null?void 0:t.rows}catch(t){console.error(t)}},async addFile(t){console.log(t),await Promise.all(Array.from(t.target.files).map(async e=>{const n=new FormData;n.append("file",e);try{const r=`${this.prefix}/widget/file/${this.id}`;return await Ue.post(r,n),this.$emit("update","file-list"),e}catch(r){return console.error(r),null}})),await this.getFileList()},prepareModal(t){const e={...t};return t.cancel||(e.cancel=()=>{this.isModalVisible=!1}),t.updateListOnConfirm&&(e.confirm=async()=>{await t.confirm(),this.isModalVisible=!1,this.getFileList()}),e},handleOpenModal(t){this.modal=this.prepareModal(t),this.isModalVisible=!0}}},GL={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700"},YL={class:"flex w-full mb-[12px] items-center gap-x-2"},ZL={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},XL={class1:"ml-auto"},KL={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},JL={class:"relative"},QL={key:1,class:"space-y-3 max-h-[300px] overflow-y-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},eF={key:0},tF={class:"p-4"},nF={class:"mt-1 text-gray-500 dark:text-neutral-500"},rF={class:"flex justify-end mt-4 gap-x-3"};function iF(t,e,n,r,i,s){var g,y;const a=d.resolveComponent("IconUpload"),o=d.resolveComponent("VsWidgetFileItem"),f=d.resolveComponent("VsDialog");return d.openBlock(),d.createElementBlock("div",GL,[d.createElementVNode("div",YL,[d.createElementVNode("h2",ZL," Файлів: "+d.toDisplayString(i.files.length),1),d.createElementVNode("div",XL,[d.createElementVNode("label",null,[d.createElementVNode("input",{type:"file",class:"hidden",onChange:e[0]||(e[0]=v=>s.addFile(v))},null,32),d.createElementVNode("div",{class:d.normalizeClass(["py-1.5 px-4 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg bg-gray-100 cursor-pointer hover:bg-gray-200 text-gray-800 shadow-2xs hover:bg-gray-50 focus:outline-hidden focus:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",{hidden:n.disabled}])},[d.createVNode(a,{height:"16",width:"16"})],2)])])]),((g=i.files)==null?void 0:g.length)>4?(d.openBlock(),d.createElementBlock("div",KL,[d.createElementVNode("div",null,[d.createElementVNode("div",JL,[e[7]||(e[7]=d.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-[1] ps-3.5"},[d.createElementVNode("svg",{class:"flex-shrink-0 text-gray-500 size-4 dark:text-neutral-400",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[d.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),d.createElementVNode("path",{d:"m21 21-4.3-4.3"})])],-1)),d.withDirectives(d.createElementVNode("input",{type:"text","onUpdate:modelValue":e[1]||(e[1]=v=>i.searchValue=v),class:"py-2 px-3 ps-10 pe-16 block w-full bg-gray-200 xl:bg-gray-100 rounded-lg text-sm focus:border-blue-500 h-[40px] focus:border-2 focus:outline-none disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-600",placeholder:"Введіть назву файлу"},null,512),[[d.vModelText,i.searchValue,void 0,{trim:!0}]])])])])):d.createCommentVNode("",!0),(y=i.files)!=null&&y.length?(d.openBlock(),d.createElementBlock("div",QL,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(s.filteredFiles,(v,w)=>(d.openBlock(),d.createBlock(o,{key:w,id:n.id,prefix:n.prefix,item:v,disabled:n.disabled,onUpdate:e[2]||(e[2]=T=>t.$emit("update","file-list")),onOpenModal:e[3]||(e[3]=T=>s.handleOpenModal(T))},null,8,["id","prefix","item","disabled"]))),128)),s.filteredFiles.length?d.createCommentVNode("",!0):(d.openBlock(),d.createElementBlock("div",eF,e[8]||(e[8]=[d.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):d.createCommentVNode("",!0),d.createVNode(f,{title:i.modal.title,size:"small",visible:i.isModalVisible,"onUpdate:visible":e[6]||(e[6]=v=>i.isModalVisible=v)},{default:d.withCtx(()=>[d.createElementVNode("div",tF,[d.createElementVNode("p",nF,d.toDisplayString(i.modal.message),1),d.createElementVNode("div",rF,[d.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-medium text-gray-800 bg-white border border-gray-200 rounded-lg shadow-sm gap-x-2 hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[4]||(e[4]=(...v)=>i.modal.cancel&&i.modal.cancel(...v))},d.toDisplayString(i.modal.cancelButtonText),1),d.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-semibold text-white bg-red-500 border border-transparent rounded-lg gap-x-2 hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:e[5]||(e[5]=(...v)=>i.modal.confirm&&i.modal.confirm(...v))},d.toDisplayString(i.modal.confirmButtonText),1)])])]),_:1},8,["title","visible"])])}const TE=Le(qL,[["render",iF]]),sF={},oF={class:"w-16 text-gray-400 mx-auto dark:text-neutral-400",width:"70",height:"46",viewBox:"0 0 70 46",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function aF(t,e,n,r,i,s){return d.openBlock(),d.createElementBlock("svg",oF,e[0]||(e[0]=[d.createStaticVNode('<path d="M6.05172 9.36853L17.2131 7.5083V41.3608L12.3018 42.3947C9.01306 43.0871 5.79705 40.9434 5.17081 37.6414L1.14319 16.4049C0.515988 13.0978 2.73148 9.92191 6.05172 9.36853Z" fill="currentColor" stroke="currentColor" stroke-width="2" class="fill-white stroke-gray-400 dark:fill-neutral-800 dark:stroke-neutral-500"></path><path d="M63.9483 9.36853L52.7869 7.5083V41.3608L57.6982 42.3947C60.9869 43.0871 64.203 40.9434 64.8292 37.6414L68.8568 16.4049C69.484 13.0978 67.2685 9.92191 63.9483 9.36853Z" fill="currentColor" stroke="currentColor" stroke-width="2" class="fill-white stroke-gray-400 dark:fill-neutral-800 dark:stroke-neutral-500"></path><rect x="17.0656" y="1.62305" width="35.8689" height="42.7541" rx="5" fill="currentColor" stroke="currentColor" stroke-width="2" class="fill-white stroke-gray-400 dark:fill-neutral-800 dark:stroke-neutral-500"></rect><path d="M47.9344 44.3772H22.0655C19.3041 44.3772 17.0656 42.1386 17.0656 39.3772L17.0656 35.9161L29.4724 22.7682L38.9825 33.7121C39.7832 34.6335 41.2154 34.629 42.0102 33.7025L47.2456 27.5996L52.9344 33.7209V39.3772C52.9344 42.1386 50.6958 44.3772 47.9344 44.3772Z" stroke="currentColor" stroke-width="2" class="stroke-gray-400 dark:stroke-neutral-500"></path><circle cx="39.5902" cy="14.9672" r="4.16393" stroke="currentColor" stroke-width="2" class="stroke-gray-400 dark:stroke-neutral-500"></circle>',5)]))}const lF=Le(sF,[["render",aF]]),cF={class:"cursor-pointer"},dF={class:"flex flex-col gap-0"},uF={class:"!mt-[4px] text-xs text-center text-stone-400 dark:text-neutral-400"},hF=["accept"],pF=Le({__name:"vs-widget-gallery-dropzone",props:{accept:{type:Array,default:()=>[".tiff",".jpg",".jpeg",".png",".svg",".ico",".webp"]}},emits:["file:upload"],setup(t,{emit:e}){const n=t,{$notify:r}=d.getCurrentInstance().proxy,i=d.ref(null),s=d.ref(!1),a=d.computed(()=>{var D,O,B;return(D=n.accept)!=null&&D.length?(B=(O=n.accept)==null?void 0:O.map(L=>{var U;return(U=L==null?void 0:L.replace(".",""))==null?void 0:U.toUpperCase()}))==null?void 0:B.join(", "):"Приймаються всі типи файлів"}),o=e,f=()=>{i.value.click()},g=async D=>{D?o("file:upload",D):r({type:"error",title:"Помилка!",message:"При спробі завантаження файлу виникла помилка"})},y=D=>{const O=D.target.files;O&&g(O)},v=D=>{const O=D.dataTransfer.files;s.value=!1,O&&g(O)},w=()=>{s.value=!0},T=()=>{s.value=!1};return(D,O)=>{var B;return d.openBlock(),d.createElementBlock("div",cF,[d.createElementVNode("div",{class:d.normalizeClass(["vs-form-dropzone border border-dashed rounded-xl p-[48px] flex items-center justify-center duration-300 hover:border-blue-600 hover:bg-blue-50",s.value?"border-blue-600 bg-blue-50":"border-gray-200"]),onDragover:d.withModifiers(w,["prevent"]),onDragleave:T,onDrop:d.withModifiers(v,["prevent"]),onClick:f},[d.createElementVNode("div",dF,[d.createVNode(lF),O[0]||(O[0]=d.createElementVNode("p",{class:"font-medium text-gray-800 text-center mt-[16px] !mb-0"}," Додати фото ",-1)),d.createElementVNode("p",uF,d.toDisplayString(a.value),1)])],34),d.createElementVNode("input",{ref_key:"fileInput",ref:i,type:"file",class:"hidden",accept:(B=t.accept)==null?void 0:B.join(","),onChange:y,multiple:""},null,40,hF)])}}},[["__scopeId","data-v-2a9e08fb"]]),fF={class:"flex items-center gap-x-2 mb-[16px]"},mF={class:"inline-block shrink-0 font-semibold text-gray-800 dark:text-neutral-200"},gF={class:"flex items-center w-full justify-end gap-x-2"},yF=["accept"],bF=["onDragstart","onDrop"],_F={key:0,class:"absolute right-[5px] top-[5px] bg-blue-100 text-blue-800 text-xs font-medium px-2.5 py-0.5 rounded-sm dark:bg-blue-900 dark:text-blue-300"},xF=["href","data-caption"],vF=["src","alt"],wF={class:"item__text-content bg-white opacity-0 rounded-b-lg absolute w-full bottom-0 p-3 flex gap-2.5 items-center justify-between"},kF={class:"text-xs w-[180px] block overflow-hidden text-nowrap overflow-ellipsis"},EF={class:"flex flex-wrap items-center text-xs text-gray-600 widget-images__item-desc"},SF={class:"flex items-center"},CF={class:"text-xs"},TF=["onClick"],AF=["onClick"],MF=["onClick"],DF={class:"p-4"},IF={class:"mt-1 text-gray-500 dark:text-neutral-500"},PF={class:"flex justify-end mt-4 gap-x-3"},NF={__name:"vs-widget-gallery",props:{id:{type:String,default:""},readonly:{type:Boolean,default:!1},prefilledData:{type:Array,default:()=>[]},limit:{type:Number,default:10},prefix:{type:String,default:"/api"}},setup(t){const{Fancybox:e}=Sm,{$notify:n}=d.getCurrentInstance().proxy,r=t,i=d.ref([]),s=d.ref(!1),a=d.ref(null),o=d.ref({}),f=[".tiff",".jpg",".jpeg",".png",".svg",".ico",".webp"],g=async()=>{var ve,Oe,je;if((ve=r==null?void 0:r.prefilledData)!=null&&ve.length){i.value=r.prefilledData,e.bind("[data-fancybox='gallery']");return}try{const{data:He}=await Ue.get(`${r.prefix}/widget/gallery/${r==null?void 0:r.id}`);i.value=[(Oe=He==null?void 0:He.rows)==null?void 0:Oe.find(qe=>qe==null?void 0:qe.ismain),...((je=He==null?void 0:He.rows)==null?void 0:je.filter(qe=>!(qe!=null&&qe.ismain)))||[]].filter(qe=>qe),e.bind("[data-fancybox='gallery']")}catch(He){console.error(He)}},y=async ve=>{var He,qe,pe,ht;if(((He=i.value)==null?void 0:He.length)+((pe=Array.from((qe=ve.target)==null?void 0:qe.files))==null?void 0:pe.length)>r.limit){n({type:"error",title:"Помилка!",message:"Встановлено ліміт на кількість, - "+r.limit});return}const Oe=Array.from((ht=ve.target)==null?void 0:ht.files);if(!Oe.every(Mt=>{var Dt,Rt;return f==null?void 0:f.includes("."+((Rt=(Dt=Mt.name.split("."))==null?void 0:Dt.pop())==null?void 0:Rt.toLowerCase()))})){n({type:"error",title:"Помилка!",message:"Доступні формати: "+f.join(", ")});return}await Promise.all(Oe.map(async Mt=>{const Dt=new FormData;Dt.append("file",Mt);try{await Ue.post(`${r.prefix}/widget/gallery/${r==null?void 0:r.id}`,Dt)}catch(Rt){console.error(Rt)}})),await g()},v=ve=>{const Oe=document.createElement("a");Oe.setAttribute("download",ve==null?void 0:ve.uploaded_name),Oe.href=ve==null?void 0:ve.file_path,Oe.click()},w=async(ve,Oe)=>{try{await Ue.post(`${r.prefix}/widget/gallery/${ve}/${Oe}`,{ismain:!0}),await g()}catch(je){console.error(je)}},T=ve=>{a.value=ve,o.value={title:"Ви впевнені?",message:"Ви впевнені що хочете видалити зображення?",confirmButtonText:"Так, видалити ",cancelButtonText:"Відмінити",confirm:async()=>{var Oe,je,He;await D(),s.value=!1,await g(),(Oe=i.value)!=null&&Oe[0]&&!((He=(je=i.value)==null?void 0:je[0])!=null&&He.ismain)&&setTimeout(()=>{var qe,pe,ht,Mt;return w((pe=(qe=i.value)==null?void 0:qe[0])==null?void 0:pe.entity_id,(Mt=(ht=i.value)==null?void 0:ht[0])==null?void 0:Mt.file_id)})},cancel:()=>{s.value=!1}},s.value=!0},D=async()=>{var ve,Oe;try{await Ue.delete(`${r.prefix}/widget/gallery/${(ve=a.value)==null?void 0:ve.entity_id}/${(Oe=a.value)==null?void 0:Oe.file_id}`)}catch(je){console.error(je)}},O=(ve,Oe=2)=>{if(ve===0)return"0 Bytes";const je=1024,He=Oe<0?0:Oe,qe=["Bytes","KB","MB","GB","TB"],pe=Math.floor(Math.log(ve)/Math.log(je));return`${parseFloat((ve/je**pe).toFixed(He))} ${qe[pe]}`},B=ve=>{const Oe={day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"numeric"};return new Date(ve).toLocaleDateString("uk-UA",Oe)},L=d.ref(null),U=d.ref(0),Z=()=>{var ve;U.value=((ve=L.value)==null?void 0:ve.offsetWidth)||0},Y=d.computed(()=>{const ve=[...i.value],Oe={isDropzone:!0},je=Math.floor(U.value/316)||1,He=Math.min(je-1,ve.length);return ve.splice(He,0,Oe),ve}),ue=d.ref(null),fe=ve=>{ue.value=ve},be=ve=>i.value.findIndex(Oe=>Oe.file_path===ve.file_path),Me=ve=>{if(ve===0){const Oe=ue.value;if(Oe===null||Oe===ve)return;const He=Y.value.filter(qe=>!qe.isDropzone)[Oe];if(!He)return;i.value.splice(Oe,1),i.value.splice(ve,0,He),ue.value=null,setTimeout(()=>{var qe,pe,ht,Mt;return w((pe=(qe=i.value)==null?void 0:qe[0])==null?void 0:pe.entity_id,(Mt=(ht=i.value)==null?void 0:ht[0])==null?void 0:Mt.file_id)})}};return d.onMounted(()=>{g(),Z(),window.addEventListener("resize",Z),addEventListener("reloadCardPage",g)}),d.onUnmounted(()=>{removeEventListener("reloadCardPage",g)}),d.watch(()=>r.id,g),d.watch(i,Z),(ve,Oe)=>{const je=d.resolveComponent("VsConfirm");return d.openBlock(),d.createElementBlock("div",{ref_key:"galleryContainer",ref:L,class:"flex flex-col vs-widget-images xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700"},[d.createElementVNode("div",fF,[d.createElementVNode("h2",mF," Світлин: "+d.toDisplayString(i.value.length)+" (ліміт - "+d.toDisplayString(t.limit)+") ",1),d.createElementVNode("div",gF,[d.createElementVNode("div",null,[d.createElementVNode("label",null,[d.createElementVNode("input",{type:"file",class:"hidden",onChange:y,accept:f.join(","),multiple:""},null,40,yF),Oe[5]||(Oe[5]=d.createStaticVNode('<span type="button" class="py-2 px-2.5 cursor-pointer inline-flex items-center gap-x-1.5 text-xs font-medium rounded-lg border border-stone-200 bg-white text-stone-800 shadow-2xs hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-hidden focus:bg-stone-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"><svg class="shrink-0 size-3.5" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242"></path><path d="M12 12v9"></path><path d="m16 16-4-4-4 4"></path></svg> Завантажити </span>',1))])])])]),d.createVNode(d.TransitionGroup,{name:"gallery",tag:"div",class:"flex flex-wrap gap-[16px]"},{default:d.withCtx(()=>[d.createVNode(pF,{"onFile:upload":Oe[0]||(Oe[0]=He=>y({target:{files:He}})),class:"h-[200px] w-[300px]"}),(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(i.value,(He,qe)=>(d.openBlock(),d.createElementBlock("div",{key:He.file_path||"dz-"+qe,draggable:"true",onDragstart:pe=>fe(be(He)),onDragover:Oe[1]||(Oe[1]=d.withModifiers(()=>{},["prevent"])),onDrop:pe=>Me(be(He)),class:"relative cursor-pointer rounded-b-lg item hover:shadow-lg shrink-0 h-[200px] w-[300px]"},[He!=null&&He.ismain?(d.openBlock(),d.createElementBlock("span",_F,"Головне")):d.createCommentVNode("",!0),d.createElementVNode("a",{href:He.file_path,"data-fancybox":"gallery","data-caption":He.uploaded_name,target:"_blank"},[d.createElementVNode("img",{class:"object-cover w-full h-full rounded-lg",src:He.file_path||"/icons/no-image.jpg",alt:He.uploaded_name},null,8,vF),d.createElementVNode("div",wF,[d.createElementVNode("div",null,[d.createElementVNode("span",kF,d.toDisplayString(He.uploaded_name),1),d.createElementVNode("div",EF,[d.createElementVNode("span",SF,d.toDisplayString(O(He.size)),1),d.createElementVNode("span",null,d.toDisplayString(B(He.cdate)),1)]),d.createElementVNode("span",CF,d.toDisplayString(He.username),1),He!=null&&He.ismain?d.createCommentVNode("",!0):(d.openBlock(),d.createElementBlock("div",{key:0,class:"text-xs underline",onClick:d.withModifiers(pe=>w(He==null?void 0:He.entity_id,He==null?void 0:He.file_id),["prevent"])}," Зробити головним ",8,TF))]),d.createElementVNode("div",null,[d.createElementVNode("div",{class:"flex items-center justify-center gap-2 hover:bg-gray-200 p-[6px] rounded",onClick:d.withModifiers(pe=>v(He),["prevent"])},[d.createVNode(EE,{height:"14",width:"14"})],8,AF),d.createElementVNode("div",{class:"flex items-center gap-2 hover:bg-gray-200 p-[6px] rounded hover:cursor-pointer",onClick:d.withModifiers(pe=>T(He),["prevent"])},[d.createVNode(SE,{height:"14",width:"14"})],8,MF)])])],8,xF)],40,bF))),128))]),_:1}),d.createVNode(je,{title:o.value.title,size:"small",visible:s.value,"onUpdate:visible":Oe[4]||(Oe[4]=He=>s.value=He)},{default:d.withCtx(()=>[d.createElementVNode("div",DF,[d.createElementVNode("p",IF,d.toDisplayString(o.value.message),1),d.createElementVNode("div",PF,[d.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-medium text-gray-800 bg-white border border-gray-200 rounded-lg shadow-sm gap-x-2 hover:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700",onClick:Oe[2]||(Oe[2]=(...He)=>o.value.cancel&&o.value.cancel(...He))},d.toDisplayString(o.value.cancelButtonText),1),d.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-semibold text-white bg-red-500 border border-transparent rounded-lg gap-x-2 hover:bg-red-600",onClick:Oe[3]||(Oe[3]=(...He)=>o.value.confirm&&o.value.confirm(...He))},d.toDisplayString(o.value.confirmButtonText),1)])])]),_:1},8,["title","visible"])],512)}}};function ri(t){this.content=t}ri.prototype={constructor:ri,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),s=r.content.slice();return i==-1?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new ri(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new ri(n)},addToStart:function(t,e){return new ri([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new ri(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),s=r.find(t);return i.splice(s==-1?i.length:s,0,e,n),new ri(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=ri.from(t),t.size?new ri(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=ri.from(t),t.size?new ri(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=ri.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}},ri.from=function(t){if(t instanceof ri)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new ri(e)};function AE(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),s=e.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let a=0;i.text[a]==s.text[a];a++)n++;return n}if(i.content.size||s.content.size){let a=AE(i.content,s.content,n+1);if(a!=null)return a}n+=i.nodeSize}}function ME(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let a=t.child(--i),o=e.child(--s),f=a.nodeSize;if(a==o){n-=f,r-=f;continue}if(!a.sameMarkup(o))return{a:n,b:r};if(a.isText&&a.text!=o.text){let g=0,y=Math.min(a.text.length,o.text.length);for(;g<y&&a.text[a.text.length-g-1]==o.text[o.text.length-g-1];)g++,n--,r--;return{a:n,b:r}}if(a.content.size||o.content.size){let g=ME(a.content,o.content,n-1,r-1);if(g)return g}n-=f,r-=f}}class Ze{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,s){for(let a=0,o=0;o<n;a++){let f=this.content[a],g=o+f.nodeSize;if(g>e&&r(f,i+o,s||null,a)!==!1&&f.content.size){let y=o+1;f.nodesBetween(Math.max(0,e-y),Math.min(f.content.size,n-y),r,i+y)}o=g}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",a=!0;return this.nodesBetween(e,n,(o,f)=>{let g=o.isText?o.text.slice(Math.max(e,f)-f,n-f):o.isLeaf?i?typeof i=="function"?i(o):i:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&g||o.isTextblock)&&r&&(a?a=!1:s+=r),s+=g},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new Ze(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let s=0,a=0;a<n;s++){let o=this.content[s],f=a+o.nodeSize;f>e&&((a<e||f>n)&&(o.isText?o=o.cut(Math.max(0,e-a),Math.min(o.text.length,n-a)):o=o.cut(Math.max(0,e-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=f}return new Ze(r,i)}cutByIndex(e,n){return e==n?Ze.empty:e==0&&n==this.content.length?this:new Ze(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new Ze(i,s)}addToStart(e){return new Ze([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Ze(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return AE(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return ME(this,e,n,r)}findIndex(e,n=-1){if(e==0)return Tm(0,e);if(e==this.size)return Tm(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let s=this.child(r),a=i+s.nodeSize;if(a>=e)return a==e||n>0?Tm(r+1,a):Tm(r,i);i=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return Ze.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new Ze(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Ze.empty;let n,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(n||(n=e.slice(0,i)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new Ze(n||e,r)}static from(e){if(!e)return Ze.empty;if(e instanceof Ze)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Ze([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Ze.empty=new Ze([],0);const Lb={index:0,offset:0};function Tm(t,e){return Lb.index=t,Lb.offset=e,Lb}function Am(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!Am(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Am(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let er=class Kv{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Am(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Kv.none;if(e instanceof Kv)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};er.none=[];class Mm extends Error{}class xt{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=IE(this.content,e+this.openStart,n);return r&&new xt(r,this.openStart,this.openEnd)}removeBetween(e,n){return new xt(DE(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return xt.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new xt(Ze.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new xt(e,r,i)}}xt.empty=new xt(Ze.empty,0,0);function DE(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:a,offset:o}=t.findIndex(n);if(i==e||s.isText){if(o!=n&&!t.child(a).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=a)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(DE(s.content,e-i-1,n-i-1)))}function IE(t,e,n,r){let{index:i,offset:s}=t.findIndex(e),a=t.maybeChild(i);if(s==e||a.isText)return t.cut(0,e).append(n).append(t.cut(e));let o=IE(a.content,e-s-1,n);return o&&t.replaceChild(i,a.copy(o))}function RF(t,e,n){if(n.openStart>t.depth)throw new Mm("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Mm("Inconsistent open depths");return PE(t,e,n,0)}function PE(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let a=PE(t,e,n,r+1);return s.copy(s.content.replaceChild(i,a))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let a=t.parent,o=a.content;return nc(a,o.cut(0,t.parentOffset).append(n.content).append(o.cut(e.parentOffset)))}else{let{start:a,end:o}=OF(n,t);return nc(s,RE(t,a,o,e,r))}else return nc(s,Dm(t,e,r))}function NE(t,e){if(!e.type.compatibleContent(t.type))throw new Mm("Cannot join "+e.type.name+" onto "+t.type.name)}function Fb(t,e,n){let r=t.node(n);return NE(r,e.node(n)),r}function tc(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Ah(t,e,n,r){let i=(e||t).node(n),s=0,a=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(tc(t.nodeAfter,r),s++));for(let o=s;o<a;o++)tc(i.child(o),r);e&&e.depth==n&&e.textOffset&&tc(e.nodeBefore,r)}function nc(t,e){return t.type.checkContent(e),t.copy(e)}function RE(t,e,n,r,i){let s=t.depth>i&&Fb(t,e,i+1),a=r.depth>i&&Fb(n,r,i+1),o=[];return Ah(null,t,i,o),s&&a&&e.index(i)==n.index(i)?(NE(s,a),tc(nc(s,RE(t,e,n,r,i+1)),o)):(s&&tc(nc(s,Dm(t,e,i+1)),o),Ah(e,n,i,o),a&&tc(nc(a,Dm(n,r,i+1)),o)),Ah(r,null,i,o),new Ze(o)}function Dm(t,e,n){let r=[];if(Ah(null,t,n,r),t.depth>n){let i=Fb(t,e,n+1);tc(nc(i,Dm(t,e,n+1)),r)}return Ah(e,null,n,r),new Ze(r)}function OF(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)i=e.node(s).copy(Ze.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class Mh{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return er.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let o=r;r=i,i=o}let s=r.marks;for(var a=0;a<s.length;a++)s[a].type.spec.inclusive===!1&&(!i||!s[a].isInSet(i.marks))&&(s=s[a--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new Im(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,s=n;for(let a=e;;){let{index:o,offset:f}=a.content.findIndex(s),g=s-f;if(r.push(a,o,i+f),!g||(a=a.child(o),a.isText))break;s=g-1,i+=f+1}return new Mh(n,r,s)}static resolveCached(e,n){let r=OE.get(e);if(r)for(let s=0;s<r.elts.length;s++){let a=r.elts[s];if(a.pos==n)return a}else OE.set(e,r=new BF);let i=r.elts[r.i]=Mh.resolve(e,n);return r.i=(r.i+1)%VF,i}}class BF{constructor(){this.elts=[],this.i=0}}const VF=12,OE=new WeakMap;class Im{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const zF=Object.create(null);let Ya=class Jv{constructor(e,n,r,i=er.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||Ze.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&Am(this.attrs,n||e.defaultAttrs||zF)&&er.sameSet(this.marks,r||er.none)}copy(e=null){return e==this.content?this:new Jv(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Jv(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return xt.empty;let i=this.resolve(e),s=this.resolve(n),a=r?0:i.sharedDepth(n),o=i.start(a),g=i.node(a).content.cut(i.pos-o,s.pos-o);return new xt(g,i.depth-a,s.depth-a)}replace(e,n,r){return RF(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return Mh.resolveCached(this,e)}resolveNoCache(e){return Mh.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),BE(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=Ze.empty,i=0,s=r.childCount){let a=this.contentMatchAt(e).matchFragment(r,i,s),o=a&&a.matchFragment(this.content,n);if(!o||!o.validEnd)return!1;for(let f=i;f<s;f++)if(!this.type.allowsMarks(r.child(f).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),a=s&&s.matchFragment(this.content,n);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=er.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!er.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=Ze.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};Ya.prototype.text=void 0;class Pm extends Ya{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):BE(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Pm(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Pm(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function BE(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class rc{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new LF(e,n);if(r.next==null)return rc.empty;let i=VE(r);r.next&&r.err("Unexpected trailing text");let s=qF(WF(i));return GF(s,r),s}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let s=n;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function s(a,o){let f=a.matchFragment(e,r);if(f&&(!n||f.validEnd))return Ze.from(o.map(g=>g.createAndFill()));for(let g=0;g<a.next.length;g++){let{type:y,next:v}=a.next[g];if(!(y.isText||y.hasRequiredAttrs())&&i.indexOf(v)==-1){i.push(v);let w=s(v,o.concat(y));if(w)return w}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let a=[];for(let o=i;o.type;o=o.via)a.push(o.type);return a.reverse()}for(let a=0;a<s.next.length;a++){let{type:o,next:f}=s.next[a];!o.isLeaf&&!o.hasRequiredAttrs()&&!(o.name in n)&&(!i.type||f.validEnd)&&(r.push({match:o.contentMatch,type:o,via:i}),n[o.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let a=0;a<r.next.length;a++)s+=(a?", ":"")+r.next[a].type.name+"->"+e.indexOf(r.next[a].next);return s}).join(`
|
625
|
+
<source src="{{src}}" type="{{format}}" />Sorry, your browser doesn't support embedded videos.</video>`,videoFormat:"",vimeo:{byline:1,color:"00adef",controls:1,dnt:1,muted:0},youtube:{controls:1,enablejsapi:1,nocookie:1,rel:0,fs:1}},Y5=["image","html","ajax","inline","clone","iframe","map","pdf","html5video","youtube","vimeo"];class tE extends io{onBeforeInitSlide(e,n,r){this.processType(r)}onCreateSlide(e,n,r){this.setContent(r)}onClearContent(e,n){n.xhr&&(n.xhr.abort(),n.xhr=null);const r=n.iframeEl;r&&(r.onload=r.onerror=null,r.src="//about:blank",n.iframeEl=null);const i=n.contentEl,s=n.placeholderEl;if(n.type==="inline"&&i&&s)i.classList.remove("fancybox__content"),getComputedStyle(i).getPropertyValue("display")!=="none"&&(i.style.display="none"),setTimeout(()=>{s&&(i&&s.parentNode&&s.parentNode.insertBefore(i,s),s.remove())},0),n.contentEl=void 0,n.placeholderEl=void 0;else for(;n.el&&n.el.firstChild;)n.el.removeChild(n.el.firstChild)}onSelectSlide(e,n,r){r.state===xi.Ready&&this.playVideo()}onUnselectSlide(e,n,r){var i,s;if(r.type===Ch){try{(s=(i=r.el)===null||i===void 0?void 0:i.querySelector("video"))===null||s===void 0||s.pause()}catch{}return}let a;r.type===Kl?a={method:"pause",value:"true"}:r.type===ia&&(a={event:"command",func:"pauseVideo"}),a&&r.iframeEl&&r.iframeEl.contentWindow&&r.iframeEl.contentWindow.postMessage(JSON.stringify(a),"*"),r.poller&&clearTimeout(r.poller)}onDone(e,n){e.isCurrentSlide(n)&&!e.isClosing()&&this.playVideo()}onRefresh(e,n){n.slides.forEach(r=>{r.el&&(this.resizeIframe(r),this.setAspectRatio(r))})}onMessage(e){try{let n=JSON.parse(e.data);if(e.origin==="https://player.vimeo.com"){if(n.event==="ready")for(let r of Array.from(document.getElementsByClassName("fancybox__iframe")))r instanceof HTMLIFrameElement&&r.contentWindow===e.source&&(r.dataset.ready="true")}else if(e.origin.match(/^https:\/\/(www.)?youtube(-nocookie)?.com$/)&&n.event==="onReady"){const r=document.getElementById(n.id);r&&(r.dataset.ready="true")}}catch{}}loadAjaxContent(e){const n=this.instance.optionFor(e,"src")||"";this.instance.showLoading(e);const r=this.instance,i=new XMLHttpRequest;r.showLoading(e),i.onreadystatechange=function(){i.readyState===XMLHttpRequest.DONE&&r.state===$r.Ready&&(r.hideLoading(e),i.status===200?r.setContent(e,i.responseText):r.setError(e,i.status===404?"{{AJAX_NOT_FOUND}}":"{{AJAX_FORBIDDEN}}"))};const s=e.ajax||null;i.open(s?"POST":"GET",n+""),i.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),i.setRequestHeader("X-Requested-With","XMLHttpRequest"),i.send(s),e.xhr=i}setInlineContent(e){let n=null;if(es(e.src))n=e.src;else if(typeof e.src=="string"){const r=e.src.split("#",2).pop();n=r?document.getElementById(r):null}if(n){if(e.type==="clone"||n.closest(".fancybox__slide")){n=n.cloneNode(!0);const r=n.dataset.animationName;r&&(n.classList.remove(r),delete n.dataset.animationName);let i=n.getAttribute("id");i=i?`${i}--clone`:`clone-${this.instance.id}-${e.index}`,n.setAttribute("id",i)}else if(n.parentNode){const r=document.createElement("div");r.classList.add("fancybox-placeholder"),n.parentNode.insertBefore(r,n),e.placeholderEl=r}this.instance.setContent(e,n)}else this.instance.setError(e,"{{ELEMENT_NOT_FOUND}}")}setIframeContent(e){const{src:n,el:r}=e;if(!n||typeof n!="string"||!r)return;r.classList.add("is-loading");const i=this.instance,s=document.createElement("iframe");s.className="fancybox__iframe",s.setAttribute("id",`fancybox__iframe_${i.id}_${e.index}`);for(const[o,f]of Object.entries(this.optionFor(e,"iframeAttr")||{}))s.setAttribute(o,f);s.onerror=()=>{i.setError(e,"{{IFRAME_ERROR}}")},e.iframeEl=s;const a=this.optionFor(e,"preload");if(e.type!=="iframe"||a===!1)return s.setAttribute("src",e.src+""),i.setContent(e,s,!1),this.resizeIframe(e),void i.revealContent(e);i.showLoading(e),s.onload=()=>{if(!s.src.length)return;const o=s.dataset.ready!=="true";s.dataset.ready="true",this.resizeIframe(e),o?i.revealContent(e):i.hideLoading(e)},s.setAttribute("src",n),i.setContent(e,s,!1)}resizeIframe(e){const{type:n,iframeEl:r}=e;if(n===ia||n===Kl)return;const i=r==null?void 0:r.parentElement;if(!r||!i)return;let s=e.autoSize;s===void 0&&(s=this.optionFor(e,"autoSize"));let a=e.width||0,o=e.height||0;a&&o&&(s=!1);const f=i&&i.style;if(e.preload!==!1&&s!==!1&&f)try{const g=window.getComputedStyle(i),y=parseFloat(g.paddingLeft)+parseFloat(g.paddingRight),v=parseFloat(g.paddingTop)+parseFloat(g.paddingBottom),w=r.contentWindow;if(w){const T=w.document,D=T.getElementsByTagName(Mb)[0],O=T.body;f.width="",O.style.overflow="hidden",a=a||D.scrollWidth+y,f.width=`${a}px`,O.style.overflow="",f.flex="0 0 auto",f.height=`${O.scrollHeight}px`,o=D.scrollHeight+v}}catch{}if(a||o){const g={flex:"0 1 auto",width:"",height:""};a&&a!=="auto"&&(g.width=`${a}px`),o&&o!=="auto"&&(g.height=`${o}px`),Object.assign(f,g)}}playVideo(){const e=this.instance.getSlide();if(!e)return;const{el:n}=e;if(!n||!n.offsetParent||!this.optionFor(e,"videoAutoplay"))return;if(e.type===Ch)try{const i=n.querySelector("video");if(i){const s=i.play();s!==void 0&&s.then(()=>{}).catch(a=>{i.muted=!0,i.play()})}}catch{}if(e.type!==ia&&e.type!==Kl)return;const r=()=>{if(e.iframeEl&&e.iframeEl.contentWindow){let i;if(e.iframeEl.dataset.ready==="true")return i=e.type===ia?{event:"command",func:"playVideo"}:{method:"play",value:"true"},i&&e.iframeEl.contentWindow.postMessage(JSON.stringify(i),"*"),void(e.poller=void 0);e.type===ia&&(i={event:"listening",id:e.iframeEl.getAttribute("id")},e.iframeEl.contentWindow.postMessage(JSON.stringify(i),"*"))}e.poller=setTimeout(r,250)};r()}processType(e){if(e.html)return e.type=Mb,e.src=e.html,void(e.html="");const n=this.instance.optionFor(e,"src","");if(!n||typeof n!="string")return;let r=e.type,i=null;if(i=n.match(/(youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(?:watch\?(?:.*&)?v=|v\/|u\/|shorts\/|embed\/?)?(videoseries\?list=(?:.*)|[\w-]{11}|\?listType=(?:.*)&list=(?:.*))(?:.*)/i)){const s=this.optionFor(e,ia),{nocookie:a}=s,o=function(v,w){var T={};for(var D in v)Object.prototype.hasOwnProperty.call(v,D)&&w.indexOf(D)<0&&(T[D]=v[D]);if(v!=null&&typeof Object.getOwnPropertySymbols=="function"){var O=0;for(D=Object.getOwnPropertySymbols(v);O<D.length;O++)w.indexOf(D[O])<0&&Object.prototype.propertyIsEnumerable.call(v,D[O])&&(T[D[O]]=v[D[O]])}return T}(s,["nocookie"]),f=`www.youtube${a?"-nocookie":""}.com`,g=eE(n,o),y=encodeURIComponent(i[2]);e.videoId=y,e.src=`https://${f}/embed/${y}?${g}`,e.thumbSrc=e.thumbSrc||`https://i.ytimg.com/vi/${y}/mqdefault.jpg`,r=ia}else if(i=n.match(/^.+vimeo.com\/(?:\/)?([\d]+)((\/|\?h=)([a-z0-9]+))?(.*)?/)){const s=eE(n,this.optionFor(e,Kl)),a=encodeURIComponent(i[1]),o=i[4]||"";e.videoId=a,e.src=`https://player.vimeo.com/video/${a}?${o?`h=${o}${s?"&":""}`:""}${s}`,r=Kl}if(!r&&e.triggerEl){const s=e.triggerEl.dataset.type;Y5.includes(s)&&(r=s)}r||typeof n=="string"&&(n.charAt(0)==="#"?r="inline":(i=n.match(/\.(mp4|mov|ogv|webm)((\?|#).*)?$/i))?(r=Ch,e.videoFormat=e.videoFormat||"video/"+(i[1]==="ogv"?"ogg":i[1])):n.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)?r=Q2:n.match(/\.(pdf)((\?|#).*)?$/i)&&(r="pdf")),(i=n.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:(?:(?:maps\/(?:place\/(?:.*)\/)?\@(.*),(\d+.?\d+?)z))|(?:\?ll=))(.*)?/i))?(e.src=`https://maps.google.${i[1]}/?ll=${(i[2]?i[2]+"&z="+Math.floor(parseFloat(i[3]))+(i[4]?i[4].replace(/^\//,"&"):""):i[4]+"").replace(/\?/,"&")}&output=${i[4]&&i[4].indexOf("layer=c")>0?"svembed":"embed"}`,r=Db):(i=n.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:maps\/search\/)(.*)/i))&&(e.src=`https://maps.google.${i[1]}/maps?q=${i[2].replace("query=","q=").replace("api=1","")}&output=embed`,r=Db),r=r||this.instance.option("defaultType"),e.type=r,r===Q2&&(e.thumbSrc=e.thumbSrc||e.src)}setContent(e){const n=this.instance.optionFor(e,"src")||"";if(e&&e.type&&n){switch(e.type){case Mb:this.instance.setContent(e,n);break;case Ch:const r=this.option("videoTpl");r&&this.instance.setContent(e,r.replace(/\{\{src\}\}/gi,n+"").replace(/\{\{format\}\}/gi,this.optionFor(e,"videoFormat")||"").replace(/\{\{poster\}\}/gi,e.poster||e.thumbSrc||""));break;case"inline":case"clone":this.setInlineContent(e);break;case"ajax":this.loadAjaxContent(e);break;case"pdf":case Db:case ia:case Kl:e.preload=!1;case"iframe":this.setIframeContent(e)}this.setAspectRatio(e)}}setAspectRatio(e){const n=e.contentEl;if(!(e.el&&n&&e.type&&[ia,Kl,Ch].includes(e.type)))return;let r,i=e.width||"auto",s=e.height||"auto";if(i==="auto"||s==="auto"){r=this.optionFor(e,"videoRatio");const g=(r+"").match(/(\d+)\s*\/\s?(\d+)/);r=g&&g.length>2?parseFloat(g[1])/parseFloat(g[2]):parseFloat(r+"")}else i&&s&&(r=i/s);if(!r)return;n.style.aspectRatio="",n.style.width="",n.style.height="",n.offsetHeight;const a=n.getBoundingClientRect(),o=a.width||1,f=a.height||1;n.style.aspectRatio=r+"",r<o/f?(s=s==="auto"?f:Math.min(f,s),n.style.width="auto",n.style.height=`${s}px`):(i=i==="auto"?o:Math.min(o,i),n.style.width=`${i}px`,n.style.height="auto")}attach(){const e=this,n=e.instance;n.on("Carousel.beforeInitSlide",e.onBeforeInitSlide),n.on("Carousel.createSlide",e.onCreateSlide),n.on("Carousel.selectSlide",e.onSelectSlide),n.on("Carousel.unselectSlide",e.onUnselectSlide),n.on("Carousel.Panzoom.refresh",e.onRefresh),n.on("done",e.onDone),n.on("clearContent",e.onClearContent),window.addEventListener("message",e.onMessage)}detach(){const e=this,n=e.instance;n.off("Carousel.beforeInitSlide",e.onBeforeInitSlide),n.off("Carousel.createSlide",e.onCreateSlide),n.off("Carousel.selectSlide",e.onSelectSlide),n.off("Carousel.unselectSlide",e.onUnselectSlide),n.off("Carousel.Panzoom.refresh",e.onRefresh),n.off("done",e.onDone),n.off("clearContent",e.onClearContent),window.removeEventListener("message",e.onMessage)}}Object.defineProperty(tE,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:G5});const vm="play",wm="pause",Th="ready";class nE extends io{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:Th}),Object.defineProperty(this,"inHover",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"progressBar",{enumerable:!0,configurable:!0,writable:!0,value:null})}get isActive(){return this.state!==Th}onReady(e){this.option("autoStart")&&(e.isInfinite||e.page<e.pages.length-1)&&this.start()}onChange(){this.removeProgressBar(),this.pause()}onSettle(){this.resume()}onVisibilityChange(){document.visibilityState==="visible"?this.resume():this.pause()}onMouseEnter(){this.inHover=!0,this.pause()}onMouseLeave(){var e;this.inHover=!1,!((e=this.instance.panzoom)===null||e===void 0)&&e.isResting&&this.resume()}onTimerEnd(){const e=this.instance;this.state==="play"&&(e.isInfinite||e.page!==e.pages.length-1?e.slideNext():e.slideTo(0))}removeProgressBar(){this.progressBar&&(this.progressBar.remove(),this.progressBar=null)}createProgressBar(){var e;if(!this.option("showProgress"))return null;this.removeProgressBar();const n=this.instance,r=((e=n.pages[n.page])===null||e===void 0?void 0:e.slides)||[];let i=this.option("progressParentEl");if(i||(i=(r.length===1?r[0].el:null)||n.viewport),!i)return null;const s=document.createElement("div");return Bt(s,"f-progress"),i.prepend(s),this.progressBar=s,s.offsetHeight,s}set(){const e=this,n=e.instance;if(n.pages.length<2||e.timer)return;const r=e.option("timeout");e.state=vm,Bt(n.container,"has-autoplay");let i=e.createProgressBar();i&&(i.style.transitionDuration=`${r}ms`,i.style.transform="scaleX(1)"),e.timer=setTimeout(()=>{e.timer=null,e.inHover||e.onTimerEnd()},r),e.emit("set")}clear(){const e=this;e.timer&&(clearTimeout(e.timer),e.timer=null),e.removeProgressBar()}start(){const e=this;if(e.set(),e.state!==Th){if(e.option("pauseOnHover")){const n=e.instance.container;n.addEventListener("mouseenter",e.onMouseEnter,!1),n.addEventListener("mouseleave",e.onMouseLeave,!1)}document.addEventListener("visibilitychange",e.onVisibilityChange,!1),e.emit("start")}}stop(){const e=this,n=e.state,r=e.instance.container;e.clear(),e.state=Th,r.removeEventListener("mouseenter",e.onMouseEnter,!1),r.removeEventListener("mouseleave",e.onMouseLeave,!1),document.removeEventListener("visibilitychange",e.onVisibilityChange,!1),Fn(r,"has-autoplay"),n!==Th&&e.emit("stop")}pause(){const e=this;e.state===vm&&(e.state=wm,e.clear(),e.emit(wm))}resume(){const e=this,n=e.instance;if(n.isInfinite||n.page!==n.pages.length-1)if(e.state!==vm){if(e.state===wm&&!e.inHover){const r=new Event("resume",{bubbles:!0,cancelable:!0});e.emit("resume",r),r.defaultPrevented||e.set()}}else e.set();else e.stop()}toggle(){this.state===vm||this.state===wm?this.stop():this.start()}attach(){const e=this,n=e.instance;n.on("ready",e.onReady),n.on("Panzoom.startAnimation",e.onChange),n.on("Panzoom.endAnimation",e.onSettle),n.on("Panzoom.touchMove",e.onChange)}detach(){const e=this,n=e.instance;n.off("ready",e.onReady),n.off("Panzoom.startAnimation",e.onChange),n.off("Panzoom.endAnimation",e.onSettle),n.off("Panzoom.touchMove",e.onChange),e.stop()}}Object.defineProperty(nE,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{autoStart:!0,pauseOnHover:!0,progressParentEl:null,showProgress:!0,timeout:3e3}});class rE extends io{constructor(){super(...arguments),Object.defineProperty(this,"ref",{enumerable:!0,configurable:!0,writable:!0,value:null})}onPrepare(e){const n=e.carousel;if(!n)return;const r=e.container;r&&(n.options.Autoplay=Qi({autoStart:!1},this.option("Autoplay")||{},{pauseOnHover:!1,timeout:this.option("timeout"),progressParentEl:()=>this.option("progressParentEl")||null,on:{start:()=>{e.emit("startSlideshow")},set:i=>{var s;r.classList.add("has-slideshow"),((s=e.getSlide())===null||s===void 0?void 0:s.state)!==xi.Ready&&i.pause()},stop:()=>{r.classList.remove("has-slideshow"),e.isCompact||e.endIdle(),e.emit("endSlideshow")},resume:(i,s)=>{var a,o,f;!s||!s.cancelable||((a=e.getSlide())===null||a===void 0?void 0:a.state)===xi.Ready&&(!((f=(o=e.carousel)===null||o===void 0?void 0:o.panzoom)===null||f===void 0)&&f.isResting)||s.preventDefault()}}}),n.attachPlugins({Autoplay:nE}),this.ref=n.plugins.Autoplay)}onReady(e){const n=e.carousel,r=this.ref;r&&n&&this.option("playOnStart")&&(n.isInfinite||n.page<n.pages.length-1)&&r.start()}onDone(e,n){const r=this.ref,i=e.carousel;if(!r||!i)return;const s=n.panzoom;s&&s.on("startAnimation",()=>{e.isCurrentSlide(n)&&r.stop()}),e.isCurrentSlide(n)&&r.resume()}onKeydown(e,n){var r;const i=this.ref;i&&n===this.option("key")&&((r=document.activeElement)===null||r===void 0?void 0:r.nodeName)!=="BUTTON"&&i.toggle()}attach(){const e=this,n=e.instance;n.on("Carousel.init",e.onPrepare),n.on("Carousel.ready",e.onReady),n.on("done",e.onDone),n.on("keydown",e.onKeydown)}detach(){const e=this,n=e.instance;n.off("Carousel.init",e.onPrepare),n.off("Carousel.ready",e.onReady),n.off("done",e.onDone),n.off("keydown",e.onKeydown)}}Object.defineProperty(rE,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{key:" ",playOnStart:!1,progressParentEl:t=>{var e;return((e=t.instance.container)===null||e===void 0?void 0:e.querySelector(".fancybox__toolbar [data-fancybox-toggle-slideshow]"))||t.instance.container},timeout:3e3}});const iE={classes:{container:"f-thumbs f-carousel__thumbs",viewport:"f-thumbs__viewport",track:"f-thumbs__track",slide:"f-thumbs__slide",isResting:"is-resting",isSelected:"is-selected",isLoading:"is-loading",hasThumbs:"has-thumbs"},minCount:2,parentEl:null,thumbTpl:'<button class="f-thumbs__slide__button" tabindex="0" type="button" aria-label="{{GOTO}}" data-carousel-index="%i"><img class="f-thumbs__slide__img" data-lazy-src="{{%s}}" alt="" /></button>',type:"modern"};var sa;(function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Hidden=2]="Hidden"})(sa||(sa={}));const sE="isResting",km="thumbWidth",Sd="thumbHeight",Eo="thumbClipWidth";let oE=class extends io{constructor(){super(...arguments),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:"modern"}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"thumbWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbClipWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbHeight",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbExtraGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:sa.Init})}get isModern(){return this.type==="modern"}onInitSlide(t,e){const n=e.el?e.el.dataset:void 0;n&&(e.thumbSrc=n.thumbSrc||e.thumbSrc||"",e[Eo]=parseFloat(n[Eo]||"")||e[Eo]||0,e[Sd]=parseFloat(n.thumbHeight||"")||e[Sd]||0),this.addSlide(e)}onInitSlides(){this.build()}onChange(){var t;if(!this.isModern)return;const e=this.container,n=this.instance,r=n.panzoom,i=this.carousel,s=i?i.panzoom:null,a=n.page;if(r&&i&&s){if(r.isDragging){Fn(e,this.cn(sE));let o=((t=i.pages[a])===null||t===void 0?void 0:t.pos)||0;o+=n.getProgress(a)*(this[Eo]+this.thumbGap);let f=s.getBounds();-1*o>f.x.min&&-1*o<f.x.max&&s.panTo({x:-1*o,friction:.12})}else ko(e,this.cn(sE),r.isResting);this.shiftModern()}}onRefresh(){this.updateProps();for(const t of this.instance.slides||[])this.resizeModernSlide(t);this.shiftModern()}isDisabled(){const t=this.option("minCount")||0;if(t){const n=this.instance;let r=0;for(const i of n.slides||[])i.thumbSrc&&r++;if(r<t)return!0}const e=this.option("type");return["modern","classic"].indexOf(e)<0}getThumb(t){const e=this.option("thumbTpl")||"";return{html:this.instance.localize(e,[["%i",t.index],["%d",t.index+1],["%s",t.thumbSrc||"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"]])}}addSlide(t){const e=this.carousel;e&&e.addSlide(t.index,this.getThumb(t))}getSlides(){const t=[];for(const e of this.instance.slides||[])t.push(this.getThumb(e));return t}resizeModernSlide(t){this.isModern&&(t[km]=t[Eo]&&t[Sd]?Math.round(this[Sd]*(t[Eo]/t[Sd])):this[km])}updateProps(){const t=this.container;if(!t)return;const e=n=>parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-"+n))||0;this.thumbGap=e("gap"),this.thumbExtraGap=e("extra-gap"),this[km]=e("width")||40,this[Eo]=e("clip-width")||40,this[Sd]=e("height")||40}build(){const t=this;if(t.state!==sa.Init)return;if(t.isDisabled())return void t.emit("disabled");const e=t.instance,n=e.container,r=t.getSlides(),i=t.option("type");t.type=i;const s=t.option("parentEl"),a=t.cn("container"),o=t.cn("track");let f=s==null?void 0:s.querySelector("."+a);f||(f=document.createElement("div"),Bt(f,a),s?s.appendChild(f):n.after(f)),Bt(f,`is-${i}`),Bt(n,t.cn("hasThumbs")),t.container=f,t.updateProps();let g=f.querySelector("."+o);g||(g=document.createElement("div"),Bt(g,t.cn("track")),f.appendChild(g)),t.track=g;const y=Qi({},{track:g,infinite:!1,center:!0,fill:i==="classic",dragFree:!0,slidesPerPage:1,transition:!1,preload:.25,friction:.12,Panzoom:{maxVelocity:0},Dots:!1,Navigation:!1,classes:{container:"f-thumbs",viewport:"f-thumbs__viewport",track:"f-thumbs__track",slide:"f-thumbs__slide"}},t.option("Carousel")||{},{Sync:{target:e},slides:r}),v=new e.constructor(f,y);v.on("createSlide",(w,T)=>{t.setProps(T.index),t.emit("createSlide",T,T.el)}),v.on("ready",()=>{t.shiftModern(),t.emit("ready")}),v.on("refresh",()=>{t.shiftModern()}),v.on("Panzoom.click",(w,T,D)=>{t.onClick(D)}),t.carousel=v,t.state=sa.Ready}onClick(t){t.preventDefault(),t.stopPropagation();const e=this.instance,{pages:n,page:r}=e,i=O=>{if(O){const B=O.closest("[data-carousel-index]");if(B)return[parseInt(B.dataset.carouselIndex||"",10)||0,B]}return[-1,void 0]},s=(O,B)=>{const L=document.elementFromPoint(O,B);return L?i(L):[-1,void 0]};let[a,o]=i(t.target);if(a>-1)return;const f=this[Eo],g=t.clientX,y=t.clientY;let[v,w]=s(g-f,y),[T,D]=s(g+f,y);w&&D?(a=Math.abs(g-w.getBoundingClientRect().right)<Math.abs(g-D.getBoundingClientRect().left)?v:T,a===r&&(a=a===v?T:v)):w?a=v:D&&(a=T),a>-1&&n[a]&&e.slideTo(a)}getShift(t){var e;const n=this,{instance:r}=n,i=n.carousel;if(!r||!i)return 0;const s=n[km],a=n[Eo],o=n.thumbGap,f=n.thumbExtraGap;if(!(!((e=i.slides[t])===null||e===void 0)&&e.el))return 0;const g=.5*(s-a),y=r.pages.length-1;let v=r.getProgress(0),w=r.getProgress(y),T=r.getProgress(t,!1,!0),D=0,O=g+f+o;const B=v<0&&v>-1,L=w>0&&w<1;return t===0?(D=O*Math.abs(v),L&&v===1&&(D-=O*Math.abs(w))):t===y?(D=O*Math.abs(w)*-1,B&&w===-1&&(D+=O*Math.abs(v))):B||L?(D=-1*O,D+=O*Math.abs(v),D+=O*(1-Math.abs(w))):D=O*T,D}setProps(t){var e;const n=this;if(!n.isModern)return;const{instance:r}=n,i=n.carousel;if(r&&i){const s=(e=i.slides[t])===null||e===void 0?void 0:e.el;if(s&&s.childNodes.length){let a=yt(1-Math.abs(r.getProgress(t))),o=yt(n.getShift(t));s.style.setProperty("--progress",a?a+"":""),s.style.setProperty("--shift",o+"")}}}shiftModern(){const t=this;if(!t.isModern)return;const{instance:e,track:n}=t,r=e.panzoom,i=t.carousel;if(!(e&&n&&r&&i)||r.state===Un.Init||r.state===Un.Destroy)return;for(const a of e.slides)t.setProps(a.index);let s=(t[Eo]+t.thumbGap)*(i.slides.length||0);n.style.setProperty("--width",s+"")}cleanup(){const t=this;t.carousel&&t.carousel.destroy(),t.carousel=null,t.container&&t.container.remove(),t.container=null,t.track&&t.track.remove(),t.track=null,t.state=sa.Init,Fn(t.instance.container,t.cn("hasThumbs"))}attach(){const t=this,e=t.instance;e.on("initSlide",t.onInitSlide),e.state===Mr.Init?e.on("initSlides",t.onInitSlides):t.onInitSlides(),e.on(["change","Panzoom.afterTransform"],t.onChange),e.on("Panzoom.refresh",t.onRefresh)}detach(){const t=this,e=t.instance;e.off("initSlide",t.onInitSlide),e.off("initSlides",t.onInitSlides),e.off(["change","Panzoom.afterTransform"],t.onChange),e.off("Panzoom.refresh",t.onRefresh),t.cleanup()}};Object.defineProperty(oE,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:iE});const Z5=Object.assign(Object.assign({},iE),{key:"t",showOnStart:!0,parentEl:null}),aE="is-masked",lE="aria-hidden";class cE extends io{constructor(){super(...arguments),Object.defineProperty(this,"ref",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"hidden",{enumerable:!0,configurable:!0,writable:!0,value:!1})}get isEnabled(){const e=this.ref;return e&&!e.isDisabled()}get isHidden(){return this.hidden}onClick(e,n){n.stopPropagation()}onCreateSlide(e,n){var r,i,s;const a=((s=(i=(r=this.instance)===null||r===void 0?void 0:r.carousel)===null||i===void 0?void 0:i.slides[n.index])===null||s===void 0?void 0:s.type)||"",o=n.el;if(o&&a){let f=`for-${a}`;["video","youtube","vimeo","html5video"].includes(a)&&(f+=" for-video"),Bt(o,f)}}onInit(){var e;const n=this,r=n.instance,i=r.carousel;if(n.ref||!i)return;const s=n.option("parentEl")||r.footer||r.container;if(!s)return;const a=Qi({},n.options,{parentEl:s,classes:{container:"f-thumbs fancybox__thumbs"},Carousel:{Sync:{friction:r.option("Carousel.friction")||0}},on:{ready:o=>{const f=o.container;f&&this.hidden&&(n.refresh(),f.style.transition="none",n.hide(),f.offsetHeight,queueMicrotask(()=>{f.style.transition="",n.show()}))}}});a.Carousel=a.Carousel||{},a.Carousel.on=Qi(((e=n.options.Carousel)===null||e===void 0?void 0:e.on)||{},{click:this.onClick,createSlide:this.onCreateSlide}),i.options.Thumbs=a,i.attachPlugins({Thumbs:oE}),n.ref=i.plugins.Thumbs,n.option("showOnStart")||(n.ref.state=sa.Hidden,n.hidden=!0)}onResize(){var e;const n=(e=this.ref)===null||e===void 0?void 0:e.container;n&&(n.style.maxHeight="")}onKeydown(e,n){const r=this.option("key");r&&r===n&&this.toggle()}toggle(){const e=this.ref;if(e&&!e.isDisabled())return e.state===sa.Hidden?(e.state=sa.Init,void e.build()):void(this.hidden?this.show():this.hide())}show(){const e=this.ref;if(!e||e.isDisabled())return;const n=e.container;n&&(this.refresh(),n.offsetHeight,n.removeAttribute(lE),n.classList.remove(aE),this.hidden=!1)}hide(){const e=this.ref,n=e&&e.container;n&&(this.refresh(),n.offsetHeight,n.classList.add(aE),n.setAttribute(lE,"true")),this.hidden=!0}refresh(){const e=this.ref;if(!e||!e.state)return;const n=e.container,r=(n==null?void 0:n.firstChild)||null;n&&r&&r.childNodes.length&&(n.style.maxHeight=`${r.getBoundingClientRect().height}px`)}attach(){const e=this,n=e.instance;n.state===$r.Init?n.on("Carousel.init",e.onInit):e.onInit(),n.on("resize",e.onResize),n.on("keydown",e.onKeydown)}detach(){var e;const n=this,r=n.instance;r.off("Carousel.init",n.onInit),r.off("resize",n.onResize),r.off("keydown",n.onKeydown),(e=r.carousel)===null||e===void 0||e.detachPlugins(["Thumbs"]),n.ref=null}}Object.defineProperty(cE,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:Z5});const Ib={panLeft:{icon:'<svg><path d="M5 12h14M5 12l6 6M5 12l6-6"/></svg>',change:{panX:-100}},panRight:{icon:'<svg><path d="M5 12h14M13 18l6-6M13 6l6 6"/></svg>',change:{panX:100}},panUp:{icon:'<svg><path d="M12 5v14M18 11l-6-6M6 11l6-6"/></svg>',change:{panY:-100}},panDown:{icon:'<svg><path d="M12 5v14M18 13l-6 6M6 13l6 6"/></svg>',change:{panY:100}},zoomIn:{icon:'<svg><circle cx="11" cy="11" r="7.5"/><path d="m21 21-4.35-4.35M11 8v6M8 11h6"/></svg>',action:"zoomIn"},zoomOut:{icon:'<svg><circle cx="11" cy="11" r="7.5"/><path d="m21 21-4.35-4.35M8 11h6"/></svg>',action:"zoomOut"},toggle1to1:{icon:'<svg><path d="M3.51 3.07c5.74.02 11.48-.02 17.22.02 1.37.1 2.34 1.64 2.18 3.13 0 4.08.02 8.16 0 12.23-.1 1.54-1.47 2.64-2.79 2.46-5.61-.01-11.24.02-16.86-.01-1.36-.12-2.33-1.65-2.17-3.14 0-4.07-.02-8.16 0-12.23.1-1.36 1.22-2.48 2.42-2.46Z"/><path d="M5.65 8.54h1.49v6.92m8.94-6.92h1.49v6.92M11.5 9.4v.02m0 5.18v0"/></svg>',action:"toggleZoom"},toggleZoom:{icon:'<svg><g><line x1="11" y1="8" x2="11" y2="14"></line></g><circle cx="11" cy="11" r="7.5"/><path d="m21 21-4.35-4.35M8 11h6"/></svg>',action:"toggleZoom"},iterateZoom:{icon:'<svg><g><line x1="11" y1="8" x2="11" y2="14"></line></g><circle cx="11" cy="11" r="7.5"/><path d="m21 21-4.35-4.35M8 11h6"/></svg>',action:"iterateZoom"},rotateCCW:{icon:'<svg><path d="M15 4.55a8 8 0 0 0-6 14.9M9 15v5H4M18.37 7.16v.01M13 19.94v.01M16.84 18.37v.01M19.37 15.1v.01M19.94 11v.01"/></svg>',action:"rotateCCW"},rotateCW:{icon:'<svg><path d="M9 4.55a8 8 0 0 1 6 14.9M15 15v5h5M5.63 7.16v.01M4.06 11v.01M4.63 15.1v.01M7.16 18.37v.01M11 19.94v.01"/></svg>',action:"rotateCW"},flipX:{icon:'<svg style="stroke-width: 1.3"><path d="M12 3v18M16 7v10h5L16 7M8 7v10H3L8 7"/></svg>',action:"flipX"},flipY:{icon:'<svg style="stroke-width: 1.3"><path d="M3 12h18M7 16h10L7 21v-5M7 8h10L7 3v5"/></svg>',action:"flipY"},fitX:{icon:'<svg><path d="M4 12V6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v6M10 18H3M21 18h-7M6 15l-3 3 3 3M18 15l3 3-3 3"/></svg>',action:"fitX"},fitY:{icon:'<svg><path d="M12 20H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h6M18 14v7M18 3v7M15 18l3 3 3-3M15 6l3-3 3 3"/></svg>',action:"fitY"},reset:{icon:'<svg><path d="M20 11A8.1 8.1 0 0 0 4.5 9M4 5v4h4M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"/></svg>',action:"reset"},toggleFS:{icon:'<svg><g><path d="M14.5 9.5 21 3m0 0h-6m6 0v6M3 21l6.5-6.5M3 21v-6m0 6h6"/></g><g><path d="m14 10 7-7m-7 7h6m-6 0V4M3 21l7-7m0 0v6m0-6H4"/></g></svg>',action:"toggleFS"}};var Jl;(function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Disabled=2]="Disabled"})(Jl||(Jl={}));const X5={absolute:"auto",display:{left:["infobar"],middle:[],right:["iterateZoom","slideshow","fullscreen","thumbs","close"]},enabled:"auto",items:{infobar:{tpl:'<div class="fancybox__infobar" tabindex="-1"><span data-fancybox-current-index></span>/<span data-fancybox-count></span></div>'},download:{tpl:'<a class="f-button" title="{{DOWNLOAD}}" data-fancybox-download href="javasript:;"><svg><path d="M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2M7 11l5 5 5-5M12 4v12"/></svg></a>'},prev:{tpl:'<button class="f-button" title="{{PREV}}" data-fancybox-prev><svg><path d="m15 6-6 6 6 6"/></svg></button>'},next:{tpl:'<button class="f-button" title="{{NEXT}}" data-fancybox-next><svg><path d="m9 6 6 6-6 6"/></svg></button>'},slideshow:{tpl:'<button class="f-button" title="{{TOGGLE_SLIDESHOW}}" data-fancybox-toggle-slideshow><svg><g><path d="M8 4v16l13 -8z"></path></g><g><path d="M8 4v15M17 4v15"/></g></svg></button>'},fullscreen:{tpl:'<button class="f-button" title="{{TOGGLE_FULLSCREEN}}" data-fancybox-toggle-fullscreen><svg><g><path d="M4 8V6a2 2 0 0 1 2-2h2M4 16v2a2 2 0 0 0 2 2h2M16 4h2a2 2 0 0 1 2 2v2M16 20h2a2 2 0 0 0 2-2v-2"/></g><g><path d="M15 19v-2a2 2 0 0 1 2-2h2M15 5v2a2 2 0 0 0 2 2h2M5 15h2a2 2 0 0 1 2 2v2M5 9h2a2 2 0 0 0 2-2V5"/></g></svg></button>'},thumbs:{tpl:'<button class="f-button" title="{{TOGGLE_THUMBS}}" data-fancybox-toggle-thumbs><svg><circle cx="5.5" cy="5.5" r="1"/><circle cx="12" cy="5.5" r="1"/><circle cx="18.5" cy="5.5" r="1"/><circle cx="5.5" cy="12" r="1"/><circle cx="12" cy="12" r="1"/><circle cx="18.5" cy="12" r="1"/><circle cx="5.5" cy="18.5" r="1"/><circle cx="12" cy="18.5" r="1"/><circle cx="18.5" cy="18.5" r="1"/></svg></button>'},close:{tpl:'<button class="f-button" title="{{CLOSE}}" data-fancybox-close><svg><path d="m19.5 4.5-15 15M4.5 4.5l15 15"/></svg></button>'}},parentEl:null},K5={tabindex:"-1",width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},dE="has-toolbar",Pb="fancybox__toolbar";class uE extends io{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:Jl.Init}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null})}onReady(e){var n;if(!e.carousel)return;let r=this.option("display"),i=this.option("absolute"),s=this.option("enabled");if(s==="auto"){const g=this.instance.carousel;let y=0;if(g)for(const v of g.slides)(v.panzoom||v.type==="image")&&y++;y||(s=!1)}s||(r=void 0);let a=0;const o={left:[],middle:[],right:[]};if(r)for(const g of["left","middle","right"])for(const y of r[g]){const v=this.createEl(y);v&&((n=o[g])===null||n===void 0||n.push(v),a++)}let f=null;if(a&&(f=this.createContainer()),f){for(const[g,y]of Object.entries(o)){const v=document.createElement("div");Bt(v,Pb+"__column is-"+g);for(const w of y)v.appendChild(w);i!=="auto"||g!=="middle"||y.length||(i=!0),f.appendChild(v)}i===!0&&Bt(f,"is-absolute"),this.state=Jl.Ready,this.onRefresh()}else this.state=Jl.Disabled}onClick(e){var n,r;const i=this.instance,s=i.getSlide(),a=s==null?void 0:s.panzoom,o=e.target,f=o&&es(o)?o.dataset:null;if(!f)return;if(f.fancyboxToggleThumbs!==void 0)return e.preventDefault(),e.stopPropagation(),void((n=i.plugins.Thumbs)===null||n===void 0||n.toggle());if(f.fancyboxToggleFullscreen!==void 0)return e.preventDefault(),e.stopPropagation(),void this.instance.toggleFullscreen();if(f.fancyboxToggleSlideshow!==void 0){e.preventDefault(),e.stopPropagation();const v=(r=i.carousel)===null||r===void 0?void 0:r.plugins.Autoplay;let w=v.isActive;return a&&a.panMode==="mousemove"&&!w&&a.reset(),void(w?v.stop():v.start())}const g=f.panzoomAction,y=f.panzoomChange;if((y||g)&&(e.preventDefault(),e.stopPropagation()),y){let v={};try{v=JSON.parse(y)}catch{}a&&a.applyChange(v)}else g&&a&&a[g]&&a[g]()}onChange(){this.onRefresh()}onRefresh(){if(this.instance.isClosing())return;const e=this.container;if(!e)return;const n=this.instance.getSlide();if(!n||n.state!==xi.Ready)return;const r=n&&!n.error&&n.panzoom;for(const a of e.querySelectorAll("[data-panzoom-action]"))r?(a.removeAttribute("disabled"),a.removeAttribute("tabindex")):(a.setAttribute("disabled",""),a.setAttribute("tabindex","-1"));let i=r&&r.canZoomIn(),s=r&&r.canZoomOut();for(const a of e.querySelectorAll('[data-panzoom-action="zoomIn"]'))i?(a.removeAttribute("disabled"),a.removeAttribute("tabindex")):(a.setAttribute("disabled",""),a.setAttribute("tabindex","-1"));for(const a of e.querySelectorAll('[data-panzoom-action="zoomOut"]'))s?(a.removeAttribute("disabled"),a.removeAttribute("tabindex")):(a.setAttribute("disabled",""),a.setAttribute("tabindex","-1"));for(const a of e.querySelectorAll('[data-panzoom-action="toggleZoom"],[data-panzoom-action="iterateZoom"]')){s||i?(a.removeAttribute("disabled"),a.removeAttribute("tabindex")):(a.setAttribute("disabled",""),a.setAttribute("tabindex","-1"));const o=a.querySelector("g");o&&(o.style.display=i?"":"none")}}onDone(e,n){var r;(r=n.panzoom)===null||r===void 0||r.on("afterTransform",()=>{this.instance.isCurrentSlide(n)&&this.onRefresh()}),this.instance.isCurrentSlide(n)&&this.onRefresh()}createContainer(){const e=this.instance.container;if(!e)return null;const n=this.option("parentEl")||e;let r=n.querySelector("."+Pb);return r||(r=document.createElement("div"),Bt(r,Pb),n.prepend(r)),r.addEventListener("click",this.onClick,{passive:!1,capture:!0}),e&&Bt(e,dE),this.container=r,r}createEl(e){const n=this.instance,r=n.carousel;if(!r||e==="toggleFS"||e==="fullscreen"&&!W2())return null;let i=null;const s=r.slides.length||0;let a=0,o=0;for(const g of r.slides)(g.panzoom||g.type==="image")&&a++,(g.type==="image"||g.downloadSrc)&&o++;if(s<2&&["infobar","prev","next"].includes(e))return i;if(Ib[e]!==void 0&&!a||e==="download"&&!o)return null;if(e==="thumbs"){const g=n.plugins.Thumbs;if(!g||!g.isEnabled)return null}if(e==="slideshow"&&(!r.plugins.Autoplay||s<2))return null;if(Ib[e]!==void 0){const g=Ib[e];i=document.createElement("button"),i.setAttribute("title",this.instance.localize(`{{${e.toUpperCase()}}}`)),Bt(i,"f-button"),g.action&&(i.dataset.panzoomAction=g.action),g.change&&(i.dataset.panzoomChange=JSON.stringify(g.change)),i.appendChild(wo(this.instance.localize(g.icon)))}else{const g=(this.option("items")||[])[e];g&&(i=wo(this.instance.localize(g.tpl)),typeof g.click=="function"&&i.addEventListener("click",y=>{y.preventDefault(),y.stopPropagation(),typeof g.click=="function"&&g.click.call(this,this,y)}))}const f=i==null?void 0:i.querySelector("svg");if(f)for(const[g,y]of Object.entries(K5))f.getAttribute(g)||f.setAttribute(g,String(y));return i}removeContainer(){const e=this.container;e&&e.remove(),this.container=null,this.state=Jl.Disabled;const n=this.instance.container;n&&Fn(n,dE)}attach(){const e=this,n=e.instance;n.on("Carousel.initSlides",e.onReady),n.on("done",e.onDone),n.on(["reveal","Carousel.change"],e.onChange),e.onReady(e.instance)}detach(){const e=this,n=e.instance;n.off("Carousel.initSlides",e.onReady),n.off("done",e.onDone),n.off(["reveal","Carousel.change"],e.onChange),e.removeContainer()}}Object.defineProperty(uE,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:X5});const J5={Hash:class extends io{onReady(){Sh=!1}onChange(t){Xl&&clearTimeout(Xl);const{hash:e}=G2(),{hash:n}=_m(),r=t.isOpeningSlide(t.getSlide());r&&(q2=n===e?"":n),e&&e!==n&&(Xl=setTimeout(()=>{try{if(t.state===$r.Ready){let i="replaceState";r&&!bm&&(i="pushState",bm=!0),window.history[i]({},document.title,window.location.pathname+window.location.search+e)}}catch{}},300))}onClose(t){if(Xl&&clearTimeout(Xl),!Sh&&bm)return bm=!1,Sh=!1,void window.history.back();if(!Sh)try{window.history.replaceState({},document.title,window.location.pathname+window.location.search+(q2||""))}catch{}}attach(){const t=this.instance;t.on("ready",this.onReady),t.on(["Carousel.ready","Carousel.change"],this.onChange),t.on("close",this.onClose)}detach(){const t=this.instance;t.off("ready",this.onReady),t.off(["Carousel.ready","Carousel.change"],this.onChange),t.off("close",this.onClose)}static parseURL(){return _m()}static startFromUrl(){Y2()}static destroy(){window.removeEventListener("hashchange",X2,!1)}},Html:tE,Images:J2,Slideshow:rE,Thumbs:cE,Toolbar:uE},hE="with-fancybox",Nb="hide-scrollbar",pE="--fancybox-scrollbar-compensate",fE="--fancybox-body-margin",Rb="aria-hidden",Ob="is-using-tab",Bb="is-animated",mE="is-compact",gE="is-loading",Vb="is-opening",Em="has-caption",Cd="disabled",Ql="tabindex",yE="download",zb="href",Td="src",Ga=t=>typeof t=="string",bE=function(){var t=window.getSelection();return!!t&&t.type==="Range"};let zs,Ls=null,ec=null,_E=0,xE=0,vE=0,wE=0;const Ad=new Map;let Q5=0;class An extends vb{get isIdle(){return this.idle}get isCompact(){return this.option("compact")}constructor(e=[],n={},r={}){super(n),Object.defineProperty(this,"userSlides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"idle",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"idleTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"pwt",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"ignoreFocusChange",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"startedFs",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:$r.Init}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"footer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"lastFocus",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"prevMouseMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),zs||(zs=W2()),this.id=n.id||++Q5,Ad.set(this.id,this),this.userSlides=e,this.userPlugins=r,queueMicrotask(()=>{this.init()})}init(){if(this.state===$r.Destroy)return;this.state=$r.Init,this.attachPlugins(Object.assign(Object.assign({},An.Plugins),this.userPlugins)),this.emit("init"),this.emit("attachPlugins"),this.option("hideScrollbar")===!0&&(()=>{if(!Eh)return;const n=document,r=n.body,i=n.documentElement;if(r.classList.contains(Nb))return;let s=window.innerWidth-i.getBoundingClientRect().width;const a=parseFloat(window.getComputedStyle(r).marginRight);s<0&&(s=0),i.style.setProperty(pE,`${s}px`),a&&r.style.setProperty(fE,`${a}px`),r.classList.add(Nb)})(),this.initLayout(),this.scale();const e=()=>{this.initCarousel(this.userSlides),this.state=$r.Ready,this.attachEvents(),this.emit("ready"),setTimeout(()=>{this.container&&this.container.setAttribute(Rb,"false")},16)};this.option("Fullscreen.autoStart")&&zs&&!zs.isFullscreen()?zs.request().then(()=>{this.startedFs=!0,e()}).catch(()=>e()):e()}initLayout(){var e,n;const r=this.option("parentEl")||document.body,i=wo(this.localize(this.option("tpl.main")||""));if(i){if(i.setAttribute("id",`fancybox-${this.id}`),i.setAttribute("aria-label",this.localize("{{MODAL}}")),i.classList.toggle(mE,this.isCompact),Bt(i,this.option("mainClass")||""),Bt(i,Vb),this.container=i,this.footer=i.querySelector(".fancybox__footer"),r.appendChild(i),Bt(document.documentElement,hE),Ls&&ec||(Ls=document.createElement("span"),Bt(Ls,"fancybox-focus-guard"),Ls.setAttribute(Ql,"0"),Ls.setAttribute(Rb,"true"),Ls.setAttribute("aria-label","Focus guard"),ec=Ls.cloneNode(),(e=i.parentElement)===null||e===void 0||e.insertBefore(Ls,i),(n=i.parentElement)===null||n===void 0||n.append(ec)),i.addEventListener("mousedown",s=>{_E=s.pageX,xE=s.pageY,Fn(i,Ob)}),this.option("closeExisting"))for(const s of Ad.values())s.id!==this.id&&s.close();else this.option("animated")&&(Bt(i,Bb),setTimeout(()=>{this.isClosing()||Fn(i,Bb)},350));this.emit("initLayout")}}initCarousel(e){const n=this.container;if(!n)return;const r=n.querySelector(".fancybox__carousel");if(!r)return;const i=this.carousel=new kh(r,Qi({},{slides:e,transition:"fade",Panzoom:{lockAxis:this.option("dragToClose")?"xy":"x",infinite:!!this.option("dragToClose")&&"y"},Dots:!1,Navigation:{classes:{container:"fancybox__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"}},initialPage:this.option("startIndex"),l10n:this.option("l10n")},this.option("Carousel")||{}));i.on("*",(s,a,...o)=>{this.emit(`Carousel.${a}`,s,...o)}),i.on(["ready","change"],()=>{this.manageCaption()}),this.on("Carousel.removeSlide",(s,a,o)=>{this.clearContent(o),o.state=void 0}),i.on("Panzoom.touchStart",()=>{var s,a;this.isCompact||this.endIdle(),!((s=document.activeElement)===null||s===void 0)&&s.closest(".f-thumbs")&&((a=this.container)===null||a===void 0||a.focus())}),i.on("settle",()=>{this.idleTimer||this.isCompact||!this.option("idle")||this.setIdle(),this.option("autoFocus")&&!this.isClosing&&this.checkFocus()}),this.option("dragToClose")&&(i.on("Panzoom.afterTransform",(s,a)=>{const o=this.getSlide();if(o&&yb(o.el))return;const f=this.container;if(f){const g=Math.abs(a.current.f),y=g<1?"":Math.max(.5,Math.min(1,1-g/a.contentRect.fitHeight*1.5));f.style.setProperty("--fancybox-ts",y?"0s":""),f.style.setProperty("--fancybox-opacity",y+"")}}),i.on("Panzoom.touchEnd",(s,a,o)=>{var f;const g=this.getSlide();if(g&&yb(g.el)||a.isMobile&&document.activeElement&&["TEXTAREA","INPUT"].indexOf((f=document.activeElement)===null||f===void 0?void 0:f.nodeName)!==-1)return;const y=Math.abs(a.dragOffset.y);a.lockedAxis==="y"&&(y>=200||y>=50&&a.dragOffset.time<300)&&(o&&o.cancelable&&o.preventDefault(),this.close(o,"f-throwOut"+(a.current.f<0?"Up":"Down")))})),i.on("change",s=>{var a;let o=(a=this.getSlide())===null||a===void 0?void 0:a.triggerEl;if(o){const f=new CustomEvent("slideTo",{bubbles:!0,cancelable:!0,detail:s.page});o.dispatchEvent(f)}}),i.on(["refresh","change"],s=>{const a=this.container;if(!a)return;for(const g of a.querySelectorAll("[data-fancybox-current-index]"))g.innerHTML=s.page+1;for(const g of a.querySelectorAll("[data-fancybox-count]"))g.innerHTML=s.pages.length;if(!s.isInfinite){for(const g of a.querySelectorAll("[data-fancybox-next]"))s.page<s.pages.length-1?(g.removeAttribute(Cd),g.removeAttribute(Ql)):(g.setAttribute(Cd,""),g.setAttribute(Ql,"-1"));for(const g of a.querySelectorAll("[data-fancybox-prev]"))s.page>0?(g.removeAttribute(Cd),g.removeAttribute(Ql)):(g.setAttribute(Cd,""),g.setAttribute(Ql,"-1"))}const o=this.getSlide();if(!o)return;let f=o.downloadSrc||"";f||o.type!=="image"||o.error||!Ga(o[Td])||(f=o[Td]);for(const g of a.querySelectorAll("[data-fancybox-download]")){const y=o.downloadFilename;f?(g.removeAttribute(Cd),g.removeAttribute(Ql),g.setAttribute(zb,f),g.setAttribute(yE,y||f),g.setAttribute("target","_blank")):(g.setAttribute(Cd,""),g.setAttribute(Ql,"-1"),g.removeAttribute(zb),g.removeAttribute(yE))}}),this.emit("initCarousel")}attachEvents(){const e=this,n=e.container;if(!n)return;n.addEventListener("click",e.onClick,{passive:!1,capture:!1}),n.addEventListener("wheel",e.onWheel,{passive:!1,capture:!1}),document.addEventListener("keydown",e.onKeydown,{passive:!1,capture:!0}),document.addEventListener("visibilitychange",e.onVisibilityChange,!1),document.addEventListener("mousemove",e.onMousemove),e.option("trapFocus")&&document.addEventListener("focus",e.onFocus,!0),window.addEventListener("resize",e.onResize);const r=window.visualViewport;r&&(r.addEventListener("scroll",e.onResize),r.addEventListener("resize",e.onResize))}detachEvents(){const e=this,n=e.container;if(!n)return;document.removeEventListener("keydown",e.onKeydown,{passive:!1,capture:!0}),n.removeEventListener("wheel",e.onWheel,{passive:!1,capture:!1}),n.removeEventListener("click",e.onClick,{passive:!1,capture:!1}),document.removeEventListener("mousemove",e.onMousemove),window.removeEventListener("resize",e.onResize);const r=window.visualViewport;r&&(r.removeEventListener("resize",e.onResize),r.removeEventListener("scroll",e.onResize)),document.removeEventListener("visibilitychange",e.onVisibilityChange,!1),document.removeEventListener("focus",e.onFocus,!0)}scale(){const e=this.container;if(!e)return;const n=window.visualViewport,r=Math.max(1,(n==null?void 0:n.scale)||1);let i="",s="",a="";if(n&&r>1){let o=`${n.offsetLeft}px`,f=`${n.offsetTop}px`;i=n.width*r+"px",s=n.height*r+"px",a=`translate3d(${o}, ${f}, 0) scale(${1/r})`}e.style.transform=a,e.style.width=i,e.style.height=s}onClick(e){var n;const{container:r,isCompact:i}=this;if(!r||this.isClosing())return;!i&&this.option("idle")&&this.resetIdle();const s=e.composedPath()[0];if(s.closest(".fancybox-spinner")||s.closest("[data-fancybox-close]"))return e.preventDefault(),void this.close(e);if(s.closest("[data-fancybox-prev]"))return e.preventDefault(),void this.prev();if(s.closest("[data-fancybox-next]"))return e.preventDefault(),void this.next();if(e.type==="click"&&e.detail===0||Math.abs(e.pageX-_E)>30||Math.abs(e.pageY-xE)>30)return;const a=document.activeElement;if(bE()&&a&&r.contains(a))return;if(i&&((n=this.getSlide())===null||n===void 0?void 0:n.type)==="image")return void(this.clickTimer?(clearTimeout(this.clickTimer),this.clickTimer=null):this.clickTimer=setTimeout(()=>{this.toggleIdle(),this.clickTimer=null},350));if(this.emit("click",e),e.defaultPrevented)return;let o=!1;if(s.closest(".fancybox__content")){if(a){if(a.closest("[contenteditable]"))return;s.matches(Tb)||a.blur()}if(bE())return;o=this.option("contentClick")}else s.closest(".fancybox__carousel")&&!s.matches(Tb)&&(o=this.option("backdropClick"));o==="close"?(e.preventDefault(),this.close(e)):o==="next"?(e.preventDefault(),this.next()):o==="prev"&&(e.preventDefault(),this.prev())}onWheel(e){const n=e.target;let r=this.option("wheel",e);n.closest(".fancybox__thumbs")&&(r="slide");const i=r==="slide",s=[-e.deltaX||0,-e.deltaY||0,-e.detail||0].reduce(function(f,g){return Math.abs(g)>Math.abs(f)?g:f}),a=Math.max(-1,Math.min(1,s)),o=Date.now();this.pwt&&o-this.pwt<300?i&&e.preventDefault():(this.pwt=o,this.emit("wheel",e,a),e.defaultPrevented||(r==="close"?(e.preventDefault(),this.close(e)):r==="slide"&&(dm(n)||(e.preventDefault(),this[a>0?"prev":"next"]()))))}onScroll(){window.scrollTo(vE,wE)}onKeydown(e){if(!this.isTopmost())return;this.isCompact||!this.option("idle")||this.isClosing()||this.resetIdle();const n=e.key,r=this.option("keyboard");if(!r)return;const i=e.composedPath()[0],s=document.activeElement&&document.activeElement.classList,a=s&&s.contains("f-button")||i.dataset.carouselPage||i.dataset.carouselIndex;if(n!=="Escape"&&!a&&es(i)&&(i.isContentEditable||["TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].indexOf(i.nodeName)!==-1)||(e.key==="Tab"?Bt(this.container,Ob):Fn(this.container,Ob),e.ctrlKey||e.altKey||e.shiftKey))return;this.emit("keydown",n,e);const o=r[n];o&&typeof this[o]=="function"&&(e.preventDefault(),this[o]())}onResize(){const e=this.container;if(!e)return;const n=this.isCompact;e.classList.toggle(mE,n),this.manageCaption(this.getSlide()),this.isCompact?this.clearIdle():this.endIdle(),this.scale(),this.emit("resize")}onFocus(e){this.isTopmost()&&this.checkFocus(e)}onMousemove(e){this.prevMouseMoveEvent=e,!this.isCompact&&this.option("idle")&&this.resetIdle()}onVisibilityChange(){document.visibilityState==="visible"?this.checkFocus():this.endIdle()}manageCloseBtn(e){const n=this.optionFor(e,"closeButton")||!1;if(n==="auto"){const i=this.plugins.Toolbar;if(i&&i.state===Jl.Ready)return}if(!n||!e.contentEl||e.closeBtnEl)return;const r=this.option("tpl.closeButton");if(r){const i=wo(this.localize(r));e.closeBtnEl=e.contentEl.appendChild(i),e.el&&Bt(e.el,"has-close-btn")}}manageCaption(e=void 0){var n,r;const i="fancybox__caption",s=this.container;if(!s)return;Fn(s,Em);const a=this.isCompact||this.option("commonCaption"),o=!a;if(this.caption&&this.stop(this.caption),o&&this.caption&&(this.caption.remove(),this.caption=null),a&&!this.caption)for(const v of((n=this.carousel)===null||n===void 0?void 0:n.slides)||[])v.captionEl&&(v.captionEl.remove(),v.captionEl=void 0,Fn(v.el,Em),(r=v.el)===null||r===void 0||r.removeAttribute("aria-labelledby"));if(e||(e=this.getSlide()),!e||a&&!this.isCurrentSlide(e))return;const f=e.el;let g=this.optionFor(e,"caption","");if(!g)return void(a&&this.caption&&this.animate(this.caption,"f-fadeOut",()=>{this.caption&&(this.caption.innerHTML="")}));let y=null;if(o){if(y=e.captionEl||null,f&&!y){const v=i+`_${this.id}_${e.index}`;y=document.createElement("div"),Bt(y,i),y.setAttribute("id",v),e.captionEl=f.appendChild(y),Bt(f,Em),f.setAttribute("aria-labelledby",v)}}else y=this.caption,y||(y=s.querySelector("."+i)),!y&&(y=document.createElement("div"),y.dataset.fancyboxCaption="",Bt(y,i),(this.footer||s).prepend(y)),Bt(s,Em),this.caption=y;y&&(y.innerHTML="",Ga(g)||typeof g=="number"?y.innerHTML=g+"":g instanceof HTMLElement&&y.appendChild(g))}checkFocus(e){this.focus(e)}focus(e){var n;if(this.ignoreFocusChange)return;const r=document.activeElement||null,i=(e==null?void 0:e.target)||null,s=this.container,a=(n=this.carousel)===null||n===void 0?void 0:n.viewport;if(!s||!a||!e&&r&&s.contains(r))return;const o=this.getSlide(),f=o&&o.state===xi.Ready?o.el:null;if(!f||f.contains(r)||s===r)return;e&&e.cancelable&&e.preventDefault(),this.ignoreFocusChange=!0;const g=Array.from(s.querySelectorAll(Tb));let y=[],v=null;for(let T of g){const D=!T.offsetParent||!!T.closest('[aria-hidden="true"]'),O=f&&f.contains(T),B=!a.contains(T);if(T===s||(O||B)&&!D){y.push(T);const L=T.dataset.origTabindex;L!==void 0&&L&&(T.tabIndex=parseFloat(L)),T.removeAttribute("data-orig-tabindex"),!T.hasAttribute("autoFocus")&&v||(v=T)}else{const L=T.dataset.origTabindex===void 0?T.getAttribute("tabindex")||"":T.dataset.origTabindex;L&&(T.dataset.origTabindex=L),T.tabIndex=-1}}let w=null;e?(!i||y.indexOf(i)<0)&&(w=v||s,y.length&&(r===ec?w=y[0]:this.lastFocus!==s&&r!==Ls||(w=y[y.length-1]))):w=o&&o.type==="image"?s:v||s,w&&U2(w),this.lastFocus=document.activeElement,this.ignoreFocusChange=!1}next(){const e=this.carousel;e&&e.pages.length>1&&e.slideNext()}prev(){const e=this.carousel;e&&e.pages.length>1&&e.slidePrev()}jumpTo(...e){this.carousel&&this.carousel.slideTo(...e)}isTopmost(){var e;return((e=An.getInstance())===null||e===void 0?void 0:e.id)==this.id}animate(e=null,n="",r){if(!e||!n)return void(r&&r());this.stop(e);const i=s=>{s.target===e&&e.dataset.animationName&&(e.removeEventListener("animationend",i),delete e.dataset.animationName,r&&r(),Fn(e,n))};e.dataset.animationName=n,e.addEventListener("animationend",i),Bt(e,n)}stop(e){e&&e.dispatchEvent(new CustomEvent("animationend",{bubbles:!1,cancelable:!0,currentTarget:e}))}setContent(e,n="",r=!0){if(this.isClosing())return;const i=e.el;if(!i)return;let s=null;if(es(n)?s=n:(s=wo(n+""),es(s)||(s=document.createElement("div"),s.innerHTML=n+"")),["img","picture","iframe","video","audio"].includes(s.nodeName.toLowerCase())){const a=document.createElement("div");a.appendChild(s),s=a}es(s)&&e.filter&&!e.error&&(s=s.querySelector(e.filter)),s&&es(s)?(Bt(s,"fancybox__content"),e.id&&s.setAttribute("id",e.id),i.classList.add(`has-${e.error?"error":e.type||"unknown"}`),i.prepend(s),s.style.display==="none"&&(s.style.display=""),getComputedStyle(s).getPropertyValue("display")==="none"&&(s.style.display=e.display||this.option("defaultDisplay")||"flex"),e.contentEl=s,r&&this.revealContent(e),this.manageCloseBtn(e),this.manageCaption(e)):this.setError(e,"{{ELEMENT_NOT_FOUND}}")}revealContent(e,n){const r=e.el,i=e.contentEl;r&&i&&(this.emit("reveal",e),this.hideLoading(e),e.state=xi.Opening,(n=this.isOpeningSlide(e)?n===void 0?this.optionFor(e,"showClass"):n:"f-fadeIn")?this.animate(i,n,()=>{this.done(e)}):this.done(e))}done(e){this.isClosing()||(e.state=xi.Ready,this.emit("done",e),Bt(e.el,"is-done"),this.isCurrentSlide(e)&&this.option("autoFocus")&&queueMicrotask(()=>{var n;(n=e.panzoom)===null||n===void 0||n.updateControls(),this.option("autoFocus")&&this.focus()}),this.isOpeningSlide(e)&&(Fn(this.container,Vb),!this.isCompact&&this.option("idle")&&this.setIdle()))}isCurrentSlide(e){const n=this.getSlide();return!(!e||!n)&&n.index===e.index}isOpeningSlide(e){var n,r;return((n=this.carousel)===null||n===void 0?void 0:n.prevPage)===null&&e&&e.index===((r=this.getSlide())===null||r===void 0?void 0:r.index)}showLoading(e){e.state=xi.Loading;const n=e.el;n&&(Bt(n,gE),this.emit("loading",e),e.spinnerEl||setTimeout(()=>{if(!this.isClosing()&&!e.spinnerEl&&e.state===xi.Loading){let r=wo(wb);Bt(r,"fancybox-spinner"),e.spinnerEl=r,n.prepend(r),this.animate(r,"f-fadeIn")}},250))}hideLoading(e){const n=e.el;if(!n)return;const r=e.spinnerEl;this.isClosing()?r==null||r.remove():(Fn(n,gE),r&&this.animate(r,"f-fadeOut",()=>{r.remove()}),e.state===xi.Loading&&(this.emit("loaded",e),e.state=xi.Ready))}setError(e,n){if(this.isClosing())return;const r=new Event("error",{bubbles:!0,cancelable:!0});if(this.emit("error",r,e),r.defaultPrevented)return;e.error=n,this.hideLoading(e),this.clearContent(e);const i=document.createElement("div");i.classList.add("fancybox-error"),i.innerHTML=this.localize(n||"<p>{{ERROR}}</p>"),this.setContent(e,i)}clearContent(e){if(e.state===void 0)return;this.emit("clearContent",e),e.contentEl&&(e.contentEl.remove(),e.contentEl=void 0);const n=e.el;n&&(Fn(n,"has-error"),Fn(n,"has-unknown"),Fn(n,`has-${e.type||"unknown"}`)),e.closeBtnEl&&e.closeBtnEl.remove(),e.closeBtnEl=void 0,e.captionEl&&e.captionEl.remove(),e.captionEl=void 0,e.spinnerEl&&e.spinnerEl.remove(),e.spinnerEl=void 0}getSlide(){var e;const n=this.carousel;return((e=n==null?void 0:n.pages[n==null?void 0:n.page])===null||e===void 0?void 0:e.slides[0])||void 0}close(e,n){if(this.isClosing())return;const r=new Event("shouldClose",{bubbles:!0,cancelable:!0});if(this.emit("shouldClose",r,e),r.defaultPrevented)return;e&&e.cancelable&&(e.preventDefault(),e.stopPropagation());const i=()=>{this.proceedClose(e,n)};this.startedFs&&zs&&zs.isFullscreen()?Promise.resolve(zs.exit()).then(()=>i()):i()}clearIdle(){this.idleTimer&&clearTimeout(this.idleTimer),this.idleTimer=null}setIdle(e=!1){const n=()=>{this.clearIdle(),this.idle=!0,Bt(this.container,"is-idle"),this.emit("setIdle")};if(this.clearIdle(),!this.isClosing())if(e)n();else{const r=this.option("idle");r&&(this.idleTimer=setTimeout(n,r))}}endIdle(){this.clearIdle(),this.idle&&!this.isClosing()&&(this.idle=!1,Fn(this.container,"is-idle"),this.emit("endIdle"))}resetIdle(){this.endIdle(),this.setIdle()}toggleIdle(){this.idle?this.endIdle():this.setIdle(!0)}toggleFullscreen(){zs&&(zs.isFullscreen()?zs.exit():zs.request().then(()=>{this.startedFs=!0}))}isClosing(){return[$r.Closing,$r.CustomClosing,$r.Destroy].includes(this.state)}proceedClose(e,n){var r,i;this.state=$r.Closing,this.clearIdle(),this.detachEvents();const s=this.container,a=this.carousel,o=this.getSlide(),f=o&&this.option("placeFocusBack")?o.triggerEl||this.option("triggerEl"):null;if(f&&(H2(f)?U2(f):f.focus()),s&&(Fn(s,Vb),Bt(s,"is-closing"),s.setAttribute(Rb,"true"),this.option("animated")&&Bt(s,Bb),s.style.pointerEvents="none"),a){a.clearTransitions(),(r=a.panzoom)===null||r===void 0||r.destroy(),(i=a.plugins.Navigation)===null||i===void 0||i.detach();for(const g of a.slides){g.state=xi.Closing,this.hideLoading(g);const y=g.contentEl;y&&this.stop(y);const v=g==null?void 0:g.panzoom;v&&(v.stop(),v.detachEvents(),v.detachObserver()),this.isCurrentSlide(g)||a.emit("removeSlide",g)}}vE=window.scrollX,wE=window.scrollY,window.addEventListener("scroll",this.onScroll),this.emit("close",e),this.state!==$r.CustomClosing?(n===void 0&&o&&(n=this.optionFor(o,"hideClass")),n&&o?(this.animate(o.contentEl,n,()=>{a&&a.emit("removeSlide",o)}),setTimeout(()=>{this.destroy()},500)):this.destroy()):setTimeout(()=>{this.destroy()},500)}destroy(){var e;if(this.state===$r.Destroy)return;window.removeEventListener("scroll",this.onScroll),this.state=$r.Destroy,(e=this.carousel)===null||e===void 0||e.destroy();const n=this.container;n&&n.remove(),Ad.delete(this.id);const r=An.getInstance();r?r.focus():(Ls&&(Ls.remove(),Ls=null),ec&&(ec.remove(),ec=null),Fn(document.documentElement,hE),(()=>{if(!Eh)return;const i=document,s=i.body;s.classList.remove(Nb),s.style.setProperty(fE,""),i.documentElement.style.setProperty(pE,"")})(),this.emit("destroy"))}static bind(e,n,r){if(!Eh)return;let i,s="",a={};if(e===void 0?i=document.body:Ga(e)?(i=document.body,s=e,typeof n=="object"&&(a=n||{})):(i=e,Ga(n)&&(s=n),typeof r=="object"&&(a=r||{})),!i||!es(i))return;s=s||"[data-fancybox]";const o=An.openers.get(i)||new Map;o.set(s,a),An.openers.set(i,o),o.size===1&&i.addEventListener("click",An.fromEvent)}static unbind(e,n){let r,i="";if(Ga(e)?(r=document.body,i=e):(r=e,Ga(n)&&(i=n)),!r)return;const s=An.openers.get(r);s&&i&&s.delete(i),i&&s||(An.openers.delete(r),r.removeEventListener("click",An.fromEvent))}static destroy(){let e;for(;e=An.getInstance();)e.destroy();for(const n of An.openers.keys())n.removeEventListener("click",An.fromEvent);An.openers=new Map}static fromEvent(e){if(e.defaultPrevented||e.button&&e.button!==0||e.ctrlKey||e.metaKey||e.shiftKey)return;let n=e.composedPath()[0];const r=n.closest("[data-fancybox-trigger]");if(r){const D=r.dataset.fancyboxTrigger||"",O=document.querySelectorAll(`[data-fancybox="${D}"]`),B=parseInt(r.dataset.fancyboxIndex||"",10)||0;n=O[B]||n}if(!(n&&n instanceof Element))return;let i,s,a,o;if([...An.openers].reverse().find(([D,O])=>!(!D.contains(n)||![...O].reverse().find(([B,L])=>{let U=n.closest(B);return!!U&&(i=D,s=B,a=U,o=L,!0)}))),!i||!s||!a)return;o=o||{},e.preventDefault(),n=a;let f=[],g=Qi({},Ab,o);g.event=e,g.triggerEl=n,g.delegate=r;const y=g.groupAll,v=g.groupAttr,w=v&&n?n.getAttribute(`${v}`):"";if((!n||w||y)&&(f=[].slice.call(i.querySelectorAll(s))),n&&!y&&(f=w?f.filter(D=>D.getAttribute(`${v}`)===w):[n]),!f.length)return;const T=An.getInstance();return T&&T.options.triggerEl&&f.indexOf(T.options.triggerEl)>-1?void 0:(n&&(g.startIndex=f.indexOf(n)),An.fromNodes(f,g))}static fromSelector(e,n,r){let i=null,s="",a={};if(Ga(e)?(i=document.body,s=e,typeof n=="object"&&(a=n||{})):e instanceof HTMLElement&&Ga(n)&&(i=e,s=n,typeof r=="object"&&(a=r||{})),!i||!s)return!1;const o=An.openers.get(i);return!!o&&(a=Qi({},o.get(s)||{},a),!!a&&An.fromNodes(Array.from(i.querySelectorAll(s)),a))}static fromNodes(e,n){n=Qi({},Ab,n||{});const r=[];for(const i of e){const s=i.dataset||{},a=s[Td]||i.getAttribute(zb)||i.getAttribute("currentSrc")||i.getAttribute(Td)||void 0;let o;const f=n.delegate;let g;f&&r.length===n.startIndex&&(o=f instanceof HTMLImageElement?f:f.querySelector("img:not([aria-hidden])")),o||(o=i instanceof HTMLImageElement?i:i.querySelector("img:not([aria-hidden])")),o&&(g=o.currentSrc||o[Td]||void 0,!g&&o.dataset&&(g=o.dataset.lazySrc||o.dataset[Td]||void 0));const y={src:a,triggerEl:i,thumbEl:o,thumbElSrc:g,thumbSrc:g};for(const v in s){let w=s[v]+"";w=w!=="false"&&(w==="true"||w),y[v]=w}r.push(y)}return new An(r,n)}static getInstance(e){return e?Ad.get(e):Array.from(Ad.values()).reverse().find(n=>!n.isClosing()&&n)||null}static getSlide(){var e;return((e=An.getInstance())===null||e===void 0?void 0:e.getSlide())||null}static show(e=[],n={}){return new An(e,n)}static next(){const e=An.getInstance();e&&e.next()}static prev(){const e=An.getInstance();e&&e.prev()}static close(e=!0,...n){if(e)for(const r of Ad.values())r.close(...n);else{const r=An.getInstance();r&&r.close(...n)}}}Object.defineProperty(An,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.36"}),Object.defineProperty(An,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:Ab}),Object.defineProperty(An,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:J5}),Object.defineProperty(An,"openers",{enumerable:!0,configurable:!0,writable:!0,value:new Map});const Sm=Object.freeze(Object.defineProperty({__proto__:null,Carousel:kh,Fancybox:An,Panzoom:Ed},Symbol.toStringTag,{value:"Module"})),{Fancybox:Cm}=Sm,eL={props:{options:Object},mounted(){Cm.defaults={...this.options||{}}},updated(){Cm.close(),Cm.defaults={...this.options||{}}},unmounted(){Cm.close()}},tL={ref:"container"};function nL(t,e,n,r,i,s){return d.openBlock(),d.createElementBlock("div",tL,[d.renderSlot(t.$slots,"default")],512)}const rL=Le(eL,[["render",nL]]),iL={},sL={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-file"};function oL(t,e,n,r,i,s){return d.openBlock(),d.createElementBlock("svg",sL,e[0]||(e[0]=[d.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),d.createElementVNode("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"},null,-1),d.createElementVNode("path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"},null,-1)]))}const kE=Le(iL,[["render",oL]]),aL={componens:{IconFile:kE},props:{item:null},computed:{createDate(){try{const t=_t(this.item.cdate,"YYYY-MM-DD");return new Date(t).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}}},methods:{formatBytes(t){if(t<1024)return`${t} B`;const e=t/1024;return e<1024?`${e.toFixed(2)} KB`:`${(e/1024).toFixed(2)} MB`}}},lL={class:"max-w-[55vw]"},cL={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},dL={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},uL={class:"px-[5px]"},hL={class:""};function pL(t,e,n,r,i,s){var a,o;return d.openBlock(),d.createElementBlock(d.Fragment,null,[e[1]||(e[1]=d.createStaticVNode('<div class="flex items-center justify-center h-[30px] w-[30px]"><svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-file"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path></svg></div>',1)),d.createElementVNode("div",lL,[d.createElementVNode("p",cL,d.toDisplayString(n.item.uploaded_name),1),d.createElementVNode("p",dL,[d.createElementVNode("span",null,d.toDisplayString(n.item.username),1),d.withDirectives(d.createElementVNode("span",uL,"|",512),[[d.vShow,(a=n.item)==null?void 0:a.username]]),d.createElementVNode("span",null,d.toDisplayString(s.createDate),1),e[0]||(e[0]=d.createElementVNode("span",{class:"px-[5px]"},"|",-1)),d.createElementVNode("span",hL,d.toDisplayString(s.formatBytes((o=n.item)==null?void 0:o.size)),1)])])],64)}const fL=Le(aL,[["render",pL]]),mL={},gL={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function yL(t,e,n,r,i,s){return d.openBlock(),d.createElementBlock("svg",gL,e[0]||(e[0]=[d.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),d.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),d.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),d.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const EE=Le(mL,[["render",yL]]),bL={},_L={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-trash"};function xL(t,e,n,r,i,s){return d.openBlock(),d.createElementBlock("svg",_L,e[0]||(e[0]=[d.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7l16 0"></path><path d="M10 11l0 6"></path><path d="M14 11l0 6"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>',6)]))}const SE=Le(bL,[["render",xL]]),vL={components:{Fancybox:rL,VsWidgetFileInfo:fL,IconDownload:EE,IconTrash:SE},props:{item:null,prefix:{type:String,default:"/api"},disabled:{type:Boolean,default:!1}},data(){return{optionsFile:{defaultType:"iframe"}}},computed:{createDate(){try{const t=_t(this.item.cdate,"YYYY-MM-DD");return new Date(t).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}}},methods:{isSupportedFile(t){return["pdf","json"].includes(t.ext)},isSupportedAllFile(t){return["ppt","pptx","doc","docx","xls","xlsx"].includes(t.ext)},async downloadFile(t){const e=document.createElement("a");e.setAttribute("download",t.uploaded_name),e.href=t.file_path,e.click()},confirnDeleteFile(){this.$emit("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:this.deleteFile,updateListOnConfirm:!0})},async deleteFile(){try{await Ue.delete(`${this.prefix}/widget/file/${this.item.entity_id}/${this.item.file_id}`),this.$emit("update")}catch(t){console.error(t)}}}},wL={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},kL={key:0,class:"flex w-full gap-x-3 items-center"},EL=["href"],SL={key:1,class:"flex gap-x-3 w-full items-center"},CL=["href"],TL={key:2,class:"flex gap-x-3 w-full items-center"},AL=["href"],ML={key:3,class:"flex gap-x-3 w-full items-center"},DL={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},IL={class:"p-0.5 sm:p-1 inline-flex items-center gap-0.5 bg-white rounded-lg dark:bg-neutral-800 dark:border-neutral-700"},PL={class:"inline-block"},NL=["disabled"],RL={class:"inline-block"},OL=["disabled"];function BL(t,e,n,r,i,s){const a=d.resolveComponent("VsWidgetFileInfo"),o=d.resolveComponent("Fancybox"),f=d.resolveComponent("IconDownload"),g=d.resolveComponent("IconTrash");return d.openBlock(),d.createElementBlock("div",wL,[n.item.ext==="jpg"||n.item.ext==="png"?(d.openBlock(),d.createElementBlock("div",kL,[d.createVNode(o,null,{default:d.withCtx(()=>[d.createElementVNode("a",{"data-fancybox":"gallery",href:n.item.file_path,target:"_blank",class:"flex gap-x-3 w-full items-center"},[d.createVNode(a,{item:n.item},null,8,["item"])],8,EL)]),_:1})])):s.isSupportedFile(n.item)?(d.openBlock(),d.createElementBlock("div",SL,[d.createVNode(o,{options:i.optionsFile},{default:d.withCtx(()=>[d.createElementVNode("a",{"data-fancybox":"gallery",href:n.item.file_path,target:"_blank",class:"flex gap-x-3 w-full items-center"},[d.createVNode(a,{item:n.item},null,8,["item"])],8,CL)]),_:1},8,["options"])])):s.isSupportedAllFile(n.item)?(d.openBlock(),d.createElementBlock("div",TL,[d.createVNode(o,{options:i.optionsFile},{default:d.withCtx(()=>[d.createElementVNode("a",{"data-fancybox":"gallery",href:`/api/file-preview?id=${n.item.file_id}.pdf`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[d.createVNode(a,{item:n.item},null,8,["item"])],8,AL)]),_:1},8,["options"])])):(d.openBlock(),d.createElementBlock("div",ML,[d.createVNode(a,{item:n.item},null,8,["item"])])),d.createElementVNode("div",DL,[d.createElementVNode("div",IL,[d.createElementVNode("div",PL,[d.createElementVNode("button",{class:"inline-flex p-[6px] justify-center items-center gap-x-2 rounded-lg border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-400 focus:outline-none focus:bg-gray-100 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[0]||(e[0]=y=>s.downloadFile(n.item)),disabled:n.disabled},[d.createVNode(f,{height:"14",width:"14"})],8,NL)]),e[2]||(e[2]=d.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),d.createElementVNode("div",RL,[d.createElementVNode("button",{type:"button",class:"size-[30px] inline-flex justify-center items-center gap-x-2 rounded-lg border border-transparent text-red-600 hover:bg-red-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-red-100 dark:text-red-500 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",onClick:e[1]||(e[1]=y=>s.confirnDeleteFile()),disabled:n.disabled},[d.createVNode(g,{height:"14",width:"14"})],8,OL)])])])])}const VL=Le(vL,[["render",BL]]),zL={props:["text"]},LL={class:"pl-3 text-sm font-medium text-gray-600"};function FL(t,e,n,r,i,s){return d.openBlock(),d.createElementBlock("div",null,[d.createElementVNode("p",LL,d.toDisplayString(n.text),1)])}const CE=Le(zL,[["render",FL]]),$L={},jL={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-upload"};function HL(t,e,n,r,i,s){return d.openBlock(),d.createElementBlock("svg",jL,e[0]||(e[0]=[d.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),d.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),d.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),d.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const UL=Le($L,[["render",HL]]),{Fancybox:WL}=Sm,qL={components:{VsWidgetFileItem:VL,VsEmptyWidget:CE,IconUpload:UL},props:{id:{type:String,default(){return""}},prefilledData:{},prefix:{type:String,default:"/api"},disabled:{type:Boolean,default:!1}},data(){return{isModalVisible:!1,modal:{},files:"",searchValue:""}},mounted(){this.getFileList()},computed:{filteredFiles(){return this.searchValue===""?this.files:this.files.filter(e=>e.uploaded_name.includes(this.searchValue))}},methods:{async getFileList(){if(this.prefilledData){this.files=this.prefilledData.rows;return}try{const{data:t}=await Ue.get(`${this.prefix}/widget/file/${this.id}`);WL.bind("[data-fancybox='gallery']"),this.files=t==null?void 0:t.rows}catch(t){console.error(t)}},async addFile(t){console.log(t),await Promise.all(Array.from(t.target.files).map(async e=>{const n=new FormData;n.append("file",e);try{const r=`${this.prefix}/widget/file/${this.id}`;return await Ue.post(r,n),this.$emit("update","file-list"),e}catch(r){return console.error(r),null}})),await this.getFileList()},prepareModal(t){const e={...t};return t.cancel||(e.cancel=()=>{this.isModalVisible=!1}),t.updateListOnConfirm&&(e.confirm=async()=>{await t.confirm(),this.isModalVisible=!1,this.getFileList()}),e},handleOpenModal(t){this.modal=this.prepareModal(t),this.isModalVisible=!0}}},GL={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700"},YL={class:"flex w-full mb-[12px] items-center gap-x-2"},ZL={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},XL={class1:"ml-auto"},KL={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},JL={class:"relative"},QL={key:1,class:"space-y-3 max-h-[300px] overflow-y-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},eF={key:0},tF={class:"p-4"},nF={class:"mt-1 text-gray-500 dark:text-neutral-500"},rF={class:"flex justify-end mt-4 gap-x-3"};function iF(t,e,n,r,i,s){var g,y;const a=d.resolveComponent("IconUpload"),o=d.resolveComponent("VsWidgetFileItem"),f=d.resolveComponent("VsDialog");return d.openBlock(),d.createElementBlock("div",GL,[d.createElementVNode("div",YL,[d.createElementVNode("h2",ZL," Файлів: "+d.toDisplayString(i.files.length),1),d.createElementVNode("div",XL,[d.createElementVNode("label",null,[d.createElementVNode("input",{type:"file",class:"hidden",onChange:e[0]||(e[0]=v=>s.addFile(v))},null,32),d.createElementVNode("div",{class:d.normalizeClass(["py-1.5 px-4 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg bg-gray-100 cursor-pointer hover:bg-gray-200 text-gray-800 shadow-2xs hover:bg-gray-50 focus:outline-hidden focus:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",{hidden:n.disabled}])},[d.createVNode(a,{height:"16",width:"16"})],2)])])]),((g=i.files)==null?void 0:g.length)>4?(d.openBlock(),d.createElementBlock("div",KL,[d.createElementVNode("div",null,[d.createElementVNode("div",JL,[e[7]||(e[7]=d.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-[1] ps-3.5"},[d.createElementVNode("svg",{class:"flex-shrink-0 text-gray-500 size-4 dark:text-neutral-400",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[d.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),d.createElementVNode("path",{d:"m21 21-4.3-4.3"})])],-1)),d.withDirectives(d.createElementVNode("input",{type:"text","onUpdate:modelValue":e[1]||(e[1]=v=>i.searchValue=v),class:"py-2 px-3 ps-10 pe-16 block w-full bg-gray-200 xl:bg-gray-100 rounded-lg text-sm focus:border-blue-500 h-[40px] focus:border-2 focus:outline-none disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-600",placeholder:"Введіть назву файлу"},null,512),[[d.vModelText,i.searchValue,void 0,{trim:!0}]])])])])):d.createCommentVNode("",!0),(y=i.files)!=null&&y.length?(d.openBlock(),d.createElementBlock("div",QL,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(s.filteredFiles,(v,w)=>(d.openBlock(),d.createBlock(o,{key:w,id:n.id,prefix:n.prefix,item:v,disabled:n.disabled,onUpdate:e[2]||(e[2]=T=>t.$emit("update","file-list")),onOpenModal:e[3]||(e[3]=T=>s.handleOpenModal(T))},null,8,["id","prefix","item","disabled"]))),128)),s.filteredFiles.length?d.createCommentVNode("",!0):(d.openBlock(),d.createElementBlock("div",eF,e[8]||(e[8]=[d.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):d.createCommentVNode("",!0),d.createVNode(f,{title:i.modal.title,size:"small",visible:i.isModalVisible,"onUpdate:visible":e[6]||(e[6]=v=>i.isModalVisible=v)},{default:d.withCtx(()=>[d.createElementVNode("div",tF,[d.createElementVNode("p",nF,d.toDisplayString(i.modal.message),1),d.createElementVNode("div",rF,[d.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-medium text-gray-800 bg-white border border-gray-200 rounded-lg shadow-sm gap-x-2 hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[4]||(e[4]=(...v)=>i.modal.cancel&&i.modal.cancel(...v))},d.toDisplayString(i.modal.cancelButtonText),1),d.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-semibold text-white bg-red-500 border border-transparent rounded-lg gap-x-2 hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:e[5]||(e[5]=(...v)=>i.modal.confirm&&i.modal.confirm(...v))},d.toDisplayString(i.modal.confirmButtonText),1)])])]),_:1},8,["title","visible"])])}const TE=Le(qL,[["render",iF]]),sF={},oF={class:"w-16 text-gray-400 mx-auto dark:text-neutral-400",width:"70",height:"46",viewBox:"0 0 70 46",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function aF(t,e,n,r,i,s){return d.openBlock(),d.createElementBlock("svg",oF,e[0]||(e[0]=[d.createStaticVNode('<path d="M6.05172 9.36853L17.2131 7.5083V41.3608L12.3018 42.3947C9.01306 43.0871 5.79705 40.9434 5.17081 37.6414L1.14319 16.4049C0.515988 13.0978 2.73148 9.92191 6.05172 9.36853Z" fill="currentColor" stroke="currentColor" stroke-width="2" class="fill-white stroke-gray-400 dark:fill-neutral-800 dark:stroke-neutral-500"></path><path d="M63.9483 9.36853L52.7869 7.5083V41.3608L57.6982 42.3947C60.9869 43.0871 64.203 40.9434 64.8292 37.6414L68.8568 16.4049C69.484 13.0978 67.2685 9.92191 63.9483 9.36853Z" fill="currentColor" stroke="currentColor" stroke-width="2" class="fill-white stroke-gray-400 dark:fill-neutral-800 dark:stroke-neutral-500"></path><rect x="17.0656" y="1.62305" width="35.8689" height="42.7541" rx="5" fill="currentColor" stroke="currentColor" stroke-width="2" class="fill-white stroke-gray-400 dark:fill-neutral-800 dark:stroke-neutral-500"></rect><path d="M47.9344 44.3772H22.0655C19.3041 44.3772 17.0656 42.1386 17.0656 39.3772L17.0656 35.9161L29.4724 22.7682L38.9825 33.7121C39.7832 34.6335 41.2154 34.629 42.0102 33.7025L47.2456 27.5996L52.9344 33.7209V39.3772C52.9344 42.1386 50.6958 44.3772 47.9344 44.3772Z" stroke="currentColor" stroke-width="2" class="stroke-gray-400 dark:stroke-neutral-500"></path><circle cx="39.5902" cy="14.9672" r="4.16393" stroke="currentColor" stroke-width="2" class="stroke-gray-400 dark:stroke-neutral-500"></circle>',5)]))}const lF=Le(sF,[["render",aF]]),cF={class:"cursor-pointer"},dF={class:"flex flex-col gap-0"},uF={class:"!mt-[4px] text-xs text-center text-stone-400 dark:text-neutral-400"},hF=["accept"],pF=Le({__name:"vs-widget-gallery-dropzone",props:{accept:{type:Array,default:()=>[".tiff",".jpg",".jpeg",".png",".svg",".ico",".webp"]}},emits:["file:upload"],setup(t,{emit:e}){const n=t,{$notify:r}=d.getCurrentInstance().proxy,i=d.ref(null),s=d.ref(!1),a=d.computed(()=>{var D,O,B;return(D=n.accept)!=null&&D.length?(B=(O=n.accept)==null?void 0:O.map(L=>{var U;return(U=L==null?void 0:L.replace(".",""))==null?void 0:U.toUpperCase()}))==null?void 0:B.join(", "):"Приймаються всі типи файлів"}),o=e,f=()=>{i.value.click()},g=async D=>{D?o("file:upload",D):r({type:"error",title:"Помилка!",message:"При спробі завантаження файлу виникла помилка"})},y=D=>{const O=D.target.files;O&&g(O)},v=D=>{const O=D.dataTransfer.files;s.value=!1,O&&g(O)},w=()=>{s.value=!0},T=()=>{s.value=!1};return(D,O)=>{var B;return d.openBlock(),d.createElementBlock("div",cF,[d.createElementVNode("div",{class:d.normalizeClass(["vs-form-dropzone border border-dashed rounded-xl p-[48px] flex items-center justify-center duration-300 hover:border-blue-600 hover:bg-blue-50",s.value?"border-blue-600 bg-blue-50":"border-gray-200"]),onDragover:d.withModifiers(w,["prevent"]),onDragleave:T,onDrop:d.withModifiers(v,["prevent"]),onClick:f},[d.createElementVNode("div",dF,[d.createVNode(lF),O[0]||(O[0]=d.createElementVNode("p",{class:"font-medium text-gray-800 text-center mt-[16px] !mb-0"}," Додати фото ",-1)),d.createElementVNode("p",uF,d.toDisplayString(a.value),1)])],34),d.createElementVNode("input",{ref_key:"fileInput",ref:i,type:"file",class:"hidden",accept:(B=t.accept)==null?void 0:B.join(","),onChange:y,multiple:""},null,40,hF)])}}},[["__scopeId","data-v-2a9e08fb"]]),fF={class:"flex items-center gap-x-2 mb-[16px]"},mF={class:"inline-block shrink-0 font-semibold text-gray-800 dark:text-neutral-200"},gF={class:"flex items-center w-full justify-end gap-x-2"},yF=["accept"],bF=["onDragstart","onDrop"],_F={key:0,class:"absolute right-[5px] top-[5px] bg-blue-100 text-blue-800 text-xs font-medium px-2.5 py-0.5 rounded-sm dark:bg-blue-900 dark:text-blue-300"},xF=["href","data-caption"],vF=["src","alt"],wF={class:"item__text-content bg-white opacity-0 rounded-b-lg absolute w-full bottom-0 p-3 flex gap-2.5 items-center justify-between"},kF={class:"text-xs w-[180px] block overflow-hidden text-nowrap overflow-ellipsis"},EF={class:"flex flex-wrap items-center text-xs text-gray-600 widget-images__item-desc"},SF={class:"flex items-center"},CF={class:"text-xs"},TF=["onClick"],AF=["onClick"],MF=["onClick"],DF={class:"p-4"},IF={class:"mt-1 text-gray-500 dark:text-neutral-500"},PF={class:"flex justify-end mt-4 gap-x-3"},NF={__name:"vs-widget-gallery",props:{id:{type:String,default:""},readonly:{type:Boolean,default:!1},prefilledData:{type:Array,default:()=>[]},limit:{type:Number,default:10},prefix:{type:String,default:"/api"}},setup(t){const{Fancybox:e}=Sm,{$notify:n}=d.getCurrentInstance().proxy,r=t,i=d.ref([]),s=d.ref(!1),a=d.ref(null),o=d.ref({}),f=[".tiff",".jpg",".jpeg",".png",".svg",".ico",".webp"],g=async()=>{var ve,Oe,je;if((ve=r==null?void 0:r.prefilledData)!=null&&ve.length){i.value=r.prefilledData,e.bind("[data-fancybox='gallery']");return}try{const{data:He}=await Ue.get(`${r.prefix}/widget/gallery/${r==null?void 0:r.id}`);i.value=[(Oe=He==null?void 0:He.rows)==null?void 0:Oe.find(qe=>qe==null?void 0:qe.ismain),...((je=He==null?void 0:He.rows)==null?void 0:je.filter(qe=>!(qe!=null&&qe.ismain)))||[]].filter(qe=>qe),e.bind("[data-fancybox='gallery']")}catch(He){console.error(He)}},y=async ve=>{var He,qe,pe,ht;if(((He=i.value)==null?void 0:He.length)+((pe=Array.from((qe=ve.target)==null?void 0:qe.files))==null?void 0:pe.length)>r.limit){n({type:"error",title:"Помилка!",message:"Встановлено ліміт на кількість, - "+r.limit});return}const Oe=Array.from((ht=ve.target)==null?void 0:ht.files);if(!Oe.every(Mt=>{var Dt,Rt;return f==null?void 0:f.includes("."+((Rt=(Dt=Mt.name.split("."))==null?void 0:Dt.pop())==null?void 0:Rt.toLowerCase()))})){n({type:"error",title:"Помилка!",message:"Доступні формати: "+f.join(", ")});return}await Promise.all(Oe.map(async Mt=>{const Dt=new FormData;Dt.append("file",Mt);try{await Ue.post(`${r.prefix}/widget/gallery/${r==null?void 0:r.id}`,Dt)}catch(Rt){console.error(Rt)}})),await g()},v=ve=>{const Oe=document.createElement("a");Oe.setAttribute("download",ve==null?void 0:ve.uploaded_name),Oe.href=ve==null?void 0:ve.file_path,Oe.click()},w=async(ve,Oe)=>{try{await Ue.post(`${r.prefix}/widget/gallery/${ve}/${Oe}`,{ismain:!0}),await g()}catch(je){console.error(je)}},T=ve=>{a.value=ve,o.value={title:"Ви впевнені?",message:"Ви впевнені що хочете видалити зображення?",confirmButtonText:"Так, видалити ",cancelButtonText:"Відмінити",confirm:async()=>{var Oe,je,He;await D(),s.value=!1,await g(),(Oe=i.value)!=null&&Oe[0]&&!((He=(je=i.value)==null?void 0:je[0])!=null&&He.ismain)&&setTimeout(()=>{var qe,pe,ht,Mt;return w((pe=(qe=i.value)==null?void 0:qe[0])==null?void 0:pe.entity_id,(Mt=(ht=i.value)==null?void 0:ht[0])==null?void 0:Mt.file_id)})},cancel:()=>{s.value=!1}},s.value=!0},D=async()=>{var ve,Oe;try{await Ue.delete(`${r.prefix}/widget/gallery/${(ve=a.value)==null?void 0:ve.entity_id}/${(Oe=a.value)==null?void 0:Oe.file_id}`)}catch(je){console.error(je)}},O=(ve,Oe=2)=>{if(ve===0)return"0 Bytes";const je=1024,He=Oe<0?0:Oe,qe=["Bytes","KB","MB","GB","TB"],pe=Math.floor(Math.log(ve)/Math.log(je));return`${parseFloat((ve/je**pe).toFixed(He))} ${qe[pe]}`},B=ve=>{const Oe={day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"numeric"};return new Date(ve).toLocaleDateString("uk-UA",Oe)},L=d.ref(null),U=d.ref(0),Z=()=>{var ve;U.value=((ve=L.value)==null?void 0:ve.offsetWidth)||0},Y=d.computed(()=>{const ve=[...i.value],Oe={isDropzone:!0},je=Math.floor(U.value/316)||1,He=Math.min(je-1,ve.length);return ve.splice(He,0,Oe),ve}),ue=d.ref(null),fe=ve=>{ue.value=ve},be=ve=>i.value.findIndex(Oe=>Oe.file_path===ve.file_path),Me=ve=>{if(ve===0){const Oe=ue.value;if(Oe===null||Oe===ve)return;const He=Y.value.filter(qe=>!qe.isDropzone)[Oe];if(!He)return;i.value.splice(Oe,1),i.value.splice(ve,0,He),ue.value=null,setTimeout(()=>{var qe,pe,ht,Mt;return w((pe=(qe=i.value)==null?void 0:qe[0])==null?void 0:pe.entity_id,(Mt=(ht=i.value)==null?void 0:ht[0])==null?void 0:Mt.file_id)})}};return d.onMounted(()=>{g(),Z(),window.addEventListener("resize",Z),addEventListener("reloadCardPage",g)}),d.onUnmounted(()=>{removeEventListener("reloadCardPage",g)}),d.watch(()=>r.id,g),d.watch(i,Z),(ve,Oe)=>{const je=d.resolveComponent("VsConfirm");return d.openBlock(),d.createElementBlock("div",{ref_key:"galleryContainer",ref:L,class:"flex flex-col vs-widget-images xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700"},[d.createElementVNode("div",fF,[d.createElementVNode("h2",mF," Світлин: "+d.toDisplayString(i.value.length)+" (ліміт - "+d.toDisplayString(t.limit)+") ",1),d.createElementVNode("div",gF,[d.createElementVNode("div",null,[d.createElementVNode("label",null,[d.createElementVNode("input",{type:"file",class:"hidden",onChange:y,accept:f.join(","),multiple:""},null,40,yF),Oe[5]||(Oe[5]=d.createStaticVNode('<span type="button" class="py-2 px-2.5 cursor-pointer inline-flex items-center gap-x-1.5 text-xs font-medium rounded-lg border border-stone-200 bg-white text-stone-800 shadow-2xs hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-hidden focus:bg-stone-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"><svg class="shrink-0 size-3.5" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242"></path><path d="M12 12v9"></path><path d="m16 16-4-4-4 4"></path></svg> Завантажити </span>',1))])])])]),d.createVNode(d.TransitionGroup,{name:"gallery",tag:"div",class:"flex flex-wrap gap-[16px]"},{default:d.withCtx(()=>[d.createVNode(pF,{"onFile:upload":Oe[0]||(Oe[0]=He=>y({target:{files:He}})),class:"h-[200px] w-[300px]"}),(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(i.value,(He,qe)=>(d.openBlock(),d.createElementBlock("div",{key:He.file_path||"dz-"+qe,draggable:"true",onDragstart:pe=>fe(be(He)),onDragover:Oe[1]||(Oe[1]=d.withModifiers(()=>{},["prevent"])),onDrop:pe=>Me(be(He)),class:"relative cursor-pointer rounded-b-lg item hover:shadow-lg shrink-0 h-[200px] w-[300px]"},[He!=null&&He.ismain?(d.openBlock(),d.createElementBlock("span",_F,"Головне")):d.createCommentVNode("",!0),d.createElementVNode("a",{href:He.file_path,"data-fancybox":"gallery","data-caption":He.uploaded_name,target:"_blank"},[d.createElementVNode("img",{class:"object-cover w-full h-full rounded-lg",src:He.file_path||"/icons/no-image.jpg",alt:He.uploaded_name},null,8,vF),d.createElementVNode("div",wF,[d.createElementVNode("div",null,[d.createElementVNode("span",kF,d.toDisplayString(He.uploaded_name),1),d.createElementVNode("div",EF,[d.createElementVNode("span",SF,d.toDisplayString(O(He.size)),1),d.createElementVNode("span",null,d.toDisplayString(B(He.cdate)),1)]),d.createElementVNode("span",CF,d.toDisplayString(He.username),1),He!=null&&He.ismain?d.createCommentVNode("",!0):(d.openBlock(),d.createElementBlock("div",{key:0,class:"text-xs underline",onClick:d.withModifiers(pe=>w(He==null?void 0:He.entity_id,He==null?void 0:He.file_id),["prevent"])}," Зробити головним ",8,TF))]),d.createElementVNode("div",null,[d.createElementVNode("div",{class:"flex items-center justify-center gap-2 hover:bg-gray-200 p-[6px] rounded",onClick:d.withModifiers(pe=>v(He),["prevent"])},[d.createVNode(EE,{height:"14",width:"14"})],8,AF),d.createElementVNode("div",{class:"flex items-center gap-2 hover:bg-gray-200 p-[6px] rounded hover:cursor-pointer",onClick:d.withModifiers(pe=>T(He),["prevent"])},[d.createVNode(SE,{height:"14",width:"14"})],8,MF)])])],8,xF)],40,bF))),128))]),_:1}),d.createVNode(je,{title:o.value.title,size:"small",visible:s.value,"onUpdate:visible":Oe[4]||(Oe[4]=He=>s.value=He)},{default:d.withCtx(()=>[d.createElementVNode("div",DF,[d.createElementVNode("p",IF,d.toDisplayString(o.value.message),1),d.createElementVNode("div",PF,[d.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-medium text-gray-800 bg-white border border-gray-200 rounded-lg shadow-sm gap-x-2 hover:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700",onClick:Oe[2]||(Oe[2]=(...He)=>o.value.cancel&&o.value.cancel(...He))},d.toDisplayString(o.value.cancelButtonText),1),d.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-semibold text-white bg-red-500 border border-transparent rounded-lg gap-x-2 hover:bg-red-600",onClick:Oe[3]||(Oe[3]=(...He)=>o.value.confirm&&o.value.confirm(...He))},d.toDisplayString(o.value.confirmButtonText),1)])])]),_:1},8,["title","visible"])],512)}}};function ri(t){this.content=t}ri.prototype={constructor:ri,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),s=r.content.slice();return i==-1?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new ri(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new ri(n)},addToStart:function(t,e){return new ri([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new ri(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),s=r.find(t);return i.splice(s==-1?i.length:s,0,e,n),new ri(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=ri.from(t),t.size?new ri(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=ri.from(t),t.size?new ri(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=ri.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}},ri.from=function(t){if(t instanceof ri)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new ri(e)};function AE(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),s=e.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let a=0;i.text[a]==s.text[a];a++)n++;return n}if(i.content.size||s.content.size){let a=AE(i.content,s.content,n+1);if(a!=null)return a}n+=i.nodeSize}}function ME(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let a=t.child(--i),o=e.child(--s),f=a.nodeSize;if(a==o){n-=f,r-=f;continue}if(!a.sameMarkup(o))return{a:n,b:r};if(a.isText&&a.text!=o.text){let g=0,y=Math.min(a.text.length,o.text.length);for(;g<y&&a.text[a.text.length-g-1]==o.text[o.text.length-g-1];)g++,n--,r--;return{a:n,b:r}}if(a.content.size||o.content.size){let g=ME(a.content,o.content,n-1,r-1);if(g)return g}n-=f,r-=f}}class Ze{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,s){for(let a=0,o=0;o<n;a++){let f=this.content[a],g=o+f.nodeSize;if(g>e&&r(f,i+o,s||null,a)!==!1&&f.content.size){let y=o+1;f.nodesBetween(Math.max(0,e-y),Math.min(f.content.size,n-y),r,i+y)}o=g}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",a=!0;return this.nodesBetween(e,n,(o,f)=>{let g=o.isText?o.text.slice(Math.max(e,f)-f,n-f):o.isLeaf?i?typeof i=="function"?i(o):i:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&g||o.isTextblock)&&r&&(a?a=!1:s+=r),s+=g},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new Ze(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let s=0,a=0;a<n;s++){let o=this.content[s],f=a+o.nodeSize;f>e&&((a<e||f>n)&&(o.isText?o=o.cut(Math.max(0,e-a),Math.min(o.text.length,n-a)):o=o.cut(Math.max(0,e-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=f}return new Ze(r,i)}cutByIndex(e,n){return e==n?Ze.empty:e==0&&n==this.content.length?this:new Ze(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new Ze(i,s)}addToStart(e){return new Ze([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Ze(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return AE(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return ME(this,e,n,r)}findIndex(e,n=-1){if(e==0)return Tm(0,e);if(e==this.size)return Tm(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let s=this.child(r),a=i+s.nodeSize;if(a>=e)return a==e||n>0?Tm(r+1,a):Tm(r,i);i=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return Ze.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new Ze(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Ze.empty;let n,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(n||(n=e.slice(0,i)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new Ze(n||e,r)}static from(e){if(!e)return Ze.empty;if(e instanceof Ze)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Ze([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Ze.empty=new Ze([],0);const Lb={index:0,offset:0};function Tm(t,e){return Lb.index=t,Lb.offset=e,Lb}function Am(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!Am(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Am(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let er=class Kv{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Am(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Kv.none;if(e instanceof Kv)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};er.none=[];class Mm extends Error{}class xt{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=IE(this.content,e+this.openStart,n);return r&&new xt(r,this.openStart,this.openEnd)}removeBetween(e,n){return new xt(DE(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return xt.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new xt(Ze.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new xt(e,r,i)}}xt.empty=new xt(Ze.empty,0,0);function DE(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:a,offset:o}=t.findIndex(n);if(i==e||s.isText){if(o!=n&&!t.child(a).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=a)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(DE(s.content,e-i-1,n-i-1)))}function IE(t,e,n,r){let{index:i,offset:s}=t.findIndex(e),a=t.maybeChild(i);if(s==e||a.isText)return t.cut(0,e).append(n).append(t.cut(e));let o=IE(a.content,e-s-1,n);return o&&t.replaceChild(i,a.copy(o))}function RF(t,e,n){if(n.openStart>t.depth)throw new Mm("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Mm("Inconsistent open depths");return PE(t,e,n,0)}function PE(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let a=PE(t,e,n,r+1);return s.copy(s.content.replaceChild(i,a))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let a=t.parent,o=a.content;return nc(a,o.cut(0,t.parentOffset).append(n.content).append(o.cut(e.parentOffset)))}else{let{start:a,end:o}=OF(n,t);return nc(s,RE(t,a,o,e,r))}else return nc(s,Dm(t,e,r))}function NE(t,e){if(!e.type.compatibleContent(t.type))throw new Mm("Cannot join "+e.type.name+" onto "+t.type.name)}function Fb(t,e,n){let r=t.node(n);return NE(r,e.node(n)),r}function tc(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Ah(t,e,n,r){let i=(e||t).node(n),s=0,a=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(tc(t.nodeAfter,r),s++));for(let o=s;o<a;o++)tc(i.child(o),r);e&&e.depth==n&&e.textOffset&&tc(e.nodeBefore,r)}function nc(t,e){return t.type.checkContent(e),t.copy(e)}function RE(t,e,n,r,i){let s=t.depth>i&&Fb(t,e,i+1),a=r.depth>i&&Fb(n,r,i+1),o=[];return Ah(null,t,i,o),s&&a&&e.index(i)==n.index(i)?(NE(s,a),tc(nc(s,RE(t,e,n,r,i+1)),o)):(s&&tc(nc(s,Dm(t,e,i+1)),o),Ah(e,n,i,o),a&&tc(nc(a,Dm(n,r,i+1)),o)),Ah(r,null,i,o),new Ze(o)}function Dm(t,e,n){let r=[];if(Ah(null,t,n,r),t.depth>n){let i=Fb(t,e,n+1);tc(nc(i,Dm(t,e,n+1)),r)}return Ah(e,null,n,r),new Ze(r)}function OF(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)i=e.node(s).copy(Ze.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class Mh{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return er.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let o=r;r=i,i=o}let s=r.marks;for(var a=0;a<s.length;a++)s[a].type.spec.inclusive===!1&&(!i||!s[a].isInSet(i.marks))&&(s=s[a--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new Im(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,s=n;for(let a=e;;){let{index:o,offset:f}=a.content.findIndex(s),g=s-f;if(r.push(a,o,i+f),!g||(a=a.child(o),a.isText))break;s=g-1,i+=f+1}return new Mh(n,r,s)}static resolveCached(e,n){let r=OE.get(e);if(r)for(let s=0;s<r.elts.length;s++){let a=r.elts[s];if(a.pos==n)return a}else OE.set(e,r=new BF);let i=r.elts[r.i]=Mh.resolve(e,n);return r.i=(r.i+1)%VF,i}}class BF{constructor(){this.elts=[],this.i=0}}const VF=12,OE=new WeakMap;class Im{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const zF=Object.create(null);let Ya=class Jv{constructor(e,n,r,i=er.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||Ze.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&Am(this.attrs,n||e.defaultAttrs||zF)&&er.sameSet(this.marks,r||er.none)}copy(e=null){return e==this.content?this:new Jv(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Jv(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return xt.empty;let i=this.resolve(e),s=this.resolve(n),a=r?0:i.sharedDepth(n),o=i.start(a),g=i.node(a).content.cut(i.pos-o,s.pos-o);return new xt(g,i.depth-a,s.depth-a)}replace(e,n,r){return RF(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return Mh.resolveCached(this,e)}resolveNoCache(e){return Mh.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),BE(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=Ze.empty,i=0,s=r.childCount){let a=this.contentMatchAt(e).matchFragment(r,i,s),o=a&&a.matchFragment(this.content,n);if(!o||!o.validEnd)return!1;for(let f=i;f<s;f++)if(!this.type.allowsMarks(r.child(f).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),a=s&&s.matchFragment(this.content,n);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=er.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!er.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=Ze.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};Ya.prototype.text=void 0;class Pm extends Ya{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):BE(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Pm(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Pm(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function BE(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class rc{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new LF(e,n);if(r.next==null)return rc.empty;let i=VE(r);r.next&&r.err("Unexpected trailing text");let s=qF(WF(i));return GF(s,r),s}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let s=n;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function s(a,o){let f=a.matchFragment(e,r);if(f&&(!n||f.validEnd))return Ze.from(o.map(g=>g.createAndFill()));for(let g=0;g<a.next.length;g++){let{type:y,next:v}=a.next[g];if(!(y.isText||y.hasRequiredAttrs())&&i.indexOf(v)==-1){i.push(v);let w=s(v,o.concat(y));if(w)return w}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let a=[];for(let o=i;o.type;o=o.via)a.push(o.type);return a.reverse()}for(let a=0;a<s.next.length;a++){let{type:o,next:f}=s.next[a];!o.isLeaf&&!o.hasRequiredAttrs()&&!(o.name in n)&&(!i.type||f.validEnd)&&(r.push({match:o.contentMatch,type:o,via:i}),n[o.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let a=0;a<r.next.length;a++)s+=(a?", ":"")+r.next[a].type.name+"->"+e.indexOf(r.next[a].next);return s}).join(`
|
626
626
|
`)}}rc.empty=new rc(!0);class LF{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function VE(t){let e=[];do e.push(FF(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function FF(t){let e=[];do e.push($F(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function $F(t){let e=UF(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=jF(t,e);else break;return e}function zE(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function jF(t,e){let n=zE(t),r=n;return t.eat(",")&&(t.next!="}"?r=zE(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function HF(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let s in n){let a=n[s];a.isInGroup(e)&&i.push(a)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function UF(t){if(t.eat("(")){let e=VE(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=HF(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function WF(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(a,o,f){let g={term:f,to:o};return e[a].push(g),g}function i(a,o){a.forEach(f=>f.to=o)}function s(a,o){if(a.type=="choice")return a.exprs.reduce((f,g)=>f.concat(s(g,o)),[]);if(a.type=="seq")for(let f=0;;f++){let g=s(a.exprs[f],o);if(f==a.exprs.length-1)return g;i(g,o=n())}else if(a.type=="star"){let f=n();return r(o,f),i(s(a.expr,f),f),[r(f)]}else if(a.type=="plus"){let f=n();return i(s(a.expr,o),f),i(s(a.expr,f),f),[r(f)]}else{if(a.type=="opt")return[r(o)].concat(s(a.expr,o));if(a.type=="range"){let f=o;for(let g=0;g<a.min;g++){let y=n();i(s(a.expr,f),y),f=y}if(a.max==-1)i(s(a.expr,f),f);else for(let g=a.min;g<a.max;g++){let y=n();r(f,y),i(s(a.expr,f),y),f=y}return[r(f)]}else{if(a.type=="name")return[r(o,void 0,a.value)];throw new Error("Unknown expr type")}}}}function LE(t,e){return e-t}function FE(t,e){let n=[];return r(e),n.sort(LE);function r(i){let s=t[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let a=0;a<s.length;a++){let{term:o,to:f}=s[a];!o&&n.indexOf(f)==-1&&r(f)}}}function qF(t){let e=Object.create(null);return n(FE(t,0));function n(r){let i=[];r.forEach(a=>{t[a].forEach(({term:o,to:f})=>{if(!o)return;let g;for(let y=0;y<i.length;y++)i[y][0]==o&&(g=i[y][1]);FE(t,f).forEach(y=>{g||i.push([o,g=[]]),g.indexOf(y)==-1&&g.push(y)})})});let s=e[r.join(",")]=new rc(r.indexOf(t.length-1)>-1);for(let a=0;a<i.length;a++){let o=i[a][1].sort(LE);s.next.push({type:i[a][0],next:e[o.join(",")]||n(o)})}return s}}function GF(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,a=[];for(let o=0;o<i.next.length;o++){let{type:f,next:g}=i.next[o];a.push(f.name),s&&!(f.isText||f.hasRequiredAttrs())&&(s=!1),r.indexOf(g)==-1&&r.push(g)}s&&e.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function $E(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function jE(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let s=t[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function HE(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in t){let s=t[i];s.validate&&s.validate(e[i])}}function UE(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new ZF(t,r,e[r]);return n}let WE=class aN{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=UE(e,r.attrs),this.defaultAttrs=$E(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==rc.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:jE(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Ya(this,this.computeAttrs(e),Ze.from(n),er.setFrom(r))}createChecked(e=null,n,r){return n=Ze.from(n),this.checkContent(n),new Ya(this,this.computeAttrs(e),n,er.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=Ze.from(n),n.size){let a=this.contentMatch.fillBefore(n);if(!a)return null;n=a.append(n)}let i=this.contentMatch.matchFragment(n),s=i&&i.fillBefore(Ze.empty,!0);return s?new Ya(this,e,n.append(s),er.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){HE(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:er.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,a)=>r[s]=new aN(s,n,a));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function YF(t,e,n){let r=n.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${s}`)}}class ZF{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?YF(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Nm{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=UE(e,i.attrs),this.excluded=null;let s=$E(this.attrs);this.instance=s?new er(this,s):null}create(e=null){return!e&&this.instance?this.instance:new er(this,jE(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,a)=>r[s]=new Nm(s,i++,n,a)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){HE(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class qE{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=ri.from(e.nodes),n.marks=ri.from(e.marks||{}),this.nodes=WE.compile(this.spec.nodes,this),this.marks=Nm.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],a=s.spec.content||"",o=s.spec.marks;if(s.contentMatch=r[a]||(r[a]=rc.parse(a,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=o=="_"?null:o?GE(this,o.split(" ")):o==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],a=s.spec.excludes;s.excluded=a==null?[s]:a==""?[]:GE(this,a.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof WE){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new Pm(r,r.defaultAttrs,e,er.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return Ya.fromJSON(this,e)}markFromJSON(e){return er.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function GE(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],a=s;if(s)n.push(s);else for(let o in t.marks){let f=t.marks[o];(i=="_"||f.spec.group&&f.spec.group.split(" ").indexOf(i)>-1)&&n.push(a=f)}if(!a)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function XF(t){return t.tag!=null}function KF(t){return t.style!=null}let Dh=class Qv{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(XF(i))this.tags.push(i);else if(KF(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,n={}){let r=new KE(this,n,!1);return r.addAll(e,er.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new KE(this,n,!0);return r.addAll(e,er.none,n.from,n.to),xt.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(e$(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let a=s.getAttrs(e);if(a===!1)continue;s.attrs=a||void 0}return s}}}matchStyle(e,n,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let a=this.styles[s],o=a.style;if(!(o.indexOf(e)!=0||a.context&&!r.matchesContext(a.context)||o.length>e.length&&(o.charCodeAt(e.length)!=61||o.slice(e.length+1)!=n))){if(a.getAttrs){let f=a.getAttrs(n);if(f===!1)continue;a.attrs=f||void 0}return a}}}static schemaRules(e){let n=[];function r(i){let s=i.priority==null?50:i.priority,a=0;for(;a<n.length;a++){let o=n[a];if((o.priority==null?50:o.priority)<s)break}n.splice(a,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(a=>{r(a=JE(a)),a.mark||a.ignore||a.clearMark||(a.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(a=>{r(a=JE(a)),a.node||a.ignore||a.mark||(a.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Qv(e,Qv.schemaRules(e)))}};const YE={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},JF={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ZE={ol:!0,ul:!0},Ih=1,$b=2,Ph=4;function XE(t,e,n){return e!=null?(e?Ih:0)|(e==="full"?$b:0):t&&t.whitespace=="pre"?Ih|$b:n&~Ph}class Rm{constructor(e,n,r,i,s,a){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=a,this.content=[],this.activeMarks=er.none,this.match=s||(a&Ph?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(Ze.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ih)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let n=Ze.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(Ze.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!YE.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class KE{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,s,a=XE(null,n.preserveWhitespace,0)|(r?Ph:0);i?s=new Rm(i.type,i.attrs,er.none,!0,n.topMatch||i.type.contentMatch,a):r?s=new Rm(null,null,er.none,!0,null,a):s=new Rm(e.schema.topNodeType,null,er.none,!0,null,a),this.nodes=[s],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,s=i.options&$b?"full":this.localPreserveWS||(i.options&Ih)>0;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)s!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,`
|
627
627
|
`);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=i.content[i.content.length-1],o=e.previousSibling;(!a||o&&o.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),n),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;ZE.hasOwnProperty(a)&&this.parser.normalizeLists&&QF(e);let f=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,r));e:if(f?f.ignore:JF.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,n);else if(!f||f.skip||f.closeParent){f&&f.closeParent?this.open=Math.max(0,this.open-1):f&&f.skip.nodeType&&(e=f.skip);let g,y=this.needsBlock;if(YE.hasOwnProperty(a))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),g=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let v=f&&f.skip?n:this.readStyles(e,n);v&&this.addAll(e,v),g&&this.sync(s),this.needsBlock=y}else{let g=this.readStyles(e,n);g&&this.addElementByRule(e,f,g,f.consuming===!1?o:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
628
628
|
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],a=r.getPropertyValue(s);if(a)for(let o=void 0;;){let f=this.parser.matchStyle(s,a,this,o);if(!f)break;if(f.ignore)return null;if(f.clearMark?n=n.filter(g=>!f.clearMark(g)):n=n.concat(this.parser.schema.marks[f.mark].create(f.attrs)),f.consuming===!1)o=f;else break}}return n}addElementByRule(e,n,r,i){let s,a;if(n.node)if(a=this.parser.schema.nodes[n.node],a.isLeaf)this.insertNode(a.create(n.attrs),r)||this.leafFallback(e,r);else{let f=this.enter(a,n.attrs||null,r,n.preserveWhitespace);f&&(s=!0,r=f)}else{let f=this.parser.schema.marks[n.mark];r=r.concat(f.create(n.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(f=>this.insertNode(f,r));else{let f=e;typeof n.contentElement=="string"?f=e.querySelector(n.contentElement):typeof n.contentElement=="function"?f=n.contentElement(e):n.contentElement&&(f=n.contentElement),this.findAround(e,f,!0),this.addAll(f,r),this.findAround(e,f,!1)}s&&this.sync(o)&&this.open--}addAll(e,n,r,i){let s=r||0;for(let a=r?e.childNodes[r]:e.firstChild,o=i==null?null:e.childNodes[i];a!=o;a=a.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(a,n);this.findAtPoint(e,s)}findPlace(e,n){let r,i;for(let s=this.open;s>=0;s--){let a=this.nodes[s],o=a.findWrapping(e);if(o&&(!r||r.length>o.length)&&(r=o,i=a,!o.length)||a.solid)break}if(!r)return null;this.sync(i);for(let s=0;s<r.length;s++)n=this.enterInner(r[s],null,n,!1);return n}insertNode(e,n){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let r=this.findPlace(e,n);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=er.none;for(let a of r.concat(e.marks))(i.type?i.type.allowsMarkType(a.type):QE(a.type,e.type))&&(s=a.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,n,r,i){let s=this.findPlace(e.create(n),r);return s&&(s=this.enterInner(e,n,r,!0,i)),s}enterInner(e,n,r,i=!1,s){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let o=XE(e,s,a.options);a.options&Ph&&a.content.length==0&&(o|=Ph);let f=er.none;return r=r.filter(g=>(a.type?a.type.allowsMarkType(g.type):QE(g.type,e))?(f=g.addToSet(f),!1):!0),this.nodes.push(new Rm(e,n,f,i,null,o)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Ih)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),a=(o,f)=>{for(;o>=0;o--){let g=n[o];if(g==""){if(o==n.length-1||o==0)continue;for(;f>=s;f--)if(a(o-1,f))return!0;return!1}else{let y=f>0||f==0&&i?this.nodes[f].type:r&&f>=s?r.node(f-s).type:null;if(!y||y.name!=g&&!y.isInGroup(g))return!1;f--}}return!0};return a(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function QF(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&ZE.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function e$(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function JE(t){let e={};for(let n in t)e[n]=t[n];return e}function QE(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],a=o=>{s.push(o);for(let f=0;f<o.edgeCount;f++){let{type:g,next:y}=o.edge(f);if(g==e||s.indexOf(y)<0&&a(y))return!0}};if(a(i.contentMatch))return!0}}class ic{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=jb(n).createDocumentFragment());let i=r,s=[];return e.forEach(a=>{if(s.length||a.marks.length){let o=0,f=0;for(;o<s.length&&f<a.marks.length;){let g=a.marks[f];if(!this.marks[g.type.name]){f++;continue}if(!g.eq(s[o][0])||g.type.spec.spanning===!1)break;o++,f++}for(;o<s.length;)i=s.pop()[1];for(;f<a.marks.length;){let g=a.marks[f++],y=this.serializeMark(g,a.isInline,n);y&&(s.push([g,i]),i.appendChild(y.dom),i=y.contentDOM||y.dom)}}i.appendChild(this.serializeNodeInner(a,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=Om(jb(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&Om(jb(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return Om(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new ic(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=eS(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return eS(e.marks)}}function eS(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function jb(t){return t.document||window.document}const tS=new WeakMap;function t$(t){let e=tS.get(t);return e===void 0&&tS.set(t,e=n$(t)),e}function n$(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function Om(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=t$(r))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let a=i.indexOf(" ");a>0&&(n=i.slice(0,a),i=i.slice(a+1));let o,f=n?t.createElementNS(n,i):t.createElement(i),g=e[1],y=1;if(g&&typeof g=="object"&&g.nodeType==null&&!Array.isArray(g)){y=2;for(let v in g)if(g[v]!=null){let w=v.indexOf(" ");w>0?f.setAttributeNS(v.slice(0,w),v.slice(w+1),g[v]):f.setAttribute(v,g[v])}}for(let v=y;v<e.length;v++){let w=e[v];if(w===0){if(v<e.length-1||v>y)throw new RangeError("Content hole must be the only child of its parent node");return{dom:f,contentDOM:f}}else{let{dom:T,contentDOM:D}=Om(t,w,n,r);if(f.appendChild(T),D){if(o)throw new RangeError("Multiple content holes");o=D}}}return{dom:f,contentDOM:o}}const nS=65535,rS=Math.pow(2,16);function r$(t,e){return t+e*rS}function iS(t){return t&nS}function i$(t){return(t-(t&nS))/rS}const sS=1,oS=2,Bm=4,aS=8;class Hb{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&aS)>0}get deletedBefore(){return(this.delInfo&(sS|Bm))>0}get deletedAfter(){return(this.delInfo&(oS|Bm))>0}get deletedAcross(){return(this.delInfo&Bm)>0}}class ps{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&ps.empty)return ps.empty}recover(e){let n=0,r=iS(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+i$(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,s=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let f=this.ranges[o]-(this.inverted?i:0);if(f>e)break;let g=this.ranges[o+s],y=this.ranges[o+a],v=f+g;if(e<=v){let w=g?e==f?-1:e==v?1:n:n,T=f+i+(w<0?0:y);if(r)return T;let D=e==(n<0?f:v)?null:r$(o/3,e-f),O=e==f?oS:e==v?sS:Bm;return(n<0?e!=f:e!=v)&&(O|=aS),new Hb(T,O,D)}i+=y-g}return r?e+i:new Hb(e+i,0,null)}touches(e,n){let r=0,i=iS(n),s=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let f=this.ranges[o]-(this.inverted?r:0);if(f>e)break;let g=this.ranges[o+s],y=f+g;if(e<=y&&o==i*3)return!0;r+=this.ranges[o+a]-g}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let a=this.ranges[i],o=a-(this.inverted?s:0),f=a+(this.inverted?0:s),g=this.ranges[i+n],y=this.ranges[i+r];e(o,o+g,f,f+y),s+=y-g}}invert(){return new ps(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?ps.empty:new ps(e<0?[0,-e,0]:[0,0,e])}}ps.empty=new ps([]);class Md{constructor(e=[],n,r=0,i=e.length){this.maps=e,this.mirror=n,this.from=r,this.to=i}slice(e=0,n=this.maps.length){return new Md(this.maps,this.mirror,e,n)}copy(){return new Md(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,n){this.to=this.maps.push(e),n!=null&&this.setMirror(this.maps.length-1,n)}appendMapping(e){for(let n=0,r=this.maps.length;n<e.maps.length;n++){let i=e.getMirror(n);this.appendMap(e.maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this.maps.length+e.maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e.maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new Md;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let s=this.from;s<this.to;s++){let a=this.maps[s],o=a.mapResult(e,n);if(o.recover!=null){let f=this.getMirror(s);if(f!=null&&f>s&&f<this.to){s=f,e=this.maps[f].recover(o.recover);continue}}i|=o.delInfo,e=o.pos}return r?e:new Hb(e,i,null)}}const Ub=Object.create(null);class vi{getMap(){return ps.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Ub[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Ub)throw new RangeError("Duplicate use of step JSON ID "+e);return Ub[e]=n,n.prototype.jsonID=e,n}}class Dr{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Dr(e,null)}static fail(e){return new Dr(null,e)}static fromReplace(e,n,r,i){try{return Dr.ok(e.replace(n,r,i))}catch(s){if(s instanceof Mm)return Dr.fail(s.message);throw s}}}function Wb(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(Wb(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return Ze.fromArray(r)}class Za extends vi{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new xt(Wb(n.content,(a,o)=>!a.isAtom||!o.type.allowsMarkType(this.mark.type)?a:a.mark(this.mark.addToSet(a.marks)),i),n.openStart,n.openEnd);return Dr.fromReplace(e,this.from,this.to,s)}invert(){return new So(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Za(n.pos,r.pos,this.mark)}merge(e){return e instanceof Za&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Za(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Za(n.from,n.to,e.markFromJSON(n.mark))}}vi.jsonID("addMark",Za);class So extends vi{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new xt(Wb(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Dr.fromReplace(e,this.from,this.to,r)}invert(){return new Za(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new So(n.pos,r.pos,this.mark)}merge(e){return e instanceof So&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new So(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new So(n.from,n.to,e.markFromJSON(n.mark))}}vi.jsonID("removeMark",So);class Xa extends vi{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Dr.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Dr.fromReplace(e,this.pos,this.pos+1,new xt(Ze.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Xa(this.pos,n.marks[i]);return new Xa(this.pos,this.mark)}}return new Dd(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Xa(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Xa(n.pos,e.markFromJSON(n.mark))}}vi.jsonID("addNodeMark",Xa);class Dd extends vi{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Dr.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Dr.fromReplace(e,this.pos,this.pos+1,new xt(Ze.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Xa(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Dd(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Dd(n.pos,e.markFromJSON(n.mark))}}vi.jsonID("removeNodeMark",Dd);class jr extends vi{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&qb(e,this.from,this.to)?Dr.fail("Structure replace would overwrite content"):Dr.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ps([this.from,this.to-this.from,this.slice.size])}invert(e){return new jr(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new jr(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(e){if(!(e instanceof jr)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?xt.empty:new xt(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new jr(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?xt.empty:new xt(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new jr(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new jr(n.from,n.to,xt.fromJSON(e,n.slice),!!n.structure)}}vi.jsonID("replace",jr);class Hr extends vi{constructor(e,n,r,i,s,a,o=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=a,this.structure=o}apply(e){if(this.structure&&(qb(e,this.from,this.gapFrom)||qb(e,this.gapTo,this.to)))return Dr.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Dr.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Dr.fromReplace(e,this.from,this.to,r):Dr.fail("Content does not fit in gap")}getMap(){return new ps([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Hr(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new Hr(n.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Hr(n.from,n.to,n.gapFrom,n.gapTo,xt.fromJSON(e,n.slice),n.insert,!!n.structure)}}vi.jsonID("replaceAround",Hr);function qb(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let a=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,i--}}return!1}function s$(t,e,n,r){let i=[],s=[],a,o;t.doc.nodesBetween(e,n,(f,g,y)=>{if(!f.isInline)return;let v=f.marks;if(!r.isInSet(v)&&y.type.allowsMarkType(r.type)){let w=Math.max(g,e),T=Math.min(g+f.nodeSize,n),D=r.addToSet(v);for(let O=0;O<v.length;O++)v[O].isInSet(D)||(a&&a.to==w&&a.mark.eq(v[O])?a.to=T:i.push(a=new So(w,T,v[O])));o&&o.to==w?o.to=T:s.push(o=new Za(w,T,r))}}),i.forEach(f=>t.step(f)),s.forEach(f=>t.step(f))}function o$(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(a,o)=>{if(!a.isInline)return;s++;let f=null;if(r instanceof Nm){let g=a.marks,y;for(;y=r.isInSet(g);)(f||(f=[])).push(y),g=y.removeFromSet(g)}else r?r.isInSet(a.marks)&&(f=[r]):f=a.marks;if(f&&f.length){let g=Math.min(o+a.nodeSize,n);for(let y=0;y<f.length;y++){let v=f[y],w;for(let T=0;T<i.length;T++){let D=i[T];D.step==s-1&&v.eq(i[T].style)&&(w=D)}w?(w.to=g,w.step=s):i.push({style:v,from:Math.max(o,e),to:g,step:s})}}}),i.forEach(a=>t.step(new So(a.from,a.to,a.style)))}function Gb(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),a=[],o=e+1;for(let f=0;f<s.childCount;f++){let g=s.child(f),y=o+g.nodeSize,v=r.matchType(g.type);if(!v)a.push(new jr(o,y,xt.empty));else{r=v;for(let w=0;w<g.marks.length;w++)n.allowsMarkType(g.marks[w].type)||t.step(new So(o,y,g.marks[w]));if(i&&g.isText&&n.whitespace!="pre"){let w,T=/\r?\n|\r/g,D;for(;w=T.exec(g.text);)D||(D=new xt(Ze.from(n.schema.text(" ",n.allowedMarks(g.marks))),0,0)),a.push(new jr(o+w.index,o+w.index+w[0].length,D))}}o=y}if(!r.validEnd){let f=r.fillBefore(Ze.empty,!0);t.replace(o,o,new xt(f,0,0))}for(let f=a.length-1;f>=0;f--)t.step(a[f])}function a$(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Id(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let i=t.$from.node(r),s=t.$from.index(r),a=t.$to.indexAfter(r);if(r<t.depth&&i.canReplace(s,a,n))return r;if(r==0||i.type.spec.isolating||!a$(i,s,a))break}return null}function l$(t,e,n){let{$from:r,$to:i,depth:s}=e,a=r.before(s+1),o=i.after(s+1),f=a,g=o,y=Ze.empty,v=0;for(let D=s,O=!1;D>n;D--)O||r.index(D)>0?(O=!0,y=Ze.from(r.node(D).copy(y)),v++):f--;let w=Ze.empty,T=0;for(let D=s,O=!1;D>n;D--)O||i.after(D+1)<i.end(D)?(O=!0,w=Ze.from(i.node(D).copy(w)),T++):g++;t.step(new Hr(f,g,a,o,new xt(y.append(w),v,T),y.size-v,!0))}function Yb(t,e,n=null,r=t){let i=c$(t,e),s=i&&d$(r,e);return s?i.map(lS).concat({type:e,attrs:n}).concat(s.map(lS)):null}function lS(t){return{type:t,attrs:null}}function c$(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let a=s.length?s[0]:e;return n.canReplaceWith(r,i,a)?s:null}function d$(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),a=e.contentMatch.findWrapping(s.type);if(!a)return null;let f=(a.length?a[a.length-1]:e).contentMatch;for(let g=r;f&&g<i;g++)f=f.matchType(n.child(g).type);return!f||!f.validEnd?null:a}function u$(t,e,n){let r=Ze.empty;for(let a=n.length-1;a>=0;a--){if(r.size){let o=n[a].type.contentMatch.matchFragment(r);if(!o||!o.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Ze.from(n[a].type.create(n[a].attrs,r))}let i=e.start,s=e.end;t.step(new Hr(i,s,i,s,new xt(r,0,0),n.length,!0))}function h$(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(a,o)=>{let f=typeof i=="function"?i(a):i;if(a.isTextblock&&!a.hasMarkup(r,f)&&p$(t.doc,t.mapping.slice(s).map(o),r)){let g=null;if(r.schema.linebreakReplacement){let T=r.whitespace=="pre",D=!!r.contentMatch.matchType(r.schema.linebreakReplacement);T&&!D?g=!1:!T&&D&&(g=!0)}g===!1&&dS(t,a,o,s),Gb(t,t.mapping.slice(s).map(o,1),r,void 0,g===null);let y=t.mapping.slice(s),v=y.map(o,1),w=y.map(o+a.nodeSize,1);return t.step(new Hr(v,w,v+1,w-1,new xt(Ze.from(r.create(f,null,a.marks)),0,0),1,!0)),g===!0&&cS(t,a,o,s),!1}})}function cS(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let a,o=/\r?\n|\r/g;for(;a=o.exec(i.text);){let f=t.mapping.slice(r).map(n+1+s+a.index);t.replaceWith(f,f+1,e.type.schema.linebreakReplacement.create())}}})}function dS(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let a=t.mapping.slice(r).map(n+1+s);t.replaceWith(a,a+1,e.type.schema.text(`
|