JezK
Edit File: view.js
(()=>{"use strict";var t={5338:(t,e,n)=>{var r=n(5795);e.H=r.createRoot,r.hydrateRoot},5795:t=>{t.exports=window.ReactDOM}},e={};const n=window.React;var r=function n(r){var o=e[r];if(void 0!==o)return o.exports;var a=e[r]={exports:{}};return t[r](a,a.exports,n),a.exports}(5338);const o=t=>{try{const e=new URL(t);return["http:","https:"].includes(e.protocol)?e.toString():null}catch(e){return"string"==typeof t&&t.startsWith("/")&&!t.startsWith("//")?t:null}};const a="linear-gradient(135deg, #0040E3, #18D4FD)",s=t=>{const e=o(t);if(!e)return"none";return`url('${e.replace(/['"()]/g,"")}')`},i=(t,e)=>{return null==(n=e)||""===n||Array.isArray(n)&&0===n.length||"object"==typeof n&&0===Object.keys(n).length||"string"==typeof n&&""===n.trim()||"number"==typeof n&&0===n?"":`${t}: ${e};`;var n},c=(t,e=!0,n=!0,r=!0)=>{const{type:o="solid",color:c="",gradient:l=a,image:u={},position:d="center center",attachment:p="",repeat:f="no-repeat",size:y="",overlayColor:m=""}=t||{};return"gradient"===o&&n?i("background",l):"image"===o&&r?`background: ${s(u?.url)};\n\t\t\t\t${i("background-color",m)}\n\t\t\t\t${i("background-position",d)}\n\t\t\t\t${i("background-size",y)}\n\t\t\t\t${i("background-repeat",f)}\n\t\t\t\t${i("background-attachment",p)}\n\t\t\t\t${i("background-repeat",f)}\n\t\t\t\tbackground-blend-mode: overlay;`:e&&i("background",c)},l=(t,e,n=!0)=>{const{fontFamily:r="Default",fontCategory:o="sans-serif",fontVariant:a=400,fontWeight:s,isUploadFont:c=!0,fontSize:l={desktop:null,tablet:null,mobile:null},fontStyle:u,textTransform:d,textDecoration:p,lineHeight:f,letterSpace:y}=e||{},m=!n||!r||"Default"===r,h=l?.desktop||l,_=l?.tablet||h,g=l?.mobile||_,b=t=>{const e=String(t);return["px","em","rem","%","vh","vw"].some((t=>e.endsWith(t)))?e:"number"==typeof t?`${e}px`:""},$=`\n\t\t${m?"":`font-family: '${r}', ${o};`}\n\t\t${i("font-weight",s)}\n\t\t${i("font-size",b(h))}\n\t\t${i("font-style",u)}\n\t\t${i("text-transform",d)}\n\t\t${i("text-decoration",p)}\n\t\t${i("line-height",f)}\n\t\t${i("letter-spacing",y)}\n\t`,v=a&&400!==a?"400i"===a?":ital@1":a?.includes("00i")?`: ital, wght@1, ${a?.replace("00i","00")} `:`: wght@${a} `:"",w=m?"":`https://fonts.googleapis.com/css2?family=${r?.split(" ").join("+")}${v.replace(/ /g,"")}&display=swap`;return{googleFontLink:!c||m?"":`@import url(${w});`,styles:`${t}{\n\t\t\t${$}\n\t\t}\n\t\t@media only screen and (max-width: 1024px) {\n\t\t\t${t}{\n\t\t\t\t${i("font-size",b(_))}\n\t\t\t}\n\t\t}\n\t\t@media only screen and (max-width: 640px) {\n\t\t\t${t}{\n\t\t\t\t${i("font-size",b(g))}\n\t\t\t}\n\t\t}`.replace(/\s+/g," ").trim()}},u=t=>{if(!t)return"";if("string"==typeof t)return t;if("object"==typeof t&&!Array.isArray(t)){const e=["top","right","bottom","left"];return e.map((e=>t[e]||"")).every((t=>!t))?"":e.map((e=>t[e]||"0")).join(" ")}return""},d=({attributes:t,id:e})=>{const{styles:r,layout:o}=t,a=`${`#${e}`} .bpsc-storytelling-section`,s=`${a} .hero`,i=`${a} .hero h2`,d=`${a} .hero p`,p=`${a} .story-container`,f=`${p} .story-text`,y=`${f} .chapter-meta`,m=`${f} h2`,h=`${f} .story-description`,_=`${f} .quote`,g=`${a} .story-media`,b=`${g} .image-overlay`;return(0,n.createElement)("style",{dangerouslySetInnerHTML:{__html:`\n\t\t\n\t\t${l("",r?.section?.header?.typo)?.googleFontLink}\n\t\t${l("",r?.section?.description?.typo)?.googleFontLink}\n\t\t${l("",r?.story?.chapterMeta?.typo)?.googleFontLink}\n\t\t${l("",r?.story?.title?.typo)?.googleFontLink}\n\t\t${l("",r?.story?.description?.typo)?.googleFontLink}\n\t\t${l("",r?.story?.quote?.typo)?.googleFontLink}\n\t\t${l("",r?.story?.overlay?.typo)?.googleFontLink}\n\t\t\t\t\n \t${l(i,r?.section?.header?.typo)?.styles}\n \t${l(d,r?.section?.description?.typo)?.styles}\n \t${l(y,r?.story?.chapterMeta?.typo)?.styles}\n \t${l(m,r?.story?.title?.typo)?.styles}\n \t${l(h,r?.story?.description?.typo)?.styles}\n \t${l(_,r?.story?.quote?.typo)?.styles}\n \t${l(b,r?.story?.overlay?.typo)?.styles}\n\n\n\t\t${a} {\n \t\tmargin:${u(o?.section?.margin?.desktop)};\n \t\tpadding:${u(o?.section?.padding?.desktop)};\n\t\t}\n\n\t\t${s}{\n\t\t\t${c(r?.section?.upperBg)}\n\t\t}\n\n\t\t${i}{\n\t\t\tcolor:${r?.section?.header?.color};\n\t\t}\n\n\t\t${d}{\n\t\t\tcolor:${r?.section?.description?.color};\n\t\t}\n\n\t\t${p}{\n\t\t\t${c(r?.section?.lowerBg)}\n\t\t}\n\n\t\t${y}{\n\t\t\tcolor:${r?.story?.chapterMeta?.color};\n\t\t}\n\t\t${m}{\n\t\t\tcolor:${r?.story?.title?.color};\n\t\t}\n\t\t${h}{\n\t\t\tcolor:${r?.story?.description?.color};\n\t\t}\n\t\t${_}{\n\t\t\tcolor:${r?.story?.quote?.color};\n\t\t\tborder-left: 4px solid ${r?.story?.quoteBorderColor};\n\t\t}\n\n\t\t${g}{\n\t\t\tborder-radius: ${u(o?.imageContainer?.borderRadius)};\n\t\t}\n\n\t\t${b}{\n\t\t\tcolor:${r?.story?.overlay?.color};\n\t\t}\n\n\t\t@media (min-width:641px) and (max-width: 1024px){\n\t\t\t${a} {\n\t\t\t\tmargin:${u(o?.section?.margin?.tablet)};\n\t\t\t\tpadding:${u(o?.section?.padding?.tablet)};\n\t\t\t}\n\t\t} \n\n\t\t@media (max-width: 480px){\n\t\t\t${a} {\n\t\t\t\tmargin:${u(o?.section?.margin?.mobile)};\n\t\t\t\tpadding:${u(o?.section?.padding?.mobile)};\n\t\t\t}\n\t\t}\n\n\t`}})};var p=Symbol.for("immer-nothing"),f=Symbol.for("immer-draftable"),y=Symbol.for("immer-state");function m(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var h=Object.getPrototypeOf;function _(t){return!!t&&!!t[y]}function g(t){return!!t&&($(t)||Array.isArray(t)||!!t[f]||!!t.constructor?.[f]||x(t)||k(t))}var b=Object.prototype.constructor.toString();function $(t){if(!t||"object"!=typeof t)return!1;const e=h(t);if(null===e)return!0;const n=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===b}function v(t,e){0===w(t)?Reflect.ownKeys(t).forEach((n=>{e(n,t[n],t)})):t.forEach(((n,r)=>e(r,n,t)))}function w(t){const e=t[y];return e?e.type_:Array.isArray(t)?1:x(t)?2:k(t)?3:0}function E(t,e){return 2===w(t)?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function S(t,e,n){const r=w(t);2===r?t.set(e,n):3===r?t.add(n):t[e]=n}function x(t){return t instanceof Map}function k(t){return t instanceof Set}function z(t){return t.copy_||t.base_}function P(t,e){if(x(t))return new Map(t);if(k(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=$(t);if(!0===e||"class_only"===e&&!n){const e=Object.getOwnPropertyDescriptors(t);delete e[y];let n=Reflect.ownKeys(e);for(let r=0;r<n.length;r++){const o=n[r],a=e[o];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(e[o]={configurable:!0,writable:!0,enumerable:a.enumerable,value:t[o]})}return Object.create(h(t),e)}{const e=h(t);if(null!==e&&n)return{...t};const r=Object.create(e);return Object.assign(r,t)}}function F(t,e=!1){return O(t)||_(t)||!g(t)||(w(t)>1&&(t.set=t.add=t.clear=t.delete=L),Object.freeze(t),e&&Object.entries(t).forEach((([t,e])=>F(e,!0)))),t}function L(){m(2)}function O(t){return Object.isFrozen(t)}var A,j={};function C(t){const e=j[t];return e||m(0),e}function N(){return A}function D(t,e){e&&(C("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function R(t){M(t),t.drafts_.forEach(Y),t.drafts_=null}function M(t){t===A&&(A=t.parent_)}function q(t){return A={drafts_:[],parent_:A,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Y(t){const e=t[y];0===e.type_||1===e.type_?e.revoke_():e.revoked_=!0}function W(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return void 0!==t&&t!==n?(n[y].modified_&&(R(e),m(4)),g(t)&&(t=H(e,t),e.parent_||T(e,t)),e.patches_&&C("Patches").generateReplacementPatches_(n[y].base_,t,e.patches_,e.inversePatches_)):t=H(e,n,[]),R(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==p?t:void 0}function H(t,e,n){if(O(e))return e;const r=e[y];if(!r)return v(e,((o,a)=>I(t,r,e,o,a,n))),e;if(r.scope_!==t)return e;if(!r.modified_)return T(t,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const e=r.copy_;let o=e,a=!1;3===r.type_&&(o=new Set(e),e.clear(),a=!0),v(o,((o,s)=>I(t,r,e,o,s,n,a))),T(t,e,!1),n&&t.patches_&&C("Patches").generatePatches_(r,n,t.patches_,t.inversePatches_)}return r.copy_}function I(t,e,n,r,o,a,s){if(_(o)){const s=H(t,o,a&&e&&3!==e.type_&&!E(e.assigned_,r)?a.concat(r):void 0);if(S(n,r,s),!_(s))return;t.canAutoFreeze_=!1}else s&&n.add(o);if(g(o)&&!O(o)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;H(t,o),e&&e.scope_.parent_||"symbol"==typeof r||!Object.prototype.propertyIsEnumerable.call(n,r)||T(t,o)}}function T(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&F(e,n)}var U={get(t,e){if(e===y)return t;const n=z(t);if(!E(n,e))return function(t,e,n){const r=X(e,n);return r?"value"in r?r.value:r.get?.call(t.draft_):void 0}(t,n,e);const r=n[e];return t.finalized_||!g(r)?r:r===K(t.base_,e)?(V(t),t.copy_[e]=G(r,t)):r},has:(t,e)=>e in z(t),ownKeys:t=>Reflect.ownKeys(z(t)),set(t,e,n){const r=X(z(t),e);if(r?.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const r=K(z(t),e),s=r?.[y];if(s&&s.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(((o=n)===(a=r)?0!==o||1/o==1/a:o!=o&&a!=a)&&(void 0!==n||E(t.base_,e)))return!0;V(t),J(t)}var o,a;return t.copy_[e]===n&&(void 0!==n||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_[e]=!0),!0},deleteProperty:(t,e)=>(void 0!==K(t.base_,e)||e in t.base_?(t.assigned_[e]=!1,V(t),J(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0),getOwnPropertyDescriptor(t,e){const n=z(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r?{writable:!0,configurable:1!==t.type_||"length"!==e,enumerable:r.enumerable,value:n[e]}:r},defineProperty(){m(11)},getPrototypeOf:t=>h(t.base_),setPrototypeOf(){m(12)}},B={};function K(t,e){const n=t[y];return(n?z(n):t)[e]}function X(t,e){if(!(e in t))return;let n=h(t);for(;n;){const t=Object.getOwnPropertyDescriptor(n,e);if(t)return t;n=h(n)}}function J(t){t.modified_||(t.modified_=!0,t.parent_&&J(t.parent_))}function V(t){t.copy_||(t.copy_=P(t.base_,t.scope_.immer_.useStrictShallowCopy_))}v(U,((t,e)=>{B[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}})),B.deleteProperty=function(t,e){return B.set.call(this,t,e,void 0)},B.set=function(t,e,n){return U.set.call(this,t[0],e,n,t[0])};function G(t,e){const n=x(t)?C("MapSet").proxyMap_(t,e):k(t)?C("MapSet").proxySet_(t,e):function(t,e){const n=Array.isArray(t),r={type_:n?1:0,scope_:e?e.scope_:N(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,a=U;n&&(o=[r],a=B);const{revoke:s,proxy:i}=Proxy.revocable(o,a);return r.draft_=i,r.revoke_=s,i}(t,e);return(e?e.scope_:N()).drafts_.push(n),n}function Q(t){if(!g(t)||O(t))return t;const e=t[y];let n;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=P(t,e.scope_.immer_.useStrictShallowCopy_)}else n=P(t,!0);return v(n,((t,e)=>{S(n,t,Q(e))})),e&&(e.finalized_=!1),n}var Z=new class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,e,n)=>{if("function"==typeof t&&"function"!=typeof e){const n=e;e=t;const r=this;return function(t=n,...o){return r.produce(t,(t=>e.call(this,t,...o)))}}let r;if("function"!=typeof e&&m(6),void 0!==n&&"function"!=typeof n&&m(7),g(t)){const o=q(this),a=G(t,void 0);let s=!0;try{r=e(a),s=!1}finally{s?R(o):M(o)}return D(o,n),W(r,o)}if(!t||"object"!=typeof t){if(r=e(t),void 0===r&&(r=t),r===p&&(r=void 0),this.autoFreeze_&&F(r,!0),n){const e=[],o=[];C("Patches").generateReplacementPatches_(t,r,e,o),n(e,o)}return r}m(1)},this.produceWithPatches=(t,e)=>{if("function"==typeof t)return(e,...n)=>this.produceWithPatches(e,(e=>t(e,...n)));let n,r;return[this.produce(t,e,((t,e)=>{n=t,r=e})),n,r]},"boolean"==typeof t?.autoFreeze&&this.setAutoFreeze(t.autoFreeze),"boolean"==typeof t?.useStrictShallowCopy&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){g(t)||m(8),_(t)&&(t=function(t){_(t)||m(10);return Q(t)}(t));const e=q(this),n=G(t,void 0);return n[y].isManual_=!0,M(e),n}finishDraft(t,e){const n=t&&t[y];n&&n.isManual_||m(9);const{scope_:r}=n;return D(r,e),W(void 0,r)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const r=e[n];if(0===r.path.length&&"replace"===r.op){t=r.value;break}}n>-1&&(e=e.slice(n+1));const r=C("Patches").applyPatches_;return _(t)?r(t,e):this.produce(t,(t=>r(t,e)))}},tt=Z.produce;Z.produceWithPatches.bind(Z),Z.setAutoFreeze.bind(Z),Z.setUseStrictShallowCopy.bind(Z),Z.applyPatches.bind(Z),Z.createDraft.bind(Z),Z.finishDraft.bind(Z);const et=(t,e,...n)=>{if(0===n.length)return e;const[r,...o]=n;return 0===o.length?tt(t,(t=>{t[r]=e})):tt(t,(t=>{Object.prototype.hasOwnProperty.call(t,r)||(t[r]={}),t[r]=et(t[r],e,...o)}))},nt=window.wp.blockEditor,rt=window.wp.i18n,ot=({attributes:t,setAttributes:e,isBackend:r=!1})=>{const o=(0,n.useRef)([]),a=(0,n.useRef)([]),s=(0,n.useRef)(!1),i=(0,n.useRef)(0),c=(0,n.useRef)(null),{storyData:l,heading:u,options:d}=t||[],p=(0,n.useCallback)((()=>{const t=window.scrollY,e=window.innerHeight;a.current.forEach((n=>{if(!n)return;const r=n.closest(".story-card");if(!r)return;const o=r.getBoundingClientRect(),a=(o.top+t+o.height/2-(t+e/2))/(.8*e);let s=Math.min(.2,Math.max(-.2,.6*a));const i=document.documentElement.scrollHeight-e;s+=.08*((i>0?t/i:0)-.5);const c=20*s;r.classList.contains("active")?(n.style.transform=`translateY(${c}%) scale(1.02)`,n.style.transition="transform 0.2s cubic-bezier(0.2, 0.9, 0.4, 1.1)"):(n.style.transform=`translateY(${c}%)`,n.style.transition="transform 0.1s linear")}))}),[]),f=(0,n.useCallback)((()=>{s.current||(requestAnimationFrame((()=>{p(),s.current=!1})),s.current=!0)}),[p]),y=(0,n.useCallback)((()=>{p()}),[p]),m=(0,n.useCallback)((t=>{i.current=t.clientX/window.innerWidth-.5;const e=document.querySelector(".story-card.active");if(e){const t=e.querySelector(".parallax-image");if(t){const e=t.style.transform,n=e.match(/translateY\(([-\d.]+)%\)/),r=n?n[1]:"0",o=e.includes("scale");t.style.transform=o?`translateY(${r}%) translateX(${14*i.current}px) scale(1.02)`:`translateY(${r}%) translateX(${14*i.current}px)`}}}),[]),h=(0,n.useCallback)((()=>{a.current.forEach((t=>{if(t){const e=t.style.transform.match(/translateY\(([-\d.]+)%\)/);e&&(t.style.transform=`translateY(${e[1]}%)`)}}))}),[]);return(0,n.useEffect)((()=>(c.current=new IntersectionObserver((t=>{t.forEach((t=>{const e=t.target;t.isIntersecting?e.classList.add("active"):e.classList.remove("active")}))}),{threshold:.4,rootMargin:"0px 0px -15% 0px"}),o.current.forEach((t=>{t&&c.current.observe(t)})),()=>{c.current&&c.current.disconnect()})),[]),(0,n.useEffect)((()=>(window.addEventListener("scroll",f),window.addEventListener("resize",y),document.addEventListener("mousemove",m),document.addEventListener("mouseleave",h),p(),()=>{window.removeEventListener("scroll",f),window.removeEventListener("resize",y),document.removeEventListener("mousemove",m),document.removeEventListener("mouseleave",h)})),[f,y,m,h,p]),(0,n.useEffect)((()=>{o.current.forEach(((t,e)=>{t&&(t.style.opacity="0",t.style.transform="translateY(30px)",setTimeout((()=>{t.style.transition="opacity 0.6s ease, transform 0.6s ease",t.style.opacity="1",t.style.transform="translateY(0)"}),150*e))}))}),[]),(0,n.useEffect)((()=>{a.current.forEach((t=>{t&&(t.complete?t.classList.add("loaded"):t.addEventListener("load",(()=>{t.classList.add("loaded"),p()})))}))}),[p]),(0,n.createElement)("div",{className:"bpsc-storytelling-section"},u?.status&&(0,n.createElement)("section",{className:"hero"},r?(0,n.createElement)(n.Fragment,null,(0,n.createElement)(nt.RichText,{tagName:"h2",value:u?.title,onChange:t=>e({heading:et(u,t,"title")}),placeholder:(0,rt.__)("title...")}),(0,n.createElement)(nt.RichText,{tagName:"p",value:u?.description,onChange:t=>e({heading:et(u,t,"description")}),placeholder:(0,rt.__)("description...")})):(0,n.createElement)(n.Fragment,null,(0,n.createElement)("h1",{dangerouslySetInnerHTML:{__html:u?.title}}),(0,n.createElement)("p",{dangerouslySetInnerHTML:{__html:u?.description}})),d?.isDownArrow&&(0,n.createElement)("div",{className:"scroll-indicator"},"↓")),(0,n.createElement)("div",{className:"story-container"},(0,n.createElement)("div",{className:"story-grid"},l.map(((t,e)=>(0,n.createElement)("div",{key:e,className:"story-card","data-index":e,ref:t=>o.current[e]=t},(0,n.createElement)("div",{className:"story-text"},(0,n.createElement)("div",{className:"chapter-meta"},t.chapter),(0,n.createElement)("h2",null,t.title),(0,n.createElement)("p",{className:"story-description"},t.description),(0,n.createElement)("p",{className:"quote"},t.quote)),(0,n.createElement)("div",{className:"story-media"},(0,n.createElement)("img",{className:"parallax-image",src:t.imageUrl,alt:t.alt,loading:"lazy",ref:t=>a.current[e]=t}),t.overlay&&(0,n.createElement)("div",{className:"image-overlay"},t.overlay))))))))};document.addEventListener("DOMContentLoaded",(()=>{document.querySelectorAll(".wp-block-bpsc-storytelling-section").forEach((t=>{const e=JSON.parse(t.dataset.attributes);(0,r.H)(t).render((0,n.createElement)(n.Fragment,null,(0,n.createElement)(d,{attributes:e,id:t.id}),(0,n.createElement)(ot,{attributes:e}))),t?.removeAttribute("data-attributes")}))}))})();