/home/shalekuihb/www/wp-content/plugins/insta-gallery/build/gutenberg/js/index.js
/*! For license information please see index.js.LICENSE.txt */
(()=>{var e={500:(e,t)=>{var a;!function(){"use strict";var l={}.hasOwnProperty;function n(){for(var e="",t=0;t<arguments.length;t++){var a=arguments[t];a&&(e=i(e,r(a)))}return e}function r(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return n.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var a in e)l.call(e,a)&&e[a]&&(t=i(t,a));return t}function i(e,t){return t?e?e+" "+t:e+t:e}e.exports?(n.default=n,e.exports=n):void 0===(a=function(){return n}.apply(t,[]))||(e.exports=a)}()}},t={};function a(l){var n=t[l];if(void 0!==n)return n.exports;var r=t[l]={exports:{}};return e[l](r,r.exports,a),r.exports}a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var l in t)a.o(t,l)&&!a.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:t[l]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";const e=window.React,t=window.wp.i18n,l=window.wp.blocks,n=window.wp.blockEditor,r=window.wp.compose,i=window.wp.hooks,o=(0,r.createHigherOrderComponent)(t=>a=>("qligg/box"===a.name&&(a.attributes.username&&(a.attributes.account_id=a.attributes.username,a.attributes.username=void 0),a.attributes.type&&(a.atributes.source=a.attributes.type,a.attributes.type=void 0),a.attributes.popup&&(a.attributes.modal=a.attributes.popup,a.attributes.popup=void 0)),(0,e.createElement)(t,{...a})),"withCustomBlockEdit");(0,i.addFilter)("editor.BlockEdit","qligg/box/edit",o);const s=window.qligg.store;var c=a(500),m=a.n(c);const g=window.wp.element,d=window.wp.components,u=[{key:"desktop",label:(0,t.__)("Desktop","insta-gallery"),icon:"desktop"},{key:"tablet",label:(0,t.__)("Tablet","insta-gallery"),icon:"tablet"},{key:"mobile",label:(0,t.__)("Mobile","insta-gallery"),icon:"smartphone"}],_={desktop:{columns:3,spacing:10},tablet:{columns:2,spacing:8},mobile:{columns:1,spacing:6},breakpoints:{tablet:768,mobile:480}},p=!1!==window?.QLIGG_IS_PREMIUM;function y(e={},t,a){return{..._,...e,[t]:{...e?.[t]||{},...a}}}const h=a=>{const{attributes:l,setAttributes:i}=a,[o,c]=(0,g.useState)(l.tag),[h,f]=(0,g.useState)(l.limit),b=(0,r.useDebounce)(e=>{i({tag:e})},1e3),E=(0,r.useDebounce)(e=>{i({limit:e})},1e3);(0,g.useEffect)(()=>{b(o)},[o,b]),(0,g.useEffect)(()=>{E(h)},[h,E]);const{accounts:v}=(0,s.useAccountsEntities)(),k=qligg_gutenberg.image_url,C=v?.find(e=>e.id===l.account_id),[x,w]=(0,g.useState)(!1);return(0,e.createElement)(n.InspectorControls,{key:"inspector"},(0,e.createElement)(d.PanelBody,{initialOpen:!0,title:(0,t.__)("Cache","insta-gallery")},(0,e.createElement)(d.Button,{variant:"secondary",onClick:async()=>{confirm((0,t.__)("You are about to reset the cache of this feed.","insta-gallery"))&&(w(!0),await(0,s.clearFeedCache)({method:"POST",data:{feedSettings:l}}),w(!1))}},(0,t.__)("Clear Cache","insta-gallery")),x&&(0,e.createElement)("span",{style:{visibility:"visible",position:"absolute"},className:"spinner"})),(0,e.createElement)(d.PanelBody,{initialOpen:!0,title:(0,t.__)("General","insta-gallery")},(0,e.createElement)(d.SelectControl,{label:(0,t.__)("Account","insta-gallery"),help:(0,t.__)("Please select Instagram account.","insta-gallery"),value:l.account_id,onChange:e=>i({account_id:e}),options:v.map((e,t)=>({value:e.id,label:e.nickname||e.username,disabled:!p&&t>0}))}),(0,e.createElement)(d.SelectControl,{label:(0,t.__)("Source","insta-gallery"),value:l.source,onChange:e=>i({source:e}),options:[{value:"tag",label:(0,t.__)("Tag","insta-gallery")},{value:"username",label:(0,t.__)("Username","insta-gallery")},{value:"tagged",label:(0,t.__)("Tagged (Premium)","insta-gallery"),disabled:!p||"BUSINESS"!==C?.access_token_type},{value:"stories",label:(0,t.__)("Stories (Premium)","insta-gallery"),disabled:!p||"BUSINESS"!==C?.access_token_type}]}),"BUSINESS"!==C?.access_token_type&&(0,e.createElement)(d.Notice,{status:"info",isDismissible:!1},(0,e.createElement)("p",null,(0,t.__)("Hashtag, Tagged, and Stories options are only available for professional accounts.","insta-gallery"))),"tag"===l.source&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(d.TextControl,{label:(0,t.__)("Tag","insta-gallery"),help:(0,t.__)("Please enter Instagram tag","insta-gallery"),value:o,onChange:function(e){c(e)}}),(0,e.createElement)(d.SelectControl,{label:(0,t.__)("Order by","insta-gallery"),help:(0,t.__)("Please enter Instagram tag order","insta-gallery"),value:l.order_by,onChange:e=>i({order_by:e}),options:[{value:"recent_media",label:(0,t.__)("Recent (Within 24 hours)","insta-gallery")},{value:"top_media",label:(0,t.__)("Top (Most popular first)","insta-gallery")}]}),(0,e.createElement)(d.Notice,{status:"info",isDismissible:!1},(0,t.__)("Instagram API limitation: You are limited to 30 unique hashtags in a 7-day period.","insta-gallery"))),"tagged"===l.source&&"BUSINESS"===C?.access_token_type&&(0,e.createElement)(d.Notice,{status:"info",isDismissible:!1},(0,t.__)("This feed will display photos where your Instagram account has been tagged by other users.","insta-gallery")),"stories"===l.source&&"BUSINESS"===C?.access_token_type&&(0,e.createElement)(d.Notice,{status:"info",isDismissible:!1},(0,t.__)("This feed will display your active Instagram stories. Stories expire after 24 hours.","insta-gallery")),(0,e.createElement)(e.Fragment,null,(0,e.createElement)("ul",{className:"qligg-list-videos"},["carousel","gallery","masonry","highlight"].filter(e=>!("stories"===l.source&&"carousel"===e)).map((t,a)=>(0,e.createElement)("li",{key:a,className:m()("qligg-modal-image",l.layout==t&&"active","carousel"!==t&&"gallery"!==t&&"qligg-premium-field"),onClick:()=>i({layout:t})},(0,e.createElement)("span",null,t.replace("-"," ")),(0,e.createElement)("img",{src:`${k}/${t}.png`,alt:"layout"}))))),"tag"!==l.source&&"stories"!==l.source&&(0,e.createElement)(d.ToggleControl,{label:(0,t.__)("Hide feed reels","insta-gallery"),help:(0,t.__)("Hide reels from feed","insta-gallery"),checked:!!l.reel.hide,onChange:e=>i({reel:{...l.reel,hide:e}})}),(0,e.createElement)(e.Fragment,null,(0,e.createElement)(d.ToggleControl,{label:(0,t.__)("Hide feed copyright","insta-gallery"),help:(0,t.__)("Hide the feeds that have copyright","insta-gallery"),checked:!!l.copyright.hide,onChange:e=>i({copyright:{...l.copyright,hide:e}})})),"gallery"===l.layout&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"custom-aspect-ratio-controls qligg-premium-field"},(0,e.createElement)("span",{className:"components-base-control__label"},(0,t.__)("Aspect Ratio","insta-gallery")),(0,e.createElement)("div",{style:{display:"flex",gap:"5px",marginTop:"10px"}},(0,e.createElement)(d.TextControl,{label:(0,t.__)(" Width","insta-gallery"),type:"number",min:1,max:100,value:l.aspect_ratio.width,onChange:e=>{const t=parseInt(e),a=isNaN(t)?1:Math.min(Math.max(t,1),100);i({aspect_ratio:{...l.aspect_ratio,width:a}})}}),(0,e.createElement)("span",null,":"),(0,e.createElement)(d.TextControl,{label:(0,t.__)("Height","insta-gallery"),type:"number",min:1,max:100,value:l.aspect_ratio.height,onChange:e=>{const t=parseInt(e),a=isNaN(t)?1:Math.min(Math.max(t,1),100);i({aspect_ratio:{...l.aspect_ratio,height:a}})}})))),(0,e.createElement)(d.RangeControl,{label:(0,t.__)("Limit","insta-gallery"),help:(0,t.__)("Number of videos to display","insta-gallery"),value:h,onChange:function(e){f(e)},min:1,max:33}),"highlight"===l.layout&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(d.TextControl,{label:(0,t.__)(" highlight by tag","insta-gallery"),help:(0,t.__)("Highlight feeds items with this tags","insta-gallery"),value:l.highlight.tag,onChange:e=>i({highlight:{...l.highlight,tag:e}})}),(0,e.createElement)(d.TextControl,{label:(0,t.__)(" highlight by id","insta-gallery"),help:(0,t.__)(" highlight by id","insta-gallery"),value:l.highlight.id,onChange:e=>i({highlight:{...l.highlight,id:e}})}),(0,e.createElement)(d.TextControl,{label:(0,t.__)(" highlight by position","insta-gallery"),help:(0,t.__)("Highlight feeds items in this positions","insta-gallery"),value:l.highlight.position,onChange:e=>i({highlight:{...l.highlight,position:e}})}))),(0,e.createElement)(d.PanelBody,{initialOpen:!1,title:(0,t.__)("Responsive","insta-gallery")},(0,e.createElement)("div",{className:"qligg-premium-field"},(0,e.createElement)("p",null,(0,e.createElement)("span",{className:"description"},(0,e.createElement)("small",null,(0,t.__)("These responsive settings will override the main feed settings for different screen sizes.","insta-gallery"))))),u.map(({key:a,label:n,icon:r})=>{var o,s;const c=null!==(o=l?.responsive?.breakpoints?.[a])&&void 0!==o?o:_.breakpoints[a],g=null!==(s=l?.responsive?.[a])&&void 0!==s?s:_[a];return(0,e.createElement)(d.BaseControl,{key:a,className:m()("desktop"!==a&&"qligg-premium-field"),__nextHasNoMarginBottom:!0,label:(0,e.createElement)(e.Fragment,null,(0,e.createElement)("span",{className:`dashicons dashicons-${r}`})," ",n)},"desktop"!==a&&(0,e.createElement)(d.RangeControl,{label:(0,t.__)("Breakpoint (px)","insta-gallery"),min:320,max:"tablet"===a?1200:767,value:c,onChange:e=>i({responsive:y(l.responsive,"breakpoints",{[a]:e})}),help:sprintf((0,t.__)("Screen width at which %s layout starts","insta-gallery"),n)}),(0,e.createElement)(d.RangeControl,{label:(0,t.__)("Columns","insta-gallery"),min:1,max:"desktop"===a?10:"tablet"===a?8:6,value:g.columns,onChange:e=>i({responsive:y(l.responsive,a,{columns:e})}),help:sprintf((0,t.__)("Number of columns for %s devices","insta-gallery"),n)}),(0,e.createElement)(d.RangeControl,{label:(0,t.__)("Spacing","insta-gallery"),min:0,max:50,value:g.spacing,onChange:e=>i({responsive:y(l.responsive,a,{spacing:e})}),help:(0,t.__)("Space between items in pixels","insta-gallery")}))})),"carousel"==l.layout&&(0,e.createElement)(d.PanelBody,{initialOpen:!1,title:(0,t.__)("Carousel","insta-gallery")},(0,e.createElement)(d.ToggleControl,{label:(0,t.__)("Autoplay","insta-gallery"),help:(0,t.__)("Autoplay carousel items","insta-gallery"),checked:!!l.carousel.autoplay,onChange:e=>i({carousel:{...l.carousel,autoplay:e}}),className:"qligg-premium-field"}),l.carousel.autoplay&&(0,e.createElement)(d.RangeControl,{label:(0,t.__)("Autoplay Interval","insta-gallery"),help:(0,t.__)("Moves carousel after a certain amount of time ","insta-gallery"),value:l.carousel.autoplay_interval,onChange:e=>i({carousel:{...l.carousel,autoplay_interval:e}}),min:1e3,max:3e5,step:100,className:"qligg-premium-field"}),(0,e.createElement)(d.ToggleControl,{label:(0,t.__)("Navigation","insta-gallery"),help:(0,t.__)("Display navigation arrows","insta-gallery"),checked:!!l.carousel.navarrows,onChange:e=>i({carousel:{...l.carousel,navarrows:e}}),className:"qligg-premium-field"}),l.carousel.navarrows&&(0,e.createElement)(d.BaseControl,{label:(0,t.__)("Navigation color","insta-gallery"),help:(0,t.__)("Change navigation arrows color","insta-gallery"),className:"qligg-premium-field"},(0,e.createElement)(n.ColorPalette,{value:l.carousel.navarrows_color,onChange:e=>i({carousel:{...l.carousel,navarrows_color:e}})})),(0,e.createElement)(d.ToggleControl,{label:(0,t.__)("Pagination","insta-gallery"),help:(0,t.__)("Display pagination dots","insta-gallery"),checked:!!l.carousel.pagination,onChange:e=>i({carousel:{...l.carousel,pagination:e}}),className:"qligg-premium-field"}),l.carousel.pagination&&(0,e.createElement)(d.BaseControl,{label:(0,t.__)("Pagination color","insta-gallery"),help:(0,t.__)("Change pagination dots color","insta-gallery"),className:"qligg-premium-field"},(0,e.createElement)(n.ColorPalette,{value:l.carousel.pagination_color,onChange:e=>i({carousel:{...l.carousel,pagination_color:e}})}))),(0,e.createElement)(d.PanelBody,{initialOpen:!1,title:(0,t.__)("Profile","insta-gallery")},(0,e.createElement)(d.ToggleControl,{label:(0,t.__)("Display","insta-gallery"),className:"qligg-premium-field",help:(0,t.__)("Display user profile or tag info","insta-gallery"),checked:!!l.profile.display,onChange:e=>i({profile:{...l.profile,display:e}})}),l.profile.display&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(d.TextControl,{label:(0,t.__)("Full name","insta-gallery"),help:(0,t.__)("Feed profile full name","insta-gallery"),value:l.profile.nickname,onChange:e=>{i({profile:{...l.profile,nickname:e}})}}),(0,e.createElement)(d.TextControl,{label:(0,t.__)("Follow text","insta-gallery"),help:(0,t.__)("Follow text here","insta-gallery"),value:l.profile.link_text,onChange:e=>{i({profile:{...l.profile,link_text:e}})}}),(0,e.createElement)(d.TextControl,{label:(0,t.__)("Website","insta-gallery"),help:(0,t.__)("Website url here","insta-gallery"),value:l.profile.website,onChange:e=>{i({profile:{...l.profile,website:e}})}}),(0,e.createElement)(d.TextControl,{label:(0,t.__)("Website link text","insta-gallery"),help:(0,t.__)("Website link text here","insta-gallery"),value:l.profile.website_text,onChange:e=>{i({profile:{...l.profile,website_text:e}})}}),(0,e.createElement)("div",{style:{display:"flex",flexDirection:"column",alignItems:"right"}},(0,e.createElement)("img",{alt:"",width:"150",height:"150",src:l.profile.avatar||C.avatar||"http://2.gravatar.com/avatar/b642b4217b34b1e8d3bd915fc65c4452?s=150&d=mm&r=g"}),(0,e.createElement)(n.MediaUpload,{onSelect:e=>{i({profile:{...l.profile,avatar:e.url}})},allowedTypes:["image"],value:l.profile.avatar,render:({open:a})=>(0,e.createElement)("div",null,(0,e.createElement)(d.Button,{style:{margin:"15px 5px 15px 0"},variant:"secondary",onClick:a},(0,t.__)("Upload","insta-gallery")),(0,e.createElement)(d.Button,{style:{margin:"15px 0"},variant:"secondary",disabled:!l.profile.avatar||l.profile.avatar===C.avatar,onClick:()=>{i({profile:{...l.profile,avatar:C.avatar||""}})}},"×"))}),(0,e.createElement)(d.TextareaControl,{label:(0,t.__)("Biography","insta-gallery"),help:(0,t.__)("Feed profile biography","insta-gallery"),value:l.profile.biography,onChange:e=>{i({profile:{...l.profile,biography:e}})}})))),(0,e.createElement)(d.PanelBody,{initialOpen:!1,title:(0,t.__)("Box","insta-gallery")},(0,e.createElement)(d.ToggleControl,{label:(0,t.__)("Display","insta-gallery"),className:"qligg-premium-field",help:(0,t.__)("Display the Instagram Feed inside a customizable box","insta-gallery"),checked:!!l.box.display,onChange:e=>i({box:{...l.box,display:e}})}),l.box.display&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(d.RangeControl,{label:(0,t.__)("Padding","insta-gallery"),className:"qligg-premium-field",help:(0,t.__)("Add padding to the box","insta-gallery"),value:l.box.padding,onChange:e=>i({box:{...l.box,padding:e}}),min:0,max:300}),(0,e.createElement)(d.RangeControl,{label:(0,t.__)("Radius","insta-gallery"),help:(0,t.__)("Add radius to the box","insta-gallery"),className:"qligg-premium-field",value:l.box.radius,onChange:e=>i({box:{...l.box,radius:e}}),min:0,max:1e3}),(0,e.createElement)(d.BaseControl,{label:(0,t.__)("Background","insta-gallery"),help:(0,t.__)("Change background color in box","insta-gallery"),className:"qligg-premium-field"},(0,e.createElement)(n.ColorPalette,{value:l.box.background,onChange:e=>i({box:{...l.box,background:e}})})),(0,e.createElement)(d.BaseControl,{label:(0,t.__)("Text color","insta-gallery"),className:"qligg-premium-field",help:(0,t.__)("Change text color in box","insta-gallery")},(0,e.createElement)(n.ColorPalette,{value:l.box.text_color,onChange:e=>i({box:{...l.box,text_color:e}})})))),(0,e.createElement)(d.PanelBody,{initialOpen:!1,title:(0,t.__)("Image","insta-gallery")},(0,e.createElement)(d.ToggleControl,{label:(0,t.__)("Lazy load","insta-gallery"),help:(0,t.__)("Defers image load","insta-gallery"),checked:!!l.lazy,onChange:e=>i({lazy:e})}),(0,e.createElement)(d.ToggleControl,{label:(0,t.__)("Mask","insta-gallery"),help:(0,t.__)("Display mask on hover","insta-gallery"),checked:!!l.mask.display,onChange:e=>i({mask:{...l.mask,display:e}})}),l.mask.display&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(d.BaseControl,{label:(0,t.__)("Background","insta-gallery"),help:(0,t.__)("Change background color in mask","insta-gallery")},(0,e.createElement)(n.ColorPalette,{value:l.mask.background,onChange:e=>i({mask:{...l.mask,background:e}})})),"PERSONAL"===C.access_token_type&&(0,e.createElement)(d.Notice,{status:"info",isDismissible:!1},(0,e.createElement)("p",null,(0,t.__)("Likes and comments options are only available for professional account.","insta-gallery"))),(0,e.createElement)(d.ToggleControl,{label:(0,t.__)("Likes count","insta-gallery"),help:(0,t.__)("Display likes count in mask","insta-gallery"),checked:!!l.mask.likes_count,disabled:"PERSONAL"===C.access_token_type,onChange:e=>i({mask:{...l.mask,likes_count:e}})}),(0,e.createElement)(d.ToggleControl,{label:(0,t.__)("Comments count","insta-gallery"),help:(0,t.__)("Display comments count in mask","insta-gallery"),checked:!!l.mask.comments_count,disabled:"PERSONAL"===C.access_token_type,onChange:e=>i({mask:{...l.mask,comments_count:e}})}),(l.mask.comments_count||l.mask.likes_count)&&(0,e.createElement)(d.BaseControl,{label:(0,t.__)("Icons color","insta-gallery"),help:(0,t.__)("Change icons color in mask","insta-gallery")},(0,e.createElement)(n.ColorPalette,{value:l.mask.icon_color,onChange:e=>i({mask:{...l.mask,icon_color:e}})})))),(0,e.createElement)(d.PanelBody,{initialOpen:!1,title:(0,t.__)("Card","insta-gallery")},(0,e.createElement)(d.ToggleControl,{label:(0,t.__)("Display","insta-gallery"),className:"qligg-premium-field",help:(0,t.__)("Display card in image","insta-gallery"),checked:!!l.card.display,onChange:e=>i({card:{...l.card,display:e}})}),l.card.display&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(d.RangeControl,{label:(0,t.__)("Radius","insta-gallery"),help:(0,t.__)("Add radius to the card","insta-gallery"),className:"qligg-premium-field",value:l.card.radius,onChange:e=>i({card:{...l.card,radius:e}}),min:0,max:1e3}),(0,e.createElement)(d.RangeControl,{label:(0,t.__)("Font size","insta-gallery"),help:(0,t.__)("Change font size in cards","insta-gallery"),className:"qligg-premium-field",value:l.card.font_size,onChange:e=>i({card:{...l.card,font_size:e}}),min:8,max:36}),(0,e.createElement)(d.BaseControl,{label:(0,t.__)("Background","insta-gallery"),className:"qligg-premium-field",help:(0,t.__)("Change background color in cards","insta-gallery")},(0,e.createElement)(n.ColorPalette,{value:l.card.background,onChange:e=>i({card:{...l.card,background:e}})})),(0,e.createElement)(d.BaseControl,{label:(0,t.__)("Background hover","insta-gallery"),className:"qligg-premium-field",help:(0,t.__)("Change background color hover in cards","insta-gallery")},(0,e.createElement)(n.ColorPalette,{value:l.card.background_hover,onChange:e=>i({card:{...l.card,background_hover:e}})})),(0,e.createElement)(d.BaseControl,{label:(0,t.__)("Text color","insta-gallery"),className:"qligg-premium-field",help:(0,t.__)("Change text color","insta-gallery")},(0,e.createElement)(n.ColorPalette,{value:l.card.text_color,onChange:e=>i({card:{...l.card,text_color:e}})})),(0,e.createElement)(d.RangeControl,{label:(0,t.__)("Padding","insta-gallery"),help:(0,t.__)("Add padding in cards","insta-gallery"),className:"qligg-premium-field",value:l.card.padding,onChange:e=>i({card:{...l.card,padding:e}}),min:0,max:20}),"PERSONAL"===C.access_token_type&&(0,e.createElement)(d.Notice,{status:"info",isDismissible:!1},(0,e.createElement)("p",null,(0,t.__)("Likes and comments options are only available for professional account.","insta-gallery"))),(0,e.createElement)(d.ToggleControl,{label:(0,t.__)("Likes","insta-gallery"),className:"qligg-premium-field",help:(0,t.__)("Display likes count in cards","insta-gallery"),checked:!!l.card.likes_count,disabled:"PERSONAL"===C.access_token_type,onChange:e=>i({card:{...l.card,likes_count:e}})}),(0,e.createElement)(d.ToggleControl,{label:(0,t.__)("Comments","insta-gallery"),className:"qligg-premium-field",help:(0,t.__)("Display comments count in cards","insta-gallery"),checked:!!l.card.comments_count,disabled:"PERSONAL"===C.access_token_type,onChange:e=>i({card:{...l.card,comments_count:e}})}),(0,e.createElement)(d.RangeControl,{label:(0,t.__)("Length","insta-gallery"),help:(0,t.__)("Limit the length of the description in the card","insta-gallery"),className:"qligg-premium-field",value:l.card.text_length,onChange:e=>i({card:{...l.card,text_length:e}}),min:1,max:100}),(0,e.createElement)(d.SelectControl,{label:(0,t.__)("Text align","insta-gallery"),help:(0,t.__)("Align description in card","insta-gallery"),className:"qligg-premium-field",value:l.card.text_align||"",onChange:e=>i({card:{...l.card,text_align:e}}),options:[{value:"left",label:(0,t.__)("Left","insta-gallery")},{value:"center",label:(0,t.__)("Center","insta-gallery")},{value:"right",label:(0,t.__)("Right","insta-gallery")}]}))),(0,e.createElement)(d.PanelBody,{initialOpen:!1,title:(0,t.__)("Modal","insta-gallery")},(0,e.createElement)(d.ToggleControl,{label:(0,t.__)("Display","insta-gallery"),help:(0,t.__)("Display modal by clicking on image","insta-gallery"),checked:!!l.modal.display,onChange:e=>i({modal:{...l.modal,display:e}})}),l.modal.display&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(d.SelectControl,{label:(0,t.__)("Sidebar align","insta-gallery"),help:(0,t.__)("Align sidebar in modal on desktop","insta-gallery"),className:"qligg-premium-field",value:l.modal.modal_align||"",onChange:e=>i({modal:{...l.modal,modal_align:e}}),options:[{value:"top",label:(0,t.__)("Top","insta-gallery")},{value:"right",label:(0,t.__)("Right","insta-gallery")},{value:"bottom",label:(0,t.__)("Bottom","insta-gallery")},{value:"left",label:(0,t.__)("Left","insta-gallery")}]}),(0,e.createElement)(d.ToggleControl,{label:(0,t.__)("Profile","insta-gallery"),help:(0,t.__)("Display user profile or tag info","insta-gallery"),checked:!!l.modal.profile,onChange:e=>i({modal:{...l.modal,profile:e}})}),"PERSONAL"===C.access_token_type&&(0,e.createElement)(d.Notice,{status:"info",isDismissible:!1},(0,e.createElement)("p",null,(0,t.__)("Likes and comments options are only available for professional account.","insta-gallery"))),(0,e.createElement)(d.ToggleControl,{label:(0,t.__)("Show likes count","insta-gallery"),help:(0,t.__)("Display likes count in sidebar","insta-gallery"),checked:!!l.modal.likes_count,disabled:"PERSONAL"===C.access_token_type,onChange:e=>i({modal:{...l.modal,likes_count:e}})}),(0,e.createElement)(d.ToggleControl,{label:(0,t.__)("Show comments count","insta-gallery"),help:(0,t.__)("Display comments count in sidebar","insta-gallery"),checked:!!l.modal.comments_count,disabled:"PERSONAL"===C.access_token_type,onChange:e=>i({modal:{...l.modal,comments_count:e}})}),(0,e.createElement)(d.ToggleControl,{label:(0,t.__)("Show description","insta-gallery"),help:(0,t.__)("Display description in the sidebar","insta-gallery"),checked:!!l.modal.media_description,onChange:e=>i({modal:{...l.modal,media_description:e}})}),(0,e.createElement)(d.ToggleControl,{label:(0,t.__)("Show comments list","insta-gallery"),help:(0,t.__)("Display comments list in sidebar","insta-gallery"),className:"qligg-premium-field",checked:!!l.modal.comments_list,disabled:"BUSINESS"!==C?.access_token_type,onChange:e=>i({modal:{...l.modal,comments_list:e}})}),"stories"===l.source&&(0,e.createElement)(d.Notice,{status:"info",isDismissible:!1},(0,e.createElement)("p",null,(0,t.__)("Comments option for Instagram feeds (all sources except Stories)","insta-gallery"))),(0,e.createElement)(d.SelectControl,{label:(0,t.__)("Text align","insta-gallery"),help:(0,t.__)("Align description in sidebar","insta-gallery"),className:"qligg-premium-field",value:l.modal.text_align||"",onChange:e=>i({modal:{...l.modal,text_align:e}}),options:[{value:"left",label:(0,t.__)("Left","insta-gallery")},{value:"center",label:(0,t.__)("Center","insta-gallery")},{value:"right",label:(0,t.__)("Right","insta-gallery")}]}),(0,e.createElement)(d.RangeControl,{label:(0,t.__)("Font size","insta-gallery"),help:(0,t.__)("Change font size in sidebar","insta-gallery"),className:"qligg-premium-field",value:l.modal.font_size,onChange:e=>i({modal:{...l.modal,font_size:e}}),min:8,max:36}))),(0,e.createElement)(d.PanelBody,{initialOpen:!1,title:(0,t.__)("Button","insta-gallery")},(0,e.createElement)(d.ToggleControl,{label:(0,t.__)("Display","insta-gallery"),help:(0,t.__)("Display the button to open Instagram site link","insta-gallery"),checked:!!l.button.display,onChange:e=>i({button:{...l.button,display:e}})}),l.button.display&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(d.TextControl,{label:(0,t.__)("Text","insta-gallery"),help:(0,t.__)("Change button text","insta-gallery"),value:l.button.text,onChange:e=>i({button:{...l.button,text:e}})}),(0,e.createElement)(d.BaseControl,{label:(0,t.__)("Text color","insta-gallery"),help:(0,t.__)("Change Color text in button","insta-gallery")},(0,e.createElement)(n.ColorPalette,{value:l.button.text_color,onChange:e=>i({button:{...l.button,text_color:e}})})),(0,e.createElement)(d.BaseControl,{label:(0,t.__)("Background","insta-gallery"),help:(0,t.__)("Change background color in button","insta-gallery")},(0,e.createElement)(n.ColorPalette,{value:l.button.background,onChange:e=>i({button:{...l.button,background:e}})})),(0,e.createElement)(d.BaseControl,{label:(0,t.__)("Background hover","insta-gallery"),help:(0,t.__)("Change background hover in button","insta-gallery")},(0,e.createElement)(n.ColorPalette,{value:l.button.background_hover,onChange:e=>i({button:{...l.button,background_hover:e}})})))),(0,e.createElement)(d.PanelBody,{initialOpen:!1,title:(0,t.__)("Button Load More","insta-gallery")},(0,e.createElement)(d.ToggleControl,{label:(0,t.__)("Display","insta-gallery"),help:(0,t.__)("Display the button to load more videos","insta-gallery"),className:"qligg-premium-field",checked:!!l.button_load.display,onChange:e=>i({button_load:{...l.button_load,display:e}})}),l.button_load.display&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(d.TextControl,{label:(0,t.__)("Text","insta-gallery"),help:(0,t.__)("Change button text","insta-gallery"),value:l.button_load.text,onChange:e=>i({button_load:{...l.button_load,text:e}})}),(0,e.createElement)(d.BaseControl,{label:(0,t.__)("Text color","insta-gallery"),help:(0,t.__)("Change Color text in button","insta-gallery")},(0,e.createElement)(n.ColorPalette,{value:l.button_load.text_color,onChange:e=>i({button_load:{...l.button_load,text_color:e}})})),(0,e.createElement)(d.BaseControl,{label:(0,t.__)("Background","insta-gallery"),help:(0,t.__)("Change background color in button","insta-gallery")},(0,e.createElement)(n.ColorPalette,{value:l.button_load.background,onChange:e=>i({button_load:{...l.button_load,background:e}})})),(0,e.createElement)(d.BaseControl,{label:(0,t.__)("Background hover","insta-gallery"),help:(0,t.__)("Change background hover in button","insta-gallery")},(0,e.createElement)(n.ColorPalette,{value:l.button_load.background_hover,onChange:e=>i({button_load:{...l.button_load,background_hover:e}})})))))},f=(0,g.createContext)({}),b=()=>(0,g.useContext)(f),E=(e,t)=>{switch(t.type){case"SET_CURRENT_FEED_INDEX":case"SET_IS_OPEN":case"SET_COUNTER":return{...e,...t.payload}}},v=t=>{const{children:a}=t,[l,n]=(0,g.useReducer)(E,{currentFeedIndex:0,isOpen:!1,isImageLoad:!1,counter:0});return(0,e.createElement)(f.Provider,{value:{...l,setCurrentFeedIndex:e=>{l.currentFeedIndex!=e&&n({type:"SET_CURRENT_FEED_INDEX",payload:{currentFeedIndex:e}})},setIsOpen:e=>{l.isOpen!=e&&n({type:"SET_IS_OPEN",payload:{isOpen:e}})},setCounter:e=>{l.counter!=e&&n({type:"SET_COUNTER",payload:{counter:e}})}}},a)};async function k({url:e,data:t,method:a}){if(!e)throw new Error(`Empty url: ${e}`);const l={"Content-Type":"application/json"};return"undefined"!=typeof wpApiSettings&&wpApiSettings.nonce&&(l["X-WP-Nonce"]=wpApiSettings.nonce),await fetch(e,{body:t?JSON.stringify(t):void 0,method:a,headers:l,credentials:"same-origin"}).then(e=>e.json()).then(e=>{if(e.code)throw new Error(`${e.code}: ${e?.message||"Unknown"}`);return e}).catch(e=>{throw new Error(e)})}function C(e,t){const a=[];for(const l in e)if(e.hasOwnProperty(l)){const n=t?t+"["+l+"]":l,r=e[l];a.push(null!==r&&"object"==typeof r?C(r,n):encodeURIComponent(n)+"="+encodeURIComponent(r))}return a.join("&")}f.Consumer;const x=({href:t,className:a,children:l,onClick:n,disabled:r})=>(0,e.createElement)("a",{href:t,target:"blank",onClick:n,className:m()("instagram-gallery__button",a,r&&"instagram-gallery__button--disabled")},l);function w(e,t){const{tag:a,source:l}=e,n=t?.username;switch(l){case"username":return`https://www.instagram.com/${n}`;case"tag":return`https://www.instagram.com/explore/tags/${a}`;default:return"https://www.instagram.com"}}const N=({userProfile:t,feedSettings:a,onClick:l,after:n})=>{const r=!!a?.button?.display,i=!!a?.button_load?.display;return(0,e.createElement)("div",{className:"instagram-gallery__actions"},r&&(0,e.createElement)(x,{feedSettings:a,href:w(a,t),target:"blank",className:"instagram-gallery__button--follow"},(0,e.createElement)("i",{className:"qligg-icon-instagram "}),a.button.text),i&&(0,e.createElement)(x,{feedSettings:a,className:"instagram-gallery__button--load",disabled:""===n,onClick:l},a.button_load.text))},S=()=>{const t=window?.qligg_frontend?.settings?.spinner_image_url;return(0,e.createElement)("div",{className:"instagram-gallery__spinner",style:t?{backgroundImage:`url(${t})`}:{}})},I=({errorUserProfile:t,errorUserMediaList:a})=>(0,e.createElement)("div",{className:"instagram-gallery__alert"},(0,e.createElement)("ul",null,t&&(0,e.createElement)("li",null,(0,e.createElement)("b",null,t.error),(0,e.createElement)("p",null,t.message)),a&&(0,e.createElement)("li",null,(0,e.createElement)("b",null,a.error),(0,e.createElement)("p",null,a.message)))),q=(0,g.memo)(({feedSettings:t,userProfile:a})=>{const l={...a,...function(e){const t={};for(const a in e)e.hasOwnProperty(a)&&""!==e[a]&&(t[a]=e[a]);return t}(t.profile)};return!!t?.profile?.display&&(0,e.createElement)("div",{className:"instagram-gallery__profile"},(0,e.createElement)("div",{className:"avatar"},(0,e.createElement)("img",{src:l.avatar||"http://2.gravatar.com/avatar/b642b4217b34b1e8d3bd915fc65c4452?s=150&d=mm&r=g",alt:l.nickname})),(0,e.createElement)("div",{className:"info"},(0,e.createElement)("div",null,(0,e.createElement)("span",{className:"user"},"@",l.username),l.nickname&&(0,e.createElement)(g.Fragment,null,(0,e.createElement)("span",{className:"separator"},"•"),(0,e.createElement)("span",{className:"user"},l.nickname)),(0,e.createElement)("span",{className:"separator"},"•"),(0,e.createElement)("a",{className:"follow",href:l.link,target:"_blank",rel:"noopener noreferrer"},l.link_text),!!l.website&&(0,e.createElement)(g.Fragment,null,(0,e.createElement)("span",{className:"separator"},"•"),(0,e.createElement)("a",{className:"follow",href:l.website,target:"_blank",rel:"noopener noreferrer"},l.website_text)),(0,e.createElement)("div",{className:"description"},l.biography))))});var P,T,L,D,A,$,B,M,R,F,O,U={},z=[],W=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,j=Array.isArray;function H(e,t){for(var a in t)e[a]=t[a];return e}function V(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function G(e,t,a,l,n){var r={type:e,props:t,key:a,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==n?++L:n,__i:-1,__u:0};return null==n&&null!=T.vnode&&T.vnode(r),r}function Z(e){return e.children}function X(e,t){this.props=e,this.context=t}function J(e,t){if(null==t)return e.__?J(e.__,e.__i+1):null;for(var a;t<e.__k.length;t++)if(null!=(a=e.__k[t])&&null!=a.__e)return a.__e;return"function"==typeof e.type?J(e):null}function Y(e){var t,a;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(a=e.__k[t])&&null!=a.__e){e.__e=e.__c.base=a.__e;break}return Y(e)}}function K(e){(!e.__d&&(e.__d=!0)&&D.push(e)&&!Q.__r++||A!=T.debounceRendering)&&((A=T.debounceRendering)||$)(Q)}function Q(){for(var e,t,a,l,n,r,i,o=1;D.length;)D.length>o&&D.sort(B),e=D.shift(),o=D.length,e.__d&&(a=void 0,l=void 0,n=(l=(t=e).__v).__e,r=[],i=[],t.__P&&((a=H({},l)).__v=l.__v+1,T.vnode&&T.vnode(a),oe(t.__P,a,l,t.__n,t.__P.namespaceURI,32&l.__u?[n]:null,r,null==n?J(l):n,!!(32&l.__u),i),a.__v=l.__v,a.__.__k[a.__i]=a,ce(r,a,i),l.__e=l.__=null,a.__e!=n&&Y(a)));Q.__r=0}function ee(e,t,a,l,n,r,i,o,s,c,m){var g,d,u,_,p,y,h,f=l&&l.__k||z,b=t.length;for(s=te(a,t,f,s,b),g=0;g<b;g++)null!=(u=a.__k[g])&&(d=-1==u.__i?U:f[u.__i]||U,u.__i=g,y=oe(e,u,d,n,r,i,o,s,c,m),_=u.__e,u.ref&&d.ref!=u.ref&&(d.ref&&de(d.ref,null,u),m.push(u.ref,u.__c||_,u)),null==p&&null!=_&&(p=_),(h=!!(4&u.__u))||d.__k===u.__k?s=ae(u,s,e,h):"function"==typeof u.type&&void 0!==y?s=y:_&&(s=_.nextSibling),u.__u&=-7);return a.__e=p,s}function te(e,t,a,l,n){var r,i,o,s,c,m=a.length,g=m,d=0;for(e.__k=new Array(n),r=0;r<n;r++)null!=(i=t[r])&&"boolean"!=typeof i&&"function"!=typeof i?(s=r+d,(i=e.__k[r]="string"==typeof i||"number"==typeof i||"bigint"==typeof i||i.constructor==String?G(null,i,null,null,null):j(i)?G(Z,{children:i},null,null,null):null==i.constructor&&i.__b>0?G(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i).__=e,i.__b=e.__b+1,o=null,-1!=(c=i.__i=le(i,a,s,g))&&(g--,(o=a[c])&&(o.__u|=2)),null==o||null==o.__v?(-1==c&&(n>m?d--:n<m&&d++),"function"!=typeof i.type&&(i.__u|=4)):c!=s&&(c==s-1?d--:c==s+1?d++:(c>s?d--:d++,i.__u|=4))):e.__k[r]=null;if(g)for(r=0;r<m;r++)null!=(o=a[r])&&!(2&o.__u)&&(o.__e==l&&(l=J(o)),ue(o,o));return l}function ae(e,t,a,l){var n,r;if("function"==typeof e.type){for(n=e.__k,r=0;n&&r<n.length;r++)n[r]&&(n[r].__=e,t=ae(n[r],t,a,l));return t}e.__e!=t&&(l&&(t&&e.type&&!t.parentNode&&(t=J(e)),a.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function le(e,t,a,l){var n,r,i,o=e.key,s=e.type,c=t[a],m=null!=c&&!(2&c.__u);if(null===c&&null==e.key||m&&o==c.key&&s==c.type)return a;if(l>(m?1:0))for(n=a-1,r=a+1;n>=0||r<t.length;)if(null!=(c=t[i=n>=0?n--:r++])&&!(2&c.__u)&&o==c.key&&s==c.type)return i;return-1}function ne(e,t,a){"-"==t[0]?e.setProperty(t,null==a?"":a):e[t]=null==a?"":"number"!=typeof a||W.test(t)?a:a+"px"}function re(e,t,a,l,n){var r,i;e:if("style"==t)if("string"==typeof a)e.style.cssText=a;else{if("string"==typeof l&&(e.style.cssText=l=""),l)for(t in l)a&&t in a||ne(e.style,t,"");if(a)for(t in a)l&&a[t]==l[t]||ne(e.style,t,a[t])}else if("o"==t[0]&&"n"==t[1])r=t!=(t=t.replace(M,"$1")),i=t.toLowerCase(),t=i in e||"onFocusOut"==t||"onFocusIn"==t?i.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+r]=a,a?l?a.u=l.u:(a.u=R,e.addEventListener(t,r?O:F,r)):e.removeEventListener(t,r?O:F,r);else{if("http://www.w3.org/2000/svg"==n)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==a?"":a;break e}catch(e){}"function"==typeof a||(null==a||!1===a&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==a?"":a))}}function ie(e){return function(t){if(this.l){var a=this.l[t.type+e];if(null==t.t)t.t=R++;else if(t.t<a.u)return;return a(T.event?T.event(t):t)}}}function oe(e,t,a,l,n,r,i,o,s,c){var m,g,d,u,_,p,y,h,f,b,E,v,k,C,x,w,N,S=t.type;if(null!=t.constructor)return null;128&a.__u&&(s=!!(32&a.__u),r=[o=t.__e=a.__e]),(m=T.__b)&&m(t);e:if("function"==typeof S)try{if(h=t.props,f="prototype"in S&&S.prototype.render,b=(m=S.contextType)&&l[m.__c],E=m?b?b.props.value:m.__:l,a.__c?y=(g=t.__c=a.__c).__=g.__E:(f?t.__c=g=new S(h,E):(t.__c=g=new X(h,E),g.constructor=S,g.render=_e),b&&b.sub(g),g.props=h,g.state||(g.state={}),g.context=E,g.__n=l,d=g.__d=!0,g.__h=[],g._sb=[]),f&&null==g.__s&&(g.__s=g.state),f&&null!=S.getDerivedStateFromProps&&(g.__s==g.state&&(g.__s=H({},g.__s)),H(g.__s,S.getDerivedStateFromProps(h,g.__s))),u=g.props,_=g.state,g.__v=t,d)f&&null==S.getDerivedStateFromProps&&null!=g.componentWillMount&&g.componentWillMount(),f&&null!=g.componentDidMount&&g.__h.push(g.componentDidMount);else{if(f&&null==S.getDerivedStateFromProps&&h!==u&&null!=g.componentWillReceiveProps&&g.componentWillReceiveProps(h,E),!g.__e&&null!=g.shouldComponentUpdate&&!1===g.shouldComponentUpdate(h,g.__s,E)||t.__v==a.__v){for(t.__v!=a.__v&&(g.props=h,g.state=g.__s,g.__d=!1),t.__e=a.__e,t.__k=a.__k,t.__k.some(function(e){e&&(e.__=t)}),v=0;v<g._sb.length;v++)g.__h.push(g._sb[v]);g._sb=[],g.__h.length&&i.push(g);break e}null!=g.componentWillUpdate&&g.componentWillUpdate(h,g.__s,E),f&&null!=g.componentDidUpdate&&g.__h.push(function(){g.componentDidUpdate(u,_,p)})}if(g.context=E,g.props=h,g.__P=e,g.__e=!1,k=T.__r,C=0,f){for(g.state=g.__s,g.__d=!1,k&&k(t),m=g.render(g.props,g.state,g.context),x=0;x<g._sb.length;x++)g.__h.push(g._sb[x]);g._sb=[]}else do{g.__d=!1,k&&k(t),m=g.render(g.props,g.state,g.context),g.state=g.__s}while(g.__d&&++C<25);g.state=g.__s,null!=g.getChildContext&&(l=H(H({},l),g.getChildContext())),f&&!d&&null!=g.getSnapshotBeforeUpdate&&(p=g.getSnapshotBeforeUpdate(u,_)),w=m,null!=m&&m.type===Z&&null==m.key&&(w=me(m.props.children)),o=ee(e,j(w)?w:[w],t,a,l,n,r,i,o,s,c),g.base=t.__e,t.__u&=-161,g.__h.length&&i.push(g),y&&(g.__E=g.__=null)}catch(e){if(t.__v=null,s||null!=r)if(e.then){for(t.__u|=s?160:128;o&&8==o.nodeType&&o.nextSibling;)o=o.nextSibling;r[r.indexOf(o)]=null,t.__e=o}else{for(N=r.length;N--;)V(r[N]);se(t)}else t.__e=a.__e,t.__k=a.__k,e.then||se(t);T.__e(e,t,a)}else null==r&&t.__v==a.__v?(t.__k=a.__k,t.__e=a.__e):o=t.__e=ge(a.__e,t,a,l,n,r,i,s,c);return(m=T.diffed)&&m(t),128&t.__u?void 0:o}function se(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(se)}function ce(e,t,a){for(var l=0;l<a.length;l++)de(a[l],a[++l],a[++l]);T.__c&&T.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){T.__e(e,t.__v)}})}function me(e){return"object"!=typeof e||null==e||e.__b&&e.__b>0?e:j(e)?e.map(me):H({},e)}function ge(e,t,a,l,n,r,i,o,s){var c,m,g,d,u,_,p,y=a.props,h=t.props,f=t.type;if("svg"==f?n="http://www.w3.org/2000/svg":"math"==f?n="http://www.w3.org/1998/Math/MathML":n||(n="http://www.w3.org/1999/xhtml"),null!=r)for(c=0;c<r.length;c++)if((u=r[c])&&"setAttribute"in u==!!f&&(f?u.localName==f:3==u.nodeType)){e=u,r[c]=null;break}if(null==e){if(null==f)return document.createTextNode(h);e=document.createElementNS(n,f,h.is&&h),o&&(T.__m&&T.__m(t,r),o=!1),r=null}if(null==f)y===h||o&&e.data==h||(e.data=h);else{if(r=r&&P.call(e.childNodes),y=a.props||U,!o&&null!=r)for(y={},c=0;c<e.attributes.length;c++)y[(u=e.attributes[c]).name]=u.value;for(c in y)if(u=y[c],"children"==c);else if("dangerouslySetInnerHTML"==c)g=u;else if(!(c in h)){if("value"==c&&"defaultValue"in h||"checked"==c&&"defaultChecked"in h)continue;re(e,c,null,u,n)}for(c in h)u=h[c],"children"==c?d=u:"dangerouslySetInnerHTML"==c?m=u:"value"==c?_=u:"checked"==c?p=u:o&&"function"!=typeof u||y[c]===u||re(e,c,u,y[c],n);if(m)o||g&&(m.__html==g.__html||m.__html==e.innerHTML)||(e.innerHTML=m.__html),t.__k=[];else if(g&&(e.innerHTML=""),ee("template"==t.type?e.content:e,j(d)?d:[d],t,a,l,"foreignObject"==f?"http://www.w3.org/1999/xhtml":n,r,i,r?r[0]:a.__k&&J(a,0),o,s),null!=r)for(c=r.length;c--;)V(r[c]);o||(c="value","progress"==f&&null==_?e.removeAttribute("value"):null!=_&&(_!==e[c]||"progress"==f&&!_||"option"==f&&_!=y[c])&&re(e,c,_,y[c],n),c="checked",null!=p&&p!=e[c]&&re(e,c,p,y[c],n))}return e}function de(e,t,a){try{if("function"==typeof e){var l="function"==typeof e.__u;l&&e.__u(),l&&null==t||(e.__u=e(t))}else e.current=t}catch(e){T.__e(e,a)}}function ue(e,t,a){var l,n;if(T.unmount&&T.unmount(e),(l=e.ref)&&(l.current&&l.current!=e.__e||de(l,null,t)),null!=(l=e.__c)){if(l.componentWillUnmount)try{l.componentWillUnmount()}catch(e){T.__e(e,t)}l.base=l.__P=null}if(l=e.__k)for(n=0;n<l.length;n++)l[n]&&ue(l[n],t,a||"function"!=typeof e.type);a||V(e.__e),e.__c=e.__=e.__e=void 0}function _e(e,t,a){return this.constructor(e,a)}P=z.slice,T={__e:function(e,t,a,l){for(var n,r,i;t=t.__;)if((n=t.__c)&&!n.__)try{if((r=n.constructor)&&null!=r.getDerivedStateFromError&&(n.setState(r.getDerivedStateFromError(e)),i=n.__d),null!=n.componentDidCatch&&(n.componentDidCatch(e,l||{}),i=n.__d),i)return n.__E=n}catch(t){e=t}throw e}},L=0,X.prototype.setState=function(e,t){var a;a=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=H({},this.state),"function"==typeof e&&(e=e(H({},a),this.props)),e&&H(a,e),null!=e&&this.__v&&(t&&this._sb.push(t),K(this))},X.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),K(this))},X.prototype.render=Z,D=[],$="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,B=function(e,t){return e.__v.__b-t.__v.__b},Q.__r=0,M=/(PointerCapture)$|Capture$/i,R=0,F=ie(!1),O=ie(!0);const pe=({feedSettings:t,feedItem:a})=>(0,e.createElement)(g.Fragment,null,(0,e.createElement)("div",{className:"instagram-gallery-item__media-mask"}),"BUSINESS"==a?.user_type&&(0,e.createElement)("div",{className:"instagram-gallery-item__media-mask--content"},!!t.mask.likes_count&&(0,e.createElement)("span",{className:"instagram-gallery-item__likes_count--mask"},(0,e.createElement)("i",{className:"qligg-icon-heart instagram-gallery-item__icon-heart"}),a.likes_count||0),!!t.mask.comments_count&&(0,e.createElement)("span",{className:"instagram-gallery-item__comments_count--mask"},(0,e.createElement)("i",{className:"qligg-icon-comment instagram-gallery-item__icon-bubble_chat"}),a.comments_count||0))),ye=({feedItem:t,feedSettings:a})=>{const l="CAROUSEL_ALBUM"===t.media_type&&"VIDEO"===t.media.type,n=null===t.media.url;return(0,e.createElement)("div",{className:"instagram-gallery-item__media-wrap"},n?(0,e.createElement)("img",{alt:"instagram",className:m()("instagram-gallery-item__media"),src:a.copyright.placeholder?a.copyright.placeholder:t.media.thumbnail}):"VIDEO"===t.media_type||l?(0,e.createElement)("video",{alt:"instagram",poster:t.media.thumbnail,className:"instagram-gallery-item__media",src:t.media.url}):(0,e.createElement)("img",{alt:"instagram",className:"instagram-gallery-item__media",src:t.media.url}),a.mask.display&&(0,e.createElement)(pe,{feedItem:t,feedSettings:a}),"VIDEO"===t.media_type&&!n&&(0,e.createElement)("i",{className:"instagram-gallery-item__icon qligg-icon-video instagram-gallery-item__icon--views"}),"CAROUSEL_ALBUM"===t.media_type&&(0,e.createElement)("i",{className:"instagram-gallery-item__icon qligg-icon-gallery instagram-gallery-item__icon--views"}),!!t.share_url&&(0,e.createElement)("a",{className:"instagram-gallery-item__icon qligg-icon-instagram instagram-gallery-item__icon--link",href:t.share_url,target:"_blank",rel:"noreferrer"}))},he=e=>{const t=e.highlight.tag?.split(" ");return t.map(e=>e.includes("#")?e:e.split(" ").map(e=>"#"+e).join(" "))},fe=(e,t)=>{if(!e)return;const a=e.replace(/<[^>]+>/g,"");let l=a;return l=e.match("[぀-ヿ㐀-䶿一-鿿豈-﫿ヲ-゚]")?a.split("",t).join(""):a.split(" ",t).join(" "),l.length<e.length?`${l}...`:l},be=(0,g.memo)(({feedSettings:t,feedItem:a})=>(0,e.createElement)("div",{className:"instagram-gallery-item__media-card"},(0,e.createElement)("div",{className:"instagram-gallery-item__info"},!!a.date&&(0,e.createElement)("span",{className:"instagram-gallery-item__date"},(0,e.createElement)("i",{className:"qligg-icon-date"}),a.date),"BUSINESS"==a?.user_type&&(0,e.createElement)("div",{className:"instagram-gallery-item__icons"},!!t.card.likes_count&&(0,e.createElement)("span",{className:"instagram-gallery-item__likes_count"},(0,e.createElement)("i",{className:"qligg-icon-heart"}),a.likes_count||0),!!t.card.comments_count&&(0,e.createElement)("span",{className:"instagram-gallery-item__comments_count"},(0,e.createElement)("i",{className:"qligg-icon-comment"}),a.comments_count||0))),!!t.card.text_length&&!!a.media_description&&(0,e.createElement)("p",{className:"instagram-gallery-item__media_description"},fe(a.media_description,t.card.text_length)))),Ee=({index:t,length:a,feedSettings:l,feedItem:n,onClick:r})=>{const i=function(e,t,a){if(!["highlight","highlight-square"].includes(e.layout))return!1;if(!e?.highlight)return!1;for(const l in e.highlight){const n=e.highlight[l].split(",").map(e=>e.toString().trim());switch(l){case"position":if(n.includes(a.toString()))return!0;break;case"id":if(n.includes(t.id))return!0;break;case"tag":const l=t.tags?.filter(t=>he(e).includes(t)).length;if(l)return!0}}return!1}(l,n,t),o=function(e){return["carousel","carousel-vertical"].includes(e.layout)}(l),s=!l?.modal?.display&&!!n?.share_url,c=s?"a":"div";return(0,e.createElement)(c,{href:s?n.share_url:void 0,target:s?"_blank":void 0,rel:s?"noopener noreferrer":void 0,className:m()("instagram-gallery-item",o&&"swiper-slide",i&&"instagram-gallery-item--highlight",`instagram-gallery-item--cols-${l.columns}`),"data-elementor-open-lightbox":"no","data-feed-item-index":t,onClick:r,onKeyDown:s?void 0:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),r(e))},tabIndex:s?void 0:0,role:s?void 0:"button","aria-label":(()=>{const e="VIDEO"===n.media_type?"Video":"Image";let t=n.media_description?`: ${n.media_description.replace(/<[^>]*>?/gm,"")}`:"";return t.length>100&&(t=t.substring(0,100)+"..."),`Instagram ${e}${t}`})()},(0,e.createElement)("div",{className:"instagram-gallery-item__wrap"},(0,e.createElement)(ye,{index:t,feedItem:n,length:a,feedSettings:l}),l.card.display&&(0,e.createElement)(be,{feedItem:n,feedSettings:l})))},ve="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMjRweCIgaGVpZ2h0PSIyNHB4IiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWlkWU1pZCBtZWV0IiB2aWV3Qm94PSIwIDAgMjAgMjAiIHN0eWxlPSItbXMtdHJhbnNmb3JtOiByb3RhdGUoMzYwZGVnKTsgLXdlYmtpdC10cmFuc2Zvcm06IHJvdGF0ZSgzNjBkZWcpOyB0cmFuc2Zvcm06IHJvdGF0ZSgzNjBkZWcpOyI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE2IDE3SDJsMy41LTQuNWwyLjUgM2wzLTMuODFBMiAyIDAgMCAxIDEwIDEwVjZIMmEyIDIgMCAwIDAtMiAydjEwYTIgMiAwIDAgMCAyIDJoMTRhMiAyIDAgMCAwIDItMnYtNmgtNS43NXoiLz48cGF0aCBmaWxsPSIjZmZmIiBkPSJNMTkgNGgtLjVWMi41YTIuNSAyLjUgMCAwIDAtNSAwVjRIMTNhMSAxIDAgMCAwLTEgMXY0YTEgMSAwIDAgMCAxIDFoNmExIDEgMCAwIDAgMS0xVjVhMSAxIDAgMCAwLTEtMXptLTMgNGExIDEgMCAxIDEgMS0xYTEgMSAwIDAgMS0xIDF6bTEuNS00aC0zVjIuNzVDMTQuNSAyIDE0LjUgMSAxNiAxczEuNSAxIDEuNSAxLjc1eiIvPjwvc3ZnPgo=",ke=({currentFeedItem:t,feedSettings:a})=>{const l=(0,g.useRef)(null);return(0,e.createElement)("section",{className:"instagram-gallery-modal__media-container insta-gallery-slider-container"},(0,e.createElement)("div",{ref:l,className:"insta-gallery-slider"},t.children.map(t=>(0,e.createElement)("div",{key:t.id,className:"insta-gallery__media"},null===t.media.url?(0,e.createElement)("img",{className:m()("instagram-gallery-modal__media",!a.copyright.placeholder&&"instagram-gallery-modal__media--placeholder"),src:a.copyright.placeholder?a.copyright.placeholder:ve,alt:t.media.alt}):"VIDEO"===t.media.type?(0,e.createElement)("video",{controls:!0,poster:t.media.thumbnail,className:"instagram-gallery-modal__media",src:t.media.url}):(0,e.createElement)("img",{className:"instagram-gallery-modal__media",src:t.media.url,alt:t.media.alt})))),(0,e.createElement)("div",{className:"insta-gallery-slider__button-container"},(0,e.createElement)("span",{onClick:()=>{if(l.current.children.length>0){const e=l.current.children.length-1,t=l.current.children[e];l.current.insertBefore(t,l.current.firstChild),l.current.style.transition="none";const a=l.current.children[0].offsetWidth;l.current.style.transform=`translateX(-${a}px)`,setTimeout(()=>{l.current.style.transition="200ms ease-out all",l.current.style.transform="translateX(0)"},30)}},className:"insta-gallery-slider__button insta-gallery-slider__button--left qligg-icon-prev"}),(0,e.createElement)("span",{onClick:()=>{if(l.current.children.length>0){const e=l.current.children[0];l.current.style.transition="300ms ease-out all";const t=l.current.children[0].offsetWidth;l.current.style.transform=`translateX(-${t}px)`;const a=()=>{l.current.style.transition="none",l.current.style.transform="translateX(0)",l.current.appendChild(e),l.current.removeEventListener("transitionend",a)};l.current.addEventListener("transitionend",a)}},className:"insta-gallery-slider__button insta-gallery-slider__button--right qligg-icon-next"})))},Ce=(0,g.memo)(({currentFeedItem:t,feedSettings:a})=>{var l;const n=!t?.media?.url;switch(t.media_type){case"CAROUSEL_ALBUM":return(0,e.createElement)(ke,{feedSettings:a,currentFeedItem:t});case"VIDEO":return(0,e.createElement)("section",{className:"instagram-gallery-modal__media-container"},n?(0,e.createElement)("img",{src:ve,alt:"thumbnail",className:"instagram-gallery-item__icon qligg-icon-video instagram-gallery-item__icon--views"}):(0,e.createElement)("video",{poster:t.media.thumbnail,src:t.media.url,controls:!0,className:"instagram-gallery-modal__media"}));default:return(0,e.createElement)("section",{className:"instagram-gallery-modal__media-container"},n?(0,e.createElement)("img",{src:null!==(l=t?.media?.thumbnail)&&void 0!==l?l:a?.copyright?.placeholder,className:"instagram-gallery-modal__media"}):(0,e.createElement)("img",{src:t.media.url,className:"instagram-gallery-modal__media"}))}}),xe=({currentFeedItem:t,userProfile:a,feedItemsNumber:l,feedSettings:n})=>{var r,i,o,s;const{currentFeedIndex:c}=b(),[m,d]=(0,g.useState)(5),{comments:u,loading:_,error:p}=(({feedSettings:e,currentFeedItem:t,maxRetries:a=2,retryDelay:l=1500})=>{const[n,r]=(0,g.useState)([]),[i,o]=(0,g.useState)(!1),[s,c]=(0,g.useState)(null);return window?.qligg_frontend?.restRoutePaths.comments,(0,g.useEffect)(()=>{if(!(e?.modal?.comments_list&&"BUSINESS"===t?.user_type&&t?.id&&e?.account_id))return;let n=!0;return(async()=>{o(!0),r([]),c(null);const i=async s=>{try{const a=await async function({account_id:e,media_id:t,limit:a=25}){const l=window?.qligg_frontend?.restRoutePaths.comments,n=C({account_id:e,media_id:t,limit:a}).toString(),r=`${l}${l.includes("?")?"&":"?"}${n}`,i=await k({url:r,method:"GET"}),{data:o}=i;return Array.isArray(o)?o:o&&"object"==typeof o?[o]:[]}({account_id:e.account_id,media_id:t.id});n&&(r(a),o(!1))}catch(e){if(!n)return;s<a?setTimeout(()=>{n&&i(s+1)},l):(c(e),o(!1))}};await i(0)})(),()=>{n=!1}},[t?.id,e?.account_id,a,l]),{comments:n,loading:i,error:s}})({feedSettings:n,currentFeedItem:t}),y=(0,g.useCallback)(e=>new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}),[]),h=(0,g.useCallback)(()=>{d(e=>e+5)},[]),f=u.slice(0,m),E=u.length>m,v="BUSINESS"===t.user_type;return(0,e.createElement)("section",{className:"instagram-gallery-modal__media-sidebar"},n.modal.profile&&a.username&&a.link&&(0,e.createElement)("div",{className:"instagram-gallery-modal__profile"},a.avatar&&(0,e.createElement)("img",{alt:null!==(r=a.nickname)&&void 0!==r?r:a.username,src:a.avatar}),(0,e.createElement)("div",null,(0,e.createElement)("span",null,null!==(i=a.nickname)&&void 0!==i?i:a.username),(0,e.createElement)("a",{href:a.link,title:null!==(o=a.nickname)&&void 0!==o?o:a.username,target:"_blank",rel:"noopener noreferrer","aria-label":`Visit ${null!==(s=a.nickname)&&void 0!==s?s:a.username}'s Instagram profile`},`@${a.username}`))),(0,e.createElement)("div",{className:"instagram-gallery-modal__icons"},(0,e.createElement)("span",{className:"instagram-gallery-modal__counter","aria-live":"polite"},`${c+1} / ${l}`),(0,e.createElement)("a",{className:"instagram-gallery-modal__link",href:t.share_url,target:"_blank",rel:"noopener noreferrer","aria-label":"View on Instagram"},(0,e.createElement)("i",{className:"qligg-icon-instagram","aria-hidden":"true"})," ","Instagram")),n.modal.media_description&&!!t.media_description&&(0,e.createElement)("div",{className:"instagram-gallery-modal__media_description"},(0,e.createElement)("p",{dangerouslySetInnerHTML:{__html:fe(t.media_description,n.modal.text_length)}})),(n.modal.likes_count||n.modal.comments_count)&&v&&(0,e.createElement)("div",{className:"instagram-gallery-modal__info"},n.modal.likes_count&&(0,e.createElement)("span",{className:"instagram-gallery-modal__likes_count"},(0,e.createElement)("i",{className:"qligg-icon-heart","aria-hidden":"true"}),t.likes_count||0),n.modal.comments_count&&(0,e.createElement)("span",{className:"instagram-gallery-modal__comments_count"},(0,e.createElement)("i",{className:"qligg-icon-comment","aria-hidden":"true"}),t.comments_count||0)),n.modal.comments_list&&v&&(0,e.createElement)("div",{className:"instagram-gallery-modal__comments-list"},(0,e.createElement)("p",null,(0,e.createElement)("b",null,"Comments")),_?(0,e.createElement)("p",{"aria-live":"polite"},"Loading comments..."):p?(0,e.createElement)("p",{className:"instagram-gallery-modal__error","aria-live":"assertive"},"Unable to load comments. Please try again later."):f.length>0?(0,e.createElement)(g.Fragment,null,(0,e.createElement)("ul",null,f.map(t=>(0,e.createElement)("li",{key:t.id,className:"instagram-gallery-modal__comment"},(0,e.createElement)("div",{className:"instagram-gallery-modal__comment-header"},(0,e.createElement)("strong",null,t.username),(0,e.createElement)("span",{className:"instagram-gallery-modal__comment-time"},y(t.timestamp))),(0,e.createElement)("p",null,t.text),t.replies&&t.replies.length>0&&(0,e.createElement)("ul",{className:"instagram-gallery-modal__comment-replies"},t.replies.map(t=>(0,e.createElement)("li",{key:t.id,className:"instagram-gallery-modal__comment-reply"},(0,e.createElement)("div",{className:"instagram-gallery-modal__comment-header"},(0,e.createElement)("strong",null,t.username),(0,e.createElement)("span",{className:"instagram-gallery-modal__comment-time"},y(t.timestamp))),(0,e.createElement)("p",null,t.text))))))),E&&(0,e.createElement)("button",{className:"instagram-gallery-modal__load-more",onClick:h,"aria-label":"Load more comments"},"Load more comments")):(0,e.createElement)("div",null,(0,e.createElement)("p",null,"No comments available for this post."),window.qligg_frontend&&window.qligg_frontend.QLIGG_DEVELOPER&&(0,e.createElement)("p",null,"Comment count in feed item:"," ",t.comments_count))))},we=({isPrevious:t,classname:a,onClick:l,...n})=>(0,e.createElement)("span",{className:m()("instagram-gallery-modal__button-arrow",a,t&&"qligg-icon-prev",!t&&"qligg-icon-next"),onClick:l,onKeyPress:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),l(e))},role:"button",tabIndex:"0",...n}),Ne=({onClick:t,...a})=>(0,e.createElement)("span",{className:"instagram-gallery-modal__button-close",onClick:t,onKeyPress:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t(e))},role:"button",...a}),Se=({children:t,id:a})=>{const{isOpen:l,setIsOpen:n}=b();return l?(0,e.createElement)("div",{className:"instagram-gallery-modal__overlay",id:a,onClick:()=>n(!1),onKeyDown:e=>{"Escape"===e.key&&n(!1)},role:"dialog","aria-modal":"true",tabIndex:"-1"},t):null},Ie=({feedItems:t,feedSettings:a,userProfile:l})=>{const{currentFeedIndex:n,setCurrentFeedIndex:r}=b(),{setIsOpen:i,isOpen:o}=b(),s=(0,g.useRef)(null),[c,d]=(0,g.useState)(t[n]),u=!!t[n-1]||t.length>1,_=!!t[n+1]||t.length>1,p=(0,g.useCallback)(()=>{u&&(t[n-1]?r(n-1):r(t.length-1))},[n,t,u,r]),y=(0,g.useCallback)(()=>{_&&(t[n+1]?r(n+1):r(0))},[n,t,_,r]),h=(0,g.useCallback)(e=>{"ArrowLeft"===e.key?p():"ArrowRight"===e.key?y():"Escape"===e.key&&i(!1)},[p,y,i]);return(0,g.useEffect)(()=>{d(t[n])},[n,t]),(0,g.useEffect)(()=>(document.addEventListener("keydown",h),s.current&&s.current.focus(),o&&(document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",h),document.body.style.overflow=""}),[h,o]),(0,e.createElement)(Se,{id:`instagram-gallery-modal-${a.id}`},(0,e.createElement)("div",{className:"instagram-gallery-modal",onClick:e=>e.stopPropagation(),ref:s,tabIndex:"-1","aria-modal":"true",role:"dialog","aria-label":"Instagram media viewer"},(0,e.createElement)("div",{className:"instagram-gallery-modal__options"},(0,e.createElement)("div",{className:"instagram-gallery-modal__options--arrows"},(0,e.createElement)(we,{isPrevious:!0,onClick:e=>{e.stopPropagation(),p()},"aria-label":"Previous image",tabIndex:"0"}),(0,e.createElement)(we,{next:!0,onClick:e=>{e.stopPropagation(),y()},"aria-label":"Next image",tabIndex:"0"})),(0,e.createElement)(Ne,{onClick:()=>i(!1),"aria-label":"Close modal",tabIndex:"0"})),(0,e.createElement)("section",{className:m()("instagram-gallery-modal__body","right"!==a.modal.modal_align&&`instagram-gallery-modal__body--sidebar-${a.modal.modal_align}`)},(0,e.createElement)(Ce,{feedSettings:a,currentFeedItem:c}),(0,e.createElement)(xe,{feedSettings:a,currentFeedItem:c,userProfile:l,feedItemsNumber:t.length}))))},qe=(e,t,a="")=>null==t||""===t?"":`${e}: ${t}${a};`,Pe=(0,g.forwardRef)((Te=t=>{const a=t.target.parentNode,{masonryRef:l,userMediaList:n,feedSettings:r,className:i,userProfile:o}=t,{currentFeedIndex:s,setCurrentFeedIndex:c}=b(),{setIsOpen:d}=b(),u=!!r?.modal?.display;return(0,e.createElement)(g.Fragment,null,(0,e.createElement)("div",{ref:l,className:m()("instagram-gallery-list",i),"data-feed_layout":r.layout},n.data.map((t,a)=>{const l=n.data.length;return(0,e.createElement)(Ee,{key:t.id,index:a,length:l,feedItem:t,feedSettings:r,onClick:()=>{u&&(c(a),d(!0))}})})),u&&(0,g.createPortal)((0,e.createElement)(Ie,{userProfile:o,feedSettings:r,currentFeedIndex:s,feedItems:n.data}),a))},(t,a)=>{const{feedSettings:l}=t,n=l.responsive||{desktop:{columns:l.columns||3,spacing:l.spacing||10},tablet:{columns:2,spacing:8},mobile:{columns:1,spacing:6},breakpoints:{tablet:768,mobile:480}},r=n.breakpoints?.tablet||768,i=n.breakpoints?.mobile||480,o=!!l.box?.display,s=!!l.card?.display,c="carousel"===l.layout,m=!!l.mask?.display,d=!!l.button?.display,u=!!l.button_load?.display,_=`instagram-gallery-feed-${l.id}`,p=`instagram-gallery-modal-${l.id}`;return(0,e.createElement)(g.Fragment,null,(0,e.createElement)("style",null,`\n\t\t\t\t\t#${p} {\n\t\t\t\t\t\t${qe("--qligg-modal-text-align",l.modal?.text_align||"left")}\n\t\t\t\t\t\t${qe("--qligg-modal-font-size",l.modal?.font_size||14,"px")}\n\t\t\t\t\t\t--qligg-modal-body-height: 75vh;\n\t\t\t\t\t\t--qligg-modal-body-width: 75vw;\n\t\t\t\t\t\t--qligg-modal-sidebar-width: 360px;\n\t\t\t\t\t\t--qligg-modal-button-size: 40px;\n\t\t\t\t\t\t--qligg-modal-comments-height: 400px;\n\t\t\t\t\t\t--qligg-modal-border-color: #eeeeee;\n\t\t\t\t\t\t--qligg-modal-border-color-dark: #dddddd;\n\t\t\t\t\t\t--qligg-modal-button-border: #efefef;\n\t\t\t\t\t\t--qligg-modal-button-hover: #fafafa;\n\t\t\t\t\t\t--qligg-modal-error-color: #e74c3c;\n\t\t\t\t\t}\n\t\t\t\t`),(0,e.createElement)("style",null,`\n\t\t\t\t\t\t#${_} {\n\t\t\t\t\t\t\t--qligg-columns: ${n.desktop?.columns||3};\n\t\t\t\t\t\t\t--qligg-spacing: ${n.desktop?.spacing||10}px;\n\t\t\t\t\t\t\t--qligg-item-width: calc(100% / var(--qligg-columns));\n\t\t\t\t\t\t\t--qligg-aspect-ratio: ${l.aspect_ratio?.width||1} / ${l.aspect_ratio?.height||1};\n\t\t\t\t\t\t\t${o?qe("--qligg-box-bg",l.box.background):""}\n\t\t\t\t\t\t\t${o?qe("--qligg-box-color",l.box.text_color):""}\n\t\t\t\t\t\t\t${o?qe("--qligg-box-radius",l.box.radius,"px"):""}\n\t\t\t\t\t\t\t${o?qe("--qligg-box-padding",l.box.padding,"px"):""}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t/* Feed card settings */\n\t\t\t\t\t\t\t${s?qe("--qligg-card-bg",l.card.background):""}\n\t\t\t\t\t\t\t${s?qe("--qligg-card-bg-hover",l.card.background_hover):""}\n\t\t\t\t\t\t\t${s?qe("--qligg-card-color",l.card.text_color):""}\n\t\t\t\t\t\t\t${s?qe("--qligg-card-font-size",l.card.font_size,"px"):""}\n\t\t\t\t\t\t\t${s?qe("--qligg-card-padding",l.card.padding,"px"):""}\n\t\t\t\t\t\t\t${s?qe("--qligg-card-radius",l.card.radius,"px"):""}\n\t\t\t\t\t\t\t${s&&l.card.boxed?qe("--qligg-card-boxed","1px solid #f5f5f5"):""}\n\t\t\t\t\t\t\t${s&&l.card.boxed?qe("--qligg-card-shadow","0 1px 3px rgba(0,0,0,0.05)"):""}\n\t\t\t\t\t\t\t${s&&l.card.boxed?qe("--qligg-card-shadow-hover","0 3px 10px rgba(0,0,0,0.06)"):""}\n\t\t\t\t\t\t\t${s?qe("--qligg-card-text-align",l.card.text_align||"left"):""}\n\t\t\t\t\t\t\t${m?qe("--qligg-mask-bg",l.mask.background):""}\n\t\t\t\t\t\t\t${m?qe("--qligg-mask-icon-color",l.mask.icon_color||"#ffffff"):""}\n\t\t\t\t\t\t\t${c?qe("--qligg-carousel-arrow-color",l.carousel.navarrows_color):""}\n\t\t\t\t\t\t\t${c?qe("--qligg-carousel-pagination-color",l.carousel.pagination_color):""}\n\t\t\t\t\t\t\t${d?qe("--qligg-button-color",l.button.text_color):""}\n\t\t\t\t\t\t\t${d?qe("--qligg-button-bg",l.button.background):""}\n\t\t\t\t\t\t\t${d?qe("--qligg-button-bg-hover",l.button.background_hover):""}\n\t\t\t\t\t\t\t${u?qe("--qligg-load-button-color",l.button_load.text_color):""}\n\t\t\t\t\t\t\t${u?qe("--qligg-load-button-bg",l.button_load.background):""}\n\t\t\t\t\t\t\t${u?qe("--qligg-load-button-bg-hover",l.button_load.background_hover):""}\n\t\t\t\t\t\t}\n\t\t\t\t\t`),(0,e.createElement)("style",null,`\n\t\t\t\t\t\t@media (max-width: ${r}px) {\n\t\t\t\t\t\t\t#${_} {\n\t\t\t\t\t\t\t\t--qligg-columns: ${n.tablet?.columns||2};\n\t\t\t\t\t\t\t\t--qligg-spacing: ${n.tablet?.spacing||8}px;\n\t\t\t\t\t\t\t\t--qligg-mask-icon-size: 26px;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t#${p} {\n\t\t\t\t\t\t\t\t--qligg-modal-body-height: 80vh;\n\t\t\t\t\t\t\t\t--qligg-modal-body-width: 80vw;\n\t\t\t\t\t\t\t\t--qligg-modal-sidebar-width: 100%;\n\t\t\t\t\t\t\t\t--qligg-modal-button-size: 36px;\n\t\t\t\t\t\t\t\t--qligg-modal-comments-height: 250px;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t#${p} .instagram-gallery-modal__body {\n\t\t\t\t\t\t\t\tflex-direction: column;\n\t\t\t\t\t\t\t\toverflow-x: hidden;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t#${p} .instagram-gallery-modal__media-sidebar {\n\t\t\t\t\t\t\t\tmax-height: 40vh;\n\t\t\t\t\t\t\t\tborder-left: none;\n\t\t\t\t\t\t\t\tborder-top: 1px solid #f5f5f5;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t#${p} .instagram-gallery-modal__media-container {\n\t\t\t\t\t\t\t\twidth: 100%;\n\t\t\t\t\t\t\t\toverflow: visible;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t#${p} .instagram-gallery-modal__button-close:before, \n\t\t\t\t\t\t\t#${p} .instagram-gallery-modal__button-close:after {\n\t\t\t\t\t\t\t\twidth: 18px;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t`),(0,e.createElement)("style",null,`\n\t\t\t\t\t\t@media (max-width: ${i}px) {\n\t\t\t\t\t\t\t#${_} {\n\t\t\t\t\t\t\t\t--qligg-columns: ${n.mobile?.columns||1};\n\t\t\t\t\t\t\t\t--qligg-spacing: ${n.mobile?.spacing||6}px;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t#${p} {\n\t\t\t\t\t\t\t\t--qligg-modal-body-height: 85vh;\n\t\t\t\t\t\t\t\t--qligg-modal-body-width: 90vw;\n\t\t\t\t\t\t\t\t--qligg-modal-sidebar-width: 100%;\n\t\t\t\t\t\t\t\t--qligg-modal-button-size: 32px;\n\t\t\t\t\t\t\t\t--qligg-modal-comments-height: 200px;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t#${p} .instagram-gallery-modal__button-arrow {\n\t\t\t\t\t\t\t\tposition: relative;\n\t\t\t\t\t\t\t\tfont-size: 1rem;\n\t\t\t\t\t\t\t\ttop: auto;\n\t\t\t\t\t\t\t\tleft: auto;\n\t\t\t\t\t\t\t\tright: auto;\n\t\t\t\t\t\t\t\tbottom: auto;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t`),(0,e.createElement)(Te,{...t,forwardRef:a}))}));var Te;const Le=t=>{const{target:a,userMediaList:l,feedSettings:n,calculateWidth:r}=t,[i,o]=(0,g.useState)(!0),{isImageLoad:s}=b(),c=(0,g.useRef)(null),m=(0,g.useRef)(null),d=(0,g.useRef)(new Set),u=(0,g.useRef)(0),_=(0,g.useCallback)(()=>{m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{c.current&&c.current.layout()},100)},[]),p=(0,g.useCallback)(e=>{d.current.add(e),_(),d.current.size>=u.current&&u.current>0&&(o(!1),a.classList.add("loaded"))},[_,a]),y=function(e,t){const a=(0,g.useRef)();return(0,g.useCallback)(t=>{t?a.current=e(t):a.current&&a.current()},t)}(e=>{const{ownerDocument:t}=e,{defaultView:l}=t;if(!l.Masonry)return;const i={itemSelector:".instagram-gallery-item",isResizable:!0,isAnimated:!1,transitionDuration:0,percentPosition:!0,gutter:0};i.columnWidth=r&&"function"==typeof r?r(e,n):".instagram-gallery-item";const s=new l.Masonry(e,i);c.current=s;const g=e.querySelectorAll(".instagram-gallery-item__media");u.current=g.length,d.current.clear(),g.forEach((e,t)=>{const a=`media-${t}`,l=()=>{p(a),e.removeEventListener("load",l),e.removeEventListener("loadeddata",l),e.removeEventListener("canplay",l),e.removeEventListener("error",l)};"IMG"===e.tagName?e.complete&&0!==e.naturalWidth?p(a):(e.addEventListener("load",l),e.addEventListener("error",l)):"VIDEO"===e.tagName&&(e.readyState>=3?p(a):(e.addEventListener("loadeddata",l),e.addEventListener("canplay",l),e.addEventListener("error",l)))}),0===u.current&&(o(!1),a.classList.add("loaded"));const y=new l.MutationObserver(e=>{let t=!1;e.forEach(e=>{"childList"===e.type&&e.addedNodes.length>0&&(t=!0)}),t&&_()}),h=e.querySelector(".instagram-gallery-item__wrap")||e;return y.observe(h,{childList:!0,subtree:!0}),setTimeout(()=>{s.layout()},50),()=>{m.current&&clearTimeout(m.current),y.disconnect(),s.destroy(),c.current=null}},[l,p,_,a,r,n]);return(0,e.createElement)(g.Fragment,null,i&&(0,e.createElement)(S,null),(0,e.createElement)(Pe,{...t,masonryRef:y}))},De=t=>{const{userMediaList:a,feedSettings:l}=t,{setCurrentFeedIndex:n}=b(),{setIsOpen:r}=b(),i=(0,g.useCallback)(e=>{if(e){const{defaultView:t}=document;if(!t.Swiper)return;new t.Swiper(e,{slideClass:"instagram-gallery-item",loop:!0,loopedSlidesLimit:!1,centeredSlides:l.carousel.centered_slides,allowTouchMove:!1,slidesPerView:l.responsive?.desktop?.columns||l.carousel.slidespv||l.columns||3,spaceBetween:l.responsive?.desktop?.spacing||l.spacing||10,autoplay:l.carousel.autoplay&&{delay:l.carousel.autoplay_interval},pagination:{el:e.querySelector(".swiper-pagination"),dynamicBullets:!0,clickable:!0,type:"bullets"},navigation:{nextEl:e.querySelector(".swiper-button-next"),prevEl:e.querySelector(".swiper-button-prev")},breakpoints:{0:{slidesPerView:l.responsive?.mobile?.columns||1,spaceBetween:l.responsive?.mobile?.spacing||6},[l.responsive?.breakpoints?.mobile||480]:{slidesPerView:l.responsive?.tablet?.columns||2,spaceBetween:l.responsive?.tablet?.spacing||8},[l.responsive?.breakpoints?.tablet||768]:{slidesPerView:l.responsive?.desktop?.columns||3,spaceBetween:l.responsive?.desktop?.spacing||10}}});const a=()=>{e.addEventListener("click",e=>{(e.target.classList.contains(".swiper-slide-duplicate")||e.target.closest(".swiper-slide-duplicate"))&&(r(!0),n(Number(e.target.closest(".swiper-slide-duplicate").dataset.feedItemIndex)))})};a()}},[a,l]);return(0,e.createElement)("div",{ref:i,className:"swiper-container"},(0,e.createElement)(Pe,{className:"swiper-wrapper instagram-gallery-square",...t}),l.carousel.pagination&&(0,e.createElement)("div",{className:"swiper-pagination"}),l.carousel.navarrows&&(0,e.createElement)(g.Fragment,null,(0,e.createElement)("div",{tabIndex:"1",className:"swiper-button-prev"}),(0,e.createElement)("div",{tabIndex:"1",className:"swiper-button-next"})))},Ae=t=>{const a=(0,g.useRef)();return(0,e.createElement)(Pe,{ref:a,className:"instagram-gallery-square",...t})},$e=t=>{const{feedSettings:a}=t,{layout:l}=a;switch(l){case"masonry":case"highlight":return(0,e.createElement)(Le,{...t});case"carousel":return(0,e.createElement)(De,{...t});default:return(0,e.createElement)(Ae,{...t})}},Be=t=>{const{target:a,feedSettings:l}=t,{isLoading:n,userProfile:r,error:i}=(e=>{const{account_id:t}=e,[a,l]=(0,g.useState)(!0),[n,r]=(0,g.useState)(null),[i,o]=(0,g.useState)(null);return(0,g.useEffect)(()=>{(async()=>{l(!0);try{const t=await async function(e){const t=window?.qligg_frontend?.restRoutePaths.userprofile,a=C({account_id:e.account_id}).toString(),l=`${t}${t.includes("?")?"&":"?"}${a}`;return await k({url:l,method:"GET"})}(e);r(t),l(!1)}catch(e){l(!1),o(e)}})()},[t]),{isLoading:a,userProfile:n,error:i}})(l),{isLoading:o,isLoadingMore:s,userMediaList:c,error:m,setAfter:d}=(e=>{const{source:t,limit:a,account_id:l,tag:n,order_by:r,copyright:i,reel:o}=e,{counter:s}=b(),[c,m]=(0,g.useState)(!0),[d,u]=(0,g.useState)(!1),[_,p]=(0,g.useState)({paging:{next:null,prev:null},data:[]}),[y,h]=(0,g.useState)(""),[f,E]=(0,g.useState)(null);return(0,g.useEffect)(()=>{E(null),(async()=>{0===s?m(!0):u(!0);try{const t=await async function(e,t="",a=0){const l=e?.account_id,n=e?.limit,r=e?.copyright?.hide,i=e?.reel?.hide,o=e?.order_by,s=e?.tag,c=e?.source,m=window?.qligg_frontend?.restRoutePaths?.[c];if(!m)throw new Error(`Unknown source: ${c}`);const g=C({account_id:l,limit:n,hide_items_with_copyright:r,hide_reels:i,after:t,pagination:a,order_by:o,tag:s}).toString(),d=`${m}${m.includes("?")?"&":"?"}${g}`;return await k({url:d,method:"GET"})}(e,y,s);p(0===s?{paging:t?.paging,data:t?.data}:{paging:t?.paging,data:[..._?.data,...t?.data]}),m(!1),u(!1)}catch(e){m(!1),u(!1),E(e)}})()},[a,r,l,t,n,i?.hide,o?.hide,s]),{isLoading:c,isLoadingMore:d,userMediaList:_,error:f,setAfter:h}})(l),u=n||o,_=i||m,{counter:p,setCounter:y}=b();return(0,g.useEffect)(()=>{u||["masonry","highlight"].includes(l.layout)||a.classList.add("loaded")},[u]),u?(0,e.createElement)(S,null):_?(0,e.createElement)(I,{errorUserProfile:i,errorUserMediaList:m}):(0,e.createElement)(g.Fragment,null,!!l?.profile?.display&&(0,e.createElement)(q,{feedSettings:l,userProfile:r}),(0,e.createElement)($e,{target:a,feedSettings:l,userMediaList:c,userProfile:r}),s&&(0,e.createElement)(S,null),(0,e.createElement)(N,{userProfile:r,feedSettings:l,onClick:e=>{e.preventDefault(),d(c.paging.next),y(p+1)},after:c?.paging?.next}))},Me=t=>{const{attributes:a,setAttributes:l}=t,i=(0,g.useRef)(null),[o,s]=(0,g.useState)(!1),[c,m]=(0,g.useState)("desktop"),d=(0,n.useBlockProps)({className:"qligg-box-editor"}),u=(0,r.useInstanceId)(Me,"qligg");return(0,g.useEffect)(()=>{l({id:u})},[u,l]),(0,g.useEffect)(()=>{i.current&&!o&&s(!0)},[i.current]),(0,g.useEffect)(()=>{const e=()=>{const e=document.querySelector(".edit-post-visual-editor");e&&(e.classList.contains("is-mobile-preview")?m("mobile"):e.classList.contains("is-tablet-preview")?m("tablet"):m("desktop"))};e();const t=document.querySelector(".edit-post-visual-editor");if(t){const a=new MutationObserver(e);return a.observe(t,{attributes:!0,attributeFilter:["class"]}),()=>a.disconnect()}},[]),(0,e.createElement)("div",{...d},(0,e.createElement)("div",{className:"instagram-gallery-feed",ref:i,id:`instagram-gallery-feed-${u}`,"data-view-mode":c},o&&(0,e.createElement)(v,null,(0,e.createElement)(Be,{target:i.current,feedSettings:a}))))},Re=(0,g.forwardRef)(Me),Fe=({title:t,show:a,onClose:l,children:n,className:r,__experimentalHideHeader:i=!1})=>{const o=(0,g.useRef)();return(0,g.useEffect)(()=>{const e=e=>{a&&o?.current&&o.current===e.target&&l(e)};return o?.current?.addEventListener("click",e),()=>{o?.current?.removeEventListener("click",e)}},[o,a]),a?(0,e.createElement)(d.Modal,{ref:o,title:t,onRequestClose:l,shouldCloseOnClickOutside:!1,className:m()("insta-gallery__modal media-modal wp-core-ui upload-php",r),__experimentalHideHeader:i},n):null},Oe=a=>{const{href:l,target:n="_self",title:r,children:i,className:o,alert:s}=a,[c,u]=(0,g.useState)(!1),_=()=>{u(!1)};return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("a",{href:l,className:m()("insta-gallery__account-button",o),target:n,title:r,onClick:e=>{e.preventDefault(),u(!0)}},i),(0,e.createElement)(Fe,{show:c,className:"insta-gallery__modal--confirm",onClose:_,title:r},(0,e.createElement)("div",{className:"insta-gallery__modal-content"},(0,e.createElement)("p",null,s),(0,e.createElement)("div",{className:"insta-gallery__modal-actions"},(0,e.createElement)(d.Button,{variant:"secondary",onClick:_},(0,t.__)("Cancel","insta-gallery")),(0,e.createElement)(d.Button,{variant:"primary",onClick:()=>{u(!1),window.open(l,n)}},(0,t.__)("Continue","insta-gallery"))))))},{QLIGG_PERSONAL_LINK:Ue,QLIGG_BUSSINESS_LINK:ze}="undefined"!=typeof qligg_gutenberg?qligg_gutenberg:{},We=()=>(0,e.createElement)(d.Placeholder,{label:(0,t.__)("Please create access token","insta-gallery"),instructions:(0,t.__)("Before you start creating feeds, you have to create an access token. Please go to the account tab to connect your Instagram account and then reload this page.","insta-gallery")},(0,e.createElement)(e.Fragment,null,(0,e.createElement)("p",null,(0,e.createElement)(Oe,{href:Ue||"#",target:"_blank",title:(0,t.__)("Add Personal Account","insta-gallery")},(0,t.__)("Add Personal Account","insta-gallery")),(0,e.createElement)(Oe,{className:"qligg-premium-field",href:ze||"#",target:"_blank",title:(0,t.__)("Add Professional Account","insta-gallery")},(0,t.__)("Add Professional Account","insta-gallery"))))),je=({attributes:a,setAttributes:l,accounts:n})=>(0,e.createElement)(d.Placeholder,{label:(0,t.__)("Please select account","insta-gallery"),instructions:(0,t.__)("Before you start creating feeds, you have to select your Instagram account.","insta-gallery")},(0,e.createElement)("p",null,(0,e.createElement)(d.RadioControl,{selected:a.account_id,onChange:e=>l({account_id:e}),options:n.map(e=>({value:e.id,label:e.nickname||e.username}))}))),{U:He}={U:"qligg/box"};(0,l.registerBlockType)(He,{title:(0,t.__)("Instagram Feed","insta-gallery"),description:(0,t.__)("Display beautiful, responsive galleries from your Instagram feed on your website.","insta-gallery"),icon:"instagram",keywords:["qligg","instagram","gallery","social","feed","quadlayers","Social Feed Gallery"],edit:a=>{const{attributes:l}=a,{accounts:n,hasResolvedAccounts:r}=(0,s.useAccountsEntities)();return r?n&&0!==n.length?n?.find(e=>e.id===l.account_id)?(0,e.createElement)(e.Fragment,null,(0,e.createElement)(h,{...a}),(0,e.createElement)(Re,{...a})):(0,e.createElement)(je,{...a,accounts:n}):(0,e.createElement)(We,{...a}):(0,e.createElement)("p",null,(0,e.createElement)("span",{style:{visibility:"visible"},className:"spinner"}),(0,t.__)("Loading…","insta-gallery"))},save:()=>(0,e.createElement)(n.InnerBlocks.Content,null)})})()})();