"use strict";(self.webpackChunkfindagrave_frontend=self.webpackChunkfindagrave_frontend||[]).push([[1013,4400],{2440(e,t,a){var o=a(54802),i=a(69917),n=a(71757);function r(e){var t;e||(e=null===(t=/page=(\d+)/.exec(window.location.href))||void 0===t?void 0:t[1]),n("#gotoPage").val(e||"1")}function s(e){if(e.length>0){const t=n(e),a=n(window),o=a.scrollTop(),i=o+a.height(),r=t.offset().top,s=r+t.height();return t.height()>a.height()?s<=i&&s>=o||r>=o&&r<=i:s<=i&&r>=o}return!1}function l(e){const t=n(window).scrollTop(),a=n(window).height(),o=n(e).offset().top,i=n(e).height();return o+i-.25*i>t&&o500&&(f=500),g>1&&h("#back-to-top").removeClass("d-none"),"click"==p?(h("#load-next-page").closest("div").removeClass("hidden"),h("#load-previous-page").closest("div").removeClass("hidden")):"scroll"==p&&h("#content-placeholder").find("div").removeClass("invisible"),t>0&&0===h(window).scrollTop()&&h(window).scrollTop(1),r(),function({rowSelector:e,itemSelector:t,focusSelectorNext:a,focusSelectorPrevious:o,loadNextFunction:n,loadPreviousFunction:d,type:c}){h(document).on("click",t,function(t){!function(e){const t=new URL(window.location.href),a=new URLSearchParams(S);let o=e.closest(".list-item-page").attr("data-url").replace("page=","");e.attr("id")&&(o+="#"+e.attr("id"));const i=e.offset().top-h(window).scrollTop();a.set("page",o),history.replaceState({distanceFromTopFold:i},null,`${t.pathname}?${a.toString().replace(/%23/g,"#")}`)}(h(this).closest(e))});let x=0;h(window).on("scroll",function(){var t;"scroll"==p&&u{k(c,a,u)})),"scroll"==p&&x>h(window).scrollTop()&&g>1&&!y&&s(`${e}:first`)&&(y=!0,h("#loadpreviousajaxloader").show(),g--,d(g,C(g),v).then(e=>{L(c,o,g)})),Math.abs(h(window).scrollTop()-w)>.1*h(window).height()&&("normal"==c?(t=e,w=h(window).scrollTop(),h(".list-item-page").each(function(e){if(l(this)){const e=new URL(window.location.href),a=new URLSearchParams(S);let o=h(this).attr("data-url").replace("page=",""),i=h(this).attr("data-url");h(this).find(t).each(function(t){if(s(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(i)?h("#back-to-top").addClass("d-none"):h("#back-to-top").removeClass("d-none"),a.set("page",o),history.replaceState(null,null,`${e.pathname}?${a.toString().replace(/%23/g,"#")}`),r()),!1})}})):"suggestedEdits"==c&&function(e){w=h(window).scrollTop(),h(e).each(function(e){if(l(this)){const e=new URL(window.location.href),t=new URLSearchParams(S);let a=h(this).attr("data-url").replace("page=",""),o=h(this).attr("data-url");h(this).find("tr").each(function(i){if(s(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(o)?h("#back-to-top").addClass("d-none"):h("#back-to-top").removeClass("d-none"),t.set("page",a),history.replaceState(null,null,`${e.pathname}?${t.toString().replace(/%23/g,"#")}`),r()),!1})}})}(e)),x=h(window).scrollTop()}),h(document).on("click","#load-next-page",function(e){e.preventDefault(),"click"==p&&(m=!0,h("#loadmoreajaxloader").show(),u++,n(u,C(u),v).then(e=>{k(c,a,u)}))}),h(document).on("click","#load-previous-page",function(e){e.preventDefault(),"click"==p&&(y=!0,h("#loadpreviousajaxloader").show(),g--,d(g,C(g),v).then(e=>{L(c,o,g)}))}),"click"==p?(h("#load-next-page").closest("div").removeClass("hidden"),h("#load-previous-page").closest("div").removeClass("hidden")):"scroll"==p&&h("#content-placeholder").find("div").removeClass("invisible");h(document).on("change","#scrollLists",function(e){if(e.preventDefault(),e.stopPropagation(),h("#scrollLists").is(":checked")){p="scroll",g>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,i.kQ)().pref&&(0,i.TV)("pageLoadType","scroll",365)}else{p="click",h("#content-placeholder").find("div").addClass("invisible"),u1&&h("#load-previous-page").closest("div").removeClass("hidden"),(0,i.kQ)().pref&&(0,i.TV)("pageLoadType","click",365)}})}({itemSelector:d,rowSelector:n,focusSelectorNext:c,focusSelectorPrevious:x,loadNextFunction:$,loadPreviousFunction:T,type:e})}function C(e){return e*v-v}function k(e,t,a){u>=f&&h("#load-next-page").closest("div").addClass("hidden"),h("#loadmoreajaxloader").hide(),"normal"==e?h(t).trigger("focus"):"suggestedEdits"==e&&h(`tbody[data-page=${a}]`).next().find("a.fw-bold").trigger("focus"),m=!1}function L(e,t,a){if(g<=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=${a}]`).first().offset().top,t=h(`tbody[data-page=${a+1}]`).first().offset().top-e;window.scrollTo({top:h(window).scrollTop()+t,left:0,behavior:"instant"}),h(`tbody[data-page=${a+1}]`).prev().find("a.fw-bold").trigger("focus")}y=!1}var $=a(71757),T=a.n($),b=function(e,t,a,o){return new(a||(a=Promise))(function(i,n){function r(e){try{l(o.next(e))}catch(e){n(e)}}function s(e){try{l(o.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof a?t:new a(function(e){e(t)})).then(r,s)}l((o=o.apply(e,t||[])).next())})};const I=a(27907);T()(function(){new o.A,x({totalRecords:findagrave.total,currentPage:findagrave.page||1,loadNextFunction:function(e,t,a){return b(this,void 0,void 0,function*(){let o=yield T().ajax({url:"/new-listings",data:{ajax:!0,skip:t,famelevel:findagrave.famelevel,limit:a}});findagrave.skip=o.loadmore.next,o.page=e,o.currentView=findagrave.currentView||"default";const i=I.render(o);T()(".memorial-list-data").append(i)})},loadPreviousFunction:function(e,t,a){return b(this,void 0,void 0,function*(){let o=yield T().ajax({url:"/new-listings",data:{ajax:!0,skip:t,famelevel:findagrave.famelevel,limit:a}});findagrave.prev=o.loadmore.prev,o.page=e,o.currentView=findagrave.currentView||"default";const i=I.render(o);T()(".memorial-list-data").prepend(i)})}})})},69917(e,t,a){a.d(t,{Ri:()=>i,TV:()=>o,kQ:()=>n});a(71757);function o(e,t,a,o){let i="",n=`path= ${o&&o.length>0?o:"/"};`,r=`domain=.${location.hostname.split(".").slice(-2).join(".")};`;if(a){let e=new Date;e.setTime(e.getTime()+24*a*60*60*1e3),i=`expires=${e.toUTCString()};`}document.cookie=`${e}=${t};${i}${n}${r}SameSite=Lax;Secure;`}function i(e){let t=document.cookie.split("; ").find(t=>t.split("=")[0]===e);return t?t.split("=")[1]:""}function n(){var e=i("consentSettings"),t={pref:!1,ga:!1,aa:!1};try{t=JSON.parse(e)}catch(e){}return t}},11045(e,t,a){a.d(t,{Aq:()=>n,Ue:()=>i});const o=["cemetery","city","county","state","country"];function i(e,t=!1){return(t?o.slice(1):o).map(t=>e[t]).filter(e=>e).join(", ")}function n(e){return e.slice(1).map(e=>e.name).join(", ")}},99376(e,t,a){a.d(t,{v:()=>o});a(71757);function o(e){return e&&["city","county","state","country"].map(t=>e[t]).filter(e=>e).join(", ")}},51009(e,t,a){function o(e,t){return e&&t&&(e=e.includes("?")?`${e}&size=${t}`:`${e}?size=${t}`),e}function i(){return location.hostname.includes("localhost")||location.hostname.includes("gravelocal.com")?"https://images.gravedev.com":`https://images${location.hostname.substring(location.hostname.indexOf("."))}`}a.d(t,{N5:()=>i,nB:()=>o})},56533(e,t,a){a.d(t,{Ay:()=>h});var o=a(71757),i=a.n(o),n=(a(62427),a(29462)),r=a.n(n),s=a(39708),l=function(e,t,a,o){return new(a||(a=Promise))(function(i,n){function r(e){try{l(o.next(e))}catch(e){n(e)}}function s(e){try{l(o.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof a?t:new a(function(e){e(t)})).then(r,s)}l((o=o.apply(e,t||[])).next())})};const d=a(18510),c=a(53547);function h(){return{singleTypeahead:function(e){this.settings=i().extend({},this.defaults,e),this.changed=!1;const t=this,a=new TextEncoder;let o=new(r())({datumTokenizer:function(e){return r().tokenizers.whitespace(e.text)},queryTokenizer:r().tokenizers.whitespace,remote:{url:"/graphql/q=%prefix",wildcard:"%prefix",prepare:(e,t)=>(t.skipLoad=!/^\d+$/.test(e.trim())&&a.encode(e).length<3,t.name=e,t.url=t.url.replace("%prefix",e),t),transform:function(e){var a;return(null===(a=e.locationsByTypeahead)||void 0===a?void 0:a.locations.map(function(a){(a=Object.assign({},a)).text=["cemetery","city","county","state","country"].map(e=>a.locations[0][e]).filter(e=>e).join(", ").replace(/&/g,"&"),t.settings.displayId&&(a.text+=` (${a.id})`);const o=e.query.trim().split(/[\p{P}\s]+/u).filter(e=>e).map(e=>e.toLocaleLowerCase()),i=a.text.toLocaleLowerCase();return!o.every(e=>i.includes(e))&&a.highlight&&(a.text+=` (${a.highlight})`),a}))||[]},transport:(e,t,a)=>l(this,void 0,void 0,function*(){if(e.skipLoad)t([]);else{const{errors:o,data:i}=yield this.settings.apolloClient.query({query:s.J1` query locationTypeahead($search: LocationSearchInput) { locationsByTypeahead(search: $search) { total locations { ... on Location { id locations(format: short){ city county state country continent } names { name } coordinates { lat lon } highlight } ... on Cemetery { id locations(format: short){ cemetery city county state country continent } names { name } coordinates { lat lon } highlight } } } } `,variables:{search:{name:e.name,autocomplete:this.settings.autocomplete,categories:this.settings.type,havingCoordinates:this.settings.havingCoordinates,returnHighlight:!0}},errorPolicy:"all"});o?a(o):t(Object.assign(Object.assign({},i),{query:e.name.toLocaleLowerCase()}))}})}});this.typeaheadEl=i()(this.settings.inputId),this.typeahead=this.typeaheadEl.typeahead(this.settings.displayOptions,{name:this.settings.inputId.replace(/[#.]/,""),source:o.ttAdapter(),displayKey:"text",limit:5,templates:{notFound:function({query:e}){return!/^\d+$/.test(e.trim())&&a.encode(e).length<3?c.render():d.render()}}});const n=``;return this.typeaheadEl.addClass("form-control").after(n).parent().addClass("form-floating"),this.clearLocation=this.typeaheadEl.parents(".btn-group, .input-group").find(".clear-search"),this.targetId=i()(this.settings.targetId),this.typeahead.on("typeahead:autocomplete typeahead:select",function(e,a){t.targetId.val(null==a?void 0:a.id).data("d",a),t.typeahead.trigger("typeahead:set",[a]),t.targetId.trigger("change"),t.topSuggestion=a,t.clearLocation.removeClass("hidden")}).on("typeahead:change",function(e){var o;t.settings.onChange.call(t,e),!t.targetId.val().trim()&&a.encode(t.typeahead.typeahead("val").trim()).length>=3&&(t.changed=!0,null===(o=t.settings.onEmpty)||void 0===o||o.call(t))}).on("typeahead:render",function(e,a){a&&a.length>0&&a[0]&&(t.topSuggestion=a[0])}),t.typeahead.typeahead("val")&&t.typeahead.typeahead("val").trim().length>0&&t.clearLocation.removeClass("hidden"),t.clearLocation.on("click",function(){t.typeahead.typeahead("val",""),t.typeahead.trigger("typeahead:clear"),t.typeahead.trigger("focus"),t.targetId.val("").removeData("d"),t.targetId.trigger("change"),t.topSuggestion=null,i()(this).addClass("hidden")}),t.typeaheadEl.on("keydown",function(e){var o;if(13==e.which||9==e.which){a.encode(t.typeahead.typeahead("val").trim()).length>=3?t.topSuggestion?(t.targetId.val(t.topSuggestion.id).data("d",t.topSuggestion),t.typeahead.typeahead("val",t.topSuggestion.text),t.typeahead.trigger("typeahead:set",[t.topSuggestion]),t.targetId.trigger("change"),t.clearLocation.removeClass("hidden")):e.preventDefault():t.typeahead.typeahead("val","")}else["arrowup","arrowdown","arrowleft","arrowright","end","home","pagedown","pageup","meta","control","alt"].includes(null===(o=e.key)||void 0===o?void 0:o.toLowerCase())||e.metaKey||e.ctrlKey||(t.topSuggestion=null);return i()(this).val().trim().length>0?t.clearLocation.removeClass("hidden"):t.clearLocation.addClass("hidden"),t.settings.enterSubmitsForm||13!=e.which}).on("click",function(e){t.topSuggestion&&t.typeahead.typeahead("val").trim().length>=3&&(t.targetId.val(t.topSuggestion.id).data("d",t.topSuggestion),t.typeahead.typeahead("val",t.topSuggestion.text),t.typeahead.trigger("typeahead:set",[t.topSuggestion]),t.targetId.trigger("change"),t.typeahead.typeahead("close"),t.clearLocation.removeClass("hidden"))}),t},defaults:{inputId:"#location",targetId:"#locationId",type:p,autocomplete:"location",enterSubmitsForm:!0,noContinents:!1,displayId:!1,displayOptions:{hint:!0,highlight:!0,minLength:1},onEmpty:!1,clearEmpty:!1,onChange:function(e){this.typeahead.typeahead("val").trim().length>=3?(this.topSuggestion?(this.targetId.val(this.topSuggestion.id).data("d",this.topSuggestion),this.typeahead.trigger("typeahead:set",[this.topSuggestion]),this.targetId.trigger("change"),this.typeahead.typeahead("val",this.topSuggestion.text),this.typeahead.typeahead("close")):this.targetId.val("").removeData("d"),this.clearLocation.removeClass("hidden")):(this.targetId.val("").removeData("d"),this.typeahead.trigger("typeahead:clear"),this.targetId.trigger("change"),this.clearLocation.addClass("hidden"))}}}}const p=["loc"]}}]); //# sourceMappingURL=1013.1021fbf242aa4a95e94c.js.map