@liforma/client 0.4.10 → 0.4.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/CHANGELOG.md +10 -1
  2. package/dist/next/index.js +754 -618
  3. package/dist/next/index.js.map +1 -1
  4. package/dist/next/react/ExperienceThumbnail.d.ts +2 -0
  5. package/dist/next/react/ExperienceThumbnail.d.ts.map +1 -1
  6. package/dist/next/react/ExperienceWidget.d.ts +3 -0
  7. package/dist/next/react/ExperienceWidget.d.ts.map +1 -1
  8. package/dist/next/thumbnail/expandAssetUrl.d.ts +17 -0
  9. package/dist/next/thumbnail/expandAssetUrl.d.ts.map +1 -0
  10. package/dist/next/thumbnail/expandAssetUrl.test.d.ts +2 -0
  11. package/dist/next/thumbnail/expandAssetUrl.test.d.ts.map +1 -0
  12. package/dist/next/thumbnail/index.d.ts +3 -0
  13. package/dist/next/thumbnail/index.d.ts.map +1 -1
  14. package/dist/next/thumbnail/locationPlate.d.ts +13 -0
  15. package/dist/next/thumbnail/locationPlate.d.ts.map +1 -0
  16. package/dist/next/thumbnail/locationPlate.test.d.ts +2 -0
  17. package/dist/next/thumbnail/locationPlate.test.d.ts.map +1 -0
  18. package/dist/next/thumbnail/styles.d.ts.map +1 -1
  19. package/dist/next/thumbnail/toGalleryThumbUrl.d.ts +12 -2
  20. package/dist/next/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
  21. package/dist/next/thumbnail/types.d.ts +7 -1
  22. package/dist/next/thumbnail/types.d.ts.map +1 -1
  23. package/dist/next/thumbnail.js +273 -192
  24. package/dist/next/thumbnail.js.map +1 -1
  25. package/dist/next/v2/embed/iframeHost.d.ts +3 -0
  26. package/dist/next/v2/embed/iframeHost.d.ts.map +1 -1
  27. package/dist/next/v2/embed/protocol.d.ts +21 -0
  28. package/dist/next/v2/embed/protocol.d.ts.map +1 -1
  29. package/dist/next/v2/experience.d.ts +20 -0
  30. package/dist/next/v2/experience.d.ts.map +1 -1
  31. package/dist/next/v2/shims/embedBaseUrl.d.ts +15 -1
  32. package/dist/next/v2/shims/embedBaseUrl.d.ts.map +1 -1
  33. package/dist/next/v2/types/stage.d.ts +8 -0
  34. package/dist/next/v2/types/stage.d.ts.map +1 -0
  35. package/dist/next/widget/mountExperienceWidget.d.ts.map +1 -1
  36. package/dist/npm/index.js +557 -449
  37. package/dist/npm/index.js.map +1 -1
  38. package/dist/npm/thumbnail/expandAssetUrl.d.ts +17 -0
  39. package/dist/npm/thumbnail/expandAssetUrl.d.ts.map +1 -0
  40. package/dist/npm/thumbnail/index.d.ts +3 -0
  41. package/dist/npm/thumbnail/index.d.ts.map +1 -1
  42. package/dist/npm/thumbnail/index.js +151 -75
  43. package/dist/npm/thumbnail/index.js.map +1 -1
  44. package/dist/npm/thumbnail/locationPlate.d.ts +13 -0
  45. package/dist/npm/thumbnail/locationPlate.d.ts.map +1 -0
  46. package/dist/npm/thumbnail/styles.d.ts.map +1 -1
  47. package/dist/npm/thumbnail/toGalleryThumbUrl.d.ts +12 -2
  48. package/dist/npm/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
  49. package/dist/npm/thumbnail/types.d.ts +7 -1
  50. package/dist/npm/thumbnail/types.d.ts.map +1 -1
  51. package/dist/npm/v2/embed/iframeHost.d.ts +3 -0
  52. package/dist/npm/v2/embed/iframeHost.d.ts.map +1 -1
  53. package/dist/npm/v2/embed/protocol.d.ts +21 -0
  54. package/dist/npm/v2/embed/protocol.d.ts.map +1 -1
  55. package/dist/npm/v2/experience.d.ts +20 -0
  56. package/dist/npm/v2/experience.d.ts.map +1 -1
  57. package/dist/npm/v2/index.d.ts +1 -0
  58. package/dist/npm/v2/index.d.ts.map +1 -1
  59. package/dist/npm/v2/liforma-experience-thumbnail.d.ts.map +1 -1
  60. package/dist/npm/v2/liforma-experience.d.ts.map +1 -1
  61. package/dist/npm/v2/npm.d.ts +1 -0
  62. package/dist/npm/v2/npm.d.ts.map +1 -1
  63. package/dist/npm/v2/shims/embedBaseUrl.d.ts +15 -1
  64. package/dist/npm/v2/shims/embedBaseUrl.d.ts.map +1 -1
  65. package/dist/npm/v2/types/stage.d.ts +8 -0
  66. package/dist/npm/v2/types/stage.d.ts.map +1 -0
  67. package/dist/npm/widget/mountExperienceWidget.d.ts.map +1 -1
  68. package/dist/react/component/experienceComponentRuntime.d.ts +3 -0
  69. package/dist/react/component/experienceComponentRuntime.d.ts.map +1 -1
  70. package/dist/react/component/experienceComponentTypes.d.ts +13 -1
  71. package/dist/react/component/experienceComponentTypes.d.ts.map +1 -1
  72. package/dist/react/index.js +870 -712
  73. package/dist/react/index.js.map +1 -1
  74. package/dist/react/react/Experience.d.ts.map +1 -1
  75. package/dist/react/react/ExperienceThumbnail.d.ts +2 -0
  76. package/dist/react/react/ExperienceThumbnail.d.ts.map +1 -1
  77. package/dist/react/react/ExperienceWidget.d.ts +3 -0
  78. package/dist/react/react/ExperienceWidget.d.ts.map +1 -1
  79. package/dist/react/thumbnail/expandAssetUrl.d.ts +17 -0
  80. package/dist/react/thumbnail/expandAssetUrl.d.ts.map +1 -0
  81. package/dist/react/thumbnail/expandAssetUrl.test.d.ts +2 -0
  82. package/dist/react/thumbnail/expandAssetUrl.test.d.ts.map +1 -0
  83. package/dist/react/thumbnail/index.d.ts +3 -0
  84. package/dist/react/thumbnail/index.d.ts.map +1 -1
  85. package/dist/react/thumbnail/locationPlate.d.ts +13 -0
  86. package/dist/react/thumbnail/locationPlate.d.ts.map +1 -0
  87. package/dist/react/thumbnail/locationPlate.test.d.ts +2 -0
  88. package/dist/react/thumbnail/locationPlate.test.d.ts.map +1 -0
  89. package/dist/react/thumbnail/styles.d.ts.map +1 -1
  90. package/dist/react/thumbnail/toGalleryThumbUrl.d.ts +12 -2
  91. package/dist/react/thumbnail/toGalleryThumbUrl.d.ts.map +1 -1
  92. package/dist/react/thumbnail/types.d.ts +7 -1
  93. package/dist/react/thumbnail/types.d.ts.map +1 -1
  94. package/dist/react/thumbnail.js +273 -192
  95. package/dist/react/thumbnail.js.map +1 -1
  96. package/dist/react/v2/embed/iframeHost.d.ts +3 -0
  97. package/dist/react/v2/embed/iframeHost.d.ts.map +1 -1
  98. package/dist/react/v2/embed/protocol.d.ts +21 -0
  99. package/dist/react/v2/embed/protocol.d.ts.map +1 -1
  100. package/dist/react/v2/experience.d.ts +20 -0
  101. package/dist/react/v2/experience.d.ts.map +1 -1
  102. package/dist/react/v2/shims/embedBaseUrl.d.ts +15 -1
  103. package/dist/react/v2/shims/embedBaseUrl.d.ts.map +1 -1
  104. package/dist/react/v2/types/stage.d.ts +8 -0
  105. package/dist/react/v2/types/stage.d.ts.map +1 -0
  106. package/dist/react/widget/mountExperienceWidget.d.ts.map +1 -1
  107. package/dist/sdk/v2/client.js +2 -2
  108. package/dist/sdk/v2/client.js.map +1 -1
  109. package/dist/sdk/v2/thumbnail.js +9 -2
  110. package/dist/sdk/v2/thumbnail.js.map +1 -1
  111. package/dist/svelte/Experience.svelte +41 -0
  112. package/dist/svelte/Experience.svelte.d.ts +3 -0
  113. package/dist/svelte/ExperienceThumbnail.svelte +24 -2
  114. package/dist/svelte/ExperienceThumbnail.svelte.d.ts +2 -0
  115. package/dist/svelte/ExperienceWidget.svelte +9 -0
  116. package/dist/svelte/ExperienceWidget.svelte.d.ts +3 -0
  117. package/package.json +1 -1
@@ -1,4 +1,11 @@
1
- (function(){function e(e){return e===`face`?`liforma-et--fit-face`:e===`medium`?`liforma-et--fit-medium`:``}var t=/(\/avatars\/[^/]+\/)(\d+)(\/)/i,n=/_CH(\.webp)/i,r=/(-)(\d+x\d+)(\.webp)(\?|$)/i;function i(e){let i=e.trim();if(!i)return i;let a=i.replace(t,(e,t,n,r)=>n===`256`?`${t}${n}${r}`:`${t}256${r}`);return a=a.replace(n,`_neutral$1`),a=a.replace(r,(e,t,n,r,i)=>n===`256x256`?`${t}${n}${r}${i}`:`${t}256x256${r}${i}`),a}function a(e){let t=e.avatarImage?.trim()||e.galleryThumb?.avatarImage?.trim()||``;if(!t)return null;let n=e.backgroundImage?.trim()||e.galleryThumb?.backgroundImage?.trim()||``,r=e.foregroundImage?.trim()||e.galleryThumb?.foregroundImage?.trim()||``,a=e.fallbackImage?.trim()||``;return{avatarImage:i(t),...n?{backgroundImage:i(n)}:{},...r?{foregroundImage:i(r)}:{},...a?{fallbackImage:i(a)}:{}}}function o(){if(globalThis.__LIFORMA_STACK===`local`)return!0;if(typeof location>`u`)return!1;try{return new URLSearchParams(location.search).get(`stack`)===`local`}catch{return!1}}var s=`https://player.liforma.ai`,c=`http://localhost:3002`;function l(e){return e.href?.trim()?`anchor`:e.hasClickHandler?`button`:e.experienceId?.trim()?`anchor`:`presentational`}function u(e){let t=e?.trim();return t?t.replace(/\/$/,``):o()?c:s}function d(e){let t=e.experienceId.trim(),n=u(e.playerBaseUrl),r=new URL(`${n}/${encodeURIComponent(t)}`),i=e.returnUrl?.trim();return i&&r.searchParams.set(`returnUrl`,i),r.toString()}function f(e){let t=e.href?.trim();if(t)return t;let n=e.experienceId?.trim();if(!n)return;let r=e.returnUrl?.trim();return!r&&e.useCurrentPageAsReturnUrl&&typeof window<`u`&&(r=window.location.href),d({experienceId:n,...r?{returnUrl:r}:{},playerBaseUrl:e.playerBaseUrl})}function p(){return typeof window>`u`?!1:window.matchMedia(`(hover: none), (pointer: coarse)`).matches}var m=0,h=[];function g(){return p()?4:1/0}function _(){return p()?160:0}function v(){let e=g();for(;m<e&&h.length>0;){let e=h.shift();if(!e||e.cancelled)continue;m+=1,e.start();let t=_();if(t<=0){m=Math.max(0,m-1);continue}window.setTimeout(()=>{m=Math.max(0,m-1),v()},t)}}function y(e){if(!p())return e(),()=>{};let t={start:e,cancelled:!1};return h.push(t),v(),()=>{t.cancelled=!0}}function b(){return p()?`96px 0px`:`280px 0px`}function x(e){let t=e.trim().split(/\s+/)[0]??`0px`,n=Number.parseFloat(t);return Number.isFinite(n)?Math.abs(n):280}function S(e,t){if(typeof window>`u`)return!1;let n=e.getBoundingClientRect();return n.bottom>=-t&&n.top<=window.innerHeight+t}function C(e,t){let{onVisibleChange:n}=t,r=t.rootMargin??b(),i=x(r),a=!1,o=!1,s=null,c=()=>{o||(s?.(),s=y(()=>{s=null,o=!0,n(!0)}))},l=e=>{if(e!==a){if(a=e,e){c();return}s?.(),s=null,n(!1)}};if(typeof IntersectionObserver>`u`)return c(),()=>{s?.(),s=null};let u=new IntersectionObserver(e=>{l(e.some(e=>e.isIntersecting))},{root:null,rootMargin:r,threshold:0});return u.observe(e),S(e,i)&&l(!0),()=>{s?.(),s=null,u.disconnect()}}function w(e,t){let n=()=>t();return e.complete?queueMicrotask(n):(e.addEventListener(`load`,n,{once:!0}),e.addEventListener(`error`,n,{once:!0})),()=>{e.removeEventListener(`load`,n),e.removeEventListener(`error`,n)}}function T(){return typeof window>`u`||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?!1:window.matchMedia(`(hover: none), (pointer: coarse)`).matches}function E(e,t){return((e.top+e.height/2)/Math.max(t,1)-.5)*2}var D=new Set,O=!1,k=0;function A(){if(k=0,D.size===0||typeof window>`u`)return;let e=window.innerHeight;for(let t of D){if(t.pointerActive?.())continue;let n=t.element.getBoundingClientRect();n.bottom<-64||n.top>e+64||t.onParallax(E(n,e))}}function j(){k===0&&(k=requestAnimationFrame(A))}function M(){O||typeof window>`u`||(O=!0,window.addEventListener(`scroll`,j,{passive:!0}),window.addEventListener(`resize`,j,{passive:!0}))}function N(){D.size>0||!O||typeof window>`u`||(O=!1,k!==0&&(cancelAnimationFrame(k),k=0),window.removeEventListener(`scroll`,j),window.removeEventListener(`resize`,j))}function P(e,t){if(!T())return()=>{};let n={element:e,onParallax:t.onParallax,pointerActive:t.pointerActive};return D.add(n),M(),n.pointerActive?.()||t.onParallax(E(e.getBoundingClientRect(),window.innerHeight)),()=>{D.delete(n),N()}}var F=`.liforma-et {
1
+ (function(){function e(e){return e===`face`?`liforma-et--fit-face`:e===`medium`?`liforma-et--fit-medium`:``}var t=/(-)(\d+x\d+)(\.webp)(\?|$)/i;function n(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<1||t<1||e<=t?`256x256`:e>800||t>450?`1672x941`:`800x450`}function r(e,n){let r=e.trim();return r&&r.replace(t,(e,t,r,i,a)=>`${t}${n}${i}${a}`)}function i(e,t){let n=()=>{t(e.clientWidth,e.clientHeight)};if(n(),typeof ResizeObserver>`u`)return()=>{};let r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()}var a=/-(256x256|400x450|800x450|836x971|1672x941|167x94)$/i;function o(e){return e?.trim().replace(/\/$/,``)||`https://cdn.liforma.ai`}function s(e){return/^https?:\/\//i.test(e)||e.startsWith(`//`)}function c(e){return e.startsWith(`//`)?`https:${e}`:e}function l(e){let t=e.indexOf(`?`);return t===-1?{pathname:e,search:``}:{pathname:e.slice(0,t),search:e.slice(t)}}function u(e,t,n=``){return`${e}${t.startsWith(`/`)?t:`/${t}`}${n}`}function d(e,t,n){let i=e.trim();if(!i)return i;let d=o(n);if(s(i))return r(c(i),t);let{pathname:f,search:p}=l(i.replace(/\\/g,`/`)),m=f;if(!m.startsWith(`/`))m=`/locations/${m.replace(/^locations\//i,``)}`;else if(!/^\/locations\//i.test(m))return/^\/avatars\//i.test(m)?u(d,m,p):i;if(/\.webp$/i.test(m)&&!a.test(m.replace(/\.webp$/i,``)))return u(d,m,p);let h=m.replace(/^\/locations\//i,``).replace(/\.webp$/i,``);return h=h.replace(a,``),`${d}/locations/${h}-${t}.webp${p}`}function f(e,t){let n=e.trim();if(!n)return n;let r=o(t);if(s(n))return c(n);let{pathname:i,search:a}=l(n.replace(/\\/g,`/`)),d=i;if(!d.startsWith(`/`))if(/^avatars\//i.test(d))d=`/${d}`;else if(/^[^/]+$/.test(d)&&!a)return`${r}/avatars/${d}/256/${d}_neutral.webp`;else return n;if(!/^\/avatars\//i.test(d))return n;let f=d.replace(/^\/avatars\//i,``).replace(/\/+$/,``);return f&&!f.includes(`/`)&&!a?`${r}/avatars/${f}/256/${f}_neutral.webp`:u(r,d,a)}var p=/(\/avatars\/[^/]+\/)(\d+)(\/)/i,m=/_CH(\.webp)/i;function h(e){return/\/locations\//i.test(e)||/^locations\//i.test(e)?!0:/^https?:\/\//i.test(e)||e.startsWith(`//`)||/^\/?avatars\//i.test(e)||e.startsWith(`/`)?!1:e.includes(`/`)}function g(e,t=`256x256`,n){let r=e.trim();if(!r)return r;if(h(r))return d(r,t,n);let i=f(r,n);return i=i.replace(p,(e,t,n,r)=>n===`256`?`${t}${n}${r}`:`${t}256${r}`),i.replace(m,`_neutral$1`)}function _(e){let t=e.avatarImage?.trim()||e.galleryThumb?.avatarImage?.trim()||``;if(!t)return null;let n=e.backgroundImage?.trim()||e.galleryThumb?.backgroundImage?.trim()||``,r=e.foregroundImage?.trim()||e.galleryThumb?.foregroundImage?.trim()||``,i=e.fallbackImage?.trim()||``,a=e.locationPlateSize??`256x256`,s=o(e.cdnBaseUrl),c=e.normalize!==!1,l=e=>!c&&/^https?:\/\//i.test(e.trim())?e.trim():g(e,a,s),u=e=>!c&&/^https?:\/\//i.test(e.trim())?e.trim():d(e,a,s);return{avatarImage:l(t),...n?{backgroundImage:u(n)}:{},...r?{foregroundImage:u(r)}:{},...i?{fallbackImage:l(i)}:{}}}function v(){if(globalThis.__LIFORMA_STACK===`local`)return!0;if(typeof location>`u`)return!1;try{return new URLSearchParams(location.search).get(`stack`)===`local`}catch{return!1}}var y=`https://player.liforma.ai`,b=`http://localhost:3002`;function x(e){return e.href?.trim()?`anchor`:e.hasClickHandler?`button`:e.experienceId?.trim()?`anchor`:`presentational`}function S(e){let t=e?.trim();return t?t.replace(/\/$/,``):v()?b:y}function C(e){let t=e.experienceId.trim(),n=S(e.playerBaseUrl),r=new URL(`${n}/${encodeURIComponent(t)}`),i=e.returnUrl?.trim();return i&&r.searchParams.set(`returnUrl`,i),r.toString()}function w(e){let t=e.href?.trim();if(t)return t;let n=e.experienceId?.trim();if(!n)return;let r=e.returnUrl?.trim();return!r&&e.useCurrentPageAsReturnUrl&&typeof window<`u`&&(r=window.location.href),C({experienceId:n,...r?{returnUrl:r}:{},playerBaseUrl:e.playerBaseUrl})}function T(){return typeof window>`u`?!1:window.matchMedia(`(hover: none), (pointer: coarse)`).matches}var E=0,D=[];function O(){return T()?4:1/0}function k(){return T()?160:0}function A(){let e=O();for(;E<e&&D.length>0;){let e=D.shift();if(!e||e.cancelled)continue;E+=1,e.start();let t=k();if(t<=0){E=Math.max(0,E-1);continue}window.setTimeout(()=>{E=Math.max(0,E-1),A()},t)}}function j(e){if(!T())return e(),()=>{};let t={start:e,cancelled:!1};return D.push(t),A(),()=>{t.cancelled=!0}}function M(){return T()?`96px 0px`:`280px 0px`}function N(e){let t=e.trim().split(/\s+/)[0]??`0px`,n=Number.parseFloat(t);return Number.isFinite(n)?Math.abs(n):280}function P(e,t){if(typeof window>`u`)return!1;let n=e.getBoundingClientRect();return n.bottom>=-t&&n.top<=window.innerHeight+t}function F(e,t){let{onVisibleChange:n}=t,r=t.rootMargin??M(),i=N(r),a=!1,o=!1,s=null,c=()=>{o||(s?.(),s=j(()=>{s=null,o=!0,n(!0)}))},l=e=>{if(e!==a){if(a=e,e){c();return}s?.(),s=null,n(!1)}};if(typeof IntersectionObserver>`u`)return c(),()=>{s?.(),s=null};let u=new IntersectionObserver(e=>{l(e.some(e=>e.isIntersecting))},{root:null,rootMargin:r,threshold:0});return u.observe(e),P(e,i)&&l(!0),()=>{s?.(),s=null,u.disconnect()}}function I(e,t){let n=()=>t();return e.complete?queueMicrotask(n):(e.addEventListener(`load`,n,{once:!0}),e.addEventListener(`error`,n,{once:!0})),()=>{e.removeEventListener(`load`,n),e.removeEventListener(`error`,n)}}function L(){return typeof window>`u`||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?!1:window.matchMedia(`(hover: none), (pointer: coarse)`).matches}function R(e,t){return((e.top+e.height/2)/Math.max(t,1)-.5)*2}var z=new Set,B=!1,V=0;function H(){if(V=0,z.size===0||typeof window>`u`)return;let e=window.innerHeight;for(let t of z){if(t.pointerActive?.())continue;let n=t.element.getBoundingClientRect();n.bottom<-64||n.top>e+64||t.onParallax(R(n,e))}}function U(){V===0&&(V=requestAnimationFrame(H))}function W(){B||typeof window>`u`||(B=!0,window.addEventListener(`scroll`,U,{passive:!0}),window.addEventListener(`resize`,U,{passive:!0}))}function G(){z.size>0||!B||typeof window>`u`||(B=!1,V!==0&&(cancelAnimationFrame(V),V=0),window.removeEventListener(`scroll`,U),window.removeEventListener(`resize`,U))}function K(e,t){if(!L())return()=>{};let n={element:e,onParallax:t.onParallax,pointerActive:t.pointerActive};return z.add(n),W(),n.pointerActive?.()||t.onParallax(R(e.getBoundingClientRect(),window.innerHeight)),()=>{z.delete(n),G()}}var q=`:host {
2
+ display: block;
3
+ width: 100%;
4
+ height: 100%;
5
+ min-height: 0;
6
+ }
7
+
8
+ .liforma-et {
2
9
  --liforma-et-parallax-x: 0;
3
10
  --liforma-et-parallax-y: 0;
4
11
  --liforma-et-bg-scale: 1;
@@ -218,5 +225,5 @@ button.liforma-et {
218
225
  .liforma-et__avatar {
219
226
  transition: none;
220
227
  }
221
- }`,I=`liforma-experience-thumbnail`;function L(e){if(e?.trim())try{let t=JSON.parse(e);if(t&&typeof t.avatarImage==`string`)return t}catch{}}var R=class extends HTMLElement{static get observedAttributes(){return[`experience-id`,`gallery-thumb`,`avatar-image`,`background-image`,`foreground-image`,`fallback-image`,`alt`,`href`,`target`,`rel`,`return-url`,`player-base-url`,`parallax`,`fit`,`lazy`]}#e=null;#t=[];#n=!1;#r=!1;#i=!1;#a=!1;#o=0;#s=0;#c=!1;#l=!1;#u=!1;#d=!1;connectedCallback(){this.#m()}disconnectedCallback(){this.#f()}attributeChangedCallback(){this.isConnected&&this.#m()}#f(){for(let e of this.#t)e();this.#t=[],this.#e=null}#p(e,t){if(!this.hasAttribute(e))return t;let n=this.getAttribute(e);return n===null||n===``||n===`true`?!0:n===`false`?!1:t}#m(){this.#f();let t=this.shadowRoot??this.attachShadow({mode:`open`}),n=document.createElement(`style`);n.textContent=F,t.replaceChildren(n);let r=this.getAttribute(`alt`)?.trim()||`Experience`,i=this.getAttribute(`href`),o=this.getAttribute(`experience-id`),s=l({href:i,hasClickHandler:this.hasAttribute(`onclick`)||typeof this.onclick==`function`,experienceId:o}),c=a({galleryThumb:L(this.getAttribute(`gallery-thumb`)),avatarImage:this.getAttribute(`avatar-image`)??void 0,backgroundImage:this.getAttribute(`background-image`)??void 0,foregroundImage:this.getAttribute(`foreground-image`)??void 0,fallbackImage:this.getAttribute(`fallback-image`)??void 0});if(!c)return;let u=this.#p(`parallax`,!0),d=this.getAttribute(`fit`)?.trim(),p=d===`face`||d===`medium`?d:`full`,m=this.#p(`lazy`,!0);this.#n=!m;let h=s===`anchor`&&!i?.trim()&&!!o?.trim(),g=f({href:i??void 0,experienceId:o??void 0,returnUrl:this.getAttribute(`return-url`)??void 0,playerBaseUrl:this.getAttribute(`player-base-url`)??void 0,useCurrentPageAsReturnUrl:h&&!this.getAttribute(`return-url`)?.trim()}),_;if(s===`anchor`&&g){let e=document.createElement(`a`);e.href=g;let t=this.getAttribute(`target`),n=this.getAttribute(`rel`);t&&(e.target=t),n&&(e.rel=n),_=e}else if(s===`button`){let e=document.createElement(`button`);e.type=`button`,_=e}else _=document.createElement(`div`),_.setAttribute(`role`,`img`);_.className=`liforma-et`,_.setAttribute(`aria-label`,r),this.#e=_,t.appendChild(_);let v=()=>{let t=!!c.backgroundImage,n=u&&(this.#r||this.#a),r=this.#n&&(this.#u||this.#l||this.#d);_.className=[`liforma-et`,t?`liforma-et--scene`:``,e(p),n?`liforma-et--parallax`:``,this.#a?`liforma-et--scroll-parallax`:``,this.#n&&!r?`liforma-et--loading`:``,r?`liforma-et--revealed`:``].filter(Boolean).join(` `),_.style.setProperty(`--liforma-et-parallax-x`,String(this.#o)),_.style.setProperty(`--liforma-et-parallax-y`,String(this.#s))},y=document.createElement(`span`);y.className=`liforma-et__placeholder`,y.setAttribute(`aria-hidden`,`true`),_.appendChild(y);let b=()=>{if(!this.#n)return;let e=this.#c&&c.fallbackImage?c.fallbackImage:c.avatarImage;if(c.backgroundImage&&!_.querySelector(`.liforma-et__background`)){let e=document.createElement(`img`);e.className=`liforma-et__background liforma-et__media`,e.alt=``,e.decoding=`async`,e.src=c.backgroundImage,this.#t.push(w(e,()=>{this.#l=!0,e.classList.add(`liforma-et__media--ready`),v()})),_.appendChild(e)}let t=_.querySelector(`.liforma-et__avatar`);if(t||(t=document.createElement(`img`),t.className=`liforma-et__avatar liforma-et__media`,t.alt=``,t.decoding=`async`,t.addEventListener(`error`,()=>{c.fallbackImage&&!this.#c?(this.#c=!0,t.src=c.fallbackImage):(this.#u=!0,v())}),this.#t.push(w(t,()=>{this.#u=!0,t.classList.add(`liforma-et__media--ready`),v()})),_.appendChild(t)),t.src!==e&&(t.src=e),c.foregroundImage&&!_.querySelector(`.liforma-et__foreground`)){let e=document.createElement(`img`);e.className=`liforma-et__foreground liforma-et__media`,e.alt=``,e.decoding=`async`,e.src=c.foregroundImage,this.#t.push(w(e,()=>{this.#d=!0,e.classList.add(`liforma-et__media--ready`),v()})),_.appendChild(e)}v()};if(m?this.#t.push(C(_,{onVisibleChange:e=>{e&&(this.#n=!0,b(),v())}})):b(),u){this.#t.push(P(_,{onParallax:e=>{this.#a=!0,this.#i||(this.#o=e,this.#s=0,v())},pointerActive:()=>this.#i}));let e=e=>{if(this.#a)return;let t=_.getBoundingClientRect();t.width<=0||t.height<=0||(this.#o=((e.clientX-t.left)/t.width-.5)*2,this.#s=((e.clientY-t.top)/t.height-.5)*2,v())},t=e=>{this.#i=!0,e.pointerType===`mouse`&&(this.#r=!0),v()},n=()=>{let e=this.#i;this.#i=!1,this.#r=!1,this.#a&&e?(this.#o=E(_.getBoundingClientRect(),window.innerHeight),this.#s=0):this.#a||(this.#o=0,this.#s=0),v()};_.addEventListener(`pointermove`,e),_.addEventListener(`pointerdown`,t),_.addEventListener(`pointerup`,n),_.addEventListener(`pointercancel`,n),_.addEventListener(`pointerenter`,e=>{e.pointerType===`mouse`&&(this.#r=!0,v())}),_.addEventListener(`pointerleave`,()=>{this.#i||(this.#r=!1,this.#a||(this.#o=0,this.#s=0),v())}),this.#t.push(()=>{_.removeEventListener(`pointermove`,e),_.removeEventListener(`pointerdown`,t),_.removeEventListener(`pointerup`,n),_.removeEventListener(`pointercancel`,n)})}_.addEventListener(`click`,e=>{if(h&&!this.getAttribute(`return-url`)?.trim()){let t=f({experienceId:o??void 0,playerBaseUrl:this.getAttribute(`player-base-url`)??void 0,useCurrentPageAsReturnUrl:!0});t&&e.button===0&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&(e.preventDefault(),window.location.assign(t))}}),v()}};customElements.get(I)||customElements.define(I,R),window.LiformaThumbnail={sdkVersion:`v2`,element:R}})();
228
+ }`,J=`liforma-experience-thumbnail`;function Y(e){if(e?.trim())try{let t=JSON.parse(e);if(t&&typeof t.avatarImage==`string`)return t}catch{}}var X=class extends HTMLElement{static get observedAttributes(){return[`experience-id`,`gallery-thumb`,`avatar-image`,`background-image`,`foreground-image`,`fallback-image`,`alt`,`href`,`target`,`rel`,`return-url`,`player-base-url`,`parallax`,`fit`,`lazy`,`normalize-urls`,`cdn-base-url`]}#e=null;#t=[];#n=!1;#r=!1;#i=!1;#a=!1;#o=0;#s=0;#c=!1;#l=!1;#u=!1;#d=!1;connectedCallback(){this.#m()}disconnectedCallback(){this.#f()}attributeChangedCallback(){this.isConnected&&this.#m()}#f(){for(let e of this.#t)e();this.#t=[],this.#e=null}#p(e,t){if(!this.hasAttribute(e))return t;let n=this.getAttribute(e);return n===null||n===``||n===`true`?!0:n===`false`?!1:t}#m(){this.#f();let t=this.shadowRoot??this.attachShadow({mode:`open`}),r=document.createElement(`style`);r.textContent=q,t.replaceChildren(r);let a=this.getAttribute(`alt`)?.trim()||`Experience`,o=this.getAttribute(`href`),s=this.getAttribute(`experience-id`),c=x({href:o,hasClickHandler:this.hasAttribute(`onclick`)||typeof this.onclick==`function`,experienceId:s}),l=this.#p(`normalize-urls`,!0),u=n(0,0),d=()=>_({galleryThumb:Y(this.getAttribute(`gallery-thumb`)),avatarImage:this.getAttribute(`avatar-image`)??void 0,backgroundImage:this.getAttribute(`background-image`)??void 0,foregroundImage:this.getAttribute(`foreground-image`)??void 0,fallbackImage:this.getAttribute(`fallback-image`)??void 0,normalize:l,locationPlateSize:u,cdnBaseUrl:this.getAttribute(`cdn-base-url`)??void 0}),f=d();if(!f)return;let p=f,m=this.#p(`parallax`,!0),h=this.getAttribute(`fit`)?.trim(),g=h===`face`||h===`medium`?h:`full`,v=this.#p(`lazy`,!0);this.#n=!v;let y=c===`anchor`&&!o?.trim()&&!!s?.trim(),b=w({href:o??void 0,experienceId:s??void 0,returnUrl:this.getAttribute(`return-url`)??void 0,playerBaseUrl:this.getAttribute(`player-base-url`)??void 0,useCurrentPageAsReturnUrl:y&&!this.getAttribute(`return-url`)?.trim()}),S;if(c===`anchor`&&b){let e=document.createElement(`a`);e.href=b;let t=this.getAttribute(`target`),n=this.getAttribute(`rel`);t&&(e.target=t),n&&(e.rel=n),S=e}else if(c===`button`){let e=document.createElement(`button`);e.type=`button`,S=e}else S=document.createElement(`div`),S.setAttribute(`role`,`img`);S.className=`liforma-et`,S.setAttribute(`aria-label`,a),this.#e=S,t.appendChild(S);let C=()=>{let t=!!p.backgroundImage,n=m&&(this.#r||this.#a),r=this.#n&&(this.#u||this.#l||this.#d);S.className=[`liforma-et`,t?`liforma-et--scene`:``,e(g),n?`liforma-et--parallax`:``,this.#a?`liforma-et--scroll-parallax`:``,this.#n&&!r?`liforma-et--loading`:``,r?`liforma-et--revealed`:``].filter(Boolean).join(` `),S.style.setProperty(`--liforma-et-parallax-x`,String(this.#o)),S.style.setProperty(`--liforma-et-parallax-y`,String(this.#s))};this.#t.push(i(this,(e,t)=>{let r=n(e,t);if(r===u)return;u=r;let i=d();if(!i)return;p=i;let a=S.querySelector(`.liforma-et__background`);a&&p.backgroundImage&&a.getAttribute(`src`)!==p.backgroundImage&&(this.#l=!1,a.classList.remove(`liforma-et__media--ready`),a.src=p.backgroundImage);let o=S.querySelector(`.liforma-et__foreground`);o&&p.foregroundImage&&o.getAttribute(`src`)!==p.foregroundImage&&(this.#d=!1,o.classList.remove(`liforma-et__media--ready`),o.src=p.foregroundImage),C()}));let T=d();T&&(p=T);let E=document.createElement(`span`);E.className=`liforma-et__placeholder`,E.setAttribute(`aria-hidden`,`true`),S.appendChild(E);let D=()=>{if(!this.#n)return;let e=this.#c&&p.fallbackImage?p.fallbackImage:p.avatarImage;if(p.backgroundImage&&!S.querySelector(`.liforma-et__background`)){let e=document.createElement(`img`);e.className=`liforma-et__background liforma-et__media`,e.alt=``,e.decoding=`async`,e.src=p.backgroundImage,this.#t.push(I(e,()=>{this.#l=!0,e.classList.add(`liforma-et__media--ready`),C()})),S.appendChild(e)}let t=S.querySelector(`.liforma-et__avatar`);if(t||(t=document.createElement(`img`),t.className=`liforma-et__avatar liforma-et__media`,t.alt=``,t.decoding=`async`,t.addEventListener(`error`,()=>{p.fallbackImage&&!this.#c?(this.#c=!0,t.src=p.fallbackImage):(this.#u=!0,C())}),this.#t.push(I(t,()=>{this.#u=!0,t.classList.add(`liforma-et__media--ready`),C()})),S.appendChild(t)),t.src!==e&&(t.src=e),p.foregroundImage&&!S.querySelector(`.liforma-et__foreground`)){let e=document.createElement(`img`);e.className=`liforma-et__foreground liforma-et__media`,e.alt=``,e.decoding=`async`,e.src=p.foregroundImage,this.#t.push(I(e,()=>{this.#d=!0,e.classList.add(`liforma-et__media--ready`),C()})),S.appendChild(e)}C()};if(v?this.#t.push(F(S,{onVisibleChange:e=>{e&&(this.#n=!0,D(),C())}})):D(),m){this.#t.push(K(S,{onParallax:e=>{this.#a=!0,this.#i||(this.#o=e,this.#s=0,C())},pointerActive:()=>this.#i}));let e=e=>{if(this.#a)return;let t=S.getBoundingClientRect();t.width<=0||t.height<=0||(this.#o=((e.clientX-t.left)/t.width-.5)*2,this.#s=((e.clientY-t.top)/t.height-.5)*2,C())},t=e=>{this.#i=!0,e.pointerType===`mouse`&&(this.#r=!0),C()},n=()=>{let e=this.#i;this.#i=!1,this.#r=!1,this.#a&&e?(this.#o=R(S.getBoundingClientRect(),window.innerHeight),this.#s=0):this.#a||(this.#o=0,this.#s=0),C()};S.addEventListener(`pointermove`,e),S.addEventListener(`pointerdown`,t),S.addEventListener(`pointerup`,n),S.addEventListener(`pointercancel`,n),S.addEventListener(`pointerenter`,e=>{e.pointerType===`mouse`&&(this.#r=!0,C())}),S.addEventListener(`pointerleave`,()=>{this.#i||(this.#r=!1,this.#a||(this.#o=0,this.#s=0),C())}),this.#t.push(()=>{S.removeEventListener(`pointermove`,e),S.removeEventListener(`pointerdown`,t),S.removeEventListener(`pointerup`,n),S.removeEventListener(`pointercancel`,n)})}S.addEventListener(`click`,e=>{if(y&&!this.getAttribute(`return-url`)?.trim()){let t=w({experienceId:s??void 0,playerBaseUrl:this.getAttribute(`player-base-url`)??void 0,useCurrentPageAsReturnUrl:!0});t&&e.button===0&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&(e.preventDefault(),window.location.assign(t))}}),C()}};customElements.get(J)||customElements.define(J,X),window.LiformaThumbnail={sdkVersion:`v2`,element:X}})();
222
229
  //# sourceMappingURL=thumbnail.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"thumbnail.js","names":["#render","#teardown","#cleanup","#root","#boolAttr","#shouldLoad","#hovering","#scrollParallax","#avatarReady","#backgroundReady","#foregroundReady","#parallaxX","#parallaxY","#avatarLoadFailed","#pointerDown"],"sources":["../../../src/thumbnail/types.ts","../../../src/thumbnail/toGalleryThumbUrl.ts","../../../src/shims/localStack.ts","../../../src/thumbnail/hostedLaunchUrl.ts","../../../src/thumbnail/thumbLoadScheduler.ts","../../../src/thumbnail/lazyLoad.ts","../../../src/thumbnail/scrollParallax.ts","../../../src/thumbnail/styles.ts","../../../src/v2/liforma-experience-thumbnail.ts","../../../src/v2/thumbnail-cdn.ts"],"sourcesContent":["/** Catalog-shaped layered gallery preview (CDN URLs). */\nexport type GalleryThumb = {\n\treadonly avatarImage: string;\n\treadonly backgroundImage?: string;\n\treadonly foregroundImage?: string;\n};\n\nexport type ThumbnailInteractionKind = 'anchor' | 'button' | 'presentational';\n\nexport type ResolveThumbnailInteractionInput = {\n\treadonly href?: string | null;\n\treadonly hasClickHandler?: boolean;\n\treadonly experienceId?: string | null;\n};\n\nexport type ThumbnailLayers = {\n\treadonly avatarImage: string;\n\treadonly backgroundImage?: string;\n\treadonly foregroundImage?: string;\n\treadonly fallbackImage?: string;\n};\n\n/** Shared props across Svelte / React / Next (React uses `onClick`). */\nexport type ExperienceThumbnailBaseProps = {\n\treadonly galleryThumb?: GalleryThumb;\n\treadonly avatarImage?: string;\n\treadonly backgroundImage?: string;\n\treadonly foregroundImage?: string;\n\treadonly alt: string;\n\treadonly experienceId?: string;\n\treadonly href?: string;\n\treadonly target?: string;\n\treadonly rel?: string;\n\treadonly returnUrl?: string;\n\treadonly playerBaseUrl?: string;\n\treadonly parallax?: boolean;\n\t/** Same as `<Experience fit>`: `full` (default), `medium`, or `face`. */\n\treadonly fit?: 'full' | 'face' | 'medium';\n\treadonly lazy?: boolean;\n\treadonly className?: string;\n\treadonly fallbackImage?: string;\n};\n\nexport function thumbnailFitClass(fit?: 'full' | 'face' | 'medium'): string {\n\tif (fit === 'face') return 'liforma-et--fit-face';\n\tif (fit === 'medium') return 'liforma-et--fit-medium';\n\treturn '';\n}\n","const AVATAR_TIER_RE = /(\\/avatars\\/[^/]+\\/)(\\d+)(\\/)/i;\nconst AVATAR_CH_PLATE_RE = /_CH(\\.webp)/i;\nconst LOCATION_SIZE_RE = /(-)(\\d+x\\d+)(\\.webp)(\\?|$)/i;\n\n/**\n * Rewrite known Liforma CDN URLs to gallery thumb tiers.\n * Avatars: /{tier}/ → /256/; locations: -{WxH}.webp → -256x256.webp.\n * Unrecognized URLs are returned unchanged.\n */\nexport function toGalleryThumbUrl(url: string): string {\n\tconst raw = url.trim();\n\tif (!raw) return raw;\n\n\tlet next = raw.replace(AVATAR_TIER_RE, (_match, prefix: string, tier: string, slash: string) => {\n\t\tif (tier === '256') return `${prefix}${tier}${slash}`;\n\t\treturn `${prefix}256${slash}`;\n\t});\n\tnext = next.replace(AVATAR_CH_PLATE_RE, '_neutral$1');\n\n\tnext = next.replace(\n\t\tLOCATION_SIZE_RE,\n\t\t(_match, dash: string, size: string, ext: string, end: string) => {\n\t\t\tif (size === '256x256') return `${dash}${size}${ext}${end}`;\n\t\t\treturn `${dash}256x256${ext}${end}`;\n\t\t}\n\t);\n\n\treturn next;\n}\n\nexport function resolveThumbnailLayers(input: {\n\treadonly galleryThumb?: {\n\t\treadonly avatarImage?: string;\n\t\treadonly backgroundImage?: string;\n\t\treadonly foregroundImage?: string;\n\t};\n\treadonly avatarImage?: string;\n\treadonly backgroundImage?: string;\n\treadonly foregroundImage?: string;\n\treadonly fallbackImage?: string;\n}): {\n\treadonly avatarImage: string;\n\treadonly backgroundImage?: string;\n\treadonly foregroundImage?: string;\n\treadonly fallbackImage?: string;\n} | null {\n\tconst avatarSource =\n\t\tinput.avatarImage?.trim() ||\n\t\tinput.galleryThumb?.avatarImage?.trim() ||\n\t\t'';\n\tif (!avatarSource) return null;\n\n\tconst backgroundSource =\n\t\tinput.backgroundImage?.trim() || input.galleryThumb?.backgroundImage?.trim() || '';\n\tconst foregroundSource =\n\t\tinput.foregroundImage?.trim() || input.galleryThumb?.foregroundImage?.trim() || '';\n\tconst fallbackSource = input.fallbackImage?.trim() || '';\n\n\treturn {\n\t\tavatarImage: toGalleryThumbUrl(avatarSource),\n\t\t...(backgroundSource ? { backgroundImage: toGalleryThumbUrl(backgroundSource) } : {}),\n\t\t...(foregroundSource ? { foregroundImage: toGalleryThumbUrl(foregroundSource) } : {}),\n\t\t...(fallbackSource ? { fallbackImage: toGalleryThumbUrl(fallbackSource) } : {})\n\t};\n}\n","/**\n * Opt-in local monorepo stack (api :3001, player :3002).\n * Never inferred from hostname alone — third-party demos run on localhost against production.\n */\nexport function useExplicitLocalStack(): boolean {\n\tif ((globalThis as { __LIFORMA_STACK?: string }).__LIFORMA_STACK === 'local') {\n\t\treturn true;\n\t}\n\n\tif (typeof location === 'undefined') {\n\t\treturn false;\n\t}\n\n\ttry {\n\t\treturn new URLSearchParams(location.search).get('stack') === 'local';\n\t} catch {\n\t\treturn false;\n\t}\n}\n","import { useExplicitLocalStack } from '../shims/localStack';\nimport type { ResolveThumbnailInteractionInput, ThumbnailInteractionKind } from './types';\n\nconst PRODUCTION_PLAYER_ORIGIN = 'https://player.liforma.ai';\nconst LOCAL_PLAYER_ORIGIN = 'http://localhost:3002';\n\n/** Priority: href → click-only → hosted (experienceId) → presentational. */\nexport function resolveThumbnailInteraction(\n\tinput: ResolveThumbnailInteractionInput\n): ThumbnailInteractionKind {\n\tif (input.href?.trim()) return 'anchor';\n\tif (input.hasClickHandler) return 'button';\n\tif (input.experienceId?.trim()) return 'anchor';\n\treturn 'presentational';\n}\n\nexport function resolvePlayerBaseUrl(playerBaseUrl?: string): string {\n\tconst configured = playerBaseUrl?.trim();\n\tif (configured) return configured.replace(/\\/$/, '');\n\n\tif (useExplicitLocalStack()) {\n\t\treturn LOCAL_PLAYER_ORIGIN;\n\t}\n\n\treturn PRODUCTION_PLAYER_ORIGIN;\n}\n\n/**\n * Build hosted player launch URL: `{player}/{experienceId}?returnUrl=…`\n * When `returnUrl` is omitted, callers should assign on click (SSR-safe) or pass an explicit URL.\n */\nexport function buildHostedLaunchUrl(options: {\n\treadonly experienceId: string;\n\treadonly returnUrl?: string;\n\treadonly playerBaseUrl?: string;\n}): string {\n\tconst experienceId = options.experienceId.trim();\n\tconst base = resolvePlayerBaseUrl(options.playerBaseUrl);\n\tconst url = new URL(`${base}/${encodeURIComponent(experienceId)}`);\n\tconst returnUrl = options.returnUrl?.trim();\n\tif (returnUrl) {\n\t\turl.searchParams.set('returnUrl', returnUrl);\n\t}\n\treturn url.toString();\n}\n\n/** Resolve href for anchor mode (app link or hosted launch). */\nexport function resolveThumbnailHref(options: {\n\treadonly href?: string;\n\treadonly experienceId?: string;\n\treadonly returnUrl?: string;\n\treadonly playerBaseUrl?: string;\n\t/** When true and returnUrl omitted, use window.location.href (browser only). */\n\treadonly useCurrentPageAsReturnUrl?: boolean;\n}): string | undefined {\n\tconst href = options.href?.trim();\n\tif (href) return href;\n\n\tconst experienceId = options.experienceId?.trim();\n\tif (!experienceId) return undefined;\n\n\tlet returnUrl = options.returnUrl?.trim();\n\tif (!returnUrl && options.useCurrentPageAsReturnUrl && typeof window !== 'undefined') {\n\t\treturnUrl = window.location.href;\n\t}\n\n\treturn buildHostedLaunchUrl({\n\t\texperienceId,\n\t\t...(returnUrl ? { returnUrl } : {}),\n\t\tplayerBaseUrl: options.playerBaseUrl\n\t});\n}\n","/** Touch / coarse pointers — limit how many thumbs start loading at once. */\nexport const COARSE_THUMB_LOAD_CONCURRENCY = 4;\n/** Delay before a started thumb frees its queue slot for the next card. */\nexport const COARSE_THUMB_LOAD_STAGGER_MS = 160;\n\nexport function prefersCoarsePointer(): boolean {\n\tif (typeof window === 'undefined') return false;\n\treturn window.matchMedia('(hover: none), (pointer: coarse)').matches;\n}\n\ntype QueuedLoad = {\n\treadonly start: () => void;\n\tcancelled: boolean;\n};\n\nlet inflight = 0;\nconst waiting: QueuedLoad[] = [];\n\nfunction maxConcurrent(): number {\n\treturn prefersCoarsePointer() ? COARSE_THUMB_LOAD_CONCURRENCY : Number.POSITIVE_INFINITY;\n}\n\nfunction staggerMs(): number {\n\treturn prefersCoarsePointer() ? COARSE_THUMB_LOAD_STAGGER_MS : 0;\n}\n\nfunction pump(): void {\n\tconst limit = maxConcurrent();\n\twhile (inflight < limit && waiting.length > 0) {\n\t\tconst next = waiting.shift();\n\t\tif (!next || next.cancelled) continue;\n\t\tinflight += 1;\n\t\tnext.start();\n\t\tconst delay = staggerMs();\n\t\tif (delay <= 0) {\n\t\t\tinflight = Math.max(0, inflight - 1);\n\t\t\tcontinue;\n\t\t}\n\t\twindow.setTimeout(() => {\n\t\t\tinflight = Math.max(0, inflight - 1);\n\t\t\tpump();\n\t\t}, delay);\n\t}\n}\n\n/**\n * On coarse pointers, start thumb image loads in small waves so old devices\n * are not hit with dozens of concurrent decodes. Fine pointers start immediately.\n * Returns a cancel function (no-op after start has run).\n */\nexport function scheduleThumbLoad(start: () => void): () => void {\n\tif (!prefersCoarsePointer()) {\n\t\tstart();\n\t\treturn () => {};\n\t}\n\n\tconst item: QueuedLoad = { start, cancelled: false };\n\twaiting.push(item);\n\tpump();\n\n\treturn () => {\n\t\titem.cancelled = true;\n\t};\n}\n\n/** Test helper — clear queue state between vitest cases. */\nexport function resetThumbLoadSchedulerForTests(): void {\n\tinflight = 0;\n\twaiting.length = 0;\n}\n","import { prefersCoarsePointer, scheduleThumbLoad } from './thumbLoadScheduler';\n\nexport type LazyThumbOptions = {\n\treadonly rootMargin?: string;\n\treadonly onVisibleChange: (visible: boolean) => void;\n};\n\n/** Desktop: prefetch earlier. Coarse/touch: tighter margin to cut burst loads. */\nexport function getDefaultLazyRootMargin(): string {\n\treturn prefersCoarsePointer() ? '96px 0px' : '280px 0px';\n}\n\nfunction parseVerticalRootMarginPx(rootMargin: string): number {\n\tconst first = rootMargin.trim().split(/\\s+/)[0] ?? '0px';\n\tconst value = Number.parseFloat(first);\n\treturn Number.isFinite(value) ? Math.abs(value) : 280;\n}\n\nfunction isNearViewport(element: HTMLElement, marginPx: number): boolean {\n\tif (typeof window === 'undefined') return false;\n\tconst rect = element.getBoundingClientRect();\n\treturn rect.bottom >= -marginPx && rect.top <= window.innerHeight + marginPx;\n}\n\n/** Observe the thumb and enable image loads when near the viewport. */\nexport function attachLazyThumb(element: HTMLElement, options: LazyThumbOptions): () => void {\n\tconst { onVisibleChange } = options;\n\tconst rootMargin = options.rootMargin ?? getDefaultLazyRootMargin();\n\tconst marginPx = parseVerticalRootMarginPx(rootMargin);\n\tlet visible = false;\n\tlet loadStarted = false;\n\tlet cancelScheduled: (() => void) | null = null;\n\n\tconst requestLoad = () => {\n\t\tif (loadStarted) return;\n\t\tcancelScheduled?.();\n\t\tcancelScheduled = scheduleThumbLoad(() => {\n\t\t\tcancelScheduled = null;\n\t\t\tloadStarted = true;\n\t\t\tonVisibleChange(true);\n\t\t});\n\t};\n\n\tconst setVisible = (next: boolean) => {\n\t\tif (next === visible) return;\n\t\tvisible = next;\n\t\tif (next) {\n\t\t\trequestLoad();\n\t\t\treturn;\n\t\t}\n\t\t// Keep images once started; only cancel a queued (not-yet-started) load.\n\t\tcancelScheduled?.();\n\t\tcancelScheduled = null;\n\t\tonVisibleChange(false);\n\t};\n\n\tif (typeof IntersectionObserver === 'undefined') {\n\t\trequestLoad();\n\t\treturn () => {\n\t\t\tcancelScheduled?.();\n\t\t\tcancelScheduled = null;\n\t\t};\n\t}\n\n\tconst observer = new IntersectionObserver(\n\t\t(entries) => {\n\t\t\tsetVisible(entries.some((entry) => entry.isIntersecting));\n\t\t},\n\t\t{ root: null, rootMargin, threshold: 0 }\n\t);\n\n\tobserver.observe(element);\n\n\tif (isNearViewport(element, marginPx)) {\n\t\tsetVisible(true);\n\t}\n\n\treturn () => {\n\t\tcancelScheduled?.();\n\t\tcancelScheduled = null;\n\t\tobserver.disconnect();\n\t};\n}\n\nexport function attachImageReady(element: HTMLImageElement, onReady: () => void): () => void {\n\tconst notify = () => onReady();\n\tif (element.complete) {\n\t\tqueueMicrotask(notify);\n\t} else {\n\t\telement.addEventListener('load', notify, { once: true });\n\t\telement.addEventListener('error', notify, { once: true });\n\t}\n\treturn () => {\n\t\telement.removeEventListener('load', notify);\n\t\telement.removeEventListener('error', notify);\n\t};\n}\n","/** Touch devices without hover — drive thumbnail parallax from scroll position. */\nexport function prefersScrollLinkedParallax(): boolean {\n\tif (typeof window === 'undefined') return false;\n\tif (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return false;\n\treturn window.matchMedia('(hover: none), (pointer: coarse)').matches;\n}\n\n/**\n * Map an element's vertical centre in the viewport to horizontal parallax in [-1, 1].\n */\nexport function horizontalParallaxFromViewportY(rect: DOMRect, viewportHeight: number): number {\n\tconst centerY = rect.top + rect.height / 2;\n\tconst t = centerY / Math.max(viewportHeight, 1);\n\treturn (t - 0.5) * 2;\n}\n\nexport type ScrollLinkedParallaxOptions = {\n\treadonly onParallax: (x: number) => void;\n\treadonly pointerActive?: () => boolean;\n};\n\ntype ScrollParallaxSubscriber = {\n\treadonly element: HTMLElement;\n\treadonly onParallax: (x: number) => void;\n\treadonly pointerActive?: () => boolean;\n};\n\nconst subscribers = new Set<ScrollParallaxSubscriber>();\nlet listening = false;\nlet frame = 0;\n\nfunction syncAll(): void {\n\tframe = 0;\n\tif (subscribers.size === 0 || typeof window === 'undefined') return;\n\tconst viewportHeight = window.innerHeight;\n\tfor (const entry of subscribers) {\n\t\tif (entry.pointerActive?.()) continue;\n\t\tconst rect = entry.element.getBoundingClientRect();\n\t\t// Skip off-screen thumbs — avoids N layout reads + framework updates per scroll.\n\t\tif (rect.bottom < -64 || rect.top > viewportHeight + 64) continue;\n\t\tentry.onParallax(horizontalParallaxFromViewportY(rect, viewportHeight));\n\t}\n}\n\nfunction scheduleSync(): void {\n\tif (frame !== 0) return;\n\tframe = requestAnimationFrame(syncAll);\n}\n\nfunction ensureListening(): void {\n\tif (listening || typeof window === 'undefined') return;\n\tlistening = true;\n\twindow.addEventListener('scroll', scheduleSync, { passive: true });\n\twindow.addEventListener('resize', scheduleSync, { passive: true });\n}\n\nfunction stopListeningIfIdle(): void {\n\tif (subscribers.size > 0 || !listening || typeof window === 'undefined') return;\n\tlistening = false;\n\tif (frame !== 0) {\n\t\tcancelAnimationFrame(frame);\n\t\tframe = 0;\n\t}\n\twindow.removeEventListener('scroll', scheduleSync);\n\twindow.removeEventListener('resize', scheduleSync);\n}\n\n/**\n * Subscribe to scroll/resize and update horizontal parallax from viewport Y.\n * Uses one shared window listener for all thumbs (old iPads with large galleries).\n */\nexport function attachScrollLinkedParallax(\n\telement: HTMLElement,\n\toptions: ScrollLinkedParallaxOptions\n): () => void {\n\tif (!prefersScrollLinkedParallax()) return () => {};\n\n\tconst entry: ScrollParallaxSubscriber = {\n\t\telement,\n\t\tonParallax: options.onParallax,\n\t\tpointerActive: options.pointerActive\n\t};\n\tsubscribers.add(entry);\n\tensureListening();\n\n\tif (!entry.pointerActive?.()) {\n\t\toptions.onParallax(\n\t\t\thorizontalParallaxFromViewportY(element.getBoundingClientRect(), window.innerHeight)\n\t\t);\n\t}\n\n\treturn () => {\n\t\tsubscribers.delete(entry);\n\t\tstopListeningIfIdle();\n\t};\n}\n\n/** Test helper — clear shared scroll state between vitest cases. */\nexport function resetScrollLinkedParallaxForTests(): void {\n\tsubscribers.clear();\n\tif (typeof window !== 'undefined' && listening) {\n\t\twindow.removeEventListener('scroll', scheduleSync);\n\t\twindow.removeEventListener('resize', scheduleSync);\n\t}\n\tlistening = false;\n\tif (frame !== 0) {\n\t\tcancelAnimationFrame(frame);\n\t\tframe = 0;\n\t}\n}\n","/** Shared styles for ExperienceThumbnail (class prefix `liforma-et`). */\nexport const EXPERIENCE_THUMBNAIL_CSS = `\n.liforma-et {\n\t--liforma-et-parallax-x: 0;\n\t--liforma-et-parallax-y: 0;\n\t--liforma-et-bg-scale: 1;\n\t--liforma-et-fg-scale: 1;\n\t--liforma-et-avatar-scale: 1;\n\t--liforma-et-bg-shift: 0px;\n\t--liforma-et-fg-shift: 0px;\n\t--liforma-et-avatar-shift: 0px;\n\t--liforma-et-reveal-duration: 420ms;\n\n\tbox-sizing: border-box;\n\tposition: relative;\n\tdisplay: block;\n\twidth: 100%;\n\theight: 100%;\n\tmin-height: 0;\n\tmargin: 0;\n\tpadding: 0;\n\tborder: 0;\n\tborder-radius: 0.65rem;\n\toverflow: hidden;\n\tbackground: #111;\n\tcolor: inherit;\n\ttext-decoration: none;\n\tcursor: inherit;\n\t-webkit-tap-highlight-color: transparent;\n}\n\na.liforma-et,\nbutton.liforma-et {\n\tcursor: pointer;\n}\n\nbutton.liforma-et {\n\tfont: inherit;\n\tappearance: none;\n}\n\n.liforma-et__placeholder {\n\tposition: absolute;\n\tinset: 0;\n\tz-index: 0;\n\tbackground:\n\t\tradial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.06), transparent 58%),\n\t\tlinear-gradient(180deg, #1a1a1a 0%, #101010 100%);\n\topacity: 1;\n\ttransition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n.liforma-et--revealed .liforma-et__placeholder {\n\topacity: 0;\n}\n\n.liforma-et__media {\n\topacity: 0;\n\ttransition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n.liforma-et__media--ready {\n\topacity: 1;\n}\n\n.liforma-et__background {\n\tposition: absolute;\n\tinset: 0;\n\tz-index: 1;\n\twidth: 100%;\n\theight: 100%;\n\tobject-fit: cover;\n\tobject-position: center center;\n\ttransform: translate(\n\t\t\tcalc(var(--liforma-et-parallax-x) * var(--liforma-et-bg-shift)),\n\t\t\tcalc(var(--liforma-et-parallax-y) * var(--liforma-et-bg-shift))\n\t\t)\n\t\tscale(var(--liforma-et-bg-scale));\n\ttransform-origin: center center;\n\ttransition:\n\t\topacity var(--liforma-et-reveal-duration) ease,\n\t\ttransform 160ms ease;\n}\n\n.liforma-et__avatar {\n\tposition: relative;\n\tz-index: 2;\n\tdisplay: block;\n\twidth: 100%;\n\theight: 100%;\n\tobject-fit: contain;\n\tobject-position: center bottom;\n\ttransform: scale(var(--liforma-et-avatar-scale))\n\t\ttranslate(\n\t\t\tcalc(var(--liforma-et-parallax-x) * var(--liforma-et-avatar-shift)),\n\t\t\tcalc(var(--liforma-et-parallax-y) * var(--liforma-et-avatar-shift))\n\t\t);\n\ttransform-origin: center center;\n\ttransition:\n\t\topacity var(--liforma-et-reveal-duration) ease,\n\t\ttransform 160ms ease;\n}\n\n/* Gallery plates are typically square in a square tile — contain vs cover is a no-op\n without a zoom. Scale the whole scene from the upper third so Face matches\n player fit (location + avatar crop together). */\n.liforma-et--fit-face {\n\t--liforma-et-avatar-scale: 1.85;\n\t--liforma-et-bg-scale: 1.85;\n\t--liforma-et-fg-scale: 1.85;\n}\n\n.liforma-et--fit-face .liforma-et__avatar,\n.liforma-et--fit-face .liforma-et__background,\n.liforma-et--fit-face .liforma-et__foreground {\n\ttransform-origin: 50% 18%;\n}\n\n.liforma-et--fit-face .liforma-et__avatar {\n\tobject-fit: cover;\n\tobject-position: 50% 18%;\n}\n\n/* Bust / medium: less zoom than face so upper chest stays in frame (player 3.75H window). */\n.liforma-et--fit-medium {\n\t--liforma-et-avatar-scale: 1.35;\n\t--liforma-et-bg-scale: 1.35;\n\t--liforma-et-fg-scale: 1.35;\n}\n\n.liforma-et--fit-medium .liforma-et__avatar,\n.liforma-et--fit-medium .liforma-et__background,\n.liforma-et--fit-medium .liforma-et__foreground {\n\ttransform-origin: 50% 28%;\n}\n\n.liforma-et--fit-medium .liforma-et__avatar {\n\tobject-fit: cover;\n\tobject-position: 50% 28%;\n}\n\n.liforma-et__foreground {\n\tposition: absolute;\n\tinset: 0;\n\tz-index: 3;\n\twidth: 100%;\n\theight: 100%;\n\tobject-fit: cover;\n\tobject-position: center center;\n\tpointer-events: none;\n\ttransform: translate(\n\t\t\tcalc(var(--liforma-et-parallax-x) * var(--liforma-et-fg-shift) * -1),\n\t\t\tcalc(var(--liforma-et-parallax-y) * var(--liforma-et-fg-shift) * -1)\n\t\t)\n\t\tscale(var(--liforma-et-fg-scale));\n\ttransform-origin: center center;\n\ttransition:\n\t\topacity var(--liforma-et-reveal-duration) ease,\n\t\ttransform 160ms ease;\n}\n\n.liforma-et--parallax {\n\t--liforma-et-bg-scale: 1.08;\n\t--liforma-et-fg-scale: 1.05;\n\t--liforma-et-avatar-scale: 1.08;\n\t--liforma-et-bg-shift: 10px;\n\t--liforma-et-fg-shift: 4px;\n\t--liforma-et-avatar-shift: 4px;\n}\n\n/* Promote layers only while parallax is active — avoids N compositor surfaces on galleries. */\n.liforma-et--parallax .liforma-et__background,\n.liforma-et--parallax .liforma-et__foreground,\n.liforma-et--parallax .liforma-et__avatar {\n\twill-change: transform;\n}\n\n.liforma-et--parallax.liforma-et--fit-face {\n\t--liforma-et-avatar-scale: 1.95;\n\t--liforma-et-bg-scale: 1.95;\n\t--liforma-et-fg-scale: 1.95;\n\t--liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--parallax.liforma-et--fit-medium {\n\t--liforma-et-avatar-scale: 1.42;\n\t--liforma-et-bg-scale: 1.42;\n\t--liforma-et-fg-scale: 1.42;\n\t--liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--scroll-parallax .liforma-et__background,\n.liforma-et--scroll-parallax .liforma-et__foreground,\n.liforma-et--scroll-parallax .liforma-et__avatar {\n\ttransition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n@media (prefers-reduced-motion: reduce) {\n\t.liforma-et {\n\t\t--liforma-et-reveal-duration: 0ms;\n\t}\n\n\t.liforma-et--parallax {\n\t\t--liforma-et-bg-scale: 1;\n\t\t--liforma-et-fg-scale: 1;\n\t\t--liforma-et-avatar-scale: 1;\n\t\t--liforma-et-bg-shift: 0px;\n\t\t--liforma-et-fg-shift: 0px;\n\t\t--liforma-et-avatar-shift: 0px;\n\t}\n\n\t.liforma-et--parallax.liforma-et--fit-face {\n\t\t--liforma-et-avatar-scale: 1.85;\n\t\t--liforma-et-bg-scale: 1.85;\n\t\t--liforma-et-fg-scale: 1.85;\n\t}\n\n\t.liforma-et__background,\n\t.liforma-et__foreground,\n\t.liforma-et__avatar {\n\t\ttransition: none;\n\t}\n}\n`.trim();\n","import {\n\tattachImageReady,\n\tattachLazyThumb,\n\tattachScrollLinkedParallax,\n\tEXPERIENCE_THUMBNAIL_CSS,\n\thorizontalParallaxFromViewportY,\n\tresolveThumbnailHref,\n\tresolveThumbnailInteraction,\n\tresolveThumbnailLayers,\n\tthumbnailFitClass,\n\ttype GalleryThumb\n} from '../thumbnail/index';\n\nconst ELEMENT_NAME = 'liforma-experience-thumbnail';\n\nfunction parseGalleryThumb(raw: string | null): GalleryThumb | undefined {\n\tif (!raw?.trim()) return undefined;\n\ttry {\n\t\tconst parsed = JSON.parse(raw) as GalleryThumb;\n\t\tif (parsed && typeof parsed.avatarImage === 'string') return parsed;\n\t} catch {\n\t\t/* ignore */\n\t}\n\treturn undefined;\n}\n\nclass LiformaExperienceThumbnailElement extends HTMLElement {\n\tstatic get observedAttributes(): string[] {\n\t\treturn [\n\t\t\t'experience-id',\n\t\t\t'gallery-thumb',\n\t\t\t'avatar-image',\n\t\t\t'background-image',\n\t\t\t'foreground-image',\n\t\t\t'fallback-image',\n\t\t\t'alt',\n\t\t\t'href',\n\t\t\t'target',\n\t\t\t'rel',\n\t\t\t'return-url',\n\t\t\t'player-base-url',\n\t\t\t'parallax',\n\t\t\t'fit',\n\t\t\t'lazy'\n\t\t];\n\t}\n\n\t#root: HTMLElement | null = null;\n\t#cleanup: (() => void)[] = [];\n\t#shouldLoad = false;\n\t#hovering = false;\n\t#pointerDown = false;\n\t#scrollParallax = false;\n\t#parallaxX = 0;\n\t#parallaxY = 0;\n\t#avatarLoadFailed = false;\n\t#backgroundReady = false;\n\t#avatarReady = false;\n\t#foregroundReady = false;\n\n\tconnectedCallback(): void {\n\t\tthis.#render();\n\t}\n\n\tdisconnectedCallback(): void {\n\t\tthis.#teardown();\n\t}\n\n\tattributeChangedCallback(): void {\n\t\tif (this.isConnected) this.#render();\n\t}\n\n\t#teardown(): void {\n\t\tfor (const fn of this.#cleanup) fn();\n\t\tthis.#cleanup = [];\n\t\tthis.#root = null;\n\t}\n\n\t#boolAttr(name: string, defaultValue: boolean): boolean {\n\t\tif (!this.hasAttribute(name)) return defaultValue;\n\t\tconst value = this.getAttribute(name);\n\t\tif (value === null || value === '' || value === 'true') return true;\n\t\tif (value === 'false') return false;\n\t\treturn defaultValue;\n\t}\n\n\t#render(): void {\n\t\tthis.#teardown();\n\n\t\tconst shadow = this.shadowRoot ?? this.attachShadow({ mode: 'open' });\n\t\tconst style = document.createElement('style');\n\t\tstyle.textContent = EXPERIENCE_THUMBNAIL_CSS;\n\t\tshadow.replaceChildren(style);\n\n\t\tconst alt = this.getAttribute('alt')?.trim() || 'Experience';\n\t\tconst hrefAttr = this.getAttribute('href');\n\t\tconst experienceId = this.getAttribute('experience-id');\n\t\tconst hasClickHandler = this.hasAttribute('onclick') || typeof this.onclick === 'function';\n\t\tconst interaction = resolveThumbnailInteraction({\n\t\t\thref: hrefAttr,\n\t\t\thasClickHandler,\n\t\t\texperienceId\n\t\t});\n\n\t\tconst layers = resolveThumbnailLayers({\n\t\t\tgalleryThumb: parseGalleryThumb(this.getAttribute('gallery-thumb')),\n\t\t\tavatarImage: this.getAttribute('avatar-image') ?? undefined,\n\t\t\tbackgroundImage: this.getAttribute('background-image') ?? undefined,\n\t\t\tforegroundImage: this.getAttribute('foreground-image') ?? undefined,\n\t\t\tfallbackImage: this.getAttribute('fallback-image') ?? undefined\n\t\t});\n\t\tif (!layers) return;\n\n\t\tconst parallaxEnabled = this.#boolAttr('parallax', true);\n\t\tconst fitAttr = this.getAttribute('fit')?.trim();\n\t\tconst fit = fitAttr === 'face' || fitAttr === 'medium' ? fitAttr : 'full';\n\t\tconst lazy = this.#boolAttr('lazy', true);\n\t\tthis.#shouldLoad = !lazy;\n\n\t\tconst isHostedLaunch =\n\t\t\tinteraction === 'anchor' && !hrefAttr?.trim() && Boolean(experienceId?.trim());\n\t\tconst resolvedHref = resolveThumbnailHref({\n\t\t\thref: hrefAttr ?? undefined,\n\t\t\texperienceId: experienceId ?? undefined,\n\t\t\treturnUrl: this.getAttribute('return-url') ?? undefined,\n\t\t\tplayerBaseUrl: this.getAttribute('player-base-url') ?? undefined,\n\t\t\tuseCurrentPageAsReturnUrl:\n\t\t\t\tisHostedLaunch && !this.getAttribute('return-url')?.trim()\n\t\t});\n\n\t\tlet root: HTMLElement;\n\t\tif (interaction === 'anchor' && resolvedHref) {\n\t\t\tconst a = document.createElement('a');\n\t\t\ta.href = resolvedHref;\n\t\t\tconst target = this.getAttribute('target');\n\t\t\tconst rel = this.getAttribute('rel');\n\t\t\tif (target) a.target = target;\n\t\t\tif (rel) a.rel = rel;\n\t\t\troot = a;\n\t\t} else if (interaction === 'button') {\n\t\t\tconst button = document.createElement('button');\n\t\t\tbutton.type = 'button';\n\t\t\troot = button;\n\t\t} else {\n\t\t\troot = document.createElement('div');\n\t\t\troot.setAttribute('role', 'img');\n\t\t}\n\n\t\troot.className = 'liforma-et';\n\t\troot.setAttribute('aria-label', alt);\n\t\tthis.#root = root;\n\t\tshadow.appendChild(root);\n\n\t\tconst syncClass = () => {\n\t\t\tconst hasScene = Boolean(layers.backgroundImage);\n\t\t\tconst parallaxActive = parallaxEnabled && (this.#hovering || this.#scrollParallax);\n\t\t\t// Fade placeholder as soon as any layer can paint — don't wait for the slowest plate.\n\t\t\tconst reveal =\n\t\t\t\tthis.#shouldLoad &&\n\t\t\t\t(this.#avatarReady || this.#backgroundReady || this.#foregroundReady);\n\t\t\troot.className = [\n\t\t\t\t'liforma-et',\n\t\t\t\thasScene ? 'liforma-et--scene' : '',\n\t\t\t\tthumbnailFitClass(fit),\n\t\t\t\tparallaxActive ? 'liforma-et--parallax' : '',\n\t\t\t\tthis.#scrollParallax ? 'liforma-et--scroll-parallax' : '',\n\t\t\t\tthis.#shouldLoad && !reveal ? 'liforma-et--loading' : '',\n\t\t\t\treveal ? 'liforma-et--revealed' : ''\n\t\t\t]\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join(' ');\n\t\t\troot.style.setProperty('--liforma-et-parallax-x', String(this.#parallaxX));\n\t\t\troot.style.setProperty('--liforma-et-parallax-y', String(this.#parallaxY));\n\t\t};\n\n\t\tconst placeholder = document.createElement('span');\n\t\tplaceholder.className = 'liforma-et__placeholder';\n\t\tplaceholder.setAttribute('aria-hidden', 'true');\n\t\troot.appendChild(placeholder);\n\n\t\tconst paintImages = () => {\n\t\t\tif (!this.#shouldLoad) return;\n\t\t\tconst avatarSrc =\n\t\t\t\tthis.#avatarLoadFailed && layers.fallbackImage\n\t\t\t\t\t? layers.fallbackImage\n\t\t\t\t\t: layers.avatarImage;\n\n\t\t\tif (layers.backgroundImage && !root.querySelector('.liforma-et__background')) {\n\t\t\t\tconst img = document.createElement('img');\n\t\t\t\timg.className = 'liforma-et__background liforma-et__media';\n\t\t\t\timg.alt = '';\n\t\t\t\timg.decoding = 'async';\n\t\t\t\timg.src = layers.backgroundImage;\n\t\t\t\tthis.#cleanup.push(\n\t\t\t\t\tattachImageReady(img, () => {\n\t\t\t\t\t\tthis.#backgroundReady = true;\n\t\t\t\t\t\timg.classList.add('liforma-et__media--ready');\n\t\t\t\t\t\tsyncClass();\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t\troot.appendChild(img);\n\t\t\t}\n\n\t\t\tlet avatar = root.querySelector('.liforma-et__avatar') as HTMLImageElement | null;\n\t\t\tif (!avatar) {\n\t\t\t\tavatar = document.createElement('img');\n\t\t\t\tavatar.className = 'liforma-et__avatar liforma-et__media';\n\t\t\t\tavatar.alt = '';\n\t\t\t\tavatar.decoding = 'async';\n\t\t\t\tavatar.addEventListener('error', () => {\n\t\t\t\t\tif (layers.fallbackImage && !this.#avatarLoadFailed) {\n\t\t\t\t\t\tthis.#avatarLoadFailed = true;\n\t\t\t\t\t\tavatar!.src = layers.fallbackImage;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.#avatarReady = true;\n\t\t\t\t\t\tsyncClass();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tthis.#cleanup.push(\n\t\t\t\t\tattachImageReady(avatar, () => {\n\t\t\t\t\t\tthis.#avatarReady = true;\n\t\t\t\t\t\tavatar!.classList.add('liforma-et__media--ready');\n\t\t\t\t\t\tsyncClass();\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t\troot.appendChild(avatar);\n\t\t\t}\n\t\t\tif (avatar.src !== avatarSrc) avatar.src = avatarSrc;\n\n\t\t\tif (layers.foregroundImage && !root.querySelector('.liforma-et__foreground')) {\n\t\t\t\tconst img = document.createElement('img');\n\t\t\t\timg.className = 'liforma-et__foreground liforma-et__media';\n\t\t\t\timg.alt = '';\n\t\t\t\timg.decoding = 'async';\n\t\t\t\timg.src = layers.foregroundImage;\n\t\t\t\tthis.#cleanup.push(\n\t\t\t\t\tattachImageReady(img, () => {\n\t\t\t\t\t\tthis.#foregroundReady = true;\n\t\t\t\t\t\timg.classList.add('liforma-et__media--ready');\n\t\t\t\t\t\tsyncClass();\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t\troot.appendChild(img);\n\t\t\t}\n\t\t\tsyncClass();\n\t\t};\n\n\t\tif (lazy) {\n\t\t\tthis.#cleanup.push(\n\t\t\t\tattachLazyThumb(root, {\n\t\t\t\t\tonVisibleChange: (visible) => {\n\t\t\t\t\t\tif (!visible) return;\n\t\t\t\t\t\tthis.#shouldLoad = true;\n\t\t\t\t\t\tpaintImages();\n\t\t\t\t\t\tsyncClass();\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t);\n\t\t} else {\n\t\t\tpaintImages();\n\t\t}\n\n\t\tif (parallaxEnabled) {\n\t\t\tthis.#cleanup.push(\n\t\t\t\tattachScrollLinkedParallax(root, {\n\t\t\t\t\tonParallax: (x) => {\n\t\t\t\t\t\tthis.#scrollParallax = true;\n\t\t\t\t\t\tif (!this.#pointerDown) {\n\t\t\t\t\t\t\tthis.#parallaxX = x;\n\t\t\t\t\t\t\tthis.#parallaxY = 0;\n\t\t\t\t\t\t\tsyncClass();\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tpointerActive: () => this.#pointerDown\n\t\t\t\t})\n\t\t\t);\n\n\t\t\tconst onPointerMove = (event: PointerEvent) => {\n\t\t\t\tif (this.#scrollParallax) return;\n\t\t\t\tconst rect = root.getBoundingClientRect();\n\t\t\t\tif (rect.width <= 0 || rect.height <= 0) return;\n\t\t\t\tthis.#parallaxX = ((event.clientX - rect.left) / rect.width - 0.5) * 2;\n\t\t\t\tthis.#parallaxY = ((event.clientY - rect.top) / rect.height - 0.5) * 2;\n\t\t\t\tsyncClass();\n\t\t\t};\n\t\t\tconst onPointerDown = (event: PointerEvent) => {\n\t\t\t\tthis.#pointerDown = true;\n\t\t\t\tif (event.pointerType === 'mouse') this.#hovering = true;\n\t\t\t\tsyncClass();\n\t\t\t};\n\t\t\tconst onPointerUp = () => {\n\t\t\t\tconst wasDown = this.#pointerDown;\n\t\t\t\tthis.#pointerDown = false;\n\t\t\t\tthis.#hovering = false;\n\t\t\t\tif (this.#scrollParallax && wasDown) {\n\t\t\t\t\tthis.#parallaxX = horizontalParallaxFromViewportY(\n\t\t\t\t\t\troot.getBoundingClientRect(),\n\t\t\t\t\t\twindow.innerHeight\n\t\t\t\t\t);\n\t\t\t\t\tthis.#parallaxY = 0;\n\t\t\t\t} else if (!this.#scrollParallax) {\n\t\t\t\t\tthis.#parallaxX = 0;\n\t\t\t\t\tthis.#parallaxY = 0;\n\t\t\t\t}\n\t\t\t\tsyncClass();\n\t\t\t};\n\t\t\troot.addEventListener('pointermove', onPointerMove);\n\t\t\troot.addEventListener('pointerdown', onPointerDown);\n\t\t\troot.addEventListener('pointerup', onPointerUp);\n\t\t\troot.addEventListener('pointercancel', onPointerUp);\n\t\t\troot.addEventListener('pointerenter', (event: PointerEvent) => {\n\t\t\t\tif (event.pointerType === 'mouse') {\n\t\t\t\t\tthis.#hovering = true;\n\t\t\t\t\tsyncClass();\n\t\t\t\t}\n\t\t\t});\n\t\t\troot.addEventListener('pointerleave', () => {\n\t\t\t\tif (!this.#pointerDown) {\n\t\t\t\t\tthis.#hovering = false;\n\t\t\t\t\tif (!this.#scrollParallax) {\n\t\t\t\t\t\tthis.#parallaxX = 0;\n\t\t\t\t\t\tthis.#parallaxY = 0;\n\t\t\t\t\t}\n\t\t\t\t\tsyncClass();\n\t\t\t\t}\n\t\t\t});\n\t\t\tthis.#cleanup.push(() => {\n\t\t\t\troot.removeEventListener('pointermove', onPointerMove);\n\t\t\t\troot.removeEventListener('pointerdown', onPointerDown);\n\t\t\t\troot.removeEventListener('pointerup', onPointerUp);\n\t\t\t\troot.removeEventListener('pointercancel', onPointerUp);\n\t\t\t});\n\t\t}\n\n\t\troot.addEventListener('click', (event: MouseEvent) => {\n\t\t\tif (isHostedLaunch && !this.getAttribute('return-url')?.trim()) {\n\t\t\t\tconst next = resolveThumbnailHref({\n\t\t\t\t\texperienceId: experienceId ?? undefined,\n\t\t\t\t\tplayerBaseUrl: this.getAttribute('player-base-url') ?? undefined,\n\t\t\t\t\tuseCurrentPageAsReturnUrl: true\n\t\t\t\t});\n\t\t\t\tif (\n\t\t\t\t\tnext &&\n\t\t\t\t\tevent.button === 0 &&\n\t\t\t\t\t!event.metaKey &&\n\t\t\t\t\t!event.ctrlKey &&\n\t\t\t\t\t!event.shiftKey\n\t\t\t\t) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\twindow.location.assign(next);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tsyncClass();\n\t}\n}\n\nif (!customElements.get(ELEMENT_NAME)) {\n\tcustomElements.define(ELEMENT_NAME, LiformaExperienceThumbnailElement);\n}\n\nexport { LiformaExperienceThumbnailElement };\n","/**\n * Thumbnail-only CDN IIFE — registers `<liforma-experience-thumbnail>` without\n * the session player (`<liforma-experience>`) or widget.\n *\n * Reference the exported class so Rollup keeps the module (customElements.define\n * runs at import time). A bare side-effect import is tree-shaken in lib mode.\n */\nimport { LiformaExperienceThumbnailElement } from './liforma-experience-thumbnail';\n\ndeclare global {\n\tinterface Window {\n\t\tLiformaThumbnail?: {\n\t\t\treadonly sdkVersion: 'v2';\n\t\t\treadonly element: typeof LiformaExperienceThumbnailElement;\n\t\t};\n\t}\n}\n\nwindow.LiformaThumbnail = {\n\tsdkVersion: 'v2',\n\telement: LiformaExperienceThumbnailElement\n};\n"],"mappings":"YA2CA,SAAgB,EAAkB,EAA0C,CAG3E,OAFI,IAAQ,OAAe,uBACvB,IAAQ,SAAiB,yBACtB,EACR,CC/CA,IAAM,EAAiB,iCACjB,EAAqB,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SAAS,OAAO,CAAI,EAE7B,CACD,CAAC,EAED,EAAU,CACX,CACD,EAEK,eAAe,IAAI,CAAY,GACnC,eAAe,OAAO,EAAc,CAAiC,ECrVtE,OAAO,iBAAmB,CACzB,WAAY,KACZ,QAAS,CACV"}
1
+ {"version":3,"file":"thumbnail.js","names":["#render","#teardown","#cleanup","#root","#boolAttr","#shouldLoad","#hovering","#scrollParallax","#avatarReady","#backgroundReady","#foregroundReady","#parallaxX","#parallaxY","#avatarLoadFailed","#pointerDown"],"sources":["../../../src/thumbnail/types.ts","../../../src/thumbnail/locationPlate.ts","../../../src/thumbnail/expandAssetUrl.ts","../../../src/thumbnail/toGalleryThumbUrl.ts","../../../src/shims/localStack.ts","../../../src/thumbnail/hostedLaunchUrl.ts","../../../src/thumbnail/thumbLoadScheduler.ts","../../../src/thumbnail/lazyLoad.ts","../../../src/thumbnail/scrollParallax.ts","../../../src/thumbnail/styles.ts","../../../src/v2/liforma-experience-thumbnail.ts","../../../src/v2/thumbnail-cdn.ts"],"sourcesContent":["/**\n * Catalog-shaped layered gallery preview.\n * Values may be absolute URLs or Liforma paths (`/avatars/…`, `/locations/…/scene`).\n */\nexport type GalleryThumb = {\n\treadonly avatarImage: string;\n\treadonly backgroundImage?: string;\n\treadonly foregroundImage?: string;\n};\n\nexport type ThumbnailInteractionKind = 'anchor' | 'button' | 'presentational';\n\nexport type ResolveThumbnailInteractionInput = {\n\treadonly href?: string | null;\n\treadonly hasClickHandler?: boolean;\n\treadonly experienceId?: string | null;\n};\n\nexport type ThumbnailLayers = {\n\treadonly avatarImage: string;\n\treadonly backgroundImage?: string;\n\treadonly foregroundImage?: string;\n\treadonly fallbackImage?: string;\n};\n\n/** Shared props across Svelte / React / Next (React uses `onClick`). */\nexport type ExperienceThumbnailBaseProps = {\n\treadonly galleryThumb?: GalleryThumb;\n\treadonly avatarImage?: string;\n\treadonly backgroundImage?: string;\n\treadonly foregroundImage?: string;\n\treadonly alt: string;\n\treadonly experienceId?: string;\n\treadonly href?: string;\n\treadonly target?: string;\n\treadonly rel?: string;\n\treadonly returnUrl?: string;\n\treadonly playerBaseUrl?: string;\n\treadonly parallax?: boolean;\n\t/** Same as `<Experience fit>`: `full` (default), `medium`, or `face`. */\n\treadonly fit?: 'full' | 'face' | 'medium';\n\treadonly lazy?: boolean;\n\treadonly className?: string;\n\treadonly fallbackImage?: string;\n\treadonly normalizeUrls?: boolean;\n\t/** CDN origin for catalog paths. Default `https://cdn.liforma.ai`. */\n\treadonly cdnBaseUrl?: string;\n};\n\nexport function thumbnailFitClass(fit?: 'full' | 'face' | 'medium'): string {\n\tif (fit === 'face') return 'liforma-et--fit-face';\n\tif (fit === 'medium') return 'liforma-et--fit-medium';\n\treturn '';\n}\n","/** Location colour plates used by ExperienceThumbnail (no zoom/portrait crops). */\nexport const THUMBNAIL_LOCATION_PLATE_SIZES = ['256x256', '800x450', '1672x941'] as const;\nexport type ThumbnailLocationPlateSize = (typeof THUMBNAIL_LOCATION_PLATE_SIZES)[number];\n\nconst LOCATION_SIZE_RE = /(-)(\\d+x\\d+)(\\.webp)(\\?|$)/i;\n\n/**\n * Square / portrait hosts keep the gallery crop. Landscape hosts use the 16:9 plate\n * so cover-fit fills height instead of clipping the top and bottom of a square.\n * Unmeasured boxes stay on `256x256`.\n */\nexport function pickThumbnailLocationPlateSize(\n\twidth: number,\n\theight: number\n): ThumbnailLocationPlateSize {\n\tif (!Number.isFinite(width) || !Number.isFinite(height) || width < 1 || height < 1) {\n\t\treturn '256x256';\n\t}\n\tif (width <= height) return '256x256';\n\tif (width > 800 || height > 450) return '1672x941';\n\treturn '800x450';\n}\n\nexport function rewriteThumbnailLocationPlateSize(\n\turl: string,\n\tsize: ThumbnailLocationPlateSize\n): string {\n\tconst trimmed = url.trim();\n\tif (!trimmed) return trimmed;\n\treturn trimmed.replace(\n\t\tLOCATION_SIZE_RE,\n\t\t(_match, dash: string, _current: string, ext: string, end: string) =>\n\t\t\t`${dash}${size}${ext}${end}`\n\t);\n}\n\n/** Observe the thumb host and report CSS box size (for plate picking). */\nexport function attachThumbnailBox(\n\telement: HTMLElement,\n\tonBox: (width: number, height: number) => void\n): () => void {\n\tconst emit = () => {\n\t\tonBox(element.clientWidth, element.clientHeight);\n\t};\n\temit();\n\tif (typeof ResizeObserver === 'undefined') {\n\t\treturn () => {};\n\t}\n\tconst observer = new ResizeObserver(emit);\n\tobserver.observe(element);\n\treturn () => observer.disconnect();\n}\n","import {\n\trewriteThumbnailLocationPlateSize,\n\ttype ThumbnailLocationPlateSize\n} from './locationPlate';\n\n/** Default origin for Liforma gallery plates (catalog paths have no host). */\nexport const DEFAULT_THUMBNAIL_CDN_BASE_URL = 'https://cdn.liforma.ai';\n\nconst LOCATION_SIZE_STEM_RE = /-(256x256|400x450|800x450|836x971|1672x941|167x94)$/i;\n\nexport function normalizeThumbnailCdnBaseUrl(cdnBaseUrl?: string): string {\n\tconst trimmed = cdnBaseUrl?.trim().replace(/\\/$/, '');\n\treturn trimmed || DEFAULT_THUMBNAIL_CDN_BASE_URL;\n}\n\nfunction isHttpUrl(value: string): boolean {\n\treturn /^https?:\\/\\//i.test(value) || value.startsWith('//');\n}\n\nfunction absoluteHttpUrl(value: string): string {\n\tif (value.startsWith('//')) return `https:${value}`;\n\treturn value;\n}\n\nfunction splitPathAndSearch(value: string): { pathname: string; search: string } {\n\tconst q = value.indexOf('?');\n\tif (q === -1) return { pathname: value, search: '' };\n\treturn { pathname: value.slice(0, q), search: value.slice(q) };\n}\n\nfunction joinCdn(cdnBase: string, pathname: string, search = ''): string {\n\tconst path = pathname.startsWith('/') ? pathname : `/${pathname}`;\n\treturn `${cdnBase}${path}${search}`;\n}\n\n/**\n * Expand a catalog location path (or keep a full URL) to a sized plate URL.\n *\n * `/locations/modern/city/office/interior-desk-daytime` →\n * `{cdn}/locations/modern/city/office/interior-desk-daytime-800x450.webp`\n */\nexport function expandThumbnailLocationUrl(\n\tref: string,\n\tlocationPlateSize: ThumbnailLocationPlateSize,\n\tcdnBaseUrl?: string\n): string {\n\tconst raw = ref.trim();\n\tif (!raw) return raw;\n\tconst cdnBase = normalizeThumbnailCdnBaseUrl(cdnBaseUrl);\n\n\tif (isHttpUrl(raw)) {\n\t\treturn rewriteThumbnailLocationPlateSize(absoluteHttpUrl(raw), locationPlateSize);\n\t}\n\n\tconst { pathname: rawPath, search } = splitPathAndSearch(raw.replace(/\\\\/g, '/'));\n\tlet pathname = rawPath;\n\n\tif (!pathname.startsWith('/')) {\n\t\tpathname = `/locations/${pathname.replace(/^locations\\//i, '')}`;\n\t} else if (/^\\/locations\\//i.test(pathname)) {\n\t\t/* already a location path */\n\t} else if (/^\\/avatars\\//i.test(pathname)) {\n\t\treturn joinCdn(cdnBase, pathname, search);\n\t} else {\n\t\treturn raw;\n\t}\n\n\tif (/\\.webp$/i.test(pathname) && !LOCATION_SIZE_STEM_RE.test(pathname.replace(/\\.webp$/i, ''))) {\n\t\treturn joinCdn(cdnBase, pathname, search);\n\t}\n\n\tlet stem = pathname.replace(/^\\/locations\\//i, '').replace(/\\.webp$/i, '');\n\tstem = stem.replace(LOCATION_SIZE_STEM_RE, '');\n\treturn `${cdnBase}/locations/${stem}-${locationPlateSize}.webp${search}`;\n}\n\n/**\n * Expand a catalog avatar path (or keep a full URL) onto the public CDN.\n * `/avatars/{id}` → `{cdn}/avatars/{id}/256/{id}_neutral.webp`\n */\nexport function expandThumbnailAvatarUrl(ref: string, cdnBaseUrl?: string): string {\n\tconst raw = ref.trim();\n\tif (!raw) return raw;\n\tconst cdnBase = normalizeThumbnailCdnBaseUrl(cdnBaseUrl);\n\n\tif (isHttpUrl(raw)) {\n\t\treturn absoluteHttpUrl(raw);\n\t}\n\n\tconst { pathname: rawPath, search } = splitPathAndSearch(raw.replace(/\\\\/g, '/'));\n\tlet pathname = rawPath;\n\n\tif (!pathname.startsWith('/')) {\n\t\tif (/^avatars\\//i.test(pathname)) {\n\t\t\tpathname = `/${pathname}`;\n\t\t} else if (/^[^/]+$/.test(pathname) && !search) {\n\t\t\treturn `${cdnBase}/avatars/${pathname}/256/${pathname}_neutral.webp`;\n\t\t} else {\n\t\t\treturn raw;\n\t\t}\n\t}\n\n\tif (!/^\\/avatars\\//i.test(pathname)) {\n\t\treturn raw;\n\t}\n\n\tconst rest = pathname.replace(/^\\/avatars\\//i, '').replace(/\\/+$/, '');\n\tif (rest && !rest.includes('/') && !search) {\n\t\treturn `${cdnBase}/avatars/${rest}/256/${rest}_neutral.webp`;\n\t}\n\n\treturn joinCdn(cdnBase, pathname, search);\n}\n","import {\n\texpandThumbnailAvatarUrl,\n\texpandThumbnailLocationUrl,\n\tnormalizeThumbnailCdnBaseUrl\n} from './expandAssetUrl';\nimport type { ThumbnailLocationPlateSize } from './locationPlate';\n\nconst AVATAR_TIER_RE = /(\\/avatars\\/[^/]+\\/)(\\d+)(\\/)/i;\nconst AVATAR_CH_PLATE_RE = /_CH(\\.webp)/i;\n\nexport type { ThumbnailLocationPlateSize };\n\nfunction isLocationRef(raw: string): boolean {\n\tif (/\\/locations\\//i.test(raw) || /^locations\\//i.test(raw)) return true;\n\tif (/^https?:\\/\\//i.test(raw) || raw.startsWith('//')) return false;\n\tif (/^\\/?avatars\\//i.test(raw)) return false;\n\tif (raw.startsWith('/')) return false;\n\treturn raw.includes('/');\n}\n\n/**\n * Rewrite known Liforma CDN URLs to gallery thumb tiers.\n * Avatars: /{tier}/ → /256/; locations: -{WxH}.webp → the requested plate\n * (`256x256` by default, `800x450` / `1672x941` for landscape hosts).\n * Catalog paths (`/locations/…/scene`, `/avatars/{id}`) expand onto the CDN first.\n * Unrecognized URLs are returned unchanged.\n */\nexport function toGalleryThumbUrl(\n\turl: string,\n\tlocationPlateSize: ThumbnailLocationPlateSize = '256x256',\n\tcdnBaseUrl?: string\n): string {\n\tconst raw = url.trim();\n\tif (!raw) return raw;\n\n\tif (isLocationRef(raw)) {\n\t\treturn expandThumbnailLocationUrl(raw, locationPlateSize, cdnBaseUrl);\n\t}\n\n\tlet next = expandThumbnailAvatarUrl(raw, cdnBaseUrl);\n\tnext = next.replace(AVATAR_TIER_RE, (_match, prefix: string, tier: string, slash: string) => {\n\t\tif (tier === '256') return `${prefix}${tier}${slash}`;\n\t\treturn `${prefix}256${slash}`;\n\t});\n\treturn next.replace(AVATAR_CH_PLATE_RE, '_neutral$1');\n}\n\nexport function resolveThumbnailLayers(input: {\n\treadonly galleryThumb?: {\n\t\treadonly avatarImage?: string;\n\t\treadonly backgroundImage?: string;\n\t\treadonly foregroundImage?: string;\n\t};\n\treadonly avatarImage?: string;\n\treadonly backgroundImage?: string;\n\treadonly foregroundImage?: string;\n\treadonly fallbackImage?: string;\n\t/** When false, keep caller absolute URLs (lightbox / preview). Paths still expand. Default true. */\n\treadonly normalize?: boolean;\n\t/** Location plate when expanding or rewriting location assets. Default `256x256`. */\n\treadonly locationPlateSize?: ThumbnailLocationPlateSize;\n\t/** CDN origin for catalog paths. Default `https://cdn.liforma.ai`. */\n\treadonly cdnBaseUrl?: string;\n}): {\n\treadonly avatarImage: string;\n\treadonly backgroundImage?: string;\n\treadonly foregroundImage?: string;\n\treadonly fallbackImage?: string;\n} | null {\n\tconst avatarSource =\n\t\tinput.avatarImage?.trim() ||\n\t\tinput.galleryThumb?.avatarImage?.trim() ||\n\t\t'';\n\tif (!avatarSource) return null;\n\n\tconst backgroundSource =\n\t\tinput.backgroundImage?.trim() || input.galleryThumb?.backgroundImage?.trim() || '';\n\tconst foregroundSource =\n\t\tinput.foregroundImage?.trim() || input.galleryThumb?.foregroundImage?.trim() || '';\n\tconst fallbackSource = input.fallbackImage?.trim() || '';\n\tconst plate = input.locationPlateSize ?? '256x256';\n\tconst cdnBaseUrl = normalizeThumbnailCdnBaseUrl(input.cdnBaseUrl);\n\tconst rewriteKnown = input.normalize !== false;\n\n\tconst rewriteAvatar = (ref: string) => {\n\t\tif (!rewriteKnown && /^https?:\\/\\//i.test(ref.trim())) return ref.trim();\n\t\treturn toGalleryThumbUrl(ref, plate, cdnBaseUrl);\n\t};\n\tconst rewriteLocation = (ref: string) => {\n\t\tif (!rewriteKnown && /^https?:\\/\\//i.test(ref.trim())) return ref.trim();\n\t\treturn expandThumbnailLocationUrl(ref, plate, cdnBaseUrl);\n\t};\n\n\treturn {\n\t\tavatarImage: rewriteAvatar(avatarSource),\n\t\t...(backgroundSource ? { backgroundImage: rewriteLocation(backgroundSource) } : {}),\n\t\t...(foregroundSource ? { foregroundImage: rewriteLocation(foregroundSource) } : {}),\n\t\t...(fallbackSource ? { fallbackImage: rewriteAvatar(fallbackSource) } : {})\n\t};\n}\n","/**\n * Opt-in local monorepo stack (api :3001, player :3002).\n * Never inferred from hostname alone — third-party demos run on localhost against production.\n */\nexport function useExplicitLocalStack(): boolean {\n\tif ((globalThis as { __LIFORMA_STACK?: string }).__LIFORMA_STACK === 'local') {\n\t\treturn true;\n\t}\n\n\tif (typeof location === 'undefined') {\n\t\treturn false;\n\t}\n\n\ttry {\n\t\treturn new URLSearchParams(location.search).get('stack') === 'local';\n\t} catch {\n\t\treturn false;\n\t}\n}\n","import { useExplicitLocalStack } from '../shims/localStack';\nimport type { ResolveThumbnailInteractionInput, ThumbnailInteractionKind } from './types';\n\nconst PRODUCTION_PLAYER_ORIGIN = 'https://player.liforma.ai';\nconst LOCAL_PLAYER_ORIGIN = 'http://localhost:3002';\n\n/** Priority: href → click-only → hosted (experienceId) → presentational. */\nexport function resolveThumbnailInteraction(\n\tinput: ResolveThumbnailInteractionInput\n): ThumbnailInteractionKind {\n\tif (input.href?.trim()) return 'anchor';\n\tif (input.hasClickHandler) return 'button';\n\tif (input.experienceId?.trim()) return 'anchor';\n\treturn 'presentational';\n}\n\nexport function resolvePlayerBaseUrl(playerBaseUrl?: string): string {\n\tconst configured = playerBaseUrl?.trim();\n\tif (configured) return configured.replace(/\\/$/, '');\n\n\tif (useExplicitLocalStack()) {\n\t\treturn LOCAL_PLAYER_ORIGIN;\n\t}\n\n\treturn PRODUCTION_PLAYER_ORIGIN;\n}\n\n/**\n * Build hosted player launch URL: `{player}/{experienceId}?returnUrl=…`\n * When `returnUrl` is omitted, callers should assign on click (SSR-safe) or pass an explicit URL.\n */\nexport function buildHostedLaunchUrl(options: {\n\treadonly experienceId: string;\n\treadonly returnUrl?: string;\n\treadonly playerBaseUrl?: string;\n}): string {\n\tconst experienceId = options.experienceId.trim();\n\tconst base = resolvePlayerBaseUrl(options.playerBaseUrl);\n\tconst url = new URL(`${base}/${encodeURIComponent(experienceId)}`);\n\tconst returnUrl = options.returnUrl?.trim();\n\tif (returnUrl) {\n\t\turl.searchParams.set('returnUrl', returnUrl);\n\t}\n\treturn url.toString();\n}\n\n/** Resolve href for anchor mode (app link or hosted launch). */\nexport function resolveThumbnailHref(options: {\n\treadonly href?: string;\n\treadonly experienceId?: string;\n\treadonly returnUrl?: string;\n\treadonly playerBaseUrl?: string;\n\t/** When true and returnUrl omitted, use window.location.href (browser only). */\n\treadonly useCurrentPageAsReturnUrl?: boolean;\n}): string | undefined {\n\tconst href = options.href?.trim();\n\tif (href) return href;\n\n\tconst experienceId = options.experienceId?.trim();\n\tif (!experienceId) return undefined;\n\n\tlet returnUrl = options.returnUrl?.trim();\n\tif (!returnUrl && options.useCurrentPageAsReturnUrl && typeof window !== 'undefined') {\n\t\treturnUrl = window.location.href;\n\t}\n\n\treturn buildHostedLaunchUrl({\n\t\texperienceId,\n\t\t...(returnUrl ? { returnUrl } : {}),\n\t\tplayerBaseUrl: options.playerBaseUrl\n\t});\n}\n","/** Touch / coarse pointers — limit how many thumbs start loading at once. */\nexport const COARSE_THUMB_LOAD_CONCURRENCY = 4;\n/** Delay before a started thumb frees its queue slot for the next card. */\nexport const COARSE_THUMB_LOAD_STAGGER_MS = 160;\n\nexport function prefersCoarsePointer(): boolean {\n\tif (typeof window === 'undefined') return false;\n\treturn window.matchMedia('(hover: none), (pointer: coarse)').matches;\n}\n\ntype QueuedLoad = {\n\treadonly start: () => void;\n\tcancelled: boolean;\n};\n\nlet inflight = 0;\nconst waiting: QueuedLoad[] = [];\n\nfunction maxConcurrent(): number {\n\treturn prefersCoarsePointer() ? COARSE_THUMB_LOAD_CONCURRENCY : Number.POSITIVE_INFINITY;\n}\n\nfunction staggerMs(): number {\n\treturn prefersCoarsePointer() ? COARSE_THUMB_LOAD_STAGGER_MS : 0;\n}\n\nfunction pump(): void {\n\tconst limit = maxConcurrent();\n\twhile (inflight < limit && waiting.length > 0) {\n\t\tconst next = waiting.shift();\n\t\tif (!next || next.cancelled) continue;\n\t\tinflight += 1;\n\t\tnext.start();\n\t\tconst delay = staggerMs();\n\t\tif (delay <= 0) {\n\t\t\tinflight = Math.max(0, inflight - 1);\n\t\t\tcontinue;\n\t\t}\n\t\twindow.setTimeout(() => {\n\t\t\tinflight = Math.max(0, inflight - 1);\n\t\t\tpump();\n\t\t}, delay);\n\t}\n}\n\n/**\n * On coarse pointers, start thumb image loads in small waves so old devices\n * are not hit with dozens of concurrent decodes. Fine pointers start immediately.\n * Returns a cancel function (no-op after start has run).\n */\nexport function scheduleThumbLoad(start: () => void): () => void {\n\tif (!prefersCoarsePointer()) {\n\t\tstart();\n\t\treturn () => {};\n\t}\n\n\tconst item: QueuedLoad = { start, cancelled: false };\n\twaiting.push(item);\n\tpump();\n\n\treturn () => {\n\t\titem.cancelled = true;\n\t};\n}\n\n/** Test helper — clear queue state between vitest cases. */\nexport function resetThumbLoadSchedulerForTests(): void {\n\tinflight = 0;\n\twaiting.length = 0;\n}\n","import { prefersCoarsePointer, scheduleThumbLoad } from './thumbLoadScheduler';\n\nexport type LazyThumbOptions = {\n\treadonly rootMargin?: string;\n\treadonly onVisibleChange: (visible: boolean) => void;\n};\n\n/** Desktop: prefetch earlier. Coarse/touch: tighter margin to cut burst loads. */\nexport function getDefaultLazyRootMargin(): string {\n\treturn prefersCoarsePointer() ? '96px 0px' : '280px 0px';\n}\n\nfunction parseVerticalRootMarginPx(rootMargin: string): number {\n\tconst first = rootMargin.trim().split(/\\s+/)[0] ?? '0px';\n\tconst value = Number.parseFloat(first);\n\treturn Number.isFinite(value) ? Math.abs(value) : 280;\n}\n\nfunction isNearViewport(element: HTMLElement, marginPx: number): boolean {\n\tif (typeof window === 'undefined') return false;\n\tconst rect = element.getBoundingClientRect();\n\treturn rect.bottom >= -marginPx && rect.top <= window.innerHeight + marginPx;\n}\n\n/** Observe the thumb and enable image loads when near the viewport. */\nexport function attachLazyThumb(element: HTMLElement, options: LazyThumbOptions): () => void {\n\tconst { onVisibleChange } = options;\n\tconst rootMargin = options.rootMargin ?? getDefaultLazyRootMargin();\n\tconst marginPx = parseVerticalRootMarginPx(rootMargin);\n\tlet visible = false;\n\tlet loadStarted = false;\n\tlet cancelScheduled: (() => void) | null = null;\n\n\tconst requestLoad = () => {\n\t\tif (loadStarted) return;\n\t\tcancelScheduled?.();\n\t\tcancelScheduled = scheduleThumbLoad(() => {\n\t\t\tcancelScheduled = null;\n\t\t\tloadStarted = true;\n\t\t\tonVisibleChange(true);\n\t\t});\n\t};\n\n\tconst setVisible = (next: boolean) => {\n\t\tif (next === visible) return;\n\t\tvisible = next;\n\t\tif (next) {\n\t\t\trequestLoad();\n\t\t\treturn;\n\t\t}\n\t\t// Keep images once started; only cancel a queued (not-yet-started) load.\n\t\tcancelScheduled?.();\n\t\tcancelScheduled = null;\n\t\tonVisibleChange(false);\n\t};\n\n\tif (typeof IntersectionObserver === 'undefined') {\n\t\trequestLoad();\n\t\treturn () => {\n\t\t\tcancelScheduled?.();\n\t\t\tcancelScheduled = null;\n\t\t};\n\t}\n\n\tconst observer = new IntersectionObserver(\n\t\t(entries) => {\n\t\t\tsetVisible(entries.some((entry) => entry.isIntersecting));\n\t\t},\n\t\t{ root: null, rootMargin, threshold: 0 }\n\t);\n\n\tobserver.observe(element);\n\n\tif (isNearViewport(element, marginPx)) {\n\t\tsetVisible(true);\n\t}\n\n\treturn () => {\n\t\tcancelScheduled?.();\n\t\tcancelScheduled = null;\n\t\tobserver.disconnect();\n\t};\n}\n\nexport function attachImageReady(element: HTMLImageElement, onReady: () => void): () => void {\n\tconst notify = () => onReady();\n\tif (element.complete) {\n\t\tqueueMicrotask(notify);\n\t} else {\n\t\telement.addEventListener('load', notify, { once: true });\n\t\telement.addEventListener('error', notify, { once: true });\n\t}\n\treturn () => {\n\t\telement.removeEventListener('load', notify);\n\t\telement.removeEventListener('error', notify);\n\t};\n}\n","/** Touch devices without hover — drive thumbnail parallax from scroll position. */\nexport function prefersScrollLinkedParallax(): boolean {\n\tif (typeof window === 'undefined') return false;\n\tif (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return false;\n\treturn window.matchMedia('(hover: none), (pointer: coarse)').matches;\n}\n\n/**\n * Map an element's vertical centre in the viewport to horizontal parallax in [-1, 1].\n */\nexport function horizontalParallaxFromViewportY(rect: DOMRect, viewportHeight: number): number {\n\tconst centerY = rect.top + rect.height / 2;\n\tconst t = centerY / Math.max(viewportHeight, 1);\n\treturn (t - 0.5) * 2;\n}\n\nexport type ScrollLinkedParallaxOptions = {\n\treadonly onParallax: (x: number) => void;\n\treadonly pointerActive?: () => boolean;\n};\n\ntype ScrollParallaxSubscriber = {\n\treadonly element: HTMLElement;\n\treadonly onParallax: (x: number) => void;\n\treadonly pointerActive?: () => boolean;\n};\n\nconst subscribers = new Set<ScrollParallaxSubscriber>();\nlet listening = false;\nlet frame = 0;\n\nfunction syncAll(): void {\n\tframe = 0;\n\tif (subscribers.size === 0 || typeof window === 'undefined') return;\n\tconst viewportHeight = window.innerHeight;\n\tfor (const entry of subscribers) {\n\t\tif (entry.pointerActive?.()) continue;\n\t\tconst rect = entry.element.getBoundingClientRect();\n\t\t// Skip off-screen thumbs — avoids N layout reads + framework updates per scroll.\n\t\tif (rect.bottom < -64 || rect.top > viewportHeight + 64) continue;\n\t\tentry.onParallax(horizontalParallaxFromViewportY(rect, viewportHeight));\n\t}\n}\n\nfunction scheduleSync(): void {\n\tif (frame !== 0) return;\n\tframe = requestAnimationFrame(syncAll);\n}\n\nfunction ensureListening(): void {\n\tif (listening || typeof window === 'undefined') return;\n\tlistening = true;\n\twindow.addEventListener('scroll', scheduleSync, { passive: true });\n\twindow.addEventListener('resize', scheduleSync, { passive: true });\n}\n\nfunction stopListeningIfIdle(): void {\n\tif (subscribers.size > 0 || !listening || typeof window === 'undefined') return;\n\tlistening = false;\n\tif (frame !== 0) {\n\t\tcancelAnimationFrame(frame);\n\t\tframe = 0;\n\t}\n\twindow.removeEventListener('scroll', scheduleSync);\n\twindow.removeEventListener('resize', scheduleSync);\n}\n\n/**\n * Subscribe to scroll/resize and update horizontal parallax from viewport Y.\n * Uses one shared window listener for all thumbs (old iPads with large galleries).\n */\nexport function attachScrollLinkedParallax(\n\telement: HTMLElement,\n\toptions: ScrollLinkedParallaxOptions\n): () => void {\n\tif (!prefersScrollLinkedParallax()) return () => {};\n\n\tconst entry: ScrollParallaxSubscriber = {\n\t\telement,\n\t\tonParallax: options.onParallax,\n\t\tpointerActive: options.pointerActive\n\t};\n\tsubscribers.add(entry);\n\tensureListening();\n\n\tif (!entry.pointerActive?.()) {\n\t\toptions.onParallax(\n\t\t\thorizontalParallaxFromViewportY(element.getBoundingClientRect(), window.innerHeight)\n\t\t);\n\t}\n\n\treturn () => {\n\t\tsubscribers.delete(entry);\n\t\tstopListeningIfIdle();\n\t};\n}\n\n/** Test helper — clear shared scroll state between vitest cases. */\nexport function resetScrollLinkedParallaxForTests(): void {\n\tsubscribers.clear();\n\tif (typeof window !== 'undefined' && listening) {\n\t\twindow.removeEventListener('scroll', scheduleSync);\n\t\twindow.removeEventListener('resize', scheduleSync);\n\t}\n\tlistening = false;\n\tif (frame !== 0) {\n\t\tcancelAnimationFrame(frame);\n\t\tframe = 0;\n\t}\n}\n","/** Shared styles for ExperienceThumbnail (class prefix `liforma-et`). */\nexport const EXPERIENCE_THUMBNAIL_CSS = `\n:host {\n\tdisplay: block;\n\twidth: 100%;\n\theight: 100%;\n\tmin-height: 0;\n}\n\n.liforma-et {\n\t--liforma-et-parallax-x: 0;\n\t--liforma-et-parallax-y: 0;\n\t--liforma-et-bg-scale: 1;\n\t--liforma-et-fg-scale: 1;\n\t--liforma-et-avatar-scale: 1;\n\t--liforma-et-bg-shift: 0px;\n\t--liforma-et-fg-shift: 0px;\n\t--liforma-et-avatar-shift: 0px;\n\t--liforma-et-reveal-duration: 420ms;\n\n\tbox-sizing: border-box;\n\tposition: relative;\n\tdisplay: block;\n\twidth: 100%;\n\theight: 100%;\n\tmin-height: 0;\n\tmargin: 0;\n\tpadding: 0;\n\tborder: 0;\n\tborder-radius: 0.65rem;\n\toverflow: hidden;\n\tbackground: #111;\n\tcolor: inherit;\n\ttext-decoration: none;\n\tcursor: inherit;\n\t-webkit-tap-highlight-color: transparent;\n}\n\na.liforma-et,\nbutton.liforma-et {\n\tcursor: pointer;\n}\n\nbutton.liforma-et {\n\tfont: inherit;\n\tappearance: none;\n}\n\n.liforma-et__placeholder {\n\tposition: absolute;\n\tinset: 0;\n\tz-index: 0;\n\tbackground:\n\t\tradial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.06), transparent 58%),\n\t\tlinear-gradient(180deg, #1a1a1a 0%, #101010 100%);\n\topacity: 1;\n\ttransition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n.liforma-et--revealed .liforma-et__placeholder {\n\topacity: 0;\n}\n\n.liforma-et__media {\n\topacity: 0;\n\ttransition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n.liforma-et__media--ready {\n\topacity: 1;\n}\n\n.liforma-et__background {\n\tposition: absolute;\n\tinset: 0;\n\tz-index: 1;\n\twidth: 100%;\n\theight: 100%;\n\tobject-fit: cover;\n\tobject-position: center center;\n\ttransform: translate(\n\t\t\tcalc(var(--liforma-et-parallax-x) * var(--liforma-et-bg-shift)),\n\t\t\tcalc(var(--liforma-et-parallax-y) * var(--liforma-et-bg-shift))\n\t\t)\n\t\tscale(var(--liforma-et-bg-scale));\n\ttransform-origin: center center;\n\ttransition:\n\t\topacity var(--liforma-et-reveal-duration) ease,\n\t\ttransform 160ms ease;\n}\n\n.liforma-et__avatar {\n\tposition: relative;\n\tz-index: 2;\n\tdisplay: block;\n\twidth: 100%;\n\theight: 100%;\n\tobject-fit: contain;\n\tobject-position: center bottom;\n\ttransform: scale(var(--liforma-et-avatar-scale))\n\t\ttranslate(\n\t\t\tcalc(var(--liforma-et-parallax-x) * var(--liforma-et-avatar-shift)),\n\t\t\tcalc(var(--liforma-et-parallax-y) * var(--liforma-et-avatar-shift))\n\t\t);\n\ttransform-origin: center center;\n\ttransition:\n\t\topacity var(--liforma-et-reveal-duration) ease,\n\t\ttransform 160ms ease;\n}\n\n/* Gallery plates are typically square in a square tile — contain vs cover is a no-op\n without a zoom. Scale the whole scene from the upper third so Face matches\n player fit (location + avatar crop together). */\n.liforma-et--fit-face {\n\t--liforma-et-avatar-scale: 1.85;\n\t--liforma-et-bg-scale: 1.85;\n\t--liforma-et-fg-scale: 1.85;\n}\n\n.liforma-et--fit-face .liforma-et__avatar,\n.liforma-et--fit-face .liforma-et__background,\n.liforma-et--fit-face .liforma-et__foreground {\n\ttransform-origin: 50% 18%;\n}\n\n.liforma-et--fit-face .liforma-et__avatar {\n\tobject-fit: cover;\n\tobject-position: 50% 18%;\n}\n\n/* Bust / medium: less zoom than face so upper chest stays in frame (player 3.75H window). */\n.liforma-et--fit-medium {\n\t--liforma-et-avatar-scale: 1.35;\n\t--liforma-et-bg-scale: 1.35;\n\t--liforma-et-fg-scale: 1.35;\n}\n\n.liforma-et--fit-medium .liforma-et__avatar,\n.liforma-et--fit-medium .liforma-et__background,\n.liforma-et--fit-medium .liforma-et__foreground {\n\ttransform-origin: 50% 28%;\n}\n\n.liforma-et--fit-medium .liforma-et__avatar {\n\tobject-fit: cover;\n\tobject-position: 50% 28%;\n}\n\n.liforma-et__foreground {\n\tposition: absolute;\n\tinset: 0;\n\tz-index: 3;\n\twidth: 100%;\n\theight: 100%;\n\tobject-fit: cover;\n\tobject-position: center center;\n\tpointer-events: none;\n\ttransform: translate(\n\t\t\tcalc(var(--liforma-et-parallax-x) * var(--liforma-et-fg-shift) * -1),\n\t\t\tcalc(var(--liforma-et-parallax-y) * var(--liforma-et-fg-shift) * -1)\n\t\t)\n\t\tscale(var(--liforma-et-fg-scale));\n\ttransform-origin: center center;\n\ttransition:\n\t\topacity var(--liforma-et-reveal-duration) ease,\n\t\ttransform 160ms ease;\n}\n\n.liforma-et--parallax {\n\t--liforma-et-bg-scale: 1.08;\n\t--liforma-et-fg-scale: 1.05;\n\t--liforma-et-avatar-scale: 1.08;\n\t--liforma-et-bg-shift: 10px;\n\t--liforma-et-fg-shift: 4px;\n\t--liforma-et-avatar-shift: 4px;\n}\n\n/* Promote layers only while parallax is active — avoids N compositor surfaces on galleries. */\n.liforma-et--parallax .liforma-et__background,\n.liforma-et--parallax .liforma-et__foreground,\n.liforma-et--parallax .liforma-et__avatar {\n\twill-change: transform;\n}\n\n.liforma-et--parallax.liforma-et--fit-face {\n\t--liforma-et-avatar-scale: 1.95;\n\t--liforma-et-bg-scale: 1.95;\n\t--liforma-et-fg-scale: 1.95;\n\t--liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--parallax.liforma-et--fit-medium {\n\t--liforma-et-avatar-scale: 1.42;\n\t--liforma-et-bg-scale: 1.42;\n\t--liforma-et-fg-scale: 1.42;\n\t--liforma-et-avatar-shift: 0px;\n}\n\n.liforma-et--scroll-parallax .liforma-et__background,\n.liforma-et--scroll-parallax .liforma-et__foreground,\n.liforma-et--scroll-parallax .liforma-et__avatar {\n\ttransition: opacity var(--liforma-et-reveal-duration) ease;\n}\n\n@media (prefers-reduced-motion: reduce) {\n\t.liforma-et {\n\t\t--liforma-et-reveal-duration: 0ms;\n\t}\n\n\t.liforma-et--parallax {\n\t\t--liforma-et-bg-scale: 1;\n\t\t--liforma-et-fg-scale: 1;\n\t\t--liforma-et-avatar-scale: 1;\n\t\t--liforma-et-bg-shift: 0px;\n\t\t--liforma-et-fg-shift: 0px;\n\t\t--liforma-et-avatar-shift: 0px;\n\t}\n\n\t.liforma-et--parallax.liforma-et--fit-face {\n\t\t--liforma-et-avatar-scale: 1.85;\n\t\t--liforma-et-bg-scale: 1.85;\n\t\t--liforma-et-fg-scale: 1.85;\n\t}\n\n\t.liforma-et__background,\n\t.liforma-et__foreground,\n\t.liforma-et__avatar {\n\t\ttransition: none;\n\t}\n}\n`.trim();\n","import {\n\tattachImageReady,\n\tattachLazyThumb,\n\tattachScrollLinkedParallax,\n\tattachThumbnailBox,\n\tEXPERIENCE_THUMBNAIL_CSS,\n\thorizontalParallaxFromViewportY,\n\tpickThumbnailLocationPlateSize,\n\tresolveThumbnailHref,\n\tresolveThumbnailInteraction,\n\tresolveThumbnailLayers,\n\tthumbnailFitClass,\n\ttype GalleryThumb\n} from '../thumbnail/index';\n\nconst ELEMENT_NAME = 'liforma-experience-thumbnail';\n\nfunction parseGalleryThumb(raw: string | null): GalleryThumb | undefined {\n\tif (!raw?.trim()) return undefined;\n\ttry {\n\t\tconst parsed = JSON.parse(raw) as GalleryThumb;\n\t\tif (parsed && typeof parsed.avatarImage === 'string') return parsed;\n\t} catch {\n\t\t/* ignore */\n\t}\n\treturn undefined;\n}\n\nclass LiformaExperienceThumbnailElement extends HTMLElement {\n\tstatic get observedAttributes(): string[] {\n\t\treturn [\n\t\t\t'experience-id',\n\t\t\t'gallery-thumb',\n\t\t\t'avatar-image',\n\t\t\t'background-image',\n\t\t\t'foreground-image',\n\t\t\t'fallback-image',\n\t\t\t'alt',\n\t\t\t'href',\n\t\t\t'target',\n\t\t\t'rel',\n\t\t\t'return-url',\n\t\t\t'player-base-url',\n\t\t\t'parallax',\n\t\t\t'fit',\n\t\t\t'lazy',\n\t\t\t'normalize-urls',\n\t\t\t'cdn-base-url'\n\t\t];\n\t}\n\n\t#root: HTMLElement | null = null;\n\t#cleanup: (() => void)[] = [];\n\t#shouldLoad = false;\n\t#hovering = false;\n\t#pointerDown = false;\n\t#scrollParallax = false;\n\t#parallaxX = 0;\n\t#parallaxY = 0;\n\t#avatarLoadFailed = false;\n\t#backgroundReady = false;\n\t#avatarReady = false;\n\t#foregroundReady = false;\n\n\tconnectedCallback(): void {\n\t\tthis.#render();\n\t}\n\n\tdisconnectedCallback(): void {\n\t\tthis.#teardown();\n\t}\n\n\tattributeChangedCallback(): void {\n\t\tif (this.isConnected) this.#render();\n\t}\n\n\t#teardown(): void {\n\t\tfor (const fn of this.#cleanup) fn();\n\t\tthis.#cleanup = [];\n\t\tthis.#root = null;\n\t}\n\n\t#boolAttr(name: string, defaultValue: boolean): boolean {\n\t\tif (!this.hasAttribute(name)) return defaultValue;\n\t\tconst value = this.getAttribute(name);\n\t\tif (value === null || value === '' || value === 'true') return true;\n\t\tif (value === 'false') return false;\n\t\treturn defaultValue;\n\t}\n\n\t#render(): void {\n\t\tthis.#teardown();\n\n\t\tconst shadow = this.shadowRoot ?? this.attachShadow({ mode: 'open' });\n\t\tconst style = document.createElement('style');\n\t\tstyle.textContent = EXPERIENCE_THUMBNAIL_CSS;\n\t\tshadow.replaceChildren(style);\n\n\t\tconst alt = this.getAttribute('alt')?.trim() || 'Experience';\n\t\tconst hrefAttr = this.getAttribute('href');\n\t\tconst experienceId = this.getAttribute('experience-id');\n\t\tconst hasClickHandler = this.hasAttribute('onclick') || typeof this.onclick === 'function';\n\t\tconst interaction = resolveThumbnailInteraction({\n\t\t\thref: hrefAttr,\n\t\t\thasClickHandler,\n\t\t\texperienceId\n\t\t});\n\n\t\tconst normalizeUrls = this.#boolAttr('normalize-urls', true);\n\t\tlet locationPlateSize = pickThumbnailLocationPlateSize(0, 0);\n\t\tconst resolveLayers = () =>\n\t\t\tresolveThumbnailLayers({\n\t\t\t\tgalleryThumb: parseGalleryThumb(this.getAttribute('gallery-thumb')),\n\t\t\t\tavatarImage: this.getAttribute('avatar-image') ?? undefined,\n\t\t\t\tbackgroundImage: this.getAttribute('background-image') ?? undefined,\n\t\t\t\tforegroundImage: this.getAttribute('foreground-image') ?? undefined,\n\t\t\t\tfallbackImage: this.getAttribute('fallback-image') ?? undefined,\n\t\t\t\tnormalize: normalizeUrls,\n\t\t\t\tlocationPlateSize,\n\t\t\t\tcdnBaseUrl: this.getAttribute('cdn-base-url') ?? undefined\n\t\t\t});\n\t\tconst initialLayers = resolveLayers();\n\t\tif (!initialLayers) return;\n\t\tlet layers = initialLayers;\n\n\t\tconst parallaxEnabled = this.#boolAttr('parallax', true);\n\t\tconst fitAttr = this.getAttribute('fit')?.trim();\n\t\tconst fit = fitAttr === 'face' || fitAttr === 'medium' ? fitAttr : 'full';\n\t\tconst lazy = this.#boolAttr('lazy', true);\n\t\tthis.#shouldLoad = !lazy;\n\n\t\tconst isHostedLaunch =\n\t\t\tinteraction === 'anchor' && !hrefAttr?.trim() && Boolean(experienceId?.trim());\n\t\tconst resolvedHref = resolveThumbnailHref({\n\t\t\thref: hrefAttr ?? undefined,\n\t\t\texperienceId: experienceId ?? undefined,\n\t\t\treturnUrl: this.getAttribute('return-url') ?? undefined,\n\t\t\tplayerBaseUrl: this.getAttribute('player-base-url') ?? undefined,\n\t\t\tuseCurrentPageAsReturnUrl:\n\t\t\t\tisHostedLaunch && !this.getAttribute('return-url')?.trim()\n\t\t});\n\n\t\tlet root: HTMLElement;\n\t\tif (interaction === 'anchor' && resolvedHref) {\n\t\t\tconst a = document.createElement('a');\n\t\t\ta.href = resolvedHref;\n\t\t\tconst target = this.getAttribute('target');\n\t\t\tconst rel = this.getAttribute('rel');\n\t\t\tif (target) a.target = target;\n\t\t\tif (rel) a.rel = rel;\n\t\t\troot = a;\n\t\t} else if (interaction === 'button') {\n\t\t\tconst button = document.createElement('button');\n\t\t\tbutton.type = 'button';\n\t\t\troot = button;\n\t\t} else {\n\t\t\troot = document.createElement('div');\n\t\t\troot.setAttribute('role', 'img');\n\t\t}\n\n\t\troot.className = 'liforma-et';\n\t\troot.setAttribute('aria-label', alt);\n\t\tthis.#root = root;\n\t\tshadow.appendChild(root);\n\n\t\tconst syncClass = () => {\n\t\t\tconst hasScene = Boolean(layers.backgroundImage);\n\t\t\tconst parallaxActive = parallaxEnabled && (this.#hovering || this.#scrollParallax);\n\t\t\t// Fade placeholder as soon as any layer can paint — don't wait for the slowest plate.\n\t\t\tconst reveal =\n\t\t\t\tthis.#shouldLoad &&\n\t\t\t\t(this.#avatarReady || this.#backgroundReady || this.#foregroundReady);\n\t\t\troot.className = [\n\t\t\t\t'liforma-et',\n\t\t\t\thasScene ? 'liforma-et--scene' : '',\n\t\t\t\tthumbnailFitClass(fit),\n\t\t\t\tparallaxActive ? 'liforma-et--parallax' : '',\n\t\t\t\tthis.#scrollParallax ? 'liforma-et--scroll-parallax' : '',\n\t\t\t\tthis.#shouldLoad && !reveal ? 'liforma-et--loading' : '',\n\t\t\t\treveal ? 'liforma-et--revealed' : ''\n\t\t\t]\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join(' ');\n\t\t\troot.style.setProperty('--liforma-et-parallax-x', String(this.#parallaxX));\n\t\t\troot.style.setProperty('--liforma-et-parallax-y', String(this.#parallaxY));\n\t\t};\n\n\t\tthis.#cleanup.push(\n\t\t\tattachThumbnailBox(this, (width, height) => {\n\t\t\t\tconst next = pickThumbnailLocationPlateSize(width, height);\n\t\t\t\tif (next === locationPlateSize) return;\n\t\t\t\tlocationPlateSize = next;\n\t\t\t\tconst nextLayers = resolveLayers();\n\t\t\t\tif (!nextLayers) return;\n\t\t\t\tlayers = nextLayers;\n\t\t\t\tconst background = root.querySelector(\n\t\t\t\t\t'.liforma-et__background'\n\t\t\t\t) as HTMLImageElement | null;\n\t\t\t\tif (\n\t\t\t\t\tbackground &&\n\t\t\t\t\tlayers.backgroundImage &&\n\t\t\t\t\tbackground.getAttribute('src') !== layers.backgroundImage\n\t\t\t\t) {\n\t\t\t\t\tthis.#backgroundReady = false;\n\t\t\t\t\tbackground.classList.remove('liforma-et__media--ready');\n\t\t\t\t\tbackground.src = layers.backgroundImage;\n\t\t\t\t}\n\t\t\t\tconst foreground = root.querySelector(\n\t\t\t\t\t'.liforma-et__foreground'\n\t\t\t\t) as HTMLImageElement | null;\n\t\t\t\tif (\n\t\t\t\t\tforeground &&\n\t\t\t\t\tlayers.foregroundImage &&\n\t\t\t\t\tforeground.getAttribute('src') !== layers.foregroundImage\n\t\t\t\t) {\n\t\t\t\t\tthis.#foregroundReady = false;\n\t\t\t\t\tforeground.classList.remove('liforma-et__media--ready');\n\t\t\t\t\tforeground.src = layers.foregroundImage;\n\t\t\t\t}\n\t\t\t\tsyncClass();\n\t\t\t})\n\t\t);\n\t\tconst measured = resolveLayers();\n\t\tif (measured) layers = measured;\n\n\t\tconst placeholder = document.createElement('span');\n\t\tplaceholder.className = 'liforma-et__placeholder';\n\t\tplaceholder.setAttribute('aria-hidden', 'true');\n\t\troot.appendChild(placeholder);\n\n\t\tconst paintImages = () => {\n\t\t\tif (!this.#shouldLoad) return;\n\t\t\tconst avatarSrc =\n\t\t\t\tthis.#avatarLoadFailed && layers.fallbackImage\n\t\t\t\t\t? layers.fallbackImage\n\t\t\t\t\t: layers.avatarImage;\n\n\t\t\tif (layers.backgroundImage && !root.querySelector('.liforma-et__background')) {\n\t\t\t\tconst img = document.createElement('img');\n\t\t\t\timg.className = 'liforma-et__background liforma-et__media';\n\t\t\t\timg.alt = '';\n\t\t\t\timg.decoding = 'async';\n\t\t\t\timg.src = layers.backgroundImage;\n\t\t\t\tthis.#cleanup.push(\n\t\t\t\t\tattachImageReady(img, () => {\n\t\t\t\t\t\tthis.#backgroundReady = true;\n\t\t\t\t\t\timg.classList.add('liforma-et__media--ready');\n\t\t\t\t\t\tsyncClass();\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t\troot.appendChild(img);\n\t\t\t}\n\n\t\t\tlet avatar = root.querySelector('.liforma-et__avatar') as HTMLImageElement | null;\n\t\t\tif (!avatar) {\n\t\t\t\tavatar = document.createElement('img');\n\t\t\t\tavatar.className = 'liforma-et__avatar liforma-et__media';\n\t\t\t\tavatar.alt = '';\n\t\t\t\tavatar.decoding = 'async';\n\t\t\t\tavatar.addEventListener('error', () => {\n\t\t\t\t\tif (layers.fallbackImage && !this.#avatarLoadFailed) {\n\t\t\t\t\t\tthis.#avatarLoadFailed = true;\n\t\t\t\t\t\tavatar!.src = layers.fallbackImage;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.#avatarReady = true;\n\t\t\t\t\t\tsyncClass();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tthis.#cleanup.push(\n\t\t\t\t\tattachImageReady(avatar, () => {\n\t\t\t\t\t\tthis.#avatarReady = true;\n\t\t\t\t\t\tavatar!.classList.add('liforma-et__media--ready');\n\t\t\t\t\t\tsyncClass();\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t\troot.appendChild(avatar);\n\t\t\t}\n\t\t\tif (avatar.src !== avatarSrc) avatar.src = avatarSrc;\n\n\t\t\tif (layers.foregroundImage && !root.querySelector('.liforma-et__foreground')) {\n\t\t\t\tconst img = document.createElement('img');\n\t\t\t\timg.className = 'liforma-et__foreground liforma-et__media';\n\t\t\t\timg.alt = '';\n\t\t\t\timg.decoding = 'async';\n\t\t\t\timg.src = layers.foregroundImage;\n\t\t\t\tthis.#cleanup.push(\n\t\t\t\t\tattachImageReady(img, () => {\n\t\t\t\t\t\tthis.#foregroundReady = true;\n\t\t\t\t\t\timg.classList.add('liforma-et__media--ready');\n\t\t\t\t\t\tsyncClass();\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t\troot.appendChild(img);\n\t\t\t}\n\t\t\tsyncClass();\n\t\t};\n\n\t\tif (lazy) {\n\t\t\tthis.#cleanup.push(\n\t\t\t\tattachLazyThumb(root, {\n\t\t\t\t\tonVisibleChange: (visible) => {\n\t\t\t\t\t\tif (!visible) return;\n\t\t\t\t\t\tthis.#shouldLoad = true;\n\t\t\t\t\t\tpaintImages();\n\t\t\t\t\t\tsyncClass();\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t);\n\t\t} else {\n\t\t\tpaintImages();\n\t\t}\n\n\t\tif (parallaxEnabled) {\n\t\t\tthis.#cleanup.push(\n\t\t\t\tattachScrollLinkedParallax(root, {\n\t\t\t\t\tonParallax: (x) => {\n\t\t\t\t\t\tthis.#scrollParallax = true;\n\t\t\t\t\t\tif (!this.#pointerDown) {\n\t\t\t\t\t\t\tthis.#parallaxX = x;\n\t\t\t\t\t\t\tthis.#parallaxY = 0;\n\t\t\t\t\t\t\tsyncClass();\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tpointerActive: () => this.#pointerDown\n\t\t\t\t})\n\t\t\t);\n\n\t\t\tconst onPointerMove = (event: PointerEvent) => {\n\t\t\t\tif (this.#scrollParallax) return;\n\t\t\t\tconst rect = root.getBoundingClientRect();\n\t\t\t\tif (rect.width <= 0 || rect.height <= 0) return;\n\t\t\t\tthis.#parallaxX = ((event.clientX - rect.left) / rect.width - 0.5) * 2;\n\t\t\t\tthis.#parallaxY = ((event.clientY - rect.top) / rect.height - 0.5) * 2;\n\t\t\t\tsyncClass();\n\t\t\t};\n\t\t\tconst onPointerDown = (event: PointerEvent) => {\n\t\t\t\tthis.#pointerDown = true;\n\t\t\t\tif (event.pointerType === 'mouse') this.#hovering = true;\n\t\t\t\tsyncClass();\n\t\t\t};\n\t\t\tconst onPointerUp = () => {\n\t\t\t\tconst wasDown = this.#pointerDown;\n\t\t\t\tthis.#pointerDown = false;\n\t\t\t\tthis.#hovering = false;\n\t\t\t\tif (this.#scrollParallax && wasDown) {\n\t\t\t\t\tthis.#parallaxX = horizontalParallaxFromViewportY(\n\t\t\t\t\t\troot.getBoundingClientRect(),\n\t\t\t\t\t\twindow.innerHeight\n\t\t\t\t\t);\n\t\t\t\t\tthis.#parallaxY = 0;\n\t\t\t\t} else if (!this.#scrollParallax) {\n\t\t\t\t\tthis.#parallaxX = 0;\n\t\t\t\t\tthis.#parallaxY = 0;\n\t\t\t\t}\n\t\t\t\tsyncClass();\n\t\t\t};\n\t\t\troot.addEventListener('pointermove', onPointerMove);\n\t\t\troot.addEventListener('pointerdown', onPointerDown);\n\t\t\troot.addEventListener('pointerup', onPointerUp);\n\t\t\troot.addEventListener('pointercancel', onPointerUp);\n\t\t\troot.addEventListener('pointerenter', (event: PointerEvent) => {\n\t\t\t\tif (event.pointerType === 'mouse') {\n\t\t\t\t\tthis.#hovering = true;\n\t\t\t\t\tsyncClass();\n\t\t\t\t}\n\t\t\t});\n\t\t\troot.addEventListener('pointerleave', () => {\n\t\t\t\tif (!this.#pointerDown) {\n\t\t\t\t\tthis.#hovering = false;\n\t\t\t\t\tif (!this.#scrollParallax) {\n\t\t\t\t\t\tthis.#parallaxX = 0;\n\t\t\t\t\t\tthis.#parallaxY = 0;\n\t\t\t\t\t}\n\t\t\t\t\tsyncClass();\n\t\t\t\t}\n\t\t\t});\n\t\t\tthis.#cleanup.push(() => {\n\t\t\t\troot.removeEventListener('pointermove', onPointerMove);\n\t\t\t\troot.removeEventListener('pointerdown', onPointerDown);\n\t\t\t\troot.removeEventListener('pointerup', onPointerUp);\n\t\t\t\troot.removeEventListener('pointercancel', onPointerUp);\n\t\t\t});\n\t\t}\n\n\t\troot.addEventListener('click', (event: MouseEvent) => {\n\t\t\tif (isHostedLaunch && !this.getAttribute('return-url')?.trim()) {\n\t\t\t\tconst next = resolveThumbnailHref({\n\t\t\t\t\texperienceId: experienceId ?? undefined,\n\t\t\t\t\tplayerBaseUrl: this.getAttribute('player-base-url') ?? undefined,\n\t\t\t\t\tuseCurrentPageAsReturnUrl: true\n\t\t\t\t});\n\t\t\t\tif (\n\t\t\t\t\tnext &&\n\t\t\t\t\tevent.button === 0 &&\n\t\t\t\t\t!event.metaKey &&\n\t\t\t\t\t!event.ctrlKey &&\n\t\t\t\t\t!event.shiftKey\n\t\t\t\t) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\twindow.location.assign(next);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tsyncClass();\n\t}\n}\n\nif (!customElements.get(ELEMENT_NAME)) {\n\tcustomElements.define(ELEMENT_NAME, LiformaExperienceThumbnailElement);\n}\n\nexport { LiformaExperienceThumbnailElement };\n","/**\n * Thumbnail-only CDN IIFE — registers `<liforma-experience-thumbnail>` without\n * the session player (`<liforma-experience>`) or widget.\n *\n * Reference the exported class so Rollup keeps the module (customElements.define\n * runs at import time). A bare side-effect import is tree-shaken in lib mode.\n */\nimport { LiformaExperienceThumbnailElement } from './liforma-experience-thumbnail';\n\ndeclare global {\n\tinterface Window {\n\t\tLiformaThumbnail?: {\n\t\t\treadonly sdkVersion: 'v2';\n\t\t\treadonly element: typeof LiformaExperienceThumbnailElement;\n\t\t};\n\t}\n}\n\nwindow.LiformaThumbnail = {\n\tsdkVersion: 'v2',\n\telement: LiformaExperienceThumbnailElement\n};\n"],"mappings":"YAiDA,SAAgB,EAAkB,EAA0C,CAG3E,OAFI,IAAQ,OAAe,uBACvB,IAAQ,SAAiB,yBACtB,EACR,CCjDA,IAAM,EAAmB,8BAOzB,SAAgB,EACf,EACA,EAC6B,CAM7B,MALI,CAAC,OAAO,SAAS,CAAK,GAAK,CAAC,OAAO,SAAS,CAAM,GAAK,EAAQ,GAAK,EAAS,GAG7E,GAAS,EAAe,UACxB,EAAQ,KAAO,EAAS,IAAY,WACjC,SACR,CAEA,SAAgB,EACf,EACA,EACS,CACT,IAAM,EAAU,EAAI,KAAK,EAEzB,OADK,GACE,EAAQ,QACd,GACC,EAAQ,EAAc,EAAkB,EAAa,IACrD,GAAG,IAAO,IAAO,IAAM,GACzB,CACD,CAGA,SAAgB,EACf,EACA,EACa,CACb,IAAM,MAAa,CAClB,EAAM,EAAQ,YAAa,EAAQ,YAAY,CAChD,EAEA,GADA,EAAK,EACD,OAAO,eAAmB,IAC7B,UAAa,CAAC,EAEf,IAAM,EAAW,IAAI,eAAe,CAAI,EAExC,OADA,EAAS,QAAQ,CAAO,MACX,EAAS,WAAW,CAClC,CC3CA,IAAM,EAAwB,uDAE9B,SAAgB,EAA6B,EAA6B,CAEzE,OADgB,GAAY,KAAK,EAAE,QAAQ,MAAO,EAAE,GAAA,wBAErD,CAEA,SAAS,EAAU,E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CAAa,EAClD,EAAK,iBAAiB,YAAa,CAAW,EAC9C,EAAK,iBAAiB,gBAAiB,CAAW,EAClD,EAAK,iBAAiB,eAAiB,GAAwB,CAC1D,EAAM,cAAgB,UACzB,KAAKN,GAAY,GACjB,EAAU,EAEZ,CAAC,EACD,EAAK,iBAAiB,mBAAsB,CACtC,KAAKQ,KACT,KAAKR,GAAY,GACZ,KAAKC,KACT,KAAKI,GAAa,EAClB,KAAKC,GAAa,GAEnB,EAAU,EAEZ,CAAC,EACD,KAAKV,GAAS,SAAW,CACxB,EAAK,oBAAoB,cAAe,CAAa,EACrD,EAAK,oBAAoB,cAAe,CAAa,EACrD,EAAK,oBAAoB,YAAa,CAAW,EACjD,EAAK,oBAAoB,gBAAiB,CAAW,CACtD,CAAC,CACF,CAEA,EAAK,iBAAiB,QAAU,GAAsB,CACrD,GAAI,GAAkB,CAAC,KAAK,aAAa,YAAY,GAAG,KAAK,EAAG,CAC/D,IAAM,EAAO,EAAqB,CACjC,aAAc,GAAgB,IAAA,GAC9B,cAAe,KAAK,aAAa,iBAAiB,GAAK,IAAA,GACvD,0BAA2B,EAC5B,CAAC,EAEA,GACA,EAAM,SAAW,GACjB,CAAC,EAAM,SACP,CAAC,EAAM,SACP,CAAC,EAAM,WAEP,EAAM,eAAe,EACrB,OAAO,SAAS,OAAO,CAAI,EAE7B,CACD,CAAC,EAED,EAAU,CACX,CACD,EAEK,eAAe,IAAI,CAAY,GACnC,eAAe,OAAO,EAAc,CAAiC,ECvYtE,OAAO,iBAAmB,CACzB,WAAY,KACZ,QAAS,CACV"}
@@ -64,6 +64,9 @@
64
64
  conversationProcessor,
65
65
  speechOnly = false,
66
66
  fit,
67
+ stage,
68
+ pipBackground,
69
+ pipShadow,
67
70
  attribution,
68
71
  alreadyConverted,
69
72
  avatarId,
@@ -392,6 +395,9 @@
392
395
  const player = await session.attach({
393
396
  container,
394
397
  fit: untrack(() => fit),
398
+ stage: untrack(() => stage),
399
+ pipBackground: untrack(() => pipBackground),
400
+ pipShadow: untrack(() => pipShadow),
395
401
  startButton: untrack(() => startButton),
396
402
  theme: untrack(() => theme),
397
403
  showFeedback: untrack(() => showFeedback),
@@ -501,6 +507,20 @@
501
507
  return withSession((session) => session.setFit(nextFit));
502
508
  }
503
509
 
510
+ export function setStage(nextStage: NonNullable<ExperienceProps['stage']>): Promise<void> {
511
+ return withSession((session) => session.setStage(nextStage));
512
+ }
513
+
514
+ export function setPipBackground(
515
+ nextBackground: NonNullable<ExperienceProps['pipBackground']>
516
+ ): Promise<void> {
517
+ return withSession((session) => session.setPipBackground(nextBackground));
518
+ }
519
+
520
+ export function setPipShadow(nextShadow: boolean): Promise<void> {
521
+ return withSession((session) => session.setPipShadow(nextShadow));
522
+ }
523
+
504
524
  export function conversion(key: string): Promise<void> {
505
525
  return withSession((session) => session.conversion(key));
506
526
  }
@@ -563,6 +583,27 @@
563
583
  void session.setFit(nextFit);
564
584
  });
565
585
 
586
+ $effect(() => {
587
+ const nextStage = stage ?? 'fill';
588
+ const session = untrack(() => activeGeneration?.instance ?? null);
589
+ if (!session) return;
590
+ void session.setStage(nextStage);
591
+ });
592
+
593
+ $effect(() => {
594
+ const nextBackground = pipBackground ?? 'none';
595
+ const session = untrack(() => activeGeneration?.instance ?? null);
596
+ if (!session) return;
597
+ void session.setPipBackground(nextBackground);
598
+ });
599
+
600
+ $effect(() => {
601
+ if (pipShadow === undefined) return;
602
+ const session = untrack(() => activeGeneration?.instance ?? null);
603
+ if (!session) return;
604
+ void session.setPipShadow(pipShadow);
605
+ });
606
+
566
607
  $effect(() => {
567
608
  const container = errorHost;
568
609
  const presentation = loadError;
@@ -17,6 +17,9 @@ declare const Experience: import("svelte").Component<ExperienceProps, {
17
17
  getConversation: () => ReturnType<ExperienceSession["getConversation"]>;
18
18
  focusCharacter: (characterId: string) => Promise<void>;
19
19
  setFit: (nextFit: NonNullable<ExperienceProps["fit"]>) => Promise<void>;
20
+ setStage: (nextStage: NonNullable<ExperienceProps["stage"]>) => Promise<void>;
21
+ setPipBackground: (nextBackground: NonNullable<ExperienceProps["pipBackground"]>) => Promise<void>;
22
+ setPipShadow: (nextShadow: boolean) => Promise<void>;
20
23
  conversion: (key: string) => Promise<void>;
21
24
  engage: () => Promise<void>;
22
25
  end: () => Promise<void>;
@@ -6,9 +6,11 @@
6
6
  attachImageReady,
7
7
  attachLazyThumb,
8
8
  attachScrollLinkedParallax,
9
+ attachThumbnailBox,
9
10
  ensureExperienceThumbnailStyles,
10
11
  EXPERIENCE_THUMBNAIL_CSS,
11
12
  horizontalParallaxFromViewportY,
13
+ pickThumbnailLocationPlateSize,
12
14
  resolveThumbnailHref,
13
15
  resolveThumbnailInteraction,
14
16
  resolveThumbnailLayers,
@@ -33,7 +35,9 @@
33
35
  fit = 'full',
34
36
  lazy = true,
35
37
  class: className = '',
36
- fallbackImage
38
+ fallbackImage,
39
+ normalizeUrls = true,
40
+ cdnBaseUrl
37
41
  }: {
38
42
  galleryThumb?: GalleryThumb;
39
43
  avatarImage?: string;
@@ -52,15 +56,24 @@
52
56
  lazy?: boolean;
53
57
  class?: string;
54
58
  fallbackImage?: string;
59
+ normalizeUrls?: boolean;
60
+ cdnBaseUrl?: string;
55
61
  } = $props();
56
62
 
63
+ let boxW = $state(0);
64
+ let boxH = $state(0);
65
+ const locationPlateSize = $derived(pickThumbnailLocationPlateSize(boxW, boxH));
66
+
57
67
  const layers = $derived(
58
68
  resolveThumbnailLayers({
59
69
  galleryThumb,
60
70
  avatarImage,
61
71
  backgroundImage,
62
72
  foregroundImage,
63
- fallbackImage
73
+ fallbackImage,
74
+ normalize: normalizeUrls,
75
+ locationPlateSize,
76
+ cdnBaseUrl
64
77
  })
65
78
  );
66
79
 
@@ -148,6 +161,12 @@
148
161
  return (element) => attachImageReady(element, onReady);
149
162
  }
150
163
 
164
+ const boxAttach: Attachment<HTMLElement> = (element) =>
165
+ attachThumbnailBox(element, (width, height) => {
166
+ boxW = width;
167
+ boxH = height;
168
+ });
169
+
151
170
  const lazyLoadAttach: Attachment<HTMLElement> = (element) => {
152
171
  if (!lazy) {
153
172
  shouldLoad = true;
@@ -286,6 +305,7 @@
286
305
  aria-label={alt}
287
306
  style:--liforma-et-parallax-x={parallaxX}
288
307
  style:--liforma-et-parallax-y={parallaxY}
308
+ {@attach boxAttach}
289
309
  {@attach lazyLoadAttach}
290
310
  {@attach scrollParallaxAttach}
291
311
  onclick={handleClick}
@@ -305,6 +325,7 @@
305
325
  aria-label={alt}
306
326
  style:--liforma-et-parallax-x={parallaxX}
307
327
  style:--liforma-et-parallax-y={parallaxY}
328
+ {@attach boxAttach}
308
329
  {@attach lazyLoadAttach}
309
330
  {@attach scrollParallaxAttach}
310
331
  onclick={handleClick}
@@ -325,6 +346,7 @@
325
346
  aria-hidden={alt ? undefined : 'true'}
326
347
  style:--liforma-et-parallax-x={parallaxX}
327
348
  style:--liforma-et-parallax-y={parallaxY}
349
+ {@attach boxAttach}
328
350
  {@attach lazyLoadAttach}
329
351
  {@attach scrollParallaxAttach}
330
352
  onpointerdown={onPointerDown}
@@ -17,6 +17,8 @@ type $$ComponentProps = {
17
17
  lazy?: boolean;
18
18
  class?: string;
19
19
  fallbackImage?: string;
20
+ normalizeUrls?: boolean;
21
+ cdnBaseUrl?: string;
20
22
  };
21
23
  declare const ExperienceThumbnail: import("svelte").Component<$$ComponentProps, {}, "">;
22
24
  type ExperienceThumbnail = ReturnType<typeof ExperienceThumbnail>;
@@ -25,6 +25,9 @@
25
25
  position = 'static',
26
26
  offset,
27
27
  sessionEndpoint,
28
+ locale,
29
+ secondaryLocale,
30
+ learningLocale,
28
31
  language,
29
32
  mode,
30
33
  speechInputMode,
@@ -58,6 +61,9 @@
58
61
  position?: ExperienceWidgetPosition;
59
62
  offset?: number | string;
60
63
  sessionEndpoint?: string;
64
+ locale?: string;
65
+ secondaryLocale?: string;
66
+ learningLocale?: string;
61
67
  language?: 'en' | 'es';
62
68
  mode?: ExperienceMode;
63
69
  speechInputMode?: SpeechInputMode;
@@ -105,6 +111,9 @@
105
111
  position,
106
112
  offset,
107
113
  sessionEndpoint,
114
+ locale,
115
+ secondaryLocale,
116
+ learningLocale,
108
117
  language,
109
118
  mode,
110
119
  speechInputMode,
@@ -12,6 +12,9 @@ type $$ComponentProps = {
12
12
  position?: ExperienceWidgetPosition;
13
13
  offset?: number | string;
14
14
  sessionEndpoint?: string;
15
+ locale?: string;
16
+ secondaryLocale?: string;
17
+ learningLocale?: string;
15
18
  language?: 'en' | 'es';
16
19
  mode?: ExperienceMode;
17
20
  speechInputMode?: SpeechInputMode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liforma/client",
3
- "version": "0.4.10",
3
+ "version": "0.4.11",
4
4
  "type": "module",
5
5
  "description": "Liforma browser SDK — Experience sessions, speech API, and Svelte embed component.",
6
6
  "license": "MIT",