"use strict";(self.webpackChunkfindagrave_frontend=self.webpackChunkfindagrave_frontend||[]).push([[4400,4890],{69917(e,t,a){a.d(t,{Ri:()=>i,TV:()=>n,kQ:()=>o});a(71757);function n(e,t,a,n){let i="",o=`path= ${n&&n.length>0?n:"/"};`,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}${o}${r}SameSite=Lax;Secure;`}function i(e){let t=document.cookie.split("; ").find(t=>t.split("=")[0]===e);return t?t.split("=")[1]:""}function o(){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:()=>o,Ue:()=>i});const n=["cemetery","city","county","state","country"];function i(e,t=!1){return(t?n.slice(1):n).map(t=>e[t]).filter(e=>e).join(", ")}function o(e){return e.slice(1).map(e=>e.name).join(", ")}},99376(e,t,a){a.d(t,{v:()=>n});a(71757);function n(e){return e&&["city","county","state","country"].map(t=>e[t]).filter(e=>e).join(", ")}},51009(e,t,a){function n(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:()=>n})},24365(e,t,a){a.d(t,{Y:()=>r,f:()=>o});var n=a(71757),i=function(e,t,a,n){return new(a||(a=Promise))(function(i,o){function r(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(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((n=n.apply(e,t||[])).next())})};function o(e){return i(this,void 0,void 0,function*(){var t;function a(e){let t="";return n("#photoId").length>0&&(t=n("#photoId").val().trim()),new Promise((a,i)=>n.ajax({type:"POST",url:"/user/"+contrib+"/add-photo",data:{photo:e,photoId:t,publicNote:n("#publicNote").val().trim(),"x-csrf-token":n("#x-csrf-token").val()}}).done(()=>{e&&r(`https://${window.location.hostname.replace(/^[^.]+/,"images")}/photos250/${e}`),a()}).fail(function(e){var t;i((null===(t=null==e?void 0:e.responseJSON)||void 0===t?void 0:t.errMsg)||"ServerError")}))}n("#photoMissing").addClass("hidden"),e.preventDefault();const i=null===(t=n("input[type=file]")[0].files)||void 0===t?void 0:t[0];if((null==i?void 0:i.size)>20971520)return n("#i18n-sizeExceeded").removeClass("hidden"),!1;const o=(null==i?void 0:i.type.replace("image/",""))||(null==i?void 0:i.name.substring(i.name.lastIndexOf(".")+1).toLowerCase()),s=["heic","heif","jpg","png","webp","jpeg"].includes(o);if(s){const e=n("#saveProfilePhoto"),t=e.text();e.text(findagrave.saving).prop("disabled",!0),n("#deleteProfilePhoto, #cancel").hide();try{const[e,t]=yield new Promise((e,t)=>{n.getJSON(`/user/${contrib}/photo-url/${o}?target=user&ts=${Date.now()}`).done(function(t){let a=new FormData;a.append("key",t.key),a.append("Content-type",`image/${o}`),a.append("acl","private"),n.each(t.fields,function(e,t){"key"!==e&&a.append(e,t)}),a.append("file",i),e([a,t])}).fail(()=>t())});yield new Promise((a,i)=>{n.ajax({type:"POST",url:t.url,data:e,cache:!1,contentType:!1,processData:!1}).done(function(e,t,n){a()}).fail(()=>i())}),yield a(t.key)}catch(e){n("#ServerError").removeClass("hidden")}finally{e.text(t).prop("disabled",!1),n("#deleteProfilePhoto, #cancel").show()}}else if(n("#photoId").val())try{yield a(null),n("#caption").html(n("#publicNote").val()),n("#change-avtar").modal("hide")}catch(e){n(`#${e}`).removeClass("hidden")}else s?n("#photoMissing").removeClass("hidden"):n("#InvalidType").removeClass("hidden");return!1})}function r(e){n("#avtar-pic").attr("src",e);const t=n(".bio-pic").find("img");t.length>0?t.attr("src",e):n("a.bio-pic").html(`
`),n("#change-avtar").modal("hide")}},56533(e,t,a){a.d(t,{Ay:()=>h});var n=a(71757),i=a.n(n),o=(a(62427),a(29462)),r=a.n(o),s=a(39708),l=function(e,t,a,n){return new(a||(a=Promise))(function(i,o){function r(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(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((n=n.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 n=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 n=e.query.trim().split(/[\p{P}\s]+/u).filter(e=>e).map(e=>e.toLocaleLowerCase()),i=a.text.toLocaleLowerCase();return!n.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:n,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"});n?a(n):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:n.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 o=``;return this.typeaheadEl.addClass("form-control").after(o).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 n;t.settings.onChange.call(t,e),!t.targetId.val().trim()&&a.encode(t.typeahead.typeahead("val").trim()).length>=3&&(t.changed=!0,null===(n=t.settings.onEmpty)||void 0===n||n.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 n;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===(n=e.key)||void 0===n?void 0:n.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=4890.6d76affed4c115be9793.js.map