"use strict";(self.webpackChunkfindagrave_frontend=self.webpackChunkfindagrave_frontend||[]).push([[5359],{65359(e,t,o){var a=o(71757),n=o.n(a),i=(o(11992),o(54802)),r=o(69917),l=o(71757);function s(e){var t;e||(e=null===(t=/page=(\d+)/.exec(window.location.href))||void 0===t?void 0:t[1]),l("#gotoPage").val(e||"1")}function c(e){if(e.length>0){const t=l(e),o=l(window),a=o.scrollTop(),n=a+o.height(),i=t.offset().top,r=i+t.height();return t.height()>o.height()?r<=n&&r>=a||i>=a&&i<=n:r<=n&&i>=a}return!1}function d(e){const t=l(window).scrollTop(),o=l(window).height(),a=l(e).offset().top,n=l(e).height();return a+n-.25*n>t&&a500&&(g=500),v>1&&h("#back-to-top").removeClass("d-none"),"click"==f?(h("#load-next-page").closest("div").removeClass("hidden"),h("#load-previous-page").closest("div").removeClass("hidden")):"scroll"==f&&h("#content-placeholder").find("div").removeClass("invisible"),t>0&&0===h(window).scrollTop()&&h(window).scrollTop(1),s(),function({rowSelector:e,itemSelector:t,focusSelectorNext:o,focusSelectorPrevious:a,loadNextFunction:n,loadPreviousFunction:i,type:l}){h(document).on("click",t,function(t){!function(e){const t=new URL(window.location.href),o=new URLSearchParams(L);let a=e.closest(".list-item-page").attr("data-url").replace("page=","");e.attr("id")&&(a+="#"+e.attr("id"));const n=e.offset().top-h(window).scrollTop();o.set("page",a),history.replaceState({distanceFromTopFold:n},null,`${t.pathname}?${o.toString().replace(/%23/g,"#")}`)}(h(this).closest(e))});let u=0;h(window).on("scroll",function(){var t;"scroll"==f&&m{S(l,o,m)})),"scroll"==f&&u>h(window).scrollTop()&&v>1&&!b&&c(`${e}:first`)&&(b=!0,h("#loadpreviousajaxloader").show(),v--,i(v,x(v),w).then(e=>{D(l,a,v)})),Math.abs(h(window).scrollTop()-C)>.1*h(window).height()&&("normal"==l?(t=e,C=h(window).scrollTop(),h(".list-item-page").each(function(e){if(d(this)){const e=new URL(window.location.href),o=new URLSearchParams(L);let a=h(this).attr("data-url").replace("page=",""),n=h(this).attr("data-url");h(this).find(t).each(function(t){if(c(h(this)))return h(this).attr("id")&&(a+="#"+h(this).attr("id")),h(this).attr("id")&&h(this).attr("id").length>3&&(/page=1$/.test(n)?h("#back-to-top").addClass("d-none"):h("#back-to-top").removeClass("d-none"),o.set("page",a),history.replaceState(null,null,`${e.pathname}?${o.toString().replace(/%23/g,"#")}`),s()),!1})}})):"suggestedEdits"==l&&function(e){C=h(window).scrollTop(),h(e).each(function(e){if(d(this)){const e=new URL(window.location.href),t=new URLSearchParams(L);let o=h(this).attr("data-url").replace("page=",""),a=h(this).attr("data-url");h(this).find("tr").each(function(n){if(c(h(this)))return h(this).attr("id")&&(o+="#"+h(this).attr("id")),h(this).attr("id")&&h(this).attr("id").length>3&&(/page=1$/.test(a)?h("#back-to-top").addClass("d-none"):h("#back-to-top").removeClass("d-none"),t.set("page",o),history.replaceState(null,null,`${e.pathname}?${t.toString().replace(/%23/g,"#")}`),s()),!1})}})}(e)),u=h(window).scrollTop()}),h(document).on("click","#load-next-page",function(e){e.preventDefault(),"click"==f&&(y=!0,h("#loadmoreajaxloader").show(),m++,n(m,x(m),w).then(e=>{S(l,o,m)}))}),h(document).on("click","#load-previous-page",function(e){e.preventDefault(),"click"==f&&(b=!0,h("#loadpreviousajaxloader").show(),v--,i(v,x(v),w).then(e=>{D(l,a,v)}))}),"click"==f?(h("#load-next-page").closest("div").removeClass("hidden"),h("#load-previous-page").closest("div").removeClass("hidden")):"scroll"==f&&h("#content-placeholder").find("div").removeClass("invisible");h(document).on("change","#scrollLists",function(e){if(e.preventDefault(),e.stopPropagation(),h("#scrollLists").is(":checked")){f="scroll",v>1&&h("#content-placeholder").find("div").removeClass("invisible"),h("#load-next-page").closest("div").addClass("hidden"),h("#load-previous-page").closest("div").addClass("hidden"),(0,r.kQ)().pref&&(0,r.TV)("pageLoadType","scroll",365)}else{f="click",h("#content-placeholder").find("div").addClass("invisible"),m1&&h("#load-previous-page").closest("div").removeClass("hidden"),(0,r.kQ)().pref&&(0,r.TV)("pageLoadType","click",365)}})}({itemSelector:i,rowSelector:n,focusSelectorNext:l,focusSelectorPrevious:u,loadNextFunction:p,loadPreviousFunction:k,type:e})}function x(e){return e*w-w}function S(e,t,o){m>=g&&h("#load-next-page").closest("div").addClass("hidden"),h("#loadmoreajaxloader").hide(),"normal"==e?h(t).trigger("focus"):"suggestedEdits"==e&&h(`tbody[data-page=${o}]`).next().find("a.fw-bold").trigger("focus"),y=!1}function D(e,t,o){if(v<=1&&(h("#content-placeholder").addClass("hidden"),h("#load-previous-page").closest("div").addClass("hidden")),h("#loadpreviousajaxloader").hide(),h(".list-item-page").addClass("in"),"normal"==e){const e=h("div.list-item-page:first").outerHeight();window.scrollTo({top:h(window).scrollTop()+e,left:0,behavior:"instant"}),h(t).trigger("focus")}else if("suggestedEdits"==e){const e=h(`tbody[data-page=${o}]`).first().offset().top,t=h(`tbody[data-page=${o+1}]`).first().offset().top-e;window.scrollTo({top:h(window).scrollTop()+t,left:0,behavior:"instant"}),h(`tbody[data-page=${o+1}]`).prev().find("a.fw-bold").trigger("focus")}b=!1}var Y=o(95093),R=o.n(Y),T=o(71757);o(85498),o(97650),o(77853),o(79834),o(88383),o(92572),o(41011),o(90527),o(94418),o(93601),o(22274),o(26435);class P{constructor(e,t,o,a){this.queryParam=e,this.dateRegex=new RegExp(`[?&]${e}=(\\d{4}-\\d{2}-\\d{2})_(\\d{4}-\\d{2}-\\d{2})`),this.selector=t,a&&(this.update=a),o&&(this.inputSelector=o);const n=/https?:\/\/([^.]+)./.exec(document.URL)[1].toLowerCase();"www"!==n?"fr-ca"===n?R().locale("fr-CA"):R().locale(n):R().locale("en");const i={startDate:R()().subtract(2,"months"),endDate:R()(),linkedCalendars:!1,showDropdowns:!0,minDate:R()([1998,3,1]),maxDate:R()(),locale:{format:"DD MMM YYYY",applyLabel:findagrave.applyLabel||"Apply",cancelLabel:findagrave.cancelLabel||"Cancel",toLabel:findagrave.toLabel||"To",fromLabel:findagrave.fromLabel||"From",customRangeLabel:findagrave.customRangeLabel||"Custom"},ranges:{[findagrave.allDates]:[R()([1998,3,1]),R()()],[findagrave.past24]:[R()().subtract(24,"hours"),R()()],[findagrave.pastWeek]:[R()().subtract(6,"days"),R()()],[findagrave.pastMonth]:[R()().subtract(1,"month"),R()()],[findagrave.pastQuarter]:[R()().subtract(3,"month"),R()()]}},r=this.dateRegex.exec(location.href);null!==r&&(i.startDate=R()(r[1],"YYYY-MM-DD"),i.endDate=R()(r[2],"YYYY-MM-DD"));const l=this;T(t).daterangepicker(i,function(e,t){let o=e.format("YYYY-MM-DD")+"_"+t.format("YYYY-MM-DD");if(T(l.selector+" .date-filter").html(e.format("DD MMM YYYY")+" - "+t.format("DD MMM YYYY")),l.inputSelector){T(l.inputSelector).val(o)}l.update&&l.update(o,l.queryParam)})}}var M=o(44162),F=o(39708),U=o(28097),$=o(11045),j=o(27667),N=function(e,t,o,a){return new(o||(o=Promise))(function(n,i){function r(e){try{s(a.next(e))}catch(e){i(e)}}function l(e){try{s(a.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof o?t:new o(function(e){e(t)})).then(r,l)}s((a=a.apply(e,t||[])).next())})};const _=(0,M.H)({name:"findagrave-frontend-contributor-photos"}),I=F.J1` query contributorPhotos($search: ContributorPhotoSearchInput) { contributorPhotos(search: $search) { photosWithContainers { container { ...on Cemetery{ __typename id locations { cemetery city county state country } } ...on Memorial { __typename id name { first last nickname maiden } birth { date { year } } death { date { year } } cemetery { id locations { cemetery city county state country } } manager { id } } } photos { id path dateCreated } } } } `,O=o(46010),q={unattached:o(44089),cemetery:o(70134),memorial:o(25936)},E=(e,t)=>{let o=[];if("cemetery"===t)o=e.cemeteries;else o=e.interments;if((null==o?void 0:o.length)>0){let a=n()(O.render(e));o.forEach(e=>{let o=q[t].render({contributorId:findagrave.contributorId,item:e}),i=t+"_"+e[("cemetery"===t?t:"interment")+"Id"];n()("#"+i).length>0?n()("#"+i+" .photo-added").append(n()(n().parseHTML(o)).find(".photo-added").children()):a.find("#paged-results").append(o)}),e.previousData?n()("#"+t+"-section").prepend(a):n()("#"+t+"-section").append(a),n()("#"+t+"-section").find("h1").removeClass("hidden")}};function z(e,t){let o=location.href;if(-1!==o.indexOf(t+"=")){let a=new RegExp(t+"=[^&]*");o=o.replace(a,t+"="+e)}else-1!==o.indexOf("#")&&(o=o.replace(/#.*/,"")),-1===o.indexOf("?")?o+="?":o+="&",o+=t+"="+e;location.href=o}n()(function(){new i.A;const e="c"===findagrave.type?"cemetery":"memorial",t=new URL(window.location.href),o=t.searchParams.get("pf"),a=t.searchParams.get("df"),[,r]=/\/(\d+)\//.exec(t.pathname),l=Number(r);let s="all";function c(t,o,n){return N(this,void 0,void 0,function*(){const{data:t,error:i}=yield _.query({query:I,variables:{search:{contributorId:l,type:e,source:s,dateFilter:a,skip:o,size:n}}});return function(e){let t=0;const o=e.contributorPhotos.photosWithContainers.map(e=>(t+=e.photos.length,{container:"Memorial"===e.container.__typename?H(e.container):Q(e.container),photos:e.photos.map(e=>{const t=new URL(e.path);return t.searchParams.set("size","photoThumbnails"),{dateCreated:e.dateCreated&&U.c9.fromISO(e.dateCreated).setLocale(findagrave.locale).toFormat("d LLL yyyy"),path:t.toString()}})}));return e={total:findagrave.total,photosInBatch:t},"c"===findagrave.type?e.cemeteries=o:e.interments=o,e}(t)})}"v"===o?s="volunteer":"t"===o&&(s="transcribe"),k({totalRecords:findagrave.total,currentPage:findagrave.page||1,pageSize:100,loadNextFunction:function(e,t,o){return N(this,void 0,void 0,function*(){const a=yield c(e,t,o);var n;findagrave.skip=function(){if(findagrave.total>A&&findagrave.skipA&&findagrave.skip-A>=-100)return findagrave.skip-A;return-20}(),a.page=e,(n=a)&&(n.previousData=!0,E(n,"memorial"),E(n,"cemetery"))})}}),new P("df","#daterange","#daterangevalue",z),n()("#photofilter").on("change",function(){"v"===n()(this).val()?location.href=location.href.replace(/photos\/.*/,"photos/m?pf=v"):"t"===n()(this).val()?location.href=location.href.replace(/photos\/.*/,"photos/m?pf=t"):location.href=location.href.replace(/photos\/.*/,"photos/m")}),n()("#memorial-section").on("click",".memorial-item",e=>{location.href=n()(e.currentTarget).find("a.memorial").attr("href")})});const A=100;function H(e){var t,o,a,n,i,r,l,s,c,d;return Object.assign(Object.assign({},e),{birthDate:(null===(o=null===(t=e.birth)||void 0===t?void 0:t.date)||void 0===o?void 0:o.year)||"unknown",deathDate:(null===(n=null===(a=e.death)||void 0===a?void 0:a.date)||void 0===n?void 0:n.year)||"unknown",locationName:(null===(i=e.cemetery)||void 0===i?void 0:i.locations)&&(0,$.Ue)(null===(l=null===(r=null==e?void 0:e.cemetery)||void 0===r?void 0:r.locations)||void 0===l?void 0:l[0],!0),nameForURL:W(e.name[0]),cemeteryNameForURL:(0,$.cs)(null===(d=null===(c=null===(s=null==e?void 0:e.cemetery)||void 0===s?void 0:s.locations)||void 0===c?void 0:c[0])||void 0===d?void 0:d.cemetery)})}function Q(e){var t,o,a,n;return Object.assign(Object.assign({},e),{name:(null===(t=e.locations[0])||void 0===t?void 0:t.cemetery)||"",locationName:(0,$.Ue)(null===(o=null==e?void 0:e.locations)||void 0===o?void 0:o[0],!0),nameForURL:(0,$.cs)(null===(n=null===(a=null==e?void 0:e.locations)||void 0===a?void 0:a[0])||void 0===n?void 0:n.cemetery)})}function W({first:e,last:t}){let[o,a]=[e,t].filter(e=>e&&""!==e.trim()).map(e=>e.replace(/\?+/g,"").replace(/&/g,"").replace(/&+/g,"")).map(e=>encodeURIComponent(e.toLocaleLowerCase().trim().replace(/\s+/g,"_").replace(/\/+/g,"").replace(/#+/g,"").replace(/\.+/g,"")));return j.default.t("mem.ovr.NameForURL",{first:o,last:a,divider:o&&a?"-":""})||[o,a].map(e=>e).join(o&&a?"-":"")}},11045(e,t,o){o.d(t,{Aq:()=>i,Ue:()=>n,cs:()=>r});const a=["cemetery","city","county","state","country"];function n(e,t=!1){return(t?a.slice(1):a).map(t=>e[t]).filter(e=>e).join(", ")}function i(e){return e.slice(1).map(e=>e.name).join(", ")}function r(e){return null==e?void 0:e.toLowerCase().replace(/\s+/g,"-")}}}]); //# sourceMappingURL=5359.38fa906df6a01a502fd7.js.map