1"use strict";(self.webpackChunkcalendy=self.webpackChunkcalendy||[]).push([[6975],{7498:function(e,t,a){var s=a(74848),l=a(96540),n=a(49612);t.A=()=>{const e=(0,l.useRef)((0,n.A)()).current;return(0,s.jsxs)("svg",{className:"canva-logo",viewBox:"0 0 1900 1900",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,s.jsx)("circle",{cx:"950",cy:"950",r:"950",fill:"#7D2AE7"}),(0,s.jsx)("circle",{cx:"950",cy:"950",r:"950",fill:`url(#${e}_paint0_radial)`}),(0,s.jsx)("circle",{cx:"950",cy:"950",r:"950",fill:`url(#${e}_paint1_radial)`}),(0,s.jsx)("circle",{cx:"950",cy:"950",r:"950",fill:`url(#${e}_paint2_radial)`}),(0,s.jsx)("circle",{cx:"950",cy:"950",r:"950",fill:`url(#${e}_paint3_radial)`}),(0,s.jsx)("path",{d:"M1360.14 1144.88C1352.3 1144.88 1345.4 1151.5 1338.22 1165.96C1257.14 1330.37 1117.1 1446.7 955.046 1446.7C767.666 1446.7 651.627 1277.55 651.627 1043.87C651.627 648.036 872.175 419.173 1065.89 419.173C1156.41 419.173 1211.69 476.058 1211.69 566.583C1211.69 674.022 1150.65 730.907 1150.65 768.799C1150.65 785.808 1161.23 796.107 1182.21 796.107C1266.5 796.107 1365.43 699.252 1365.43 562.425C1365.43 429.756 1249.96 332.239 1056.25 332.239C736.105 332.239 451.585 629.043 451.585 1039.71C451.585 1357.59 633.107 1567.65 913.186 1567.65C1210.46 1567.65 1382.35 1271.88 1382.35 1175.88C1382.35 1154.62 1371.48 1144.88 1360.14 1144.88Z",fill:"white"}),(0,s.jsxs)("defs",{children:[(0,s.jsxs)("radialGradient",{id:`${e}_paint0_radial`,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(367 1684) rotate(-49.4156) scale(1469.49)",children:[(0,s.jsx)("stop",{stopColor:"#6420FF"}),(0,s.jsx)("stop",{offset:"1",stopColor:"#6420FF",stopOpacity:"0"})]}),(0,s.jsxs)("radialGradient",{id:`${e}_paint1_radial`,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(503 216) rotate(54.7035) scale(1657.12)",children:[(0,s.jsx)("stop",{stopColor:"#00C4CC"}),(0,s.jsx)("stop",{offset:"1",stopColor:"#00C4CC",stopOpacity:"0"})]}),(0,s.jsxs)("radialGradient",{id:`${e}_paint2_radial`,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(367 1684) rotate(-45.1954) scale(1451.7 667.656)",children:[(0,s.jsx)("stop",{stopColor:"#6420FF"}),(0,s.jsx)("stop",{offset:"1",stopColor:"#6420FF",stopOpacity:"0"})]}),(0,s.jsxs)("radialGradient",{id:`${e}_paint3_radial`,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(777 256) rotate(66.5198) scale(1495.86 2505.9)",children:[(0,s.jsx)("stop",{stopColor:"#00C4CC",stopOpacity:"0.725916"}),(0,s.jsx)("stop",{offset:"0.0001",stopColor:"#00C4CC"}),(0,s.jsx)("stop",{offset:"1",stopColor:"#00C4CC",stopOpacity:"0"})]})]})]})}},10526:function(e,t,a){a.d(t,{A:function(){return v}});var s=a(74848),l=a(96540);const n={};var o=(e,t)=>{const[a,s]=(0,l.useState)(()=>!e||t?.shouldPreventLoad?"idle":"undefined"===typeof window?"loading":n[e]??"loading");return(0,l.useEffect)(()=>{if(!e||t?.shouldPreventLoad)return;const a=n[e];if("ready"===a||"error"===a)return void s(a);const l=(e=>{const t=document.querySelector(`script[src="${e}"], script[data-src="${e}"]`),a=t?.getAttribute("data-status");return{node:t,status:a}})(e);let o=l.node;if(o)s(l.status??a??"loading");else{o=document.createElement("script"),o.src=e,o.async=!0,o.setAttribute("data-status","loading"),o.setAttribute("data-src",e),document.body.appendChild(o);const t=e=>{const t="load"===e.type?"ready":"error";o?.setAttribute("data-status",t)};o.addEventListener("load",t),o.addEventListener("error",t)}const r=t=>{const a="load"===t.type?"ready":"error";s(a),n[e]=a};return o?.addEventListener("load",r),o?.addEventListener("error",r),()=>{o&&(o.removeEventListener("load",r),o.removeEventListener("error",r)),o&&t?.removeOnUnmount&&o.remove()}},[e,t?.shouldPreventLoad,t?.removeOnUnmount]),a},r=a(82726);var i=({clientId:e})=>{const t=(0,l.useRef)(),[a,s]=(0,l.useState)(!1),n=["https://www.googleapis.com/auth/drive.readonly"],i=(0,l.useRef)(),c=(0,l.useRef)(),d=o("https://accounts.google.com/gsi/client",{removeOnUnmount:!1}),m=o("https://apis.google.com/js/api.js",{removeOnUnmount:!1});(0,l.useEffect)(()=>{"ready"!==d||"ready"!==m||a||h()},[d,m,a]);const u=(0,l.useCallback)(()=>s(!0),[]),p=(0,l.useCallback)(async()=>{await gapi.client.init({discoveryDocs:["https://www.googleapis.com/discovery/v1/apis/drive/v3/rest"]})},[]),h=(0,l.useCallback)(()=>{window.gapi.load("auth"),window.gapi.load("client",{callback:p}),window.gapi.load("picker",{callback:u})},[u]),g=(0,l.useCallback)(({token:e,appId:t="",viewId:a="DOCS",disabled:s,multiselect:l,setOrigin:n,showUploadView:o=!1,showUploadFolders:r,setParentFolder:i="",viewMimeTypes:d,customViews:m,locale:u="en",maxItems:p,selectableMimeTypes:h,setIncludeFolders:g,setSelectFolderEnabled:x,disableDefaultView:v=!1,callbackFunction:b})=>{if(s)return!1;const f=new google.picker.DocsView(google.picker.ViewId[a||"DOCS_IMAGES"]);d&&f.setMimeTypes(d),g&&f.setIncludeFolders(!0),x&&f.setSelectFolderEnabled(!0);const j=new google.picker.DocsUploadView;d&&j.setMimeTypes(d),r&&j.setIncludeFolders(!0),i&&j.setParent(i),i&&f.setParent(i);const y=(new google.picker.PickerBuilder).setAppId(t).setOAuthToken(e).setLocale(u).setCallback(b);n&&y.setOrigin(n),v||y.addView(f),m&&m.map(e=>
1y.addView(e)),l&&y.enableFeature(google.picker.Feature.MULTISELECT_ENABLED),o&&y.addView(j),p&&y.setMaxItems(p),h&&y.setSelectableMimeTypes(h);const C=y.build();return c.current=C,C.setVisible(!0),!0},[]),x=(0,l.useCallback)(a=>{if(!window.google)return void alert("Google Drive couldn't load. Please disable your ad blocker if applicable, or contact us.");window.google.accounts.oauth2.initTokenClient({client_id:e,scope:(a.customScopes?[...n,...a.customScopes]:n).join(" "),callback:e=>{t.current=e,g({...a,token:e.access_token}),v(a)}}).requestAccessToken()},[g,e]),v=(0,l.useCallback)(e=>{i.current&&clearTimeout(i.current);const a=(t.current.expires_in||3600)-900;i.current=setTimeout(()=>{c.current&&c.current.isVisible()&&(alert("The Google Drive file picker is open for more than 1 hour and will need to re-authenticate to prevent loosing access."),r.ajax({type:"GET",url:`https://accounts.google.com/o/oauth2/revoke?token=${t.current.access_token}`,async:!1,contentType:"application/x-www-form-urlencoded",success:function(){c.current.setVisible(!1),c.current.dispose(),x(e)},error:function(e){console.log("Error revoking google oauth token: ",e)}}))},1e3*a)},[x]);return{openPicker:x,authResponse:t,tokenMonitoringTimeout:i}},c=a(15734),d=a.n(c),m=a(64351);a(74626)(d());const u={video:"DOCS_VIDEOS",image:"DOCS_IMAGES",document:"PDFS"},p={video:["video/mp4","video/m4v","video/quicktime","video/x-msvideo","video/x-ms-wmv","video/3gpp","video/MP2T","application/x-mpegURL","video/x-flv"],image:["image/jpeg","image/png","image/gif"],document:["application/pdf"]};var h=({source:e,calendarId:t,googleDrivePickerEnv:a,maxItems:s=10,fileType:n="image",setErrors:o,onValidate:r,onClearFailed:c,onOpen:h,onUploadCallback:g})=>{const{openPicker:x,authResponse:v,tokenMonitoringTimeout:b}=i({clientId:a.client_id}),[f,j]=(0,l.useState)(!1),y=(0,l.useCallback)((e,t)=>{const a=r((0,m.IG)(e));if(a.hasErrors){const t=a.errors.map(e=>e.message).join(", ");o(a=>[...a,`${e.name}: ${t}`])}else t(e)},[r,o,m.IG]),C=(0,l.useCallback)(a=>{if("loaded"!==a.action&&b.current&&clearTimeout(b.current),!f&&"picked"===a.action){j(!0);const s=a.docs;let l=[];s.forEach(e=>{y(e,e=>{l.push({file_id:e.id,token:v.current.access_token,meta:{type:e.type,file_name:e.name,content_type:e.mimeType,content_length:e.sizeBytes,last_modified:e.lastEditedUtc}})})}),l.length?d().post("/import_media_from_google_drive.json").send({source:e,calendar_id:t,files:l}).setCsrfToken().end((e,t)=>{if(e||!t.ok)t.body.errors&&o(t.body.errors),j(!1);else{const e=t.body;e.media.forEach(e=>{g(e)}),e.failed_media_errors.length>0&&o(e.failed_media_errors),j(!1)}}):j(!1)}},[f,t,o,y,g]);return{handleDriveOpenPicker:(0,l.useCallback)(()=>{o([]),c&&c(),h&&h(),x({viewId:u[n],maxItems:s,setSelectFolderEnabled:!1,showUploadView:!1,showUploadFolders:!1,multiselect:!0,viewMimeTypes:p[n].join(","),selectableMimeTypes:p[n].join(","),callbackFunction:C})},[x,o,c,h]),importing:f}},g=a(15366),x=a(81614);var v=({source:e,calendarId:t,labelText:a="Google Drive",googleDrivePickerEnv:n,afterClickingButtonCallback:o,setErrors:r,onValidate:i,onClearFailed:c,onOpen:d,photosLimit:m=40,showPhotosChooser:u=!0,photosDisabled:p=!1,onUploadPhoto:v,videosLimit:b=10,showVideosChooser:f=!0,videosDisabled:j=!1,onUploadVideo:y,documentsLimit:C=10,showDocumentsChooser:k=!0,documentsDisabled:N=!1,onUploadDocument:w})=>{const _=(0,l.useRef)(null),S=(0,l.useRef)(null),[A,T,F,I]=(0,g.A)(_,S),{handleDriveOpenPicker:E,importing:D}=h({source:e,calendarId:t,googleDrivePickerEnv:n,maxItems:m||40,fileType:"image",setErrors:r,onValidate:i,onClearFailed:c,onOpen:d,onUploadCallback:v}),{handleDriveOpenPicker:P,importing:V}=h({source:e,calendarId:t,googleDrivePickerEnv:n,maxItems:b||10,fileType:"video",setErrors:r,onValidate:i,onClearFailed:c,onOpen:d,onUploadCallback:y}),{handleDriveOpenPicker:M,importing:U}=h({source:e,calendarId:t,googleDrivePickerEnv:n,maxItems:C||10,fileType:"document",setErrors:r,onValidate:i,onClearFailed:c,onOpen:d,onUploadCallback:w}),O=D||V,$=(0,l.useCallback)(()=>{o&&o(),F(),E()},[o,E,F]),q=(0,l.useCallback)(()=>{o&&o(),F(),P()},[o,P,F]),R=(0,l.useCallback)(()=>{o&&o(),F(),M()},[o,M,F]),B=!u&&!f&&!k||p&&j&&N||p&&!f&&!k||j&&!u&&!k||N&&!u&&!f;return(0,s.jsxs)("div",{className:`dropdown google-drive-import ${A?"open":""} ${B?"hidden":""}`,children:[(0,s.jsx)("button",{ref:S,id:"google-drive-import-button",className:"google-drive-button btn-link",type:"button",onClick:I,children:(0,s.jsxs)(x.A,{content:"Import from Google Drive",placement:"top",children:[(0,s.jsxs)("svg",{style:{verticalAlign:"middle"},className:"google-drive-icon",viewBox:"0 0 87.3 78",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,s.jsx)("path",{d:"m6.6 66.85 3.85 6.65c.8 1.4 1.95 2.5 3.3 3.3l13.75-23.8h-27.5c0 1.55.4 3.1 1.2 4.5z",fill:"#0066da"}
1),(0,s.jsx)("path",{d:"m43.65 25-13.75-23.8c-1.35.8-2.5 1.9-3.3 3.3l-25.4 44a9.06 9.06 0 0 0 -1.2 4.5h27.5z",fill:"#00ac47"}),(0,s.jsx)("path",{d:"m73.55 76.8c1.35-.8 2.5-1.9 3.3-3.3l1.6-2.75 7.65-13.25c.8-1.4 1.2-2.95 1.2-4.5h-27.502l5.852 11.5z",fill:"#ea4335"}),(0,s.jsx)("path",{d:"m43.65 25 13.75-23.8c-1.35-.8-2.9-1.2-4.5-1.2h-18.5c-1.6 0-3.15.45-4.5 1.2z",fill:"#00832d"}),(0,s.jsx)("path",{d:"m59.8 53h-32.3l-13.75 23.8c1.35.8 2.9 1.2 4.5 1.2h50.8c1.6 0 3.15-.45 4.5-1.2z",fill:"#2684fc"}),(0,s.jsx)("path",{d:"m73.4 26.5-12.7-22c-.8-1.4-1.95-2.5-3.3-3.3l-13.75 23.8 16.15 28h27.45c0-1.55-.4-3.1-1.2-4.5z",fill:"#ffba00"})]}),a]})}),(0,s.jsx)("div",{ref:_,className:"dropdown-menu","aria-labelledby":"google-drive-import-button",children:(0,s.jsxs)("ul",{children:[u&&(0,s.jsx)("li",{children:(0,s.jsx)("button",{onClick:$,disabled:p||O,children:"Import Photos from Google Drive"})}),f&&(0,s.jsx)("li",{children:(0,s.jsx)("button",{onClick:q,disabled:j||O,children:"Import Videos from Google Drive"})}),k&&(0,s.jsx)("li",{children:(0,s.jsx)("button",{onClick:R,disabled:N||O,children:"Import Documents from Google Drive"})})]})})]})}},13215:function(e,t,a){var s=a(74848),l=a(96540),n=a(15734),o=a.n(n),r=a(26916),i=a(93490),c=a(73615),d=a(13672),m=a(71050),u=a(64351),p=a(30685),h=a(82726);a(74626)(o());t.A=({isMobileApp:e,onValidate:t,onClose:a,calendarId:n,onUploadPhoto:g,actionButtonText:x="Insert"})=>{const[v,b]=(0,l.useState)({items:[],total_pages:0,total_entries:0,current_page:1}),[f,j]=(0,l.useState)([]),[y,C]=(0,l.useState)([]),[k,N]=(0,l.useState)(!1),[w,_]=(0,l.useState)({query:""}),[S,A]=(0,l.useState)([]),[T,F]=(0,l.useState)([]),I=(0,l.useCallback)(e=>{const t=e.links.download_location;if(t)return o().post(`/calendars/${n}/unsplash_photos/import.json`).send({download_location:t}).setCsrfToken()},[g]),E=(0,l.useCallback)(async()=>{const e=await Promise.all(y.map(e=>I(e).catch(t=>(t.item=e)&&t)));let t=[];e.forEach(e=>{e instanceof Error?t=t.concat([`The image from the artist ${e.item.user.name} failed to import: ${e.message}.`]):e.body&&e.body.errors?t=t.concat(e.body.errors):g(e.body.media)}),t.length>0?A(t):a()},[y,I]),D=(0,l.useCallback)((e,a)=>{if(t){const s=(0,u.e6)(e,a),l=y.map(t=>(0,u.e6)(e)),n=t(s,{current:l});return"function"==typeof n.entries?(j(n.entries("error")),!n.hasEntries("error")):(j(n.errors),!n.hasErrors)}return!0},[y,t]),P=(0,l.useCallback)(e=>(j([]),!0),[]),V=(0,l.useCallback)(e=>{C(t=>t.concat(e))},[y]),M=(0,l.useCallback)(e=>{C(t=>t.filter(t=>t.id!=e.id))},[y]),U=(0,l.useCallback)((e=1,t)=>{const a={query:t.query,page:e};N(!0),o().get(`/calendars/${n}/unsplash_photos.json`).setCsrfToken().query(a).end((e,t)=>{e||!t.ok?(e&&F([e.message]),t.body&&t.body.errors&&F(t.body.errors)):(F([]),b(t.body)),N(!1)})},[]),O=(0,l.useCallback)(e=>U(e,w),[U,w]),$=(0,l.useCallback)(e=>{e.preventDefault();const t={query:h(e.currentTarget).find("input[name='search-query']").val()};_(t),U(1,t)},[]);(0,l.useEffect)(()=>{U(1,w)},[]);const q=(0,l.useMemo)(()=>T?"Oops! Something went wrong, please try again later.":"No photos to show.",[T]),R=(0,l.useCallback)(e=>({metadata:{width:e.width,height:e.height},overlay:{title:e.user.name,link:e.user.links.html},urls:{small:e.urls.small,full:e.urls.full}}),[]);return(0,s.jsxs)(l.Fragment,{children:[S.length>0&&(0,s.jsxs)(m.A,{modalProps:{open:!0,showCloseIcon:!1,closeOnOverlayClick:!1,onClose:()=>{}},onAccept:a,onAcceptText:"Ok",children:[S.length>1?(0,s.jsx)("p",{children:"There were errors importing images:"}):(0,s.jsx)("p",{children:"There was an error importing an image:"}),(0,s.jsx)("ul",{children:S.map((e,t)=>(0,s.jsx)("li",{children:e},t))})]}),0==S.length&&(0,s.jsx)(r.A,{modalClassName:"gallery-modal unsplash-gallery-modal height-restricted",containerClassName:"gallery-modal-container",open:!0,onClose:a,children:(0,s.jsxs)("div",{className:"modal-content-custom",children:[(0,s.jsxs)("div",{className:"modal-header-custom",children:[(0,s.jsx)("div",{className:"modal-title-custom "+(e?"":"large"),children:"Browse Unsplash"}),(0,s.jsx)("div",{className:"browse-controls",children:(0,s.jsxs)("div",{className:"search-container",children:[(0,s.jsx)("div",{className:"form-group",children:(0,s.jsx)("form",{onSubmit:$,children:(0,s.jsx)("input",{type:"text",name:"search-query",placeholder:"Search Unsplash...",className:"search-text-field with-search-icon x-large "+(w.query?"search-query-active":""),defaultValue:w.query})})}),e&&y.length>0&&(0,s.jsx)("button",{type:"button",className:"button insert-button",onClick:E,children:x})]})})]}),(0,s.jsxs)("div",{className:"modal-body-custom left "+(f.length>0?"with-errors":""),children:[(0,s.jsx)("div",{className:"alert-container",children:T.map((e,t)=>(0,s.jsx)("div",{className:"alert alert-danger",children:e},t))}),(0,s.jsx)("div",{className:"alert-container",children:f.map((e,t)=>(0,s.jsx)("div",{className:"alert alert-warning",children:e.message},t))}
1),(0,s.jsx)(i.A,{searching:k,items:v.items,itemFormatter:R,selected:y,onAddToSelection:V,onRemoveFromSelection:M,onBeforeAddToSelection:D,onBeforeRemoveFromSelection:P,filterActive:!!w.query,itemDisplayComponent:e?d.A:c.A,emptyItemsMessage:q})]}),(0,s.jsxs)("div",{className:"modal-footer-custom with-border with-pagination",children:[!e&&(0,s.jsxs)("div",{className:"modal-buttons",children:[(0,s.jsx)("button",{type:"button",className:"button small secondary",onClick:a,children:"Cancel"}),(0,s.jsx)("button",{type:"button",className:"button small",disabled:0==y.length,onClick:E,children:x})]}),!k&&(0,s.jsx)(p.A,{totalPages:v.total_pages,currentPage:v.current_page,totalEntries:v.total_entries,perPage:v.per_page,numberOnCurrentPage:v.items.length,resultsLabel:w.query?"results":"images",onFetchPage:O,showPagination:v.total_pages>1,selectedCount:y.length})]})]})})]})}},13672:function(e,t,a){var s=a(74848),l=a(96540),n=a(99613);t.A=({item:e,itemFormatter:t,selected:a=!1,onAddToSelection:o,onRemoveFromSelection:r})=>{const[i,c,d]=(0,n.A)(e,t,a,r,o),[m,u]=(0,l.useState)(!1),p=t(e),h=(0,l.useCallback)(()=>{d(),u(!0)},[d]),g=p.overlay.link&&`${p.overlay.link}?utm_source=Loomly&utm_medium=referral`;return(0,s.jsxs)("div",{className:"masonry-grid-cell"+(a?" selected":""),children:[a?(0,s.jsx)("div",{className:"selected-border-box"}):null,m&&(0,s.jsxs)("div",{className:"photo-info-overlay",children:[(0,s.jsx)("div",{className:"close-photo-info-overlay",onClick:()=>u(!1),children:(0,s.jsx)("span",{className:"fa fa-times"})}),(0,s.jsx)("h5",{children:(0,s.jsx)("a",{href:g,target:"_blank",rel:"noopener nofollow",children:p.overlay.name})}),c&&c.content_type&&(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"detail-title",children:"Type:"}),"\xa0",c.content_type]}),c&&c.content_length&&(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"detail-title",children:"Image Size:"}),"\xa0",`${(c.content_length/1048576).toFixed(2)} MB`]}),p.metadata.width&&p.metadata.height&&(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"detail-title",children:"Dimensions:"}),"\xa0",`${p.metadata.width} x ${p.metadata.height} px`]}),p.metadata.pages&&(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"detail-title",children:"Page Count:"}),"\xa0",p.metadata.pages]})]}),(0,s.jsx)("img",{src:p.urls.small,onClick:i}),(0,s.jsxs)("div",{className:"photo-info with-gradient",children:[(0,s.jsx)("div",{className:"author-name",children:(0,s.jsx)("a",{href:g,target:"_blank",rel:"noopener nofollow",children:p.overlay.title})}),(0,s.jsx)("span",{className:"fa fa-info-circle info-icon",onClick:h})]})]})}},25282:function(e,t,a){var s=a(74848);a(96540);t.A=()=>(0,s.jsxs)("svg",{className:"giphy-logo",viewBox:"0 0 12 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,s.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1.71436 1.82861H10.2855V14.1715H1.71436V1.82861Z",fill:"black"}),(0,s.jsx)("path",{d:"M0 1.37158H1.71423V14.6288H0V1.37158Z",fill:"#04FF8E"}),(0,s.jsx)("path",{d:"M10.2856 5.02869H11.9999V14.6287H10.2856V5.02869Z",fill:"#8E2EFF"}),(0,s.jsx)("path",{d:"M0 14.1714H11.9996V16H0V14.1714Z",fill:"#00C5FF"}),(0,s.jsx)("path",{d:"M0 0H6.85692V1.82858H0V0Z",fill:"#FFF152"}),(0,s.jsx)("path",{d:"M10.2856 3.65716V1.82858H8.57141V0H6.85718V5.48574H11.9999V3.65716",fill:"#FF5B5B"}),(0,s.jsx)("path",{d:"M10.2856 7.3143V5.48572H11.9999",fill:"#551C99"}),(0,s.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.85681 0V1.82858H5.14258",fill:"#999131"})]})},67290:function(e,t,a){var s=a(74848),l=a(96540),n=a(15734),o=a.n(n),r=a(26916),i=a(93490),c=a(73615),d=a(13672),m=a(71050),u=a(64351),p=a(30685),h=a(82726);a(74626)(o());t.A=({isMobileApp:e,onValidate:t,onClose:a,calendarId:n,onUploadPhoto:g})=>{const[x,v]=(0,l.useState)({items:[],total_pages:0,total_entries:0,current_page:1}),[b,f]=(0,l.useState)([]),[j,y]=(0,l.useState)([]),[C,k]=(0,l.useState)(!1),[N,w]=(0,l.useState)({query:""}),[_,S]=(0,l.useState)([]),[A,T]=(0,l.useState)([]),F=(0,l.useCallback)(e=>{const t=e.images.original.url;if(t)return o().post(`/calendars/${n}/giphy_photos/import.json`).send({download_location:t}).setCsrfToken()},[g]),I=(0,l.useCallback)(async()=>{const e=await Promise.all(j.map(e=>F(e).catch(t=>(t.item=e)&&t)));let t=[];
1e.forEach(e=>{e instanceof Error?t=t.concat([`The image from the artist ${e.item.user.name} failed to import: ${e.message}.`]):e.body&&e.body.errors?t=t.concat(e.body.errors):g(e.body.media)}),t.length>0?S(t):a()},[j,F]),E=(0,l.useCallback)((e,a)=>{if(t){const s=(0,u.JK)(e,a),l=j.map(t=>(0,u.JK)(e)),n=t(s,{current:l});return"function"==typeof n.entries?(f(n.entries("error")),!n.hasEntries("error")):(f(n.errors),!n.hasErrors)}return!0},[j,t]),D=(0,l.useCallback)(e=>(f([]),!0),[]),P=(0,l.useCallback)(e=>{y(t=>t.concat(e))},[j]),V=(0,l.useCallback)(e=>{y(t=>t.filter(t=>t.id!=e.id))},[j]),M=(0,l.useCallback)((e=1,t)=>{const a={query:t.query,page:e};k(!0),o().get(`/calendars/${n}/giphy_photos.json`).setCsrfToken().query(a).end((e,t)=>{e||!t.ok?(e&&T([e.message]),t.body&&t.body.errors&&T(t.body.errors)):(T([]),v(t.body)),k(!1)})},[]),U=(0,l.useCallback)(e=>M(e,N),[M,N]),O=(0,l.useCallback)(e=>{e.preventDefault();const t={query:h(e.currentTarget).find("input[name='search-query']").val()};w(t),M(1,t)},[]);(0,l.useEffect)(()=>{M(1,N)},[]);const $=(0,l.useMemo)(()=>A?"Oops! Something went wrong, please try again later.":"No photos to show.",[A]),q=(0,l.useCallback)(e=>({metadata:{width:e.images.original.width,height:e.images.original.height},overlay:{title:e.user&&e.user.display_name,link:e.user&&e.user.profile_url},urls:{small:e.images.preview_gif.url,full:e.images.original.url}}),[]);return(0,s.jsxs)(l.Fragment,{children:[_.length>0&&(0,s.jsxs)(m.A,{modalProps:{open:!0,showCloseIcon:!1,closeOnOverlayClick:!1,onClose:()=>{}},onAccept:a,onAcceptText:"Ok",children:[_.length>1?(0,s.jsx)("p",{children:"There were errors importing images:"}):(0,s.jsx)("p",{children:"There was an error importing an image:"}),(0,s.jsx)("ul",{children:_.map((e,t)=>(0,s.jsx)("li",{children:e},t))})]}),0==_.length&&(0,s.jsx)(r.A,{modalClassName:"gallery-modal giphy-gallery-modal height-restricted",containerClassName:"gallery-modal-container",open:!0,onClose:a,children:(0,s.jsxs)("div",{className:"modal-content-custom",children:[(0,s.jsxs)("div",{className:"modal-header-custom",children:[(0,s.jsx)("div",{className:"modal-title-custom "+(e?"":"large"),children:"Browse Giphy"}),(0,s.jsx)("div",{className:"browse-controls",children:(0,s.jsxs)("div",{className:"search-container",children:[(0,s.jsx)("div",{className:"form-group",children:(0,s.jsx)("form",{onSubmit:O,children:(0,s.jsx)("input",{type:"text",name:"search-query",placeholder:"Search Giphy...",className:"search-text-field with-search-icon x-large "+(N.query?"search-query-active":""),defaultValue:N.query})})}),e&&j.length>0&&(0,s.jsx)("button",{type:"button",className:"button insert-button",onClick:I,children:"Insert"})]})})]}),(0,s.jsxs)("div",{className:"modal-body-custom left "+(b.length>0?"with-errors":""),children:[(0,s.jsx)("div",{className:"alert-container",children:A.map((e,t)=>(0,s.jsx)("div",{className:"alert alert-danger",children:e},t))}),(0,s.jsx)("div",{className:"alert-container",children:b.map((e,t)=>(0,s.jsx)("div",{className:"alert alert-warning",children:e.message},t))}),(0,s.jsx)("div",{className:"giphy-attribution"}),(0,s.jsx)(i.A,{searching:C,items:x.items,itemFormatter:q,selected:j,onAddToSelection:P,onRemoveFromSelection:V,onBeforeAddToSelection:E,onBeforeRemoveFromSelection:D,filterActive:!!N.query,itemDisplayComponent:e?d.A:c.A,emptyItemsMessage:$})]}),(0,s.jsxs)("div",{className:"modal-footer-custom with-border with-pagination",children:[!e&&(0,s.jsxs)("div",{className:"modal-buttons",children:[(0,s.jsx)("button",{type:"button",className:"button small secondary",onClick:a,children:"Cancel"}),(0,s.jsx)("button",{type:"button",className:"button small",disabled:0==j.length,onClick:I,children:"Insert"})]}),!C&&(0,s.jsx)(p.A,{totalPages:x.total_pages,currentPage:x.current_page,totalEntries:x.total_entries,perPage:x.per_page,numberOnCurrentPage:x.items.length,resultsLabel:N.query?"results":"images",onFetchPage:U,showPagination:x.total_pages>1,selectedCount:j.length})]})]})})]})}},68889:function(e,t,a){a.d(t,{A:function(){return v}});var s=a(74848),l=a(96540),n=a(15734),o=a.n(n),r=a(26916),i=a(93490),c=a(73615),d=a(13672),m=a(63189),u=a(82726);a(74626)(o());var p=({isMobileApp:e,calendarId:t,items:a,onSetItems:n,selected:r,onAddToSelection:p,onRemoveFromSelection:h,onCancel:g,onNext:x})=>{const[v,b]=(0,l.useState)(!1),[f,j]=(0,l.useState)({query:""}),[y,C]=(0,l.useState)([]),k=(0,l.useCallback)((e,a)=>{const s={query:e.query,continuation:a};b(!0),o().get(`/calendars/${t}/canva_designs.json`).setCsrfToken().query(s).end((e,t)=>{e||!t.ok?(e&&C([e.message]),t.body&&t.body.error&&C([t.body.error]),t.body&&t.body.errors&&C(t.body.errors)):(C([]),n(a?e=>({items:[...e.items,t.body.items],continuation:t.body.continuation}):t.body)),b(!1)})},[t]),N=(0,l.useCallback)(e=>k(f,e),[k,f]),w=(0,l.useCallback)(e=>{e.target.scrollHeight-e.target.scrollTop<=e.target.clientHeight+1&&!v&&a.continuation&&N(a.continuation)},[v,N,a.continuation]),_=(0,l.useCallback)(e=>{e.preventDefault();const t={query:u(e.currentTarget).find("input[name='search-query']").val()};j(t),k(t)},[]);(0,l.useEffect)(()=>{k(f)},[]);const S=(0,l.useMemo)(()=>
1{if(y){const e=()=>{(0,m.A)(`/calendars/${t}/identities/connect/canva?inline=true`),g()};return(0,s.jsxs)("div",{children:["Oops! Something went wrong, please try again later, or try ",(0,s.jsx)("button",{type:"button",className:"btn btn-link btn-inline-social-connection",onClick:e,children:"reconnecting Canva"}),"."]})}return"No designs to show."},[y,g,t]),A=(0,l.useCallback)(e=>({metadata:{pages:e.page_count||1},overlay:{title:e.title||"Untitled Design",link:e.urls?.edit_url||e.urls?.view_url},urls:{small:e.thumbnail?.url}}),[]);return(0,s.jsxs)(l.Fragment,{children:[(0,s.jsxs)("div",{className:"modal-header-custom",children:[(0,s.jsx)("div",{className:"modal-title-custom "+(e?"":"large"),children:"Search Canva Designs"}),(0,s.jsx)("div",{className:"browse-controls",children:(0,s.jsxs)("div",{className:"search-container",children:[(0,s.jsx)("div",{className:"form-group",children:(0,s.jsx)("form",{onSubmit:_,children:(0,s.jsx)("input",{type:"text",name:"search-query",placeholder:"Search Canva...",className:"search-text-field with-search-icon x-large "+(f.query?"search-query-active":""),defaultValue:f.query})})}),e&&r.length>0&&(0,s.jsx)("button",{type:"button",className:"button insert-button",onClick:x,children:"Continue"})]})})]}),(0,s.jsxs)("div",{className:"modal-body-custom left",onScroll:w,children:[(0,s.jsx)("div",{className:"alert-container",children:y.map((e,t)=>(0,s.jsx)("div",{className:"alert alert-danger",children:e},t))}),(0,s.jsx)(i.A,{searching:v,items:a.items,itemFormatter:A,selected:r,onAddToSelection:p,onRemoveFromSelection:h,filterActive:!!f.query,itemDisplayComponent:e?d.A:c.A,emptyItemsMessage:S})]}),(0,s.jsx)("div",{className:"modal-footer-custom with-border",children:!e&&(0,s.jsxs)("div",{className:"modal-buttons",children:[(0,s.jsx)("button",{type:"button",className:"button small secondary",onClick:g,children:"Cancel"}),(0,s.jsx)("button",{type:"button",className:"button small",disabled:0==r.length,onClick:x,children:"Continue"})]})})]})},h=a(46892);a(74626)(o());var g=({isMobileApp:e,selected:t,onCancel:a,onNext:n,exportError:o})=>{const[r]=t,[i,c]=(0,l.useState)(r.title||"Untitled Design"),[d,m]=(0,l.useState)(),[u,p]=(0,l.useState)(),[g,x]=(0,l.useState)(1==r.page_count?null:""),[v,b]=(0,l.useState)();(0,l.useEffect)(()=>{r.thumbnail&&p(r.thumbnail.width>r.thumbnail.height?"horizontal":"vertical")},[r.thumbnail]);const f=(0,l.useCallback)(()=>{if(null===g)return void b();const e=(g||"").replace(/[^0-9\-,]/g,"");if(!e)return void x("");const t=e.split(",").some(e=>{if(!e.includes("-"))return e=Number(e),isNaN(e);const t=e.split("-"),a=Number(t[0]),s=Number(t[1]);return isNaN(a)||isNaN(s)||a>s}),a=e.split(",").some(e=>{if(!e.includes("-"))return(e=Number(e))>r.page_count;const t=e.split("-"),a=Number(t[0]),s=Number(t[1]);return a>r.page_count||s>r.page_count});"pdf"!==d&&/[-,]+/g.test(e)?b("Please select a single page."):t?b("Invalid page range, use e.g. 1-5, 8, 11-13."):a?b(`Cannot find the specified page numbers. This Canva design has ${r.page_count} page${1!=r.page_count?"s":""}.`):(x(e),b())},[d,g,r.page_count]);(0,l.useEffect)(()=>{if(d&&"pdf"!==d){const e=1==r.page_count?null:"";x(t=>t||e)}f()},[d,r.page_count]);const j=()=>n({name:i,type:d,orientation:u,pages:g}),y=!d||""===g||v;return(0,s.jsxs)(l.Fragment,{children:[(0,s.jsxs)("div",{className:"modal-header-custom",children:[(0,s.jsx)("div",{className:"modal-title-custom "+(e?"":"large"),children:"Import Canva Design"}),(0,s.jsx)("div",{className:"browse-controls",children:(0,s.jsx)("div",{className:"search-container",children:e&&(0,s.jsx)("button",{type:"button",className:"button insert-button",disabled:y,onClick:j,children:"Continue"})})})]}),(0,s.jsxs)("div",{className:"modal-body-custom left",children:[o&&(0,s.jsx)("div",{className:"alert-container",children:(0,s.jsx)("div",{className:"alert alert-danger",children:o})}),(0,s.jsxs)("div",{className:"row",children:[(0,s.jsxs)("div",{className:"col-md-6 canva-design-description",children:[(0,s.jsxs)("p",{className:"text-center",children:[(0,s.jsx)("b",{children:"Design:"})," ",r.title||"Untitled Design",(0,s.jsx)("br",{}),(0,s.jsx)("b",{children:"Page Count:"})," ",r.page_count||"Unknown"]}),(0,s.jsx)(h.A,{src:r.thumbnail?.url,style:{maxWidth:"100%"},loaderWidth:"100%",loaderHeight:200})]}),(0,s.jsxs)("div",{className:"col-md-6",children:[(0,s.jsx)("p",{children:(0,s.jsx)("b",{children:"Import your Canva design into Loomly"})}),(0,s.jsxs)("form",{onSubmit:()=>{},children:[(0,s.jsxs)("div",{className:"form-group",children:[(0,s.jsx)("label",{className:"name",children:"Asset Name"}),(0,s.jsx)("input",{type:"text",value:i,name:"name",placeholder:"Untitled Design",onChange:e=>c(e.target.value||"Untitled Design")})]}),(0,s.jsxs)("div",{className:"form-group",children:[(0,s.jsx)("label",{className:"name",children:"Import As"}),(0,s.jsxs)("select",{className:"form-control",name:"format",value:d,onChange:e=>m(e.target.value),required:!0,children:[(0,s.jsx)("option",{value:"",children:"Select Format"}),(0,s.jsx)("option",{value:"pdf",children:"Document"}),(0,s.jsx)("option",{value:"png",children:"Photo"}),(0,s.jsx)("option",{value:"gif",children:"Animated GIF"}),(0,s.jsx)("option",{value:"mp4",children:"Video"})]})]}),"mp4"===d&&!r.thumbnail&&(0,s.jsxs)("div",{className:"form-group",children:[(0,s.jsx)("label",{className:"name",children:"Video Orientation"}),(0,s.jsxs)("div",{className:"inline-checkboxes",children:[(0,s.jsx)("div",{className:"custom-radio-container",children:(0,s.jsxs)("label",{children:[(0,s.jsx)("input",{type:"radio",value:"horizontal",name:"orientation",checked:"horizontal"===u,onChange:e=>p(e.target.value)}),"Horizontal",(0,s.jsx)("span",{className:"checkmark"})]})}),(0,s.jsx)("div",{className:"custom-radio-container",children:(0,s.jsxs)("label",{children:[(0,s.jsx)("input",{type:"radio",value:"vertical",name:"orientation",checked:"vertical"===u,onChange:e=>p(e.target.value)}),"Vertical",(0,s.jsx)("span",{className:"checkmark"})]})})]})]}),r.page_count>1&&(0,s.jsxs)("div",{className:"form-group",children:[(0,s.jsx)("label",{className:"name",children:"pdf"===d?"Select Pages":"Select Page"}),(0,s.jsxs)("div",{className:"inline-checkboxes",children:[(0,s.jsx)("div",{className:"custom-radio-container",children:(0,s.jsxs)("label",{children:[(0,s.jsx)("input",{type:"radio",value:"all",name:"page_input",checked:null===g,disabled:"pdf"!==d,onChange:e=>x(null)}),"All",(0,s.jsx)("span",{className:"checkmark"})]})}),(0,s.jsx)("div",{className:"custom-radio-container",children:(0,s.jsxs)("label",{children:[(0,s.jsx)("input",{type:"radio",value:"custom",n
1ame:"page_input",checked:null!==g,onChange:e=>x("")}),"Custom",(0,s.jsx)("span",{className:"checkmark"})]})})]}),null!==g&&(0,s.jsxs)("div",{children:[(0,s.jsx)("input",{type:"text",value:g,name:"pages",placeholder:"e.g. 1-5, 8, 11-13",onChange:e=>x(e.target.value),onBlur:f}),v&&(0,s.jsx)("div",{className:"form-field-error",children:v})]})]})]})]})]})]}),(0,s.jsx)("div",{className:"modal-footer-custom with-border",children:!e&&(0,s.jsxs)("div",{className:"modal-buttons",children:[(0,s.jsx)("button",{type:"button",className:"button small secondary",onClick:a,children:"Back"}),(0,s.jsx)("button",{type:"button",className:"button small",disabled:y,onClick:j,children:"Continue"})]})})]})};a(74626)(o());var x=({isMobileApp:e,onClose:t,calendarId:a,onUploadPhoto:n,onUploadVideo:i,onUploadDocument:c})=>{const[d,m]=(0,l.useState)(0),u=(0,l.useCallback)(()=>m(e=>e-1),[]),h=(0,l.useCallback)(()=>m(e=>e+1),[]),[x,v]=(0,l.useState)({items:[]}),[b,f]=(0,l.useState)([]),[j,y]=(0,l.useState)(),C=(0,l.useCallback)(async e=>{const s={design_id:b[0].id,settings:e};y(),o().post(`/calendars/${a}/canva_designs/import.json`).send(s).setCsrfToken().end((e,a)=>{if(e||!a.ok)e&&(console.error(e),y(`The design failed to import: ${e.toString()}.`)),a.body&&a.body.error&&y(`The design failed to import: ${a.body.error}.`);else{const{media:e,media_import:s}=a.body;"Photo"==e.type?n(e,s.file_name):"Video"==e.type?i(e,s.file_name):"Document"==e.type&&c(e,s.file_name),t()}})},[a,b,t,c,n,i]),k=(0,l.useCallback)(e=>{f([e])},[]),N=(0,l.useCallback)(e=>{f(t=>t.filter(t=>t.id!=e.id))},[]);return(0,s.jsx)(r.A,{modalClassName:"gallery-modal canva-gallery-modal height-restricted",containerClassName:"gallery-modal-container",open:!0,onClose:t,children:(0,s.jsxs)("div",{className:"modal-content-custom",children:[0===d&&(0,s.jsx)(p,{calendarId:a,isMobileApp:e,items:x,onSetItems:v,selected:b,onAddToSelection:k,onRemoveFromSelection:N,onCancel:t,onNext:h}),1===d&&(0,s.jsx)(g,{calendarId:a,isMobileApp:e,selected:b,onCancel:u,onNext:C,exportError:j})]})})};a(74626)(o());var v=({isMobileApp:e,calendarId:t,identity:a,onOpen:n,onClose:o,onUploadPhoto:r,onUploadVideo:i,onUploadDocument:c})=>{const d=a&&!a.failing&&!a.revoked,u=(0,l.useRef)(d);return(0,l.useEffect)(()=>{if(u.current!==d)u.current=d,d&&n();else if(!d){const e=(0,m.A)(`/calendars/${t}/identities/connect/canva?inline=true`),a=e?setInterval(()=>{e.closed&&(clearInterval(a),o())},300):null;return new BroadcastChannel(`loomly-inline-identity-connections--calendar-${t}`).onmessage=e=>{"identity-connection-success"===e.data.type&&a&&clearInterval(a)},()=>{a&&clearInterval(a)}}},[d,t,o]),d?(0,s.jsx)(x,{isMobileApp:e,onClose:o,calendarId:t,onUploadPhoto:r,onUploadVideo:i,onUploadDocument:c}):null}},73615:function(e,t,a){var s=a(74848),l=a(96540),n=a(65848),o=a(86404),r=a(99613);t.A=({item:e,itemFormatter:t,selected:a=!1,onAddToSelection:i,onRemoveFromSelection:c})=>{const[d,m,u]=(0,r.A)(e,t,a,c,i),p=t(e),h=(0,l.useMemo)(()=>(0,s.jsxs)("div",{className:"gallery-popover-details",children:[m&&m.content_type&&(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"detail-title",children:"Type:"}),"\xa0",m.content_type]}),m&&m.content_length&&(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"detail-title",children:"Image Size:"}),"\xa0",`${(m.content_length/1048576).toFixed(2)} MB`]}),p.metadata.width&&p.metadata.height&&(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"detail-title",children:"Dimensions:"}),"\xa0",`${p.metadata.width} x ${p.metadata.height} px`]}),p.metadata.pages&&(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"detail-title",children:"Page Count:"}),"\xa0",p.metadata.pages]})]}),[m]),g=p.overlay.link&&`${p.overlay.link}?utm_source=Loomly&utm_medium=referral`;return(0,s.jsxs)("div",{className:"masonry-grid-cell show-info-on-hover "+(a?" selected":""),onClick:d,onMouseOver:u,children:[a?(0,s.jsx)("div",{className:"selected-border-box"}):null,(0,s.jsx)("img",{src:p.urls.small}),(0,s.jsxs)("div",{className:"photo-info",children:[(0,s.jsx)("div",{className:"author-name",children:(0,s.jsx)("a",{href:g,target:"_blank",rel:"noopener nofollow",children:p.overlay.title})}),(0,s.jsx)(o.A,{content:(0,n.renderToString)(h),popoverSize:"large",html:!0,children:(0,s.jsx)("span",{className:"fa fa-info-circle info-icon"})})]})]})}},82493:function(e,t,a){var s=a(74848);a(96540);t.A=()=>(0,s.jsx)("svg",{className:"unsplash-logo",viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg",children:(0,s.jsx)("path",{d:"M10 9V0h12v9H10zm12 5h10v18H0V14h10v9h12v-9z",fill:"#212121",fillRule:"nonzero"})})},86404:function(e,t,a){var s=a(74848),l=a(96540),n=a(71468),o=a(81614);t.A=l.memo((0,n.Ng)(e=>({isMobileApp:e.ui.isMobileApp}
1))(({content:e,mobileAppAlertTitle:t,mobileAppContent:a,isMobileApp:n,...r})=>{const i=(0,l.useCallback)(()=>{MobileMessages.post_message({action:"alert",data:{alertType:"info",alertTitle:t,alertMessage:a||e}})},[e,t,a]);return(0,s.jsx)(o.A,{content:e,onClick:n?i:void 0,disabled:n,...r})}))},99613:function(e,t,a){var s=a(96540),l=a(15734),n=a.n(l);a(74626)(n());t.A=(e,t,a,l,o)=>{const[r,i]=(0,s.useState)({}),[c,d]=(0,s.useState)(!1),[m,u]=(0,s.useState)(!1),p=(0,s.useMemo)(()=>t(e),[e,t]),h=(0,s.useCallback)(()=>{r.content_length||!p.urls.full?o(e,{...r,...p.metadata}):v().then(t=>{const a=b(t.headers);o(e,{...a,...p.metadata}),i(a)}).catch(t=>{o(e,{...p.metadata})})},[e,r,o]),g=(0,s.useCallback)(()=>{l(e)},[e,l]),x=(0,s.useCallback)(()=>{a?g():h()},[g,h,a,l,o]),v=(0,s.useCallback)(()=>n().head(p.urls.full),[e]),b=(0,s.useCallback)(e=>({content_length:parseInt(e["content-length"]),content_type:e["content-type"]})),f=(0,s.useCallback)(()=>{m||c||!p.urls.full||(d(!0),v().end((e,t)=>{e||!t.ok||i(b(t.headers)),u(!0),d(!1)}))},[e,m,c]);return[x,r,f]}}}]); 2//# sourceMappingURL=6975-3a1bcec4e72019e93554.chunk.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.