@oim-media/player-oim 1.28.0 → 1.29.0
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.
package/dist/esm/index.js
CHANGED
|
@@ -2975,7 +2975,14 @@ var BASE = "oim:base";
|
|
|
2975
2975
|
* in its principal picture or in any language. Such a document's PNG is its base, not a poster.
|
|
2976
2976
|
*/
|
|
2977
2977
|
function hasBaseLayer(document) {
|
|
2978
|
-
const shows = (src) =>
|
|
2978
|
+
const shows = (src) => {
|
|
2979
|
+
if (typeof src === "string") return src === BASE;
|
|
2980
|
+
if ("ref" in src) {
|
|
2981
|
+
const paint = document.resources?.[src.ref];
|
|
2982
|
+
return paint !== void 0 && "kind" in paint && paint.kind === "image" && paint.src === BASE;
|
|
2983
|
+
}
|
|
2984
|
+
return src.value === BASE || Object.values(src.modes ?? {}).includes(BASE);
|
|
2985
|
+
};
|
|
2979
2986
|
const walk = (layers) => layers.some((layer) => layer.image !== void 0 && shows(layer.image.src) || walk(layer.children ?? []));
|
|
2980
2987
|
return walk(document.layers);
|
|
2981
2988
|
}
|
|
@@ -3006,6 +3013,18 @@ function resolveRefs(document) {
|
|
|
3006
3013
|
paint
|
|
3007
3014
|
}] : [];
|
|
3008
3015
|
});
|
|
3016
|
+
if (layer.image && typeof layer.image.src === "object" && "ref" in layer.image.src) {
|
|
3017
|
+
const src = layer.image.src;
|
|
3018
|
+
const resource = Object.prototype.hasOwnProperty.call(resources, src.ref) ? resources[src.ref] : void 0;
|
|
3019
|
+
if (resource && "kind" in resource && resource.kind === "image") layer.image = {
|
|
3020
|
+
...layer.image,
|
|
3021
|
+
src: resource.src
|
|
3022
|
+
};
|
|
3023
|
+
else {
|
|
3024
|
+
delete layer.image;
|
|
3025
|
+
if (!missing.includes(src.ref)) missing.push(src.ref);
|
|
3026
|
+
}
|
|
3027
|
+
}
|
|
3009
3028
|
if (layer.children) walk(layer.children);
|
|
3010
3029
|
}
|
|
3011
3030
|
};
|
|
@@ -3259,9 +3278,11 @@ function maskStyle(layer) {
|
|
|
3259
3278
|
cuts: layer.extensions?.studio?.maskCuts
|
|
3260
3279
|
};
|
|
3261
3280
|
}
|
|
3262
|
-
/** The picture a 2.0 image shows in one language: its own exception, else the principal; the base PNG paints none (the player shows it under the layers). */
|
|
3281
|
+
/** The picture a 2.0 image shows in one language: its own exception, else the principal; the base PNG paints none (the player shows it under the layers). An unresolved `{ ref }` paints nothing. */
|
|
3263
3282
|
function imageSrc(src, lang) {
|
|
3264
|
-
|
|
3283
|
+
if (typeof src === "string") return src === "oim:base" ? "" : src;
|
|
3284
|
+
if (!("value" in src) || typeof src.value !== "string") return "";
|
|
3285
|
+
const pick = resolveByLang(src.modes ?? {}, lang) ?? src.value;
|
|
3265
3286
|
return pick === "oim:base" ? "" : pick;
|
|
3266
3287
|
}
|
|
3267
3288
|
var safeColor$1 = (c) => c && !/[;{}<>"]|url\(|expression\(/i.test(c) ? c : void 0;
|
|
@@ -4477,7 +4498,7 @@ function nextWheelZoom(zoom, deltaY, deltaMode, pinch) {
|
|
|
4477
4498
|
* the format can change without the player being touched. Tying both numbers
|
|
4478
4499
|
* together would make an internal fix look like a format break.
|
|
4479
4500
|
*/
|
|
4480
|
-
var CONTRACT_VERSION = "1.
|
|
4501
|
+
var CONTRACT_VERSION = "1.29.0";
|
|
4481
4502
|
/**
|
|
4482
4503
|
* What the player implements TODAY, measured and not assumed.
|
|
4483
4504
|
*
|
package/dist/oim-player.js
CHANGED
|
@@ -48,7 +48,7 @@ var OimPlayer=(function(e){Object.defineProperties(e,{__esModule:{value:!0},[Sym
|
|
|
48
48
|
@keyframes background-animation-zoom-out { 0%, 100% { background-size: calc(var(--oim-bg-tile, 160px) * 1.15) calc(var(--oim-bg-tile, 160px) * 1.15); -webkit-mask-size: calc(var(--oim-bg-tile, 160px) * 1.15) calc(var(--oim-bg-tile, 160px) * 1.15); mask-size: calc(var(--oim-bg-tile, 160px) * 1.15) calc(var(--oim-bg-tile, 160px) * 1.15); } 50% { background-size: var(--oim-bg-tile, 160px) var(--oim-bg-tile, 160px); -webkit-mask-size: var(--oim-bg-tile, 160px) var(--oim-bg-tile, 160px); mask-size: var(--oim-bg-tile, 160px) var(--oim-bg-tile, 160px); } }
|
|
49
49
|
@keyframes background-animation-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.65; } }
|
|
50
50
|
@keyframes background-animation-none { }
|
|
51
|
-
[data-slot-id="background-pattern-slot"] { width: 100% !important; height: 100% !important; display: block !important; }`}function ee(e){if(!e)return;let t=O();if(document.head&&!document.getElementById(`oim-player-styles`)){let e=document.createElement(`style`);e.id=`oim-player-styles`,e.textContent=t,document.head.appendChild(e)}if(e.getElementById&&!e.getElementById(`oim-player-styles`)){let n=document.createElement(`style`);n.id=`oim-player-styles`,n.textContent=t,e.appendChild(n)}}function k(e){let t=e.artboardWidth||e.canvasWidth||e.canvas_width||1080,n=e.artboardHeight||e.canvasHeight||e.canvas_height||1920;Array.isArray(e.slots_raw)&&!Array.isArray(e.slots)&&(e.slots=e.slots_raw.map(e=>{let r=e.x_px??e.x??0,i=e.y_px??e.y??0,a=e.width_px??e.width??0,o=e.height_px??e.height??0,s=e.align||`left`,c=r,l=i,u=t>0?c/t*100:0,d=n>0?l/n*100:0,f=e.style||{};return f.width=f.width||a+`px`,f.height=f.height||o+`px`,e.border_radius_px!==void 0&&f.borderRadius===void 0&&(f.borderRadius=e.border_radius_px+`px`),f.borderRadiusTL!==void 0&&(f.borderTopLeftRadius=f.borderRadiusTL+`px`,f.borderTopRightRadius=f.borderRadiusTR+`px`,f.borderBottomLeftRadius=f.borderRadiusBL+`px`,f.borderBottomRightRadius=f.borderRadiusBR+`px`),{...e,x:r,y:i,width:a,height:o,width_px:a,height_px:o,align:s,fontSize:e.fontSize??e.font_size_px??16,position:[u,d],style:f}})),Array.isArray(e.languages)&&!Array.isArray(e.lang)&&(e.lang=e.languages)}var te=new Map([[`publico`,`public`],[`solo_autor`,`author_only`],[`sellado`,`sealed`]]),A=new Set([`public`,`author_only`,`sealed`]);function ne(e){let t={...e};if(t.reedit===void 0&&`reedicion`in t){let e=t.reedicion;t.reedit=typeof e==`string`?te.get(e)??`author_only`:`author_only`}return t.reedit!==void 0&&!(typeof t.reedit==`string`&&A.has(t.reedit))&&(t.reedit=`author_only`),delete t.reedicion,t}var re=[`primary`,`on-primary`,`secondary`,`on-secondary`,`surface`,`on-surface`,`outline`,`accent`,`text-primary`,`text-secondary`,`text-muted`,`text-on-accent`],ie=new Set(re);function ae(e){return typeof e==`string`&&ie.has(e)}var oe=/^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/,j=/^(?:rgb|rgba|hsl|hsla)\(\s*[0-9a-zA-Z.,%/\s+-]*\)$/,M=new Set([`transparent`,`currentcolor`,`none`,`inherit`]),N=/^var\(\s*(--[A-Za-z0-9_-]+)\s*\)$/,se=/^var\(\s*(--[A-Za-z0-9_-]+)\s*,([\s\S]+)\)$/;function ce(e,t=0){if(typeof e!=`string`)return!1;let n=e.trim();if(!n||n.length>128||t>4||/[;{}<>"]/.test(n)||n.includes(`\\`)||/url\(|expression\(|\/\*/i.test(n))return!1;if(oe.test(n)||M.has(n.toLowerCase())||j.test(n)||N.test(n))return!0;let r=se.exec(n);return r?ce(r[2],t+1):!1}function le(e,t={}){let n=e.palettes??{},r=Object.hasOwn(n,`dark`)&&Object.hasOwn(n,`light`)&&t.prefersDark!==void 0?t.prefersDark?`dark`:`light`:void 0,i=[t.requested,r,e.defaultPalette].find(e=>typeof e==`string`&&Object.hasOwn(n,e));if(i===void 0)return null;let a={};for(let e of re){let t=n[i][e];ce(t)&&(a[e]=String(t).trim())}return{name:i,colors:a}}function P(e,t){let n=t!=null&&t!==``?String(t).trim():void 0,r=n&&ce(n)?n:void 0;if(ae(e)){let t=`var(--oim-palette-`+e+(r?`, `+r:``)+`)`;return`var(--oim-color-`+e+`, `+t+`)`}return r||``}function ue(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}var F={grayscale:`grayscale(1)`,sepia:`sepia(0.8)`,"high-contrast":`contrast(1.5) saturate(1.2)`,vintage:`sepia(0.35) contrast(1.1) saturate(0.85) brightness(1.05)`,cool:`saturate(1.1) hue-rotate(15deg) brightness(1.02)`,warm:`saturate(1.15) hue-rotate(-12deg) brightness(1.03)`,faded:`contrast(0.85) brightness(1.1) saturate(0.8)`,cinema:`contrast(1.25) saturate(1.1) hue-rotate(-8deg) brightness(0.95)`,nordic:`saturate(0.7) hue-rotate(20deg) brightness(1.05) contrast(1.1)`,sunset:`sepia(0.4) saturate(1.4) hue-rotate(-20deg) brightness(1.05)`,noir:`grayscale(1) contrast(1.6) brightness(0.9)`,dramatic:`contrast(1.6) saturate(1.3) brightness(0.95)`,cyberpunk:`contrast(1.3) saturate(1.8) hue-rotate(140deg)`,pastel:`brightness(1.15) saturate(1.3) contrast(0.9) hue-rotate(-5deg)`,vhs:`sepia(0.2) contrast(1.2) saturate(1.5) hue-rotate(30deg) brightness(1.05)`};function I(e,t,n){if(typeof e==`number`&&Number.isFinite(e))return Math.min(n,Math.max(t,e))}function de(e){let{filterPreset:t}=e;return{preset:typeof t==`string`&&Object.prototype.hasOwnProperty.call(F,t)?t:void 0,blur:I(e.filterBlur,0,100)??0,brightness:I(e.filterBrightness,0,500)??100,contrast:I(e.filterContrast,0,500)??100,saturate:I(e.filterSaturate,0,500)??100,hue:I(e.filterHueRotate,0,360)??0}}function fe(e){let t=de(e),n=[];return t.preset!==void 0&&n.push(F[t.preset]),t.blur!==0&&n.push(`blur(${t.blur}px)`),t.brightness!==100&&n.push(`brightness(${t.brightness}%)`),t.contrast!==100&&n.push(`contrast(${t.contrast}%)`),t.saturate!==100&&n.push(`saturate(${t.saturate}%)`),t.hue!==0&&n.push(`hue-rotate(${t.hue}deg)`),n.length>0?n.join(` `):void 0}var pe=`author_only`,me=[`public`,`author_only`,`sealed`];function he(e){if(!e||typeof e!=`object`)return pe;let t=ne(e);if(t.immutable_lock===!0||t.immutable===!0)return`sealed`;let n=t.reedit;return typeof n==`string`&&me.includes(n)?n:pe}function ge(e){return e===`public`?`verified_authorless`:`verified`}function _e(e){return!!e&&e.type===`group`}function ve(e){let t=(e&&e.style||{}).groupId;return typeof t==`string`&&t?t:null}function ye(e){let t=new Set;for(let n of e||[])_e(n)&&n.id&&t.add(String(n.id));let n=new Map;for(let r of e||[]){if(!r||!r.id||_e(r))continue;let e=ve(r);if(!e||!t.has(e))continue;let i=n.get(e);i?i.push(String(r.id)):n.set(e,[String(r.id)])}return n}function be(e){let t=ue(e)?.oim;return typeof t==`string`&&/^2\./.test(t)}var xe=`oim:base`;function Se(e){let t=e=>typeof e==`string`?e===xe:e.value===xe||Object.values(e.modes??{}).includes(xe),n=e=>e.some(e=>e.image!==void 0&&t(e.image.src)||n(e.children??[]));return n(e.layers)}function Ce(e){let t=structuredClone(e),n=[],r=e.resources??{},i=e=>{if(!(`ref`in e))return e;if(Object.prototype.hasOwnProperty.call(r,e.ref))return structuredClone(r[e.ref]);n.includes(e.ref)||n.push(e.ref)},a=e=>e.flatMap(e=>i(e)??[]),o=e=>{for(let t of e)t.fills&&=a(t.fills),t.strokes&&=t.strokes.flatMap(e=>{let t=i(e.paint);return t?[{...e,paint:t}]:[]}),t.children&&o(t.children)};return t.canvas.fills&&(t.canvas.fills=a(t.canvas.fills)),o(t.layers),{document:t,missing:n}}var L=r({createExternalLottieLoader:()=>we,createExternalScriptLoader:()=>z,default:()=>Te,vendorUrl:()=>R});function R(e,t){let n=`vendor/lottie_light-${t}.js`;if(e)try{return new URL(n,e).href}catch{}return B+n}function z(e){let t=null;return function(){let n=e.read();if(n)return Promise.resolve(n);if(t)return t;let r=e.doc??document,i=B+e.file;if(e.scriptUrl)try{i=new URL(e.file,e.scriptUrl).href}catch{}return t=new Promise((t,n)=>{let a=r.createElement(`script`);a.src=i,a.async=!0,a.setAttribute(e.marker,``),a.onload=()=>{let r=e.read();r?t(r):n(Error(`Script loaded from ${i} but did not define what was expected`))},a.onerror=()=>{a.remove(),n(Error(`Could not load ${i}`))},(r.head||r.documentElement).appendChild(a)}),t.catch(()=>{t=null}),t}}function we(e){return z({scriptUrl:e.scriptUrl,file:`vendor/lottie_light-${e.version}.js`,marker:`data-oim-lottie`,doc:e.doc,read:()=>{let e=globalThis.lottie;return e&&typeof e.loadAnimation==`function`?e:void 0}})}var B,V,Te,Ee=n((()=>{B=`https://cdn.oim.media/player/v1/`,V=we({scriptUrl:i,version:`5.13.0`}),Te={__oimExternal:!0,load:V}}));a(),Ee();var De=`__oimUpgrade`,H=()=>globalThis[De],Oe=z({scriptUrl:i,file:`vendor/oim-upgrade-b6a0795e5ed6.js`,marker:`data-oim-upgrade`,read:()=>H()}),ke=e=>{let t=H();if(!t)throw Error(`[OimPlayer] upgrade called before ensureUpgrade()`);return t(e)};function U(){return H()?Promise.resolve():Oe().then(()=>void 0)}function W(e,t){if(!e||typeof e!=`object`)return;let n=(t||``).toLowerCase();if(e[n]!==void 0)return e[n];let r=Object.keys(e);for(let t=0;t<r.length;t++)if(r[t].toLowerCase()===n)return e[r[t]]}function Ae(e,t){let n=e||{};if(n[`*`]!==void 0){let e=W(n,t);return typeof e==`string`?e:String(n[`*`]??``)}function r(e){if(n[e]!==void 0&&n[e]!==``)return n[e];let t=e.toLowerCase(),r=e.toUpperCase();if(n[r]!==void 0&&n[r]!==``)return n[r];if(n[t]!==void 0&&n[t]!==``)return n[t];let i=Object.keys(n);for(let e=0;e<i.length;e++)if(i[e].toLowerCase()===t&&n[i[e]]!==``)return n[i[e]]}let i=r(t)||r(`en`)||r(`es`)||r(`default`)||``;if(!i){let e=Object.keys(n);e.length>0&&(i=n[e[0]]||``)}return i}function je(e,t){return e&&e.type===`image`?!0:t.indexOf(`data:image/`)===0}function Me(e){return!!e&&(e.is_background_pattern===!0||e.id===`background-pattern-slot`)}var G=/^[\d.+-]+(cqw|cqh|cqi|cqb|rem|em|ex|ch|vw|vh|vmin|vmax|%|px|pt|pc|cm|mm|in|lh|rlh)$/i;function Ne(e,t){let n=t==null?`16px`:t.toString(),r=(e==null?``:e.toString()).trim();if(!r||r===`undefined`||r===`null`)return n;if(G.test(r))return r;let i=parseFloat(r);return isNaN(i)?n:i+`px`}function Pe(e,t){let n=e&&e.style||{},r=Ae(e&&e.content,t),i=je(e,r);return{content:r,size:Ne(W(n.fontSizes,t)||n.fontSize,n.fontSize||`16px`),maxWidthValue:Me(e)?`none`:W(n.maxWidths,t)||(i||(e?.type??`text`)!==`text`?n.maxWidth||`none`:n.maxWidth||`80%`)}}function Fe(e,t,n){let r=Pe(e,t),i=Pe(e,n);return r.content===i.content?r.size!==i.size||r.maxWidthValue!==i.maxWidthValue?`style-only`:`none`:`content`}var K=new WeakMap;function Ie(e){let t=new Map,n=e=>{for(let r of e)t.set(r.id,r),n(r.children??[])};return n(e),t}function Le(e){let t=K.get(e);if(t)return t;try{t=Ie(ke(e).document.layers)}catch(e){console.warn(`[OimPlayer] 2.0 view unavailable:`,e),t=new Map}return K.set(e,t),t}function Re(e,t){K.set(e,Ie(t.layers))}function ze(e){let t=e=>!!e&&typeof e==`object`&&typeof e.var==`string`;return{css:e=>(t(e)?P(e.var,e.fallback):typeof e==`string`?P(null,e):``)||void 0,literal:n=>(t(n)?le(e)?.colors?.[n.var]??P(null,n.fallback):typeof n==`string`?P(null,n):``)||void 0}}function Be(e){let t=e.anchor??`top-left`;return[/left/.test(t)?`0%`:/right/.test(t)?`-100%`:`-50%`,/^top/.test(t)?`0%`:/^bottom/.test(t)?`-100%`:`-50%`]}function Ve(e,t){if(typeof e==`number`)return e;if(e&&typeof e==`object`&&`value`in e){let{value:n,modes:r}=e,i=r?.[t];return typeof i==`number`?i:typeof n==`number`?n:void 0}}function He(e,t){let n=e?.text;if(!n)return;let r={},i=Ve(n.font?.size,t);i!==void 0&&(r.fontSize=`${+i.toFixed(4)}px`);let a=Ve(n.maxWidth,t);return a!==void 0&&(r.maxWidth=`${+a.toFixed(4)}px`),n.font?.family&&(r.fontFamily=n.font.family),n.font?.weight!==void 0&&(r.fontWeight=String(n.font.weight)),n.font?.italic&&(r.fontStyle=`italic`),n.letterSpacing!==void 0&&(r.letterSpacing=`${n.letterSpacing}px`),n.transform&&(r.textTransform=n.transform),n.decoration&&(r.textDecoration=n.decoration),r}function Ue(e){let t=e??{},n=e=>typeof e==`number`?+(e*100).toFixed(6):void 0;return{filterPreset:t.preset,filterBlur:t.blur,filterBrightness:n(t.brightness),filterContrast:n(t.contrast),filterSaturate:n(t.saturate),filterHueRotate:t.hueRotate}}function We(e){let t=e.mask??{},n=e.geometry,r=n?.kind===`preset`?n.name:n?.kind===`paths`?`custom`:{rect:`rectangle`,ellipse:`circle`,line:`line`}[n?.kind??``],i=e=>typeof e==`string`?{role:void 0,literal:e}:e&&typeof e==`object`?{role:e.var,literal:e.fallback}:{role:void 0,literal:void 0},a=e.fills?.[0],o=i(a?.kind===`color`?a.value:void 0),s=e.strokes?.[0],c=i(s?.paint?.kind===`color`?s.paint.value:void 0);return{maskMode:t.mode===`cutout`?`cutout`:`window`,maskFeather:t.feather,maskCoverage:t.scope===`group`?`container`:`canvas`,maskShape:r,maskSvgPath:n?.kind===`paths`?n.paths?.map(e=>e.d).join(` `):void 0,geoShape:void 0,svgPath:void 0,maskBgColor:o.literal,maskBgColorRole:o.role,fillColorRole:void 0,maskStrokeColor:c.literal,maskStrokeColorRole:c.role,strokeColorRole:void 0,maskStrokeWidth:s?.width,cuts:e.extensions?.studio?.maskCuts}}function Ge(e,t){let n=typeof e==`string`?e:W(e.modes??{},t)??e.value;return n===`oim:base`?``:n}var Ke=e=>e&&!/[;{}<>"]|url\(|expression\(/i.test(e)?e:void 0;function qe(e,t,n=!1){let r=`http://www.w3.org/2000/svg`,i=document.createElementNS(r,`svg`);i.setAttribute(`viewBox`,e.viewBox.join(` `)),i.setAttribute(`width`,n?String(e.viewBox[2]):`100%`),i.setAttribute(`height`,n?String(e.viewBox[3]):`100%`),n?i.setAttribute(`xmlns`,r):(i.setAttribute(`preserveAspectRatio`,`xMidYMid meet`),i.style.setProperty(`display`,`block`));for(let a of e.paths){let e=document.createElementNS(r,`path`);e.setAttribute(`d`,a.d);let o=Ke(a.fill===`currentColor`?t.fill??`currentColor`:a.fill),s=Ke(a.stroke===`currentColor`?t.stroke??`currentColor`:a.stroke);n?(e.setAttribute(`fill`,o??`none`),s&&e.setAttribute(`stroke`,s)):(e.setAttribute(`fill`,`none`),o&&e.style.setProperty(`fill`,o),s&&e.style.setProperty(`stroke`,s)),a.strokeWidth!==void 0&&e.setAttribute(`stroke-width`,String(a.strokeWidth)),a.fillRule&&e.setAttribute(`fill-rule`,a.fillRule),a.cap&&e.setAttribute(`stroke-linecap`,a.cap),a.join&&e.setAttribute(`stroke-linejoin`,a.join),a.opacity!==void 0&&e.setAttribute(`opacity`,String(a.opacity)),a.transform&&e.setAttribute(`transform`,`matrix(${a.transform.join(` `)})`),i.appendChild(e)}return i.outerHTML}function Je(e,t){let n=e=>e&&typeof e==`object`&&e.kind===`color`?t(e.value):void 0,r=n(e.fills?.[0]),i=n(e.strokes?.[0]?.paint);return{fill:r??i,stroke:i??r}}function q(e){if(typeof e==`number`)return{px:`${e}px`};if(e&&typeof e==`object`&&`value`in e){let{value:t,modes:n}=e,r=Object.fromEntries(Object.entries(n??{}).map(([e,t])=>[e,`${t}px`]));return{px:`${t}px`,byLang:Object.keys(r).length>0?r:void 0}}return{}}function Ye(e,t){e.content=t.content;let n=q(t.font?.size),r=q(t.maxWidth);n.px&&(e.style.fontSize=n.px),n.byLang&&(e.style.fontSizes=n.byLang),r.px&&(e.style.maxWidth=r.px),r.byLang&&(e.style.maxWidths=r.byLang)}function Xe(e){let t=e?.modes?.palette;if(!e||!t)return;let n=Object.fromEntries(t.map(e=>[e,{}]));for(let[t,r]of Object.entries(e.values??{}))for(let[e,i]of Object.entries(r))n[e]&&typeof i==`string`&&(n[e][t]=i);return n}function Ze(e){let t=[],n=(e,r)=>{for(let i of e){let e=i.mask?`mask`:i.text?.artistic?`artistic-text`:i.type,a={id:i.id,type:e,style:r?{groupId:r}:{}};i.text&&Ye(a,i.text),t.push(a),n(i.children??[],i.id)}};n(e.layers);let r={canvas_width:e.canvas.width,canvas_height:e.canvas.height,languages:e.languages,slots:t};e.fonts&&(r.fonts=e.fonts);let i=Xe(e.variables);return i&&(r.palettes=i),e.variables?.defaults?.palette&&(r.defaultPalette=e.variables.defaults.palette),Re(r,e),r}var Qe="/**\n* @license\n* Copyright (c) 2026 Xue Studios LLC\n* SPDX-License-Identifier: Apache-2.0\n*/\nconst e=10485760;async function t(t,r=e){let i=t.replace(/\\s+/g,``);try{let e=atob(i);if(e.trim().startsWith(`{`)){if(e.length>r)throw Error(`Metadata exceeds the limit of ${r/1048576}MB (zip bomb detected)`);return JSON.parse(e)}}catch(e){if(e.message&&e.message.includes(`zip bomb detected`))throw e}let a=atob(i),o=new Uint8Array(a.length);for(let e=0;e<a.length;e++)o[e]=a.charCodeAt(e);try{return JSON.parse(await n(o,`deflate`,r))}catch(e){if(e.message&&e.message.includes(`zip bomb detected`))throw e;try{return JSON.parse(await n(o,`deflate-raw`,r))}catch(t){throw t.message&&t.message.includes(`zip bomb detected`)||console.error(`[OIM Core] Decompression failed for both deflate and deflate-raw:`,e,t),t}}}async function n(t,n,r=e){let i=new DecompressionStream(n),a=i.writable.getWriter();a.write(t).catch(function(){}),a.close().catch(function(){});let o=i.readable.getReader(),s=[],c=0;try{for(;;){let{done:e,value:t}=await o.read();if(e)break;if(t){if(c+=t.byteLength,c>r)throw await o.cancel(),Error(`Decompressed metadata exceeds the limit of ${r/1048576}MB (zip bomb detected)`);s.push(t)}}}finally{o.releaseLock()}let l=new Uint8Array(c),u=0;for(let e of s)l.set(e,u),u+=e.byteLength;return new TextDecoder().decode(l)}async function r(e){let t=new DataView(e),n=[],r=0;for(let i=8;i+8<=e.byteLength;){let a=t.getUint32(i,!1);String.fromCharCode(t.getUint8(i+4),t.getUint8(i+5),t.getUint8(i+6),t.getUint8(i+7))===`IDAT`&&(n.push(new Uint8Array(e,i+8,a)),r+=a),i+=12+a}if(n.length===0)return null;let i=new Uint8Array(r),a=0;for(let e of n)i.set(e,a),a+=e.length;let o=await crypto.subtle.digest(`SHA-256`,i);return Array.from(new Uint8Array(o),e=>e.toString(16).padStart(2,`0`)).join(``)}async function i(e){let i=await e.arrayBuffer(),a=new DataView(i),o=8,s=null,c=null,l=[new Uint8Array(i,0,8)];for(;o<i.byteLength;){let e=a.getUint32(o,!1),t=o+4,r=String.fromCharCode(a.getUint8(t),a.getUint8(t+1),a.getUint8(t+2),a.getUint8(t+3)),u=8+e+4;if(r===`tEXt`){let r=new Uint8Array(i,t+4,e),a=r.indexOf(0);if(a!==-1){let e=new TextDecoder().decode(r.slice(0,a));if(e===`OIM_Data`||e===`OIM_JSON_DATA`){let e=r.slice(a+1),t=null;try{t=await n(e,`deflate`)}catch{try{t=await n(e,`deflate-raw`)}catch{}}if(t&&t.trim().startsWith(`{`))try{c=JSON.parse(t)}catch{}else s=new TextDecoder(`latin1`).decode(e);o+=u;continue}}}else if(r===`zTXt`){let r=new Uint8Array(i,t+4,e),a=r.indexOf(0);if(a!==-1){let e=new TextDecoder().decode(r.slice(0,a));if(e===`OIM_Data`||e===`OIM_JSON_DATA`){let e=r[a+1],t=r.slice(a+2);if(e===0)try{s=await n(t,`deflate`)}catch(e){try{s=await n(t,`deflate-raw`)}catch(t){console.error(`[OimPlayer] Failed to decompress zTXt chunk:`,e,t)}}if(s){o+=u;continue}}}}else if(r===`iTXt`){let r=new Uint8Array(i,t+4,e),a=r.indexOf(0);if(a!==-1){let e=new TextDecoder().decode(r.slice(0,a));if(e===`OIM_Data`||e===`OIM_JSON_DATA`){let e=r[a+1],t=r[a+2],i=r.slice(a+3),c=i.indexOf(0);if(c!==-1){let r=i.slice(c+1),a=r.indexOf(0);if(a!==-1){let i=r.slice(a+1);if(e===1){if(t===0)try{s=await n(i,`deflate`)}catch(e){try{s=await n(i,`deflate-raw`)}catch(t){console.error(`[OimPlayer] Failed to decompress iTXt chunk:`,e,t)}}}else s=new TextDecoder().decode(i);if(s){o+=u;continue}}}}}}l.push(new Uint8Array(i,o,u)),o+=u}let u=new Blob(l,{type:`image/png`}),d=null;return c?d=c:s&&(d=s.trimStart().startsWith(`{`)?JSON.parse(s):await t(s)),{image:u,metadata:d,imageHash:await r(i)}}\n/**\n* @license\n* Copyright (c) 2026 Xue Studios LLC\n* SPDX-License-Identifier: Apache-2.0\n*/\nfunction a(e){let t=e.artboardWidth||e.canvasWidth||e.canvas_width||1080,n=e.artboardHeight||e.canvasHeight||e.canvas_height||1920;Array.isArray(e.slots_raw)&&!Array.isArray(e.slots)&&(e.slots=e.slots_raw.map(e=>{let r=e.x_px??e.x??0,i=e.y_px??e.y??0,a=e.width_px??e.width??0,o=e.height_px??e.height??0,s=e.align||`left`,c=r,l=i,u=t>0?c/t*100:0,d=n>0?l/n*100:0,f=e.style||{};return f.width=f.width||a+`px`,f.height=f.height||o+`px`,e.border_radius_px!==void 0&&f.borderRadius===void 0&&(f.borderRadius=e.border_radius_px+`px`),f.borderRadiusTL!==void 0&&(f.borderTopLeftRadius=f.borderRadiusTL+`px`,f.borderTopRightRadius=f.borderRadiusTR+`px`,f.borderBottomLeftRadius=f.borderRadiusBL+`px`,f.borderBottomRightRadius=f.borderRadiusBR+`px`),{...e,x:r,y:i,width:a,height:o,width_px:a,height_px:o,align:s,fontSize:e.fontSize??e.font_size_px??16,position:[u,d],style:f}})),Array.isArray(e.languages)&&!Array.isArray(e.lang)&&(e.lang=e.languages)}\n/**\n* @license\n* Copyright (c) 2026 Xue Studios LLC\n* SPDX-License-Identifier: Apache-2.0\n*/\nconst o=/* @__PURE__ */ new Map([[`publico`,`public`],[`solo_autor`,`author_only`],[`sellado`,`sealed`]]),s=/* @__PURE__ */ new Set([`public`,`author_only`,`sealed`]);function c(e){let t={...e};if(t.reedit===void 0&&`reedicion`in t){let e=t.reedicion;t.reedit=typeof e==`string`?o.get(e)??`author_only`:`author_only`}return t.reedit!==void 0&&!(typeof t.reedit==`string`&&s.has(t.reedit))&&(t.reedit=`author_only`),delete t.reedicion,t}\n/**\n* @license\n* Copyright (c) 2026 Xue Studios LLC\n* SPDX-License-Identifier: Apache-2.0\n*/\nfunction l(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}\n/**\n* @license\n* Copyright (c) 2026 Xue Studios LLC\n* SPDX-License-Identifier: Apache-2.0\n*/\nconst u=`author_only`,d=[`public`,`author_only`,`sealed`];function f(e){if(!e||typeof e!=`object`)return u;let t=c(e);if(t.immutable_lock===!0||t.immutable===!0)return`sealed`;let n=t.reedit;return typeof n==`string`&&d.includes(n)?n:u}function p(e){return e===`public`?`verified_authorless`:`verified`}\n/**\n* @license\n* Copyright (c) 2026 Xue Studios LLC\n* SPDX-License-Identifier: Apache-2.0\n*/\nfunction m(e){let t=l(e)?.oim;return typeof t==`string`&&/^2\\./.test(t)}\n/**\n* @license\n* Copyright (c) 2026 Xue Studios LLC\n* SPDX-License-Identifier: Apache-2.0\n*/\nconst h=[{kid:`v1`,jwk:{kty:`EC`,crv:`P-256`,x:`5Qavr4M_npVognquI5k5D9K8wcXBXM9Z0mZHjqyehAs`,y:`oh7rz5Q7SlZT_ms2buyOw0bPX77QsXimc0X92Ymj2_o`}},{kid:`v2`,jwk:{kty:`EC`,crv:`P-256`,x:`pRSLtFHe9p8sR8jyqP5eoaBGbHdJgjjrdClda2lNp4A`,y:`oopYYhgja8m2iAlSMPigeWw-F72KJLNCRFQzlyWdt2I`}}];function g(e){for(let t=0;t<h.length;t++)if(h[t].kid===e)return h[t];return null}let _=null;function v(e){_=typeof e==`string`&&e?e:null}function y(){if(_)return _;let e=globalThis.OIM_PLAYER_CONFIG;return(e&&typeof e.keysUrl==`string`?e.keysUrl:``)||`https://api.oim.media/v1/media/keys`}function b(e,t){let n=g(e)?.not_after,r=t&&typeof t.not_after==`string`?t.not_after:void 0;return n?r&&Date.parse(r)<Date.parse(n)?r:n:r}function x(e,t){if(!e.not_after||!t)return!0;let n=Date.parse(t),r=Date.parse(e.not_after);return isNaN(n)||isNaN(r)?!0:n<=r}function S(e,t,n=Date.now()){let r=g(e)?.verify_until,i=t&&typeof t.verify_until==`string`?t.verify_until:void 0;if(!g(e)&&!t)return!0;let a=[r,i].filter(e=>!!e&&!isNaN(Date.parse(e)));return a.length!==0&&n>Math.min(...a.map(e=>Date.parse(e)))+6048e5}\n/**\n* @license\n* Copyright (c) 2026 Xue Studios LLC\n* SPDX-License-Identifier: Apache-2.0\n*/\nconst C=2**53-1;function w(e){return typeof e==`number`?!Number.isFinite(e)||Math.abs(e)>C:typeof e==`object`&&e?Object.values(e).some(w):!1}const T=/* @__PURE__ */ new Set([`signature`,`key_version`,`timestamp`,`creator_user_id`]);function E(e){if(Array.isArray(e))return e.map(E);if(typeof e==`object`&&e){let t={};for(let n of Object.keys(e))t[n]=E(e[n]);return t}return typeof e==`number`&&Number.isFinite(e)&&!Number.isInteger(e)?Number(e.toFixed(6)):e}function D(e){if(Array.isArray(e))return e.map(D);if(typeof e==`object`&&e){let t={},n=Object.keys(e).sort((e,t)=>{let n=[...e],r=[...t],i=Math.min(n.length,r.length);for(let e=0;e<i;e++){let t=(n[e].codePointAt(0)??0)-(r[e].codePointAt(0)??0);if(t!==0)return t}return n.length-r.length});for(let r of n)t[r]=D(e[r]);return t}return e}function O(e){if(!e||typeof e!=`object`)return new TextEncoder().encode(`{}`);let t={};for(let n of Object.keys(e))T.has(n)||(t[n]=e[n]);let n=D(E(t)),r=JSON.stringify(n);return new TextEncoder().encode(r)}\n/**\n* @license\n* Copyright (c) 2026 Xue Studios LLC\n* SPDX-License-Identifier: Apache-2.0\n*/\nconst k={};let A=null,j=!1,M=null;function N(){return new Promise(e=>{if(typeof indexedDB>`u`)return e([]);try{let t=indexedDB.open(`oim-player-keys`,1);t.onupgradeneeded=e=>{let t=e.target.result;t.objectStoreNames.contains(`keys`)||t.createObjectStore(`keys`,{keyPath:`kid`})},t.onsuccess=t=>{let n=t.target.result;if(!n.objectStoreNames.contains(`keys`)){e([]),n.close();return}let r=n.transaction(`keys`,`readonly`).objectStore(`keys`).getAll();r.onsuccess=()=>{e(r.result||[]),n.close()},r.onerror=()=>{e([]),n.close()}},t.onerror=()=>{e([])}}catch{e([])}})}function P(e){return new Promise(t=>{if(typeof indexedDB>`u`)return t();try{let n=indexedDB.open(`oim-player-keys`,1);n.onupgradeneeded=e=>{let t=e.target.result;t.objectStoreNames.contains(`keys`)||t.createObjectStore(`keys`,{keyPath:`kid`})},n.onsuccess=n=>{let r=n.target.result;if(!r.objectStoreNames.contains(`keys`)){t(),r.close();return}let i=r.transaction(`keys`,`readwrite`),a=i.objectStore(`keys`);e.forEach(e=>{a.put(e)}),i.oncomplete=()=>{t(),r.close()},i.onerror=()=>{t(),r.close()}},n.onerror=()=>{t()}}catch{t()}})}async function F(e){let t=g(e);return t?t.jwk:(k[e]||!j&&(M||=N().then(e=>{e.forEach(e=>{k[e.kid]=e}),j=!0}),await M,k[e])||await I(),k[e])}function I(){return A||=(async function(){try{let e=y(),t=await fetch(e).catch(()=>null),n=null;if(t&&t.ok&&(t.headers.get(`content-type`)||``).indexOf(`application/json`)!==-1)try{n=await t.json()}catch{}if(n&&Array.isArray(n.keys)){for(let e=0;e<n.keys.length;e++){let t=n.keys[e];k[t.kid]=t}await P(n.keys)}}catch(e){console.warn(`[OimPlayer::Security] Failed to fetch public keys from server:`,e)}})(),A}async function L(e){return await I(),k[e]||null}async function R(e,t){if(!e||typeof e!=`object`)return!1;if(!e.signature||!e.key_version)return console.warn(`[OimPlayer::Security] Metadata is not signed. Skipping signature verification (Legacy mode).`),!0;try{let t=await F(e.key_version);if(!t)return console.error(`[OimPlayer::Security] Public key not found for version:`,e.key_version),!1;if(w(e))return!1;let n=O(e),r=atob(e.signature),i=new Uint8Array(r.length);for(let e=0;e<r.length;e++)i[e]=r.charCodeAt(e);let a=async(e,t)=>{let n=await crypto.subtle.importKey(`jwk`,e,{name:`ECDSA`,namedCurve:`P-256`},!0,[`verify`]);return crypto.subtle.verify({name:`ECDSA`,hash:{name:`SHA-256`}},n,i,t)},o=await a(t,n);if(!o&&e.creator_user_id){let n={},r=Object.keys(e).filter(function(e){return e!==`signature`&&e!==`key_version`&&e!==`timestamp`}).sort();function i(e){if(Array.isArray(e))return e.map(i);if(typeof e==`object`&&e){let t={},n=Object.keys(e).sort();for(let r=0;r<n.length;r++)t[n[r]]=i(e[n[r]]);return t}return e}for(let t=0;t<r.length;t++)n[r[t]]=i(e[r[t]]);o=await a(t,new TextEncoder().encode(JSON.stringify(n)))}if(!o)try{let r=await L(e.key_version);r&&(r.x!==t.x||r.y!==t.y)&&(console.warn(`[OimPlayer::Security] Pinned key failed; retrying with the key published by the server for kid:`,e.key_version),o=await a(r,n))}catch{}if(o){let n=b(e.key_version,t);if(!x({kid:e.key_version,jwk:t,not_after:n},e.signed_at))return console.error(`[OimPlayer::Security] Signature made after this key was retired.`),!1}return o||console.error(`[OimPlayer::Security] Cryptographic signature VERIFICATION FAILED. Metadata was tampered with!`),o}catch(e){return console.error(`[OimPlayer::Security] Error verifying signature:`,e),!1}}function z(e){if(!e.isSigned)return`unsigned`;if(!e.isSigValid)return`invalid_signature`;if(e.keyExpired)return`expired_key`;let t=e.metadata||{},n=t.image_hash_alg===`sha256-idat`&&typeof t.image_hash==`string`?t.image_hash:``;return n?!e.imageHash||n.toLowerCase()!==e.imageHash.toLowerCase()?`image_mismatch`:p(f(e.metadata)):`image_unsealed`}async function B(e,t=Date.now()){let n=e&&e.key_version;return n?g(n)?S(n,null,t):S(n,await L(n),t):!1}function V(e){return e===`image_mismatch`||e===`invalid_signature`}function H(e){let t=[];function n(e){t.push(e)}function r(e,t){return typeof e==`string`&&e.length<=(t||1e7)}function i(e){return typeof e==`number`&&isFinite(e)}if(typeof e!=`object`||!e)return n(`metadata must be object`),t;let a=e.slots||e.elements||[];if(!Array.isArray(a))return n(`slots must be array`),t;a.length>150&&n(`max 150 slots`);for(let e=0;e<a.length;e++){let t=a[e];if(typeof t!=`object`||!t){n(`slot[`+e+`] must be object`);continue}t.id!==void 0&&t.id!==null&&(typeof t.id!=`string`||t.id.length>128)&&n(`slot[`+e+`].id invalid`);let o=t.content;if(o!==void 0){if(typeof o!=`object`||!o)n(`slot[`+e+`].content must be object`);else{let t=Object.keys(o);for(let i=0;i<t.length;i++){let a=o[t[i]];if(typeof a==`string`)a.length>1e7&&n(`slot[`+e+`].content.`+t[i]+` too long`);else if(typeof a==`object`&&a&&!Array.isArray(a)){let o=Object.keys(a);for(let s=0;s<o.length;s++)r(a[o[s]])||n(`slot[`+e+`].content.`+t[i]+`.`+o[s]+` invalid`)}}}}t.style&&(typeof t.style==`object`?t.style.fillColor&&(typeof t.style.fillColor!=`string`||t.style.fillColor.length>64)&&n(`slot[`+e+`].style.fillColor invalid`):n(`slot[`+e+`].style must be object`)),t.position&&(!Array.isArray(t.position)||t.position.length<2||!i(t.position[0])||!i(t.position[1]))&&n(`slot[`+e+`].position invalid`)}return t}\n/**\n* @license\n* Copyright (c) 2026 Xue Studios LLC\n* SPDX-License-Identifier: Apache-2.0\n*/\nself.onmessage=async function(e){let{id:t,blob:n,origin:r,keysUrl:o}=e.data;v(o);try{let e=await i(n);if(!e.metadata){self.postMessage({id:t,success:!0,metadata:{slots:[]},isSigValid:!1,security:`no_metadata`});return}let o=H(e.metadata);if(o.length>0)throw Error(`Corrupted or tampered OIM file: `+o[0]);let s=!!(e.metadata.signature&&e.metadata.key_version),c=await R(e.metadata,r),l=z({isSigned:s,isSigValid:c,keyExpired:s&&c?await B(e.metadata):!1,metadata:e.metadata,imageHash:e.imageHash});if(V(l)){self.postMessage({id:t,success:!1,refused:!0,security:l,error:`OIM_ALTERED: `+l});return}c?l===`unsigned`||l===`expired_key`?e.metadata={slots:[],elements:[],layers:[]}:m(e.metadata)||a(e.metadata):e.metadata={slots:[]},self.postMessage({id:t,success:!0,metadata:e.metadata,isSigValid:c,security:l})}catch(e){self.postMessage({id:t,success:!1,error:e.message||String(e)})}};",$e=typeof self<`u`&&self.Blob&&new Blob([`URL.revokeObjectURL(import.meta.url);`,Qe],{type:`text/javascript;charset=utf-8`});function et(e){let t;try{if(t=$e&&(self.URL||self.webkitURL).createObjectURL($e),!t)throw``;let n=new Worker(t,{type:`module`,name:e?.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(Qe),{type:`module`,name:e?.name})}}var tt=[{kid:`v1`,jwk:{kty:`EC`,crv:`P-256`,x:`5Qavr4M_npVognquI5k5D9K8wcXBXM9Z0mZHjqyehAs`,y:`oh7rz5Q7SlZT_ms2buyOw0bPX77QsXimc0X92Ymj2_o`}},{kid:`v2`,jwk:{kty:`EC`,crv:`P-256`,x:`pRSLtFHe9p8sR8jyqP5eoaBGbHdJgjjrdClda2lNp4A`,y:`oopYYhgja8m2iAlSMPigeWw-F72KJLNCRFQzlyWdt2I`}}],nt=`https://api.oim.media/v1/media/keys`;function J(e){for(let t=0;t<tt.length;t++)if(tt[t].kid===e)return tt[t];return null}function rt(){let e=globalThis.OIM_PLAYER_CONFIG;return(e&&typeof e.keysUrl==`string`?e.keysUrl:``)||nt}function it(e,t){let n=J(e)?.not_after,r=t&&typeof t.not_after==`string`?t.not_after:void 0;return n?r&&Date.parse(r)<Date.parse(n)?r:n:r}function at(e,t){if(!e.not_after||!t)return!0;let n=Date.parse(t),r=Date.parse(e.not_after);return isNaN(n)||isNaN(r)?!0:n<=r}var ot=6048e5;function st(e,t,n=Date.now()){let r=J(e)?.verify_until,i=t&&typeof t.verify_until==`string`?t.verify_until:void 0;if(!J(e)&&!t)return!0;let a=[r,i].filter(e=>!!e&&!isNaN(Date.parse(e)));return a.length!==0&&n>Math.min(...a.map(e=>Date.parse(e)))+ot}var ct=class extends Error{reason;constructor(e){super(`Web Worker unavailable`),this.reason=e,this.name=`WorkerUnavailableError`}};function lt(e){let t=null,n=null,r=1,i=new Map;function a(e){let t=[...i.values()];i.clear(),t.forEach(t=>t.reject(e))}function o(){if(t)return t;let n=e();return n.onmessage=e=>{let t=e.data,n=t&&typeof t.id==`number`?i.get(t.id):void 0;n&&(i.delete(t.id),n.resolve(t))},n.onerror=e=>{try{n.terminate()}catch{}t===n&&(t=null),a(e)},t=n,n}return{verify(e,t,a){if(n)return Promise.reject(new ct(n));let s;try{s=o()}catch(e){return n=e||!0,Promise.reject(new ct(e))}let c=r++;return new Promise((n,r)=>{i.set(c,{resolve:n,reject:r}),s.postMessage({id:c,blob:e,hostname:t,origin:a,keysUrl:rt()})})},stats(){return{alive:t!==null,pending:i.size}}}}var ut=null;function dt(e,t,n){return ut||=lt(()=>new et),ut.verify(e,t,n)}var ft=10485760;async function pt(e,t=ft){let n=e.replace(/\s+/g,``);try{let e=atob(n);if(e.trim().startsWith(`{`)){if(e.length>t)throw Error(`Metadata exceeds the limit of ${t/1048576}MB (zip bomb detected)`);return JSON.parse(e)}}catch(e){if(e.message&&e.message.includes(`zip bomb detected`))throw e}let r=atob(n),i=new Uint8Array(r.length);for(let e=0;e<r.length;e++)i[e]=r.charCodeAt(e);try{return JSON.parse(await Y(i,`deflate`,t))}catch(e){if(e.message&&e.message.includes(`zip bomb detected`))throw e;try{return JSON.parse(await Y(i,`deflate-raw`,t))}catch(t){throw t.message&&t.message.includes(`zip bomb detected`)||console.error(`[OIM Core] Decompression failed for both deflate and deflate-raw:`,e,t),t}}}async function Y(e,t,n=ft){let r=new DecompressionStream(t),i=r.writable.getWriter();i.write(e).catch(function(){}),i.close().catch(function(){});let a=r.readable.getReader(),o=[],s=0;try{for(;;){let{done:e,value:t}=await a.read();if(e)break;if(t){if(s+=t.byteLength,s>n)throw await a.cancel(),Error(`Decompressed metadata exceeds the limit of ${n/1048576}MB (zip bomb detected)`);o.push(t)}}}finally{a.releaseLock()}let c=new Uint8Array(s),l=0;for(let e of o)c.set(e,l),l+=e.byteLength;return new TextDecoder().decode(c)}async function mt(e){let t=new DataView(e),n=[],r=0;for(let i=8;i+8<=e.byteLength;){let a=t.getUint32(i,!1);String.fromCharCode(t.getUint8(i+4),t.getUint8(i+5),t.getUint8(i+6),t.getUint8(i+7))===`IDAT`&&(n.push(new Uint8Array(e,i+8,a)),r+=a),i+=12+a}if(n.length===0)return null;let i=new Uint8Array(r),a=0;for(let e of n)i.set(e,a),a+=e.length;let o=await crypto.subtle.digest(`SHA-256`,i);return Array.from(new Uint8Array(o),e=>e.toString(16).padStart(2,`0`)).join(``)}async function ht(e){let t=await e.arrayBuffer(),n=new DataView(t),r=8,i=null,a=null,o=[new Uint8Array(t,0,8)];for(;r<t.byteLength;){let e=n.getUint32(r,!1),s=r+4,c=String.fromCharCode(n.getUint8(s),n.getUint8(s+1),n.getUint8(s+2),n.getUint8(s+3)),l=8+e+4;if(c===`tEXt`){let n=new Uint8Array(t,s+4,e),o=n.indexOf(0);if(o!==-1){let e=new TextDecoder().decode(n.slice(0,o));if(e===`OIM_Data`||e===`OIM_JSON_DATA`){let e=n.slice(o+1),t=null;try{t=await Y(e,`deflate`)}catch{try{t=await Y(e,`deflate-raw`)}catch{}}if(t&&t.trim().startsWith(`{`))try{a=JSON.parse(t)}catch{}else i=new TextDecoder(`latin1`).decode(e);r+=l;continue}}}else if(c===`zTXt`){let n=new Uint8Array(t,s+4,e),a=n.indexOf(0);if(a!==-1){let e=new TextDecoder().decode(n.slice(0,a));if(e===`OIM_Data`||e===`OIM_JSON_DATA`){let e=n[a+1],t=n.slice(a+2);if(e===0)try{i=await Y(t,`deflate`)}catch(e){try{i=await Y(t,`deflate-raw`)}catch(t){console.error(`[OimPlayer] Failed to decompress zTXt chunk:`,e,t)}}if(i){r+=l;continue}}}}else if(c===`iTXt`){let n=new Uint8Array(t,s+4,e),a=n.indexOf(0);if(a!==-1){let e=new TextDecoder().decode(n.slice(0,a));if(e===`OIM_Data`||e===`OIM_JSON_DATA`){let e=n[a+1],t=n[a+2],o=n.slice(a+3),s=o.indexOf(0);if(s!==-1){let n=o.slice(s+1),a=n.indexOf(0);if(a!==-1){let o=n.slice(a+1);if(e===1){if(t===0)try{i=await Y(o,`deflate`)}catch(e){try{i=await Y(o,`deflate-raw`)}catch(t){console.error(`[OimPlayer] Failed to decompress iTXt chunk:`,e,t)}}}else i=new TextDecoder().decode(o);if(i){r+=l;continue}}}}}}o.push(new Uint8Array(t,r,l)),r+=l}let s=new Blob(o,{type:`image/png`}),c=null;return a?c=a:i&&(c=i.trimStart().startsWith(`{`)?JSON.parse(i):await pt(i)),{image:s,metadata:c,imageHash:await mt(t)}}var gt=2**53-1;function _t(e){return typeof e==`number`?!Number.isFinite(e)||Math.abs(e)>gt:typeof e==`object`&&e?Object.values(e).some(_t):!1}var vt=new Set([`signature`,`key_version`,`timestamp`,`creator_user_id`]);function yt(e){if(Array.isArray(e))return e.map(yt);if(typeof e==`object`&&e){let t={};for(let n of Object.keys(e))t[n]=yt(e[n]);return t}return typeof e==`number`&&Number.isFinite(e)&&!Number.isInteger(e)?Number(e.toFixed(6)):e}function bt(e){if(Array.isArray(e))return e.map(bt);if(typeof e==`object`&&e){let t={},n=Object.keys(e).sort((e,t)=>{let n=[...e],r=[...t],i=Math.min(n.length,r.length);for(let e=0;e<i;e++){let t=(n[e].codePointAt(0)??0)-(r[e].codePointAt(0)??0);if(t!==0)return t}return n.length-r.length});for(let r of n)t[r]=bt(e[r]);return t}return e}function xt(e){if(!e||typeof e!=`object`)return new TextEncoder().encode(`{}`);let t={};for(let n of Object.keys(e))vt.has(n)||(t[n]=e[n]);let n=bt(yt(t)),r=JSON.stringify(n);return new TextEncoder().encode(r)}function St(e,t){let n=e||``,r=``;for(let e=0;e<n.length;e++)n.charCodeAt(e)>=32&&(r+=n.charAt(e));return r=r.trim(),r.charAt(0)===`#`?!0:t?!1:!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(r)||/^https?:/i.test(r)||/^data:image\//i.test(r)}function Ct(e){if(typeof DOMParser>`u`)return e;try{let t=new DOMParser().parseFromString(e,`text/html`),n=`svg.g.defs.symbol.use.title.desc.path.circle.rect.polygon.polyline.ellipse.line.lineargradient.radialgradient.stop.pattern.image.clippath.mask.filter.fegaussianblur.fecolormatrix.fecomponenttransfer.fefunca.fefuncr.fefuncg.fefuncb.feblend.feoffset.femerge.femergenode.feflood.fecomposite.text.tspan.span.div.br.p.a.b.i.strong.em.img`.split(`.`),r=`class.style.id.lang.aria-hidden.part.transform.d.cx.cy.r.rx.ry.x.y.dx.dy.x1.y1.x2.y2.fx.fy.width.height.points.viewbox.preserveaspectratio.vector-effect.fill.stroke.fill-rule.clip-rule.opacity.fill-opacity.stroke-opacity.stroke-width.stroke-linecap.stroke-linejoin.stroke-dasharray.stroke-dashoffset.stroke-miterlimit.offset.stop-color.stop-opacity.gradientunits.gradienttransform.spreadmethod.patternunits.patterncontentunits.patterntransform.clip-path.clippathunits.mask.maskunits.maskcontentunits.filter.filterunits.primitiveunits.stddeviation.result.in.in2.mode.type.values.tablevalues.flood-color.flood-opacity.operator.font-family.font-size.font-weight.font-style.text-anchor.dominant-baseline.letter-spacing.word-spacing.href.src.target.rel.alt.data-slot-id.allow-lottie.show-controls.crossorigin`.split(`.`),i=t.body.querySelectorAll(`*`);for(let e=0;e<i.length;e++){let t=i[e],a=t.tagName.toLowerCase();if(n.indexOf(a)===-1){t.parentNode?.removeChild(t);continue}let o=t.attributes;for(let e=o.length-1;e>=0;e--){let n=o[e],i=n.name.toLowerCase();if(i.indexOf(`on`)===0||r.indexOf(i)===-1)t.removeAttribute(n.name);else{if(i===`href`&&!St(n.value,a===`use`||a===`image`)&&t.removeAttribute(n.name),i===`style`){let e=Tt(n.value);e!==n.value&&t.setAttribute(n.name,e)}else if(i!==`href`&&i!==`src`&&Et(n.value)){t.removeAttribute(n.name);continue}i===`src`&&(Dt(n.value.trim())||t.removeAttribute(n.name))}}}return t.body.innerHTML}catch(e){return console.warn(`[OimPlayer] HTML sanitization failed:`,e),``}}function wt(e){let t=(e||``).trim().toLowerCase();return t.indexOf(`data:image/`)===0||t.indexOf(`blob:`)===0}function Tt(e){return typeof e==`string`?e.indexOf(`\\`)!==-1||/@import|image-set\s*\(/i.test(e)?``:e.indexOf(`(`)===-1?e:e.replace(/url\(\s*(['"]?)(.*?)\1\s*\)/gi,function(e,t,n){let r=String(n).trim().toLowerCase();return r.indexOf(`#`)===0||r.indexOf(`data:`)===0?e:`none`}):e}function Et(e){let t=typeof e==`string`?e:``;if(t.indexOf(`\\`)!==-1||/image-set\s*\(|@import/i.test(t))return!0;let n=/url\(\s*['"]?\s*([^'")\s]*)/gi,r;for(;(r=n.exec(t))!==null;){let e=r[1].trim().toLowerCase();if(e.indexOf(`#`)!==0&&e.indexOf(`data:`)!==0)return!0}return!1}function Dt(e){let t=(e||``).trim();if(t.indexOf(`data:image/`)!==0)return!1;let n=t.indexOf(`,`);if(n===-1)return!1;let r=t.substring(0,n).toLowerCase();if(r.indexOf(`;base64`)===-1)return!1;let i=r.substring(5,r.indexOf(`;`));return[`image/png`,`image/jpeg`,`image/jpg`,`image/webp`,`image/gif`].indexOf(i)!==-1}function Ot(e){return!e||typeof e!=`string`?`Inter, sans-serif`:e.replace(/[^a-zA-Z0-9 ,\-\.'\'"]/g,``).trim().slice(0,128)||`Inter, sans-serif`}var kt={},At=null,jt=!1,Mt=null;function Nt(){return new Promise(e=>{if(typeof indexedDB>`u`)return e([]);try{let t=indexedDB.open(`oim-player-keys`,1);t.onupgradeneeded=e=>{let t=e.target.result;t.objectStoreNames.contains(`keys`)||t.createObjectStore(`keys`,{keyPath:`kid`})},t.onsuccess=t=>{let n=t.target.result;if(!n.objectStoreNames.contains(`keys`)){e([]),n.close();return}let r=n.transaction(`keys`,`readonly`).objectStore(`keys`).getAll();r.onsuccess=()=>{e(r.result||[]),n.close()},r.onerror=()=>{e([]),n.close()}},t.onerror=()=>{e([])}}catch{e([])}})}function Pt(e){return new Promise(t=>{if(typeof indexedDB>`u`)return t();try{let n=indexedDB.open(`oim-player-keys`,1);n.onupgradeneeded=e=>{let t=e.target.result;t.objectStoreNames.contains(`keys`)||t.createObjectStore(`keys`,{keyPath:`kid`})},n.onsuccess=n=>{let r=n.target.result;if(!r.objectStoreNames.contains(`keys`)){t(),r.close();return}let i=r.transaction(`keys`,`readwrite`),a=i.objectStore(`keys`);e.forEach(e=>{a.put(e)}),i.oncomplete=()=>{t(),r.close()},i.onerror=()=>{t(),r.close()}},n.onerror=()=>{t()}}catch{t()}})}async function Ft(e){let t=J(e);return t?t.jwk:(kt[e]||!jt&&(Mt||=Nt().then(e=>{e.forEach(e=>{kt[e.kid]=e}),jt=!0}),await Mt,kt[e])||await It(),kt[e])}function It(){return At||=(async function(){try{let e=rt(),t=await fetch(e).catch(()=>null),n=null;if(t&&t.ok&&(t.headers.get(`content-type`)||``).indexOf(`application/json`)!==-1)try{n=await t.json()}catch{}if(n&&Array.isArray(n.keys)){for(let e=0;e<n.keys.length;e++){let t=n.keys[e];kt[t.kid]=t}await Pt(n.keys)}}catch(e){console.warn(`[OimPlayer::Security] Failed to fetch public keys from server:`,e)}})(),At}async function Lt(e){return await It(),kt[e]||null}async function Rt(e,t){if(!e||typeof e!=`object`)return!1;if(!e.signature||!e.key_version)return console.warn(`[OimPlayer::Security] Metadata is not signed. Skipping signature verification (Legacy mode).`),!0;try{let t=await Ft(e.key_version);if(!t)return console.error(`[OimPlayer::Security] Public key not found for version:`,e.key_version),!1;if(_t(e))return!1;let r=xt(e),i=atob(e.signature),a=new Uint8Array(i.length);for(let e=0;e<i.length;e++)a[e]=i.charCodeAt(e);let o=async(e,t)=>{let n=await crypto.subtle.importKey(`jwk`,e,{name:`ECDSA`,namedCurve:`P-256`},!0,[`verify`]);return crypto.subtle.verify({name:`ECDSA`,hash:{name:`SHA-256`}},n,a,t)},s=await o(t,r);if(!s&&e.creator_user_id){let r={},i=Object.keys(e).filter(function(e){return e!==`signature`&&e!==`key_version`&&e!==`timestamp`}).sort();function n(e){if(Array.isArray(e))return e.map(n);if(typeof e==`object`&&e){let t={},r=Object.keys(e).sort();for(let i=0;i<r.length;i++)t[r[i]]=n(e[r[i]]);return t}return e}for(let t=0;t<i.length;t++)r[i[t]]=n(e[i[t]]);s=await o(t,new TextEncoder().encode(JSON.stringify(r)))}if(!s)try{let n=await Lt(e.key_version);n&&(n.x!==t.x||n.y!==t.y)&&(console.warn(`[OimPlayer::Security] Pinned key failed; retrying with the key published by the server for kid:`,e.key_version),s=await o(n,r))}catch{}if(s){let n=it(e.key_version,t);if(!at({kid:e.key_version,jwk:t,not_after:n},e.signed_at))return console.error(`[OimPlayer::Security] Signature made after this key was retired.`),!1}return s||console.error(`[OimPlayer::Security] Cryptographic signature VERIFICATION FAILED. Metadata was tampered with!`),s}catch(e){return console.error(`[OimPlayer::Security] Error verifying signature:`,e),!1}}function zt(e){if(!e.isSigned)return`unsigned`;if(!e.isSigValid)return`invalid_signature`;if(e.keyExpired)return`expired_key`;let t=e.metadata||{},n=t.image_hash_alg===`sha256-idat`&&typeof t.image_hash==`string`?t.image_hash:``;return n?!e.imageHash||n.toLowerCase()!==e.imageHash.toLowerCase()?`image_mismatch`:ge(he(e.metadata)):`image_unsealed`}async function Bt(e,t=Date.now()){let n=e&&e.key_version;return n?J(n)?st(n,null,t):st(n,await Lt(n),t):!1}function Vt(e){return e===`image_mismatch`||e===`invalid_signature`}var Ht=`OIM_ALTERED`;function Ut(e){let t=[];function n(e){t.push(e)}function r(e,t){return typeof e==`string`&&e.length<=(t||1e7)}function i(e){return typeof e==`number`&&isFinite(e)}if(typeof e!=`object`||!e)return n(`metadata must be object`),t;let a=e.slots||e.elements||[];if(!Array.isArray(a))return n(`slots must be array`),t;a.length>150&&n(`max 150 slots`);for(let e=0;e<a.length;e++){let t=a[e];if(typeof t!=`object`||!t){n(`slot[`+e+`] must be object`);continue}t.id!==void 0&&t.id!==null&&(typeof t.id!=`string`||t.id.length>128)&&n(`slot[`+e+`].id invalid`);let o=t.content;if(o!==void 0){if(typeof o!=`object`||!o)n(`slot[`+e+`].content must be object`);else{let t=Object.keys(o);for(let i=0;i<t.length;i++){let a=o[t[i]];if(typeof a==`string`)a.length>1e7&&n(`slot[`+e+`].content.`+t[i]+` too long`);else if(typeof a==`object`&&a&&!Array.isArray(a)){let o=Object.keys(a);for(let s=0;s<o.length;s++)r(a[o[s]])||n(`slot[`+e+`].content.`+t[i]+`.`+o[s]+` invalid`)}}}}t.style&&(typeof t.style==`object`?t.style.fillColor&&(typeof t.style.fillColor!=`string`||t.style.fillColor.length>64)&&n(`slot[`+e+`].style.fillColor invalid`):n(`slot[`+e+`].style must be object`)),t.position&&(!Array.isArray(t.position)||t.position.length<2||!i(t.position[0])||!i(t.position[1]))&&n(`slot[`+e+`].position invalid`)}return t}var Wt=Math.log(1.05)/100,Gt=.01,Kt=16,qt=800;function Jt(e,t,n,r){let i=n===1?t*Kt:n===2?t*qt:t,a=e*Math.exp(-i*(r?Gt:Wt));return Math.max(1,Math.min(4,a))}var Yt=`1.28.0`,Xt=[`vector_parallax`,`infinite_parallax`,`text_marks`,`image_fill`,`media_filters`,`frame_shapes`];function Zt(e){if(typeof e!=`string`)return null;let t=/^(\d+)\.(\d+)\.(\d+)$/.exec(e.trim());return t?[Number(t[1]),Number(t[2]),Number(t[3])]:null}function Qt(e,t){let n=Zt(e),r=Zt(t);if(!n||!r)return!1;for(let e=0;e<3;e++){if(n[e]>r[e])return!0;if(n[e]<r[e])return!1}return!1}function $t(e,t){let n=e&&typeof e.min_player==`string`?e.min_player:null,r=(Array.isArray(e?.capabilities)?e.capabilities:[]).filter(e=>typeof e==`string`&&e!==``).filter(e=>!t.capabilities.includes(e)).filter((e,t,n)=>n.indexOf(e)===t).sort(),i=(Array.isArray(e?.capabilities_required)?e.capabilities_required:[]).filter(e=>typeof e==`string`&&e!==``).filter(e=>!t.capabilities.includes(e)).filter((e,t,n)=>n.indexOf(e)===t).sort(),a=Qt(n,t.version),o=a||i.length>0,s=a||r.length>0||i.length>0;return{requiredVersion:n,versionTooOld:a,missingCapabilities:r,missingRequiredCapabilities:i,cannotRender:o,hasNotice:s,hayAlgoQueDecir:s}}function en(e){let t=[];return e.versionTooOld&&t.push(`the file requires format version ${e.requiredVersion}`),e.missingRequiredCapabilities&&e.missingRequiredCapabilities.length>0&&t.push(`requires ${e.missingRequiredCapabilities.join(`, `)}`),e.missingCapabilities&&e.missingCapabilities.length>0&&t.push(`uses ${e.missingCapabilities.join(`, `)}`),t.length===0?``:`${e.missingRequiredCapabilities&&e.missingRequiredCapabilities.length>0?`It cannot be fully rendered`:`Rendered what was possible`}: ${t.join(` and `)}.`}var tn=/^oim-[0-9a-f]{8}-[A-Za-z0-9 ]{1,64}$/,nn=546136,rn={woff:`wOFF`,woff2:`wOF2`};function an(e,t){try{return atob(e.slice(0,8)).startsWith(rn[t])}catch{return!1}}function on(e){let t=e&&Array.isArray(e.fonts)?e.fonts:[],n=[];for(let e of t)e&&typeof e==`object`&&(e.format!==`woff`&&e.format!==`woff2`||typeof e.family!=`string`||typeof e.data!=`string`||typeof e.name!=`string`||!tn.test(e.name)||e.style!==`normal`&&e.style!==`italic`||typeof e.weight!=`number`||e.weight<100||e.weight>900||e.data.length>nn||!an(e.data,e.format)||n.push({family:e.family,name:e.name,weight:e.weight,style:e.style,format:e.format,data:e.data}));return n}async function sn(e,t=document.fonts,n=(e,t,n)=>new FontFace(e,t,n)){let r=new Map;return await Promise.all(e.map(async e=>{try{let i=n(e.name,`url(data:font/${e.format};base64,${e.data})`,{weight:String(e.weight),style:e.style});await i.load(),t.add(i),r.set(e.family,e.name)}catch{}})),r}function cn(e,t){let n=t.get(e);return n?`'${n}', '${e}', sans-serif`:null}var ln=/^\{(\/?)([a-z][a-z0-9-]{0,23})\}/;function un(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(r===`{`||r===`}`){if(e[n+1]===r){t.push({kind:`text`,s:r}),n+=2;continue}if(r===`{`){let r=ln.exec(e.slice(n));if(r){t.push({kind:r[1]?`close`:`open`,name:r[2],raw:r[0],at:n}),n+=r[0].length;continue}}t.push({kind:`stray`,raw:r,at:n}),n+=1;continue}let i=n;for(;i<e.length&&e[i]!==`{`&&e[i]!==`}`;)i++;t.push({kind:`text`,s:e.slice(n,i)}),n=i}return t}function dn(e,t){let n=[],r=[],i,a=null,o=(e,t)=>{i||={reason:e,at:t}},s=e=>{if(!e)return;let t=n[n.length-1];t&&t.mark===(a??void 0)?t.text+=e:n.push(a?{text:e,mark:a}:{text:e})};for(let n of un(e))n.kind===`text`?s(n.s):n.kind===`stray`?(o(`stray brace`,n.at),s(n.raw)):t.includes(n.name)?n.kind===`open`?a?(o(`"${n.name}" inside "${a}"`,n.at),s(n.raw)):(a=n.name,r.push(n.name)):a===n.name?a=null:(o(`"${n.name}" closed without being open`,n.at),s(n.raw)):(o(`unknown mark "${n.name}"`,n.at),s(n.raw));return a&&o(`"${a}" is not closed`,e.length),{runs:n,sequence:r,error:i}}function fn(e,t){return dn(e,t).runs}function pn(e){return e.replace(/[{}]/g,e=>e+e)}function mn(e,t){return fn(e,t).map(e=>e.text).join(``)}function hn(e,t){let n=``,r=[];for(let i of fn(e,t))i.mark&&r.push({from:n.length,to:n.length+i.text.length,mark:i.mark}),n+=i.text;return{plain:n,ranges:r}}function gn(e,t){let n=``,r=0;for(let i of[...t].sort((e,t)=>e.from-t.from)){let t=Math.max(i.from,r),a=Math.min(i.to,e.length);a<=t||(n+=pn(e.slice(r,t))+`{${i.mark}}`+pn(e.slice(t,a))+`{/${i.mark}}`,r=a)}return n+pn(e.slice(r))}function _n(e){let t={underline:e.underline===!0},n=P(e.colorRole,e.color);if(n&&(t.color=n),e.bold&&(t.fontWeight=700),e.italic&&(t.fontStyle=`italic`),e.highlight){let n=e.highlight;t.highlight={style:n.style??`marker`,color:P(n.colorRole,n.color)||`rgba(245, 158, 11, 0.35)`,paddingX:n.paddingX??4,paddingY:n.paddingY??2,borderRadius:n.borderRadius??3}}return t}function vn(e,t){return mn(e,Object.keys(t??{}))}function yn(e,t,n){e.textContent=``;for(let r of fn(t,Object.keys(n??{}))){let t=r.mark?n?.[r.mark]:void 0;if(!r.mark||!t){e.appendChild(document.createTextNode(r.text));continue}let i=document.createElement(`span`);i.dataset.mark=r.mark,i.textContent=r.text;let a=_n(t),o=i.style;a.color&&(o.color=a.color),a.fontWeight&&(o.fontWeight=String(a.fontWeight)),a.fontStyle&&(o.fontStyle=a.fontStyle),a.underline&&(o.textDecoration=`underline`);let s=a.highlight;s&&(s.style===`underline-thick`?o.boxShadow=`inset 0 -.4em 0 ${s.color}`:o.backgroundColor=s.color,o.borderRadius=s.style===`pill`?`9999px`:s.style===`box`?`0`:`${s.borderRadius}px`,o.padding=`${s.paddingY}px ${s.paddingX}px`,o.boxDecorationBreak=`clone`,o.webkitBoxDecorationBreak=`clone`),e.appendChild(i)}}function bn(e){let t={scale:e.lines===3?3.2:2.2,lineHeight:.85,marginRight:e.marginRight??8,fontWeight:700};return e.color&&(t.color=e.color),e.fontFamily&&(t.fontFamily=e.fontFamily),t}function xn(e,t){let{plain:n,ranges:r}=hn(e,t);if(!n)return{letter:``,rest:``};let i=r.map(e=>({...e,from:Math.max(0,e.from-1),to:e.to-1}));return{letter:n[0],rest:gn(n.slice(1),i)}}var Sn=/^(data:image\/|blob:|https:\/\/)[^"'\\\n\r()]*$/;function Cn(e){if(e.svg&&/<svg[\s>]/i.test(e.svg))return{image:`url("data:image/svg+xml;charset=utf-8,${encodeURIComponent(e.svg)}")`,size:`100% 100%`};if(e.type===`image`&&e.image&&Sn.test(e.image)){let t=e.fit===`contain`?`contain`:e.fit===`fill`?`100% 100%`:`cover`;return{image:`url("${e.image}")`,size:t}}return null}var wn=[`fade-chars`,`slide-up`,`bounce-chars`,`reveal-mask`,`scale-in`,`rise-words`],Tn=.35,En=.05,Dn=[`slide-up`,`reveal-mask`,`rise-words`];function On(e){return typeof e==`string`&&wn.includes(e)}function kn(e){return e===`reveal-mask`}function An(e,t){return Dn.includes(t)?e.match(/\S+|\s+/g)??[]:Array.from(e)}function jn(e,t=En,n=0){return n+e*t}function Mn(e,t){let n=Math.max(0,Math.min(1,t)),r=n*(2-n);if(e===`slide-up`)return{opacity:r,translateYEm:(1-r)*.6,scale:1,rotateDeg:0};if(e===`reveal-mask`)return{opacity:1,translateYEm:(1-r)*1.2,scale:1,rotateDeg:0};if(e===`scale-in`)return{opacity:r,translateYEm:0,scale:.6+.4*r,rotateDeg:0};if(e===`rise-words`)return{opacity:r,translateYEm:(1-r)*.8,scale:1,rotateDeg:(1-r)*8};if(e===`bounce-chars`){let e=r===0?0:r<.7?r/.7*1.15:1.15-(r-.7)/.3*.15;return{opacity:r,translateYEm:0,scale:Math.round(e*1e6)/1e6,rotateDeg:0}}return{opacity:r,translateYEm:0,scale:1,rotateDeg:0}}function Nn(e,t=10){return Array.from({length:t+1},(n,r)=>Mn(e,r/t))}function Pn(){return Promise.resolve().then(()=>(Ee(),L)).then(e=>{let t=e.default||e;return t&&t.__oimExternal?t.load():t})}var Fn={triangle:{kind:`polygon`,points:[[50,5],[95,90],[5,90]]},star:{kind:`polygon`,points:[[50,2],[62,38],[100,38],[69,59],[80,95],[50,73],[20,95],[31,59],[0,38],[38,38]]},arrow:{kind:`polygon`,points:[[5,40],[60,40],[60,20],[95,50],[60,80],[60,60],[5,60]]},diamond:{kind:`polygon`,points:[[50,5],[95,50],[50,95],[5,50]]},hexagon:{kind:`polygon`,points:[[25,5],[75,5],[95,50],[75,95],[25,95],[5,50]]},circle:{kind:`path`,d:`M 50,5 A 45,45 0 1,1 49.999,5 Z`,fillable:!0},heart:{kind:`path`,d:`M 50,88 C 10,60 -5,30 15,12 C 30,-2 50,5 50,25 C 50,5 70,-2 85,12 C 105,30 90,60 50,88 Z`,fillable:!0},line:{kind:`path`,d:`M 5,50 L 95,50`,fillable:!1},blob:{kind:`path`,d:`M 50,10 C 75,10 92,25 90,50 C 88,75 75,90 50,90 C 25,90 10,75 10,50 C 10,25 25,10 50,10 Z`,fillable:!0},scribble:{kind:`path`,d:`M 5,80 Q 25,65 50,75 T 95,70 Q 75,85 50,82 T 5,88`,fillable:!1},pill:{kind:`path`,d:`M 30,25 L 70,25 C 83.8,25 95,36.2 95,50 C 95,63.8 83.8,75 70,75 L 30,75 C 16.2,75 5,63.8 5,50 C 5,36.2 16.2,25 30,25 Z`,fillable:!0},octagon:{kind:`polygon`,points:[[30,5],[70,5],[95,30],[95,70],[70,95],[30,95],[5,70],[5,30]]},pentagon:{kind:`polygon`,points:[[50,5],[94.7,37.5],[77.6,90],[22.4,90],[5.3,37.5]]},cross:{kind:`polygon`,points:[[35,5],[65,5],[65,35],[95,35],[95,65],[65,65],[65,95],[35,95],[35,65],[5,65],[5,35],[35,35]]},moon:{kind:`path`,d:`M 50,5 C 25.15,5 5,25.15 5,50 C 5,74.85 25.15,95 50,95 C 30,80 30,20 50,5 Z`,fillable:!0},cloud:{kind:`path`,d:`M 25,85 C 8,85 5,62 22,58 C 14,40 35,32 45,42 C 48,22 75,20 78,42 C 96,40 97,66 80,68 C 80,78 78,85 68,85 Z`,fillable:!0},drop:{kind:`path`,d:`M 50,5 C 62,25 80,45 80,65 C 80,81.5 66.5,95 50,95 C 33.5,95 20,81.5 20,65 C 20,45 38,25 50,5 Z`,fillable:!0},bolt:{kind:`polygon`,points:[[62,5],[18,58],[46,58],[34,95],[82,40],[55,40],[72,5]]},bubble:{kind:`path`,d:`M 20,5 L 80,5 C 88.3,5 95,11.7 95,20 L 95,57 C 95,65.3 88.3,72 80,72 L 42,72 L 22,93 L 28,72 L 20,72 C 11.7,72 5,65.3 5,57 L 5,20 C 5,11.7 11.7,5 20,5 Z`,fillable:!0},flower:{kind:`path`,d:`M 65.6,41.0 C 85.5,35.7 97.5,39.9 95.0,50.0 C 97.5,60.1 85.5,64.3 65.6,59.0 C 80.1,73.5 82.5,86.1 72.5,89.0 C 65.0,96.2 55.3,87.9 50.0,68.0 C 44.7,87.9 35.0,96.2 27.5,89.0 C 17.5,86.1 19.9,73.5 34.4,59.0 C 14.5,64.3 2.5,60.1 5.0,50.0 C 2.5,39.9 14.5,35.7 34.4,41.0 C 19.9,26.5 17.5,13.9 27.5,11.0 C 35.0,3.8 44.7,12.1 50.0,32.0 C 55.3,12.1 65.0,3.8 72.5,11.0 C 82.5,13.9 80.1,26.5 65.6,41.0 Z`,fillable:!0},burst:{kind:`polygon`,points:[[95,50],[82.8,58.8],[89,72.5],[74,74],[72.5,89],[58.8,82.8],[50,95],[41.2,82.8],[27.5,89],[26,74],[11,72.5],[17.2,58.8],[5,50],[17.2,41.2],[11,27.5],[26,26],[27.5,11],[41.2,17.2],[50,5],[58.8,17.2],[72.5,11],[74,26],[89,27.5],[82.8,41.2]]},arch:{kind:`path`,d:`M 5,95 L 5,50 C 5,25.15 25.15,5 50,5 C 74.85,5 95,25.15 95,50 L 95,95 Z`,fillable:!0}};[...Object.keys(Fn).filter(e=>e!==`line`&&e!==`scribble`)];function In(e){if(e&&e!==`rect`&&e!==`rectangle`)return Fn[e]}function Ln(e){return e.map(([e,t])=>`${e},${t}`).join(` `)}var Rn=/^[MmLlHhVvCcSsQqTtAaZz0-9eE.,\s+-]*$/,zn=/^-?\d+(\.\d+)?([\s,]+-?\d+(\.\d+)?){3}$/,Bn=`0 0 100 100`,Vn=e=>e&&e.length<=2e4&&Rn.test(e)?e:void 0,Hn=e=>e&&e.length<=64&&zn.test(e)?e:Bn;function Un(e){let t=In(e.geoShape),n=Vn(e.svgPath);return t?t.kind===`polygon`?{points:t.points.map(([e,t])=>`${e},${t}`).join(` `),viewBox:Bn}:{d:(e.geoShape===`blob`||e.geoShape===`scribble`)&&Vn(e.customBlobPath)||e.geoShape===`blob`&&n||t.d,viewBox:Bn}:n?{d:n,viewBox:Hn(e.svgViewBox)}:null}var Wn={silhouette:null,fillable:!0,round:!1};function Gn(e){if(!e||e.kind===`rect`)return Wn;if(e.kind===`line`||e.kind===`preset`||e.kind===`ellipse`){let t=e.kind===`line`?`line`:e.kind===`ellipse`?`circle`:e.name,n=In(t);return n?{silhouette:Un({geoShape:t}),fillable:n.kind===`polygon`||!!n.fillable,round:e.kind===`ellipse`,preset:t}:Wn}if(e.kind===`paths`&&e.paths.length===1&&!e.paths[0].fill&&!e.paths[0].stroke){let t=e.viewBox.join(` `),n=Un({svgPath:e.paths[0].d,svgViewBox:t});return n?{silhouette:n,fillable:!0,round:!1,path:{d:n.d,viewBox:n.viewBox}}:Wn}return Wn}var Kn=[{id:`stacked-waves`,layers:[{primitive:`layer-stack`,fixed:{interpolation:`wave`,boundary:`shared`}}],schema:[{key:`layers`,kind:`range`,group:`SHAPE`,label:{es:`Capas`,en:`Layers`},min:1,max:12,step:1,default:5},{key:`frequency`,kind:`range`,group:`SHAPE`,label:{es:`Frecuencia`,en:`Frequency`},min:2,max:12,step:1,default:4},{key:`amplitude`,kind:`range`,group:`SHAPE`,label:{es:`Amplitud`,en:`Amplitude`},min:0,max:1,step:.05,default:.5},{key:`balance`,kind:`range`,group:`SHAPE`,label:{es:`Balance`,en:`Balance`},min:0,max:1,step:.05,default:.5},{key:`anchor`,kind:`enum`,group:`DIRECTION`,label:{es:`Anclaje`,en:`Anchor`},options:[{value:`bottom`,label:{es:`Abajo`,en:`Bottom`}},{value:`top`,label:{es:`Arriba`,en:`Top`}},{value:`left`,label:{es:`Izquierda`,en:`Left`}},{value:`right`,label:{es:`Derecha`,en:`Right`}}],default:`bottom`}]},{id:`layered-waves`,layers:[{primitive:`layer-stack`,fixed:{interpolation:`wave`,boundary:`independent`}}],schema:[{key:`layers`,kind:`range`,group:`SHAPE`,label:{es:`Capas`,en:`Layers`},min:1,max:12,step:1,default:5},{key:`frequency`,kind:`range`,group:`SHAPE`,label:{es:`Frecuencia`,en:`Frequency`},min:2,max:12,step:1,default:4},{key:`amplitude`,kind:`range`,group:`SHAPE`,label:{es:`Amplitud`,en:`Amplitude`},min:0,max:1,step:.05,default:.5},{key:`anchor`,kind:`enum`,group:`DIRECTION`,label:{es:`Anclaje`,en:`Anchor`},options:[{value:`bottom`,label:{es:`Abajo`,en:`Bottom`}},{value:`top`,label:{es:`Arriba`,en:`Top`}}],default:`bottom`}]},{id:`stacked-peaks`,layers:[{primitive:`layer-stack`,fixed:{interpolation:`peak`,boundary:`shared`}}],schema:[{key:`layers`,kind:`range`,group:`SHAPE`,label:{es:`Capas`,en:`Layers`},min:1,max:12,step:1,default:5},{key:`frequency`,kind:`range`,group:`SHAPE`,label:{es:`Picos`,en:`Peaks`},min:2,max:12,step:1,default:4},{key:`amplitude`,kind:`range`,group:`SHAPE`,label:{es:`Altura`,en:`Height`},min:0,max:1,step:.05,default:.6}]},{id:`layered-peaks`,layers:[{primitive:`layer-stack`,fixed:{interpolation:`peak`,boundary:`independent`}}],schema:[{key:`layers`,kind:`range`,group:`SHAPE`,label:{es:`Capas`,en:`Layers`},min:1,max:12,step:1,default:5},{key:`frequency`,kind:`range`,group:`SHAPE`,label:{es:`Picos`,en:`Peaks`},min:2,max:12,step:1,default:4}]},{id:`stacked-steps`,layers:[{primitive:`layer-stack`,fixed:{interpolation:`step`,boundary:`shared`}}],schema:[{key:`layers`,kind:`range`,group:`SHAPE`,label:{es:`Capas`,en:`Layers`},min:1,max:12,step:1,default:5},{key:`frequency`,kind:`range`,group:`SHAPE`,label:{es:`Escalones`,en:`Steps`},min:2,max:12,step:1,default:5}]},{id:`layered-steps`,layers:[{primitive:`layer-stack`,fixed:{interpolation:`step`,boundary:`independent`}}],schema:[{key:`layers`,kind:`range`,group:`SHAPE`,label:{es:`Capas`,en:`Layers`},min:1,max:12,step:1,default:5}]},{id:`zigzag-chevron`,layers:[{primitive:`layer-stack`,fixed:{interpolation:`zigzag`,boundary:`independent`}}],schema:[{key:`layers`,kind:`range`,group:`SHAPE`,label:{es:`Franjas`,en:`Bands`},min:1,max:12,step:1,default:6}]},{id:`circle-scatter`,layers:[{primitive:`scatter`,fixed:{element:`circle`}}],schema:[{key:`count`,kind:`range`,group:`SHAPE`,label:{es:`Círculos`,en:`Circles`},min:1,max:40,step:1,default:3},{key:`sizeMin`,kind:`range`,group:`SHAPE`,label:{es:`Tamaño Mín`,en:`Min Size`},min:10,max:100,step:5,default:60},{key:`sizeMax`,kind:`range`,group:`SHAPE`,label:{es:`Tamaño Máx`,en:`Max Size`},min:60,max:300,step:10,default:180},{key:`minDistance`,kind:`range`,group:`SHAPE`,label:{es:`Distancia Mín`,en:`Min Distance`},min:0,max:100,step:5,default:40}]},{id:`rose-petals`,layers:[{primitive:`scatter`,fixed:{element:`petal`}}],schema:[{key:`count`,kind:`range`,group:`SHAPE`,label:{es:`Pétalos`,en:`Petals`},min:1,max:40,step:1,default:12},{key:`sizeMin`,kind:`range`,group:`SHAPE`,label:{es:`Tamaño Mín`,en:`Min Size`},min:10,max:100,step:5,default:30}]},{id:`blob-scene`,layers:[{primitive:`blob`,fixed:{}}],schema:[{key:`count`,kind:`range`,group:`SHAPE`,label:{es:`Blobs`,en:`Blobs`},min:1,max:6,step:1,default:2},{key:`points`,kind:`range`,group:`SHAPE`,label:{es:`Complejidad`,en:`Complexity`},min:5,max:14,step:1,default:8},{key:`irregularity`,kind:`range`,group:`SHAPE`,label:{es:`Deformación`,en:`Irregularity`},min:0,max:1,step:.05,default:.5},{key:`anchor`,kind:`enum`,group:`DIRECTION`,label:{es:`Anclaje`,en:`Anchor`},options:[{value:`center`,label:{es:`Centro`,en:`Center`}},{value:`corner-tl`,label:{es:`Esquina Sup-Izq`,en:`Top-Left`}},{value:`corner-tr`,label:{es:`Esquina Sup-Der`,en:`Top-Right`}},{value:`corner-bl`,label:{es:`Esquina Inf-Izq`,en:`Bottom-Left`}},{value:`corner-br`,label:{es:`Esquina Inf-Der`,en:`Bottom-Right`}}],default:`corner-tr`}]},{id:`low-poly-grid`,layers:[{primitive:`mesh`,fixed:{}}],schema:[{key:`resolution`,kind:`range`,group:`SHAPE`,label:{es:`Resolución`,en:`Resolution`},min:3,max:20,step:1,default:8},{key:`distortion`,kind:`range`,group:`SHAPE`,label:{es:`Distorsión`,en:`Distortion`},min:0,max:1,step:.05,default:.6},{key:`borderWidth`,kind:`range`,group:`SHAPE`,label:{es:`Borde`,en:`Border`},min:0,max:4,step:.5,default:.5}]},{id:`bullseye-gradient`,layers:[{primitive:`radial`,fixed:{kind:`rings`}}],schema:[{key:`count`,kind:`range`,group:`SHAPE`,label:{es:`Anillos`,en:`Rings`},min:3,max:48,step:1,default:16}]},{id:`wintery-sunburst`,layers:[{primitive:`radial`,fixed:{kind:`rays`}}],schema:[{key:`count`,kind:`range`,group:`SHAPE`,label:{es:`Rayos`,en:`Rays`},min:3,max:48,step:1,default:16}]},{id:`radiant-gradient`,layers:[{primitive:`gradient`,fixed:{kind:`radial`}}],schema:[{key:`softness`,kind:`range`,group:`SHAPE`,label:{es:`Suavidad`,en:`Softness`},min:0,max:1,step:.05,default:.8}]},{id:`blurry-gradient`,layers:[{primitive:`gradient`,fixed:{kind:`linear`}}],schema:[{key:`angle`,kind:`range`,group:`SHAPE`,label:{es:`Ángulo`,en:`Angle`},min:0,max:360,step:15,default:135}]},{id:`protruding-cubes`,layers:[{primitive:`iso-grid`,fixed:{hollow:!1}}],schema:[{key:`cols`,kind:`range`,group:`SHAPE`,label:{es:`Columnas`,en:`Columns`},min:4,max:20,step:1,default:8},{key:`extrude`,kind:`range`,group:`SHAPE`,label:{es:`Extrusión`,en:`Extrusion`},min:0,max:1,step:.05,default:.6}]},{id:`hollowed-boxes`,layers:[{primitive:`iso-grid`,fixed:{hollow:!0}}],schema:[{key:`cols`,kind:`range`,group:`SHAPE`,label:{es:`Columnas`,en:`Columns`},min:4,max:20,step:1,default:8}]},{id:`luz-difusa`,layers:[{primitive:`gradient`,fixed:{kind:`linear`}},{primitive:`radial`,fixed:{kind:`radial`},blend:`screen`,opacity:.8,blur:20}],grain:{intensity:.15},schema:[{key:`angle`,kind:`range`,group:`SHAPE`,label:{es:`Ángulo Base`,en:`Base Angle`},min:0,max:360,step:15,default:135},{key:`softness`,kind:`range`,group:`SHAPE`,label:{es:`Difusión`,en:`Diffusion`},min:.1,max:1,step:.05,default:.8}]},{id:`malla-suave`,layers:[{primitive:`mesh`,fixed:{borderWidth:0}},{primitive:`radial`,fixed:{kind:`radial`},blend:`soft-light`,opacity:.7}],schema:[{key:`resolution`,kind:`range`,group:`SHAPE`,label:{es:`Resolución Malla`,en:`Mesh Resolution`},min:3,max:12,step:1,default:6},{key:`distortion`,kind:`range`,group:`SHAPE`,label:{es:`Fluidez`,en:`Fluidity`},min:0,max:1,step:.05,default:.5},{key:`softness`,kind:`range`,group:`SHAPE`,label:{es:`Luz Radial`,en:`Radial Light`},min:.1,max:1,step:.05,default:.7}]},{id:`reticula`,layers:[{primitive:`gradient`,fixed:{kind:`linear`}},{primitive:`iso-grid`,fixed:{hollow:!0},blend:`screen`,opacity:.85}],grain:{intensity:.18},schema:[{key:`cols`,kind:`range`,group:`SHAPE`,label:{es:`Densidad Rejilla`,en:`Grid Density`},min:4,max:24,step:1,default:10},{key:`angle`,kind:`range`,group:`SHAPE`,label:{es:`Inclinación Luz`,en:`Light Angle`},min:0,max:360,step:15,default:120}]},{id:`polvo`,layers:[{primitive:`gradient`,fixed:{kind:`radial`}},{primitive:`scatter`,fixed:{element:`circle`},blend:`lighten`,opacity:.65}],grain:{intensity:.28},schema:[{key:`count`,kind:`range`,group:`VARIANTS`,label:{es:`Partículas`,en:`Particles`},min:10,max:80,step:5,default:35},{key:`sizeMin`,kind:`range`,group:`SHAPE`,label:{es:`Tamaño Mín`,en:`Min Size`},min:2,max:20,step:1,default:4},{key:`sizeMax`,kind:`range`,group:`SHAPE`,label:{es:`Tamaño Máx`,en:`Max Size`},min:10,max:50,step:2,default:20}]}];function qn(e){return Kn.find(t=>t.id===e)}var Jn=(e,t)=>{let n=e,r=Math.max(1,Math.min(12,Number(n.layers??5))),i=n.interpolation||`wave`,a=n.boundary||`shared`,o=Math.max(2,Math.min(12,Number(n.frequency??4))),s=Math.max(0,Math.min(1,Number(n.amplitude??.5))),c=Math.max(0,Math.min(1,Number(n.balance??.5))),l=n.anchor||`bottom`,u=t.width,d=t.height,f=t.bleed,p=l===`bottom`||l===`top`,m=p?d:u,h=p?u:d,g=m/(r+1),_=(c-.5)*h*.4,v=[];for(let e=0;e<r;e++){let n=(e+1)*g,r=[],i=h/o;for(let e=0;e<=o;e++){let a=e*i,c=(t.rng.next()-.5)*g*s*1.6,f=Math.max(10,Math.min(m-10,n+c));if(p){let t=a+(e>0&&e<o?_:0),n=l===`bottom`?d-f:f;r.push({x:t,y:n})}else{let t=a+(e>0&&e<o?_:0),n=l===`right`?u-f:f;r.push({x:n,y:t})}}v.push(r)}let y=``,b=a===`independent`?Array.from({length:r},(e,t)=>r-1-t):Array.from({length:r},(e,t)=>t);for(let e of b){let n=t.ramp(e,r),o=v[e],s=``;if(i===`step`){s=`M ${o[0].x} ${o[0].y}`;for(let e=0;e<o.length-1;e++){let t=o[e],n=o[e+1];s+=p?` L ${n.x} ${t.y} L ${n.x} ${n.y}`:` L ${t.x} ${n.y} L ${n.x} ${n.y}`}}else if(i===`peak`){s=`M ${o[0].x} ${o[0].y}`;for(let e=1;e<o.length;e++)s+=` L ${o[e].x} ${o[e].y}`}else if(i===`zigzag`||i===`chevron`){s=`M ${o[0].x} ${o[0].y}`;for(let t=0;t<o.length-1;t++){let n=o[t],r=o[t+1],i=(n.x+r.x)/2+(p?0:e%2==0?30:-30),a=(n.y+r.y)/2+(p?e%2==0?30:-30:0);s+=` L ${i} ${a} L ${r.x} ${r.y}`}}else{s=`M ${o[0].x} ${o[0].y}`;for(let e=0;e<o.length-1;e++){let t=o[e],n=o[e+1],r=t.x+(n.x-t.x)*.5,i=t.y,a=t.x+(n.x-t.x)*.5,c=n.y;s+=` C ${r} ${i}, ${a} ${c}, ${n.x} ${n.y}`}}if(a===`shared`&&e>0){let t=v[e-1],n=l===`bottom`?f:l===`top`?-f:0,r=l===`right`?f:l===`left`?-f:0;for(let e=t.length-1;e>=0;e--)s+=` L ${t[e].x+r} ${t[e].y+n}`}else s+=l===`bottom`?` L ${u} ${d+f} L 0 ${d+f}`:l===`top`?` L ${u} ${-f} L 0 ${-f}`:l===`right`?` L ${u+f} ${d} L ${u+f} 0`:` L ${-f} ${d} L ${-f} 0`;s+=` Z`,y+=`<path d="${s}" fill="${n}" stroke="${n}" stroke-width="0.5" stroke-linejoin="round" stroke-linecap="round" />`}return y},Yn=(e,t)=>{let n=e,r=Math.max(1,Math.min(40,Number(n.count??3))),i=n.element||`circle`,a=Math.max(10,Number(n.sizeMin??60)),o=Math.max(a,Number(n.sizeMax??180)),s=Math.max(0,Number(n.minDistance??40)),c=n.distribution||`uniform`,l=t.width,u=t.height,d=[],f=r*50,p=0;for(;d.length<r&&p<f;){p++;let e=t.rng.next()*l,n=t.rng.next()*u;if(c===`center`){let r=l/2,i=u/2,a=t.rng.next()**.5,o=t.rng.next()*Math.PI*2;e=r+Math.cos(o)*(l*.35*a),n=i+Math.sin(o)*(u*.35*a)}else c===`edge`&&(t.rng.next()>.5?e=t.rng.next()>.5?t.rng.range(0,l*.25):t.rng.range(l*.75,l):n=t.rng.next()>.5?t.rng.range(0,u*.25):t.rng.range(u*.75,u));let r=t.rng.range(a,o),i=!0;for(let t of d)if(Math.hypot(e-t.x,n-t.y)<t.r+r+s){i=!1;break}i&&d.push({x:e,y:n,r})}let m=``;for(let e=0;e<d.length;e++){let n=d[e],r=t.ramp(e,Math.max(1,d.length));if(i===`petal`){let e=`M ${n.x} ${n.y} C ${n.x+n.r} ${n.y-n.r*1.5}, ${n.x+n.r*2} ${n.y}, ${n.x} ${n.y+n.r*2} Z`;m+=`<path d="${e}" fill="${r}" stroke="${r}" opacity="0.85" />`}else if(i===`blob`){let e=n.r*(.8+t.rng.next()*.4),i=n.r*(.8+t.rng.next()*.4),a=n.r*(.8+t.rng.next()*.4),o=n.r*(.8+t.rng.next()*.4),s=`M ${n.x} ${n.y-e} C ${n.x+i} ${n.y-e}, ${n.x+i} ${n.y+a}, ${n.x} ${n.y+a} C ${n.x-o} ${n.y+a}, ${n.x-o} ${n.y-e}, ${n.x} ${n.y-e} Z`;m+=`<path d="${s}" fill="${r}" opacity="0.85" />`}else m+=`<circle cx="${n.x}" cy="${n.y}" r="${n.r}" fill="${r}" opacity="0.85" />`}return m},Xn=(e,t)=>{let n=e,r=Math.max(1,Math.min(6,Number(n.count??1))),i=Math.max(5,Math.min(14,Number(n.points??8))),a=Math.max(0,Math.min(1,Number(n.irregularity??.5))),o=n.anchor||`center`,s=Math.max(100,Number(n.size??Math.min(t.width,t.height)*.45)),c=t.width,l=t.height,u=``;for(let e=0;e<r;e++){let n=t.ramp(e,r),d=s*(1-e*.15),f=c/2,p=l/2;o===`corner-tl`?(f=0,p=0):o===`corner-tr`?(f=c,p=0):o===`corner-bl`?(f=0,p=l):o===`corner-br`&&(f=c,p=l);let m=Math.PI*2/i,h=[];for(let e=0;e<i;e++){let n=e*m,r=(t.rng.next()-.5)*d*a,i=Math.max(20,d+r);h.push({x:Math.cos(n)*i,y:Math.sin(n)*i})}let g=`M ${h[0].x} ${h[0].y}`;for(let e=0;e<i;e++){let t=h[e],n=h[(e+1)%i],r=(t.x+n.x)/2,a=(t.y+n.y)/2;g+=` Q ${t.x} ${t.y}, ${r} ${a}`}g+=` Z`,u+=`
|
|
51
|
+
[data-slot-id="background-pattern-slot"] { width: 100% !important; height: 100% !important; display: block !important; }`}function ee(e){if(!e)return;let t=O();if(document.head&&!document.getElementById(`oim-player-styles`)){let e=document.createElement(`style`);e.id=`oim-player-styles`,e.textContent=t,document.head.appendChild(e)}if(e.getElementById&&!e.getElementById(`oim-player-styles`)){let n=document.createElement(`style`);n.id=`oim-player-styles`,n.textContent=t,e.appendChild(n)}}function k(e){let t=e.artboardWidth||e.canvasWidth||e.canvas_width||1080,n=e.artboardHeight||e.canvasHeight||e.canvas_height||1920;Array.isArray(e.slots_raw)&&!Array.isArray(e.slots)&&(e.slots=e.slots_raw.map(e=>{let r=e.x_px??e.x??0,i=e.y_px??e.y??0,a=e.width_px??e.width??0,o=e.height_px??e.height??0,s=e.align||`left`,c=r,l=i,u=t>0?c/t*100:0,d=n>0?l/n*100:0,f=e.style||{};return f.width=f.width||a+`px`,f.height=f.height||o+`px`,e.border_radius_px!==void 0&&f.borderRadius===void 0&&(f.borderRadius=e.border_radius_px+`px`),f.borderRadiusTL!==void 0&&(f.borderTopLeftRadius=f.borderRadiusTL+`px`,f.borderTopRightRadius=f.borderRadiusTR+`px`,f.borderBottomLeftRadius=f.borderRadiusBL+`px`,f.borderBottomRightRadius=f.borderRadiusBR+`px`),{...e,x:r,y:i,width:a,height:o,width_px:a,height_px:o,align:s,fontSize:e.fontSize??e.font_size_px??16,position:[u,d],style:f}})),Array.isArray(e.languages)&&!Array.isArray(e.lang)&&(e.lang=e.languages)}var te=new Map([[`publico`,`public`],[`solo_autor`,`author_only`],[`sellado`,`sealed`]]),A=new Set([`public`,`author_only`,`sealed`]);function ne(e){let t={...e};if(t.reedit===void 0&&`reedicion`in t){let e=t.reedicion;t.reedit=typeof e==`string`?te.get(e)??`author_only`:`author_only`}return t.reedit!==void 0&&!(typeof t.reedit==`string`&&A.has(t.reedit))&&(t.reedit=`author_only`),delete t.reedicion,t}var re=[`primary`,`on-primary`,`secondary`,`on-secondary`,`surface`,`on-surface`,`outline`,`accent`,`text-primary`,`text-secondary`,`text-muted`,`text-on-accent`],ie=new Set(re);function ae(e){return typeof e==`string`&&ie.has(e)}var oe=/^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/,j=/^(?:rgb|rgba|hsl|hsla)\(\s*[0-9a-zA-Z.,%/\s+-]*\)$/,M=new Set([`transparent`,`currentcolor`,`none`,`inherit`]),N=/^var\(\s*(--[A-Za-z0-9_-]+)\s*\)$/,se=/^var\(\s*(--[A-Za-z0-9_-]+)\s*,([\s\S]+)\)$/;function ce(e,t=0){if(typeof e!=`string`)return!1;let n=e.trim();if(!n||n.length>128||t>4||/[;{}<>"]/.test(n)||n.includes(`\\`)||/url\(|expression\(|\/\*/i.test(n))return!1;if(oe.test(n)||M.has(n.toLowerCase())||j.test(n)||N.test(n))return!0;let r=se.exec(n);return r?ce(r[2],t+1):!1}function le(e,t={}){let n=e.palettes??{},r=Object.hasOwn(n,`dark`)&&Object.hasOwn(n,`light`)&&t.prefersDark!==void 0?t.prefersDark?`dark`:`light`:void 0,i=[t.requested,r,e.defaultPalette].find(e=>typeof e==`string`&&Object.hasOwn(n,e));if(i===void 0)return null;let a={};for(let e of re){let t=n[i][e];ce(t)&&(a[e]=String(t).trim())}return{name:i,colors:a}}function P(e,t){let n=t!=null&&t!==``?String(t).trim():void 0,r=n&&ce(n)?n:void 0;if(ae(e)){let t=`var(--oim-palette-`+e+(r?`, `+r:``)+`)`;return`var(--oim-color-`+e+`, `+t+`)`}return r||``}function ue(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}var F={grayscale:`grayscale(1)`,sepia:`sepia(0.8)`,"high-contrast":`contrast(1.5) saturate(1.2)`,vintage:`sepia(0.35) contrast(1.1) saturate(0.85) brightness(1.05)`,cool:`saturate(1.1) hue-rotate(15deg) brightness(1.02)`,warm:`saturate(1.15) hue-rotate(-12deg) brightness(1.03)`,faded:`contrast(0.85) brightness(1.1) saturate(0.8)`,cinema:`contrast(1.25) saturate(1.1) hue-rotate(-8deg) brightness(0.95)`,nordic:`saturate(0.7) hue-rotate(20deg) brightness(1.05) contrast(1.1)`,sunset:`sepia(0.4) saturate(1.4) hue-rotate(-20deg) brightness(1.05)`,noir:`grayscale(1) contrast(1.6) brightness(0.9)`,dramatic:`contrast(1.6) saturate(1.3) brightness(0.95)`,cyberpunk:`contrast(1.3) saturate(1.8) hue-rotate(140deg)`,pastel:`brightness(1.15) saturate(1.3) contrast(0.9) hue-rotate(-5deg)`,vhs:`sepia(0.2) contrast(1.2) saturate(1.5) hue-rotate(30deg) brightness(1.05)`};function I(e,t,n){if(typeof e==`number`&&Number.isFinite(e))return Math.min(n,Math.max(t,e))}function de(e){let{filterPreset:t}=e;return{preset:typeof t==`string`&&Object.prototype.hasOwnProperty.call(F,t)?t:void 0,blur:I(e.filterBlur,0,100)??0,brightness:I(e.filterBrightness,0,500)??100,contrast:I(e.filterContrast,0,500)??100,saturate:I(e.filterSaturate,0,500)??100,hue:I(e.filterHueRotate,0,360)??0}}function fe(e){let t=de(e),n=[];return t.preset!==void 0&&n.push(F[t.preset]),t.blur!==0&&n.push(`blur(${t.blur}px)`),t.brightness!==100&&n.push(`brightness(${t.brightness}%)`),t.contrast!==100&&n.push(`contrast(${t.contrast}%)`),t.saturate!==100&&n.push(`saturate(${t.saturate}%)`),t.hue!==0&&n.push(`hue-rotate(${t.hue}deg)`),n.length>0?n.join(` `):void 0}var pe=`author_only`,me=[`public`,`author_only`,`sealed`];function he(e){if(!e||typeof e!=`object`)return pe;let t=ne(e);if(t.immutable_lock===!0||t.immutable===!0)return`sealed`;let n=t.reedit;return typeof n==`string`&&me.includes(n)?n:pe}function ge(e){return e===`public`?`verified_authorless`:`verified`}function _e(e){return!!e&&e.type===`group`}function ve(e){let t=(e&&e.style||{}).groupId;return typeof t==`string`&&t?t:null}function ye(e){let t=new Set;for(let n of e||[])_e(n)&&n.id&&t.add(String(n.id));let n=new Map;for(let r of e||[]){if(!r||!r.id||_e(r))continue;let e=ve(r);if(!e||!t.has(e))continue;let i=n.get(e);i?i.push(String(r.id)):n.set(e,[String(r.id)])}return n}function be(e){let t=ue(e)?.oim;return typeof t==`string`&&/^2\./.test(t)}var xe=`oim:base`;function Se(e){let t=t=>{if(typeof t==`string`)return t===xe;if(`ref`in t){let n=e.resources?.[t.ref];return n!==void 0&&`kind`in n&&n.kind===`image`&&n.src===xe}return t.value===xe||Object.values(t.modes??{}).includes(xe)},n=e=>e.some(e=>e.image!==void 0&&t(e.image.src)||n(e.children??[]));return n(e.layers)}function Ce(e){let t=structuredClone(e),n=[],r=e.resources??{},i=e=>{if(!(`ref`in e))return e;if(Object.prototype.hasOwnProperty.call(r,e.ref))return structuredClone(r[e.ref]);n.includes(e.ref)||n.push(e.ref)},a=e=>e.flatMap(e=>i(e)??[]),o=e=>{for(let t of e){if(t.fills&&=a(t.fills),t.strokes&&=t.strokes.flatMap(e=>{let t=i(e.paint);return t?[{...e,paint:t}]:[]}),t.image&&typeof t.image.src==`object`&&`ref`in t.image.src){let e=t.image.src,i=Object.prototype.hasOwnProperty.call(r,e.ref)?r[e.ref]:void 0;i&&`kind`in i&&i.kind===`image`?t.image={...t.image,src:i.src}:(delete t.image,n.includes(e.ref)||n.push(e.ref))}t.children&&o(t.children)}};return t.canvas.fills&&(t.canvas.fills=a(t.canvas.fills)),o(t.layers),{document:t,missing:n}}var L=r({createExternalLottieLoader:()=>we,createExternalScriptLoader:()=>z,default:()=>Te,vendorUrl:()=>R});function R(e,t){let n=`vendor/lottie_light-${t}.js`;if(e)try{return new URL(n,e).href}catch{}return B+n}function z(e){let t=null;return function(){let n=e.read();if(n)return Promise.resolve(n);if(t)return t;let r=e.doc??document,i=B+e.file;if(e.scriptUrl)try{i=new URL(e.file,e.scriptUrl).href}catch{}return t=new Promise((t,n)=>{let a=r.createElement(`script`);a.src=i,a.async=!0,a.setAttribute(e.marker,``),a.onload=()=>{let r=e.read();r?t(r):n(Error(`Script loaded from ${i} but did not define what was expected`))},a.onerror=()=>{a.remove(),n(Error(`Could not load ${i}`))},(r.head||r.documentElement).appendChild(a)}),t.catch(()=>{t=null}),t}}function we(e){return z({scriptUrl:e.scriptUrl,file:`vendor/lottie_light-${e.version}.js`,marker:`data-oim-lottie`,doc:e.doc,read:()=>{let e=globalThis.lottie;return e&&typeof e.loadAnimation==`function`?e:void 0}})}var B,V,Te,H=n((()=>{B=`https://cdn.oim.media/player/v1/`,V=we({scriptUrl:i,version:`5.13.0`}),Te={__oimExternal:!0,load:V}}));a(),H();var Ee=`__oimUpgrade`,U=()=>globalThis[Ee],De=z({scriptUrl:i,file:`vendor/oim-upgrade-0ad24e972d28.js`,marker:`data-oim-upgrade`,read:()=>U()}),Oe=e=>{let t=U();if(!t)throw Error(`[OimPlayer] upgrade called before ensureUpgrade()`);return t(e)};function ke(){return U()?Promise.resolve():De().then(()=>void 0)}function W(e,t){if(!e||typeof e!=`object`)return;let n=(t||``).toLowerCase();if(e[n]!==void 0)return e[n];let r=Object.keys(e);for(let t=0;t<r.length;t++)if(r[t].toLowerCase()===n)return e[r[t]]}function Ae(e,t){let n=e||{};if(n[`*`]!==void 0){let e=W(n,t);return typeof e==`string`?e:String(n[`*`]??``)}function r(e){if(n[e]!==void 0&&n[e]!==``)return n[e];let t=e.toLowerCase(),r=e.toUpperCase();if(n[r]!==void 0&&n[r]!==``)return n[r];if(n[t]!==void 0&&n[t]!==``)return n[t];let i=Object.keys(n);for(let e=0;e<i.length;e++)if(i[e].toLowerCase()===t&&n[i[e]]!==``)return n[i[e]]}let i=r(t)||r(`en`)||r(`es`)||r(`default`)||``;if(!i){let e=Object.keys(n);e.length>0&&(i=n[e[0]]||``)}return i}function je(e,t){return e&&e.type===`image`?!0:t.indexOf(`data:image/`)===0}function Me(e){return!!e&&(e.is_background_pattern===!0||e.id===`background-pattern-slot`)}var G=/^[\d.+-]+(cqw|cqh|cqi|cqb|rem|em|ex|ch|vw|vh|vmin|vmax|%|px|pt|pc|cm|mm|in|lh|rlh)$/i;function Ne(e,t){let n=t==null?`16px`:t.toString(),r=(e==null?``:e.toString()).trim();if(!r||r===`undefined`||r===`null`)return n;if(G.test(r))return r;let i=parseFloat(r);return isNaN(i)?n:i+`px`}function Pe(e,t){let n=e&&e.style||{},r=Ae(e&&e.content,t),i=je(e,r);return{content:r,size:Ne(W(n.fontSizes,t)||n.fontSize,n.fontSize||`16px`),maxWidthValue:Me(e)?`none`:W(n.maxWidths,t)||(i||(e?.type??`text`)!==`text`?n.maxWidth||`none`:n.maxWidth||`80%`)}}function Fe(e,t,n){let r=Pe(e,t),i=Pe(e,n);return r.content===i.content?r.size!==i.size||r.maxWidthValue!==i.maxWidthValue?`style-only`:`none`:`content`}var K=new WeakMap;function Ie(e){let t=new Map,n=e=>{for(let r of e)t.set(r.id,r),n(r.children??[])};return n(e),t}function Le(e){let t=K.get(e);if(t)return t;try{t=Ie(Oe(e).document.layers)}catch(e){console.warn(`[OimPlayer] 2.0 view unavailable:`,e),t=new Map}return K.set(e,t),t}function Re(e,t){K.set(e,Ie(t.layers))}function ze(e){let t=e=>!!e&&typeof e==`object`&&typeof e.var==`string`;return{css:e=>(t(e)?P(e.var,e.fallback):typeof e==`string`?P(null,e):``)||void 0,literal:n=>(t(n)?le(e)?.colors?.[n.var]??P(null,n.fallback):typeof n==`string`?P(null,n):``)||void 0}}function Be(e){let t=e.anchor??`top-left`;return[/left/.test(t)?`0%`:/right/.test(t)?`-100%`:`-50%`,/^top/.test(t)?`0%`:/^bottom/.test(t)?`-100%`:`-50%`]}function Ve(e,t){if(typeof e==`number`)return e;if(e&&typeof e==`object`&&`value`in e){let{value:n,modes:r}=e,i=r?.[t];return typeof i==`number`?i:typeof n==`number`?n:void 0}}function He(e,t){let n=e?.text;if(!n)return;let r={},i=Ve(n.font?.size,t);i!==void 0&&(r.fontSize=`${+i.toFixed(4)}px`);let a=Ve(n.maxWidth,t);return a!==void 0&&(r.maxWidth=`${+a.toFixed(4)}px`),n.font?.family&&(r.fontFamily=n.font.family),n.font?.weight!==void 0&&(r.fontWeight=String(n.font.weight)),n.font?.italic&&(r.fontStyle=`italic`),n.letterSpacing!==void 0&&(r.letterSpacing=`${n.letterSpacing}px`),n.transform&&(r.textTransform=n.transform),n.decoration&&(r.textDecoration=n.decoration),r}function Ue(e){let t=e??{},n=e=>typeof e==`number`?+(e*100).toFixed(6):void 0;return{filterPreset:t.preset,filterBlur:t.blur,filterBrightness:n(t.brightness),filterContrast:n(t.contrast),filterSaturate:n(t.saturate),filterHueRotate:t.hueRotate}}function We(e){let t=e.mask??{},n=e.geometry,r=n?.kind===`preset`?n.name:n?.kind===`paths`?`custom`:{rect:`rectangle`,ellipse:`circle`,line:`line`}[n?.kind??``],i=e=>typeof e==`string`?{role:void 0,literal:e}:e&&typeof e==`object`?{role:e.var,literal:e.fallback}:{role:void 0,literal:void 0},a=e.fills?.[0],o=i(a?.kind===`color`?a.value:void 0),s=e.strokes?.[0],c=i(s?.paint?.kind===`color`?s.paint.value:void 0);return{maskMode:t.mode===`cutout`?`cutout`:`window`,maskFeather:t.feather,maskCoverage:t.scope===`group`?`container`:`canvas`,maskShape:r,maskSvgPath:n?.kind===`paths`?n.paths?.map(e=>e.d).join(` `):void 0,geoShape:void 0,svgPath:void 0,maskBgColor:o.literal,maskBgColorRole:o.role,fillColorRole:void 0,maskStrokeColor:c.literal,maskStrokeColorRole:c.role,strokeColorRole:void 0,maskStrokeWidth:s?.width,cuts:e.extensions?.studio?.maskCuts}}function Ge(e,t){if(typeof e==`string`)return e===`oim:base`?``:e;if(!(`value`in e)||typeof e.value!=`string`)return``;let n=W(e.modes??{},t)??e.value;return n===`oim:base`?``:n}var Ke=e=>e&&!/[;{}<>"]|url\(|expression\(/i.test(e)?e:void 0;function qe(e,t,n=!1){let r=`http://www.w3.org/2000/svg`,i=document.createElementNS(r,`svg`);i.setAttribute(`viewBox`,e.viewBox.join(` `)),i.setAttribute(`width`,n?String(e.viewBox[2]):`100%`),i.setAttribute(`height`,n?String(e.viewBox[3]):`100%`),n?i.setAttribute(`xmlns`,r):(i.setAttribute(`preserveAspectRatio`,`xMidYMid meet`),i.style.setProperty(`display`,`block`));for(let a of e.paths){let e=document.createElementNS(r,`path`);e.setAttribute(`d`,a.d);let o=Ke(a.fill===`currentColor`?t.fill??`currentColor`:a.fill),s=Ke(a.stroke===`currentColor`?t.stroke??`currentColor`:a.stroke);n?(e.setAttribute(`fill`,o??`none`),s&&e.setAttribute(`stroke`,s)):(e.setAttribute(`fill`,`none`),o&&e.style.setProperty(`fill`,o),s&&e.style.setProperty(`stroke`,s)),a.strokeWidth!==void 0&&e.setAttribute(`stroke-width`,String(a.strokeWidth)),a.fillRule&&e.setAttribute(`fill-rule`,a.fillRule),a.cap&&e.setAttribute(`stroke-linecap`,a.cap),a.join&&e.setAttribute(`stroke-linejoin`,a.join),a.opacity!==void 0&&e.setAttribute(`opacity`,String(a.opacity)),a.transform&&e.setAttribute(`transform`,`matrix(${a.transform.join(` `)})`),i.appendChild(e)}return i.outerHTML}function Je(e,t){let n=e=>e&&typeof e==`object`&&e.kind===`color`?t(e.value):void 0,r=n(e.fills?.[0]),i=n(e.strokes?.[0]?.paint);return{fill:r??i,stroke:i??r}}function q(e){if(typeof e==`number`)return{px:`${e}px`};if(e&&typeof e==`object`&&`value`in e){let{value:t,modes:n}=e,r=Object.fromEntries(Object.entries(n??{}).map(([e,t])=>[e,`${t}px`]));return{px:`${t}px`,byLang:Object.keys(r).length>0?r:void 0}}return{}}function Ye(e,t){e.content=t.content;let n=q(t.font?.size),r=q(t.maxWidth);n.px&&(e.style.fontSize=n.px),n.byLang&&(e.style.fontSizes=n.byLang),r.px&&(e.style.maxWidth=r.px),r.byLang&&(e.style.maxWidths=r.byLang)}function Xe(e){let t=e?.modes?.palette;if(!e||!t)return;let n=Object.fromEntries(t.map(e=>[e,{}]));for(let[t,r]of Object.entries(e.values??{}))for(let[e,i]of Object.entries(r))n[e]&&typeof i==`string`&&(n[e][t]=i);return n}function Ze(e){let t=[],n=(e,r)=>{for(let i of e){let e=i.mask?`mask`:i.text?.artistic?`artistic-text`:i.type,a={id:i.id,type:e,style:r?{groupId:r}:{}};i.text&&Ye(a,i.text),t.push(a),n(i.children??[],i.id)}};n(e.layers);let r={canvas_width:e.canvas.width,canvas_height:e.canvas.height,languages:e.languages,slots:t};e.fonts&&(r.fonts=e.fonts);let i=Xe(e.variables);return i&&(r.palettes=i),e.variables?.defaults?.palette&&(r.defaultPalette=e.variables.defaults.palette),Re(r,e),r}var Qe="/**\n* @license\n* Copyright (c) 2026 Xue Studios LLC\n* SPDX-License-Identifier: Apache-2.0\n*/\nconst e=10485760;async function t(t,r=e){let i=t.replace(/\\s+/g,``);try{let e=atob(i);if(e.trim().startsWith(`{`)){if(e.length>r)throw Error(`Metadata exceeds the limit of ${r/1048576}MB (zip bomb detected)`);return JSON.parse(e)}}catch(e){if(e.message&&e.message.includes(`zip bomb detected`))throw e}let a=atob(i),o=new Uint8Array(a.length);for(let e=0;e<a.length;e++)o[e]=a.charCodeAt(e);try{return JSON.parse(await n(o,`deflate`,r))}catch(e){if(e.message&&e.message.includes(`zip bomb detected`))throw e;try{return JSON.parse(await n(o,`deflate-raw`,r))}catch(t){throw t.message&&t.message.includes(`zip bomb detected`)||console.error(`[OIM Core] Decompression failed for both deflate and deflate-raw:`,e,t),t}}}async function n(t,n,r=e){let i=new DecompressionStream(n),a=i.writable.getWriter();a.write(t).catch(function(){}),a.close().catch(function(){});let o=i.readable.getReader(),s=[],c=0;try{for(;;){let{done:e,value:t}=await o.read();if(e)break;if(t){if(c+=t.byteLength,c>r)throw await o.cancel(),Error(`Decompressed metadata exceeds the limit of ${r/1048576}MB (zip bomb detected)`);s.push(t)}}}finally{o.releaseLock()}let l=new Uint8Array(c),u=0;for(let e of s)l.set(e,u),u+=e.byteLength;return new TextDecoder().decode(l)}async function r(e){let t=new DataView(e),n=[],r=0;for(let i=8;i+8<=e.byteLength;){let a=t.getUint32(i,!1);String.fromCharCode(t.getUint8(i+4),t.getUint8(i+5),t.getUint8(i+6),t.getUint8(i+7))===`IDAT`&&(n.push(new Uint8Array(e,i+8,a)),r+=a),i+=12+a}if(n.length===0)return null;let i=new Uint8Array(r),a=0;for(let e of n)i.set(e,a),a+=e.length;let o=await crypto.subtle.digest(`SHA-256`,i);return Array.from(new Uint8Array(o),e=>e.toString(16).padStart(2,`0`)).join(``)}async function i(e){let i=await e.arrayBuffer(),a=new DataView(i),o=8,s=null,c=null,l=[new Uint8Array(i,0,8)];for(;o<i.byteLength;){let e=a.getUint32(o,!1),t=o+4,r=String.fromCharCode(a.getUint8(t),a.getUint8(t+1),a.getUint8(t+2),a.getUint8(t+3)),u=8+e+4;if(r===`tEXt`){let r=new Uint8Array(i,t+4,e),a=r.indexOf(0);if(a!==-1){let e=new TextDecoder().decode(r.slice(0,a));if(e===`OIM_Data`||e===`OIM_JSON_DATA`){let e=r.slice(a+1),t=null;try{t=await n(e,`deflate`)}catch{try{t=await n(e,`deflate-raw`)}catch{}}if(t&&t.trim().startsWith(`{`))try{c=JSON.parse(t)}catch{}else s=new TextDecoder(`latin1`).decode(e);o+=u;continue}}}else if(r===`zTXt`){let r=new Uint8Array(i,t+4,e),a=r.indexOf(0);if(a!==-1){let e=new TextDecoder().decode(r.slice(0,a));if(e===`OIM_Data`||e===`OIM_JSON_DATA`){let e=r[a+1],t=r.slice(a+2);if(e===0)try{s=await n(t,`deflate`)}catch(e){try{s=await n(t,`deflate-raw`)}catch(t){console.error(`[OimPlayer] Failed to decompress zTXt chunk:`,e,t)}}if(s){o+=u;continue}}}}else if(r===`iTXt`){let r=new Uint8Array(i,t+4,e),a=r.indexOf(0);if(a!==-1){let e=new TextDecoder().decode(r.slice(0,a));if(e===`OIM_Data`||e===`OIM_JSON_DATA`){let e=r[a+1],t=r[a+2],i=r.slice(a+3),c=i.indexOf(0);if(c!==-1){let r=i.slice(c+1),a=r.indexOf(0);if(a!==-1){let i=r.slice(a+1);if(e===1){if(t===0)try{s=await n(i,`deflate`)}catch(e){try{s=await n(i,`deflate-raw`)}catch(t){console.error(`[OimPlayer] Failed to decompress iTXt chunk:`,e,t)}}}else s=new TextDecoder().decode(i);if(s){o+=u;continue}}}}}}l.push(new Uint8Array(i,o,u)),o+=u}let u=new Blob(l,{type:`image/png`}),d=null;return c?d=c:s&&(d=s.trimStart().startsWith(`{`)?JSON.parse(s):await t(s)),{image:u,metadata:d,imageHash:await r(i)}}\n/**\n* @license\n* Copyright (c) 2026 Xue Studios LLC\n* SPDX-License-Identifier: Apache-2.0\n*/\nfunction a(e){let t=e.artboardWidth||e.canvasWidth||e.canvas_width||1080,n=e.artboardHeight||e.canvasHeight||e.canvas_height||1920;Array.isArray(e.slots_raw)&&!Array.isArray(e.slots)&&(e.slots=e.slots_raw.map(e=>{let r=e.x_px??e.x??0,i=e.y_px??e.y??0,a=e.width_px??e.width??0,o=e.height_px??e.height??0,s=e.align||`left`,c=r,l=i,u=t>0?c/t*100:0,d=n>0?l/n*100:0,f=e.style||{};return f.width=f.width||a+`px`,f.height=f.height||o+`px`,e.border_radius_px!==void 0&&f.borderRadius===void 0&&(f.borderRadius=e.border_radius_px+`px`),f.borderRadiusTL!==void 0&&(f.borderTopLeftRadius=f.borderRadiusTL+`px`,f.borderTopRightRadius=f.borderRadiusTR+`px`,f.borderBottomLeftRadius=f.borderRadiusBL+`px`,f.borderBottomRightRadius=f.borderRadiusBR+`px`),{...e,x:r,y:i,width:a,height:o,width_px:a,height_px:o,align:s,fontSize:e.fontSize??e.font_size_px??16,position:[u,d],style:f}})),Array.isArray(e.languages)&&!Array.isArray(e.lang)&&(e.lang=e.languages)}\n/**\n* @license\n* Copyright (c) 2026 Xue Studios LLC\n* SPDX-License-Identifier: Apache-2.0\n*/\nconst o=/* @__PURE__ */ new Map([[`publico`,`public`],[`solo_autor`,`author_only`],[`sellado`,`sealed`]]),s=/* @__PURE__ */ new Set([`public`,`author_only`,`sealed`]);function c(e){let t={...e};if(t.reedit===void 0&&`reedicion`in t){let e=t.reedicion;t.reedit=typeof e==`string`?o.get(e)??`author_only`:`author_only`}return t.reedit!==void 0&&!(typeof t.reedit==`string`&&s.has(t.reedit))&&(t.reedit=`author_only`),delete t.reedicion,t}\n/**\n* @license\n* Copyright (c) 2026 Xue Studios LLC\n* SPDX-License-Identifier: Apache-2.0\n*/\nfunction l(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}\n/**\n* @license\n* Copyright (c) 2026 Xue Studios LLC\n* SPDX-License-Identifier: Apache-2.0\n*/\nconst u=`author_only`,d=[`public`,`author_only`,`sealed`];function f(e){if(!e||typeof e!=`object`)return u;let t=c(e);if(t.immutable_lock===!0||t.immutable===!0)return`sealed`;let n=t.reedit;return typeof n==`string`&&d.includes(n)?n:u}function p(e){return e===`public`?`verified_authorless`:`verified`}\n/**\n* @license\n* Copyright (c) 2026 Xue Studios LLC\n* SPDX-License-Identifier: Apache-2.0\n*/\nfunction m(e){let t=l(e)?.oim;return typeof t==`string`&&/^2\\./.test(t)}\n/**\n* @license\n* Copyright (c) 2026 Xue Studios LLC\n* SPDX-License-Identifier: Apache-2.0\n*/\nconst h=[{kid:`v1`,jwk:{kty:`EC`,crv:`P-256`,x:`5Qavr4M_npVognquI5k5D9K8wcXBXM9Z0mZHjqyehAs`,y:`oh7rz5Q7SlZT_ms2buyOw0bPX77QsXimc0X92Ymj2_o`}},{kid:`v2`,jwk:{kty:`EC`,crv:`P-256`,x:`pRSLtFHe9p8sR8jyqP5eoaBGbHdJgjjrdClda2lNp4A`,y:`oopYYhgja8m2iAlSMPigeWw-F72KJLNCRFQzlyWdt2I`}}];function g(e){for(let t=0;t<h.length;t++)if(h[t].kid===e)return h[t];return null}let _=null;function v(e){_=typeof e==`string`&&e?e:null}function y(){if(_)return _;let e=globalThis.OIM_PLAYER_CONFIG;return(e&&typeof e.keysUrl==`string`?e.keysUrl:``)||`https://api.oim.media/v1/media/keys`}function b(e,t){let n=g(e)?.not_after,r=t&&typeof t.not_after==`string`?t.not_after:void 0;return n?r&&Date.parse(r)<Date.parse(n)?r:n:r}function x(e,t){if(!e.not_after||!t)return!0;let n=Date.parse(t),r=Date.parse(e.not_after);return isNaN(n)||isNaN(r)?!0:n<=r}function S(e,t,n=Date.now()){let r=g(e)?.verify_until,i=t&&typeof t.verify_until==`string`?t.verify_until:void 0;if(!g(e)&&!t)return!0;let a=[r,i].filter(e=>!!e&&!isNaN(Date.parse(e)));return a.length!==0&&n>Math.min(...a.map(e=>Date.parse(e)))+6048e5}\n/**\n* @license\n* Copyright (c) 2026 Xue Studios LLC\n* SPDX-License-Identifier: Apache-2.0\n*/\nconst C=2**53-1;function w(e){return typeof e==`number`?!Number.isFinite(e)||Math.abs(e)>C:typeof e==`object`&&e?Object.values(e).some(w):!1}const T=/* @__PURE__ */ new Set([`signature`,`key_version`,`timestamp`,`creator_user_id`]);function E(e){if(Array.isArray(e))return e.map(E);if(typeof e==`object`&&e){let t={};for(let n of Object.keys(e))t[n]=E(e[n]);return t}return typeof e==`number`&&Number.isFinite(e)&&!Number.isInteger(e)?Number(e.toFixed(6)):e}function D(e){if(Array.isArray(e))return e.map(D);if(typeof e==`object`&&e){let t={},n=Object.keys(e).sort((e,t)=>{let n=[...e],r=[...t],i=Math.min(n.length,r.length);for(let e=0;e<i;e++){let t=(n[e].codePointAt(0)??0)-(r[e].codePointAt(0)??0);if(t!==0)return t}return n.length-r.length});for(let r of n)t[r]=D(e[r]);return t}return e}function O(e){if(!e||typeof e!=`object`)return new TextEncoder().encode(`{}`);let t={};for(let n of Object.keys(e))T.has(n)||(t[n]=e[n]);let n=D(E(t)),r=JSON.stringify(n);return new TextEncoder().encode(r)}\n/**\n* @license\n* Copyright (c) 2026 Xue Studios LLC\n* SPDX-License-Identifier: Apache-2.0\n*/\nconst k={};let A=null,j=!1,M=null;function N(){return new Promise(e=>{if(typeof indexedDB>`u`)return e([]);try{let t=indexedDB.open(`oim-player-keys`,1);t.onupgradeneeded=e=>{let t=e.target.result;t.objectStoreNames.contains(`keys`)||t.createObjectStore(`keys`,{keyPath:`kid`})},t.onsuccess=t=>{let n=t.target.result;if(!n.objectStoreNames.contains(`keys`)){e([]),n.close();return}let r=n.transaction(`keys`,`readonly`).objectStore(`keys`).getAll();r.onsuccess=()=>{e(r.result||[]),n.close()},r.onerror=()=>{e([]),n.close()}},t.onerror=()=>{e([])}}catch{e([])}})}function P(e){return new Promise(t=>{if(typeof indexedDB>`u`)return t();try{let n=indexedDB.open(`oim-player-keys`,1);n.onupgradeneeded=e=>{let t=e.target.result;t.objectStoreNames.contains(`keys`)||t.createObjectStore(`keys`,{keyPath:`kid`})},n.onsuccess=n=>{let r=n.target.result;if(!r.objectStoreNames.contains(`keys`)){t(),r.close();return}let i=r.transaction(`keys`,`readwrite`),a=i.objectStore(`keys`);e.forEach(e=>{a.put(e)}),i.oncomplete=()=>{t(),r.close()},i.onerror=()=>{t(),r.close()}},n.onerror=()=>{t()}}catch{t()}})}async function F(e){let t=g(e);return t?t.jwk:(k[e]||!j&&(M||=N().then(e=>{e.forEach(e=>{k[e.kid]=e}),j=!0}),await M,k[e])||await I(),k[e])}function I(){return A||=(async function(){try{let e=y(),t=await fetch(e).catch(()=>null),n=null;if(t&&t.ok&&(t.headers.get(`content-type`)||``).indexOf(`application/json`)!==-1)try{n=await t.json()}catch{}if(n&&Array.isArray(n.keys)){for(let e=0;e<n.keys.length;e++){let t=n.keys[e];k[t.kid]=t}await P(n.keys)}}catch(e){console.warn(`[OimPlayer::Security] Failed to fetch public keys from server:`,e)}})(),A}async function L(e){return await I(),k[e]||null}async function R(e,t){if(!e||typeof e!=`object`)return!1;if(!e.signature||!e.key_version)return console.warn(`[OimPlayer::Security] Metadata is not signed. Skipping signature verification (Legacy mode).`),!0;try{let t=await F(e.key_version);if(!t)return console.error(`[OimPlayer::Security] Public key not found for version:`,e.key_version),!1;if(w(e))return!1;let n=O(e),r=atob(e.signature),i=new Uint8Array(r.length);for(let e=0;e<r.length;e++)i[e]=r.charCodeAt(e);let a=async(e,t)=>{let n=await crypto.subtle.importKey(`jwk`,e,{name:`ECDSA`,namedCurve:`P-256`},!0,[`verify`]);return crypto.subtle.verify({name:`ECDSA`,hash:{name:`SHA-256`}},n,i,t)},o=await a(t,n);if(!o&&e.creator_user_id){let n={},r=Object.keys(e).filter(function(e){return e!==`signature`&&e!==`key_version`&&e!==`timestamp`}).sort();function i(e){if(Array.isArray(e))return e.map(i);if(typeof e==`object`&&e){let t={},n=Object.keys(e).sort();for(let r=0;r<n.length;r++)t[n[r]]=i(e[n[r]]);return t}return e}for(let t=0;t<r.length;t++)n[r[t]]=i(e[r[t]]);o=await a(t,new TextEncoder().encode(JSON.stringify(n)))}if(!o)try{let r=await L(e.key_version);r&&(r.x!==t.x||r.y!==t.y)&&(console.warn(`[OimPlayer::Security] Pinned key failed; retrying with the key published by the server for kid:`,e.key_version),o=await a(r,n))}catch{}if(o){let n=b(e.key_version,t);if(!x({kid:e.key_version,jwk:t,not_after:n},e.signed_at))return console.error(`[OimPlayer::Security] Signature made after this key was retired.`),!1}return o||console.error(`[OimPlayer::Security] Cryptographic signature VERIFICATION FAILED. Metadata was tampered with!`),o}catch(e){return console.error(`[OimPlayer::Security] Error verifying signature:`,e),!1}}function z(e){if(!e.isSigned)return`unsigned`;if(!e.isSigValid)return`invalid_signature`;if(e.keyExpired)return`expired_key`;let t=e.metadata||{},n=t.image_hash_alg===`sha256-idat`&&typeof t.image_hash==`string`?t.image_hash:``;return n?!e.imageHash||n.toLowerCase()!==e.imageHash.toLowerCase()?`image_mismatch`:p(f(e.metadata)):`image_unsealed`}async function B(e,t=Date.now()){let n=e&&e.key_version;return n?g(n)?S(n,null,t):S(n,await L(n),t):!1}function V(e){return e===`image_mismatch`||e===`invalid_signature`}function H(e){let t=[];function n(e){t.push(e)}function r(e,t){return typeof e==`string`&&e.length<=(t||1e7)}function i(e){return typeof e==`number`&&isFinite(e)}if(typeof e!=`object`||!e)return n(`metadata must be object`),t;let a=e.slots||e.elements||[];if(!Array.isArray(a))return n(`slots must be array`),t;a.length>150&&n(`max 150 slots`);for(let e=0;e<a.length;e++){let t=a[e];if(typeof t!=`object`||!t){n(`slot[`+e+`] must be object`);continue}t.id!==void 0&&t.id!==null&&(typeof t.id!=`string`||t.id.length>128)&&n(`slot[`+e+`].id invalid`);let o=t.content;if(o!==void 0){if(typeof o!=`object`||!o)n(`slot[`+e+`].content must be object`);else{let t=Object.keys(o);for(let i=0;i<t.length;i++){let a=o[t[i]];if(typeof a==`string`)a.length>1e7&&n(`slot[`+e+`].content.`+t[i]+` too long`);else if(typeof a==`object`&&a&&!Array.isArray(a)){let o=Object.keys(a);for(let s=0;s<o.length;s++)r(a[o[s]])||n(`slot[`+e+`].content.`+t[i]+`.`+o[s]+` invalid`)}}}}t.style&&(typeof t.style==`object`?t.style.fillColor&&(typeof t.style.fillColor!=`string`||t.style.fillColor.length>64)&&n(`slot[`+e+`].style.fillColor invalid`):n(`slot[`+e+`].style must be object`)),t.position&&(!Array.isArray(t.position)||t.position.length<2||!i(t.position[0])||!i(t.position[1]))&&n(`slot[`+e+`].position invalid`)}return t}\n/**\n* @license\n* Copyright (c) 2026 Xue Studios LLC\n* SPDX-License-Identifier: Apache-2.0\n*/\nself.onmessage=async function(e){let{id:t,blob:n,origin:r,keysUrl:o}=e.data;v(o);try{let e=await i(n);if(!e.metadata){self.postMessage({id:t,success:!0,metadata:{slots:[]},isSigValid:!1,security:`no_metadata`});return}let o=H(e.metadata);if(o.length>0)throw Error(`Corrupted or tampered OIM file: `+o[0]);let s=!!(e.metadata.signature&&e.metadata.key_version),c=await R(e.metadata,r),l=z({isSigned:s,isSigValid:c,keyExpired:s&&c?await B(e.metadata):!1,metadata:e.metadata,imageHash:e.imageHash});if(V(l)){self.postMessage({id:t,success:!1,refused:!0,security:l,error:`OIM_ALTERED: `+l});return}c?l===`unsigned`||l===`expired_key`?e.metadata={slots:[],elements:[],layers:[]}:m(e.metadata)||a(e.metadata):e.metadata={slots:[]},self.postMessage({id:t,success:!0,metadata:e.metadata,isSigValid:c,security:l})}catch(e){self.postMessage({id:t,success:!1,error:e.message||String(e)})}};",$e=typeof self<`u`&&self.Blob&&new Blob([`URL.revokeObjectURL(import.meta.url);`,Qe],{type:`text/javascript;charset=utf-8`});function et(e){let t;try{if(t=$e&&(self.URL||self.webkitURL).createObjectURL($e),!t)throw``;let n=new Worker(t,{type:`module`,name:e?.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(Qe),{type:`module`,name:e?.name})}}var tt=[{kid:`v1`,jwk:{kty:`EC`,crv:`P-256`,x:`5Qavr4M_npVognquI5k5D9K8wcXBXM9Z0mZHjqyehAs`,y:`oh7rz5Q7SlZT_ms2buyOw0bPX77QsXimc0X92Ymj2_o`}},{kid:`v2`,jwk:{kty:`EC`,crv:`P-256`,x:`pRSLtFHe9p8sR8jyqP5eoaBGbHdJgjjrdClda2lNp4A`,y:`oopYYhgja8m2iAlSMPigeWw-F72KJLNCRFQzlyWdt2I`}}],nt=`https://api.oim.media/v1/media/keys`;function J(e){for(let t=0;t<tt.length;t++)if(tt[t].kid===e)return tt[t];return null}function rt(){let e=globalThis.OIM_PLAYER_CONFIG;return(e&&typeof e.keysUrl==`string`?e.keysUrl:``)||nt}function it(e,t){let n=J(e)?.not_after,r=t&&typeof t.not_after==`string`?t.not_after:void 0;return n?r&&Date.parse(r)<Date.parse(n)?r:n:r}function at(e,t){if(!e.not_after||!t)return!0;let n=Date.parse(t),r=Date.parse(e.not_after);return isNaN(n)||isNaN(r)?!0:n<=r}var ot=6048e5;function st(e,t,n=Date.now()){let r=J(e)?.verify_until,i=t&&typeof t.verify_until==`string`?t.verify_until:void 0;if(!J(e)&&!t)return!0;let a=[r,i].filter(e=>!!e&&!isNaN(Date.parse(e)));return a.length!==0&&n>Math.min(...a.map(e=>Date.parse(e)))+ot}var ct=class extends Error{reason;constructor(e){super(`Web Worker unavailable`),this.reason=e,this.name=`WorkerUnavailableError`}};function lt(e){let t=null,n=null,r=1,i=new Map;function a(e){let t=[...i.values()];i.clear(),t.forEach(t=>t.reject(e))}function o(){if(t)return t;let n=e();return n.onmessage=e=>{let t=e.data,n=t&&typeof t.id==`number`?i.get(t.id):void 0;n&&(i.delete(t.id),n.resolve(t))},n.onerror=e=>{try{n.terminate()}catch{}t===n&&(t=null),a(e)},t=n,n}return{verify(e,t,a){if(n)return Promise.reject(new ct(n));let s;try{s=o()}catch(e){return n=e||!0,Promise.reject(new ct(e))}let c=r++;return new Promise((n,r)=>{i.set(c,{resolve:n,reject:r}),s.postMessage({id:c,blob:e,hostname:t,origin:a,keysUrl:rt()})})},stats(){return{alive:t!==null,pending:i.size}}}}var ut=null;function dt(e,t,n){return ut||=lt(()=>new et),ut.verify(e,t,n)}var ft=10485760;async function pt(e,t=ft){let n=e.replace(/\s+/g,``);try{let e=atob(n);if(e.trim().startsWith(`{`)){if(e.length>t)throw Error(`Metadata exceeds the limit of ${t/1048576}MB (zip bomb detected)`);return JSON.parse(e)}}catch(e){if(e.message&&e.message.includes(`zip bomb detected`))throw e}let r=atob(n),i=new Uint8Array(r.length);for(let e=0;e<r.length;e++)i[e]=r.charCodeAt(e);try{return JSON.parse(await Y(i,`deflate`,t))}catch(e){if(e.message&&e.message.includes(`zip bomb detected`))throw e;try{return JSON.parse(await Y(i,`deflate-raw`,t))}catch(t){throw t.message&&t.message.includes(`zip bomb detected`)||console.error(`[OIM Core] Decompression failed for both deflate and deflate-raw:`,e,t),t}}}async function Y(e,t,n=ft){let r=new DecompressionStream(t),i=r.writable.getWriter();i.write(e).catch(function(){}),i.close().catch(function(){});let a=r.readable.getReader(),o=[],s=0;try{for(;;){let{done:e,value:t}=await a.read();if(e)break;if(t){if(s+=t.byteLength,s>n)throw await a.cancel(),Error(`Decompressed metadata exceeds the limit of ${n/1048576}MB (zip bomb detected)`);o.push(t)}}}finally{a.releaseLock()}let c=new Uint8Array(s),l=0;for(let e of o)c.set(e,l),l+=e.byteLength;return new TextDecoder().decode(c)}async function mt(e){let t=new DataView(e),n=[],r=0;for(let i=8;i+8<=e.byteLength;){let a=t.getUint32(i,!1);String.fromCharCode(t.getUint8(i+4),t.getUint8(i+5),t.getUint8(i+6),t.getUint8(i+7))===`IDAT`&&(n.push(new Uint8Array(e,i+8,a)),r+=a),i+=12+a}if(n.length===0)return null;let i=new Uint8Array(r),a=0;for(let e of n)i.set(e,a),a+=e.length;let o=await crypto.subtle.digest(`SHA-256`,i);return Array.from(new Uint8Array(o),e=>e.toString(16).padStart(2,`0`)).join(``)}async function ht(e){let t=await e.arrayBuffer(),n=new DataView(t),r=8,i=null,a=null,o=[new Uint8Array(t,0,8)];for(;r<t.byteLength;){let e=n.getUint32(r,!1),s=r+4,c=String.fromCharCode(n.getUint8(s),n.getUint8(s+1),n.getUint8(s+2),n.getUint8(s+3)),l=8+e+4;if(c===`tEXt`){let n=new Uint8Array(t,s+4,e),o=n.indexOf(0);if(o!==-1){let e=new TextDecoder().decode(n.slice(0,o));if(e===`OIM_Data`||e===`OIM_JSON_DATA`){let e=n.slice(o+1),t=null;try{t=await Y(e,`deflate`)}catch{try{t=await Y(e,`deflate-raw`)}catch{}}if(t&&t.trim().startsWith(`{`))try{a=JSON.parse(t)}catch{}else i=new TextDecoder(`latin1`).decode(e);r+=l;continue}}}else if(c===`zTXt`){let n=new Uint8Array(t,s+4,e),a=n.indexOf(0);if(a!==-1){let e=new TextDecoder().decode(n.slice(0,a));if(e===`OIM_Data`||e===`OIM_JSON_DATA`){let e=n[a+1],t=n.slice(a+2);if(e===0)try{i=await Y(t,`deflate`)}catch(e){try{i=await Y(t,`deflate-raw`)}catch(t){console.error(`[OimPlayer] Failed to decompress zTXt chunk:`,e,t)}}if(i){r+=l;continue}}}}else if(c===`iTXt`){let n=new Uint8Array(t,s+4,e),a=n.indexOf(0);if(a!==-1){let e=new TextDecoder().decode(n.slice(0,a));if(e===`OIM_Data`||e===`OIM_JSON_DATA`){let e=n[a+1],t=n[a+2],o=n.slice(a+3),s=o.indexOf(0);if(s!==-1){let n=o.slice(s+1),a=n.indexOf(0);if(a!==-1){let o=n.slice(a+1);if(e===1){if(t===0)try{i=await Y(o,`deflate`)}catch(e){try{i=await Y(o,`deflate-raw`)}catch(t){console.error(`[OimPlayer] Failed to decompress iTXt chunk:`,e,t)}}}else i=new TextDecoder().decode(o);if(i){r+=l;continue}}}}}}o.push(new Uint8Array(t,r,l)),r+=l}let s=new Blob(o,{type:`image/png`}),c=null;return a?c=a:i&&(c=i.trimStart().startsWith(`{`)?JSON.parse(i):await pt(i)),{image:s,metadata:c,imageHash:await mt(t)}}var gt=2**53-1;function _t(e){return typeof e==`number`?!Number.isFinite(e)||Math.abs(e)>gt:typeof e==`object`&&e?Object.values(e).some(_t):!1}var vt=new Set([`signature`,`key_version`,`timestamp`,`creator_user_id`]);function yt(e){if(Array.isArray(e))return e.map(yt);if(typeof e==`object`&&e){let t={};for(let n of Object.keys(e))t[n]=yt(e[n]);return t}return typeof e==`number`&&Number.isFinite(e)&&!Number.isInteger(e)?Number(e.toFixed(6)):e}function bt(e){if(Array.isArray(e))return e.map(bt);if(typeof e==`object`&&e){let t={},n=Object.keys(e).sort((e,t)=>{let n=[...e],r=[...t],i=Math.min(n.length,r.length);for(let e=0;e<i;e++){let t=(n[e].codePointAt(0)??0)-(r[e].codePointAt(0)??0);if(t!==0)return t}return n.length-r.length});for(let r of n)t[r]=bt(e[r]);return t}return e}function xt(e){if(!e||typeof e!=`object`)return new TextEncoder().encode(`{}`);let t={};for(let n of Object.keys(e))vt.has(n)||(t[n]=e[n]);let n=bt(yt(t)),r=JSON.stringify(n);return new TextEncoder().encode(r)}function St(e,t){let n=e||``,r=``;for(let e=0;e<n.length;e++)n.charCodeAt(e)>=32&&(r+=n.charAt(e));return r=r.trim(),r.charAt(0)===`#`?!0:t?!1:!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(r)||/^https?:/i.test(r)||/^data:image\//i.test(r)}function Ct(e){if(typeof DOMParser>`u`)return e;try{let t=new DOMParser().parseFromString(e,`text/html`),n=`svg.g.defs.symbol.use.title.desc.path.circle.rect.polygon.polyline.ellipse.line.lineargradient.radialgradient.stop.pattern.image.clippath.mask.filter.fegaussianblur.fecolormatrix.fecomponenttransfer.fefunca.fefuncr.fefuncg.fefuncb.feblend.feoffset.femerge.femergenode.feflood.fecomposite.text.tspan.span.div.br.p.a.b.i.strong.em.img`.split(`.`),r=`class.style.id.lang.aria-hidden.part.transform.d.cx.cy.r.rx.ry.x.y.dx.dy.x1.y1.x2.y2.fx.fy.width.height.points.viewbox.preserveaspectratio.vector-effect.fill.stroke.fill-rule.clip-rule.opacity.fill-opacity.stroke-opacity.stroke-width.stroke-linecap.stroke-linejoin.stroke-dasharray.stroke-dashoffset.stroke-miterlimit.offset.stop-color.stop-opacity.gradientunits.gradienttransform.spreadmethod.patternunits.patterncontentunits.patterntransform.clip-path.clippathunits.mask.maskunits.maskcontentunits.filter.filterunits.primitiveunits.stddeviation.result.in.in2.mode.type.values.tablevalues.flood-color.flood-opacity.operator.font-family.font-size.font-weight.font-style.text-anchor.dominant-baseline.letter-spacing.word-spacing.href.src.target.rel.alt.data-slot-id.allow-lottie.show-controls.crossorigin`.split(`.`),i=t.body.querySelectorAll(`*`);for(let e=0;e<i.length;e++){let t=i[e],a=t.tagName.toLowerCase();if(n.indexOf(a)===-1){t.parentNode?.removeChild(t);continue}let o=t.attributes;for(let e=o.length-1;e>=0;e--){let n=o[e],i=n.name.toLowerCase();if(i.indexOf(`on`)===0||r.indexOf(i)===-1)t.removeAttribute(n.name);else{if(i===`href`&&!St(n.value,a===`use`||a===`image`)&&t.removeAttribute(n.name),i===`style`){let e=Tt(n.value);e!==n.value&&t.setAttribute(n.name,e)}else if(i!==`href`&&i!==`src`&&Et(n.value)){t.removeAttribute(n.name);continue}i===`src`&&(Dt(n.value.trim())||t.removeAttribute(n.name))}}}return t.body.innerHTML}catch(e){return console.warn(`[OimPlayer] HTML sanitization failed:`,e),``}}function wt(e){let t=(e||``).trim().toLowerCase();return t.indexOf(`data:image/`)===0||t.indexOf(`blob:`)===0}function Tt(e){return typeof e==`string`?e.indexOf(`\\`)!==-1||/@import|image-set\s*\(/i.test(e)?``:e.indexOf(`(`)===-1?e:e.replace(/url\(\s*(['"]?)(.*?)\1\s*\)/gi,function(e,t,n){let r=String(n).trim().toLowerCase();return r.indexOf(`#`)===0||r.indexOf(`data:`)===0?e:`none`}):e}function Et(e){let t=typeof e==`string`?e:``;if(t.indexOf(`\\`)!==-1||/image-set\s*\(|@import/i.test(t))return!0;let n=/url\(\s*['"]?\s*([^'")\s]*)/gi,r;for(;(r=n.exec(t))!==null;){let e=r[1].trim().toLowerCase();if(e.indexOf(`#`)!==0&&e.indexOf(`data:`)!==0)return!0}return!1}function Dt(e){let t=(e||``).trim();if(t.indexOf(`data:image/`)!==0)return!1;let n=t.indexOf(`,`);if(n===-1)return!1;let r=t.substring(0,n).toLowerCase();if(r.indexOf(`;base64`)===-1)return!1;let i=r.substring(5,r.indexOf(`;`));return[`image/png`,`image/jpeg`,`image/jpg`,`image/webp`,`image/gif`].indexOf(i)!==-1}function Ot(e){return!e||typeof e!=`string`?`Inter, sans-serif`:e.replace(/[^a-zA-Z0-9 ,\-\.'\'"]/g,``).trim().slice(0,128)||`Inter, sans-serif`}var kt={},At=null,jt=!1,Mt=null;function Nt(){return new Promise(e=>{if(typeof indexedDB>`u`)return e([]);try{let t=indexedDB.open(`oim-player-keys`,1);t.onupgradeneeded=e=>{let t=e.target.result;t.objectStoreNames.contains(`keys`)||t.createObjectStore(`keys`,{keyPath:`kid`})},t.onsuccess=t=>{let n=t.target.result;if(!n.objectStoreNames.contains(`keys`)){e([]),n.close();return}let r=n.transaction(`keys`,`readonly`).objectStore(`keys`).getAll();r.onsuccess=()=>{e(r.result||[]),n.close()},r.onerror=()=>{e([]),n.close()}},t.onerror=()=>{e([])}}catch{e([])}})}function Pt(e){return new Promise(t=>{if(typeof indexedDB>`u`)return t();try{let n=indexedDB.open(`oim-player-keys`,1);n.onupgradeneeded=e=>{let t=e.target.result;t.objectStoreNames.contains(`keys`)||t.createObjectStore(`keys`,{keyPath:`kid`})},n.onsuccess=n=>{let r=n.target.result;if(!r.objectStoreNames.contains(`keys`)){t(),r.close();return}let i=r.transaction(`keys`,`readwrite`),a=i.objectStore(`keys`);e.forEach(e=>{a.put(e)}),i.oncomplete=()=>{t(),r.close()},i.onerror=()=>{t(),r.close()}},n.onerror=()=>{t()}}catch{t()}})}async function Ft(e){let t=J(e);return t?t.jwk:(kt[e]||!jt&&(Mt||=Nt().then(e=>{e.forEach(e=>{kt[e.kid]=e}),jt=!0}),await Mt,kt[e])||await It(),kt[e])}function It(){return At||=(async function(){try{let e=rt(),t=await fetch(e).catch(()=>null),n=null;if(t&&t.ok&&(t.headers.get(`content-type`)||``).indexOf(`application/json`)!==-1)try{n=await t.json()}catch{}if(n&&Array.isArray(n.keys)){for(let e=0;e<n.keys.length;e++){let t=n.keys[e];kt[t.kid]=t}await Pt(n.keys)}}catch(e){console.warn(`[OimPlayer::Security] Failed to fetch public keys from server:`,e)}})(),At}async function Lt(e){return await It(),kt[e]||null}async function Rt(e,t){if(!e||typeof e!=`object`)return!1;if(!e.signature||!e.key_version)return console.warn(`[OimPlayer::Security] Metadata is not signed. Skipping signature verification (Legacy mode).`),!0;try{let t=await Ft(e.key_version);if(!t)return console.error(`[OimPlayer::Security] Public key not found for version:`,e.key_version),!1;if(_t(e))return!1;let r=xt(e),i=atob(e.signature),a=new Uint8Array(i.length);for(let e=0;e<i.length;e++)a[e]=i.charCodeAt(e);let o=async(e,t)=>{let n=await crypto.subtle.importKey(`jwk`,e,{name:`ECDSA`,namedCurve:`P-256`},!0,[`verify`]);return crypto.subtle.verify({name:`ECDSA`,hash:{name:`SHA-256`}},n,a,t)},s=await o(t,r);if(!s&&e.creator_user_id){let r={},i=Object.keys(e).filter(function(e){return e!==`signature`&&e!==`key_version`&&e!==`timestamp`}).sort();function n(e){if(Array.isArray(e))return e.map(n);if(typeof e==`object`&&e){let t={},r=Object.keys(e).sort();for(let i=0;i<r.length;i++)t[r[i]]=n(e[r[i]]);return t}return e}for(let t=0;t<i.length;t++)r[i[t]]=n(e[i[t]]);s=await o(t,new TextEncoder().encode(JSON.stringify(r)))}if(!s)try{let n=await Lt(e.key_version);n&&(n.x!==t.x||n.y!==t.y)&&(console.warn(`[OimPlayer::Security] Pinned key failed; retrying with the key published by the server for kid:`,e.key_version),s=await o(n,r))}catch{}if(s){let n=it(e.key_version,t);if(!at({kid:e.key_version,jwk:t,not_after:n},e.signed_at))return console.error(`[OimPlayer::Security] Signature made after this key was retired.`),!1}return s||console.error(`[OimPlayer::Security] Cryptographic signature VERIFICATION FAILED. Metadata was tampered with!`),s}catch(e){return console.error(`[OimPlayer::Security] Error verifying signature:`,e),!1}}function zt(e){if(!e.isSigned)return`unsigned`;if(!e.isSigValid)return`invalid_signature`;if(e.keyExpired)return`expired_key`;let t=e.metadata||{},n=t.image_hash_alg===`sha256-idat`&&typeof t.image_hash==`string`?t.image_hash:``;return n?!e.imageHash||n.toLowerCase()!==e.imageHash.toLowerCase()?`image_mismatch`:ge(he(e.metadata)):`image_unsealed`}async function Bt(e,t=Date.now()){let n=e&&e.key_version;return n?J(n)?st(n,null,t):st(n,await Lt(n),t):!1}function Vt(e){return e===`image_mismatch`||e===`invalid_signature`}var Ht=`OIM_ALTERED`;function Ut(e){let t=[];function n(e){t.push(e)}function r(e,t){return typeof e==`string`&&e.length<=(t||1e7)}function i(e){return typeof e==`number`&&isFinite(e)}if(typeof e!=`object`||!e)return n(`metadata must be object`),t;let a=e.slots||e.elements||[];if(!Array.isArray(a))return n(`slots must be array`),t;a.length>150&&n(`max 150 slots`);for(let e=0;e<a.length;e++){let t=a[e];if(typeof t!=`object`||!t){n(`slot[`+e+`] must be object`);continue}t.id!==void 0&&t.id!==null&&(typeof t.id!=`string`||t.id.length>128)&&n(`slot[`+e+`].id invalid`);let o=t.content;if(o!==void 0){if(typeof o!=`object`||!o)n(`slot[`+e+`].content must be object`);else{let t=Object.keys(o);for(let i=0;i<t.length;i++){let a=o[t[i]];if(typeof a==`string`)a.length>1e7&&n(`slot[`+e+`].content.`+t[i]+` too long`);else if(typeof a==`object`&&a&&!Array.isArray(a)){let o=Object.keys(a);for(let s=0;s<o.length;s++)r(a[o[s]])||n(`slot[`+e+`].content.`+t[i]+`.`+o[s]+` invalid`)}}}}t.style&&(typeof t.style==`object`?t.style.fillColor&&(typeof t.style.fillColor!=`string`||t.style.fillColor.length>64)&&n(`slot[`+e+`].style.fillColor invalid`):n(`slot[`+e+`].style must be object`)),t.position&&(!Array.isArray(t.position)||t.position.length<2||!i(t.position[0])||!i(t.position[1]))&&n(`slot[`+e+`].position invalid`)}return t}var Wt=Math.log(1.05)/100,Gt=.01,Kt=16,qt=800;function Jt(e,t,n,r){let i=n===1?t*Kt:n===2?t*qt:t,a=e*Math.exp(-i*(r?Gt:Wt));return Math.max(1,Math.min(4,a))}var Yt=`1.29.0`,Xt=[`vector_parallax`,`infinite_parallax`,`text_marks`,`image_fill`,`media_filters`,`frame_shapes`];function Zt(e){if(typeof e!=`string`)return null;let t=/^(\d+)\.(\d+)\.(\d+)$/.exec(e.trim());return t?[Number(t[1]),Number(t[2]),Number(t[3])]:null}function Qt(e,t){let n=Zt(e),r=Zt(t);if(!n||!r)return!1;for(let e=0;e<3;e++){if(n[e]>r[e])return!0;if(n[e]<r[e])return!1}return!1}function $t(e,t){let n=e&&typeof e.min_player==`string`?e.min_player:null,r=(Array.isArray(e?.capabilities)?e.capabilities:[]).filter(e=>typeof e==`string`&&e!==``).filter(e=>!t.capabilities.includes(e)).filter((e,t,n)=>n.indexOf(e)===t).sort(),i=(Array.isArray(e?.capabilities_required)?e.capabilities_required:[]).filter(e=>typeof e==`string`&&e!==``).filter(e=>!t.capabilities.includes(e)).filter((e,t,n)=>n.indexOf(e)===t).sort(),a=Qt(n,t.version),o=a||i.length>0,s=a||r.length>0||i.length>0;return{requiredVersion:n,versionTooOld:a,missingCapabilities:r,missingRequiredCapabilities:i,cannotRender:o,hasNotice:s,hayAlgoQueDecir:s}}function en(e){let t=[];return e.versionTooOld&&t.push(`the file requires format version ${e.requiredVersion}`),e.missingRequiredCapabilities&&e.missingRequiredCapabilities.length>0&&t.push(`requires ${e.missingRequiredCapabilities.join(`, `)}`),e.missingCapabilities&&e.missingCapabilities.length>0&&t.push(`uses ${e.missingCapabilities.join(`, `)}`),t.length===0?``:`${e.missingRequiredCapabilities&&e.missingRequiredCapabilities.length>0?`It cannot be fully rendered`:`Rendered what was possible`}: ${t.join(` and `)}.`}var tn=/^oim-[0-9a-f]{8}-[A-Za-z0-9 ]{1,64}$/,nn=546136,rn={woff:`wOFF`,woff2:`wOF2`};function an(e,t){try{return atob(e.slice(0,8)).startsWith(rn[t])}catch{return!1}}function on(e){let t=e&&Array.isArray(e.fonts)?e.fonts:[],n=[];for(let e of t)e&&typeof e==`object`&&(e.format!==`woff`&&e.format!==`woff2`||typeof e.family!=`string`||typeof e.data!=`string`||typeof e.name!=`string`||!tn.test(e.name)||e.style!==`normal`&&e.style!==`italic`||typeof e.weight!=`number`||e.weight<100||e.weight>900||e.data.length>nn||!an(e.data,e.format)||n.push({family:e.family,name:e.name,weight:e.weight,style:e.style,format:e.format,data:e.data}));return n}async function sn(e,t=document.fonts,n=(e,t,n)=>new FontFace(e,t,n)){let r=new Map;return await Promise.all(e.map(async e=>{try{let i=n(e.name,`url(data:font/${e.format};base64,${e.data})`,{weight:String(e.weight),style:e.style});await i.load(),t.add(i),r.set(e.family,e.name)}catch{}})),r}function cn(e,t){let n=t.get(e);return n?`'${n}', '${e}', sans-serif`:null}var ln=/^\{(\/?)([a-z][a-z0-9-]{0,23})\}/;function un(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(r===`{`||r===`}`){if(e[n+1]===r){t.push({kind:`text`,s:r}),n+=2;continue}if(r===`{`){let r=ln.exec(e.slice(n));if(r){t.push({kind:r[1]?`close`:`open`,name:r[2],raw:r[0],at:n}),n+=r[0].length;continue}}t.push({kind:`stray`,raw:r,at:n}),n+=1;continue}let i=n;for(;i<e.length&&e[i]!==`{`&&e[i]!==`}`;)i++;t.push({kind:`text`,s:e.slice(n,i)}),n=i}return t}function dn(e,t){let n=[],r=[],i,a=null,o=(e,t)=>{i||={reason:e,at:t}},s=e=>{if(!e)return;let t=n[n.length-1];t&&t.mark===(a??void 0)?t.text+=e:n.push(a?{text:e,mark:a}:{text:e})};for(let n of un(e))n.kind===`text`?s(n.s):n.kind===`stray`?(o(`stray brace`,n.at),s(n.raw)):t.includes(n.name)?n.kind===`open`?a?(o(`"${n.name}" inside "${a}"`,n.at),s(n.raw)):(a=n.name,r.push(n.name)):a===n.name?a=null:(o(`"${n.name}" closed without being open`,n.at),s(n.raw)):(o(`unknown mark "${n.name}"`,n.at),s(n.raw));return a&&o(`"${a}" is not closed`,e.length),{runs:n,sequence:r,error:i}}function fn(e,t){return dn(e,t).runs}function pn(e){return e.replace(/[{}]/g,e=>e+e)}function mn(e,t){return fn(e,t).map(e=>e.text).join(``)}function hn(e,t){let n=``,r=[];for(let i of fn(e,t))i.mark&&r.push({from:n.length,to:n.length+i.text.length,mark:i.mark}),n+=i.text;return{plain:n,ranges:r}}function gn(e,t){let n=``,r=0;for(let i of[...t].sort((e,t)=>e.from-t.from)){let t=Math.max(i.from,r),a=Math.min(i.to,e.length);a<=t||(n+=pn(e.slice(r,t))+`{${i.mark}}`+pn(e.slice(t,a))+`{/${i.mark}}`,r=a)}return n+pn(e.slice(r))}function _n(e){let t={underline:e.underline===!0},n=P(e.colorRole,e.color);if(n&&(t.color=n),e.bold&&(t.fontWeight=700),e.italic&&(t.fontStyle=`italic`),e.highlight){let n=e.highlight;t.highlight={style:n.style??`marker`,color:P(n.colorRole,n.color)||`rgba(245, 158, 11, 0.35)`,paddingX:n.paddingX??4,paddingY:n.paddingY??2,borderRadius:n.borderRadius??3}}return t}function vn(e,t){return mn(e,Object.keys(t??{}))}function yn(e,t,n){e.textContent=``;for(let r of fn(t,Object.keys(n??{}))){let t=r.mark?n?.[r.mark]:void 0;if(!r.mark||!t){e.appendChild(document.createTextNode(r.text));continue}let i=document.createElement(`span`);i.dataset.mark=r.mark,i.textContent=r.text;let a=_n(t),o=i.style;a.color&&(o.color=a.color),a.fontWeight&&(o.fontWeight=String(a.fontWeight)),a.fontStyle&&(o.fontStyle=a.fontStyle),a.underline&&(o.textDecoration=`underline`);let s=a.highlight;s&&(s.style===`underline-thick`?o.boxShadow=`inset 0 -.4em 0 ${s.color}`:o.backgroundColor=s.color,o.borderRadius=s.style===`pill`?`9999px`:s.style===`box`?`0`:`${s.borderRadius}px`,o.padding=`${s.paddingY}px ${s.paddingX}px`,o.boxDecorationBreak=`clone`,o.webkitBoxDecorationBreak=`clone`),e.appendChild(i)}}function bn(e){let t={scale:e.lines===3?3.2:2.2,lineHeight:.85,marginRight:e.marginRight??8,fontWeight:700};return e.color&&(t.color=e.color),e.fontFamily&&(t.fontFamily=e.fontFamily),t}function xn(e,t){let{plain:n,ranges:r}=hn(e,t);if(!n)return{letter:``,rest:``};let i=r.map(e=>({...e,from:Math.max(0,e.from-1),to:e.to-1}));return{letter:n[0],rest:gn(n.slice(1),i)}}var Sn=/^(data:image\/|blob:|https:\/\/)[^"'\\\n\r()]*$/;function Cn(e){if(e.svg&&/<svg[\s>]/i.test(e.svg))return{image:`url("data:image/svg+xml;charset=utf-8,${encodeURIComponent(e.svg)}")`,size:`100% 100%`};if(e.type===`image`&&e.image&&Sn.test(e.image)){let t=e.fit===`contain`?`contain`:e.fit===`fill`?`100% 100%`:`cover`;return{image:`url("${e.image}")`,size:t}}return null}var wn=[`fade-chars`,`slide-up`,`bounce-chars`,`reveal-mask`,`scale-in`,`rise-words`],Tn=.35,En=.05,Dn=[`slide-up`,`reveal-mask`,`rise-words`];function On(e){return typeof e==`string`&&wn.includes(e)}function kn(e){return e===`reveal-mask`}function An(e,t){return Dn.includes(t)?e.match(/\S+|\s+/g)??[]:Array.from(e)}function jn(e,t=En,n=0){return n+e*t}function Mn(e,t){let n=Math.max(0,Math.min(1,t)),r=n*(2-n);if(e===`slide-up`)return{opacity:r,translateYEm:(1-r)*.6,scale:1,rotateDeg:0};if(e===`reveal-mask`)return{opacity:1,translateYEm:(1-r)*1.2,scale:1,rotateDeg:0};if(e===`scale-in`)return{opacity:r,translateYEm:0,scale:.6+.4*r,rotateDeg:0};if(e===`rise-words`)return{opacity:r,translateYEm:(1-r)*.8,scale:1,rotateDeg:(1-r)*8};if(e===`bounce-chars`){let e=r===0?0:r<.7?r/.7*1.15:1.15-(r-.7)/.3*.15;return{opacity:r,translateYEm:0,scale:Math.round(e*1e6)/1e6,rotateDeg:0}}return{opacity:r,translateYEm:0,scale:1,rotateDeg:0}}function Nn(e,t=10){return Array.from({length:t+1},(n,r)=>Mn(e,r/t))}function Pn(){return Promise.resolve().then(()=>(H(),L)).then(e=>{let t=e.default||e;return t&&t.__oimExternal?t.load():t})}var Fn={triangle:{kind:`polygon`,points:[[50,5],[95,90],[5,90]]},star:{kind:`polygon`,points:[[50,2],[62,38],[100,38],[69,59],[80,95],[50,73],[20,95],[31,59],[0,38],[38,38]]},arrow:{kind:`polygon`,points:[[5,40],[60,40],[60,20],[95,50],[60,80],[60,60],[5,60]]},diamond:{kind:`polygon`,points:[[50,5],[95,50],[50,95],[5,50]]},hexagon:{kind:`polygon`,points:[[25,5],[75,5],[95,50],[75,95],[25,95],[5,50]]},circle:{kind:`path`,d:`M 50,5 A 45,45 0 1,1 49.999,5 Z`,fillable:!0},heart:{kind:`path`,d:`M 50,88 C 10,60 -5,30 15,12 C 30,-2 50,5 50,25 C 50,5 70,-2 85,12 C 105,30 90,60 50,88 Z`,fillable:!0},line:{kind:`path`,d:`M 5,50 L 95,50`,fillable:!1},blob:{kind:`path`,d:`M 50,10 C 75,10 92,25 90,50 C 88,75 75,90 50,90 C 25,90 10,75 10,50 C 10,25 25,10 50,10 Z`,fillable:!0},scribble:{kind:`path`,d:`M 5,80 Q 25,65 50,75 T 95,70 Q 75,85 50,82 T 5,88`,fillable:!1},pill:{kind:`path`,d:`M 30,25 L 70,25 C 83.8,25 95,36.2 95,50 C 95,63.8 83.8,75 70,75 L 30,75 C 16.2,75 5,63.8 5,50 C 5,36.2 16.2,25 30,25 Z`,fillable:!0},octagon:{kind:`polygon`,points:[[30,5],[70,5],[95,30],[95,70],[70,95],[30,95],[5,70],[5,30]]},pentagon:{kind:`polygon`,points:[[50,5],[94.7,37.5],[77.6,90],[22.4,90],[5.3,37.5]]},cross:{kind:`polygon`,points:[[35,5],[65,5],[65,35],[95,35],[95,65],[65,65],[65,95],[35,95],[35,65],[5,65],[5,35],[35,35]]},moon:{kind:`path`,d:`M 50,5 C 25.15,5 5,25.15 5,50 C 5,74.85 25.15,95 50,95 C 30,80 30,20 50,5 Z`,fillable:!0},cloud:{kind:`path`,d:`M 25,85 C 8,85 5,62 22,58 C 14,40 35,32 45,42 C 48,22 75,20 78,42 C 96,40 97,66 80,68 C 80,78 78,85 68,85 Z`,fillable:!0},drop:{kind:`path`,d:`M 50,5 C 62,25 80,45 80,65 C 80,81.5 66.5,95 50,95 C 33.5,95 20,81.5 20,65 C 20,45 38,25 50,5 Z`,fillable:!0},bolt:{kind:`polygon`,points:[[62,5],[18,58],[46,58],[34,95],[82,40],[55,40],[72,5]]},bubble:{kind:`path`,d:`M 20,5 L 80,5 C 88.3,5 95,11.7 95,20 L 95,57 C 95,65.3 88.3,72 80,72 L 42,72 L 22,93 L 28,72 L 20,72 C 11.7,72 5,65.3 5,57 L 5,20 C 5,11.7 11.7,5 20,5 Z`,fillable:!0},flower:{kind:`path`,d:`M 65.6,41.0 C 85.5,35.7 97.5,39.9 95.0,50.0 C 97.5,60.1 85.5,64.3 65.6,59.0 C 80.1,73.5 82.5,86.1 72.5,89.0 C 65.0,96.2 55.3,87.9 50.0,68.0 C 44.7,87.9 35.0,96.2 27.5,89.0 C 17.5,86.1 19.9,73.5 34.4,59.0 C 14.5,64.3 2.5,60.1 5.0,50.0 C 2.5,39.9 14.5,35.7 34.4,41.0 C 19.9,26.5 17.5,13.9 27.5,11.0 C 35.0,3.8 44.7,12.1 50.0,32.0 C 55.3,12.1 65.0,3.8 72.5,11.0 C 82.5,13.9 80.1,26.5 65.6,41.0 Z`,fillable:!0},burst:{kind:`polygon`,points:[[95,50],[82.8,58.8],[89,72.5],[74,74],[72.5,89],[58.8,82.8],[50,95],[41.2,82.8],[27.5,89],[26,74],[11,72.5],[17.2,58.8],[5,50],[17.2,41.2],[11,27.5],[26,26],[27.5,11],[41.2,17.2],[50,5],[58.8,17.2],[72.5,11],[74,26],[89,27.5],[82.8,41.2]]},arch:{kind:`path`,d:`M 5,95 L 5,50 C 5,25.15 25.15,5 50,5 C 74.85,5 95,25.15 95,50 L 95,95 Z`,fillable:!0}};[...Object.keys(Fn).filter(e=>e!==`line`&&e!==`scribble`)];function In(e){if(e&&e!==`rect`&&e!==`rectangle`)return Fn[e]}function Ln(e){return e.map(([e,t])=>`${e},${t}`).join(` `)}var Rn=/^[MmLlHhVvCcSsQqTtAaZz0-9eE.,\s+-]*$/,zn=/^-?\d+(\.\d+)?([\s,]+-?\d+(\.\d+)?){3}$/,Bn=`0 0 100 100`,Vn=e=>e&&e.length<=2e4&&Rn.test(e)?e:void 0,Hn=e=>e&&e.length<=64&&zn.test(e)?e:Bn;function Un(e){let t=In(e.geoShape),n=Vn(e.svgPath);return t?t.kind===`polygon`?{points:t.points.map(([e,t])=>`${e},${t}`).join(` `),viewBox:Bn}:{d:(e.geoShape===`blob`||e.geoShape===`scribble`)&&Vn(e.customBlobPath)||e.geoShape===`blob`&&n||t.d,viewBox:Bn}:n?{d:n,viewBox:Hn(e.svgViewBox)}:null}var Wn={silhouette:null,fillable:!0,round:!1};function Gn(e){if(!e||e.kind===`rect`)return Wn;if(e.kind===`line`||e.kind===`preset`||e.kind===`ellipse`){let t=e.kind===`line`?`line`:e.kind===`ellipse`?`circle`:e.name,n=In(t);return n?{silhouette:Un({geoShape:t}),fillable:n.kind===`polygon`||!!n.fillable,round:e.kind===`ellipse`,preset:t}:Wn}if(e.kind===`paths`&&e.paths.length===1&&!e.paths[0].fill&&!e.paths[0].stroke){let t=e.viewBox.join(` `),n=Un({svgPath:e.paths[0].d,svgViewBox:t});return n?{silhouette:n,fillable:!0,round:!1,path:{d:n.d,viewBox:n.viewBox}}:Wn}return Wn}var Kn=[{id:`stacked-waves`,layers:[{primitive:`layer-stack`,fixed:{interpolation:`wave`,boundary:`shared`}}],schema:[{key:`layers`,kind:`range`,group:`SHAPE`,label:{es:`Capas`,en:`Layers`},min:1,max:12,step:1,default:5},{key:`frequency`,kind:`range`,group:`SHAPE`,label:{es:`Frecuencia`,en:`Frequency`},min:2,max:12,step:1,default:4},{key:`amplitude`,kind:`range`,group:`SHAPE`,label:{es:`Amplitud`,en:`Amplitude`},min:0,max:1,step:.05,default:.5},{key:`balance`,kind:`range`,group:`SHAPE`,label:{es:`Balance`,en:`Balance`},min:0,max:1,step:.05,default:.5},{key:`anchor`,kind:`enum`,group:`DIRECTION`,label:{es:`Anclaje`,en:`Anchor`},options:[{value:`bottom`,label:{es:`Abajo`,en:`Bottom`}},{value:`top`,label:{es:`Arriba`,en:`Top`}},{value:`left`,label:{es:`Izquierda`,en:`Left`}},{value:`right`,label:{es:`Derecha`,en:`Right`}}],default:`bottom`}]},{id:`layered-waves`,layers:[{primitive:`layer-stack`,fixed:{interpolation:`wave`,boundary:`independent`}}],schema:[{key:`layers`,kind:`range`,group:`SHAPE`,label:{es:`Capas`,en:`Layers`},min:1,max:12,step:1,default:5},{key:`frequency`,kind:`range`,group:`SHAPE`,label:{es:`Frecuencia`,en:`Frequency`},min:2,max:12,step:1,default:4},{key:`amplitude`,kind:`range`,group:`SHAPE`,label:{es:`Amplitud`,en:`Amplitude`},min:0,max:1,step:.05,default:.5},{key:`anchor`,kind:`enum`,group:`DIRECTION`,label:{es:`Anclaje`,en:`Anchor`},options:[{value:`bottom`,label:{es:`Abajo`,en:`Bottom`}},{value:`top`,label:{es:`Arriba`,en:`Top`}}],default:`bottom`}]},{id:`stacked-peaks`,layers:[{primitive:`layer-stack`,fixed:{interpolation:`peak`,boundary:`shared`}}],schema:[{key:`layers`,kind:`range`,group:`SHAPE`,label:{es:`Capas`,en:`Layers`},min:1,max:12,step:1,default:5},{key:`frequency`,kind:`range`,group:`SHAPE`,label:{es:`Picos`,en:`Peaks`},min:2,max:12,step:1,default:4},{key:`amplitude`,kind:`range`,group:`SHAPE`,label:{es:`Altura`,en:`Height`},min:0,max:1,step:.05,default:.6}]},{id:`layered-peaks`,layers:[{primitive:`layer-stack`,fixed:{interpolation:`peak`,boundary:`independent`}}],schema:[{key:`layers`,kind:`range`,group:`SHAPE`,label:{es:`Capas`,en:`Layers`},min:1,max:12,step:1,default:5},{key:`frequency`,kind:`range`,group:`SHAPE`,label:{es:`Picos`,en:`Peaks`},min:2,max:12,step:1,default:4}]},{id:`stacked-steps`,layers:[{primitive:`layer-stack`,fixed:{interpolation:`step`,boundary:`shared`}}],schema:[{key:`layers`,kind:`range`,group:`SHAPE`,label:{es:`Capas`,en:`Layers`},min:1,max:12,step:1,default:5},{key:`frequency`,kind:`range`,group:`SHAPE`,label:{es:`Escalones`,en:`Steps`},min:2,max:12,step:1,default:5}]},{id:`layered-steps`,layers:[{primitive:`layer-stack`,fixed:{interpolation:`step`,boundary:`independent`}}],schema:[{key:`layers`,kind:`range`,group:`SHAPE`,label:{es:`Capas`,en:`Layers`},min:1,max:12,step:1,default:5}]},{id:`zigzag-chevron`,layers:[{primitive:`layer-stack`,fixed:{interpolation:`zigzag`,boundary:`independent`}}],schema:[{key:`layers`,kind:`range`,group:`SHAPE`,label:{es:`Franjas`,en:`Bands`},min:1,max:12,step:1,default:6}]},{id:`circle-scatter`,layers:[{primitive:`scatter`,fixed:{element:`circle`}}],schema:[{key:`count`,kind:`range`,group:`SHAPE`,label:{es:`Círculos`,en:`Circles`},min:1,max:40,step:1,default:3},{key:`sizeMin`,kind:`range`,group:`SHAPE`,label:{es:`Tamaño Mín`,en:`Min Size`},min:10,max:100,step:5,default:60},{key:`sizeMax`,kind:`range`,group:`SHAPE`,label:{es:`Tamaño Máx`,en:`Max Size`},min:60,max:300,step:10,default:180},{key:`minDistance`,kind:`range`,group:`SHAPE`,label:{es:`Distancia Mín`,en:`Min Distance`},min:0,max:100,step:5,default:40}]},{id:`rose-petals`,layers:[{primitive:`scatter`,fixed:{element:`petal`}}],schema:[{key:`count`,kind:`range`,group:`SHAPE`,label:{es:`Pétalos`,en:`Petals`},min:1,max:40,step:1,default:12},{key:`sizeMin`,kind:`range`,group:`SHAPE`,label:{es:`Tamaño Mín`,en:`Min Size`},min:10,max:100,step:5,default:30}]},{id:`blob-scene`,layers:[{primitive:`blob`,fixed:{}}],schema:[{key:`count`,kind:`range`,group:`SHAPE`,label:{es:`Blobs`,en:`Blobs`},min:1,max:6,step:1,default:2},{key:`points`,kind:`range`,group:`SHAPE`,label:{es:`Complejidad`,en:`Complexity`},min:5,max:14,step:1,default:8},{key:`irregularity`,kind:`range`,group:`SHAPE`,label:{es:`Deformación`,en:`Irregularity`},min:0,max:1,step:.05,default:.5},{key:`anchor`,kind:`enum`,group:`DIRECTION`,label:{es:`Anclaje`,en:`Anchor`},options:[{value:`center`,label:{es:`Centro`,en:`Center`}},{value:`corner-tl`,label:{es:`Esquina Sup-Izq`,en:`Top-Left`}},{value:`corner-tr`,label:{es:`Esquina Sup-Der`,en:`Top-Right`}},{value:`corner-bl`,label:{es:`Esquina Inf-Izq`,en:`Bottom-Left`}},{value:`corner-br`,label:{es:`Esquina Inf-Der`,en:`Bottom-Right`}}],default:`corner-tr`}]},{id:`low-poly-grid`,layers:[{primitive:`mesh`,fixed:{}}],schema:[{key:`resolution`,kind:`range`,group:`SHAPE`,label:{es:`Resolución`,en:`Resolution`},min:3,max:20,step:1,default:8},{key:`distortion`,kind:`range`,group:`SHAPE`,label:{es:`Distorsión`,en:`Distortion`},min:0,max:1,step:.05,default:.6},{key:`borderWidth`,kind:`range`,group:`SHAPE`,label:{es:`Borde`,en:`Border`},min:0,max:4,step:.5,default:.5}]},{id:`bullseye-gradient`,layers:[{primitive:`radial`,fixed:{kind:`rings`}}],schema:[{key:`count`,kind:`range`,group:`SHAPE`,label:{es:`Anillos`,en:`Rings`},min:3,max:48,step:1,default:16}]},{id:`wintery-sunburst`,layers:[{primitive:`radial`,fixed:{kind:`rays`}}],schema:[{key:`count`,kind:`range`,group:`SHAPE`,label:{es:`Rayos`,en:`Rays`},min:3,max:48,step:1,default:16}]},{id:`radiant-gradient`,layers:[{primitive:`gradient`,fixed:{kind:`radial`}}],schema:[{key:`softness`,kind:`range`,group:`SHAPE`,label:{es:`Suavidad`,en:`Softness`},min:0,max:1,step:.05,default:.8}]},{id:`blurry-gradient`,layers:[{primitive:`gradient`,fixed:{kind:`linear`}}],schema:[{key:`angle`,kind:`range`,group:`SHAPE`,label:{es:`Ángulo`,en:`Angle`},min:0,max:360,step:15,default:135}]},{id:`protruding-cubes`,layers:[{primitive:`iso-grid`,fixed:{hollow:!1}}],schema:[{key:`cols`,kind:`range`,group:`SHAPE`,label:{es:`Columnas`,en:`Columns`},min:4,max:20,step:1,default:8},{key:`extrude`,kind:`range`,group:`SHAPE`,label:{es:`Extrusión`,en:`Extrusion`},min:0,max:1,step:.05,default:.6}]},{id:`hollowed-boxes`,layers:[{primitive:`iso-grid`,fixed:{hollow:!0}}],schema:[{key:`cols`,kind:`range`,group:`SHAPE`,label:{es:`Columnas`,en:`Columns`},min:4,max:20,step:1,default:8}]},{id:`luz-difusa`,layers:[{primitive:`gradient`,fixed:{kind:`linear`}},{primitive:`radial`,fixed:{kind:`radial`},blend:`screen`,opacity:.8,blur:20}],grain:{intensity:.15},schema:[{key:`angle`,kind:`range`,group:`SHAPE`,label:{es:`Ángulo Base`,en:`Base Angle`},min:0,max:360,step:15,default:135},{key:`softness`,kind:`range`,group:`SHAPE`,label:{es:`Difusión`,en:`Diffusion`},min:.1,max:1,step:.05,default:.8}]},{id:`malla-suave`,layers:[{primitive:`mesh`,fixed:{borderWidth:0}},{primitive:`radial`,fixed:{kind:`radial`},blend:`soft-light`,opacity:.7}],schema:[{key:`resolution`,kind:`range`,group:`SHAPE`,label:{es:`Resolución Malla`,en:`Mesh Resolution`},min:3,max:12,step:1,default:6},{key:`distortion`,kind:`range`,group:`SHAPE`,label:{es:`Fluidez`,en:`Fluidity`},min:0,max:1,step:.05,default:.5},{key:`softness`,kind:`range`,group:`SHAPE`,label:{es:`Luz Radial`,en:`Radial Light`},min:.1,max:1,step:.05,default:.7}]},{id:`reticula`,layers:[{primitive:`gradient`,fixed:{kind:`linear`}},{primitive:`iso-grid`,fixed:{hollow:!0},blend:`screen`,opacity:.85}],grain:{intensity:.18},schema:[{key:`cols`,kind:`range`,group:`SHAPE`,label:{es:`Densidad Rejilla`,en:`Grid Density`},min:4,max:24,step:1,default:10},{key:`angle`,kind:`range`,group:`SHAPE`,label:{es:`Inclinación Luz`,en:`Light Angle`},min:0,max:360,step:15,default:120}]},{id:`polvo`,layers:[{primitive:`gradient`,fixed:{kind:`radial`}},{primitive:`scatter`,fixed:{element:`circle`},blend:`lighten`,opacity:.65}],grain:{intensity:.28},schema:[{key:`count`,kind:`range`,group:`VARIANTS`,label:{es:`Partículas`,en:`Particles`},min:10,max:80,step:5,default:35},{key:`sizeMin`,kind:`range`,group:`SHAPE`,label:{es:`Tamaño Mín`,en:`Min Size`},min:2,max:20,step:1,default:4},{key:`sizeMax`,kind:`range`,group:`SHAPE`,label:{es:`Tamaño Máx`,en:`Max Size`},min:10,max:50,step:2,default:20}]}];function qn(e){return Kn.find(t=>t.id===e)}var Jn=(e,t)=>{let n=e,r=Math.max(1,Math.min(12,Number(n.layers??5))),i=n.interpolation||`wave`,a=n.boundary||`shared`,o=Math.max(2,Math.min(12,Number(n.frequency??4))),s=Math.max(0,Math.min(1,Number(n.amplitude??.5))),c=Math.max(0,Math.min(1,Number(n.balance??.5))),l=n.anchor||`bottom`,u=t.width,d=t.height,f=t.bleed,p=l===`bottom`||l===`top`,m=p?d:u,h=p?u:d,g=m/(r+1),_=(c-.5)*h*.4,v=[];for(let e=0;e<r;e++){let n=(e+1)*g,r=[],i=h/o;for(let e=0;e<=o;e++){let a=e*i,c=(t.rng.next()-.5)*g*s*1.6,f=Math.max(10,Math.min(m-10,n+c));if(p){let t=a+(e>0&&e<o?_:0),n=l===`bottom`?d-f:f;r.push({x:t,y:n})}else{let t=a+(e>0&&e<o?_:0),n=l===`right`?u-f:f;r.push({x:n,y:t})}}v.push(r)}let y=``,b=a===`independent`?Array.from({length:r},(e,t)=>r-1-t):Array.from({length:r},(e,t)=>t);for(let e of b){let n=t.ramp(e,r),o=v[e],s=``;if(i===`step`){s=`M ${o[0].x} ${o[0].y}`;for(let e=0;e<o.length-1;e++){let t=o[e],n=o[e+1];s+=p?` L ${n.x} ${t.y} L ${n.x} ${n.y}`:` L ${t.x} ${n.y} L ${n.x} ${n.y}`}}else if(i===`peak`){s=`M ${o[0].x} ${o[0].y}`;for(let e=1;e<o.length;e++)s+=` L ${o[e].x} ${o[e].y}`}else if(i===`zigzag`||i===`chevron`){s=`M ${o[0].x} ${o[0].y}`;for(let t=0;t<o.length-1;t++){let n=o[t],r=o[t+1],i=(n.x+r.x)/2+(p?0:e%2==0?30:-30),a=(n.y+r.y)/2+(p?e%2==0?30:-30:0);s+=` L ${i} ${a} L ${r.x} ${r.y}`}}else{s=`M ${o[0].x} ${o[0].y}`;for(let e=0;e<o.length-1;e++){let t=o[e],n=o[e+1],r=t.x+(n.x-t.x)*.5,i=t.y,a=t.x+(n.x-t.x)*.5,c=n.y;s+=` C ${r} ${i}, ${a} ${c}, ${n.x} ${n.y}`}}if(a===`shared`&&e>0){let t=v[e-1],n=l===`bottom`?f:l===`top`?-f:0,r=l===`right`?f:l===`left`?-f:0;for(let e=t.length-1;e>=0;e--)s+=` L ${t[e].x+r} ${t[e].y+n}`}else s+=l===`bottom`?` L ${u} ${d+f} L 0 ${d+f}`:l===`top`?` L ${u} ${-f} L 0 ${-f}`:l===`right`?` L ${u+f} ${d} L ${u+f} 0`:` L ${-f} ${d} L ${-f} 0`;s+=` Z`,y+=`<path d="${s}" fill="${n}" stroke="${n}" stroke-width="0.5" stroke-linejoin="round" stroke-linecap="round" />`}return y},Yn=(e,t)=>{let n=e,r=Math.max(1,Math.min(40,Number(n.count??3))),i=n.element||`circle`,a=Math.max(10,Number(n.sizeMin??60)),o=Math.max(a,Number(n.sizeMax??180)),s=Math.max(0,Number(n.minDistance??40)),c=n.distribution||`uniform`,l=t.width,u=t.height,d=[],f=r*50,p=0;for(;d.length<r&&p<f;){p++;let e=t.rng.next()*l,n=t.rng.next()*u;if(c===`center`){let r=l/2,i=u/2,a=t.rng.next()**.5,o=t.rng.next()*Math.PI*2;e=r+Math.cos(o)*(l*.35*a),n=i+Math.sin(o)*(u*.35*a)}else c===`edge`&&(t.rng.next()>.5?e=t.rng.next()>.5?t.rng.range(0,l*.25):t.rng.range(l*.75,l):n=t.rng.next()>.5?t.rng.range(0,u*.25):t.rng.range(u*.75,u));let r=t.rng.range(a,o),i=!0;for(let t of d)if(Math.hypot(e-t.x,n-t.y)<t.r+r+s){i=!1;break}i&&d.push({x:e,y:n,r})}let m=``;for(let e=0;e<d.length;e++){let n=d[e],r=t.ramp(e,Math.max(1,d.length));if(i===`petal`){let e=`M ${n.x} ${n.y} C ${n.x+n.r} ${n.y-n.r*1.5}, ${n.x+n.r*2} ${n.y}, ${n.x} ${n.y+n.r*2} Z`;m+=`<path d="${e}" fill="${r}" stroke="${r}" opacity="0.85" />`}else if(i===`blob`){let e=n.r*(.8+t.rng.next()*.4),i=n.r*(.8+t.rng.next()*.4),a=n.r*(.8+t.rng.next()*.4),o=n.r*(.8+t.rng.next()*.4),s=`M ${n.x} ${n.y-e} C ${n.x+i} ${n.y-e}, ${n.x+i} ${n.y+a}, ${n.x} ${n.y+a} C ${n.x-o} ${n.y+a}, ${n.x-o} ${n.y-e}, ${n.x} ${n.y-e} Z`;m+=`<path d="${s}" fill="${r}" opacity="0.85" />`}else m+=`<circle cx="${n.x}" cy="${n.y}" r="${n.r}" fill="${r}" opacity="0.85" />`}return m},Xn=(e,t)=>{let n=e,r=Math.max(1,Math.min(6,Number(n.count??1))),i=Math.max(5,Math.min(14,Number(n.points??8))),a=Math.max(0,Math.min(1,Number(n.irregularity??.5))),o=n.anchor||`center`,s=Math.max(100,Number(n.size??Math.min(t.width,t.height)*.45)),c=t.width,l=t.height,u=``;for(let e=0;e<r;e++){let n=t.ramp(e,r),d=s*(1-e*.15),f=c/2,p=l/2;o===`corner-tl`?(f=0,p=0):o===`corner-tr`?(f=c,p=0):o===`corner-bl`?(f=0,p=l):o===`corner-br`&&(f=c,p=l);let m=Math.PI*2/i,h=[];for(let e=0;e<i;e++){let n=e*m,r=(t.rng.next()-.5)*d*a,i=Math.max(20,d+r);h.push({x:Math.cos(n)*i,y:Math.sin(n)*i})}let g=`M ${h[0].x} ${h[0].y}`;for(let e=0;e<i;e++){let t=h[e],n=h[(e+1)%i],r=(t.x+n.x)/2,a=(t.y+n.y)/2;g+=` Q ${t.x} ${t.y}, ${r} ${a}`}g+=` Z`,u+=`
|
|
52
52
|
<g transform="translate(${f}, ${p})">
|
|
53
53
|
<path d="${g}" fill="${n}" opacity="${.9-e*.1}" />
|
|
54
54
|
</g>
|
|
@@ -112,5 +112,5 @@ var OimPlayer=(function(e){Object.defineProperties(e,{__esModule:{value:!0},[Sym
|
|
|
112
112
|
${d}
|
|
113
113
|
</g>
|
|
114
114
|
</svg>`}function Ca(e,t,n,r){e.textContent=``;let i=Array.from(t);for(let t=0;t<i.length;t++){let a=i[t];if(a===`
|
|
115
|
-
`){e.appendChild(document.createElement(`br`));continue}let o=document.createElement(`span`);o.textContent=a===` `?`\xA0`:a,o.style.display=`inline-block`,o.style.animationName=oi,o.style.animationDuration=ai+`s`,o.style.animationTimingFunction=`linear`,o.style.animationIterationCount=`infinite`,o.style.animationDelay=ci(t,n,r)+`s`,e.appendChild(o)}}function wa(e,t,n,r,i){e.textContent=``,An(t,n).forEach((t,a)=>{if(/^\s+$/.test(t)){e.appendChild(document.createTextNode(t));return}let o=document.createElement(`span`);o.textContent=t,o.className=`oim-entrance`;let s=o.style;if(s.display=`inline-block`,s.animation=`oim-entrance-${n} ${Tn}s linear ${jn(a,r,i)}s both`,!kn(n)){e.appendChild(o);return}let c=document.createElement(`span`);c.className=`oim-entrance-clip`,c.style.display=`inline-block`,c.style.overflow=`hidden`,c.style.verticalAlign=`top`,c.appendChild(o),e.appendChild(c)})}function Ta(e,t){if(!e)return;let n=`oim-entrance-`+t;if(e.getElementById(n))return;let r=Nn(t),i=r.some(e=>e.rotateDeg!==0),a=r.map((e,t)=>`${t*100/(r.length-1)}%{opacity:${e.opacity};transform:translateY(${e.translateYEm}em) scale(${e.scale})${i?` rotate(${e.rotateDeg}deg)`:``}}`).join(``),o=document.createElement(`style`);o.id=n,o.textContent=`@keyframes ${n}{${a}}@media (prefers-reduced-motion: reduce){.oim-entrance{animation:none!important}}`,e.appendChild(o)}function Ea(e){if(!e)return;let t=`oim-wave-keyframes`;if(e.getElementById(t))return;let n=document.createElement(`style`);n.id=t,n.textContent=si(),e.appendChild(n)}function Da(e,t,n){let r=0,i=performance.now(),a=null,o=()=>r+(a===null?0:performance.now()-i),s=()=>t(o()/1e3),c=()=>{a===null&&(i=performance.now(),a=setInterval(s,e))},l=()=>{a!==null&&(r=o(),clearInterval(a),a=null)};return c(),{pause:l,play:c,stop:()=>{l(),n?.()}}}function Oa(e,t,n=20,r=0,i=!0){let a=a=>{let o=yi(t,a,n,r,i,!1);e.textContent=o.visibleText+(o.showCursor?`|`:``)};return a(0),Da(40,a)}function ka(e,t,n,r=1,i=0,a=50){e.textContent=``,e.style.display=`inline-block`,e.style.position=`relative`;let o=()=>{let e=document.createElement(`span`);return e.textContent=t,e},s=pi(n,fi(0)).copies.map(e=>{let t=o();t.setAttribute(`aria-hidden`,`true`);let n=t.style;return n.position=`absolute`,n.left=`0`,n.top=`0`,n.width=`100%`,n.height=`100%`,n.pointerEvents=`none`,n.opacity=`0`,e.color&&(n.color=e.color),t}),c=o();c.style.position=`relative`,n===`glitch-slice`?e.append(c,...s):e.append(...s,c);let l=t=>{let o=pi(n,fi(t,r,i,a));e.style.transform=o.skewX?`skewX(${o.skewX}deg)`:`none`,o.copies.forEach((e,t)=>{let n=s[t].style;n.opacity=String(e.opacity),n.transform=`translate(${e.dx}px, ${e.dy}px)`,e.clip&&(n.clipPath=`inset(${e.clip.top}% 0 ${100-e.clip.bottom}% 0)`)})};return Da(33,l,()=>l(0))}function Aa(e,t){if(!t?.enabled)return;let n=t.color||`rgba(245,158,11,.35)`,r=t.style===`underline-thick`,i=e.style;i.backgroundColor=r?`transparent`:n,r&&(i.boxShadow=`inset 0 -.4em 0 ${n}`),i.borderRadius=t.style===`pill`?`9999px`:t.style===`box`?`0`:`${t.borderRadius??3}px`,i.padding=`${t.paddingY??2}px ${t.paddingX??4}px`,i.boxDecorationBreak=i.webkitBoxDecorationBreak=`clone`}function ja(e,t,n,r){if(!n?.enabled||!t)return!1;let{letter:i,rest:a}=xn(t,Object.keys(r??{}));if(!i)return!1;let o=document.createElement(`span`),s=o.style,c=bn(n);return o.textContent=i,s.float=`left`,s.fontSize=`${c.scale}em`,s.lineHeight=String(c.lineHeight),s.marginRight=`${c.marginRight}px`,c.fontFamily&&(s.fontFamily=c.fontFamily),c.color&&(s.color=c.color),s.fontWeight=String(c.fontWeight),s.userSelect=`none`,yn(e,a,r),e.prepend(o),!0}function Ma(e){if(e.length<2)return 0;let t=e[0].clientX-e[1].clientX,n=e[0].clientY-e[1].clientY;return Math.sqrt(t*t+n*n)}function Na(e,t){let n=(e||``).replace(`#`,``),r=parseInt(n.substring(t*2,t*2+2),16)||0;return Math.round(r/255*1e3)/1e3}function Pa(e,t){let n=`http://www.w3.org/2000/svg`,r=e.style||{},i=t.width,a=t.height,o=Array.isArray(e.position)?e.position:[0,0],s=typeof e.x==`number`?e.x:Number(o[0])/100*i,c=typeof e.y==`number`?e.y:Number(o[1])/100*a,l=document.createElementNS(n,`svg`);l.setAttribute(`viewBox`,`0 0 `+i+` `+a),l.setAttribute(`preserveAspectRatio`,`none`),l.style.position=`absolute`,l.style.left=-s+`px`,l.style.top=-c+`px`,l.style.width=i+`px`,l.style.height=a+`px`,l.style.flex=`none`,l.style.overflow=`visible`,l.style.display=`block`,l.style.pointerEvents=`none`;let u=document.createElementNS(n,`path`);u.setAttribute(`d`,Jr(e,t)),u.setAttribute(`fill`,P(r.maskBgColorRole||r.fillColorRole,r.maskBgColor||`#38BDF8`)),u.setAttribute(`fill-rule`,`evenodd`),l.appendChild(u);let d=r.maskStrokeWidth??0;if(d>0){let i=document.createElementNS(n,`path`);i.setAttribute(`d`,Yr(e,t)),i.setAttribute(`fill`,`none`),i.setAttribute(`stroke`,P(r.maskStrokeColorRole||r.strokeColorRole,r.maskStrokeColor||`#FFFFFF`)),i.setAttribute(`stroke-width`,String(d)),i.setAttribute(`stroke-linejoin`,`round`),l.appendChild(i)}return l}function Fa(e,t){let n=`http://www.w3.org/2000/svg`,r=document.createElementNS(n,`svg`);r.setAttribute(`width`,`0`),r.setAttribute(`height`,`0`),r.setAttribute(`style`,`position:absolute`),r.setAttribute(`aria-hidden`,`true`);let i=document.createElementNS(n,`defs`);return r.appendChild(i),e.forEach(function(e){let r=e.style||{};if(e.type===`mask`&&r.maskMode===`cutout`){let a=r.maskFeather,o=ei(e,t);if(a&&a>0){let r=Qr(e)+`-blur`,s=document.createElementNS(n,`filter`);s.setAttribute(`id`,r),s.setAttribute(`filterUnits`,`userSpaceOnUse`),s.setAttribute(`x`,`0`),s.setAttribute(`y`,`0`),s.setAttribute(`width`,String(t.width)),s.setAttribute(`height`,String(t.height));let c=document.createElementNS(n,`feGaussianBlur`);c.setAttribute(`stdDeviation`,String(a)),s.appendChild(c),i.appendChild(s);let l=document.createElementNS(n,`mask`);l.setAttribute(`id`,Qr(e)),l.setAttribute(`maskUnits`,`userSpaceOnUse`);let u=document.createElementNS(n,`rect`);u.setAttribute(`x`,`0`),u.setAttribute(`y`,`0`),u.setAttribute(`width`,String(t.width)),u.setAttribute(`height`,String(t.height)),u.setAttribute(`fill`,`black`),l.appendChild(u);let d=document.createElementNS(n,`g`);d.setAttribute(`filter`,`url(#`+r+`)`);let f=document.createElementNS(n,`path`);f.setAttribute(`d`,o),f.setAttribute(`fill`,`white`),f.setAttribute(`clip-rule`,`evenodd`),f.setAttribute(`fill-rule`,`evenodd`),d.appendChild(f),l.appendChild(d),i.appendChild(l)}else{let t=document.createElementNS(n,`clipPath`);t.setAttribute(`id`,Kr(e)),t.setAttribute(`clipPathUnits`,`userSpaceOnUse`);let r=document.createElementNS(n,`path`);r.setAttribute(`d`,o),r.setAttribute(`clip-rule`,`evenodd`),t.appendChild(r),i.appendChild(t)}}if(e.type===`filter`&&e.duotone){let t=document.createElementNS(n,`filter`);t.setAttribute(`id`,Zr(e));let r=document.createElementNS(n,`feColorMatrix`);r.setAttribute(`type`,`matrix`),r.setAttribute(`values`,`0.33 0.33 0.33 0 0 0.33 0.33 0.33 0 0 0.33 0.33 0.33 0 0 0 0 0 1 0`),t.appendChild(r);let a=document.createElementNS(n,`feComponentTransfer`);[`R`,`G`,`B`].forEach(function(e,t){let r=document.createElementNS(n,`feFunc`+e);r.setAttribute(`type`,`table`);let i=t;r.setAttribute(`tableValues`,Na(Xr.shadows,i)+` `+Na(Xr.lights,i)),a.appendChild(r)}),t.appendChild(a),i.appendChild(t)}}),r}function Ia(e,t,n){let r=n.get(e.shape.id);r&&(e.clipPath&&(r.style.clipPath=e.clipPath),e.maskStyle&&(r.style.mask=e.maskStyle),t.appendChild(r))}var La=1200,Ra=class{updateScale(){}sceneReady(){}updateViewportSize(){}host;poster=`auto`;metadata=null;securityStatus=`unsigned`;embeddedFontFamilies=new Map;imageUrl=null;lang;showControls;activeSlotId=null;zoom=1;panX=0;panY=0;_stage=null;_viewport=null;_baseImg=null;_overlay=null;_lottieInstances=[];_onDragMove=null;_onDragEnd=null;_animations=[];_textAnimations=[];_paused=!1;_revealAnims=new Map;_timelines=new Map;_warnedPlay=new Set;_heldTimelines=new Set;_isStill(){let e=this.host;if(!this.disableAnimations||!e||typeof e.getAttribute!=`function`)return!1;let t=e.getAttribute(`disable-animations`);return t!==null&&t!==`false`||e.getAttribute(`mode`)===`image`}_resizeObserver=null;_onFullscreenChange=null;_retryViewportSize=!1;allowZoom;showLanguageSelector;showSlots;allowLottie;allowDynamicColors=!0;disableAnimations;disableActions;dropdownBlur;fit;align;_deviceProfile;applyPalette(){let e=this._viewport;if(!e)return;let t=typeof matchMedia==`function`&&matchMedia(`(prefers-color-scheme: dark)`).matches,n=this.allowDynamicColors?le(this.metadata??{},{requested:this.host.getAttribute(`palette`),prefersDark:t}):null;for(let t of re){let r=n?.colors[t];r?e.style.setProperty(`--oim-palette-`+t,r):e.style.removeProperty(`--oim-palette-`+t)}}async renderSlots(e){if(!this.metadata||!this.host||this.poster===`only`)return;let t=(this.metadata.slots||this.metadata.elements||[]).some(function(e){return e.type===`mask`||e.type===`filter`}),n=e&&e.onlyIds&&e.onlyIds.size>0&&!t?e.onlyIds:null;if(this._viewport&&!this._revealed&&this._viewport.classList.remove(`oim-viewport--ready`),!this.showSlots){this._overlay&&(this._overlay.innerHTML=``),this._viewport&&this._viewport.classList.add(`oim-viewport--ready`),this.sceneReady();return}n?this._destroyLottiesIn(n):this._lottieInstances&&=(this._lottieInstances.forEach(function(e){try{e.inst.destroy()}catch{}}),[]);let r=this._overlay;if(!r)return;let i=this._viewport?this._viewport.querySelector(`.oim-noise-overlay`):null,a=Array.isArray(this.metadata?.effects)?this.metadata.effects.find(e=>e&&e.type===`texture`&&e.enabled!==!1):null;if(a){let e=Vi[a.preset];if(e){let t=i||document.createElement(`div`);t.className=`oim-noise-overlay`,t.style.position=`absolute`,t.style.inset=`0`,t.style.width=`100%`,t.style.height=`100%`,t.style.pointerEvents=`none`,t.style.mixBlendMode=a.blend||e.defaultBlend||`overlay`;let n=(a.intensity===void 0?e.defaultIntensity:a.intensity)/100;t.style.opacity=n.toFixed(2),t.style.zIndex=`999`;let r=a.scale||1,o=e.tileWidth*r,s=e.tileHeight*r;t.style.backgroundImage=`url("${e.getDataUri(a.color)}")`,t.style.backgroundRepeat=`repeat`,t.style.backgroundSize=`${o}px ${s}px`,!i&&this._viewport&&this._viewport.appendChild(t)}}else if(this.metadata&&this.metadata.grain&&this.metadata.grain.enabled){let e=this.metadata.grain,t=e.intensity??15,n=e.blendMode??`overlay`,r=e.baseFrequency??.8,a=i||document.createElement(`div`);a.className=`oim-noise-overlay`,a.style.position=`absolute`,a.style.inset=`0`,a.style.width=`100%`,a.style.height=`100%`,a.style.pointerEvents=`none`,a.style.mixBlendMode=n,a.style.opacity=(t/100).toFixed(2),a.style.zIndex=`999`;let o=`oim-global-noise-filter`,s=Di(o,{intensity:t,baseFrequency:r,color:e.color}),c=`data:image/svg+xml;utf8,`+encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%"><defs>${s}</defs><rect width="100%" height="100%" filter="url(#${o})"/></svg>`);a.style.backgroundImage=`url("${c}")`,!i&&this._viewport&&this._viewport.appendChild(a)}else i&&i.remove();let o=this,s=this.metadata.slots||this.metadata.elements||[];try{await U()}catch(e){console.warn(`[OimPlayer] Could not load upgrade:`,e)}let l=Le(o.metadata);s.forEach(function(e){let t=e&&e.type===`mask`?l.get(String(e.id)):void 0;if(t){e.style={...e.style,...We(t)};let{x:n,y:r,width:i,height:a}=t.box;Object.assign(e,{x:n,y:r,width:i??0,height:a??0})}});let u=[],d=o.metadata&&(o.metadata.artboardWidth||o.metadata.canvasWidth||o.metadata.canvas_width)||(o.metadata&&o.metadata.canvas?o.metadata.canvas.natural_width||o.metadata.canvas.width:0)||(o._baseImg&&o._baseImg.naturalWidth>0?o._baseImg.naturalWidth:1080),f=o.metadata&&(o.metadata.artboardHeight||o.metadata.canvasHeight||o.metadata.canvas_height)||(o.metadata&&o.metadata.canvas?o.metadata.canvas.natural_height||o.metadata.canvas.height:0)||(o._baseImg&&o._baseImg.naturalHeight>0?Math.round(d*(o._baseImg.naturalHeight/o._baseImg.naturalWidth)):1920);r.style.setProperty(`--oim-overlay-w`,d+`px`),r.style.setProperty(`--oim-overlay-h`,f+`px`);let p=document.createDocumentFragment(),m={},h=new Map,g=Le(o.metadata);(this.metadata.zones||[]).forEach(e=>{let t=g.get(String(e?.id));if(!t||t.type!==`group`)return;let n=document.createElement(`div`);n.className=`oim-zone`,n.id=`oim-zone-`+t.id,n.style.position=`absolute`,n.style.inset=`0`;let r=t.children?.find(e=>e.id===t.id+`__background`),i=r?.fills?.[0],a=t.effects?.find(e=>e.kind===`backdrop`)?.blur;if(r||a){let e=t.box,s=document.createElement(`div`);s.className=`oim-zone-box`,s.style.position=`absolute`,s.style.left=e.x+`px`,s.style.top=e.y+`px`,s.style.width=(e.width??0)+`px`,s.style.height=(e.height??0)+`px`,i&&`kind`in i&&i.kind===`color`&&(s.style.background=ze(o.metadata).css(i.value)||``),typeof r?.corners==`number`&&(s.style.borderRadius=r.corners+`px`),a&&(s.style.backdropFilter=`blur(`+a+`px)`,s.style.webkitBackdropFilter=s.style.backdropFilter),n.appendChild(s)}p.appendChild(n),m[t.id]=n;for(let e of t.children??[])h.set(e.id,t.id)});let _=ye(s),v=Le(o.metadata),y=ze(o.metadata),b=e=>e&&typeof e==`object`&&typeof e.fallback==`string`?y.literal(e.fallback):y.literal(e),x=s.map(async e=>{let t=e.type,r=v.get(String(e.id));if(n&&!n.has(String(e.id)))return null;let i=e.style||{};if(e.tracking_data,t===`mask`&&i.maskMode===`cutout`){let t=h.get(String(e.id));return t&&m[t]&&console.warn(`[OimPlayer] Slot "`+e.id+`" is a mask layer inside zone "`+t+`". Mask layers are only supported in the top-level slot stack, so this one will neither render nor clip anything. Move it out of the zone.`),null}if(!r)return console.warn(`[OimPlayer] Slot "`+e.id+`" has no 2.0 layer; it is not painted.`),null;let a=r.box,s=Pe(e,o.lang),l=r.type===`text`?r.text?.content:void 0,u=t===`image`?r.image:void 0,p=r.type===`shape`&&r.geometry?.kind===`paths`&&!Gn(r.geometry).path?r.geometry:void 0,g=l?Ae(l,o.lang):u?Ge(u.src,o.lang):p&&!Me(e)?qe(p,Je(r,y.css)):r.type===`lottie`?r.lottie?.src??``:s.content,x=!o.disableActions&&(!!r.interactions?.length||!!r.animations?.some(e=>e.on===`hover`||e.on===`press`)),S=t===`mask`&&i.maskMode!==`cutout`,C=t===`artistic-text`,w=t===`geo`||t===`shape`||t===`draw`||t===`filter`||t===`container`||S||x||C,T=e.is_background_pattern===!0||e.id===`background-pattern-slot`;if(!(t===`group`&&_.has(String(e.id)))&&!(t===`pattern`||T)&&!g&&!(w&&(r.fills?.length||a.width!==void 0||t===`filter`||t===`container`||S||x||C)))return null;let E=je(e,g),D=g,O=!1;E||(/<svg|<span|<div|<a|<img/i.test(D)&&(D=D.replace(/</g,`<`).replace(/>/g,`>`).replace(/&/g,`&`).replace(/"/g,`"`).replace(/'/g,`'`)),O=!!p&&!Me(e));let ee=!E&&(O||/<svg|<span|<div|<a|<img/i.test(D));D=D.replace(/\\n/g,`
|
|
116
|
-
`);let k=r.type===`text`?r.text?.align??`left`:`left`,te=`center`;k===`left`?te=`flex-start`:k===`right`&&(te=`flex-end`);let A=document.createElement(`div`);A.className=`oim-slot`,A.setAttribute(`part`,`slot`),A.setAttribute(`data-slot-id`,e.id),r.languages&&!r.languages.includes(o.lang)&&(A.style.display=`none`),A.style.zIndex=T?`0`:`1`;let ne=r.animations?.find(e=>e.on===`enter`&&e.preset);A._oimReveal=ne?{effect:ne.preset,duration:ne.duration,easing:ne.easing}:void 0;let re=!!r.interactions?.length;x||re&&!o.disableActions||A.setAttribute(`data-oim-passthrough`,``);let ie=r.fills?.[0],ae=ie?.kind===`pattern`?ie.pattern:void 0,oe=ae?zr(ae,y):{};if(T){A.style.pointerEvents=`none`;let e=p?qe(p,Je(r,y.literal),!0):``;if(e||ae){if(bi(A,oe,e),(ae?.fit===`cover`?`cover`:`tile`)==`cover`)A.style.backgroundSize=`cover`,A.style.backgroundRepeat=`no-repeat`,A.style.backgroundPosition=`center`,A.style.setProperty(`--oim-pat-size`,`cover`),A.style.setProperty(`--oim-pat-repeat`,`no-repeat`),A.style.setProperty(`--oim-pat-pos`,`center`);else{let e=160*(ae?.scale||1)/d*100;A.style.backgroundSize=e.toFixed(4)+`cqw `+e.toFixed(4)+`cqw`,A.style.backgroundRepeat=`repeat`,A.style.setProperty(`--oim-bg-tile`,e.toFixed(4)+`cqw`)}let t=ae?.motion,n=t?`background-animation-${t.direction} ${t.period||8}s linear infinite`:void 0;!o.disableAnimations&&typeof n==`string`&&n.indexOf(`background-animation-`)===0&&(A.style.animation=n),D=``,O=!1}}if(t===`pattern`){let e=Gn(r.type===`shape`?r.geometry:void 0),t=Ir({...oe,geoShape:e.round?`circle`:e.preset});for(let[e,n]of Object.entries(t))e.startsWith(`--`)?A.style.setProperty(e,n):A.style[e]=n;(oe.fillPatternColorRole||oe.fillPatternBgColorRole)&&bi(A,oe,``)}let j=document.createElement(`div`);j.className=`oim-slot-loop-wrap`;let M=document.createElement(`div`);M.className=`oim-slot-hover-wrap`,(O||E||t===`lottie`||C)&&(j.style.height=`100%`,M.style.height=`100%`);let N=null,se=t===`text`?r.fills?.[0]:void 0;if(se){let e=Wr(se,{colors:y,isText:!0,width:r.box.width||d,height:r.box.height||f});N=Object.keys(e).length>0?e:null}let ce=N!==null&&(N.backgroundClip===`text`||N.webkitBackgroundClip===`text`),le=r.box.width!==void 0&&r.box.height!==void 0,P=ce&≤if(E){let t=D.trim();if(t.startsWith(`<`)){let e=t.match(/src=["']([^"']+)["']/);e&&e[1]&&(t=e[1])}let n=wt(t),i=document.createElement(`img`);n?i.src=t:(console.warn(`[OimPlayer] Image not embedded in the file (network URLs are not loaded), slot:`,e.id),i.src=``),i.alt=``,i.draggable=!1,i.style.width=`100%`,i.style.height=`100%`;let a=u?.fit,o=u?.crop;if(i.style.objectFit=a||`cover`,o){let e=ea(o);i.style.objectFit=e.objectFit,i.style.objectPosition=e.objectPosition,i.style.transform=e.transform,i.style.transformOrigin=e.transformOrigin,M.style.overflow=`hidden`}i.style.display=`block`,i.style.pointerEvents=`none`,i.style.filter=e.type===`image`?fe(Ue(r.image?.filters))??``:``,j.style.width=`100%`,j.style.height=`100%`,M.style.width=`100%`,M.style.height=`100%`,i.onerror=function(t){console.error(`[OimPlayer] Image slot failed to load for slot:`,e.id,`error:`,t),i.style.display=`none`},M.appendChild(i)}else if(t===`lottie`){let t=document.createElement(`div`);t.className=`oim-lottie-container`,t.style.width=`100%`,t.style.height=`100%`,M.appendChild(t),o.allowLottie?Pn().then(function(n){let r=typeof D==`string`&&(D.startsWith(`http`)||D.endsWith(`.json`)||D.trim().indexOf(`{`)!==0);if(r){console.warn(`[OimPlayer] Lottie animation must be a valid JSON string. External URLs are not supported.`);return}let i=n.loadAnimation({container:t,renderer:`svg`,loop:!o.disableAnimations,autoplay:!o.disableAnimations&&!o._paused,path:r?D.trim():void 0,animationData:r?void 0:JSON.parse(D)});o.disableAnimations&&i.goToAndStop(0,!0),o._lottieInstances.push({slotId:String(e.id),inst:i})}).catch(function(e){console.error(`[OIM Player] Error loading local Lottie bundle. Hiding dynamic element:`,e),A.style.display=`none`}):(console.warn(`[OIM Player] Lottie animation slot ${e.id} detected but allowLottie option is false. Hiding dynamic element.`),A.style.display=`none`)}else if(C){j.style.width=`100%`,j.style.height=`100%`,M.style.width=`100%`,M.style.height=`100%`,M.style.display=`flex`,M.style.alignItems=`center`,M.style.justifyContent=`center`,M.style.pointerEvents=`none`;let t=xa(r,o.lang,b),n=cn(t.fontFamily,o.embeddedFontFamilies);n&&(t.fontFamily=n.replace(/, sans-serif$/,``));let i=Sa(t,String(e.id));if(typeof DOMParser<`u`){let e=new DOMParser().parseFromString(i,`image/svg+xml`).documentElement;e&&M.appendChild(e)}else M.innerHTML=i}else if(ee){let e=M;if(P){let t=document.createElement(`div`);t.className=`oim-slot-text`,M.appendChild(t),e=t}let t=Ct(D);if(typeof DOMParser<`u`){let n=new DOMParser().parseFromString(t,`text/html`);for(;n.body.firstChild;)e.appendChild(n.body.firstChild)}else{let n=document.createElement(`div`);for(n.innerHTML=t;n.firstChild;)e.appendChild(n.firstChild)}}else{let e=M;if(P){let t=document.createElement(`div`);t.className=`oim-slot-text`,M.appendChild(t),e=t}let n=r.animations?.find(e=>e.on===`load`&&e.preset),i=n?.params??{},a={type:n?.preset,speed:i.speed,delay:n?.delay?+(n.delay/1e3).toFixed(6):void 0,cursor:i.cursor,intensity:i.intensity},s=a.type,c=(t===`text`?r.text:void 0)??{};Aa(e,c.highlight);let l=c.marks,u=vn(D,l);s===`wave-chars`&&!o.disableAnimations?(Ea(o.host.shadowRoot),Ca(e,u,typeof a.speed==`number`?a.speed:.05,typeof a.delay==`number`?a.delay:0)):On(s)&&!o.disableAnimations?(Ta(o.host.shadowRoot,s),wa(e,u,s,a.speed,a.delay)):s===`typewriter`&&!o.disableAnimations?o._bornPausedIfNeeded(o._textAnimations,Oa(e,u,a.speed,a.delay,a.cursor)):s?.startsWith(`glitch-`)&&!o.disableAnimations?o._bornPausedIfNeeded(o._textAnimations,ka(e,u,s,a.speed,a.delay,a.intensity)):ja(e,D,c.dropCap,l)||yn(e,D,l)}j.appendChild(M);let ue=r.motion?.loop,F=ue?{enabled:!0,speedPxSec:ue.speedPxSec,direction:ue.direction,mirror:ue.mirror??!0,pauseOnHover:!!ue.pauseOnHover}:void 0,I=!1;if(F&&F.enabled){let e=F.infinite||{},t=e.enabled===!1||o._isStill()?0:F.speedPxSec===void 0?e.speedPxSec===void 0?e.speed_px_sec===void 0?F.mode===`infinite_horizontal`?F.speed===void 0?20:F.speed:0:e.speed_px_sec:e.speedPxSec:F.speedPxSec,n=F.direction||e.direction||`right_to_left`,i=F.mirror===void 0?F.seamlessTile===void 0?e.mirror===void 0?e.seamlessTile===void 0?e.seamless_tile===void 0||!!e.seamless_tile:!!e.seamlessTile:!!e.mirror:!!F.seamlessTile:!!F.mirror,a=F.pauseOnHover===void 0?e.pauseOnHover===void 0?!!e.pause_on_hover:!!e.pauseOnHover:!!F.pauseOnHover,s=Ki({speedPxSec:Number(t)||0,direction:n,mirror:i,pauseOnHover:a},r.box.width||d||d,d);if(s.duplicate){I=!0,qi(o.host.shadowRoot);let e=document.createElement(`div`);e.className=`${Hi} ${Ui}`;for(let[t,n]of Object.entries(s.container))e.style.setProperty(t,n);for(let t=0;t<s.copies;t++){let n=t===0?j:j.cloneNode(!0);for(let[e,t]of Object.entries(s.copy))n.style.setProperty(e,t);if(t%2==1)for(let[e,t]of Object.entries(s.secondCopy))n.style.setProperty(e,t);e.appendChild(n)}A.appendChild(e)}}I||A.appendChild(j);let de=r.geometry?.trim,pe=r.animations?.find(e=>e.on===`load`&&e.tracks?.some(e=>e.property===`trimEnd`)),me=e=>+(e*100).toFixed(6),he=de||pe?{strokeWidth:1,trimStart:me(de?.start??0),trimEnd:me(de?.end??1),trimDuration:pe?+(pe.duration/1e3).toFixed(6):0}:void 0;ee&&he&&(he.trimDuration&&wi(o.host.shadowRoot),Ti(M,he));let ge=He(r,o.lang),ve={lineHeight:r.text?.lineHeight},ye=ge?.fontSize??`16px`,be=ge?.fontFamily,xe=T?`none`:ge?.maxWidth??(r.type===`text`&&!E?`80%`:`none`),Se=C||!E&&!O&&t!==`lottie`&&D.trim()!==``;if(be&&Se){let e=Ot(be),t=cn(e,o.embeddedFontFamilies);A.style.setProperty(`font-family`,t||e)}if(te=I||k===`left`?`flex-start`:k===`right`?`flex-end`:`center`,A.style.maxWidth=xe,A.style.fontSize=ye,A.style.lineHeight=String(ca(ve)),ge)for(let e of[`fontWeight`,`fontStyle`,`letterSpacing`,`textTransform`,`textDecoration`])ge[e]&&(A.style[e]=ge[e]);if(t===`text`&&se){let e=`kind`in se&&se.kind===`color`?y.css(se.value):``;e&&A.style.setProperty(`color`,e)}if(N){if(P){j.style.position=`absolute`,j.style.top=`0`,j.style.left=`0`,j.style.right=`0`,j.style.bottom=`0`,j.style.width=`100%`,j.style.height=`100%`,M.style.width=`100%`,M.style.height=`100%`,M.style.boxSizing=`border-box`,M.style.setProperty(`padding-right`,`0.25em`,`important`),M.style.display=`flex`,M.style.flexDirection=`column`,M.style.justifyContent=`center`,M.style.alignItems=te,Object.assign(M.style,N);let e=ua(ca(ve));e>0&&(A.style.setProperty(`padding-top`,e+`em`,`important`),A.style.setProperty(`padding-bottom`,e+`em`,`important`))}else if(Object.assign(A.style,N),ce){let e=ua(ca(ve));e>0&&(A.style.setProperty(`padding-top`,e+`em`,`important`),A.style.setProperty(`padding-bottom`,e+`em`,`important`))}}A.style.textAlign=k,A.style.display=`flex`,A.style.flexDirection=`column`,A.style.justifyContent=`center`,A.style.alignItems=te,A.style.opacity=`0`,A.style.transition=`opacity 0.3s ease`,A.style.whiteSpace=`pre-line`,A.style.overflow=da({isText:t===`text`,isParallaxGroup:!!r.motion?.loop||!!_.get(e.id)?.some(e=>v.get(String(e))?.motion?.loop),hasFilterOrShadow:!1,hasKeyframes:!!r.animations?.some(za)});let Ce=o.metadata?.canvas_width||o.metadata?.canvasWidth||(o.metadata?.canvas?o.metadata.canvas.natural_width:800);x&&fa(A),a.width!==void 0&&a.height!==void 0?(A.style.width=(a.width/Ce*100).toFixed(4)+`cqw`,A.style.height=(a.height/Ce*100).toFixed(4)+`cqw`):(A.style.width=`max-content`,A.style.height=`auto`);let L=r.fills?.[0],R=L&&`kind`in L?L.kind:void 0,z=Gn(r.type===`shape`?r.geometry:void 0),we=(t===`svg`||O)&&!S&&(R===`pattern`||R===`generative`),B=w&&!S&&R===`image`?String(L.src||``).trim():``,V=!!B&&wt(B),Te=we||(t===`geo`||t===`shape`)&&!S&&(V||R===`gradient`||R===`generative`||R===`pattern`&&!T),Ee=r.fills?.[1],De=R===`image`&&Ee?.kind===`color`?y.css(Ee.value):void 0,H=R===`color`?y.css(L.value):V?void 0:De;H&&w&&!S&&t!==`text`&&!C&&!Te&&A.style.setProperty(`background-color`,H);let Oe=t===`svg`||O||r.geometry?.kind===`paths`||w&&!!z.silhouette,ke=v.get(String(e.id)),U=ke?.strokes?.find(e=>!e.align&&`kind`in e.paint&&e.paint.kind===`color`&&typeof e.width==`number`),W=ke?.type===`text`?{color:``,width:0,style:void 0}:U?{color:y.css(U.paint.value)||``,width:U.width,style:U.style}:{color:``,width:0,style:void 0};W.color&&W.width&&!S&&!Oe&&A.style.setProperty(`border`,`${W.width}px ${W.style||`solid`} ${W.color}`),B&&!V&&console.warn(`[OimPlayer] Fill image not embedded in the file (network URLs are not loaded), slot:`,e.id);let G=w&&!S?z.silhouette:null;if(G){let e=`http://www.w3.org/2000/svg`,t=document.createElementNS(e,`svg`);t.setAttribute(`viewBox`,G.viewBox),t.setAttribute(`preserveAspectRatio`,`none`),t.style.position=`absolute`,t.style.left=`0`,t.style.top=`0`,t.style.width=`100%`,t.style.height=`100%`,t.style.display=`block`,t.style.overflow=`visible`;let n=document.createElementNS(e,G.points?`polygon`:`path`);G.points?n.setAttribute(`points`,G.points):n.setAttribute(`d`,G.d);let r=z.fillable,i=r&&V;n.setAttribute(`fill`,r&&H&&!Te&&!i?H:`none`);let a=U?W.width:0,o=U?W.color:``;a&&o&&(n.setAttribute(`stroke`,o),n.setAttribute(`stroke-width`,String(a)),n.setAttribute(`vector-effect`,`non-scaling-stroke`),n.setAttribute(`stroke-linejoin`,`round`),n.setAttribute(`stroke-linecap`,`round`),W.style===`dashed`?n.setAttribute(`stroke-dasharray`,`6,4`):W.style===`dotted`&&n.setAttribute(`stroke-dasharray`,`2,3`)),t.appendChild(n),A.appendChild(t),i&&ia(A,L,{d:G.d??`M `+G.points.split(` `).join(` L `)+` Z`,viewBox:G.viewBox},B,De),A.style.backgroundColor=`transparent`,A.style.padding=`0`,A.style.overflow=`visible`}else w&&!S&&z.round&&(A.style.borderRadius=`50%`);if(V&&!G){let e=typeof r.corners==`number`?r.corners:0,t=r.box.width||d,n=r.box.height||f;ia(A,L,{d:``,viewBox:`0 0 1 1`,rect:{rx:Math.min(Math.max(e/t,0),.5),ry:Math.min(Math.max(e/n,0),.5)}},B,De)}if(Te){let e=document.createElement(`div`);e.className=`oim-fill-layer`,e.style.position=`absolute`,e.style.left=`0`,e.style.top=`0`,e.style.width=`100%`,e.style.height=`100%`,e.style.pointerEvents=`none`,e.style.borderRadius=`inherit`;let t={...L?Wr(L,{colors:y,width:r.box.width||d,height:r.box.height||f}):{},...V&&Ee?.kind===`color`&&b(Ee.value)?{backgroundColor:b(Ee.value)}:{},...we?Fr(D):Nr(z.round?`circle`:z.preset,z.path?{svgPath:z.path.d,svgViewBox:z.path.viewBox}:void 0)};we&&!j.style.position&&(j.style.position=`relative`);for(let[n,r]of Object.entries(t))n.startsWith(`--`)?e.style.setProperty(n,r):e.style[n]=r;A.insertBefore(e,A.firstChild)}S&&(A.style.overflow=`visible`,A.style.display=`block`,A.style.setProperty(`padding`,`0`,`important`),A.appendChild(Pa(e,{width:d,height:f}))),(!Se&&!S||I)&&A.style.setProperty(`padding`,`0`,`important`);let Ne=h.get(String(e.id)),Fe=null;{let e=a;A.style.position=`absolute`;let t,n=`-50%`;if(e.width!==void 0&&e.height!==void 0){t=I||k===`left`?`0%`:k===`right`?`-100%`:`-50%`;let n=t===`0%`?0:t===`-100%`?1:.5;A.style.left=(e.x+e.width*n).toFixed(2)+`px`,A.style.top=(e.y+e.height/2).toFixed(2)+`px`}else[t,n]=Be(e),I&&(t=`0%`),A.style.left=e.x.toFixed(2)+`px`,A.style.top=e.y.toFixed(2)+`px`;A.style.setProperty(`--oim-tx`,t),A.style.setProperty(`--oim-ty`,n),A.style.setProperty(`--oim-rot`,(e.rotation||0)+`deg`),Fe={x:e.x,y:e.y,width:e.width??0,height:e.height??0}}let K=_e(e)&&!T&&Fe?aa(Fe,{width:d,height:f}):null;T&&(A.style.left=`0`,A.style.top=`0`,A.style.width=`100%`,A.style.height=`100%`,A.style.maxWidth=`none`,A.style.maxHeight=`none`,A.style.padding=`0`,A.style.boxSizing=`border-box`,A.style.setProperty(`--oim-tx`,`0%`),A.style.setProperty(`--oim-ty`,`0%`),A.style.setProperty(`--oim-rot`,`0deg`));let Ie=v.get(String(e.id))?.type===`text`?(()=>{let t=v.get(String(e.id))?.strokes?.[0];return t&&`kind`in t.paint&&t.paint.kind===`color`&&typeof t.width==`number`?{width:t.width,color:y.css(t.paint.value)||``}:void 0})():void 0;Ie&&(A.style.setProperty(`-webkit-text-stroke`,Ie.width+`px `+Ie.color),A.style.setProperty(`paint-order`,`stroke fill`));let Le=e=>{let n=Vi[e.preset];if(n){if(t===`text`||t===`artistic-text`){let t=e.scale||1,i=n.tileWidth*t,a=n.tileHeight*t,o=r.fills?.[0],s=o?.kind===`color`&&y.css(o.value)||`#18181b`,c=o?.kind===`gradient`?Wr(o,{colors:y}).backgroundImage:void 0,l=e.blend||n.defaultBlend||`overlay`;c?(A.style.backgroundImage=`url("`+n.getDataUri(e.color,e.intensity)+`"), `+c,A.style.backgroundRepeat=`repeat, no-repeat`,A.style.backgroundSize=i+`px `+a+`px, 100% 100%`,A.style.backgroundBlendMode=l+`, normal`):(A.style.backgroundImage=`url("`+n.getDataUri(e.color,e.intensity)+`"), linear-gradient(`+s+`, `+s+`)`,A.style.backgroundRepeat=`repeat, no-repeat`,A.style.backgroundSize=i+`px `+a+`px, 100% 100%`,A.style.backgroundBlendMode=l),A.style.webkitBackgroundClip=`text`,A.style.backgroundClip=`text`,A.style.webkitTextFillColor=`transparent`,A.style.color=`transparent`;let u=ua(ca(ve));u>0&&(A.style.setProperty(`padding-top`,u+`em`,`important`),A.style.setProperty(`padding-bottom`,u+`em`,`important`))}else{let r=document.createElement(`div`);r.className=`oim-effect-texture`,r.style.position=`absolute`,r.style.inset=`0`,r.style.pointerEvents=`none`,r.style.borderRadius=`inherit`,r.style.mixBlendMode=e.blend||n.defaultBlend||`overlay`;let i=(e.intensity===void 0?n.defaultIntensity:e.intensity)/100;r.style.opacity=String(i);let a=e.scale||1,o=n.tileWidth*a,s=n.tileHeight*a;r.style.backgroundImage=`url("${n.getDataUri(e.color,e.intensity)}")`,r.style.backgroundRepeat=`repeat`,r.style.backgroundSize=`${o}px ${s}px`,r.style.zIndex=`1`;let c=Cn({type:t,svg:O?D:void 0,image:E?D.trim():void 0,fit:u?.fit});if(c){let e=r.style;e.maskImage=e.webkitMaskImage=c.image,e.maskSize=e.webkitMaskSize=c.size,e.maskRepeat=e.webkitMaskRepeat=`no-repeat`,e.maskPosition=e.webkitMaskPosition=`center`}A.appendChild(r)}}},Re=e=>{A.style.filter=(A.style.filter?A.style.filter+` `:``)+e},ze=e=>{A.style.textShadow=A.style.textShadow?A.style.textShadow+`, `+e:e},Ve=r.effects;for(let n of Ve??[])if(n.kind===`blur`)Re(`blur(`+n.radius+`px)`);else if(n.kind===`glow`){let e=y.css(n.color)||`#f59e0b`,r=n.radius;t===`text`?ze(`0px 0px `+r*.4+`px `+e+`, 0px 0px `+r+`px `+e):Re(`drop-shadow(0px 0px `+r*.4+`px `+e+`) drop-shadow(0px 0px `+r+`px `+e+`)`)}else if(n.kind===`shadow`){let e=n.color&&typeof n.color==`object`?n.color:void 0,r=n.opacity===void 0?y.css(n.color??`#000000`)||`#000000`:$i({shadowColor:e?e.fallback:n.color,shadowOpacity:n.opacity*100,shadowColorRole:e?.var}),i=(n.x||0)+`px `+(n.y||0)+`px `+(n.blur||0)+`px `+r;t===`text`?ze(i):Re(`drop-shadow(`+i+`)`)}else if(n.kind===`grain`){if(!ki.includes(t))continue;let r=`oim-grain-`+String(e.id).replace(/[^A-Za-z0-9_-]/g,`_`);o._defineLayerGrain(r,n),Re(`url(#`+r+`)`)}else n.kind===`texture`&&Le({...n,color:n.color===void 0?void 0:b(n.color)});let We=r.opacity??1;if(A.dataset.oimOpacity=String(We),A.style.setProperty(`--oim-target-opacity`,String(We)),r.visible===!1&&(A.style.display=`none`,A.style.opacity=`0`,A.style.pointerEvents=`none`),t===`filter`){let t=r.effects?.find(e=>e.kind===`backdrop`),n=fe(Ue(t)),i=t?.preset===`duotone`?`url(#`+Zr(e)+`)`:n;i&&(A.style.backdropFilter=i,A.style.webkitBackdropFilter=i)}if(t===`container`){let e=r.box.width||300,t=r.box.height||200,n=r.fills?.[0],i=n?Wr(n,{colors:y,width:e,height:t}):{};Object.assign(A.style,i)}let Ke=r.corners;if(Ke!==void 0&&!z.round&&(A.style.borderRadius=(Array.isArray(Ke)?Ke:[Ke]).map(e=>e+`px`).join(` `)),K){A.style.left=K.left,A.style.top=K.top,A.style.width=K.width,A.style.height=K.height,A.style.maxWidth=`none`,A.style.maxHeight=`none`,A.style.setProperty(`padding`,`0`,`important`),A.style.transformOrigin=K.transformOrigin,A.style.pointerEvents=K.pointerEvents,A.style.setProperty(`--oim-tx`,`0%`),A.style.setProperty(`--oim-ty`,`0%`),A.style.setProperty(`--oim-scale`,`1`);let t=!!_.get(e.id)?.some(e=>v.get(String(e))?.motion?.loop);A.style.overflow=t?`hidden`:`visible`,c(j,`data-oim-group`,`data-oim-grupo`,String(e.id)),j.style.transformOrigin=K.transformOrigin,j.style.height=`100%`,j.style.overflow=`visible`}let q=r.animations?.find(za),Ye=r.animations?.find(e=>e.on===`loop`&&e.preset),Xe=r.animations?.find(e=>e.on===`hover`&&e.preset),Ze=e=>e?+(e/1e3).toFixed(6):0,Qe=q||Ye||Xe?{frames:q?Ua(q.tracks):void 0,duration:q?Ze(q.duration):0,trigger:q?.on===`action`?`action`:void 0,loop:Ye?.preset,loopDuration:Ze(Ye?.duration),loopDelay:Ze(Ye?.delay),hover:Xe?.preset}:void 0;if(Qe&&!o.disableAnimations){let t=Qe;if(t.frames&&typeof j.animate==`function`){let n=t.duration;{let r=t.frames,i=t.trigger===`action`,a=j.animate(r,{duration:n*1e3,iterations:i?1:1/0,easing:`linear`,...i?{fill:`both`}:{}});i?(a.pause(),a.currentTime=0):(o._paused&&a.pause(),o._animations.push(a)),o._timelines.set(String(e.id),a)}}t.loop&&t.loop!==`none`&&t.loop!==`custom`&&(j.classList.add(`oim-loop-`+t.loop),t.loopDuration&&j.style.setProperty(`--oim-loop-duration`,t.loopDuration+`s`),t.loopDelay&&j.style.setProperty(`--oim-loop-delay`,t.loopDelay+`s`)),t.hover&&t.hover!==`none`&&t.hover!==`custom`&&M.classList.add(`oim-hover-`+t.hover)}let $e=r.animations?.find(e=>e.on===`hover`&&e.tracks),et=e=>{let t=$e?.tracks?.find(t=>t.property===e)?.keyframes;return t?t[t.length-1].v:void 0},tt=e=>(r.interactions??[]).filter(t=>t.on===e).flatMap(e=>e.actions),nt={hover:{scale:et(`scale`),rotation:et(`rotation`),opacity:et(`opacity`)===void 0?void 0:+(et(`opacity`)*100).toFixed(6),transitionDuration:$e&&$e.duration>0?+($e.duration/1e3).toFixed(6):void 0,actions:tt(`hover`)},active:{actions:tt(`press`)}};if(!o.disableActions&&($e||r.interactions?.length)){let t={},n={},r=new Set;pa(A,nt,function(e,t){o.queueUpdate(e,t)},{run:function(i,a){let s=o.host.shadowRoot;if(!s)return;let c=new CustomEvent(`oim:action`,{cancelable:!0,detail:{slot:e.id,name:e.name,trigger:a||`unknown`,targets:i.map(function(e){return e.target}),types:i.map(function(e){return e.type})}});if(o.host.dispatchEvent(c),c.defaultPrevented)return;i.forEach(function(e){e.type===`play`&&e.target&&o._playTimeline(String(e.target))});let l={};i.forEach(function(i){if(!i.target||i.type===`play`)return;let a=s.querySelector(`[data-slot-id="`+i.target+`"]`);!a&&!r.has(i.target)&&(r.add(i.target),console.warn(`[OimPlayer] The slot "`+e.id+`" has an action "`+i.type+`" aimed at "`+i.target+`", which does not exist in this file. It does nothing.`));let o=!a||a.style.display!==`none`&&a.style.opacity!==`0`;if(l[i.target]=o,t[i.target]===void 0&&(t[i.target]=o),i.type===`setText`&&n[i.target]===void 0){let e=a?a.querySelector(`.oim-slot-hover-wrap`):null;n[i.target]=e?e.textContent||``:a&&a.textContent||``}});let u=ga(i,l);for(let[e,t]of Object.entries(u.visibility)){let n=s.querySelector(`[data-slot-id="`+e+`"]`);n&&(t?o._showSlotElement(n):o._hideSlotElement(n))}for(let[e,t]of Object.entries(u.texts)){let n=s.querySelector(`[data-slot-id="`+e+`"]`);if(!n)continue;let r=n.querySelector(`.oim-slot-hover-wrap`);r?r.textContent=t:n.textContent=t}},revert:function(e){let r=o.host.shadowRoot;r&&e.forEach(function(e){if(!e.target||e.type===`play`)return;let i=r.querySelector(`[data-slot-id="`+e.target+`"]`);if(i){if(t[e.target]!==void 0){let n=t[e.target];delete t[e.target],n?o._showSlotElement(i):o._hideSlotElement(i)}if(n[e.target]!==void 0){let t=n[e.target];delete n[e.target];let r=i.querySelector(`.oim-slot-hover-wrap`);r?r.textContent=t:i.textContent=t}}})}},function(e,t){o._activeTouchSlot&&o._activeTouchSlot.el!==e&&o._activeTouchSlot.leave(),o._activeTouchSlot={el:e,leave:t}})}C&&(A.style.backgroundColor=`transparent`,A.style.overflow=`visible`,A.style.setProperty(`padding`,`0`,`important`));let J=ta(a.flipX,a.flipY);if(J){let e=document.createElement(`div`);for(e.setAttribute(`data-oim-flip`,``),e.style.width=`100%`,e.style.height=`100%`,e.style.transformOrigin=`50% 50%`,e.style.transform=`scale(`+J[0]+`, `+J[1]+`)`;A.firstChild;)e.appendChild(A.firstChild);A.appendChild(e)}return{slotEl:A,zoneId:Ne,slot:e}}),S=await Promise.all(x),C=[],w=new Set;s.forEach(function(e,t){let n=e&&e.id!==void 0&&e.id!==null&&e.id!==``?String(e.id):``,r;n?w.has(n)?(console.warn(`[OimPlayer] Duplicate slot id "`+n+`" at index `+t+`; rendering it unkeyed and in stack order.`),r=`__oim-dup-`+n+`-`+t):r=n:(console.warn(`[OimPlayer] Slot #`+t+` has no id; rendering it unkeyed and in stack order.`,e),r=`__oim-unkeyed-`+t),w.add(r),C.push(r)});let T=new Map;S.forEach(function(e,t){if(!e)return;let n=e.slotEl,r=e.zoneId;r&&m[r]?m[r].appendChild(n):T.set(C[t],n)});let E=[];s.forEach(function(e,t){let n=h.get(String(e.id));n&&m[n]||E.push({id:C[t],type:e.type,style:e.style||{},duotone:e.type===`filter`&&v.get(String(e.id))?.effects?.some(e=>e.kind===`backdrop`&&e.preset===`duotone`),position:e.position,width_px:e.width_px,height_px:e.height_px})});let D=ti(E),O=E.some(function(e){return e.type===`mask`}),ee=E.some(function(e){return!!e.duotone});if((O||ee)&&p.appendChild(Fa(E,{width:d,height:f})),D.forEach(function(e){Ia(e,p,T)}),n?S.forEach(function(e){if(!e)return;let t=e.slotEl.getAttribute(`data-slot-id`)||``,n=r.querySelector(`[data-slot-id="`+t+`"]`);if(n&&n.parentNode){let t=n.querySelectorAll(`[data-oim-group] > [data-slot-id], :scope > [data-slot-id]`);for(let n=0;n<t.length;n++)e.slotEl.appendChild(t[n]);n.parentNode.replaceChild(e.slotEl,n)}}):(r.innerHTML=``,r.appendChild(p)),_.size>0){let e=function(e){for(let t in m)if(m[t]&&m[t].contains(e))return!0;return!1};_.forEach(function(t,n){let i=r.querySelector(`[data-slot-id="`+n+`"]`);if(!i||e(i))return;let a=i.querySelector(`[data-oim-group="`+n+`"]`)||i;t.forEach(function(t){let n=r.querySelector(`[data-slot-id="`+t+`"]`);n&&!e(n)&&a.appendChild(n)})})}try{await Promise.all(u)}catch(e){console.warn(`[OIM Player] Font load fallback activado.`,e)}r.querySelectorAll(`.oim-slot`).forEach(function(e){e.style.opacity=e.dataset.oimOpacity===void 0?`1`:e.dataset.oimOpacity}),await o._mediaSettled(r),o._buildA11y(),o.updateViewportSize(),o.updateScale(),o._viewport&&(o._viewport.classList.add(`oim-viewport--ready`),o._revealed=!0,o.sceneReady())}_defineLayerGrain(e,t){let n=this._viewport||this._overlay;if(!n||typeof DOMParser>`u`)return;let r=n.querySelector(`:scope > svg.oim-grain-defs > defs`);if(!r){let e=`http://www.w3.org/2000/svg`,t=document.createElementNS(e,`svg`);t.setAttribute(`class`,`oim-grain-defs`),t.setAttribute(`width`,`0`),t.setAttribute(`height`,`0`),t.setAttribute(`aria-hidden`,`true`),t.setAttribute(`style`,`position:absolute;pointer-events:none`),r=document.createElementNS(e,`defs`),t.appendChild(r),n.appendChild(t)}let i=r.querySelector(`#`+e);i&&i.remove();let a=Mi(e,{intensity:t.intensity,size:t.size,blend:t.blend}),o=new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg"><defs>`+a+`</defs></svg>`,`image/svg+xml`).querySelector(`filter`);o&&r.appendChild(document.importNode(o,!0))}_revealed=!1;_mediaSettled(e){let t=[];e.querySelectorAll(`img`).forEach(function(e){typeof e.decode==`function`&&e.getAttribute(`src`)&&t.push(e.decode().catch(function(){}))}),(this._lottieInstances||[]).forEach(function(e){let n=e.inst;n&&!n.isLoaded&&typeof n.addEventListener==`function`&&t.push(new Promise(function(e){n.addEventListener(`DOMLoaded`,e),n.addEventListener(`data_failed`,e)}))});let n=new Promise(function(e){setTimeout(e,La)});return Promise.race([Promise.all(t),n]).then(()=>new Promise(function(e){typeof requestAnimationFrame==`function`?requestAnimationFrame(function(){requestAnimationFrame(function(){e()})}):e()}))}_pendingDOMUpdates=new Map;_isUpdateScheduled=!1;_updateCallbacks=[];queueUpdate(e,t,n){let r={};for(let[e,n]of Object.entries(t))(typeof n==`string`||n===void 0)&&(r[e]=n);this._pendingDOMUpdates.set(e,{...this._pendingDOMUpdates.get(e)||{},...r}),n&&this._updateCallbacks.push(n),this._isUpdateScheduled||(this._isUpdateScheduled=!0,requestAnimationFrame(()=>this._flushDOMUpdates()))}_flushDOMUpdates(){this._pendingDOMUpdates.forEach((e,t)=>{for(let[n,r]of Object.entries(e))n.startsWith(`--`)?r===``||r==null?t.style.removeProperty(n):t.style.setProperty(n,String(r)):t.style[n]=r}),this._pendingDOMUpdates.clear(),this._isUpdateScheduled=!1;let e=this._updateCallbacks;this._updateCallbacks=[],e.forEach(e=>{try{e()}catch(e){console.error(e)}})}_hideSlotElement(e){this.disableAnimations?this.queueUpdate(e,{display:`none`,opacity:`0`,pointerEvents:`none`}):this.queueUpdate(e,{pointerEvents:`none`},()=>{this._runReveal(e,!1,()=>this.queueUpdate(e,{display:`none`}))})}_showSlotElement(e){this.disableAnimations?this.queueUpdate(e,{display:`flex`,opacity:`1`,pointerEvents:`auto`}):this.queueUpdate(e,{display:`flex`,pointerEvents:`auto`},()=>this._runReveal(e,!0))}_playTimeline(e){let t=this._timelines.get(e);t?(t.currentTime=0,this._paused||t.play()):!this.disableAnimations&&!this._warnedPlay.has(e)&&(this._warnedPlay.add(e),console.warn(`[OimPlayer] play: no animation`,e))}_runReveal(e,t,n){let r=this._revealAnims.get(e),i=r?getComputedStyle(e):void 0;r&&(r.cancel(),this._revealAnims.delete(e)),e.style.opacity=t?`1`:`0`;let a=vi(e._oimReveal,t);if(typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches||a.duration===0||typeof e.animate!=`function`){n?.();return}let o=_i(a.effect,t);if(i)for(let e of[`opacity`,`translate`,`scale`]){let t=i[e];t&&t!==`none`&&(o[0][e]=t)}let s=e.animate(o,{duration:a.duration,easing:a.easing,fill:`both`});this._paused&&s.pause(),this._revealAnims.set(e,s),s.onfinish=()=>{this._revealAnims.delete(e),s.cancel(),n?.()}}_buildA11y(){let e=this._viewport;if(!e||!this.metadata)return;let t=this.metadata,n=t.lang&&t.lang[0]||t.languages&&t.languages[0]||this.lang,r=this._a11yHidden,i=this._a11yShown,a=Zi((t.slots||t.elements||[]).filter(function(e){return!r.has(String(e&&e.id))}).map(function(e){return i.has(String(e&&e.id))?Object.assign({},e,{style:Object.assign({},e.style,{isVisible:!0})}):e}),this.lang,n,!this.disableActions);this._overlay&&this._overlay.setAttribute(`aria-hidden`,`true`),e.setAttribute(`role`,`figure`),e.setAttribute(`aria-label`,Qi(t,a,this.lang,n));let o=e.querySelector(`.oim-a11y`);o||(o=document.createElement(`div`),o.className=`oim-a11y`,o.style.cssText=`position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap`,e.appendChild(o)),o.textContent=``;let s=this;a.forEach(function(e){let t;if(e.type===`text`)t=document.createElement(`p`),t.setAttribute(`lang`,e.lang),t.textContent=e.text;else if(e.type===`image`)t=document.createElement(`span`),t.setAttribute(`role`,`img`),t.setAttribute(`aria-label`,e.label);else{t=document.createElement(`button`),t.setAttribute(`type`,`button`),t.textContent=e.label;let n=function(){let t=s._overlay&&s._overlay.querySelector(`[data-slot-id="`+CSS.escape(e.slotId)+`"]`);t&&t.click()};t.addEventListener(`click`,n),t.addEventListener(`keydown`,function(e){(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n())})}o.appendChild(t)})}_a11yHidden=new Set;_a11yShown=new Set;executeToggleState(e){if(!e)return;let t=this.host.shadowRoot;if(!t)return;let n=this,r=e.hide_slots||[];r.forEach(function(e){let r=t.querySelector(`[data-slot-id="`+e+`"]`);r&&n._hideSlotElement(r)});let i=e.show_slots||[];i.forEach(function(e){let r=t.querySelector(`[data-slot-id="`+e+`"]`);r&&n._showSlotElement(r)}),r.forEach(function(e){n._a11yHidden.add(String(e)),n._a11yShown.delete(String(e))}),i.forEach(function(e){n._a11yShown.add(String(e)),n._a11yHidden.delete(String(e))}),this._buildA11y()}_activeTouchSlot=null;clearSlots(){this._activeTouchSlot&&=null;let e=this._overlay;e&&(e.replaceChildren?e.replaceChildren():e.innerHTML=``)}setLang(e){if(this.lang===e)return;let t=this.lang;this.lang=e,this.host.setAttribute(`lang`,e),this._buildA11y();let n=this._classifyLangChange(t,e);(n.styleOnly.size>0||n.content.size>0)&&(this._prefersLessMotion()||this._isLowTierOrMobile()?this._switchWithFade(n):this._switchWithBlur(n)),this.host.dispatchEvent(new CustomEvent(`oim:langchange`,{detail:{lang:e}}))}_isLowTierOrMobile(){let e=this.host;if(e&&typeof e.getAttribute==`function`){let t=e.getAttribute(`tier`)||e.getAttribute(`quality`);if(t===`low`)return!0;if(t===`high`)return!1}return this._deviceProfile.isMobile||this._deviceProfile.tier===`low`}_prefersLessMotion(){try{return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}catch{return!1}}_switchWithBlur(e){let t=this._viewport,n=this;t?(t.style.transition=`filter 0.18s ease-out`,t.style.filter=`blur(14px)`,setTimeout(function(){let r=n._applyLangChange(e),i=new Promise(function(e){setTimeout(e,600)});Promise.race([r||Promise.resolve(),i]).then(function(){t.style.transition=`filter 0.32s ease-in-out`,t.style.filter=`none`})},180)):this._applyLangChange(e)}_switchWithFade(e){let t=this.host.shadowRoot,n=this,r=new Set([...e.styleOnly,...e.content]),i=[];t&&r.forEach(function(e){let n=t.querySelector(`[data-slot-id="`+e+`"]`);n&&!/opacity/i.test(n.style.animationName||``)&&i.push(n)}),i.forEach(function(e){e.style.transition=`opacity 0.12s linear`,e.style.opacity=`0`}),setTimeout(function(){n._applyLangChange(e),t&&r.forEach(function(e){let n=t.querySelector(`[data-slot-id="`+e+`"]`);n&&(n.style.opacity=n.dataset.oimOpacity===void 0?`1`:n.dataset.oimOpacity)})},120)}_classifyLangChange(e,t){let n=new Set,r=new Set;return this.metadata&&(this.metadata.slots||this.metadata.elements||[]).forEach(function(i){if(!i||i.id===void 0||i.id===null)return;let a=Fe(i,e,t);a===`content`?r.add(String(i.id)):a===`style-only`&&n.add(String(i.id)),Array.isArray(i.languages)&&!i.languages.includes(`*`)&&i.languages.includes(e)!==i.languages.includes(t)&&n.add(String(i.id))}),{styleOnly:n,content:r}}_applyLangChange(e){let t=this.host.shadowRoot;if(t&&e.styleOnly.size>0&&this.metadata){let n=this.metadata.slots||this.metadata.elements||[],r=this;n.forEach(function(n){if(!n||!e.styleOnly.has(String(n.id)))return;let i=t.querySelector(`[data-slot-id="`+n.id+`"]`);if(!i)return;Array.isArray(n.languages)&&!n.languages.includes(`*`)&&(i.style.display=n.languages.includes(r.lang)?``:`none`);let a=Pe(n,r.lang),o=n.type===`text`?He(Le(r.metadata).get(String(n.id)),r.lang):void 0;i.style.fontSize=o?.fontSize??a.size,i.style.maxWidth=o?.maxWidth??a.maxWidthValue})}return e.content.size>0?this.renderSlots({onlyIds:e.content}):null}play(){this._paused=!1,this._isStill()||(this._animations.forEach(function(e){try{e.play()}catch{}}),this._lottieInstances&&this._lottieInstances.forEach(function(e){try{e.inst.play()}catch{}}),this._textAnimations.forEach(function(e){e.play()}),this._revealAnims.forEach(function(e){e.play()}),this._heldTimelines.forEach(function(e){e.play()}),this._heldTimelines.clear())}pause(){this._paused=!0,this._textAnimations.forEach(function(e){e.pause()}),this._revealAnims.forEach(function(e){e.pause()});let e=this._heldTimelines;this._timelines.forEach(function(t){t.playState===`running`&&t.effect?.getTiming().iterations!==1/0&&(t.pause(),e.add(t))}),this._animations.forEach(function(e){try{e.pause()}catch{}}),this._lottieInstances&&this._lottieInstances.forEach(function(e){try{e.inst.pause()}catch{}})}_bornPausedIfNeeded(e,t){this._paused&&t.pause(),e.push(t)}_destroyLottiesIn(e){if(!this._lottieInstances)return;let t=[];this._lottieInstances.forEach(function(n){if(e.has(n.slotId))try{n.inst.destroy()}catch{}else t.push(n)}),this._lottieInstances=t}};function za(e){return(e.on===`loop`||e.on===`action`)&&!!e.tracks&&e.tracks.some(e=>Ba[e.property]!==void 0)}var Ba={x:0,y:0,rotation:0,scale:1,opacity:1,blur:0},Va=[`x`,`y`,`rotation`,`scale`];function Ha(e,t,n){if(!e)return n;let r=e.keyframes,i=r.find(e=>e.t===t);if(i)return i.v;let a=r.findIndex(e=>e.t>t);if(a<=0)return a===0?r[0].v:r[r.length-1].v;let o=r[a-1],s=r[a];return o.v+(s.v-o.v)*(t-o.t)/(s.t-o.t)}function Ua(e){let t=t=>e.find(e=>e.property===t),n=Va.some(e=>t(e)),r=new Map;for(let t of e)if(Ba[t.property]!==void 0)for(let e of t.keyframes){let n=r.get(e.t);n||r.set(e.t,n={offset:e.t}),e.e!==void 0&&(n.easing=hi(e.e,`linear`)),t.property===`opacity`?n.opacity=e.v:t.property===`blur`?n.filter=e.v>0?`blur(`+e.v+`px)`:`none`:n.moves=!0}return[...r.values()].sort((e,t)=>e.offset-t.offset).map(function(e){let{moves:r,...i}=e;if(n&&r){let n=n=>Ha(t(n),e.offset,Ba[n]);i.transform=`translate(`+n(`x`)+`px, `+n(`y`)+`px) rotate(`+n(`rotation`)+`deg) scale(`+n(`scale`)+`)`}return i})}function Wa(e){if(!be(e))return e;let t=Ce(e);return t.missing.forEach(e=>console.warn(`[OimPlayer] resource "${e}" is not in the document`)),Ze(t.document)}var Ga=class extends Ra{fileMetadata=null;_posterFade=!1;constructor(e,t){super();let n=t||{};this.host=e,this.poster=n.poster===`only`?`only`:`auto`,this.lang=e.getAttribute(`lang`)||`en`,this.showControls=e.getAttribute(`show-controls`)!==`false`,this._deviceProfile=m(),this.allowZoom=n.allowZoom===!0,this.showLanguageSelector=n.showLanguageSelector!==!1,this.showSlots=n.showSlots!==!1,this.allowLottie=n.allowLottie!==!1&&e.getAttribute(`allow-lottie`)!==`false`,this.allowDynamicColors=n.allowDynamicColors!==!1&&e.getAttribute(`allow-dynamic-colors`)!==`false`;let r=o(e,n,typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches);this.disableAnimations=r.disableAnimations,this.disableActions=r.disableActions,this.dropdownBlur=n.dropdownBlur!==!1&&e.getAttribute(`dropdown-blur`)!==`false`,this.fit=n.fit||`contain`,this.align=n.align||`center`}destroy(){this.imageUrl&&URL.revokeObjectURL(this.imageUrl),this._resizeObserver&&=(this._resizeObserver.disconnect(),null),this._onFullscreenChange&&(document.removeEventListener(`fullscreenchange`,this._onFullscreenChange),document.removeEventListener(`webkitfullscreenchange`,this._onFullscreenChange),document.removeEventListener(`mozfullscreenchange`,this._onFullscreenChange),document.removeEventListener(`MSFullscreenChange`,this._onFullscreenChange)),this._lottieInstances&&=(this._lottieInstances.forEach(function(e){try{e.inst.destroy()}catch{}}),[]),this._animations.forEach(function(e){try{e.cancel()}catch{}}),this._animations=[],this._timelines.clear(),this._revealAnims.clear(),this._heldTimelines.clear(),this._textAnimations.forEach(function(e){try{e.stop()}catch{}}),this._textAnimations=[],this._onDragMove&&=(window.removeEventListener(`mousemove`,this._onDragMove),null),this._onDragEnd&&=(window.removeEventListener(`mouseup`,this._onDragEnd),null)}async load(e){let t=this.host,n=t.shadowRoot||t.attachShadow({mode:`open`});try{if(typeof e==`string`?this.imageUrl=e:(this.imageUrl&&this.imageUrl.startsWith(`blob:`)&&URL.revokeObjectURL(this.imageUrl),this.imageUrl=URL.createObjectURL(e)),t.classList.add(`oim-player-host`),t.classList.add(`oim-align-`+this.align),t.classList.add(`oim-tier-`+this._deviceProfile.tier),this._deviceProfile.isMobile&&t.classList.add(`oim-mobile`),n.innerHTML=`<div class="oim-player-viewport oim-fit-`+this.fit+`" part="viewport"><img class="oim-player-base" crossorigin="anonymous" src="`+this.imageUrl+`" alt="" aria-hidden="true" part="base" /><div class="oim-layer-overlay" aria-hidden="true" part="overlay"></div></div>`,ee(n),this._viewport=n.querySelector(`.oim-player-viewport`),this._baseImg=n.querySelector(`.oim-player-base`),this._overlay=n.querySelector(`.oim-layer-overlay`),this._stage=this.host,!this.allowDynamicColors&&this._viewport)for(let e of re)this._viewport.style.setProperty(`--oim-color-`+e,`initial`);this.applyPalette(),(this._prefersLessMotion()||this._isLowTierOrMobile())&&this._viewport&&(this._viewport.style.filter=`none`);let r=this,i=null,a=()=>{i||=requestAnimationFrame(()=>{r.updateViewportSize(),r.updateScale(),i=null})};typeof ResizeObserver<`u`&&this._viewport&&(this._resizeObserver&&this._resizeObserver.disconnect(),this._resizeObserver=new ResizeObserver(a),this._resizeObserver.observe(this.host)),this._onFullscreenChange=a,document.addEventListener(`fullscreenchange`,this._onFullscreenChange),document.addEventListener(`webkitfullscreenchange`,this._onFullscreenChange),document.addEventListener(`mozfullscreenchange`,this._onFullscreenChange),document.addEventListener(`MSFullscreenChange`,this._onFullscreenChange);let o=this._baseImg,c=this._viewport;function l(){c&&o&&o.naturalWidth>0&&(c.style.setProperty(`--oim-ar`,o.naturalWidth+` / `+o.naturalHeight),r._baseImg=o,r.updateViewportSize(),r.updateScale(),r.metadata&&r.renderSlots())}return o&&o.complete&&o.naturalWidth>0?l():o&&(o.onload=l),this.updateViewportSize(),this.updateScale(),this._bindViewportEvents(),D.getBlob(e).then(t=>new Promise((n,i)=>{s.requestRender(r,t,e,n,i)})).catch(e=>{if(console.error(`[OimPlayer::ImageEngine::load]`,e),String(e&&e.message).indexOf(`OIM_ALTERED`)===0){n.innerHTML=`<div class="oim-player-error oim-player-refused" part="error"></div>`,ee(n);let e=n.querySelector(`.oim-player-error`);e&&(e.textContent=u(`tampered`,r.lang))}throw t.dispatchEvent(new CustomEvent(`error`,{detail:e})),e})}catch(e){console.error(`[OimPlayer::ImageEngine]`,e),n.innerHTML=`<div class="oim-player-error" part="error"></div>`;let r=n.querySelector(`.oim-player-error`);return r&&(r.textContent=u(`loadError`,this.lang)+e.message),t.dispatchEvent(new CustomEvent(`error`,{detail:e})),!1}}async _verifyMainThread(e){let t=await ht(e);if(!t.metadata)return{metadata:{slots:[]},security:`no_metadata`,announce:!1};let n=Ut(t.metadata);if(n.length>0)return{refused:!0,security:`corrupt`,error:`Corrupted or tampered OIM file: `+n[0]};let r=!!(t.metadata.signature&&t.metadata.key_version),i=await Rt(t.metadata),a=zt({isSigned:r,isSigValid:i,keyExpired:r&&i?await Bt(t.metadata):!1,metadata:t.metadata,imageHash:t.imageHash});if(Vt(a))return{refused:!0,security:a,error:Ht+`: `+a};let o,s=!1;return i?a===`unsigned`||a===`expired_key`?o={slots:[],elements:[],layers:[]}:(s=!0,be(t.metadata)||k(t.metadata),o=t.metadata):o={slots:[]},{metadata:o,security:a,announce:s}}async _verifyWithWorker(e){let t=typeof window<`u`?window.location.hostname:``,n=typeof window<`u`?window.location.origin:``,r;try{r=await dt(e,t,n)}catch(t){return console.warn(`[OimPlayer] Web Worker unavailable or crashed (possibly blocked by CSP). Falling back to main-thread execution.`,t),this._verifyMainThread(e)}return r.success?{metadata:r.metadata,security:r.security||`unsigned`,announce:!0}:r.refused?{refused:!0,security:r.security,error:r.error}:(console.warn(`[OimPlayer] Web Worker reported execution failure. Falling back to main-thread execution.`,r.error),this._verifyMainThread(e))}async _verify(e){return typeof Worker>`u`?this._verifyMainThread(e):this._verifyWithWorker(e)}async _applyVerified(e){let t=this,n=this.poster===`only`;this._posterFade=!n&&be(e.metadata)&&!Se(e.metadata);let r=structuredClone(e.metadata);if(this.fileMetadata=r,this.metadata=n?structuredClone(r):Wa(structuredClone(r)),n||this.applyPalette(),this.securityStatus=e.security,this.securityStatus===`unsigned`){try{c(this.host,`data-oim-unsigned`,`data-oim-sin-firma`)}catch{}console.warn(`[OimPlayer] Unsigned file: painting the base image only. Interactive layers need a signature.`)}if(this.securityStatus===`expired_key`){try{c(this.host,`data-oim-key-retired`,`data-oim-clave-retirada`)}catch{}console.warn(`[OimPlayer] This work was signed with a retired key. Ask the author to export it again.`)}return n?(this._viewport?.classList.add(`oim-viewport--poster`,`oim-viewport--ready`),this.host.dispatchEvent(new CustomEvent(`oim:loaded`,{detail:{type:`image`,metadata:this.fileMetadata,security:this.securityStatus}})),!0):(e.announce&&t._announceUnsupported(this.metadata),this.embeddedFontFamilies=await sn(on(this.metadata)),this._posterFade&&this._viewport?.classList.add(`oim-viewport--poster`),this.updateViewportSize(),this.updateScale(),await this.renderSlots(),typeof document<`u`&&document.fonts&&document.fonts.ready.then(()=>{t.host&&t._overlay&&(t.updateViewportSize(),t.updateScale(),t._overlay.querySelectorAll(`.oim-slot`).forEach(e=>{let t=e.style.transition;e.style.setProperty(`transition`,`none`,`important`),e.offsetWidth,e.style.transition=t}))}),this.host.dispatchEvent(new CustomEvent(`oim:loaded`,{detail:{type:`image`,metadata:this.fileMetadata,security:this.securityStatus}})),!0)}sceneReady(){let e=this._baseImg;this._posterFade&&e&&(this._posterFade=!1,this._prefersLessMotion()?e.style.display=`none`:(e.classList.add(`oim-base--faded`),setTimeout(()=>{e.style.display=`none`},200)))}async _executeLoad(e,t){try{let n=await D.getVerified(t??e,e=>this._verify(e));if(n.refused)throw this.securityStatus=n.security,Error(n.error);return this._applyVerified(n)}catch(e){throw console.error(`[OimPlayer::ImageEngine::_executeLoad]`,e),e}}_announceUnsupported(e){let t;try{t=$t(e,{version:Yt,capabilities:Xt})}catch{return}if(!t.hasNotice)return;let n=en(t);try{console.warn(`[OimPlayer] `+n)}catch{}try{t.missingCapabilities&&t.missingCapabilities.length>0&&c(this.host,`data-oim-unsupported`,`data-oim-sin-soporte`,t.missingCapabilities.join(` `)),t.missingRequiredCapabilities&&t.missingRequiredCapabilities.length>0&&c(this.host,`data-oim-missing-required`,`data-oim-requeridas-faltantes`,t.missingRequiredCapabilities.join(` `)),t.versionTooOld&&t.requiredVersion&&c(this.host,`data-oim-required-version`,`data-oim-version-exigida`,t.requiredVersion),this.host.dispatchEvent(new CustomEvent(`oim:incomplete`,{bubbles:!0,composed:!0,detail:{message:n,mensaje:n,...t}})),t.cannotRender&&this.host.dispatchEvent(new CustomEvent(`oim:unsupported`,{bubbles:!0,composed:!0,detail:{message:n,mensaje:n,...t}}))}catch{}}updateScale(){if(!this._viewport)return;let e=this._viewport.offsetWidth,t=this.metadata&&this.metadata.canvas?this.metadata.canvas.natural_width||this.metadata.canvas.width:0,n=e/(this.metadata&&(this.metadata.artboardWidth||this.metadata.canvasWidth||this.metadata.canvas_width)||t||this._baseImg&&this._baseImg.naturalWidth||1080);this._viewport.style.setProperty(`--oim-fit`,n.toFixed(6))}updateViewportSize(){if(!this._viewport)return;let e=this._baseImg?this._baseImg.naturalWidth:0,t=this._baseImg?this._baseImg.naturalHeight:0;if(e===0&&this.metadata&&this.metadata.canvas&&(e=this.metadata.canvas.natural_width||this.metadata.canvas.width||1080,t=this.metadata.canvas.natural_height||this.metadata.canvas.height||1920),e===0)return;let n=this.host.offsetWidth,r=this.host.offsetHeight;if(n===0||r===0){if(!this._retryViewportSize){this._retryViewportSize=!0;let e=this;setTimeout(()=>{e._retryViewportSize=!1,e.updateViewportSize(),e.updateScale()},100)}return}let i=e/t,a=n/r,o,s;this.fit===`cover`?a>i?(o=n,s=n/i):(s=r,o=r*i):a>i?(s=r,o=r*i):(o=n,s=n/i),this._viewport.style.width=Math.round(o)+`px`,this._viewport.style.height=Math.round(s)+`px`}_bindViewportEvents(){let e=this,t=this._stage;if(!t)return;t.addEventListener(`pointerdown`,function(t){if(t.pointerType!==`mouse`&&e._activeTouchSlot&&(typeof t.composedPath==`function`?t.composedPath():[]).indexOf(e._activeTouchSlot.el)===-1){let t=e._activeTouchSlot;e._activeTouchSlot=null,t.leave()}});let n=!1,r=0,i=0,a=0,o=0;t.addEventListener(`mousedown`,function(s){e.allowZoom&&(e.zoom<=1||s.target.closest(`.oim-slot`)||(n=!0,e._viewport&&(e._viewport.style.transition=`none`),t.style.cursor=`grabbing`,r=s.clientX,i=s.clientY,a=e.panX,o=e.panY,s.preventDefault()))}),this._onDragMove=function(t){if(!n)return;let s=t.clientX-r,c=t.clientY-i;e.panX=a+s,e.panY=o+c,e._constrainPan(),e._applyViewportTransform()},window.addEventListener(`mousemove`,this._onDragMove),this._onDragEnd=function(){n&&(n=!1,e._viewport&&(e._viewport.style.transition=`transform 0.1s linear`),t.style.cursor=e.zoom>1?`grab`:`default`)},window.addEventListener(`mouseup`,this._onDragEnd);let s=null,c=1,l=!1,u=0,d=0,f=0,p=0;t.addEventListener(`touchstart`,function(t){if(e.allowZoom){if(t.touches.length===2)s=Ma(t.touches),c=e.zoom,l=!1,e._viewport&&(e._viewport.style.transition=`none`);else if(t.touches.length===1&&e.zoom>1){if(t.target.closest(`.oim-slot`))return;l=!0,u=t.touches[0].clientX,d=t.touches[0].clientY,f=e.panX,p=e.panY,e._viewport&&(e._viewport.style.transition=`none`)}}},{passive:!0}),t.addEventListener(`touchmove`,function(t){if(e.allowZoom){if(t.touches.length===2&&s!==null){let n=Ma(t.touches);if(s>0){let t=n/s;e.setZoom(c*t)}}else if(t.touches.length===1&&l){let n=t.touches[0].clientX-u,r=t.touches[0].clientY-d;e.panX=f+n,e.panY=p+r,e._constrainPan(),e._applyViewportTransform()}}},{passive:!0}),t.addEventListener(`touchend`,function(){s=null,l=!1,e._viewport&&(e._viewport.style.transition=`transform 0.1s linear`)},{passive:!0}),e.allowZoom&&t.addEventListener(`wheel`,function(t){t.preventDefault(),e.setZoom(Jt(e.zoom,t.deltaY,t.deltaMode,t.ctrlKey))},{passive:!1})}_constrainPan(){let e=this.host;if(!e)return;let t=e.clientWidth,n=e.clientHeight,r=this.zoom,i=Math.max(0,t*(r-1)/2),a=Math.max(0,n*(r-1)/2);this.panX=Math.max(-i,Math.min(i,this.panX)),this.panY=Math.max(-a,Math.min(a,this.panY))}_applyViewportTransform(){this._viewport&&(this._viewport.style.transform=`translate3d(`+this.panX+`px, `+this.panY+`px, 0) scale(`+this.zoom+`)`)}setZoom(e){this.zoom=Math.max(1,Math.min(4,e)),this.zoom<=1&&(this.panX=0,this.panY=0),this._constrainPan(),this._applyViewportTransform();let t=this._stage;t&&(t.style.cursor=this.zoom>1?`grab`:`default`)}};function Ka(e,t){let n=``;if(typeof e==`string`){let t=e.indexOf(`#`),r=e.indexOf(`?`),i=t===-1?r===-1?e.length:r:t,a=e.lastIndexOf(`.`,i);a!==-1&&(n=e.substring(a+1,i).toLowerCase())}else if(e&&e.name){let t=e.name,r=t.lastIndexOf(`.`);r!==-1&&(n=t.substring(r+1).toLowerCase())}if(n===`oim`||n===`png`)return`image`;if(n===`ovm`||n===`webm`||n===`mp4`||n===`mkv`)return`video`;if(t){let e=String.fromCharCode(t[0],t[1],t[2],t[3]);if(e===`PNG`)return`image`;if(e===`OVM\0`||e===`Eߣ`)return`video`}return`image`}function qa(e){if(!e)return null;let t=e.trim();if(/^data:image\//i.test(t))return t;try{let e=new URL(t,document.baseURI);return e.protocol===`http:`||e.protocol===`https:`||e.protocol===`blob:`?e.href:null}catch{return null}}var Q=Object.create(HTMLElement.prototype);function Ja(){if(typeof document>`u`||document.getElementById(`oim-player-gap`))return;let e=document.createElement(`style`);e.id=`oim-player-gap`,e.textContent=`:where(oim-player){display:block}:where(oim-player:not([data-oim-loaded])){min-height:200px}`,(document.head||document.documentElement).appendChild(e)}Q.connectedCallback=function(){Ja(),this.classList.add(`oim-player-host`),this._engine=null,this._src=this.getAttribute(`src`),this._oimOptions||={},this.hasAttribute(`fit`)&&(this._oimOptions.fit=this.getAttribute(`fit`)),this.hasAttribute(`align`)&&(this._oimOptions.align=this.getAttribute(`align`)),this.hasAttribute(`dropdown-blur`)&&(this._oimOptions.dropdownBlur=this.getAttribute(`dropdown-blur`)!==`false`),this.hasAttribute(`allow-lottie`)&&(this._oimOptions.allowLottie=this.getAttribute(`allow-lottie`)!==`false`),this.hasAttribute(`allow-dynamic-colors`)&&(this._oimOptions.allowDynamicColors=this.getAttribute(`allow-dynamic-colors`)!==`false`),this.hasAttribute(`placeholder`)&&(this._oimOptions.placeholder=this.getAttribute(`placeholder`)),this.hasAttribute(`poster`)&&(this._oimOptions.poster=this.getAttribute(`poster`)),this.hasAttribute(`allow-zoom`)&&(this._oimOptions.allowZoom=this.getAttribute(`allow-zoom`)===`true`),this._syncPlaceholder(),this._mqOscuro=typeof matchMedia==`function`?matchMedia(`(prefers-color-scheme: dark)`):null,this._onEsquema=()=>this._engine&&this._engine.applyPalette(),this._mqOscuro&&this._mqOscuro.addEventListener(`change`,this._onEsquema),this._replantearActividad()},Q._replantearActividad=function(){if(this._src&&this.isConnected){if(!this._observers){if(!(`IntersectionObserver`in window)){this._moveTo(`active`);return}let e=this,t=()=>e._scheduleDecision();this._observers=[new IntersectionObserver(n=>{let r=n[0];r&&typeof r.isIntersecting==`boolean`&&(e._isNear=r.isIntersecting),t()},{rootMargin:`200px`}),new IntersectionObserver(n=>{let r=n[0];r&&typeof r.isIntersecting==`boolean`&&(e._isVisible=r.isIntersecting),t()},{threshold:[0,.01]})],this._observers.forEach(e=>e.observe(this)),this._onTabChange=t,document.addEventListener(`visibilitychange`,this._onTabChange),this.getAttribute(`activate-on`)===`hover`&&(this._onPointerEnter=()=>{e._hasPointer=!0,t()},this._onPointerLeave=()=>{e._hasPointer=!1,t()},this.addEventListener(`mouseenter`,this._onPointerEnter),this.addEventListener(`mouseleave`,this._onPointerLeave))}this._scheduleDecision()}},Q._scheduleDecision=function(){if(this._activityFrame)return;let e=this;this._activityFrame=requestAnimationFrame(function(){e._activityFrame=null,e._decide()})},Q._decide=function(){if(!this._src||!this.isConnected)return;let e=typeof document<`u`&&document.visibilityState===`hidden`,t,n;if(typeof this._isNear==`boolean`||typeof this._isVisible==`boolean`){t=this._isNear??!1;let r=this._isVisible??!1;n=(t||r)&&r&&!e,t||=r}else{let r=this.getBoundingClientRect(),i=window.innerHeight||0;t=r.bottom>-200&&r.top<i+200,n=t&&!e&&r.bottom>0&&r.top<i}this.getAttribute(`activate-on`)===`hover`&&typeof matchMedia==`function`&&matchMedia(`(hover: hover)`).matches&&(n&&=!!this._hasPointer),this.getAttribute(`activate-on`)===`manual`&&(n=!1),this._moveTo(n?`active`:t?`ready`:`dormant`)},Q._moveTo=function(e){this._activityState!==e&&(this._activityState=e,e!==`dormant`&&(this._engine||this._initPlayer(),e===`active`?this.play():this.pause()))},Q._startAutoRotateLang=function(){this._stopAutoRotateLang();let e=this.getAttribute(`auto-rotate-lang`);if(!e||e===`false`||this.classList.contains(`oim-player-paused`))return;let t=parseInt(e,10);(isNaN(t)||t<=0)&&(t=3e3);let n=this;this._autoRotateIntervalId=setInterval(()=>{let e=n._engine?n._engine.metadata:null;if(!e)return;let t=e.slots||e.elements||[],r={};for(let e=0;e<t.length;e++){let n=t[e].content||{};Object.keys(n).forEach(e=>{r[e.toLowerCase()]=!0})}let i=Object.keys(r).sort();if(i.length<=1)return;let a=(n.getAttribute(`lang`)||n._engine&&n._engine.lang||`en`).toLowerCase(),o=i[(i.indexOf(a)+1)%i.length];n.setAttribute(`lang`,o)},t)},Q._stopAutoRotateLang=function(){this._autoRotateIntervalId&&=(clearInterval(this._autoRotateIntervalId),null)},Q.disconnectedCallback=function(){this._mqOscuro&&=(this._mqOscuro.removeEventListener(`change`,this._onEsquema),null),this._stopAutoRotateLang(),this._observers&&=(this._observers.forEach(e=>e.disconnect()),null),this._onTabChange&&=(document.removeEventListener(`visibilitychange`,this._onTabChange),null),this._onPointerEnter&&(this.removeEventListener(`mouseenter`,this._onPointerEnter),this.removeEventListener(`mouseleave`,this._onPointerLeave),this._onPointerEnter=null,this._onPointerLeave=null),this._activityFrame&&=(cancelAnimationFrame(this._activityFrame),null),this._isNear=null,this._isVisible=null,this._activityState=`dormant`,this._engine&&this._engine.destroy&&this._engine.destroy()},Q.attributeChangedCallback=function(e,t,n){if(e===`placeholder`&&t!==n)this._oimOptions||={},this._oimOptions.placeholder=n,this._syncPlaceholder();else if(e===`poster`&&t!==n)this._oimOptions||={},this._oimOptions.poster=n,this._engine&&this._initPlayer();else if(e===`palette`&&t!==n)this._engine&&this._engine.applyPalette();else if(e===`src`&&t!==n)this._src=n,this._engine?this._initPlayer():this._replantearActividad();else if(e===`activate-on`&&t!==n)this._replantearActividad();else if(e===`lang`&&t!==n)this._engine&&this._engine.setLang&&this._engine.setLang(n);else if((e===`fit`||e===`align`)&&t!==n)this._oimOptions||={},this._oimOptions[e]=n,this._syncPlaceholder(),this._initPlayer();else if(e===`dropdown-blur`&&t!==n)this._oimOptions||={},this._oimOptions.dropdownBlur=n!==`false`,this._engine&&(this._engine.dropdownBlur=n!==`false`);else if(e===`allow-lottie`&&t!==n)this._oimOptions||={},this._oimOptions.allowLottie=n!==`false`,this._engine&&(this._engine.allowLottie=n!==`false`,this._engine.renderSlots&&this._engine.renderSlots());else if(e===`auto-rotate-lang`&&t!==n)this._startAutoRotateLang();else if((e===`mode`||e===`disable-animations`||e===`disable-actions`)&&t!==n){if(this._engine){let e=typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,t=o(this,this._oimOptions||{},!!e);this._engine.disableAnimations=t.disableAnimations,this._engine.disableActions=t.disableActions,this._engine.renderSlots&&this._engine.renderSlots()}}else e===`show-slots`&&t!==n&&(this._oimOptions||={},this._oimOptions.showSlots=n!==`false`,this._engine&&(this._engine.showSlots=n!==`false`,this._engine.renderSlots&&this._engine.renderSlots()))},Q._syncPlaceholder=function(){let e=this._engine||this._placeholderSettled?null:qa(this._oimOptions&&this._oimOptions.placeholder);if(!e){this._removePlaceholder();return}let t=this.shadowRoot||this.attachShadow({mode:`open`});if(!t.querySelector(`img.oim-placeholder`)){let e=document.createElement(`style`);e.className=`oim-placeholder-style`,e.textContent=`:host{position:relative}`;let n=document.createElement(`img`);n.className=`oim-placeholder`,n.alt=``,n.decoding=`async`,n.addEventListener(`error`,()=>this._removePlaceholder()),t.append(e,n)}let n=t.querySelector(`img.oim-placeholder`),r=this._oimOptions&&this._oimOptions.fit===`cover`?`cover`:`contain`,i=this._oimOptions&&this._oimOptions.align,a=i===`top`?`center top`:i===`bottom`?`center bottom`:`center center`;n.setAttribute(`style`,`position:absolute;inset:0;width:100%;height:100%;object-fit:${r};object-position:${a}`),n.getAttribute(`src`)!==e&&n.setAttribute(`src`,e)},Q._removePlaceholder=function(){this.shadowRoot&&this.shadowRoot.querySelectorAll(`.oim-placeholder, .oim-placeholder-style`).forEach(e=>e.remove())},Q._initPlayer=function(){if(!this._src)return;this._loading=!0;let e=this,t=this._src;e._oimOptions||={},e.hasAttribute(`fit`)&&(e._oimOptions.fit=e.getAttribute(`fit`)),e.hasAttribute(`align`)&&(e._oimOptions.align=e.getAttribute(`align`)),e.hasAttribute(`dropdown-blur`)&&(e._oimOptions.dropdownBlur=e.getAttribute(`dropdown-blur`)!==`false`),e.hasAttribute(`placeholder`)&&(e._oimOptions.placeholder=e.getAttribute(`placeholder`)),e.hasAttribute(`poster`)&&(e._oimOptions.poster=e.getAttribute(`poster`)),e.hasAttribute(`allow-lottie`)&&(e._oimOptions.allowLottie=e.getAttribute(`allow-lottie`)!==`false`),e.hasAttribute(`allow-zoom`)&&(e._oimOptions.allowZoom=e.getAttribute(`allow-zoom`)===`true`);let n;n=t instanceof Blob?t.slice(0,16).arrayBuffer().then(e=>new Uint8Array(e)).catch(()=>null):D.sniff(t),n.then(n=>{if(!e.isConnected)return;let r=Ka(t,n);e._engine&&e._engine.destroy&&e._engine.destroy(),r===`video`&&console.warn(`[OimPlayer] Video media detected. Video support has been migrated to <ovm-player> from @oim-media/player-ovm. Falling back to ImageEngine.`),e._engine=new Ga(e,e._oimOptions),e._loading=!1,e.classList.contains(`oim-player-paused`)&&e._engine.pause(),c(e,`data-oim-loaded`,`data-oim-cargado`);let i=()=>{e._placeholderSettled=!0,e._syncPlaceholder()};e._engine.load(t).then(()=>{i(),e._startAutoRotateLang()}).catch(e=>{i(),console.warn(`[OimPlayer] Engine load error during auto-rotate initialization:`,e)})})},Q._wake=function(){this._engine||this._loading||!this._src||this._initPlayer()},Q.getMetadata=function(){return this._wake(),this._engine?this._engine.fileMetadata:null},Q.getSecurityStatus=function(){return this._wake(),this._engine?this._engine.securityStatus||`unsigned`:null},Q.setLang=function(e){this._wake(),this._engine&&this._engine.setLang&&this._engine.setLang(e)},Q.setZoom=function(e){this._engine&&this._engine.setZoom&&this._engine.setZoom(e)},Q.play=function(){this._wake(),this.classList.remove(`oim-player-paused`),this._engine&&this._engine.play&&this._engine.play(),this._startAutoRotateLang()},Q.pause=function(){this.classList.add(`oim-player-paused`),this._engine&&this._engine.pause&&this._engine.pause(),this._stopAutoRotateLang()},Q.seek=function(e){this._engine&&this._engine.seek&&this._engine.seek(e)},Q.getEngine=function(){return this._engine},Q.destroy=function(){this._engine&&this._engine.destroy&&(this._engine.destroy(),this._engine=null),this.parentNode&&this.parentNode.removeChild(this)};var Ya=[`src`,`placeholder`,`poster`,`lang`,`activate-on`,`fit`,`align`,`dropdown-blur`,`allow-lottie`,`palette`,`auto-rotate-lang`,`disable-animations`,`disable-actions`,`mode`,`show-slots`],$;typeof customElements<`u`&&!customElements.get(`oim-player`)&&($=class extends HTMLElement{_engine=null;_src=null},$.prototype.connectedCallback=Q.connectedCallback,$.prototype.disconnectedCallback=Q.disconnectedCallback,$.prototype.attributeChangedCallback=Q.attributeChangedCallback,$.prototype.getMetadata=Q.getMetadata,$.prototype.getSecurityStatus=Q.getSecurityStatus,$.prototype.setLang=Q.setLang,$.prototype.setZoom=Q.setZoom,$.prototype.play=Q.play,$.prototype.pause=Q.pause,$.prototype.seek=Q.seek,$.prototype.getEngine=Q.getEngine,$.prototype._initPlayer=Q._initPlayer,$.prototype._syncPlaceholder=Q._syncPlaceholder,$.prototype._removePlaceholder=Q._removePlaceholder,$.prototype._replantearActividad=Q._replantearActividad,$.prototype._decide=Q._decide,$.prototype._scheduleDecision=Q._scheduleDecision,$.prototype._moveTo=Q._moveTo,$.prototype._wake=Q._wake,$.prototype._startAutoRotateLang=Q._startAutoRotateLang,$.prototype._stopAutoRotateLang=Q._stopAutoRotateLang,$.prototype.destroy=Q.destroy,$.observedAttributes=Ya,Object.defineProperty($.prototype,"src",{get:function(){return this._src},set:function(e){this._src=e,typeof e==`string`?this.setAttribute(`src`,e):this._initPlayer()}}),Object.defineProperty($.prototype,"languages",{get:function(){if(!this._engine||!this._engine.metadata)return[];let e=this._engine.metadata.slots||this._engine.metadata.elements||[],t={};for(let n=0;n<e.length;n++){let r=e[n].content||{};Object.keys(r).forEach(e=>{t[e.toLowerCase()]=!0})}return Object.keys(t).sort()}}),Object.defineProperty($.prototype,"currentLang",{get:function(){return this._engine?this._engine.lang:this.getAttribute(`lang`)||`en`}}),Object.defineProperty($.prototype,"lang",{get:function(){return this._engine?this._engine.lang:this.getAttribute(`lang`)||`en`},set:function(e){this.setAttribute(`lang`,e)}}),customElements.define(`oim-player`,$)),window.OimPlayerElement=Q;var Xa={mount:function(e,t,n){let r=typeof e==`string`?document.getElementById(e):e;if(!r)return console.error(`[OimPlayer.mount] Container not found:`,e),null;let i=document.createElement(`oim-player`);return i._oimOptions=n||{},i.src=t,i.setAttribute(`show-controls`,n&&n.showLanguageSelector===!1?`false`:`true`),n&&n.allowLottie===!1&&i.setAttribute(`allow-lottie`,`false`),r.replaceChildren?r.replaceChildren(i):(r.innerHTML=``,r.appendChild(i)),i}},Za=Xa.mount;return window.OimPlayer=Xa,e.OimPlayer=Xa,e.default=Xa,e.OimPlayerElement=Q,e.mount=Za,e})({});
|
|
115
|
+
`){e.appendChild(document.createElement(`br`));continue}let o=document.createElement(`span`);o.textContent=a===` `?`\xA0`:a,o.style.display=`inline-block`,o.style.animationName=oi,o.style.animationDuration=ai+`s`,o.style.animationTimingFunction=`linear`,o.style.animationIterationCount=`infinite`,o.style.animationDelay=ci(t,n,r)+`s`,e.appendChild(o)}}function wa(e,t,n,r,i){e.textContent=``,An(t,n).forEach((t,a)=>{if(/^\s+$/.test(t)){e.appendChild(document.createTextNode(t));return}let o=document.createElement(`span`);o.textContent=t,o.className=`oim-entrance`;let s=o.style;if(s.display=`inline-block`,s.animation=`oim-entrance-${n} ${Tn}s linear ${jn(a,r,i)}s both`,!kn(n)){e.appendChild(o);return}let c=document.createElement(`span`);c.className=`oim-entrance-clip`,c.style.display=`inline-block`,c.style.overflow=`hidden`,c.style.verticalAlign=`top`,c.appendChild(o),e.appendChild(c)})}function Ta(e,t){if(!e)return;let n=`oim-entrance-`+t;if(e.getElementById(n))return;let r=Nn(t),i=r.some(e=>e.rotateDeg!==0),a=r.map((e,t)=>`${t*100/(r.length-1)}%{opacity:${e.opacity};transform:translateY(${e.translateYEm}em) scale(${e.scale})${i?` rotate(${e.rotateDeg}deg)`:``}}`).join(``),o=document.createElement(`style`);o.id=n,o.textContent=`@keyframes ${n}{${a}}@media (prefers-reduced-motion: reduce){.oim-entrance{animation:none!important}}`,e.appendChild(o)}function Ea(e){if(!e)return;let t=`oim-wave-keyframes`;if(e.getElementById(t))return;let n=document.createElement(`style`);n.id=t,n.textContent=si(),e.appendChild(n)}function Da(e,t,n){let r=0,i=performance.now(),a=null,o=()=>r+(a===null?0:performance.now()-i),s=()=>t(o()/1e3),c=()=>{a===null&&(i=performance.now(),a=setInterval(s,e))},l=()=>{a!==null&&(r=o(),clearInterval(a),a=null)};return c(),{pause:l,play:c,stop:()=>{l(),n?.()}}}function Oa(e,t,n=20,r=0,i=!0){let a=a=>{let o=yi(t,a,n,r,i,!1);e.textContent=o.visibleText+(o.showCursor?`|`:``)};return a(0),Da(40,a)}function ka(e,t,n,r=1,i=0,a=50){e.textContent=``,e.style.display=`inline-block`,e.style.position=`relative`;let o=()=>{let e=document.createElement(`span`);return e.textContent=t,e},s=pi(n,fi(0)).copies.map(e=>{let t=o();t.setAttribute(`aria-hidden`,`true`);let n=t.style;return n.position=`absolute`,n.left=`0`,n.top=`0`,n.width=`100%`,n.height=`100%`,n.pointerEvents=`none`,n.opacity=`0`,e.color&&(n.color=e.color),t}),c=o();c.style.position=`relative`,n===`glitch-slice`?e.append(c,...s):e.append(...s,c);let l=t=>{let o=pi(n,fi(t,r,i,a));e.style.transform=o.skewX?`skewX(${o.skewX}deg)`:`none`,o.copies.forEach((e,t)=>{let n=s[t].style;n.opacity=String(e.opacity),n.transform=`translate(${e.dx}px, ${e.dy}px)`,e.clip&&(n.clipPath=`inset(${e.clip.top}% 0 ${100-e.clip.bottom}% 0)`)})};return Da(33,l,()=>l(0))}function Aa(e,t){if(!t?.enabled)return;let n=t.color||`rgba(245,158,11,.35)`,r=t.style===`underline-thick`,i=e.style;i.backgroundColor=r?`transparent`:n,r&&(i.boxShadow=`inset 0 -.4em 0 ${n}`),i.borderRadius=t.style===`pill`?`9999px`:t.style===`box`?`0`:`${t.borderRadius??3}px`,i.padding=`${t.paddingY??2}px ${t.paddingX??4}px`,i.boxDecorationBreak=i.webkitBoxDecorationBreak=`clone`}function ja(e,t,n,r){if(!n?.enabled||!t)return!1;let{letter:i,rest:a}=xn(t,Object.keys(r??{}));if(!i)return!1;let o=document.createElement(`span`),s=o.style,c=bn(n);return o.textContent=i,s.float=`left`,s.fontSize=`${c.scale}em`,s.lineHeight=String(c.lineHeight),s.marginRight=`${c.marginRight}px`,c.fontFamily&&(s.fontFamily=c.fontFamily),c.color&&(s.color=c.color),s.fontWeight=String(c.fontWeight),s.userSelect=`none`,yn(e,a,r),e.prepend(o),!0}function Ma(e){if(e.length<2)return 0;let t=e[0].clientX-e[1].clientX,n=e[0].clientY-e[1].clientY;return Math.sqrt(t*t+n*n)}function Na(e,t){let n=(e||``).replace(`#`,``),r=parseInt(n.substring(t*2,t*2+2),16)||0;return Math.round(r/255*1e3)/1e3}function Pa(e,t){let n=`http://www.w3.org/2000/svg`,r=e.style||{},i=t.width,a=t.height,o=Array.isArray(e.position)?e.position:[0,0],s=typeof e.x==`number`?e.x:Number(o[0])/100*i,c=typeof e.y==`number`?e.y:Number(o[1])/100*a,l=document.createElementNS(n,`svg`);l.setAttribute(`viewBox`,`0 0 `+i+` `+a),l.setAttribute(`preserveAspectRatio`,`none`),l.style.position=`absolute`,l.style.left=-s+`px`,l.style.top=-c+`px`,l.style.width=i+`px`,l.style.height=a+`px`,l.style.flex=`none`,l.style.overflow=`visible`,l.style.display=`block`,l.style.pointerEvents=`none`;let u=document.createElementNS(n,`path`);u.setAttribute(`d`,Jr(e,t)),u.setAttribute(`fill`,P(r.maskBgColorRole||r.fillColorRole,r.maskBgColor||`#38BDF8`)),u.setAttribute(`fill-rule`,`evenodd`),l.appendChild(u);let d=r.maskStrokeWidth??0;if(d>0){let i=document.createElementNS(n,`path`);i.setAttribute(`d`,Yr(e,t)),i.setAttribute(`fill`,`none`),i.setAttribute(`stroke`,P(r.maskStrokeColorRole||r.strokeColorRole,r.maskStrokeColor||`#FFFFFF`)),i.setAttribute(`stroke-width`,String(d)),i.setAttribute(`stroke-linejoin`,`round`),l.appendChild(i)}return l}function Fa(e,t){let n=`http://www.w3.org/2000/svg`,r=document.createElementNS(n,`svg`);r.setAttribute(`width`,`0`),r.setAttribute(`height`,`0`),r.setAttribute(`style`,`position:absolute`),r.setAttribute(`aria-hidden`,`true`);let i=document.createElementNS(n,`defs`);return r.appendChild(i),e.forEach(function(e){let r=e.style||{};if(e.type===`mask`&&r.maskMode===`cutout`){let a=r.maskFeather,o=ei(e,t);if(a&&a>0){let r=Qr(e)+`-blur`,s=document.createElementNS(n,`filter`);s.setAttribute(`id`,r),s.setAttribute(`filterUnits`,`userSpaceOnUse`),s.setAttribute(`x`,`0`),s.setAttribute(`y`,`0`),s.setAttribute(`width`,String(t.width)),s.setAttribute(`height`,String(t.height));let c=document.createElementNS(n,`feGaussianBlur`);c.setAttribute(`stdDeviation`,String(a)),s.appendChild(c),i.appendChild(s);let l=document.createElementNS(n,`mask`);l.setAttribute(`id`,Qr(e)),l.setAttribute(`maskUnits`,`userSpaceOnUse`);let u=document.createElementNS(n,`rect`);u.setAttribute(`x`,`0`),u.setAttribute(`y`,`0`),u.setAttribute(`width`,String(t.width)),u.setAttribute(`height`,String(t.height)),u.setAttribute(`fill`,`black`),l.appendChild(u);let d=document.createElementNS(n,`g`);d.setAttribute(`filter`,`url(#`+r+`)`);let f=document.createElementNS(n,`path`);f.setAttribute(`d`,o),f.setAttribute(`fill`,`white`),f.setAttribute(`clip-rule`,`evenodd`),f.setAttribute(`fill-rule`,`evenodd`),d.appendChild(f),l.appendChild(d),i.appendChild(l)}else{let t=document.createElementNS(n,`clipPath`);t.setAttribute(`id`,Kr(e)),t.setAttribute(`clipPathUnits`,`userSpaceOnUse`);let r=document.createElementNS(n,`path`);r.setAttribute(`d`,o),r.setAttribute(`clip-rule`,`evenodd`),t.appendChild(r),i.appendChild(t)}}if(e.type===`filter`&&e.duotone){let t=document.createElementNS(n,`filter`);t.setAttribute(`id`,Zr(e));let r=document.createElementNS(n,`feColorMatrix`);r.setAttribute(`type`,`matrix`),r.setAttribute(`values`,`0.33 0.33 0.33 0 0 0.33 0.33 0.33 0 0 0.33 0.33 0.33 0 0 0 0 0 1 0`),t.appendChild(r);let a=document.createElementNS(n,`feComponentTransfer`);[`R`,`G`,`B`].forEach(function(e,t){let r=document.createElementNS(n,`feFunc`+e);r.setAttribute(`type`,`table`);let i=t;r.setAttribute(`tableValues`,Na(Xr.shadows,i)+` `+Na(Xr.lights,i)),a.appendChild(r)}),t.appendChild(a),i.appendChild(t)}}),r}function Ia(e,t,n){let r=n.get(e.shape.id);r&&(e.clipPath&&(r.style.clipPath=e.clipPath),e.maskStyle&&(r.style.mask=e.maskStyle),t.appendChild(r))}var La=1200,Ra=class{updateScale(){}sceneReady(){}updateViewportSize(){}host;poster=`auto`;metadata=null;securityStatus=`unsigned`;embeddedFontFamilies=new Map;imageUrl=null;lang;showControls;activeSlotId=null;zoom=1;panX=0;panY=0;_stage=null;_viewport=null;_baseImg=null;_overlay=null;_lottieInstances=[];_onDragMove=null;_onDragEnd=null;_animations=[];_textAnimations=[];_paused=!1;_revealAnims=new Map;_timelines=new Map;_warnedPlay=new Set;_heldTimelines=new Set;_isStill(){let e=this.host;if(!this.disableAnimations||!e||typeof e.getAttribute!=`function`)return!1;let t=e.getAttribute(`disable-animations`);return t!==null&&t!==`false`||e.getAttribute(`mode`)===`image`}_resizeObserver=null;_onFullscreenChange=null;_retryViewportSize=!1;allowZoom;showLanguageSelector;showSlots;allowLottie;allowDynamicColors=!0;disableAnimations;disableActions;dropdownBlur;fit;align;_deviceProfile;applyPalette(){let e=this._viewport;if(!e)return;let t=typeof matchMedia==`function`&&matchMedia(`(prefers-color-scheme: dark)`).matches,n=this.allowDynamicColors?le(this.metadata??{},{requested:this.host.getAttribute(`palette`),prefersDark:t}):null;for(let t of re){let r=n?.colors[t];r?e.style.setProperty(`--oim-palette-`+t,r):e.style.removeProperty(`--oim-palette-`+t)}}async renderSlots(e){if(!this.metadata||!this.host||this.poster===`only`)return;let t=(this.metadata.slots||this.metadata.elements||[]).some(function(e){return e.type===`mask`||e.type===`filter`}),n=e&&e.onlyIds&&e.onlyIds.size>0&&!t?e.onlyIds:null;if(this._viewport&&!this._revealed&&this._viewport.classList.remove(`oim-viewport--ready`),!this.showSlots){this._overlay&&(this._overlay.innerHTML=``),this._viewport&&this._viewport.classList.add(`oim-viewport--ready`),this.sceneReady();return}n?this._destroyLottiesIn(n):this._lottieInstances&&=(this._lottieInstances.forEach(function(e){try{e.inst.destroy()}catch{}}),[]);let r=this._overlay;if(!r)return;let i=this._viewport?this._viewport.querySelector(`.oim-noise-overlay`):null,a=Array.isArray(this.metadata?.effects)?this.metadata.effects.find(e=>e&&e.type===`texture`&&e.enabled!==!1):null;if(a){let e=Vi[a.preset];if(e){let t=i||document.createElement(`div`);t.className=`oim-noise-overlay`,t.style.position=`absolute`,t.style.inset=`0`,t.style.width=`100%`,t.style.height=`100%`,t.style.pointerEvents=`none`,t.style.mixBlendMode=a.blend||e.defaultBlend||`overlay`;let n=(a.intensity===void 0?e.defaultIntensity:a.intensity)/100;t.style.opacity=n.toFixed(2),t.style.zIndex=`999`;let r=a.scale||1,o=e.tileWidth*r,s=e.tileHeight*r;t.style.backgroundImage=`url("${e.getDataUri(a.color)}")`,t.style.backgroundRepeat=`repeat`,t.style.backgroundSize=`${o}px ${s}px`,!i&&this._viewport&&this._viewport.appendChild(t)}}else if(this.metadata&&this.metadata.grain&&this.metadata.grain.enabled){let e=this.metadata.grain,t=e.intensity??15,n=e.blendMode??`overlay`,r=e.baseFrequency??.8,a=i||document.createElement(`div`);a.className=`oim-noise-overlay`,a.style.position=`absolute`,a.style.inset=`0`,a.style.width=`100%`,a.style.height=`100%`,a.style.pointerEvents=`none`,a.style.mixBlendMode=n,a.style.opacity=(t/100).toFixed(2),a.style.zIndex=`999`;let o=`oim-global-noise-filter`,s=Di(o,{intensity:t,baseFrequency:r,color:e.color}),c=`data:image/svg+xml;utf8,`+encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%"><defs>${s}</defs><rect width="100%" height="100%" filter="url(#${o})"/></svg>`);a.style.backgroundImage=`url("${c}")`,!i&&this._viewport&&this._viewport.appendChild(a)}else i&&i.remove();let o=this,s=this.metadata.slots||this.metadata.elements||[];try{await ke()}catch(e){console.warn(`[OimPlayer] Could not load upgrade:`,e)}let l=Le(o.metadata);s.forEach(function(e){let t=e&&e.type===`mask`?l.get(String(e.id)):void 0;if(t){e.style={...e.style,...We(t)};let{x:n,y:r,width:i,height:a}=t.box;Object.assign(e,{x:n,y:r,width:i??0,height:a??0})}});let u=[],d=o.metadata&&(o.metadata.artboardWidth||o.metadata.canvasWidth||o.metadata.canvas_width)||(o.metadata&&o.metadata.canvas?o.metadata.canvas.natural_width||o.metadata.canvas.width:0)||(o._baseImg&&o._baseImg.naturalWidth>0?o._baseImg.naturalWidth:1080),f=o.metadata&&(o.metadata.artboardHeight||o.metadata.canvasHeight||o.metadata.canvas_height)||(o.metadata&&o.metadata.canvas?o.metadata.canvas.natural_height||o.metadata.canvas.height:0)||(o._baseImg&&o._baseImg.naturalHeight>0?Math.round(d*(o._baseImg.naturalHeight/o._baseImg.naturalWidth)):1920);r.style.setProperty(`--oim-overlay-w`,d+`px`),r.style.setProperty(`--oim-overlay-h`,f+`px`);let p=document.createDocumentFragment(),m={},h=new Map,g=Le(o.metadata);(this.metadata.zones||[]).forEach(e=>{let t=g.get(String(e?.id));if(!t||t.type!==`group`)return;let n=document.createElement(`div`);n.className=`oim-zone`,n.id=`oim-zone-`+t.id,n.style.position=`absolute`,n.style.inset=`0`;let r=t.children?.find(e=>e.id===t.id+`__background`),i=r?.fills?.[0],a=t.effects?.find(e=>e.kind===`backdrop`)?.blur;if(r||a){let e=t.box,s=document.createElement(`div`);s.className=`oim-zone-box`,s.style.position=`absolute`,s.style.left=e.x+`px`,s.style.top=e.y+`px`,s.style.width=(e.width??0)+`px`,s.style.height=(e.height??0)+`px`,i&&`kind`in i&&i.kind===`color`&&(s.style.background=ze(o.metadata).css(i.value)||``),typeof r?.corners==`number`&&(s.style.borderRadius=r.corners+`px`),a&&(s.style.backdropFilter=`blur(`+a+`px)`,s.style.webkitBackdropFilter=s.style.backdropFilter),n.appendChild(s)}p.appendChild(n),m[t.id]=n;for(let e of t.children??[])h.set(e.id,t.id)});let _=ye(s),v=Le(o.metadata),y=ze(o.metadata),b=e=>e&&typeof e==`object`&&typeof e.fallback==`string`?y.literal(e.fallback):y.literal(e),x=s.map(async e=>{let t=e.type,r=v.get(String(e.id));if(n&&!n.has(String(e.id)))return null;let i=e.style||{};if(e.tracking_data,t===`mask`&&i.maskMode===`cutout`){let t=h.get(String(e.id));return t&&m[t]&&console.warn(`[OimPlayer] Slot "`+e.id+`" is a mask layer inside zone "`+t+`". Mask layers are only supported in the top-level slot stack, so this one will neither render nor clip anything. Move it out of the zone.`),null}if(!r)return console.warn(`[OimPlayer] Slot "`+e.id+`" has no 2.0 layer; it is not painted.`),null;let a=r.box,s=Pe(e,o.lang),l=r.type===`text`?r.text?.content:void 0,u=t===`image`?r.image:void 0,p=r.type===`shape`&&r.geometry?.kind===`paths`&&!Gn(r.geometry).path?r.geometry:void 0,g=l?Ae(l,o.lang):u?Ge(u.src,o.lang):p&&!Me(e)?qe(p,Je(r,y.css)):r.type===`lottie`?r.lottie?.src??``:s.content,x=!o.disableActions&&(!!r.interactions?.length||!!r.animations?.some(e=>e.on===`hover`||e.on===`press`)),S=t===`mask`&&i.maskMode!==`cutout`,C=t===`artistic-text`,w=t===`geo`||t===`shape`||t===`draw`||t===`filter`||t===`container`||S||x||C,T=e.is_background_pattern===!0||e.id===`background-pattern-slot`;if(!(t===`group`&&_.has(String(e.id)))&&!(t===`pattern`||T)&&!g&&!(w&&(r.fills?.length||a.width!==void 0||t===`filter`||t===`container`||S||x||C)))return null;let E=je(e,g),D=g,O=!1;E||(/<svg|<span|<div|<a|<img/i.test(D)&&(D=D.replace(/</g,`<`).replace(/>/g,`>`).replace(/&/g,`&`).replace(/"/g,`"`).replace(/'/g,`'`)),O=!!p&&!Me(e));let ee=!E&&(O||/<svg|<span|<div|<a|<img/i.test(D));D=D.replace(/\\n/g,`
|
|
116
|
+
`);let k=r.type===`text`?r.text?.align??`left`:`left`,te=`center`;k===`left`?te=`flex-start`:k===`right`&&(te=`flex-end`);let A=document.createElement(`div`);A.className=`oim-slot`,A.setAttribute(`part`,`slot`),A.setAttribute(`data-slot-id`,e.id),r.languages&&!r.languages.includes(o.lang)&&(A.style.display=`none`),A.style.zIndex=T?`0`:`1`;let ne=r.animations?.find(e=>e.on===`enter`&&e.preset);A._oimReveal=ne?{effect:ne.preset,duration:ne.duration,easing:ne.easing}:void 0;let re=!!r.interactions?.length;x||re&&!o.disableActions||A.setAttribute(`data-oim-passthrough`,``);let ie=r.fills?.[0],ae=ie?.kind===`pattern`?ie.pattern:void 0,oe=ae?zr(ae,y):{};if(T){A.style.pointerEvents=`none`;let e=p?qe(p,Je(r,y.literal),!0):``;if(e||ae){if(bi(A,oe,e),(ae?.fit===`cover`?`cover`:`tile`)==`cover`)A.style.backgroundSize=`cover`,A.style.backgroundRepeat=`no-repeat`,A.style.backgroundPosition=`center`,A.style.setProperty(`--oim-pat-size`,`cover`),A.style.setProperty(`--oim-pat-repeat`,`no-repeat`),A.style.setProperty(`--oim-pat-pos`,`center`);else{let e=160*(ae?.scale||1)/d*100;A.style.backgroundSize=e.toFixed(4)+`cqw `+e.toFixed(4)+`cqw`,A.style.backgroundRepeat=`repeat`,A.style.setProperty(`--oim-bg-tile`,e.toFixed(4)+`cqw`)}let t=ae?.motion,n=t?`background-animation-${t.direction} ${t.period||8}s linear infinite`:void 0;!o.disableAnimations&&typeof n==`string`&&n.indexOf(`background-animation-`)===0&&(A.style.animation=n),D=``,O=!1}}if(t===`pattern`){let e=Gn(r.type===`shape`?r.geometry:void 0),t=Ir({...oe,geoShape:e.round?`circle`:e.preset});for(let[e,n]of Object.entries(t))e.startsWith(`--`)?A.style.setProperty(e,n):A.style[e]=n;(oe.fillPatternColorRole||oe.fillPatternBgColorRole)&&bi(A,oe,``)}let j=document.createElement(`div`);j.className=`oim-slot-loop-wrap`;let M=document.createElement(`div`);M.className=`oim-slot-hover-wrap`,(O||E||t===`lottie`||C)&&(j.style.height=`100%`,M.style.height=`100%`);let N=null,se=t===`text`?r.fills?.[0]:void 0;if(se){let e=Wr(se,{colors:y,isText:!0,width:r.box.width||d,height:r.box.height||f});N=Object.keys(e).length>0?e:null}let ce=N!==null&&(N.backgroundClip===`text`||N.webkitBackgroundClip===`text`),le=r.box.width!==void 0&&r.box.height!==void 0,P=ce&≤if(E){let t=D.trim();if(t.startsWith(`<`)){let e=t.match(/src=["']([^"']+)["']/);e&&e[1]&&(t=e[1])}let n=wt(t),i=document.createElement(`img`);n?i.src=t:(console.warn(`[OimPlayer] Image not embedded in the file (network URLs are not loaded), slot:`,e.id),i.src=``),i.alt=``,i.draggable=!1,i.style.width=`100%`,i.style.height=`100%`;let a=u?.fit,o=u?.crop;if(i.style.objectFit=a||`cover`,o){let e=ea(o);i.style.objectFit=e.objectFit,i.style.objectPosition=e.objectPosition,i.style.transform=e.transform,i.style.transformOrigin=e.transformOrigin,M.style.overflow=`hidden`}i.style.display=`block`,i.style.pointerEvents=`none`,i.style.filter=e.type===`image`?fe(Ue(r.image?.filters))??``:``,j.style.width=`100%`,j.style.height=`100%`,M.style.width=`100%`,M.style.height=`100%`,i.onerror=function(t){console.error(`[OimPlayer] Image slot failed to load for slot:`,e.id,`error:`,t),i.style.display=`none`},M.appendChild(i)}else if(t===`lottie`){let t=document.createElement(`div`);t.className=`oim-lottie-container`,t.style.width=`100%`,t.style.height=`100%`,M.appendChild(t),o.allowLottie?Pn().then(function(n){let r=typeof D==`string`&&(D.startsWith(`http`)||D.endsWith(`.json`)||D.trim().indexOf(`{`)!==0);if(r){console.warn(`[OimPlayer] Lottie animation must be a valid JSON string. External URLs are not supported.`);return}let i=n.loadAnimation({container:t,renderer:`svg`,loop:!o.disableAnimations,autoplay:!o.disableAnimations&&!o._paused,path:r?D.trim():void 0,animationData:r?void 0:JSON.parse(D)});o.disableAnimations&&i.goToAndStop(0,!0),o._lottieInstances.push({slotId:String(e.id),inst:i})}).catch(function(e){console.error(`[OIM Player] Error loading local Lottie bundle. Hiding dynamic element:`,e),A.style.display=`none`}):(console.warn(`[OIM Player] Lottie animation slot ${e.id} detected but allowLottie option is false. Hiding dynamic element.`),A.style.display=`none`)}else if(C){j.style.width=`100%`,j.style.height=`100%`,M.style.width=`100%`,M.style.height=`100%`,M.style.display=`flex`,M.style.alignItems=`center`,M.style.justifyContent=`center`,M.style.pointerEvents=`none`;let t=xa(r,o.lang,b),n=cn(t.fontFamily,o.embeddedFontFamilies);n&&(t.fontFamily=n.replace(/, sans-serif$/,``));let i=Sa(t,String(e.id));if(typeof DOMParser<`u`){let e=new DOMParser().parseFromString(i,`image/svg+xml`).documentElement;e&&M.appendChild(e)}else M.innerHTML=i}else if(ee){let e=M;if(P){let t=document.createElement(`div`);t.className=`oim-slot-text`,M.appendChild(t),e=t}let t=Ct(D);if(typeof DOMParser<`u`){let n=new DOMParser().parseFromString(t,`text/html`);for(;n.body.firstChild;)e.appendChild(n.body.firstChild)}else{let n=document.createElement(`div`);for(n.innerHTML=t;n.firstChild;)e.appendChild(n.firstChild)}}else{let e=M;if(P){let t=document.createElement(`div`);t.className=`oim-slot-text`,M.appendChild(t),e=t}let n=r.animations?.find(e=>e.on===`load`&&e.preset),i=n?.params??{},a={type:n?.preset,speed:i.speed,delay:n?.delay?+(n.delay/1e3).toFixed(6):void 0,cursor:i.cursor,intensity:i.intensity},s=a.type,c=(t===`text`?r.text:void 0)??{};Aa(e,c.highlight);let l=c.marks,u=vn(D,l);s===`wave-chars`&&!o.disableAnimations?(Ea(o.host.shadowRoot),Ca(e,u,typeof a.speed==`number`?a.speed:.05,typeof a.delay==`number`?a.delay:0)):On(s)&&!o.disableAnimations?(Ta(o.host.shadowRoot,s),wa(e,u,s,a.speed,a.delay)):s===`typewriter`&&!o.disableAnimations?o._bornPausedIfNeeded(o._textAnimations,Oa(e,u,a.speed,a.delay,a.cursor)):s?.startsWith(`glitch-`)&&!o.disableAnimations?o._bornPausedIfNeeded(o._textAnimations,ka(e,u,s,a.speed,a.delay,a.intensity)):ja(e,D,c.dropCap,l)||yn(e,D,l)}j.appendChild(M);let ue=r.motion?.loop,F=ue?{enabled:!0,speedPxSec:ue.speedPxSec,direction:ue.direction,mirror:ue.mirror??!0,pauseOnHover:!!ue.pauseOnHover}:void 0,I=!1;if(F&&F.enabled){let e=F.infinite||{},t=e.enabled===!1||o._isStill()?0:F.speedPxSec===void 0?e.speedPxSec===void 0?e.speed_px_sec===void 0?F.mode===`infinite_horizontal`?F.speed===void 0?20:F.speed:0:e.speed_px_sec:e.speedPxSec:F.speedPxSec,n=F.direction||e.direction||`right_to_left`,i=F.mirror===void 0?F.seamlessTile===void 0?e.mirror===void 0?e.seamlessTile===void 0?e.seamless_tile===void 0||!!e.seamless_tile:!!e.seamlessTile:!!e.mirror:!!F.seamlessTile:!!F.mirror,a=F.pauseOnHover===void 0?e.pauseOnHover===void 0?!!e.pause_on_hover:!!e.pauseOnHover:!!F.pauseOnHover,s=Ki({speedPxSec:Number(t)||0,direction:n,mirror:i,pauseOnHover:a},r.box.width||d||d,d);if(s.duplicate){I=!0,qi(o.host.shadowRoot);let e=document.createElement(`div`);e.className=`${Hi} ${Ui}`;for(let[t,n]of Object.entries(s.container))e.style.setProperty(t,n);for(let t=0;t<s.copies;t++){let n=t===0?j:j.cloneNode(!0);for(let[e,t]of Object.entries(s.copy))n.style.setProperty(e,t);if(t%2==1)for(let[e,t]of Object.entries(s.secondCopy))n.style.setProperty(e,t);e.appendChild(n)}A.appendChild(e)}}I||A.appendChild(j);let de=r.geometry?.trim,pe=r.animations?.find(e=>e.on===`load`&&e.tracks?.some(e=>e.property===`trimEnd`)),me=e=>+(e*100).toFixed(6),he=de||pe?{strokeWidth:1,trimStart:me(de?.start??0),trimEnd:me(de?.end??1),trimDuration:pe?+(pe.duration/1e3).toFixed(6):0}:void 0;ee&&he&&(he.trimDuration&&wi(o.host.shadowRoot),Ti(M,he));let ge=He(r,o.lang),ve={lineHeight:r.text?.lineHeight},ye=ge?.fontSize??`16px`,be=ge?.fontFamily,xe=T?`none`:ge?.maxWidth??(r.type===`text`&&!E?`80%`:`none`),Se=C||!E&&!O&&t!==`lottie`&&D.trim()!==``;if(be&&Se){let e=Ot(be),t=cn(e,o.embeddedFontFamilies);A.style.setProperty(`font-family`,t||e)}if(te=I||k===`left`?`flex-start`:k===`right`?`flex-end`:`center`,A.style.maxWidth=xe,A.style.fontSize=ye,A.style.lineHeight=String(ca(ve)),ge)for(let e of[`fontWeight`,`fontStyle`,`letterSpacing`,`textTransform`,`textDecoration`])ge[e]&&(A.style[e]=ge[e]);if(t===`text`&&se){let e=`kind`in se&&se.kind===`color`?y.css(se.value):``;e&&A.style.setProperty(`color`,e)}if(N){if(P){j.style.position=`absolute`,j.style.top=`0`,j.style.left=`0`,j.style.right=`0`,j.style.bottom=`0`,j.style.width=`100%`,j.style.height=`100%`,M.style.width=`100%`,M.style.height=`100%`,M.style.boxSizing=`border-box`,M.style.setProperty(`padding-right`,`0.25em`,`important`),M.style.display=`flex`,M.style.flexDirection=`column`,M.style.justifyContent=`center`,M.style.alignItems=te,Object.assign(M.style,N);let e=ua(ca(ve));e>0&&(A.style.setProperty(`padding-top`,e+`em`,`important`),A.style.setProperty(`padding-bottom`,e+`em`,`important`))}else if(Object.assign(A.style,N),ce){let e=ua(ca(ve));e>0&&(A.style.setProperty(`padding-top`,e+`em`,`important`),A.style.setProperty(`padding-bottom`,e+`em`,`important`))}}A.style.textAlign=k,A.style.display=`flex`,A.style.flexDirection=`column`,A.style.justifyContent=`center`,A.style.alignItems=te,A.style.opacity=`0`,A.style.transition=`opacity 0.3s ease`,A.style.whiteSpace=`pre-line`,A.style.overflow=da({isText:t===`text`,isParallaxGroup:!!r.motion?.loop||!!_.get(e.id)?.some(e=>v.get(String(e))?.motion?.loop),hasFilterOrShadow:!1,hasKeyframes:!!r.animations?.some(za)});let Ce=o.metadata?.canvas_width||o.metadata?.canvasWidth||(o.metadata?.canvas?o.metadata.canvas.natural_width:800);x&&fa(A),a.width!==void 0&&a.height!==void 0?(A.style.width=(a.width/Ce*100).toFixed(4)+`cqw`,A.style.height=(a.height/Ce*100).toFixed(4)+`cqw`):(A.style.width=`max-content`,A.style.height=`auto`);let L=r.fills?.[0],R=L&&`kind`in L?L.kind:void 0,z=Gn(r.type===`shape`?r.geometry:void 0),we=(t===`svg`||O)&&!S&&(R===`pattern`||R===`generative`),B=w&&!S&&R===`image`?String(L.src||``).trim():``,V=!!B&&wt(B),Te=we||(t===`geo`||t===`shape`)&&!S&&(V||R===`gradient`||R===`generative`||R===`pattern`&&!T),H=r.fills?.[1],Ee=R===`image`&&H?.kind===`color`?y.css(H.value):void 0,U=R===`color`?y.css(L.value):V?void 0:Ee;U&&w&&!S&&t!==`text`&&!C&&!Te&&A.style.setProperty(`background-color`,U);let De=t===`svg`||O||r.geometry?.kind===`paths`||w&&!!z.silhouette,Oe=v.get(String(e.id)),ke=Oe?.strokes?.find(e=>!e.align&&`kind`in e.paint&&e.paint.kind===`color`&&typeof e.width==`number`),W=Oe?.type===`text`?{color:``,width:0,style:void 0}:ke?{color:y.css(ke.paint.value)||``,width:ke.width,style:ke.style}:{color:``,width:0,style:void 0};W.color&&W.width&&!S&&!De&&A.style.setProperty(`border`,`${W.width}px ${W.style||`solid`} ${W.color}`),B&&!V&&console.warn(`[OimPlayer] Fill image not embedded in the file (network URLs are not loaded), slot:`,e.id);let G=w&&!S?z.silhouette:null;if(G){let e=`http://www.w3.org/2000/svg`,t=document.createElementNS(e,`svg`);t.setAttribute(`viewBox`,G.viewBox),t.setAttribute(`preserveAspectRatio`,`none`),t.style.position=`absolute`,t.style.left=`0`,t.style.top=`0`,t.style.width=`100%`,t.style.height=`100%`,t.style.display=`block`,t.style.overflow=`visible`;let n=document.createElementNS(e,G.points?`polygon`:`path`);G.points?n.setAttribute(`points`,G.points):n.setAttribute(`d`,G.d);let r=z.fillable,i=r&&V;n.setAttribute(`fill`,r&&U&&!Te&&!i?U:`none`);let a=ke?W.width:0,o=ke?W.color:``;a&&o&&(n.setAttribute(`stroke`,o),n.setAttribute(`stroke-width`,String(a)),n.setAttribute(`vector-effect`,`non-scaling-stroke`),n.setAttribute(`stroke-linejoin`,`round`),n.setAttribute(`stroke-linecap`,`round`),W.style===`dashed`?n.setAttribute(`stroke-dasharray`,`6,4`):W.style===`dotted`&&n.setAttribute(`stroke-dasharray`,`2,3`)),t.appendChild(n),A.appendChild(t),i&&ia(A,L,{d:G.d??`M `+G.points.split(` `).join(` L `)+` Z`,viewBox:G.viewBox},B,Ee),A.style.backgroundColor=`transparent`,A.style.padding=`0`,A.style.overflow=`visible`}else w&&!S&&z.round&&(A.style.borderRadius=`50%`);if(V&&!G){let e=typeof r.corners==`number`?r.corners:0,t=r.box.width||d,n=r.box.height||f;ia(A,L,{d:``,viewBox:`0 0 1 1`,rect:{rx:Math.min(Math.max(e/t,0),.5),ry:Math.min(Math.max(e/n,0),.5)}},B,Ee)}if(Te){let e=document.createElement(`div`);e.className=`oim-fill-layer`,e.style.position=`absolute`,e.style.left=`0`,e.style.top=`0`,e.style.width=`100%`,e.style.height=`100%`,e.style.pointerEvents=`none`,e.style.borderRadius=`inherit`;let t={...L?Wr(L,{colors:y,width:r.box.width||d,height:r.box.height||f}):{},...V&&H?.kind===`color`&&b(H.value)?{backgroundColor:b(H.value)}:{},...we?Fr(D):Nr(z.round?`circle`:z.preset,z.path?{svgPath:z.path.d,svgViewBox:z.path.viewBox}:void 0)};we&&!j.style.position&&(j.style.position=`relative`);for(let[n,r]of Object.entries(t))n.startsWith(`--`)?e.style.setProperty(n,r):e.style[n]=r;A.insertBefore(e,A.firstChild)}S&&(A.style.overflow=`visible`,A.style.display=`block`,A.style.setProperty(`padding`,`0`,`important`),A.appendChild(Pa(e,{width:d,height:f}))),(!Se&&!S||I)&&A.style.setProperty(`padding`,`0`,`important`);let Ne=h.get(String(e.id)),Fe=null;{let e=a;A.style.position=`absolute`;let t,n=`-50%`;if(e.width!==void 0&&e.height!==void 0){t=I||k===`left`?`0%`:k===`right`?`-100%`:`-50%`;let n=t===`0%`?0:t===`-100%`?1:.5;A.style.left=(e.x+e.width*n).toFixed(2)+`px`,A.style.top=(e.y+e.height/2).toFixed(2)+`px`}else[t,n]=Be(e),I&&(t=`0%`),A.style.left=e.x.toFixed(2)+`px`,A.style.top=e.y.toFixed(2)+`px`;A.style.setProperty(`--oim-tx`,t),A.style.setProperty(`--oim-ty`,n),A.style.setProperty(`--oim-rot`,(e.rotation||0)+`deg`),Fe={x:e.x,y:e.y,width:e.width??0,height:e.height??0}}let K=_e(e)&&!T&&Fe?aa(Fe,{width:d,height:f}):null;T&&(A.style.left=`0`,A.style.top=`0`,A.style.width=`100%`,A.style.height=`100%`,A.style.maxWidth=`none`,A.style.maxHeight=`none`,A.style.padding=`0`,A.style.boxSizing=`border-box`,A.style.setProperty(`--oim-tx`,`0%`),A.style.setProperty(`--oim-ty`,`0%`),A.style.setProperty(`--oim-rot`,`0deg`));let Ie=v.get(String(e.id))?.type===`text`?(()=>{let t=v.get(String(e.id))?.strokes?.[0];return t&&`kind`in t.paint&&t.paint.kind===`color`&&typeof t.width==`number`?{width:t.width,color:y.css(t.paint.value)||``}:void 0})():void 0;Ie&&(A.style.setProperty(`-webkit-text-stroke`,Ie.width+`px `+Ie.color),A.style.setProperty(`paint-order`,`stroke fill`));let Le=e=>{let n=Vi[e.preset];if(n){if(t===`text`||t===`artistic-text`){let t=e.scale||1,i=n.tileWidth*t,a=n.tileHeight*t,o=r.fills?.[0],s=o?.kind===`color`&&y.css(o.value)||`#18181b`,c=o?.kind===`gradient`?Wr(o,{colors:y}).backgroundImage:void 0,l=e.blend||n.defaultBlend||`overlay`;c?(A.style.backgroundImage=`url("`+n.getDataUri(e.color,e.intensity)+`"), `+c,A.style.backgroundRepeat=`repeat, no-repeat`,A.style.backgroundSize=i+`px `+a+`px, 100% 100%`,A.style.backgroundBlendMode=l+`, normal`):(A.style.backgroundImage=`url("`+n.getDataUri(e.color,e.intensity)+`"), linear-gradient(`+s+`, `+s+`)`,A.style.backgroundRepeat=`repeat, no-repeat`,A.style.backgroundSize=i+`px `+a+`px, 100% 100%`,A.style.backgroundBlendMode=l),A.style.webkitBackgroundClip=`text`,A.style.backgroundClip=`text`,A.style.webkitTextFillColor=`transparent`,A.style.color=`transparent`;let u=ua(ca(ve));u>0&&(A.style.setProperty(`padding-top`,u+`em`,`important`),A.style.setProperty(`padding-bottom`,u+`em`,`important`))}else{let r=document.createElement(`div`);r.className=`oim-effect-texture`,r.style.position=`absolute`,r.style.inset=`0`,r.style.pointerEvents=`none`,r.style.borderRadius=`inherit`,r.style.mixBlendMode=e.blend||n.defaultBlend||`overlay`;let i=(e.intensity===void 0?n.defaultIntensity:e.intensity)/100;r.style.opacity=String(i);let a=e.scale||1,o=n.tileWidth*a,s=n.tileHeight*a;r.style.backgroundImage=`url("${n.getDataUri(e.color,e.intensity)}")`,r.style.backgroundRepeat=`repeat`,r.style.backgroundSize=`${o}px ${s}px`,r.style.zIndex=`1`;let c=Cn({type:t,svg:O?D:void 0,image:E?D.trim():void 0,fit:u?.fit});if(c){let e=r.style;e.maskImage=e.webkitMaskImage=c.image,e.maskSize=e.webkitMaskSize=c.size,e.maskRepeat=e.webkitMaskRepeat=`no-repeat`,e.maskPosition=e.webkitMaskPosition=`center`}A.appendChild(r)}}},Re=e=>{A.style.filter=(A.style.filter?A.style.filter+` `:``)+e},ze=e=>{A.style.textShadow=A.style.textShadow?A.style.textShadow+`, `+e:e},Ve=r.effects;for(let n of Ve??[])if(n.kind===`blur`)Re(`blur(`+n.radius+`px)`);else if(n.kind===`glow`){let e=y.css(n.color)||`#f59e0b`,r=n.radius;t===`text`?ze(`0px 0px `+r*.4+`px `+e+`, 0px 0px `+r+`px `+e):Re(`drop-shadow(0px 0px `+r*.4+`px `+e+`) drop-shadow(0px 0px `+r+`px `+e+`)`)}else if(n.kind===`shadow`){let e=n.color&&typeof n.color==`object`?n.color:void 0,r=n.opacity===void 0?y.css(n.color??`#000000`)||`#000000`:$i({shadowColor:e?e.fallback:n.color,shadowOpacity:n.opacity*100,shadowColorRole:e?.var}),i=(n.x||0)+`px `+(n.y||0)+`px `+(n.blur||0)+`px `+r;t===`text`?ze(i):Re(`drop-shadow(`+i+`)`)}else if(n.kind===`grain`){if(!ki.includes(t))continue;let r=`oim-grain-`+String(e.id).replace(/[^A-Za-z0-9_-]/g,`_`);o._defineLayerGrain(r,n),Re(`url(#`+r+`)`)}else n.kind===`texture`&&Le({...n,color:n.color===void 0?void 0:b(n.color)});let We=r.opacity??1;if(A.dataset.oimOpacity=String(We),A.style.setProperty(`--oim-target-opacity`,String(We)),r.visible===!1&&(A.style.display=`none`,A.style.opacity=`0`,A.style.pointerEvents=`none`),t===`filter`){let t=r.effects?.find(e=>e.kind===`backdrop`),n=fe(Ue(t)),i=t?.preset===`duotone`?`url(#`+Zr(e)+`)`:n;i&&(A.style.backdropFilter=i,A.style.webkitBackdropFilter=i)}if(t===`container`){let e=r.box.width||300,t=r.box.height||200,n=r.fills?.[0],i=n?Wr(n,{colors:y,width:e,height:t}):{};Object.assign(A.style,i)}let Ke=r.corners;if(Ke!==void 0&&!z.round&&(A.style.borderRadius=(Array.isArray(Ke)?Ke:[Ke]).map(e=>e+`px`).join(` `)),K){A.style.left=K.left,A.style.top=K.top,A.style.width=K.width,A.style.height=K.height,A.style.maxWidth=`none`,A.style.maxHeight=`none`,A.style.setProperty(`padding`,`0`,`important`),A.style.transformOrigin=K.transformOrigin,A.style.pointerEvents=K.pointerEvents,A.style.setProperty(`--oim-tx`,`0%`),A.style.setProperty(`--oim-ty`,`0%`),A.style.setProperty(`--oim-scale`,`1`);let t=!!_.get(e.id)?.some(e=>v.get(String(e))?.motion?.loop);A.style.overflow=t?`hidden`:`visible`,c(j,`data-oim-group`,`data-oim-grupo`,String(e.id)),j.style.transformOrigin=K.transformOrigin,j.style.height=`100%`,j.style.overflow=`visible`}let q=r.animations?.find(za),Ye=r.animations?.find(e=>e.on===`loop`&&e.preset),Xe=r.animations?.find(e=>e.on===`hover`&&e.preset),Ze=e=>e?+(e/1e3).toFixed(6):0,Qe=q||Ye||Xe?{frames:q?Ua(q.tracks):void 0,duration:q?Ze(q.duration):0,trigger:q?.on===`action`?`action`:void 0,loop:Ye?.preset,loopDuration:Ze(Ye?.duration),loopDelay:Ze(Ye?.delay),hover:Xe?.preset}:void 0;if(Qe&&!o.disableAnimations){let t=Qe;if(t.frames&&typeof j.animate==`function`){let n=t.duration;{let r=t.frames,i=t.trigger===`action`,a=j.animate(r,{duration:n*1e3,iterations:i?1:1/0,easing:`linear`,...i?{fill:`both`}:{}});i?(a.pause(),a.currentTime=0):(o._paused&&a.pause(),o._animations.push(a)),o._timelines.set(String(e.id),a)}}t.loop&&t.loop!==`none`&&t.loop!==`custom`&&(j.classList.add(`oim-loop-`+t.loop),t.loopDuration&&j.style.setProperty(`--oim-loop-duration`,t.loopDuration+`s`),t.loopDelay&&j.style.setProperty(`--oim-loop-delay`,t.loopDelay+`s`)),t.hover&&t.hover!==`none`&&t.hover!==`custom`&&M.classList.add(`oim-hover-`+t.hover)}let $e=r.animations?.find(e=>e.on===`hover`&&e.tracks),et=e=>{let t=$e?.tracks?.find(t=>t.property===e)?.keyframes;return t?t[t.length-1].v:void 0},tt=e=>(r.interactions??[]).filter(t=>t.on===e).flatMap(e=>e.actions),nt={hover:{scale:et(`scale`),rotation:et(`rotation`),opacity:et(`opacity`)===void 0?void 0:+(et(`opacity`)*100).toFixed(6),transitionDuration:$e&&$e.duration>0?+($e.duration/1e3).toFixed(6):void 0,actions:tt(`hover`)},active:{actions:tt(`press`)}};if(!o.disableActions&&($e||r.interactions?.length)){let t={},n={},r=new Set;pa(A,nt,function(e,t){o.queueUpdate(e,t)},{run:function(i,a){let s=o.host.shadowRoot;if(!s)return;let c=new CustomEvent(`oim:action`,{cancelable:!0,detail:{slot:e.id,name:e.name,trigger:a||`unknown`,targets:i.map(function(e){return e.target}),types:i.map(function(e){return e.type})}});if(o.host.dispatchEvent(c),c.defaultPrevented)return;i.forEach(function(e){e.type===`play`&&e.target&&o._playTimeline(String(e.target))});let l={};i.forEach(function(i){if(!i.target||i.type===`play`)return;let a=s.querySelector(`[data-slot-id="`+i.target+`"]`);!a&&!r.has(i.target)&&(r.add(i.target),console.warn(`[OimPlayer] The slot "`+e.id+`" has an action "`+i.type+`" aimed at "`+i.target+`", which does not exist in this file. It does nothing.`));let o=!a||a.style.display!==`none`&&a.style.opacity!==`0`;if(l[i.target]=o,t[i.target]===void 0&&(t[i.target]=o),i.type===`setText`&&n[i.target]===void 0){let e=a?a.querySelector(`.oim-slot-hover-wrap`):null;n[i.target]=e?e.textContent||``:a&&a.textContent||``}});let u=ga(i,l);for(let[e,t]of Object.entries(u.visibility)){let n=s.querySelector(`[data-slot-id="`+e+`"]`);n&&(t?o._showSlotElement(n):o._hideSlotElement(n))}for(let[e,t]of Object.entries(u.texts)){let n=s.querySelector(`[data-slot-id="`+e+`"]`);if(!n)continue;let r=n.querySelector(`.oim-slot-hover-wrap`);r?r.textContent=t:n.textContent=t}},revert:function(e){let r=o.host.shadowRoot;r&&e.forEach(function(e){if(!e.target||e.type===`play`)return;let i=r.querySelector(`[data-slot-id="`+e.target+`"]`);if(i){if(t[e.target]!==void 0){let n=t[e.target];delete t[e.target],n?o._showSlotElement(i):o._hideSlotElement(i)}if(n[e.target]!==void 0){let t=n[e.target];delete n[e.target];let r=i.querySelector(`.oim-slot-hover-wrap`);r?r.textContent=t:i.textContent=t}}})}},function(e,t){o._activeTouchSlot&&o._activeTouchSlot.el!==e&&o._activeTouchSlot.leave(),o._activeTouchSlot={el:e,leave:t}})}C&&(A.style.backgroundColor=`transparent`,A.style.overflow=`visible`,A.style.setProperty(`padding`,`0`,`important`));let J=ta(a.flipX,a.flipY);if(J){let e=document.createElement(`div`);for(e.setAttribute(`data-oim-flip`,``),e.style.width=`100%`,e.style.height=`100%`,e.style.transformOrigin=`50% 50%`,e.style.transform=`scale(`+J[0]+`, `+J[1]+`)`;A.firstChild;)e.appendChild(A.firstChild);A.appendChild(e)}return{slotEl:A,zoneId:Ne,slot:e}}),S=await Promise.all(x),C=[],w=new Set;s.forEach(function(e,t){let n=e&&e.id!==void 0&&e.id!==null&&e.id!==``?String(e.id):``,r;n?w.has(n)?(console.warn(`[OimPlayer] Duplicate slot id "`+n+`" at index `+t+`; rendering it unkeyed and in stack order.`),r=`__oim-dup-`+n+`-`+t):r=n:(console.warn(`[OimPlayer] Slot #`+t+` has no id; rendering it unkeyed and in stack order.`,e),r=`__oim-unkeyed-`+t),w.add(r),C.push(r)});let T=new Map;S.forEach(function(e,t){if(!e)return;let n=e.slotEl,r=e.zoneId;r&&m[r]?m[r].appendChild(n):T.set(C[t],n)});let E=[];s.forEach(function(e,t){let n=h.get(String(e.id));n&&m[n]||E.push({id:C[t],type:e.type,style:e.style||{},duotone:e.type===`filter`&&v.get(String(e.id))?.effects?.some(e=>e.kind===`backdrop`&&e.preset===`duotone`),position:e.position,width_px:e.width_px,height_px:e.height_px})});let D=ti(E),O=E.some(function(e){return e.type===`mask`}),ee=E.some(function(e){return!!e.duotone});if((O||ee)&&p.appendChild(Fa(E,{width:d,height:f})),D.forEach(function(e){Ia(e,p,T)}),n?S.forEach(function(e){if(!e)return;let t=e.slotEl.getAttribute(`data-slot-id`)||``,n=r.querySelector(`[data-slot-id="`+t+`"]`);if(n&&n.parentNode){let t=n.querySelectorAll(`[data-oim-group] > [data-slot-id], :scope > [data-slot-id]`);for(let n=0;n<t.length;n++)e.slotEl.appendChild(t[n]);n.parentNode.replaceChild(e.slotEl,n)}}):(r.innerHTML=``,r.appendChild(p)),_.size>0){let e=function(e){for(let t in m)if(m[t]&&m[t].contains(e))return!0;return!1};_.forEach(function(t,n){let i=r.querySelector(`[data-slot-id="`+n+`"]`);if(!i||e(i))return;let a=i.querySelector(`[data-oim-group="`+n+`"]`)||i;t.forEach(function(t){let n=r.querySelector(`[data-slot-id="`+t+`"]`);n&&!e(n)&&a.appendChild(n)})})}try{await Promise.all(u)}catch(e){console.warn(`[OIM Player] Font load fallback activado.`,e)}r.querySelectorAll(`.oim-slot`).forEach(function(e){e.style.opacity=e.dataset.oimOpacity===void 0?`1`:e.dataset.oimOpacity}),await o._mediaSettled(r),o._buildA11y(),o.updateViewportSize(),o.updateScale(),o._viewport&&(o._viewport.classList.add(`oim-viewport--ready`),o._revealed=!0,o.sceneReady())}_defineLayerGrain(e,t){let n=this._viewport||this._overlay;if(!n||typeof DOMParser>`u`)return;let r=n.querySelector(`:scope > svg.oim-grain-defs > defs`);if(!r){let e=`http://www.w3.org/2000/svg`,t=document.createElementNS(e,`svg`);t.setAttribute(`class`,`oim-grain-defs`),t.setAttribute(`width`,`0`),t.setAttribute(`height`,`0`),t.setAttribute(`aria-hidden`,`true`),t.setAttribute(`style`,`position:absolute;pointer-events:none`),r=document.createElementNS(e,`defs`),t.appendChild(r),n.appendChild(t)}let i=r.querySelector(`#`+e);i&&i.remove();let a=Mi(e,{intensity:t.intensity,size:t.size,blend:t.blend}),o=new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg"><defs>`+a+`</defs></svg>`,`image/svg+xml`).querySelector(`filter`);o&&r.appendChild(document.importNode(o,!0))}_revealed=!1;_mediaSettled(e){let t=[];e.querySelectorAll(`img`).forEach(function(e){typeof e.decode==`function`&&e.getAttribute(`src`)&&t.push(e.decode().catch(function(){}))}),(this._lottieInstances||[]).forEach(function(e){let n=e.inst;n&&!n.isLoaded&&typeof n.addEventListener==`function`&&t.push(new Promise(function(e){n.addEventListener(`DOMLoaded`,e),n.addEventListener(`data_failed`,e)}))});let n=new Promise(function(e){setTimeout(e,La)});return Promise.race([Promise.all(t),n]).then(()=>new Promise(function(e){typeof requestAnimationFrame==`function`?requestAnimationFrame(function(){requestAnimationFrame(function(){e()})}):e()}))}_pendingDOMUpdates=new Map;_isUpdateScheduled=!1;_updateCallbacks=[];queueUpdate(e,t,n){let r={};for(let[e,n]of Object.entries(t))(typeof n==`string`||n===void 0)&&(r[e]=n);this._pendingDOMUpdates.set(e,{...this._pendingDOMUpdates.get(e)||{},...r}),n&&this._updateCallbacks.push(n),this._isUpdateScheduled||(this._isUpdateScheduled=!0,requestAnimationFrame(()=>this._flushDOMUpdates()))}_flushDOMUpdates(){this._pendingDOMUpdates.forEach((e,t)=>{for(let[n,r]of Object.entries(e))n.startsWith(`--`)?r===``||r==null?t.style.removeProperty(n):t.style.setProperty(n,String(r)):t.style[n]=r}),this._pendingDOMUpdates.clear(),this._isUpdateScheduled=!1;let e=this._updateCallbacks;this._updateCallbacks=[],e.forEach(e=>{try{e()}catch(e){console.error(e)}})}_hideSlotElement(e){this.disableAnimations?this.queueUpdate(e,{display:`none`,opacity:`0`,pointerEvents:`none`}):this.queueUpdate(e,{pointerEvents:`none`},()=>{this._runReveal(e,!1,()=>this.queueUpdate(e,{display:`none`}))})}_showSlotElement(e){this.disableAnimations?this.queueUpdate(e,{display:`flex`,opacity:`1`,pointerEvents:`auto`}):this.queueUpdate(e,{display:`flex`,pointerEvents:`auto`},()=>this._runReveal(e,!0))}_playTimeline(e){let t=this._timelines.get(e);t?(t.currentTime=0,this._paused||t.play()):!this.disableAnimations&&!this._warnedPlay.has(e)&&(this._warnedPlay.add(e),console.warn(`[OimPlayer] play: no animation`,e))}_runReveal(e,t,n){let r=this._revealAnims.get(e),i=r?getComputedStyle(e):void 0;r&&(r.cancel(),this._revealAnims.delete(e)),e.style.opacity=t?`1`:`0`;let a=vi(e._oimReveal,t);if(typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches||a.duration===0||typeof e.animate!=`function`){n?.();return}let o=_i(a.effect,t);if(i)for(let e of[`opacity`,`translate`,`scale`]){let t=i[e];t&&t!==`none`&&(o[0][e]=t)}let s=e.animate(o,{duration:a.duration,easing:a.easing,fill:`both`});this._paused&&s.pause(),this._revealAnims.set(e,s),s.onfinish=()=>{this._revealAnims.delete(e),s.cancel(),n?.()}}_buildA11y(){let e=this._viewport;if(!e||!this.metadata)return;let t=this.metadata,n=t.lang&&t.lang[0]||t.languages&&t.languages[0]||this.lang,r=this._a11yHidden,i=this._a11yShown,a=Zi((t.slots||t.elements||[]).filter(function(e){return!r.has(String(e&&e.id))}).map(function(e){return i.has(String(e&&e.id))?Object.assign({},e,{style:Object.assign({},e.style,{isVisible:!0})}):e}),this.lang,n,!this.disableActions);this._overlay&&this._overlay.setAttribute(`aria-hidden`,`true`),e.setAttribute(`role`,`figure`),e.setAttribute(`aria-label`,Qi(t,a,this.lang,n));let o=e.querySelector(`.oim-a11y`);o||(o=document.createElement(`div`),o.className=`oim-a11y`,o.style.cssText=`position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap`,e.appendChild(o)),o.textContent=``;let s=this;a.forEach(function(e){let t;if(e.type===`text`)t=document.createElement(`p`),t.setAttribute(`lang`,e.lang),t.textContent=e.text;else if(e.type===`image`)t=document.createElement(`span`),t.setAttribute(`role`,`img`),t.setAttribute(`aria-label`,e.label);else{t=document.createElement(`button`),t.setAttribute(`type`,`button`),t.textContent=e.label;let n=function(){let t=s._overlay&&s._overlay.querySelector(`[data-slot-id="`+CSS.escape(e.slotId)+`"]`);t&&t.click()};t.addEventListener(`click`,n),t.addEventListener(`keydown`,function(e){(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n())})}o.appendChild(t)})}_a11yHidden=new Set;_a11yShown=new Set;executeToggleState(e){if(!e)return;let t=this.host.shadowRoot;if(!t)return;let n=this,r=e.hide_slots||[];r.forEach(function(e){let r=t.querySelector(`[data-slot-id="`+e+`"]`);r&&n._hideSlotElement(r)});let i=e.show_slots||[];i.forEach(function(e){let r=t.querySelector(`[data-slot-id="`+e+`"]`);r&&n._showSlotElement(r)}),r.forEach(function(e){n._a11yHidden.add(String(e)),n._a11yShown.delete(String(e))}),i.forEach(function(e){n._a11yShown.add(String(e)),n._a11yHidden.delete(String(e))}),this._buildA11y()}_activeTouchSlot=null;clearSlots(){this._activeTouchSlot&&=null;let e=this._overlay;e&&(e.replaceChildren?e.replaceChildren():e.innerHTML=``)}setLang(e){if(this.lang===e)return;let t=this.lang;this.lang=e,this.host.setAttribute(`lang`,e),this._buildA11y();let n=this._classifyLangChange(t,e);(n.styleOnly.size>0||n.content.size>0)&&(this._prefersLessMotion()||this._isLowTierOrMobile()?this._switchWithFade(n):this._switchWithBlur(n)),this.host.dispatchEvent(new CustomEvent(`oim:langchange`,{detail:{lang:e}}))}_isLowTierOrMobile(){let e=this.host;if(e&&typeof e.getAttribute==`function`){let t=e.getAttribute(`tier`)||e.getAttribute(`quality`);if(t===`low`)return!0;if(t===`high`)return!1}return this._deviceProfile.isMobile||this._deviceProfile.tier===`low`}_prefersLessMotion(){try{return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}catch{return!1}}_switchWithBlur(e){let t=this._viewport,n=this;t?(t.style.transition=`filter 0.18s ease-out`,t.style.filter=`blur(14px)`,setTimeout(function(){let r=n._applyLangChange(e),i=new Promise(function(e){setTimeout(e,600)});Promise.race([r||Promise.resolve(),i]).then(function(){t.style.transition=`filter 0.32s ease-in-out`,t.style.filter=`none`})},180)):this._applyLangChange(e)}_switchWithFade(e){let t=this.host.shadowRoot,n=this,r=new Set([...e.styleOnly,...e.content]),i=[];t&&r.forEach(function(e){let n=t.querySelector(`[data-slot-id="`+e+`"]`);n&&!/opacity/i.test(n.style.animationName||``)&&i.push(n)}),i.forEach(function(e){e.style.transition=`opacity 0.12s linear`,e.style.opacity=`0`}),setTimeout(function(){n._applyLangChange(e),t&&r.forEach(function(e){let n=t.querySelector(`[data-slot-id="`+e+`"]`);n&&(n.style.opacity=n.dataset.oimOpacity===void 0?`1`:n.dataset.oimOpacity)})},120)}_classifyLangChange(e,t){let n=new Set,r=new Set;return this.metadata&&(this.metadata.slots||this.metadata.elements||[]).forEach(function(i){if(!i||i.id===void 0||i.id===null)return;let a=Fe(i,e,t);a===`content`?r.add(String(i.id)):a===`style-only`&&n.add(String(i.id)),Array.isArray(i.languages)&&!i.languages.includes(`*`)&&i.languages.includes(e)!==i.languages.includes(t)&&n.add(String(i.id))}),{styleOnly:n,content:r}}_applyLangChange(e){let t=this.host.shadowRoot;if(t&&e.styleOnly.size>0&&this.metadata){let n=this.metadata.slots||this.metadata.elements||[],r=this;n.forEach(function(n){if(!n||!e.styleOnly.has(String(n.id)))return;let i=t.querySelector(`[data-slot-id="`+n.id+`"]`);if(!i)return;Array.isArray(n.languages)&&!n.languages.includes(`*`)&&(i.style.display=n.languages.includes(r.lang)?``:`none`);let a=Pe(n,r.lang),o=n.type===`text`?He(Le(r.metadata).get(String(n.id)),r.lang):void 0;i.style.fontSize=o?.fontSize??a.size,i.style.maxWidth=o?.maxWidth??a.maxWidthValue})}return e.content.size>0?this.renderSlots({onlyIds:e.content}):null}play(){this._paused=!1,this._isStill()||(this._animations.forEach(function(e){try{e.play()}catch{}}),this._lottieInstances&&this._lottieInstances.forEach(function(e){try{e.inst.play()}catch{}}),this._textAnimations.forEach(function(e){e.play()}),this._revealAnims.forEach(function(e){e.play()}),this._heldTimelines.forEach(function(e){e.play()}),this._heldTimelines.clear())}pause(){this._paused=!0,this._textAnimations.forEach(function(e){e.pause()}),this._revealAnims.forEach(function(e){e.pause()});let e=this._heldTimelines;this._timelines.forEach(function(t){t.playState===`running`&&t.effect?.getTiming().iterations!==1/0&&(t.pause(),e.add(t))}),this._animations.forEach(function(e){try{e.pause()}catch{}}),this._lottieInstances&&this._lottieInstances.forEach(function(e){try{e.inst.pause()}catch{}})}_bornPausedIfNeeded(e,t){this._paused&&t.pause(),e.push(t)}_destroyLottiesIn(e){if(!this._lottieInstances)return;let t=[];this._lottieInstances.forEach(function(n){if(e.has(n.slotId))try{n.inst.destroy()}catch{}else t.push(n)}),this._lottieInstances=t}};function za(e){return(e.on===`loop`||e.on===`action`)&&!!e.tracks&&e.tracks.some(e=>Ba[e.property]!==void 0)}var Ba={x:0,y:0,rotation:0,scale:1,opacity:1,blur:0},Va=[`x`,`y`,`rotation`,`scale`];function Ha(e,t,n){if(!e)return n;let r=e.keyframes,i=r.find(e=>e.t===t);if(i)return i.v;let a=r.findIndex(e=>e.t>t);if(a<=0)return a===0?r[0].v:r[r.length-1].v;let o=r[a-1],s=r[a];return o.v+(s.v-o.v)*(t-o.t)/(s.t-o.t)}function Ua(e){let t=t=>e.find(e=>e.property===t),n=Va.some(e=>t(e)),r=new Map;for(let t of e)if(Ba[t.property]!==void 0)for(let e of t.keyframes){let n=r.get(e.t);n||r.set(e.t,n={offset:e.t}),e.e!==void 0&&(n.easing=hi(e.e,`linear`)),t.property===`opacity`?n.opacity=e.v:t.property===`blur`?n.filter=e.v>0?`blur(`+e.v+`px)`:`none`:n.moves=!0}return[...r.values()].sort((e,t)=>e.offset-t.offset).map(function(e){let{moves:r,...i}=e;if(n&&r){let n=n=>Ha(t(n),e.offset,Ba[n]);i.transform=`translate(`+n(`x`)+`px, `+n(`y`)+`px) rotate(`+n(`rotation`)+`deg) scale(`+n(`scale`)+`)`}return i})}function Wa(e){if(!be(e))return e;let t=Ce(e);return t.missing.forEach(e=>console.warn(`[OimPlayer] resource "${e}" is not in the document`)),Ze(t.document)}var Ga=class extends Ra{fileMetadata=null;_posterFade=!1;constructor(e,t){super();let n=t||{};this.host=e,this.poster=n.poster===`only`?`only`:`auto`,this.lang=e.getAttribute(`lang`)||`en`,this.showControls=e.getAttribute(`show-controls`)!==`false`,this._deviceProfile=m(),this.allowZoom=n.allowZoom===!0,this.showLanguageSelector=n.showLanguageSelector!==!1,this.showSlots=n.showSlots!==!1,this.allowLottie=n.allowLottie!==!1&&e.getAttribute(`allow-lottie`)!==`false`,this.allowDynamicColors=n.allowDynamicColors!==!1&&e.getAttribute(`allow-dynamic-colors`)!==`false`;let r=o(e,n,typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches);this.disableAnimations=r.disableAnimations,this.disableActions=r.disableActions,this.dropdownBlur=n.dropdownBlur!==!1&&e.getAttribute(`dropdown-blur`)!==`false`,this.fit=n.fit||`contain`,this.align=n.align||`center`}destroy(){this.imageUrl&&URL.revokeObjectURL(this.imageUrl),this._resizeObserver&&=(this._resizeObserver.disconnect(),null),this._onFullscreenChange&&(document.removeEventListener(`fullscreenchange`,this._onFullscreenChange),document.removeEventListener(`webkitfullscreenchange`,this._onFullscreenChange),document.removeEventListener(`mozfullscreenchange`,this._onFullscreenChange),document.removeEventListener(`MSFullscreenChange`,this._onFullscreenChange)),this._lottieInstances&&=(this._lottieInstances.forEach(function(e){try{e.inst.destroy()}catch{}}),[]),this._animations.forEach(function(e){try{e.cancel()}catch{}}),this._animations=[],this._timelines.clear(),this._revealAnims.clear(),this._heldTimelines.clear(),this._textAnimations.forEach(function(e){try{e.stop()}catch{}}),this._textAnimations=[],this._onDragMove&&=(window.removeEventListener(`mousemove`,this._onDragMove),null),this._onDragEnd&&=(window.removeEventListener(`mouseup`,this._onDragEnd),null)}async load(e){let t=this.host,n=t.shadowRoot||t.attachShadow({mode:`open`});try{if(typeof e==`string`?this.imageUrl=e:(this.imageUrl&&this.imageUrl.startsWith(`blob:`)&&URL.revokeObjectURL(this.imageUrl),this.imageUrl=URL.createObjectURL(e)),t.classList.add(`oim-player-host`),t.classList.add(`oim-align-`+this.align),t.classList.add(`oim-tier-`+this._deviceProfile.tier),this._deviceProfile.isMobile&&t.classList.add(`oim-mobile`),n.innerHTML=`<div class="oim-player-viewport oim-fit-`+this.fit+`" part="viewport"><img class="oim-player-base" crossorigin="anonymous" src="`+this.imageUrl+`" alt="" aria-hidden="true" part="base" /><div class="oim-layer-overlay" aria-hidden="true" part="overlay"></div></div>`,ee(n),this._viewport=n.querySelector(`.oim-player-viewport`),this._baseImg=n.querySelector(`.oim-player-base`),this._overlay=n.querySelector(`.oim-layer-overlay`),this._stage=this.host,!this.allowDynamicColors&&this._viewport)for(let e of re)this._viewport.style.setProperty(`--oim-color-`+e,`initial`);this.applyPalette(),(this._prefersLessMotion()||this._isLowTierOrMobile())&&this._viewport&&(this._viewport.style.filter=`none`);let r=this,i=null,a=()=>{i||=requestAnimationFrame(()=>{r.updateViewportSize(),r.updateScale(),i=null})};typeof ResizeObserver<`u`&&this._viewport&&(this._resizeObserver&&this._resizeObserver.disconnect(),this._resizeObserver=new ResizeObserver(a),this._resizeObserver.observe(this.host)),this._onFullscreenChange=a,document.addEventListener(`fullscreenchange`,this._onFullscreenChange),document.addEventListener(`webkitfullscreenchange`,this._onFullscreenChange),document.addEventListener(`mozfullscreenchange`,this._onFullscreenChange),document.addEventListener(`MSFullscreenChange`,this._onFullscreenChange);let o=this._baseImg,c=this._viewport;function l(){c&&o&&o.naturalWidth>0&&(c.style.setProperty(`--oim-ar`,o.naturalWidth+` / `+o.naturalHeight),r._baseImg=o,r.updateViewportSize(),r.updateScale(),r.metadata&&r.renderSlots())}return o&&o.complete&&o.naturalWidth>0?l():o&&(o.onload=l),this.updateViewportSize(),this.updateScale(),this._bindViewportEvents(),D.getBlob(e).then(t=>new Promise((n,i)=>{s.requestRender(r,t,e,n,i)})).catch(e=>{if(console.error(`[OimPlayer::ImageEngine::load]`,e),String(e&&e.message).indexOf(`OIM_ALTERED`)===0){n.innerHTML=`<div class="oim-player-error oim-player-refused" part="error"></div>`,ee(n);let e=n.querySelector(`.oim-player-error`);e&&(e.textContent=u(`tampered`,r.lang))}throw t.dispatchEvent(new CustomEvent(`error`,{detail:e})),e})}catch(e){console.error(`[OimPlayer::ImageEngine]`,e),n.innerHTML=`<div class="oim-player-error" part="error"></div>`;let r=n.querySelector(`.oim-player-error`);return r&&(r.textContent=u(`loadError`,this.lang)+e.message),t.dispatchEvent(new CustomEvent(`error`,{detail:e})),!1}}async _verifyMainThread(e){let t=await ht(e);if(!t.metadata)return{metadata:{slots:[]},security:`no_metadata`,announce:!1};let n=Ut(t.metadata);if(n.length>0)return{refused:!0,security:`corrupt`,error:`Corrupted or tampered OIM file: `+n[0]};let r=!!(t.metadata.signature&&t.metadata.key_version),i=await Rt(t.metadata),a=zt({isSigned:r,isSigValid:i,keyExpired:r&&i?await Bt(t.metadata):!1,metadata:t.metadata,imageHash:t.imageHash});if(Vt(a))return{refused:!0,security:a,error:Ht+`: `+a};let o,s=!1;return i?a===`unsigned`||a===`expired_key`?o={slots:[],elements:[],layers:[]}:(s=!0,be(t.metadata)||k(t.metadata),o=t.metadata):o={slots:[]},{metadata:o,security:a,announce:s}}async _verifyWithWorker(e){let t=typeof window<`u`?window.location.hostname:``,n=typeof window<`u`?window.location.origin:``,r;try{r=await dt(e,t,n)}catch(t){return console.warn(`[OimPlayer] Web Worker unavailable or crashed (possibly blocked by CSP). Falling back to main-thread execution.`,t),this._verifyMainThread(e)}return r.success?{metadata:r.metadata,security:r.security||`unsigned`,announce:!0}:r.refused?{refused:!0,security:r.security,error:r.error}:(console.warn(`[OimPlayer] Web Worker reported execution failure. Falling back to main-thread execution.`,r.error),this._verifyMainThread(e))}async _verify(e){return typeof Worker>`u`?this._verifyMainThread(e):this._verifyWithWorker(e)}async _applyVerified(e){let t=this,n=this.poster===`only`;this._posterFade=!n&&be(e.metadata)&&!Se(e.metadata);let r=structuredClone(e.metadata);if(this.fileMetadata=r,this.metadata=n?structuredClone(r):Wa(structuredClone(r)),n||this.applyPalette(),this.securityStatus=e.security,this.securityStatus===`unsigned`){try{c(this.host,`data-oim-unsigned`,`data-oim-sin-firma`)}catch{}console.warn(`[OimPlayer] Unsigned file: painting the base image only. Interactive layers need a signature.`)}if(this.securityStatus===`expired_key`){try{c(this.host,`data-oim-key-retired`,`data-oim-clave-retirada`)}catch{}console.warn(`[OimPlayer] This work was signed with a retired key. Ask the author to export it again.`)}return n?(this._viewport?.classList.add(`oim-viewport--poster`,`oim-viewport--ready`),this.host.dispatchEvent(new CustomEvent(`oim:loaded`,{detail:{type:`image`,metadata:this.fileMetadata,security:this.securityStatus}})),!0):(e.announce&&t._announceUnsupported(this.metadata),this.embeddedFontFamilies=await sn(on(this.metadata)),this._posterFade&&this._viewport?.classList.add(`oim-viewport--poster`),this.updateViewportSize(),this.updateScale(),await this.renderSlots(),typeof document<`u`&&document.fonts&&document.fonts.ready.then(()=>{t.host&&t._overlay&&(t.updateViewportSize(),t.updateScale(),t._overlay.querySelectorAll(`.oim-slot`).forEach(e=>{let t=e.style.transition;e.style.setProperty(`transition`,`none`,`important`),e.offsetWidth,e.style.transition=t}))}),this.host.dispatchEvent(new CustomEvent(`oim:loaded`,{detail:{type:`image`,metadata:this.fileMetadata,security:this.securityStatus}})),!0)}sceneReady(){let e=this._baseImg;this._posterFade&&e&&(this._posterFade=!1,this._prefersLessMotion()?e.style.display=`none`:(e.classList.add(`oim-base--faded`),setTimeout(()=>{e.style.display=`none`},200)))}async _executeLoad(e,t){try{let n=await D.getVerified(t??e,e=>this._verify(e));if(n.refused)throw this.securityStatus=n.security,Error(n.error);return this._applyVerified(n)}catch(e){throw console.error(`[OimPlayer::ImageEngine::_executeLoad]`,e),e}}_announceUnsupported(e){let t;try{t=$t(e,{version:Yt,capabilities:Xt})}catch{return}if(!t.hasNotice)return;let n=en(t);try{console.warn(`[OimPlayer] `+n)}catch{}try{t.missingCapabilities&&t.missingCapabilities.length>0&&c(this.host,`data-oim-unsupported`,`data-oim-sin-soporte`,t.missingCapabilities.join(` `)),t.missingRequiredCapabilities&&t.missingRequiredCapabilities.length>0&&c(this.host,`data-oim-missing-required`,`data-oim-requeridas-faltantes`,t.missingRequiredCapabilities.join(` `)),t.versionTooOld&&t.requiredVersion&&c(this.host,`data-oim-required-version`,`data-oim-version-exigida`,t.requiredVersion),this.host.dispatchEvent(new CustomEvent(`oim:incomplete`,{bubbles:!0,composed:!0,detail:{message:n,mensaje:n,...t}})),t.cannotRender&&this.host.dispatchEvent(new CustomEvent(`oim:unsupported`,{bubbles:!0,composed:!0,detail:{message:n,mensaje:n,...t}}))}catch{}}updateScale(){if(!this._viewport)return;let e=this._viewport.offsetWidth,t=this.metadata&&this.metadata.canvas?this.metadata.canvas.natural_width||this.metadata.canvas.width:0,n=e/(this.metadata&&(this.metadata.artboardWidth||this.metadata.canvasWidth||this.metadata.canvas_width)||t||this._baseImg&&this._baseImg.naturalWidth||1080);this._viewport.style.setProperty(`--oim-fit`,n.toFixed(6))}updateViewportSize(){if(!this._viewport)return;let e=this._baseImg?this._baseImg.naturalWidth:0,t=this._baseImg?this._baseImg.naturalHeight:0;if(e===0&&this.metadata&&this.metadata.canvas&&(e=this.metadata.canvas.natural_width||this.metadata.canvas.width||1080,t=this.metadata.canvas.natural_height||this.metadata.canvas.height||1920),e===0)return;let n=this.host.offsetWidth,r=this.host.offsetHeight;if(n===0||r===0){if(!this._retryViewportSize){this._retryViewportSize=!0;let e=this;setTimeout(()=>{e._retryViewportSize=!1,e.updateViewportSize(),e.updateScale()},100)}return}let i=e/t,a=n/r,o,s;this.fit===`cover`?a>i?(o=n,s=n/i):(s=r,o=r*i):a>i?(s=r,o=r*i):(o=n,s=n/i),this._viewport.style.width=Math.round(o)+`px`,this._viewport.style.height=Math.round(s)+`px`}_bindViewportEvents(){let e=this,t=this._stage;if(!t)return;t.addEventListener(`pointerdown`,function(t){if(t.pointerType!==`mouse`&&e._activeTouchSlot&&(typeof t.composedPath==`function`?t.composedPath():[]).indexOf(e._activeTouchSlot.el)===-1){let t=e._activeTouchSlot;e._activeTouchSlot=null,t.leave()}});let n=!1,r=0,i=0,a=0,o=0;t.addEventListener(`mousedown`,function(s){e.allowZoom&&(e.zoom<=1||s.target.closest(`.oim-slot`)||(n=!0,e._viewport&&(e._viewport.style.transition=`none`),t.style.cursor=`grabbing`,r=s.clientX,i=s.clientY,a=e.panX,o=e.panY,s.preventDefault()))}),this._onDragMove=function(t){if(!n)return;let s=t.clientX-r,c=t.clientY-i;e.panX=a+s,e.panY=o+c,e._constrainPan(),e._applyViewportTransform()},window.addEventListener(`mousemove`,this._onDragMove),this._onDragEnd=function(){n&&(n=!1,e._viewport&&(e._viewport.style.transition=`transform 0.1s linear`),t.style.cursor=e.zoom>1?`grab`:`default`)},window.addEventListener(`mouseup`,this._onDragEnd);let s=null,c=1,l=!1,u=0,d=0,f=0,p=0;t.addEventListener(`touchstart`,function(t){if(e.allowZoom){if(t.touches.length===2)s=Ma(t.touches),c=e.zoom,l=!1,e._viewport&&(e._viewport.style.transition=`none`);else if(t.touches.length===1&&e.zoom>1){if(t.target.closest(`.oim-slot`))return;l=!0,u=t.touches[0].clientX,d=t.touches[0].clientY,f=e.panX,p=e.panY,e._viewport&&(e._viewport.style.transition=`none`)}}},{passive:!0}),t.addEventListener(`touchmove`,function(t){if(e.allowZoom){if(t.touches.length===2&&s!==null){let n=Ma(t.touches);if(s>0){let t=n/s;e.setZoom(c*t)}}else if(t.touches.length===1&&l){let n=t.touches[0].clientX-u,r=t.touches[0].clientY-d;e.panX=f+n,e.panY=p+r,e._constrainPan(),e._applyViewportTransform()}}},{passive:!0}),t.addEventListener(`touchend`,function(){s=null,l=!1,e._viewport&&(e._viewport.style.transition=`transform 0.1s linear`)},{passive:!0}),e.allowZoom&&t.addEventListener(`wheel`,function(t){t.preventDefault(),e.setZoom(Jt(e.zoom,t.deltaY,t.deltaMode,t.ctrlKey))},{passive:!1})}_constrainPan(){let e=this.host;if(!e)return;let t=e.clientWidth,n=e.clientHeight,r=this.zoom,i=Math.max(0,t*(r-1)/2),a=Math.max(0,n*(r-1)/2);this.panX=Math.max(-i,Math.min(i,this.panX)),this.panY=Math.max(-a,Math.min(a,this.panY))}_applyViewportTransform(){this._viewport&&(this._viewport.style.transform=`translate3d(`+this.panX+`px, `+this.panY+`px, 0) scale(`+this.zoom+`)`)}setZoom(e){this.zoom=Math.max(1,Math.min(4,e)),this.zoom<=1&&(this.panX=0,this.panY=0),this._constrainPan(),this._applyViewportTransform();let t=this._stage;t&&(t.style.cursor=this.zoom>1?`grab`:`default`)}};function Ka(e,t){let n=``;if(typeof e==`string`){let t=e.indexOf(`#`),r=e.indexOf(`?`),i=t===-1?r===-1?e.length:r:t,a=e.lastIndexOf(`.`,i);a!==-1&&(n=e.substring(a+1,i).toLowerCase())}else if(e&&e.name){let t=e.name,r=t.lastIndexOf(`.`);r!==-1&&(n=t.substring(r+1).toLowerCase())}if(n===`oim`||n===`png`)return`image`;if(n===`ovm`||n===`webm`||n===`mp4`||n===`mkv`)return`video`;if(t){let e=String.fromCharCode(t[0],t[1],t[2],t[3]);if(e===`PNG`)return`image`;if(e===`OVM\0`||e===`Eߣ`)return`video`}return`image`}function qa(e){if(!e)return null;let t=e.trim();if(/^data:image\//i.test(t))return t;try{let e=new URL(t,document.baseURI);return e.protocol===`http:`||e.protocol===`https:`||e.protocol===`blob:`?e.href:null}catch{return null}}var Q=Object.create(HTMLElement.prototype);function Ja(){if(typeof document>`u`||document.getElementById(`oim-player-gap`))return;let e=document.createElement(`style`);e.id=`oim-player-gap`,e.textContent=`:where(oim-player){display:block}:where(oim-player:not([data-oim-loaded])){min-height:200px}`,(document.head||document.documentElement).appendChild(e)}Q.connectedCallback=function(){Ja(),this.classList.add(`oim-player-host`),this._engine=null,this._src=this.getAttribute(`src`),this._oimOptions||={},this.hasAttribute(`fit`)&&(this._oimOptions.fit=this.getAttribute(`fit`)),this.hasAttribute(`align`)&&(this._oimOptions.align=this.getAttribute(`align`)),this.hasAttribute(`dropdown-blur`)&&(this._oimOptions.dropdownBlur=this.getAttribute(`dropdown-blur`)!==`false`),this.hasAttribute(`allow-lottie`)&&(this._oimOptions.allowLottie=this.getAttribute(`allow-lottie`)!==`false`),this.hasAttribute(`allow-dynamic-colors`)&&(this._oimOptions.allowDynamicColors=this.getAttribute(`allow-dynamic-colors`)!==`false`),this.hasAttribute(`placeholder`)&&(this._oimOptions.placeholder=this.getAttribute(`placeholder`)),this.hasAttribute(`poster`)&&(this._oimOptions.poster=this.getAttribute(`poster`)),this.hasAttribute(`allow-zoom`)&&(this._oimOptions.allowZoom=this.getAttribute(`allow-zoom`)===`true`),this._syncPlaceholder(),this._mqOscuro=typeof matchMedia==`function`?matchMedia(`(prefers-color-scheme: dark)`):null,this._onEsquema=()=>this._engine&&this._engine.applyPalette(),this._mqOscuro&&this._mqOscuro.addEventListener(`change`,this._onEsquema),this._replantearActividad()},Q._replantearActividad=function(){if(this._src&&this.isConnected){if(!this._observers){if(!(`IntersectionObserver`in window)){this._moveTo(`active`);return}let e=this,t=()=>e._scheduleDecision();this._observers=[new IntersectionObserver(n=>{let r=n[0];r&&typeof r.isIntersecting==`boolean`&&(e._isNear=r.isIntersecting),t()},{rootMargin:`200px`}),new IntersectionObserver(n=>{let r=n[0];r&&typeof r.isIntersecting==`boolean`&&(e._isVisible=r.isIntersecting),t()},{threshold:[0,.01]})],this._observers.forEach(e=>e.observe(this)),this._onTabChange=t,document.addEventListener(`visibilitychange`,this._onTabChange),this.getAttribute(`activate-on`)===`hover`&&(this._onPointerEnter=()=>{e._hasPointer=!0,t()},this._onPointerLeave=()=>{e._hasPointer=!1,t()},this.addEventListener(`mouseenter`,this._onPointerEnter),this.addEventListener(`mouseleave`,this._onPointerLeave))}this._scheduleDecision()}},Q._scheduleDecision=function(){if(this._activityFrame)return;let e=this;this._activityFrame=requestAnimationFrame(function(){e._activityFrame=null,e._decide()})},Q._decide=function(){if(!this._src||!this.isConnected)return;let e=typeof document<`u`&&document.visibilityState===`hidden`,t,n;if(typeof this._isNear==`boolean`||typeof this._isVisible==`boolean`){t=this._isNear??!1;let r=this._isVisible??!1;n=(t||r)&&r&&!e,t||=r}else{let r=this.getBoundingClientRect(),i=window.innerHeight||0;t=r.bottom>-200&&r.top<i+200,n=t&&!e&&r.bottom>0&&r.top<i}this.getAttribute(`activate-on`)===`hover`&&typeof matchMedia==`function`&&matchMedia(`(hover: hover)`).matches&&(n&&=!!this._hasPointer),this.getAttribute(`activate-on`)===`manual`&&(n=!1),this._moveTo(n?`active`:t?`ready`:`dormant`)},Q._moveTo=function(e){this._activityState!==e&&(this._activityState=e,e!==`dormant`&&(this._engine||this._initPlayer(),e===`active`?this.play():this.pause()))},Q._startAutoRotateLang=function(){this._stopAutoRotateLang();let e=this.getAttribute(`auto-rotate-lang`);if(!e||e===`false`||this.classList.contains(`oim-player-paused`))return;let t=parseInt(e,10);(isNaN(t)||t<=0)&&(t=3e3);let n=this;this._autoRotateIntervalId=setInterval(()=>{let e=n._engine?n._engine.metadata:null;if(!e)return;let t=e.slots||e.elements||[],r={};for(let e=0;e<t.length;e++){let n=t[e].content||{};Object.keys(n).forEach(e=>{r[e.toLowerCase()]=!0})}let i=Object.keys(r).sort();if(i.length<=1)return;let a=(n.getAttribute(`lang`)||n._engine&&n._engine.lang||`en`).toLowerCase(),o=i[(i.indexOf(a)+1)%i.length];n.setAttribute(`lang`,o)},t)},Q._stopAutoRotateLang=function(){this._autoRotateIntervalId&&=(clearInterval(this._autoRotateIntervalId),null)},Q.disconnectedCallback=function(){this._mqOscuro&&=(this._mqOscuro.removeEventListener(`change`,this._onEsquema),null),this._stopAutoRotateLang(),this._observers&&=(this._observers.forEach(e=>e.disconnect()),null),this._onTabChange&&=(document.removeEventListener(`visibilitychange`,this._onTabChange),null),this._onPointerEnter&&(this.removeEventListener(`mouseenter`,this._onPointerEnter),this.removeEventListener(`mouseleave`,this._onPointerLeave),this._onPointerEnter=null,this._onPointerLeave=null),this._activityFrame&&=(cancelAnimationFrame(this._activityFrame),null),this._isNear=null,this._isVisible=null,this._activityState=`dormant`,this._engine&&this._engine.destroy&&this._engine.destroy()},Q.attributeChangedCallback=function(e,t,n){if(e===`placeholder`&&t!==n)this._oimOptions||={},this._oimOptions.placeholder=n,this._syncPlaceholder();else if(e===`poster`&&t!==n)this._oimOptions||={},this._oimOptions.poster=n,this._engine&&this._initPlayer();else if(e===`palette`&&t!==n)this._engine&&this._engine.applyPalette();else if(e===`src`&&t!==n)this._src=n,this._engine?this._initPlayer():this._replantearActividad();else if(e===`activate-on`&&t!==n)this._replantearActividad();else if(e===`lang`&&t!==n)this._engine&&this._engine.setLang&&this._engine.setLang(n);else if((e===`fit`||e===`align`)&&t!==n)this._oimOptions||={},this._oimOptions[e]=n,this._syncPlaceholder(),this._initPlayer();else if(e===`dropdown-blur`&&t!==n)this._oimOptions||={},this._oimOptions.dropdownBlur=n!==`false`,this._engine&&(this._engine.dropdownBlur=n!==`false`);else if(e===`allow-lottie`&&t!==n)this._oimOptions||={},this._oimOptions.allowLottie=n!==`false`,this._engine&&(this._engine.allowLottie=n!==`false`,this._engine.renderSlots&&this._engine.renderSlots());else if(e===`auto-rotate-lang`&&t!==n)this._startAutoRotateLang();else if((e===`mode`||e===`disable-animations`||e===`disable-actions`)&&t!==n){if(this._engine){let e=typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,t=o(this,this._oimOptions||{},!!e);this._engine.disableAnimations=t.disableAnimations,this._engine.disableActions=t.disableActions,this._engine.renderSlots&&this._engine.renderSlots()}}else e===`show-slots`&&t!==n&&(this._oimOptions||={},this._oimOptions.showSlots=n!==`false`,this._engine&&(this._engine.showSlots=n!==`false`,this._engine.renderSlots&&this._engine.renderSlots()))},Q._syncPlaceholder=function(){let e=this._engine||this._placeholderSettled?null:qa(this._oimOptions&&this._oimOptions.placeholder);if(!e){this._removePlaceholder();return}let t=this.shadowRoot||this.attachShadow({mode:`open`});if(!t.querySelector(`img.oim-placeholder`)){let e=document.createElement(`style`);e.className=`oim-placeholder-style`,e.textContent=`:host{position:relative}`;let n=document.createElement(`img`);n.className=`oim-placeholder`,n.alt=``,n.decoding=`async`,n.addEventListener(`error`,()=>this._removePlaceholder()),t.append(e,n)}let n=t.querySelector(`img.oim-placeholder`),r=this._oimOptions&&this._oimOptions.fit===`cover`?`cover`:`contain`,i=this._oimOptions&&this._oimOptions.align,a=i===`top`?`center top`:i===`bottom`?`center bottom`:`center center`;n.setAttribute(`style`,`position:absolute;inset:0;width:100%;height:100%;object-fit:${r};object-position:${a}`),n.getAttribute(`src`)!==e&&n.setAttribute(`src`,e)},Q._removePlaceholder=function(){this.shadowRoot&&this.shadowRoot.querySelectorAll(`.oim-placeholder, .oim-placeholder-style`).forEach(e=>e.remove())},Q._initPlayer=function(){if(!this._src)return;this._loading=!0;let e=this,t=this._src;e._oimOptions||={},e.hasAttribute(`fit`)&&(e._oimOptions.fit=e.getAttribute(`fit`)),e.hasAttribute(`align`)&&(e._oimOptions.align=e.getAttribute(`align`)),e.hasAttribute(`dropdown-blur`)&&(e._oimOptions.dropdownBlur=e.getAttribute(`dropdown-blur`)!==`false`),e.hasAttribute(`placeholder`)&&(e._oimOptions.placeholder=e.getAttribute(`placeholder`)),e.hasAttribute(`poster`)&&(e._oimOptions.poster=e.getAttribute(`poster`)),e.hasAttribute(`allow-lottie`)&&(e._oimOptions.allowLottie=e.getAttribute(`allow-lottie`)!==`false`),e.hasAttribute(`allow-zoom`)&&(e._oimOptions.allowZoom=e.getAttribute(`allow-zoom`)===`true`);let n;n=t instanceof Blob?t.slice(0,16).arrayBuffer().then(e=>new Uint8Array(e)).catch(()=>null):D.sniff(t),n.then(n=>{if(!e.isConnected)return;let r=Ka(t,n);e._engine&&e._engine.destroy&&e._engine.destroy(),r===`video`&&console.warn(`[OimPlayer] Video media detected. Video support has been migrated to <ovm-player> from @oim-media/player-ovm. Falling back to ImageEngine.`),e._engine=new Ga(e,e._oimOptions),e._loading=!1,e.classList.contains(`oim-player-paused`)&&e._engine.pause(),c(e,`data-oim-loaded`,`data-oim-cargado`);let i=()=>{e._placeholderSettled=!0,e._syncPlaceholder()};e._engine.load(t).then(()=>{i(),e._startAutoRotateLang()}).catch(e=>{i(),console.warn(`[OimPlayer] Engine load error during auto-rotate initialization:`,e)})})},Q._wake=function(){this._engine||this._loading||!this._src||this._initPlayer()},Q.getMetadata=function(){return this._wake(),this._engine?this._engine.fileMetadata:null},Q.getSecurityStatus=function(){return this._wake(),this._engine?this._engine.securityStatus||`unsigned`:null},Q.setLang=function(e){this._wake(),this._engine&&this._engine.setLang&&this._engine.setLang(e)},Q.setZoom=function(e){this._engine&&this._engine.setZoom&&this._engine.setZoom(e)},Q.play=function(){this._wake(),this.classList.remove(`oim-player-paused`),this._engine&&this._engine.play&&this._engine.play(),this._startAutoRotateLang()},Q.pause=function(){this.classList.add(`oim-player-paused`),this._engine&&this._engine.pause&&this._engine.pause(),this._stopAutoRotateLang()},Q.seek=function(e){this._engine&&this._engine.seek&&this._engine.seek(e)},Q.getEngine=function(){return this._engine},Q.destroy=function(){this._engine&&this._engine.destroy&&(this._engine.destroy(),this._engine=null),this.parentNode&&this.parentNode.removeChild(this)};var Ya=[`src`,`placeholder`,`poster`,`lang`,`activate-on`,`fit`,`align`,`dropdown-blur`,`allow-lottie`,`palette`,`auto-rotate-lang`,`disable-animations`,`disable-actions`,`mode`,`show-slots`],$;typeof customElements<`u`&&!customElements.get(`oim-player`)&&($=class extends HTMLElement{_engine=null;_src=null},$.prototype.connectedCallback=Q.connectedCallback,$.prototype.disconnectedCallback=Q.disconnectedCallback,$.prototype.attributeChangedCallback=Q.attributeChangedCallback,$.prototype.getMetadata=Q.getMetadata,$.prototype.getSecurityStatus=Q.getSecurityStatus,$.prototype.setLang=Q.setLang,$.prototype.setZoom=Q.setZoom,$.prototype.play=Q.play,$.prototype.pause=Q.pause,$.prototype.seek=Q.seek,$.prototype.getEngine=Q.getEngine,$.prototype._initPlayer=Q._initPlayer,$.prototype._syncPlaceholder=Q._syncPlaceholder,$.prototype._removePlaceholder=Q._removePlaceholder,$.prototype._replantearActividad=Q._replantearActividad,$.prototype._decide=Q._decide,$.prototype._scheduleDecision=Q._scheduleDecision,$.prototype._moveTo=Q._moveTo,$.prototype._wake=Q._wake,$.prototype._startAutoRotateLang=Q._startAutoRotateLang,$.prototype._stopAutoRotateLang=Q._stopAutoRotateLang,$.prototype.destroy=Q.destroy,$.observedAttributes=Ya,Object.defineProperty($.prototype,"src",{get:function(){return this._src},set:function(e){this._src=e,typeof e==`string`?this.setAttribute(`src`,e):this._initPlayer()}}),Object.defineProperty($.prototype,"languages",{get:function(){if(!this._engine||!this._engine.metadata)return[];let e=this._engine.metadata.slots||this._engine.metadata.elements||[],t={};for(let n=0;n<e.length;n++){let r=e[n].content||{};Object.keys(r).forEach(e=>{t[e.toLowerCase()]=!0})}return Object.keys(t).sort()}}),Object.defineProperty($.prototype,"currentLang",{get:function(){return this._engine?this._engine.lang:this.getAttribute(`lang`)||`en`}}),Object.defineProperty($.prototype,"lang",{get:function(){return this._engine?this._engine.lang:this.getAttribute(`lang`)||`en`},set:function(e){this.setAttribute(`lang`,e)}}),customElements.define(`oim-player`,$)),window.OimPlayerElement=Q;var Xa={mount:function(e,t,n){let r=typeof e==`string`?document.getElementById(e):e;if(!r)return console.error(`[OimPlayer.mount] Container not found:`,e),null;let i=document.createElement(`oim-player`);return i._oimOptions=n||{},i.src=t,i.setAttribute(`show-controls`,n&&n.showLanguageSelector===!1?`false`:`true`),n&&n.allowLottie===!1&&i.setAttribute(`allow-lottie`,`false`),r.replaceChildren?r.replaceChildren(i):(r.innerHTML=``,r.appendChild(i)),i}},Za=Xa.mount;return window.OimPlayer=Xa,e.OimPlayer=Xa,e.default=Xa,e.OimPlayerElement=Q,e.mount=Za,e})({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oim-media/player-oim",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.29.0",
|
|
4
4
|
"description": "Web player for OIM interactive images: a framework-free <oim-player> element that verifies the signature and composes each layer.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"oim",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"main": "./dist/esm/index.js",
|
|
17
17
|
"types": "./src/index.d.ts",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@oim-media/core": "1.
|
|
19
|
+
"@oim-media/core": "1.29.0",
|
|
20
20
|
"lottie-web": "^5.12.2"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
File without changes
|