@peekling/runtime 0.1.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/AUTHORS +8 -0
- package/LICENSE +202 -0
- package/LICENSING.md +20 -0
- package/NOTICE +6 -0
- package/README.md +294 -0
- package/dist/configuration-validation.d.ts +19 -0
- package/dist/configuration-validation.d.ts.map +1 -0
- package/dist/configuration-validation.js +298 -0
- package/dist/content.d.ts +44 -0
- package/dist/content.d.ts.map +1 -0
- package/dist/content.js +738 -0
- package/dist/contracts.d.ts +10 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js +106 -0
- package/dist/defaults.d.ts +7 -0
- package/dist/defaults.d.ts.map +1 -0
- package/dist/defaults.js +6 -0
- package/dist/diagnostics.d.ts +25 -0
- package/dist/diagnostics.d.ts.map +1 -0
- package/dist/diagnostics.js +122 -0
- package/dist/direction.d.ts +3 -0
- package/dist/direction.d.ts.map +1 -0
- package/dist/direction.js +6 -0
- package/dist/errors.d.ts +15 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +53 -0
- package/dist/events.d.ts +5 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +60 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/input.d.ts +31 -0
- package/dist/input.d.ts.map +1 -0
- package/dist/input.js +215 -0
- package/dist/json.d.ts +3 -0
- package/dist/json.d.ts.map +1 -0
- package/dist/json.js +109 -0
- package/dist/loader.d.ts +33 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +477 -0
- package/dist/locomotion.d.ts +8 -0
- package/dist/locomotion.d.ts.map +1 -0
- package/dist/locomotion.js +29 -0
- package/dist/normalized.d.ts +5 -0
- package/dist/normalized.d.ts.map +1 -0
- package/dist/normalized.js +266 -0
- package/dist/overrides.d.ts +29 -0
- package/dist/overrides.d.ts.map +1 -0
- package/dist/overrides.js +296 -0
- package/dist/own-data.d.ts +18 -0
- package/dist/own-data.d.ts.map +1 -0
- package/dist/own-data.js +205 -0
- package/dist/pack-api.d.ts +9 -0
- package/dist/pack-api.d.ts.map +1 -0
- package/dist/pack-api.js +6 -0
- package/dist/pack-shared.d.ts +28 -0
- package/dist/pack-shared.d.ts.map +1 -0
- package/dist/pack-shared.js +408 -0
- package/dist/pack.d.ts +6 -0
- package/dist/pack.d.ts.map +1 -0
- package/dist/pack.js +316 -0
- package/dist/peekling.css +1 -0
- package/dist/peekling.css.sri +1 -0
- package/dist/peekling.js +7469 -0
- package/dist/peekling.js.sri +1 -0
- package/dist/peekling.min.js +2 -0
- package/dist/peekling.min.js.sri +1 -0
- package/dist/plan-compiler.d.ts +82 -0
- package/dist/plan-compiler.d.ts.map +1 -0
- package/dist/plan-compiler.js +724 -0
- package/dist/plan.d.ts +21 -0
- package/dist/plan.d.ts.map +1 -0
- package/dist/plan.js +287 -0
- package/dist/preflight-api.d.ts +3 -0
- package/dist/preflight-api.d.ts.map +1 -0
- package/dist/preflight-api.js +1 -0
- package/dist/preflight.d.ts +22 -0
- package/dist/preflight.d.ts.map +1 -0
- package/dist/preflight.js +158 -0
- package/dist/registry.d.ts +9 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +24 -0
- package/dist/renderer.d.ts +16 -0
- package/dist/renderer.d.ts.map +1 -0
- package/dist/renderer.js +176 -0
- package/dist/resolver.d.ts +3 -0
- package/dist/resolver.d.ts.map +1 -0
- package/dist/resolver.js +30 -0
- package/dist/runtime-diagnostics.d.ts +3 -0
- package/dist/runtime-diagnostics.d.ts.map +1 -0
- package/dist/runtime-diagnostics.js +5 -0
- package/dist/runtime-validation.d.ts +6 -0
- package/dist/runtime-validation.d.ts.map +1 -0
- package/dist/runtime-validation.js +104 -0
- package/dist/runtime.d.ts +87 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +1015 -0
- package/dist/sections.d.ts +15 -0
- package/dist/sections.d.ts.map +1 -0
- package/dist/sections.js +221 -0
- package/dist/styles.d.ts +18 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/styles.js +132 -0
- package/dist/tooling-preflight.d.ts +23 -0
- package/dist/tooling-preflight.d.ts.map +1 -0
- package/dist/tooling-preflight.js +207 -0
- package/dist/tooling-validation.d.ts +8 -0
- package/dist/tooling-validation.d.ts.map +1 -0
- package/dist/tooling-validation.js +94 -0
- package/dist/types.d.ts +403 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +29 -0
- package/dist/visibility.d.ts +12 -0
- package/dist/visibility.d.ts.map +1 -0
- package/dist/visibility.js +333 -0
- package/dist/web-component.d.ts +31 -0
- package/dist/web-component.d.ts.map +1 -0
- package/dist/web-component.js +236 -0
- package/package.json +74 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
sha384-F8QK1Ohgz9Gno8MS9vdSFl0ZORwZdxQQrBIoqxt6hIDDKJkSvsVyR1UgoNSA/hlu
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*!Apache-2.0*/
|
|
2
|
+
(()=>{function t(t,e,i){if(t.ownerDocument!==e)throw Error("root.document");let s=e.documentElement;if(!s)throw Error("root.missing");t.parentNode!==s&&s.append(t),t.hasAttribute(i)||t.setAttribute(i,"")}function e(t){return void 0===t||"string"==typeof t&&/^sha(?:256|384|512)-[A-Za-z0-9+/]+={0,2}$/.test(t)}function i(t,i){let s=t??Tt??(t=>({url:new URL("./peekling.css",t).href}))(i),r=new URL(s.url,i);if("https:"!==r.protocol&&"http:"!==r.protocol)throw new TypeError("styles.url");if(!e(s.integrity))throw new TypeError("styles.integrity");return Object.freeze({url:r.href,...s.integrity?{integrity:s.integrity}:{}})}function s(t){return"string"==typeof t&&Kt.test(t)}function r(t,e){if("string"!=typeof t||t.length<1||t.length>2048||/[\s\u0000-\u001f\u007f-\u009f\\]/u.test(t)||/%(?![0-9A-Fa-f]{2})/.test(t))return!1;let i=/^https:\/\//i.test(t);if(!i&&/^[A-Za-z][A-Za-z0-9+.-]*:/.test(t)||t.startsWith("//")||i&&!(t=>{let e=t.slice(8),i=e.search(/[/?#]/),s=i<0?e:e.slice(0,i);if(!s||s.includes("@")||s.includes("%"))return!1;if(s.startsWith("[")){let t=s.indexOf("]");return!(t<2||s.indexOf("[",1)>=0||s.indexOf("]",t+1)>=0||!n(s.slice(t+1)))}let r=s.indexOf(":");if(r!==s.lastIndexOf(":"))return!1;let a=r<0?s:s.slice(0,r),h=r<0?"":s.slice(r);return o(a)&&n(h)})(t))return!1;try{if(i){let e=new URL(t);return"https:"===e.protocol&&!e.username&&!e.password&&((t,e)=>{let i=t.slice(8),s=i.search(/[/?#]/),r=s<0?i:i.slice(0,s);if(r.startsWith("["))return!0;let n=r.indexOf(":");return(n<0?r:r.slice(0,n)).toLowerCase()===e.toLowerCase()})(t,e.hostname)}let s=new URL(e);if("https:"!==s.protocol&&"http:"!==s.protocol||s.username||s.password||!(t=>t.startsWith("[")?t.endsWith("]"):o(t))(s.hostname))return!1;let r=new URL(t,s);return!(r.username||r.password||"https:"!==r.protocol&&"http:"!==r.protocol||r.origin!==s.origin)}catch{return!1}}function n(t){return""===t||!!/^:[0-9]{1,5}$/.test(t)&&+t.slice(1)<=65535}function o(t){if(!t||t.length>253||t.endsWith("."))return!1;let e=t.split(".");return e.every(t=>/^[0-9]+$/.test(t))?4===e.length&&e.every(t=>/^(?:0|[1-9][0-9]{0,2})$/.test(t)&&+t<=255):e.every(t=>/^(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])$/.test(t))}function a(t,e,i){e&&Qt.add(t),i&&Yt.add(t)}function h(t,e,i){if(!i&&((t,e)=>"object"==typeof t&&null!==t&&("configuration"===e?Gt.has(t)||Qt.has(t):"pack"===e?Yt.has(t):Qt.has(t)))(t,e))return t;let s=0,r=0,n=new WeakSet,o=new WeakMap,h=(t,e,i)=>{throw new Xt(t,e,e)},l=(t,c,f)=>{if(void 0!==i?.maxDepth&&f>i.maxDepth)return h(c,"data.depth");if(r+=1,void 0!==i?.maxValues&&r>i.maxValues)return h(c,"data.nodes");if(null===t||"boolean"==typeof t)return{value:t,ownSafe:!0,packSafe:!0};if("string"==typeof t)return void 0!==i?.maxStringLength&&t.length>i.maxStringLength?h(c,"data.string"):{value:t,ownSafe:!0,packSafe:!0};if("number"==typeof t)return i?.json&&!Number.isFinite(t)?h(c,"data.type"):{value:t,ownSafe:!0,packSafe:!0};if(typeof t>"u")return i?.json?h(c,"data.type"):{value:t,ownSafe:!0,packSafe:!0};if("function"==typeof t)return"pack"===e||i?.json?h(c,"data.type"):{value:t,ownSafe:!0,packSafe:!1};if("object"!=typeof t)return h(c,"data.type");if("configuration"===e&&("$.document"===c||"$.window"===c))return{value:t,ownSafe:!1,packSafe:!1};if(f>32)return h(c,"data.depth");if(s+=1,s>2e4)return h(c,"data.nodes");let d,u,p=o.get(t);if(p){if(n.has(t))return h(c,"data.cycle");if(!i)return{value:p.value,ownSafe:p.ownSafe,packSafe:p.packSafe}}try{d=Reflect.ownKeys(t)}catch{return h(c,"data.reflect")}if(d.some(t=>"string"!=typeof t))return h(c,"data.symbol");if(Array.isArray(t)){if(t.length>Math.min(4096,i?.maxArrayLength??4096))return h(c,"data.array");if(d.length!==t.length+1||d.some(e=>"length"!==e&&(!/^\d+$/.test(e)||+e>=t.length)))return h(c,"data.array-own");let e=[],s={value:e};o.set(t,s),n.add(t);let r=!0,u=!0;for(let i=0;i<t.length;i+=1){let s=Object.getOwnPropertyDescriptor(t,i+"");if(!s||s.get||s.set)return h(`${c}[${i}]`,"data.descriptor");let n=l(s.value,`${c}[${i}]`,f+1);e.push(n.value),r&&=n.ownSafe,u&&=n.packSafe}n.delete(t);let p=Object.freeze(e);return s.ownSafe=r,s.packSafe=u,a(p,r,u),{value:p,ownSafe:r,packSafe:u}}try{u=(t=>{let e=Object.getPrototypeOf(t);return null===e||e===Object.prototype})(t)}catch{return h(c,"data.reflect")}if(!u)return h(c,"data.plain");if(d.length>Math.min(1024,i?.maxObjectKeys??1024))return h(c,"data.keys");let v=Object.create(null),y={value:v};o.set(t,y),n.add(t);let w=!0,m=!0;for(let e of d){i?.key&&!i.key(e)&&h(`${c}.${e}`,"data.key");let s=Object.getOwnPropertyDescriptor(t,e);if(!s||s.get||s.set)return h(`${c}.${e}`,"data.descriptor");let r=l(s.value,`${c}.${e}`,f+1);v[e]=r.value,w&&=r.ownSafe,m&&=r.packSafe}n.delete(t);let b=Object.freeze(v);return y.ownSafe=w,y.packSafe=m,a(b,w,m),{value:b,ownSafe:w,packSafe:m}};try{let i=l(t,"$",0);return"configuration"===e&&"object"==typeof i.value&&null!==i.value&&Gt.add(i.value),i.value}catch(t){if(t instanceof Xt)throw t;return h("$","data.reflect")}}function l(t,e){return h(t,"own",e)}function c(t){return h(t,"pack")}function f(t){return h(t,"configuration")}function d(t){switch(t){case"pointer.click":case"document.visibility":case"window.focus":case"window.scroll":case"page.lifecycle":return t;default:return}}function u(t){return"pointer.move"===t||"section.visibility"===t}function p(t){if(void 0===t)return;let e;try{e=l(t,ee)}catch(t){if(t instanceof Xt)switch(t.issueCode){case"data.array":throw new TypeError("event.array-limit");case"data.cycle":case"data.depth":case"data.nodes":throw new TypeError("event.complexity");case"data.key":throw new TypeError("event.key");case"data.keys":throw new TypeError("event.key-limit");case"data.string":throw new TypeError("event.string-limit")}throw new TypeError("event.payload")}if((Pt??=new TextEncoder).encode(JSON.stringify(e)).byteLength>8192)throw new TypeError("event.size");return e}function v(t,e,i){if("string"==typeof t)return w(t,500);if(!t||"object"!=typeof t||Array.isArray(t))throw new TypeError("content.surface");y(t,["title","text","link","mountId","announce"]);let s,n=w(t.title,120),o=w(t.text,500);if(void 0!==t.announce&&"boolean"!=typeof t.announce)throw new TypeError("content.announce");if(void 0!==t.mountId&&("string"!=typeof t.mountId||!Ht.test(t.mountId)))throw new TypeError("content.binding");if(void 0!==t.link){if(t.link&&"object"==typeof t.link&&y(t.link,["label","href"]),!t.link||"string"!=typeof t.link.label||"string"!=typeof t.link.href||!r(t.link.href,e))throw new TypeError("content.link");let i=new URL(t.link.href,e);s={label:w(t.link.label,120),href:i.href}}if(!(n||o||s||t.mountId))throw new TypeError("content.empty");return{...n?{title:n}:{},...o?{text:o}:{},...s?{link:s}:{},...t.mountId?{mountId:t.mountId}:{},...!0===t.announce?{announce:!0}:{}}}function y(t,e,i){for(let i of Object.keys(t))if(!e.includes(i))throw new TypeError(Rt("content.field"))}function w(t,e,i){if(void 0!==t){if("string"!=typeof t||t.length<1||t.length>e||/[\u0000-\u001f\u007f]/.test(t))throw new TypeError("content.text");return t}}function m(t,e,i,s,r){let n=e.y-s.height/2-12-r.height,o=e.y+s.height/2+12,a="bottom"===t,h=a?o:n,l=a?n:o;return{x:b("top-left"===t?e.x-s.width/2-12-r.width:"top-right"===t?e.x+s.width/2+12:e.x-r.width/2,8,i.width-r.width-8),y:b(h>=8&&h+r.height<=i.height-8?h:l,8,i.height-r.height-8)}}function b(t,e,i){return Math.max(e,Math.min(t,Math.max(e,i)))}function g(t){return t.replace(/https?:\/\/[^\s]+/gi,"[redacted-url]").replace(/\b(token|secret|password|authorization)=\S+/gi,"$1=[redacted]").slice(0,500)}function k(t){return t.durations?t.durations.reduce((t,e)=>t+e,0):t.frames.length/(t.fps??1)*1e3}function j(t,e){let i=(e%1+1)%1;if(!t?.length)return{advance:i,lift:0};let s=t.findIndex(t=>t.at>=i),r=t[s<0?t.length-1:s],n=t[Math.max(0,(s<0?t.length-1:s)-1)];if(r.at===n.at)return{advance:r.advance,lift:r.lift};let o=(i-n.at)/(r.at-n.at);return{advance:n.advance+(r.advance-n.advance)*o,lift:n.lift+(r.lift-n.lift)*o}}function $(t,e){return t}function E(t,e,i){t.push($(e))}function O(t,e){throw new he([$(t)])}function S(t,e,i){return!("string"!=typeof t||!le.test(t))||(E(i,e),!1)}function x(t,e,i){let s=[];if(!Array.isArray(t)||t.length<1||t.length>3)return E(i,e.path+".limit"),s;let r=new Set;for(let[n,o]of t.entries()){let t=`${e.path}.${n}`;if(!M(o)){E(i,t);continue}z(o,e.native?["src","density","sourceCellSize","sha256"]:["src","density","cellWidth","cellHeight","sha256"],t,i);let a=o.density,h=(1===a||2===a||4===a)&&!r.has(a),l=o.src,c="string"==typeof l&&Bt.test(l)&&(e.native?/\.png$/i:/\.(?:png|webp)$/i).test(l),f=o.sha256,d=S(f,t+".sha256",i),u=e.native?+e.logicalWidth*+a:o.cellWidth,p=e.native?+e.logicalHeight*+a:o.cellHeight;(e.native?o.sourceCellSize===u&&u===p:Number.isInteger(u)&&u>=1&&u<=1024&&Number.isInteger(p)&&p>=1&&p<=1024)?h&&c?d&&(r.add(a),s.push({src:l,density:a,cellWidth:u,cellHeight:p,sha256:f})):E(i,t+".density"):E(i,t+".dimensions")}return s.sort((t,e)=>t.density-e.density)}function A(t,e,i){let s=Object.create(null);if(!M(t))return E(i,"states"),s;let r=Object.entries(t);(0===r.length||r.length>64)&&E(i,"states.limit");for(let[t,n]of r){let r="states."+t;if(!Vt.test(t)||["constructor","prototype","__proto__"].includes(t)||!M(n)){E(i,r);continue}z(n,["frames","fps","loop","durations"],r,i);let o=n.frames,a=n.durations;if(!Array.isArray(o)||0===o.length||o.length>64||o.some(t=>!Number.isInteger(t)||t<0||t>=e)){E(i,r+".frames");continue}let h=void 0!==n.fps,l=void 0!==a,c="number"==typeof n.fps&&Number.isFinite(n.fps)&&n.fps>=.1&&n.fps<=60,f=Array.isArray(a)&&a.length===o.length&&a.every(t=>"number"==typeof t&&Number.isFinite(t)&&t>=16&&t<=1e4)&&a.reduce((t,e)=>t+e,0)<=6e4;h===l||"boolean"!=typeof n.loop||h&&!c||l&&!f?E(i,r+".timing"):s[t]=h?{frames:[...o],loop:n.loop,fps:n.fps}:{frames:[...o],loop:n.loop,durations:[...a]}}return s.idle||E(i,"states.idle"),s}function N(t,e,i){let s=[];if(!Array.isArray(t)||t.length<2||t.length>8)return E(i,e+".limit"),s;for(let[r,n]of t.entries()){let t=`${e}.${r}`,o=s.at(-1);M(n)&&z(n,["at","advance","lift"],t,i),!M(n)||!Number.isFinite(n.at)||!Number.isFinite(n.advance)||!Number.isFinite(n.lift)||n.at<0||n.at>1||n.advance<0||n.advance>1||n.lift<0||n.lift>.5||void 0!==o&&(n.at<=o.at||n.advance<o.advance)?E(i,t):s.push({at:n.at,advance:n.advance,lift:n.lift})}return s.length===t.length&&(0!==s[0].at||0!==s[0].advance||0!==s[0].lift||1!==s.at(-1).at||1!==s.at(-1).advance||0!==s.at(-1).lift)&&E(i,e+".endpoints"),s}function M(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function z(t,e,i,s){for(let r of Object.keys(t))e.includes(r)||E(s,`${i}.${r}`)}function T(t){return fe.every((e,i)=>t[i]===e)}function P(t){return t.byteLength>=12&&"RIFF"===I(t,0)&&"WEBP"===I(t,8)}function I(t,e){return String.fromCharCode(t[e],t[e+1],t[e+2],t[e+3])}function R(t,e){return t[e]|t[e+1]<<8|t[e+2]<<16}function D(t,e,i){return(t<1||e<1||t>ce||e>ce)&&O("webp.dimensions"),{width:t,height:e,hasAlpha:i,mimeType:"image/webp"}}function C(t,e,i,s=256){if("string"!=typeof t||0===t.length||t.length>s)E(i,e);else{if(!/[\u0000-\u001f\u007f]/.test(t))return t;E(i,e)}}function U(t,e,i=1){let s=[];try{t=c(t)}catch(t){throw t instanceof Xt?new he([t.message],t.issueCode?[t.issueCode]:[]):t}if(!M(t))throw new he([$("manifest")]);z(t,["format","name","version","license","metadata","assets","states","capabilities","defaults"],"manifest",s),1!==t.format&&E(s,"format");let r=C(t.name,"name",s,64);r&&!Ht.test(r)&&E(s,"name");let n=C(t.version,"version",s,64),o=C(t.license,"license",s,128);n&&!qt.test(n)&&E(s,"version"),o&&!Jt.test(o)&&E(s,"license");let a,h,l,f,d=0,u=1,p=32,v=32;if(M(t.assets))if(M(t.assets.atlas)){z(t.assets,["atlas"],"assets",s);let e=t.assets.atlas;z(e,["src","columns","rows","density","logicalCellSize","sourceCellSize","sha256"],"assets.atlas",s),a=C(e.src,"assets.atlas.src",s),S(e.sha256,"assets.atlas.sha256",s)&&(h=e.sha256),a&&(!Bt.test(a)||!/\.png$/i.test(a))&&E(s,"assets.atlas.src"),e.columns!==Ut&&E(s,"assets.atlas.columns");let i=[e.density,e.logicalCellSize,e.sourceCellSize],r=i.some(t=>void 0!==t),n=i.every(t=>void 0!==t);r&&!n&&E(s,"assets.atlas.density"),n&&(Lt.includes(e.density)?u=e.density:E(s,"assets.atlas.density"),Ct.includes(e.logicalCellSize)?p=e.logicalCellSize:E(s,"assets.atlas.logicalCellSize"),Number.isInteger(e.sourceCellSize)&&e.sourceCellSize===p*u?v=e.sourceCellSize:E(s,"assets.atlas.sourceCellSize")),!Number.isInteger(e.rows)||e.rows<2||e.rows>de/v?E(s,"assets.atlas.rows"):d=e.rows}else if(M(t.assets.atlases)){z(t.assets,["atlases"],"assets",s);let e=t.assets.atlases;z(e,["columns","rows","logicalCellSize","lineage","variants"],"assets.atlases",s),e.columns!==Ut&&E(s,"assets.atlases.columns"),Ct.includes(e.logicalCellSize)?p=e.logicalCellSize:E(s,"assets.atlases.logicalCellSize"),l=C(e.lineage,"assets.atlases.lineage",s,128),(!l||!/^[a-z0-9][a-z0-9._-]{2,127}$/.test(l))&&E(s,"assets.atlases.lineage"),f=x(e.variants,{path:"assets.atlases.variants",logicalWidth:p,logicalHeight:p,native:!0},s);let r=f.length?L(f.map(t=>t.density),i):void 0,n=f.find(t=>t.density===r);n&&(a=n.src,h=n.sha256,u=n.density,v=n.cellWidth),!Number.isInteger(e.rows)||e.rows<2||e.rows>de/v?E(s,"assets.atlases.rows"):d=e.rows}else E(s,"assets");else E(s,"assets");let y,w=A(t.states,d*Ut,s),m=Object.create(null);if(void 0!==t.capabilities){M(t.capabilities)&&z(t.capabilities,["locomotion"],"capabilities",s);let e=M(t.capabilities)?t.capabilities.locomotion:void 0;if(M(e)&&M(e.directions)){z(e,["directions","motion"],"capabilities.locomotion",s),z(e.directions,Wt,"capabilities.locomotion.directions",s);for(let t of Wt){let i=e.directions[t];"string"==typeof i&&w[i]?m[t]=i:E(s,"capabilities.locomotion.directions."+t)}if(void 0!==e.motion){let t=M(e.motion)?e.motion.keyframes:void 0;M(e.motion)&&z(e.motion,["keyframes"],"capabilities.locomotion.motion",s);let i=N(t,"capabilities.locomotion.motion.keyframes",s);Array.isArray(t)&&i.length===t.length&&(y=i)}}else E(s,"capabilities.locomotion.directions")}let b=2;if(void 0!==t.defaults&&(M(t.defaults)?(z(t.defaults,["scale"],"defaults",s),void 0!==t.defaults.scale&&(!Number.isInteger(t.defaults.scale)||t.defaults.scale<1||t.defaults.scale>4?E(s,"defaults.scale"):b=t.defaults.scale)):E(s,"defaults")),M(t.metadata)){z(t.metadata,["title","author","description","tags"],"metadata",s),C(t.metadata.description,"metadata.description",s,500),"string"==typeof t.metadata.description&&/:\/\//.test(t.metadata.description)&&E(s,"metadata.description");for(let e of["title","author"])void 0!==t.metadata[e]&&(C(t.metadata[e],"metadata."+e,s,120),"string"==typeof t.metadata[e]&&/:\/\//.test(t.metadata[e])&&E(s,"metadata."+e));void 0!==t.metadata.tags&&(!Array.isArray(t.metadata.tags)||t.metadata.tags.length>16||t.metadata.tags.some(t=>"string"!=typeof t||!ue.test(t)))&&E(s,"metadata.tags")}else E(s,"metadata");e&&((e.width!==Ut*v||e.height!==d*v)&&E(s,"atlas.dimensions"),(e.width>de||e.height>de||void 0!==e.byteLength&&e.byteLength>4194304)&&E(s,"atlas.size"));if(s.length||!r||!n||!o||!a||!h)throw new he(s.length?s:[$("manifest.incomplete")]);let g=t;return{name:r,displayName:g.metadata.title??r,version:n,license:o,atlas:{src:a,sha256:h,columns:Ut,rows:d,cellWidth:v,cellHeight:v,logicalWidth:p,logicalHeight:p,density:u,...l?{lineage:l}:{},...f?{variants:f}:{}},states:w,defaultScale:b,...Object.keys(m).length?{directionalStates:m}:{},...y?{locomotionMotion:y}:{},...g.metadata?{source:{metadata:g.metadata}}:{}}}function L(t,e){let i=[...new Set(t)].sort((t,e)=>t-e);if(!i.length)throw new he([$("atlas.variants")]);return i.find(t=>t>=e)??i.at(-1)}function W(t){return"string"==typeof t&&t.length>0&&t.length<=512&&!/[\u0000-\u001f\u007f]/.test(t)}function Z(t,e,i){let s=[];try{t=c(t)}catch(t){throw t instanceof Xt?new he([t.message],t.issueCode?[t.issueCode]:[]):t}if(!M(t)||!M(t.atlas)||!M(t.states))throw new he([$("normalized.structure")]);z(t,["name","displayName","version","license","atlas","states","defaultScale","directionalStates","locomotionMotion","reactionStates","source"],"normalizedPack",s);for(let e of["name","version","license"])W(t[e])||E(s,"normalized."+e);(!W(t.displayName)||t.displayName.length>120||/:\/\//.test(t.displayName))&&E(s,"normalized.displayName"),"string"==typeof t.version&&t.version.length>64&&E(s,"normalized.version"),W(t.name)&&!Ht.test(t.name)&&E(s,"normalized.name"),W(t.version)&&!qt.test(t.version)&&E(s,"normalized.version"),W(t.license)&&!Jt.test(t.license)&&E(s,"normalized.license");let r=t.atlas;z(r,["src","columns","rows","cellWidth","cellHeight","logicalWidth","logicalHeight","density","lineage","sha256","variants"],"atlas",s);let n=[["columns",256],["rows",4096],["cellWidth",1024],["cellHeight",1024]];for(let[t,e]of n)(!Number.isInteger(r[t])||r[t]<1||r[t]>e)&&E(s,"atlas."+t);(!W(r.src)||!Bt.test(r.src)||!/\.(?:png|webp)$/i.test(r.src))&&E(s,"atlas.src");let o=+r.columns,a=+r.rows,h=+r.cellWidth,l=+r.cellHeight;for(let t of["logicalWidth","logicalHeight"])void 0!==r[t]&&(!Number.isInteger(r[t])||r[t]<1||r[t]>256)&&E(s,"atlas."+t);void 0!==r.density&&![1,2,4].includes(r.density)&&E(s,"atlas.density"),void 0!==r.lineage&&(!W(r.lineage)||!/^[a-z0-9][a-z0-9._-]{2,127}$/.test(r.lineage))&&E(s,"atlas.lineage");let f=void 0===r.variants?[]:x(r.variants,{path:"atlas.variants"},s),d=void 0===r.sha256?void 0:S(r.sha256,"atlas.sha256",s)?r.sha256:void 0;void 0===r.variants&&void 0===r.sha256&&S(void 0,"atlas.sha256",s);let u=[1,2,4].includes(r.density)?r.density:1,v=Number.isInteger(r.logicalWidth)?r.logicalWidth:h/u,y=Number.isInteger(r.logicalHeight)?r.logicalHeight:l/u,w=f.length?L(f.map(t=>t.density),i??u):u,m=f.find(t=>t.density===w),b=m?.sha256??d,g=m?.src??r.src,k=m?.cellWidth??h,j=m?.cellHeight??l;(!Number.isInteger(v)||!Number.isInteger(y)||k!==v*w||j!==y*w)&&E(s,"atlas.logical-cell");let O=o*a;(o*k>4096||a*j>4096)&&E(s,"atlas.size");let T=A(t.states,O,s);(!Number.isInteger(t.defaultScale)||t.defaultScale<1||t.defaultScale>4)&&E(s,"normalized.defaultScale");let P={};if(void 0!==t.directionalStates)if(M(t.directionalStates)){z(t.directionalStates,Wt,"directionalStates",s);for(let e of Wt){let i=t.directionalStates[e];void 0!==i&&("string"==typeof i&&T[i]?P[e]=i:E(s,"directionalStates."+e))}}else E(s,"directionalStates");let I={};if(void 0!==t.reactionStates)if(!M(t.reactionStates)||Object.keys(t.reactionStates).length>32)E(s,"reactionStates.limit");else for(let[e,i]of Object.entries(t.reactionStates))/^[a-z][a-z0-9-]{0,63}$/.test(e)&&"string"==typeof i&&T[i]?I[e]=i:E(s,"reactionStates."+e);let R,D=[];void 0!==t.locomotionMotion&&(D=N(t.locomotionMotion,"locomotionMotion",s)),e&&(e.width!==o*k||e.height!==a*j)&&E(s,"atlas.pixels"),void 0!==e?.byteLength&&(!Number.isSafeInteger(e.byteLength)||e.byteLength<1||e.byteLength>33554432)&&E(s,"atlas.size");if(void 0!==t.source)try{let e=p(t.source);if(!M(e))throw new TypeError("normalized.source");R=Object.freeze({...e})}catch(t){E(s,"normalized.source")}if(s.length||!b)throw new he(s.length?s:[$("atlas.sha256")]);return{name:t.name,displayName:W(t.displayName)?t.displayName:t.name,version:t.version,license:t.license,atlas:{src:g,sha256:b,columns:o,rows:a,cellWidth:k,cellHeight:j,logicalWidth:v,logicalHeight:y,density:w,..."string"==typeof r.lineage?{lineage:r.lineage}:{},...f.length?{variants:f}:{}},states:T,defaultScale:t.defaultScale,...Object.keys(P).length?{directionalStates:P}:{},...D.length?{locomotionMotion:D}:{},...Object.keys(I).length?{reactionStates:I}:{},...R?{source:R}:{}}}function F(t){return Object.hasOwn(pe,t)}function H(t,e){let i=t.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return(!i||!e.includes(i))&&O("mime.invalid"),i}function _(t){if(t instanceof DOMException&&"AbortError"===t.name)return"abort";if(t instanceof ae)return t.category;if(t instanceof he)for(let e of t.issueCodes){let t=e.slice(e.indexOf(".")+1);if("hash"===t)return"hash";if("mime.invalid"===e||"mime"===t)return"mime";if(e.startsWith("png.")||e.startsWith("webp.")||e.startsWith("atlas.")&&["dimensions","pixels","alpha","size"].includes(t))return"image";if("size"===t)return"size";if(t.startsWith("integrity-"))return"integrity"}return"validation"}function V(t,e){return e.aborted||t instanceof DOMException&&"AbortError"===t.name}async function q(t,e,i,s){let r=((t,e,i)=>{let s=new AbortController,r=!1,n=()=>s.abort(t.reason);t.aborted?n():t.addEventListener("abort",n,{once:!0});let o=globalThis.setTimeout(()=>{s.signal.aborted||(r=!0,s.abort(new DOMException(i,"TimeoutError")))},e);return{signal:s.signal,get timedOut(){return r},close(){globalThis.clearTimeout(o),t.removeEventListener("abort",n)}}})(t,e,i);try{return await s(r.signal)}catch(t){throw r.timedOut&&(t===r.signal.reason||t instanceof DOMException&&("AbortError"===t.name||"TimeoutError"===t.name))?new ae(i,"timeout",i,t):t}finally{r.close()}}async function J(t,e,i,s){try{return await t(e,{signal:i})}catch(t){throw V(t,i)?t:new ae(s,"network",s,t)}}async function B(t,e,i,s){try{return await(async(t,e,i)=>{let s=+t.headers.get("content-length");if(Number.isFinite(s)&&s>e&&O("resource.size"),!t.body){let i=new Uint8Array(await t.arrayBuffer());return i.byteLength>e&&O("resource.size"),i}let r=t.body.getReader(),n=[],o=0;try{for(;;){i.throwIfAborted();let{done:t,value:s}=await r.read();if(t)break;o+=s.byteLength,o>e&&(await r.cancel(),O("resource.size")),n.push(s)}}catch(t){try{await r.cancel(t)}catch{}throw t}finally{r.releaseLock()}let a=new Uint8Array(o),h=0;for(let t of n)a.set(t,h),h+=t.byteLength;return a})(t,e,i)}catch(t){throw V(t,i)||t instanceof ae||t instanceof he?t:new ae(s,"network",s,t)}}async function K(t,e,i=!1){let s,r=i?"manifest":"atlas";le.test(e)||O(r+".integrity-declaration");try{let t=globalThis.crypto?.subtle;s=t?.digest.bind(t)}catch{}s||O(r+".integrity-unavailable");try{return!new Uint8Array(await s("SHA-256",t)).some((t,i)=>t!==Number.parseInt(e.slice(2*i,2*i+2),16))}catch{O(r+".integrity-failed")}}function X(t,e,i=4){let s=Number.isFinite(t)&&t>0?t:1;return Math.min(s*e,i)}function G(t,e={}){let i=l(t);at(i),ht(i,["baseline","rules"]),i.baseline||ut("missing-baseline");let s=Q(i.baseline,0,e,!1);s.until&&ut("invalid-baseline-interrupt"),s.channels.includes("state")||ut("missing-baseline-state"),s.state||ut("missing-baseline-state");for(let[t,e]of Y(s).entries())e.ordering&&ut("invalid-ordering-source");let r=void 0===i.rules?[]:i.rules;(!Array.isArray(r)||r.length>64)&&ut("rule-limit");let n=new Set,o=r.map((t,i)=>{at(t),ht(t,["id","when","effect"]),lt(t.id),n.has(t.id)&&ut("duplicate-rule"),n.add(t.id);let s=((t,e,i)=>(at(t),"application"===t.source?(ht(t,["source","event","coalesce"]),("string"!=typeof t.event||!_t.test(t.event))&&ut("invalid-condition"),it(t.coalesce),dt({source:"application",event:t.event,...t.coalesce?{coalesce:t.coalesce}:{}})):("browser"!==t.source&&ut("invalid-condition"),Zt.includes(t.event)||ut("invalid-condition"),"section.visibility"!==t.event?(ht(t,["source","event","coalesce"]),it(t.coalesce),"window.scroll"===t.event?dt({source:"browser",event:"window.scroll",...t.coalesce?{coalesce:t.coalesce}:{}}):(t.coalesce&&ut("unsafe-coalescing"),dt({source:"browser",event:t.event}))):(ht(t,["source","event","selector","phase","threshold"]),((t,e,i)=>{if(("string"!=typeof t||t.length<1||t.length>256||/[\0\r\n]/.test(t))&&ut("invalid-selector"),!i)return;let s=!1;try{s=i(t)}catch{s=!1}s||ut("invalid-selector")})(t.selector,0,i.validateSelector),["enter","while-visible","leave"].includes(t.phase)||ut("invalid-condition"),void 0!==t.threshold&&("number"!=typeof t.threshold||!Number.isFinite(t.threshold)||t.threshold<=0||t.threshold>1)&&ut("invalid-threshold"),dt({source:"browser",event:"section.visibility",selector:t.selector,phase:t.phase,...void 0===t.threshold?{}:{threshold:t.threshold}})))))(t.when,0,e),r=Q(t.effect,0,e,!0);"browser"===s.source&&("pointer.move"===s.event||"section.visibility"===s.event&&"while-visible"===s.phase)&&(void 0!==t.effect.surfaces||r.until)&&ut("invalid-continuous-effect");for(let t of Y(r))"event-payload"===et(t)&&"application"!==s.source&&ut("invalid-payload-source"),t.ordering&&"application"!==s.source&&ut("invalid-ordering-source");return dt({id:t.id,when:s,effect:r})});return((t,e)=>{let i=new Set(Y(t).map(tt)),s=new Map,r=new Map;for(let t of e)for(let e of Y(t.effect)){let n=tt(e);i.has(n)&&!e.disposition&&ut("ambiguous-channel");let o=s.get(n)??[];o.push(t),s.set(n,o);let a=e.ordering;if(!a)continue;let h=r.get(n);h?(h.sessionField!==a.sessionField&&ut("ambiguous-ordering"),a.revisionField&&h.revisionField&&h.revisionField!==a.revisionField&&ut("ambiguous-ordering"),a.revisionField&&!h.revisionField&&(h.revisionField=a.revisionField)):r.set(n,{sessionField:a.sessionField,...a.revisionField?{revisionField:a.revisionField}:{}})}for(let[t,e]of s)e.length<2||e.filter(e=>Y(e.effect).some(e=>tt(e)===t&&!e.disposition)).length&&ut("ambiguous-channel")})(s,o),(t=>{let e=new Map;for(let i of t){let t=`${i.when.source}:${i.when.event}`,s=e.get(t)??[];s.push(i),e.set(t,s)}for(let[t,i]of e)new Set(i.map(t=>t.when.coalesce??"fifo")).size>1&&ut("ambiguous-coalescing"),"latest"===i[0]?.when.coalesce&&"application"===i[0].when.source&&(i.every(t=>t.effect.channels.every(t=>t.startsWith("surface:"))&&Y(t.effect).length>0&&Y(t.effect).every(t=>t.ordering?.revisionField))||ut("unsafe-coalescing"),1!==new Set(i.flatMap(t=>Y(t.effect).map(t=>`${t.ordering.sessionField}\0${t.ordering.revisionField}`))).size&&ut("ambiguous-coalescing"))})(o),dt({baseline:s,rules:dt(o)})}function Q(t,e,i,s){at(t),ht(t,["channels","state","motion","surfaces","until"]),(!Array.isArray(t.channels)||!t.channels.length||t.channels.length>16)&&ut("invalid-channels");let r=t.channels.map((t,e)=>(("string"!=typeof t||!ve.test(t))&&ut("invalid-channel"),t));new Set(r).size!==r.length&&ut("duplicate-channel");let n=void 0===t.state?void 0:((t,e,i)=>(at(t),"state"in t?(ht(t,["state"]),("string"!=typeof t.state||!Vt.test(t.state))&&ut("invalid-state"),i.states&&!i.states.has(t.state)&&ut("unknown-state"),dt({kind:"state",name:t.state})):(ht(t,["capability"]),"locomotion"!==t.capability&&ut("invalid-capability"),i.capabilities&&!i.capabilities.has(t.capability)&&ut("unknown-capability"),dt({kind:"capability",name:t.capability}))))(t.state,0,i),o=void 0===t.motion?void 0:(t=>(at(t),ht(t,["type","speed","arrivalRadius"]),"follow-pointer"!==t.type&&ut("invalid-motion"),ft(t.speed,0,1,1e3),ft(t.arrivalRadius,0,0,1e3),dt({type:"follow-pointer",...void 0===t.speed?{}:{speed:t.speed},...void 0===t.arrivalRadius?{}:{arrivalRadius:t.arrivalRadius}})))(t.motion),a=void 0===t.surfaces?[]:t.surfaces;(!Array.isArray(a)||a.length>8)&&ut("surface-limit");let h=a.map((t,e)=>((t,e,i,s)=>{at(t),ht(t,["id","contentId","data","disposition","ordering"]),lt(t.id),lt(t.contentId),i.contentIds&&!i.contentIds.has(t.contentId)&&ut("unknown-content"),"event-payload"===t.data&&!s&&ut("invalid-surface-data"),void 0!==t.disposition&&!["update","replace","ignore","interrupt"].includes(t.disposition)&&ut("invalid-disposition");let r,n=void 0===t.ordering?void 0:(t=>(at(t),ht(t,["sessionField","revisionField","terminal"]),ct(t.sessionField),void 0!==t.revisionField&&ct(t.revisionField),void 0!==t.terminal&&"boolean"!=typeof t.terminal&&ut("invalid-ordering"),!t.terminal&&!t.revisionField&&ut("invalid-ordering"),dt({sessionField:t.sessionField,...t.revisionField?{revisionField:t.revisionField}:{},...t.terminal?{terminal:!0}:{}})))(t.ordering);if(void 0!==t.data&&"event-payload"!==t.data)try{r=p(t.data)}catch{ut("invalid-surface-data")}return dt({id:t.id,channel:"surface:"+t.id,contentId:t.contentId,..."event-payload"===t.data?{dataSource:"event-payload"}:{},...void 0===r?{}:{data:r},...t.disposition?{disposition:t.disposition}:{},...n?{ordering:n}:{}})})(t,0,i,s)),l=new Set;for(let t of h){let e=tt(t);l.has(e)&&ut("duplicate-surface"),l.add(e)}let c=void 0===t.until?void 0:(t=>(at(t),"duration"===t.type?(ht(t,["type","ms"]),void 0===t.ms&&ut("missing-interrupt-duration"),ft(t.ms,0,1,36e5),dt({type:"duration",ms:t.ms})):("event"!==t.type&&ut("invalid-interrupt-lifetime"),ht(t,["type","name","timeout"]),("string"!=typeof t.name||!_t.test(t.name))&&ut("invalid-interrupt-lifetime"),u(t.name)&&ut("invalid-interrupt-lifetime"),ft(t.timeout,0,1,36e5),dt({type:"event",name:t.name,...void 0===t.timeout?{}:{timeout:t.timeout}}))))(t.until);h.filter(t=>"interrupt"===t.disposition).length&&!c&&ut("missing-interrupt-lifetime"),c&&h.some(t=>"interrupt"!==t.disposition)&&ut("mixed-interrupt-effect"),n&&!r.includes("state")&&ut("undeclared-channel"),!n&&r.includes("state")&&ut("missing-channel-output"),o&&!r.includes("motion")&&ut("undeclared-channel"),!o&&r.includes("motion")&&ut("missing-channel-output");let f=h.map(tt);for(let t of r)t.startsWith("surface:")&&!f.includes(t)&&ut("missing-channel-output");for(let t of f)r.includes(t)||ut("undeclared-channel");return dt({channels:dt(r),...n?{state:n}:{},...o?{motion:o}:{},surfaces:dt(h),...c?{until:c}:{}})}function Y(t){return t.surfaces??[]}function tt(t){return"channel"in t?t.channel:"surface:"+t.id}function et(t){return"dataSource"in t?t.dataSource:"event-payload"===t.data?"event-payload":void 0}function it(t,e){void 0!==t&&"latest"!==t&&ut("invalid-coalescing")}function st(t,e){let i=Y(t).map(t=>dt({...t,..."event-payload"===et(t)?{data:e}:{}}));return dt({...t,surfaces:dt(i)})}function rt(t,e,i,s){for(let r of t){let t=r.ordering;if(!t)continue;if(!s||"object"!=typeof s||Array.isArray(s))return"invalid";let n=s,o=n[t.sessionField];if("string"!=typeof o&&"number"!=typeof o)return"invalid";let a=`${tt(r)}\0${typeof o}\0${o+""}`,h=e.ordering.get(a);if(!0===h)return"closed";let l=i.ordering.get(a),c="number"==typeof l?l:h;if(t.revisionField){let e=n[t.revisionField];if(!Number.isSafeInteger(e)||e<0)return"invalid";if("number"==typeof h&&e<=h||"number"==typeof l&&e<l)return"stale";c=e}i.ordering.set(a,!(!t.terminal&&!0!==l)||c)}return"matched"}function nt(t,e){if(!e.length)return;if(e.length===t.channels.length)return t;let i=new Set(e);return dt({channels:dt(e),...i.has("state")&&t.state?{state:t.state}:{},...i.has("motion")&&t.motion?{motion:t.motion}:{},surfaces:dt(Y(t).filter(t=>i.has(tt(t)))),...t.until?{until:t.until}:{}})}function ot(t,e,i){for(let[i,s]of e.ordering)t.ordering.set(i,s);for(let s of e.ordering.keys()){let e=t.sessions.get(i)??[],r=e.indexOf(s);for(r>=0&&e.splice(r,1),e.push(s),t.sessions.set(i,e);e.length>64;)t.ordering.delete(e.shift())}}function at(t,e){(!t||"object"!=typeof t||Array.isArray(t))&&ut("invalid-object")}function ht(t,e,i){for(let i of Object.keys(t))e.includes(i)||ut("unknown-field")}function lt(t,e,i){("string"!=typeof t||!/^[a-z][a-z0-9:-]{0,63}$/.test(t))&&ut("invalid-id")}function ct(t,e){("string"!=typeof t||!ye.test(t))&&ut("invalid-ordering")}function ft(t,e,i,s){void 0!==t&&("number"!=typeof t||!Number.isFinite(t)||t<i||t>s)&&ut("out-of-range")}function dt(t){return Object.freeze(t)}function ut(t,e,i){throw new we(t,"",t)}function pt(t){return void 0===t||"boolean"==typeof t||wt(t,80)}function vt(t,e,i,s,r){if(!(t=>"object"==typeof t&&null!==t&&!Array.isArray(t))(t)&&(mt(e,i),be))return;let n=t;return s&&yt(n,s,i),n}function yt(t,e,i,s){for(let s of Object.keys(t))e.includes(s)||mt("unknown-field",`${i}.${s}`)}function wt(t,e){return"string"==typeof t&&t.length>0&&t.length<=e&&!/[\u0000-\u001f\u007f]/.test(t)}function mt(t,e,i,s){throw new ke(t,e,t)}function bt(t,e,i){throw new ke(t,e,t)}function gt(t){return d(t)?"browser":"application"}function kt(t){let e=t.until;return"duration"===e?.type?e.ms:"event"===e?.type&&void 0!==e.timeout?e.timeout:"manual"===e?.type&&void 0!==e.maxMs?e.maxMs:je}function jt(t,e){if("number"!=typeof t||!Number.isFinite(t)||t<1||t>je)throw new TypeError("override.lifetime")}function $t(t,e,i){for(let i of Object.keys(t))if(!e.includes(i))throw new TypeError(Rt("override.unknown-field"))}function Et(t,e=1){let i=Number.isFinite(e)&&e>0?e:1;return Math.round(t*i)/i}function Ot(t){let e=t.target,i="function"==typeof e.closest?e:e.parentElement;try{return!!i?.closest?.("[data-peekling-host],[data-peekling-content],[data-peekling-controls]")}catch{return!1}}function St(t,e=Date.now()){try{if("1"===t.sessionStorage.getItem(Ae))return[!0];let i=JSON.parse(t.localStorage.getItem(xe)??"null");if("hidden"!==i?.visibility)return[!1];if(null===i.until)return[!0];if(Number.isFinite(i.until)&&i.until>e)return[!0,i.until];t.localStorage.removeItem(xe)}catch{}return[!1]}function xt(t,e){let i=Ne.findIndex(t=>t[1]===e);if(i<0)throw new TypeError("visibility.duration");let s=new Date,r=i>2?void 0:i<2?s.getTime()+6e4*(i?60:10):new Date(s.getFullYear(),s.getMonth(),s.getDate()+1).getTime();try{if(t.sessionStorage.removeItem(Ae),3===i)return t.localStorage.removeItem(xe),t.sessionStorage.setItem(Ae,"1"),r;t.localStorage.setItem(xe,JSON.stringify({visibility:"hidden",until:4===i?null:r}))}catch{}return r}function At(t){try{t.localStorage.removeItem(xe),t.sessionStorage.removeItem(Ae)}catch{}}function Nt(t,e,i,s){return{x:Math.max(i/2,Math.min(e.width-i/2,t.x)),y:Math.max(s/2,Math.min(e.height-s/2,t.y))}}function Mt(t){try{globalThis.dispatchEvent(new CustomEvent("peekling:collision",{detail:t}))}catch{}}function zt(){let t,e,i=new Promise((i,s)=>{t=i,e=s});return i.catch(()=>{}),[i,t,e]}var Tt,Pt,It,Rt=t=>t,Dt=class{ready;#t;#e;#i=!1;#s=()=>{};constructor(t,e,i){let s=t.createElement("link");this.#t=s,s.rel="stylesheet",s.href=i.url,s.crossOrigin="anonymous",s.referrerPolicy="no-referrer",i.integrity&&(s.integrity=i.integrity),this.ready=new Promise((t,e)=>{this.#s=e;let i=(t,i)=>{this.#i||(this.#i=!0,e(Error(t)))};s.addEventListener("load",()=>{if(this.#i)return;let e=s.sheet;e&&"function"==typeof e.insertRule?(this.#e=e,this.#i=!0,t()):i("styles.cssom")},{once:!0}),s.addEventListener("error",()=>i("styles.load"),{once:!0})}),this.ready.catch(()=>{}),e.append(s)}addRule(t){if(!this.#e)throw Error("styles.pending");let e=this.#e.cssRules.length;this.#e.insertRule(t+"{}",e);let i=this.#e.cssRules[e];if(!i?.style)throw Error("styles.rule");return i.style}removeRule(t){let e=this.#e;if(e)for(let i=e.cssRules.length-1;i>=0;i--)if(e.cssRules[i]?.style===t){e.deleteRule(i);return}}destroy(){this.#i||(this.#i=!0,this.#s(new DOMException("styles.cancelled","AbortError"))),this.#t.remove(),this.#e=void 0}},Ct=[32,64],Ut=16,Lt=[1,2,4],Wt=["N","NE","E","SE","S","SW","W","NW"],Zt=["pointer.click","pointer.move","document.visibility","window.focus","window.scroll","section.visibility","page.lifecycle"],Ft=["top-left","top-center","top-right","bottom"],Ht=/^(?!peekling:)[a-z][a-z0-9:-]{0,63}$/,_t=/^(?=.{1,64}$)[a-z][a-z0-9]*(?:[.:-][a-z][a-z0-9-]*)*$/,Vt=/^(?=.{1,64}$)[a-z][a-z0-9-]*(?::[A-Za-z0-9.-]+)?$/,qt=/^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/,Jt=/^(?:[A-Za-z0-9][A-Za-z0-9.-]{0,63}|DocumentRef-[A-Za-z0-9][A-Za-z0-9.-]{0,31}:LicenseRef-[A-Za-z0-9][A-Za-z0-9.-]{0,31})$/,Bt=/^(?!\/)(?!.*(?:^|\/)\.\.?(?:\/|$))(?!.*\/\/)[A-Za-z0-9._/-]{1,256}$/,Kt=/^(?:transparent|#(?:[0-9A-Fa-f]{3,4}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8}))(?![\s\S])/,Xt=class extends TypeError{issueCode;constructor(t,e,i){super(`${t} ${e}`),this.name="OwnDataError",this.issueCode=i}},Gt=new WeakSet,Qt=new WeakSet,Yt=new WeakSet,te=/^[A-Za-z0-9_.:-]{1,64}$/,ee=Object.freeze({json:!0,key(t){return te.test(t)},maxArrayLength:64,maxDepth:6,maxObjectKeys:64,maxStringLength:2048,maxValues:256}),ie=class{ready;#t;#e;#i;#s=new Map;#r;#n;#o;#a;#h;#l;#c;#f;#d=0;#u=0;#p=!0;#v=NaN;#y=NaN;#w=NaN;#m=NaN;#b=NaN;#g=NaN;#k;#j;#$;#E=!1;constructor(t,e={}){this.#t=t,this.#r=new URL(t.baseURI??globalThis.location?.href??"https://peekling.invalid/").origin,this.#n=e.t??(()=>{}),this.#o=e.bindings??{},this.#a=!0===e.announce,this.#h=e.emit??(()=>({accepted:!1,reason:"not-ready"})),this.#l=e.wake??(()=>{}),this.#e=t.createElement("aside"),this.#e.hidden=!0,this.#e.dataset.peeklingContent="",this.#f=e.label??"Peekling content",this.#e.setAttribute("aria-label",this.#f),this.#i=this.#e.attachShadow({mode:"closed"}),this.#c=new Dt(t,this.#i,e.styles??i(void 0,t.baseURI??"https://peekling.invalid/")),this.ready=this.#c.ready.then(()=>{this.#E||((t,e)=>{if(!e)return;let i=[["--peekling-surface-background",e.background,""],["--peekling-surface-color",e.color,""],["--peekling-surface-link",e.linkColor,""],["--peekling-surface-border",e.borderColor,""],["--peekling-surface-radius",e.radius,"px"],["--peekling-surface-width",e.width,"px"],["--peekling-surface-padding",e.padding,"px"]];for(let[e,s,r]of i)void 0!==s&&t.setProperty(e,`${s}${r}`)})(this.#c.addRule(":host"),e.theme)}),this.ready.catch(()=>{}),this.#O()}i(t,e,i,s,r,n){if(this.#E||(this.#O(),this.#E))return;if(this.#u+=1,this.#u>=Number.MAX_SAFE_INTEGER){this.#u=1;for(let t of this.#s.values())t.seen=0}let o=this.#u;for(let i of t)if(Object.hasOwn(e,i.contentId)&&(this.#S(i,e[i.contentId],o),this.#E))return;if(n){if(n!==this.#k&&(this.#k=n,this.#j={id:"peekling:name",contentId:"peekling:name",key:"peekling:name:"+n},this.#$={bottom:n}),this.#S(this.#j,this.#$,o),this.#E)return}else this.#k=void 0,this.#j=void 0,this.#$=void 0;for(let t of this.#s.values())if(t.seen!==o&&this.#x(t),this.#E)return;let a=s.width!==this.#w||s.height!==this.#m,h=a||i.x!==this.#v||i.y!==this.#y||r.width!==this.#b||r.height!==this.#g;if(this.#v=i.x,this.#y=i.y,this.#w=s.width,this.#m=s.height,this.#b=r.width,this.#g=r.height,a)for(let t of this.#s.values())t.host.hidden||(t.measureDirty=!0);h&&(this.#p=!0);for(let t of this.#s.values()){if(t.host.hidden||!t.measureDirty)continue;let e=t.host.getBoundingClientRect();if(this.#E)return;t.measuredWidth=e.width,t.measuredHeight=e.height,t.measureDirty=!1,this.#p=!0}if(this.#p){let t=0,e=0,n=0,o=0,a=[...this.#s.values()].sort((t,e)=>t.key<e.key?-1:t.key>e.key?1:0);for(let h of a){if(h.host.hidden)continue;let a;switch(h.region){case"top-left":a=t,t+=h.measuredHeight+8;break;case"top-center":a=e,e+=h.measuredHeight+8;break;case"top-right":a=n,n+=h.measuredHeight+8;break;case"bottom":a=o,o+=h.measuredHeight+8}let l=m(h.region,i,s,r,{width:h.measuredWidth,height:h.measuredHeight}),c=l.x+"px",f=b(l.y+a,8,s.height-h.measuredHeight-8)+"px";if(h.left!==c){if(h.o.left=c,this.#E)return;h.left=c}if(h.top!==f){if(h.o.top=f,this.#E)return;h.top=f}}this.#p=!1}let l=!1;for(let t of this.#s.values())if(!t.host.hidden){l=!0;break}this.#e.hidden===l&&(this.#e.hidden=!l)}#S(t,e,i){for(let s of Ft){let r=e[s];if(void 0===r)continue;let n=`${t.id}\0${s}`,o=this.#s.get(n)??this.#A(n,t.id,t.contentId,s);if(o.seen=i,o.contentId!==t.contentId&&(o.contentId=t.contentId,this.#N(o)),this.#M(o,r,t),this.#E)return}}#N(t,e=!1){t.measureDirty=!0,this.#p=!0,e&&!this.#E&&this.#l()}#z(t,e){t.host.hidden!==e&&(t.host.hidden=e,this.#p=!0,e||(t.measureDirty=!0))}#A(t,e,i,s){let r=this.#t.createElement("section"),n="peekling-position-"+ ++this.#d;r.className=`surface ${s} ${n}`,r.hidden=!0,r.setAttribute("part","surface "+s),r.dataset.peeklingSurface=e;let o=this.#t.createElement("strong");o.className="title";let a=this.#t.createElement("p"),h=this.#t.createElement("a"),l=this.#t.createElement("div");l.dataset.peeklingMount="",r.append(o,a,h,l),this.#i.append(r);let c={key:t,surfaceId:e,contentId:i,region:s,host:r,title:o,text:a,link:h,h:l,l:void 0,u:"",p:"",seen:0,measureDirty:!0,measuredWidth:0,measuredHeight:0,left:"",top:"",o:this.#c.addRule("."+n)};return this.#s.set(t,c),this.#p=!0,c}#M(t,e,i){if(this.#E)return;if(t.primitive!==e){t.primitive=e,t.item="string"==typeof e?{text:e}:e;let i=t.item;this.#N(t),t.title.textContent=i.title??"",t.title.hidden=!!i.mountId||!i.title,t.text.textContent=i.text??"",t.text.hidden=!!i.mountId||!i.text,t.link.hidden=!!i.mountId||!i.link,!i.mountId&&i.link?(t.link.textContent=i.link.label,t.link.href=i.link.href,new URL(i.link.href).origin!==this.#r?(t.link.target="_blank",t.link.rel="noopener noreferrer"):(t.link.removeAttribute("target"),t.link.removeAttribute("rel"))):(t.link.textContent="",t.link.removeAttribute("href"),t.link.removeAttribute("target"),t.link.removeAttribute("rel")),i.announce||this.#a?(t.host.setAttribute("aria-live","polite"),t.host.setAttribute("aria-atomic","true")):(t.host.removeAttribute("aria-live"),t.host.removeAttribute("aria-atomic"))}let s=t.item;if(s.mountId){if(t.p===`${s.mountId}\0${i.key}`){this.#z(t,!0);return}t.p&&(t.p=""),this.#T(t,s.mountId,i)}else t.p="",this.#P(t);this.#E||this.#z(t,!1)}#T(t,e,i){if(this.#E)return;let s,r=`${e}\0${i.key}`;if(t.l?.mountId===e&&t.u===r)return;try{s=p(i.data)}catch{this.#I(t,"data-failed",r);return}if(t.l?.mountId===e){if(t.u=r,t.l.data=s,t.l.result?.update){this.#R(t,t.l,s);return}if(!t.l.result){t.l.v=!0,t.l.key=i.key;return}this.#P(t)}else this.#P(t);if(this.#E)return;let n=this.#o.mounts,o=n&&Object.hasOwn(n,e)?n[e]:void 0;if(!o){this.#I(t,"mount-binding-is-missing",r);return}let a,h=new AbortController,l=this.#t.createElement("div"),c={mountId:e,abort:h,root:l,result:void 0,data:s,v:!1,updating:!1,key:i.key};t.l=c,t.u=r,t.h.replaceChildren(l),this.#N(t);try{a=o(Object.freeze({surfaceId:t.surfaceId,contentId:t.contentId,region:t.region,root:l,...void 0===s?{}:{data:s},signal:h.signal,emit:this.#h}))}catch{this.#I(t,"mount-failed",r);return}Promise.resolve(a).then(i=>{let s=(t=>{if(!t||"object"!=typeof t)return;let e;try{e=Object.getOwnPropertyDescriptors(t)}catch{return}let i=e.cleanup,s=e.update;return i&&"value"in i&&"function"==typeof i.value&&(!s||"value"in s&&"function"==typeof s.value)?Object.freeze({cleanup:i.value,...s?{update:s.value}:{}}):void 0})(i);if(this.#E||t.l!==c||h.signal.aborted)s&&this.#D(s,t);else if(s){if(c.result=s,this.#N(t,!0),c.v)if(c.v=!1,s.update)this.#R(t,c,c.data);else{let i={id:t.surfaceId,contentId:t.contentId,...void 0===c.data?{}:{data:c.data},key:c.key};this.#P(t),this.#T(t,e,i)}}else this.#I(t,"mount-failed",r)},()=>{!this.#E&&t.l===c&&!h.signal.aborted&&this.#I(t,"mount-failed",r)})}#R(t,e,i){if(this.#E)return;let s=e.result?.update;if(s){if(e.updating){e.v=!0;return}e.updating=!0,this.#N(t);try{let r=s(i);Promise.resolve(r).then(()=>{this.#E||t.l!==e||(e.updating=!1,this.#N(t,!0),e.v&&(e.v=!1,this.#R(t,e,e.data)))},()=>{!this.#E&&t.l===e&&this.#I(t,"update-failed",t.u)})}catch{!this.#E&&t.l===e&&this.#I(t,"update-failed",t.u)}}}#I(t,e,i=t.u){this.#E||(this.#n("content."+e),!this.#E&&(this.#P(t),!this.#E&&(t.p=i,this.#z(t,!0))))}#P(t){let e=t.l;t.l=void 0,t.u="",e&&(e.abort.abort(),e.result&&this.#D(e.result,t),e.root.remove(),t.h.replaceChildren(),this.#N(t))}#D(t,e){try{let e=t.cleanup();Promise.resolve(e).catch(()=>this.#n("content.cleanup-failed"))}catch{this.#n("content.cleanup-failed")}}#x(t){this.#P(t),!this.#E&&this.#C(t)}#C(t){t.l&&this.#P(t),this.#c.removeRule(t.o),t.host.remove(),this.#s.delete(t.key),this.#p=!0}destroy(){if(!this.#E){this.#E=!0;for(let t of[...this.#s.values()])this.#C(t);this.#c.destroy(),this.#e.remove()}}#O(){if(this.#E)return;let e=this.#e.parentNode!==this.#t.documentElement||!this.#e.hasAttribute("data-peekling-content");if(t(this.#e,this.#t,"data-peekling-content"),!this.#E){if(this.#i.host!==this.#e)throw Error("content.root");this.#e.getAttribute("aria-label")!==this.#f&&this.#e.setAttribute("aria-label",this.#f);for(let t of this.#s.values()){if(e&&this.#N(t),t.host.ownerDocument!==this.#t)throw Error(Rt("content.document"));t.host.parentNode!==this.#i&&(this.#i.append(t.host),this.#N(t)),(t.title.parentNode!==t.host||t.text.parentNode!==t.host||t.link.parentNode!==t.host||t.h.parentNode!==t.host)&&(t.host.replaceChildren(t.title,t.text,t.link,t.h),this.#N(t));let i=t.l;if(i){if(i.root.ownerDocument!==this.#t){if(this.#I(t,"root-adopted"),this.#E)return;continue}i.root.parentNode!==t.h&&(t.h.replaceChildren(i.root),this.#N(t))}}}}},se=class{pointer;m=[];k;#t=1;#e=[];#i=new Map;#s;#r;#n;#o;#a;#h;#l=!1;constructor(t,e,i){this.#s=t,this.#r=e,this.#n=i.now,this.#o=i.wake,this.#a=i.t??(()=>{}),this.k=i.now(),this.#v(e,"resize",()=>this.#o());for(let t of i.events)this.#c(t);this.#h=i.coalesce??new Map}get reaction(){return this.m[0]}j(t,e,i="application"){let s=this.#n(),r=this.m.at(-1),n=this.#h.get(`${i}:${t}`),o=!(r?.name!==t||r.source!==i||!(!0===n||void 0!==n&&((t,e,i)=>{if(!t||!e||"object"!=typeof t||"object"!=typeof e||Array.isArray(t)||Array.isArray(e))return!1;let s=t,r=e;return r[i.sessionField]===s[i.sessionField]&&Number.isSafeInteger(r[i.revisionField])&&Number.isSafeInteger(s[i.revisionField])&&r[i.revisionField]>s[i.revisionField]})(r.payload,e,n)));if(!o&&this.m.length>=32)return this.#a("event.queue-full"),{accepted:!1,reason:"queue-full"};let a={id:o?r.id:this.#t++,source:i,name:t,at:s,...void 0===e?{}:{payload:e}};return o?this.m[this.m.length-1]=a:this.m.push(a),this.k=s,this.#o(),{accepted:!0,id:a.id,coalesced:o}}$(t){this.m[0]?.id===t&&this.m.shift()}retainEvent(t){this.#c(t);let e=!0;return()=>{e&&(e=!1,this.#f(t))}}O(t){if(t!==this.#l){this.#l=t;for(let e of this.#e)t&&e[3]&&!e[4]?(e[0].removeEventListener(e[1],e[2]),e[3]=!1):!t&&!e[3]&&(e[0].addEventListener(e[1],e[2],{passive:!0}),e[3]=!0);t&&(this.pointer=void 0)}}destroy(){for(let t of this.#e.splice(0))t[3]&&t[0].removeEventListener(t[1],t[2]);this.pointer=void 0,this.m.length=0,this.#i.clear()}#c(t){let e=this.#i.get(t);if(e){e[0]+=1;return}let i=[];this.#i.set(t,[1,i]);let s=(t,e,s,r=!1)=>i.push(this.#v(t,e,s,r));if("pointer.move"===t){s(this.#s,"pointerdown",t=>{("touch"===t.pointerType||"pen"===t.pointerType)&&this.#u(t)}),s(this.#s,"pointermove",t=>this.#u(t));let t=t=>{let e=t.pointerType;("touch"===e||"pen"===e)&&this.#d()};s(this.#s,"pointerup",t),s(this.#s,"pointercancel",t),s(this.#s,"pointerout",t=>{null===t.relatedTarget&&this.#d()}),s(this.#r,"blur",()=>this.#d())}else"pointer.click"===t?s(this.#s,"click",t=>this.#p("pointer.click",t)):"document.visibility"===t?s(this.#s,"visibilitychange",()=>this.j("document.visibility",{visible:!this.#s.hidden},"browser"),!0):"window.scroll"===t?s(this.#r,"scroll",t=>this.#p("window.scroll",t)):"window.focus"===t&&(s(this.#r,"focus",()=>this.j("window.focus",{focused:!0},"browser")),s(this.#r,"blur",()=>this.j("window.focus",{focused:!1},"browser")))}#f(t){let e=this.#i.get(t);if(e){if(e[0]>1){e[0]-=1;return}this.#i.delete(t);for(let t of e[1]){t[3]&&t[0].removeEventListener(t[1],t[2]);let e=this.#e.indexOf(t);e>=0&&this.#e.splice(e,1)}}}#d(){this.#l||this.pointer&&(this.pointer=void 0,this.k=this.#n(),this.#o())}#u(t){this.#l||(this.pointer={x:t.clientX,y:t.clientY},this.k=this.#n(),this.#o())}#p(t,e){if(this.#l||e.composedPath().some(t=>"hasAttribute"in t&&"function"==typeof t.hasAttribute&&t.hasAttribute("data-peekling-controls")))return;let i=e,s=Number.isFinite(i.clientX)&&Number.isFinite(i.clientY)?{x:i.clientX,y:i.clientY}:void 0;this.j(t,s,"browser")}#v(t,e,i,s=!1){t.addEventListener(e,i,{passive:!0});let r=[t,e,i,!0,s];return this.#e.push(r),r}},re=["E","SE","S","SW","W","NW","N","NE"],ne=6e4,oe=class{#t;#e;#i;#s;#r;#n;#o;#a=0;#h=[];#l=[];#c;#f=!1;constructor(t){this.#t=t.instanceId,this.#e=t.now,this.#i=t.logger,this.#s=t.messageSink,this.#r=t.context,this.#n=!0===t.debug,this.#o=t.console}emit(t){let e=this.#e();if(this.#h=this.#h.filter(t=>e-t<ne),this.#l=this.#l.filter(t=>e-t<ne),void 0!==this.#c&&e-this.#c>=ne&&(this.#c=void 0),!this.#f)return this.#h.length>=64?(void 0===this.#c&&(this.#c=e,this.#d({code:"diagnostics.rate-limited",severity:"warning",message:"Diagnostic output was rate limited",phase:"internal",metadata:{windowMs:ne,recordLimit:64,errorReserve:8}})),"error"!==t.severity||this.#l.length>=8?void 0:(this.#l.push(e),this.#d(t))):(this.#h.push(e),this.#d(t))}#d(t){let e={code:t.code,severity:t.severity,message:g(t.message),phase:t.phase,sequence:++this.#a,timestamp:Date.now(),instanceId:this.#t};t.overrideId&&(e.overrideId=t.overrideId),void 0!==t.eventId&&(e.eventId=t.eventId),t.metadata&&(e.metadata=t.metadata),this.#r&&(e.context=this.#r),this.#n&&t.cause&&(e.cause=(t=>t instanceof Error?{name:t.name.slice(0,80),message:t.message.slice(0,500),...t.stack?{stack:t.stack.slice(0,4e3)}:{}}:{name:"Error",message:(t+"").slice(0,500)})(t.cause)),this.#f=!0;try{try{this.#s?.(e.message)}catch{}try{this.#i?.(e)}catch{}}finally{this.#f=!1}return!this.#s&&!this.#i&&(!0===this.#o||void 0===this.#o&&"error"===e.severity)&&console.warn(`[Peekling] ${e.message}${"error"===e.severity?" (use peekling.js for details)":""}`),e}},ae=class extends Error{code;category;constructor(t,e,i,s){super(i,{cause:s}),this.name="PackLoadError",this.code=t,this.category=e}},he=class extends Error{issues;issueCodes;constructor(t,e=[]){let i=t,s=t;super("pack:"+i.join(",")),this.name="PackValidationError",this.issues=i,this.issueCodes=e.length?e:s}},le=/^[a-f0-9]{64}$/,ce=4096,fe=[137,80,78,71,13,10,26,10],de=4096,ue=/^[a-z][a-z0-9._-]{0,63}$/,pe={peek:Object.freeze({url:"https://cdn.jsdelivr.net/npm/@peekling/pack-peek@0.1.0/character.json",sha256:"bc01840e84f72edca4b0421dca4d07623b38d971d851bfc647e1cada03e1cbcc"})},ve=/^(?:motion|state|surface:[a-z][a-z0-9:-]{0,63})$/,ye=/^[A-Za-z][A-Za-z0-9_.:-]{0,63}$/,we=class extends TypeError{code;path;constructor(t,e,i){super(t),this.name="PlanCompileError",this.code=t,this.path=""}},me=class{#t;#e=(()=>({ordering:new Map,sessions:new Map}))();#i=new Map;#s=new Map;#r=[];#n=0;#o;#a=[];constructor(t){this.#t=t}get plan(){return this.#t}get lastEventStatus(){return this.#o}get lastEventRejections(){return this.#a}evaluate(t){this.#o=void 0,this.#a=[];let e=t.reaction;if(this.#d(t.now),e){let i=((t,e,i)=>{function s(t,e=[],i=[],s=[]){return{status:t,rules:e,effects:i,rejectedSurfaces:dt([...s])}}let r;try{r=p(i.payload)}catch{return s("invalid")}let n="browser"===i.source&&"section.visibility"===i.name?(t=>{if(!t||"object"!=typeof t||Array.isArray(t))return;let e=t;return 3!==Object.keys(e).length||"string"!=typeof e.selector||"number"!=typeof e.S||"number"!=typeof e.ratio||e.S<0||e.S>1||e.ratio<0||e.ratio>1?void 0:e})(r):void 0;if("browser"===i.source&&"section.visibility"===i.name&&!n)return s("invalid");let o=t.rules.filter(t=>t.when.source===i.source&&t.when.event===i.name&&(!n||((t,e)=>{if("browser"!==t.source||"section.visibility"!==t.event||t.selector!==e.selector||"while-visible"===t.phase)return!1;let i=t.threshold??.25;return"enter"===t.phase?e.S<i&&e.ratio>=i:e.S>=i&&e.ratio<i})(t.when,n)));if(!o.length)return s("unmatched");if(!o.some(t=>Y(t.effect).some(t=>t.ordering)))return s("matched",o,o.map(t=>st(t.effect,r)));let a=new Map;for(let t of o)for(let e of Y(t.effect)){if(!e.ordering)continue;let t=tt(e),i=a.get(t)??[];i.push(e),a.set(t,i)}let h=[],l=new Set;for(let[t,i]of a){let s={ordering:new Map},n=rt(i,e,s,r);"matched"!==n?(l.add(t),h.push({channel:t,status:n})):ot(e,s,t)}let c=[],f=[];for(let[t,e]of o.entries()){let t=st(e.effect,r),i=nt(t,t.channels.filter(t=>!l.has(t)));i&&(c.push(e),f.push(i))}return s(f.length?"matched":h[0]?.status??"matched",c,f,h)})(this.#t,this.#e,{source:e.source,name:e.name,...void 0===e.payload?{}:{payload:e.payload}});if(this.#o=i.status,this.#a=i.rejectedSurfaces,"invalid"!==i.status&&"stale"!==i.status&&"closed"!==i.status&&this.#d(t.now,e.source,e.name),"matched"===i.status){let e=new Set;i.effects.forEach((s,r)=>{let n=s.channels.filter(t=>!e.has(t));if(n.length){for(let t of n)e.add(t);if(s.until)this.#f(nt(s,n),t.now);else{for(let t of n)("motion"===t||"state"===t)&&this.#i.set(t,[i.rules[r].effect,s]);for(let t of s.surfaces)n.includes(t.channel)&&this.#c(t)}}})}}let i=new Map;for(let t of this.#r)for(let e of t.effect.channels)i.set(e,t.effect);for(let e of this.#t.rules){let s=this.#l(e,t);for(let t of["motion","state"]){if(i.has(t))continue;let r=this.#i.get(t),n=s&&e.effect.channels.includes(t)?e.effect:r?.[0]===e.effect?r[1]:void 0;n&&i.set(t,n)}}for(let t of this.#t.baseline.channels)i.has(t)||i.set(t,this.#t.baseline);let s={},r=i.get("state")?.state;"state"===r?.kind&&(s.state=r.name),"capability"===r?.kind&&(s.capability=r.name);let n=i.get("motion")?.motion;if(n&&t.pointer){let e=t.pointer.x-t.position.x,r=t.pointer.y-t.position.y,o=Math.hypot(e,r),a=n.arrivalRadius??0;if(o>a)s.motion={x:e/o,y:r/o,speed:n.speed??160,maxDistance:o-a};else if(i.get("motion")===i.get("state")){delete s.capability;let t=this.#h();!s.state&&t&&(s.state=t)}}let o=new Map;for(let t of this.#t.baseline.surfaces)o.set(t.channel,{surface:t,version:0});for(let t of this.#s.values())o.set(t.surface.channel,t);for(let t of this.#r)for(let e of t.effect.surfaces)o.set(e.channel,{surface:e,version:t.version});return o.size&&(s.surfaces=Object.freeze([...o.values()].map(({surface:t,version:e})=>Object.freeze({id:t.id,channel:t.channel,contentId:t.contentId,...void 0===t.data?{}:{data:t.data},key:`${t.channel}:${e}`})))),e&&"matched"===this.#o&&(s.A=e.id),s}reset(){this.#i.clear(),this.#s.clear(),this.#r=[],this.#e.ordering.clear(),this.#e.sessions.clear(),this.#o=void 0,this.#a=[]}N(){return this.#r.reduce((t,e)=>Number.isFinite(e.M)?void 0===t?e.M:Math.min(t,e.M):t,void 0)}T(t){t&&(this.#r=this.#r.map(e=>({...e,M:e.M+t})))}#h(){let t=this.#t.baseline.state;return"state"===t?.kind?t.name:void 0}#l(t,e){let i=t.when;if("browser"!==i.source)return!1;if("pointer.move"===i.event){if(!e.pointer)return!1;let i=t.effect.motion;return!i||Math.hypot(e.pointer.x-e.position.x,e.pointer.y-e.position.y)>(i.arrivalRadius??0)}if("section.visibility"!==i.event)return!1;let s=e.sections?.[i.selector],r=i.threshold??.25;return"while-visible"===i.phase&&(s?.ratio??0)>=r}#c(t){let e=this.#s.get(t.channel);if("ignore"===t.disposition)return;let i="update"===t.disposition&&e?{...t,contentId:e.surface.contentId}:t;this.#s.set(t.channel,{surface:Object.freeze(i),version:++this.#n})}#f(t,e){let i=t.until,s=e+("duration"===i.type?i.ms:i.timeout??36e5);Number.isFinite(s)&&(this.#r=this.#r.filter(e=>!e.effect.channels.some(e=>t.channels.includes(e))),this.#r.push({effect:t,M:s,version:++this.#n}))}#d(t,e,i){this.#r=this.#r.filter(s=>{if(t>=s.M)return!1;let r=s.effect.until;return!(void 0!==e&&void 0!==i&&"event"===r.type&&(t=>d(t)?"browser":"application")(r.name)===e&&r.name===i)})}},be=!1,ge=["format","character","pack","packUrl","atlasUrl","styles","plan","content","bindings","theme","accessibility","diagnostics","name","scale","position","density","maxDensity","onDiagnostic","logger","document","window"],ke=class extends TypeError{issues;constructor(t,e,i){super(`${e}: ${i}`),this.name="PeeklingPreflightError",this.issues=[{code:t,path:e,message:i}]}},je=36e5,$e=class{#t;#e;#i;#s=[];#r=1;constructor(t,e,i=()=>{}){this.#t=t,this.#e=e,this.#i=i}add(t){let e,i,s=this.#n();try{e=(t=>{let e=l(t);if(!e||"object"!=typeof e||Array.isArray(e))throw new TypeError("override.object");if($t(e,["effect","until","mode"]),!e.effect)throw new TypeError("override.effect");if(void 0!==e.mode&&"reject"!==e.mode&&"replace"!==e.mode)throw new TypeError("override.mode");let i=void 0===e.until?Object.freeze({type:"manual"}):e.until;if(!i||"object"!=typeof i||Array.isArray(i))throw new TypeError("override.until");if("duration"===i.type)$t(i,["type","ms"]),jt(i.ms);else if("event"===i.type){if($t(i,["type","name","timeout"]),"string"!=typeof i.name||!_t.test(i.name))throw new TypeError("override.until.name");if(u(i.name))throw new TypeError("override.until.name");void 0!==i.timeout&&jt(i.timeout)}else{if("manual"!==i.type)throw new TypeError("override.until.type");$t(i,["type","maxMs"]),void 0!==i.maxMs&&jt(i.maxMs)}return Object.freeze({effect:e.effect,until:i,...void 0===e.mode?{}:{mode:e.mode}})})(t),i=((t,e={})=>{let i=l(t),s=Q(i,0,e,!1);s.until&&ut("invalid-override-lifetime");for(let[t,e]of Y(i).entries())void 0!==e.disposition&&ut("invalid-override-disposition"),void 0!==e.ordering&&ut("invalid-override-ordering");return s})(e.effect,this.#t)}catch(t){return this.#i("override.invalid"),s.finish("rejected"),s.handle}let r=this.#s.filter(t=>t.effect.channels.some(t=>i.channels.includes(t)));if(r.length&&"replace"!==e.mode)return this.#i("override.conflict"),s.finish("conflict"),s.handle;for(let t of r)this.#o(t,"replaced");if(this.#s.length>=8)return this.#i("override.limit"),s.finish("overflow"),s.handle;let n=this.#e();return Object.assign(s,{input:e,effect:i,P:n,M:n+kt(e),status:"active"}),this.#s.push(s),s.handle}reject(t="rejected"){let e=this.#n();return e.finish(t),e.handle}browserCompletionFor(t){let e=this.#s.find(e=>e.id===t)?.input.until;return"event"===e?.type?d(e.name):void 0}I(t,e="application"){for(let i of[...this.#s])"event"===i.input.until?.type&&i.input.until.name===t&>(i.input.until.name)===e&&this.#o(i,"event");return!1}compose(t,e){let i=this.#e();for(let t of[...this.#s])i>=t.M&&this.#o(t,"timeout");let s={...t},r=new Map;for(let e of t.surfaces??[])r.set(e.channel,e);for(let t of this.#s){let i=t.effect.state;"state"===i?.kind?(s.state=i.name,delete s.capability):"capability"===i?.kind&&(s.capability=i.name,delete s.state);let n=t.effect.motion;if(n&&e.pointer&&e.position){let t=e.pointer.x-e.position.x,i=e.pointer.y-e.position.y,r=Math.hypot(t,i),o=n.arrivalRadius??0;r>o?s.motion={x:t/r,y:i/r,speed:n.speed??160,maxDistance:r-o}:delete s.motion}for(let e of t.effect.surfaces)r.set(e.channel,Object.freeze({id:e.id,channel:e.channel,contentId:e.contentId,...void 0===e.data?{}:{data:e.data},key:t.id}))}return s.surfaces=Object.freeze([...r.values()]),s}N(){return this.#s.reduce((t,e)=>void 0===t?e.M:Math.min(t,e.M),void 0)}T(t){for(let e of this.#s)e.P+=t,e.M+=t}clear(t){for(let e of[...this.#s])this.#o(e,t)}#n(){let t,e="override:"+this.#r++,i=!1,s=new Promise(e=>{t=e}),r={},n=Object.freeze({id:e,get status(){return r.status},finished:s,cancel:()=>{"active"===r.status&&this.#o(r,"cancelled")}});return Object.assign(r,{id:e,effect:Object.freeze({channels:[],surfaces:[]}),input:Object.freeze({effect:Object.freeze({channels:[]}),until:Object.freeze({type:"manual"})}),P:0,M:0,status:"rejected",handle:n,finish(s){i||(i=!0,r.status=(t=>"rejected"===t||"conflict"===t||"overflow"===t)(s)?"rejected":"finished",t({id:e,reason:s}))}}),r}#o(t,e){let i=this.#s.indexOf(t);i>=0&&this.#s.splice(i,1),t.finish(e)}},Ee=class{host;ready;#t;#e;#i;#s;#r;#n;#o;#a=0;#h=0;#l="";#c=0;#f=-1;#d=!1;constructor(t,e,i,s,r){this.#t=t,this.#n=e,this.#o=s,this.host=t.createElement("div"),this.host.setAttribute("aria-hidden","true"),this.host.setAttribute("data-peekling-host",""),this.#e=this.host.attachShadow({mode:"closed"}),this.#s=new Dt(t,this.#e,r),this.#i=t.createElement("i"),this.#i.className="sprite",this.#e.append(this.#i),this.ready=this.#s.ready.then(()=>{this.#d||(this.#r=this.#s.addRule(".sprite"),this.#u(e,i))}),this.ready.catch(()=>{}),this.#p()}R(t,e){this.#d||this.#u(t,e)}#u(t,e){this.#n=t;let i=this.#r;if(!i)throw Error("renderer.styles");this.#a=t.atlas.logicalWidth??t.atlas.cellWidth,this.#h=t.atlas.logicalHeight??t.atlas.cellHeight,i.width=this.#a+"px",i.height=this.#h+"px",i.backgroundSize=`${t.atlas.columns*this.#a}px ${t.atlas.rows*this.#h}px`,i.backgroundImage=`url(${JSON.stringify(e)})`,i.imageRendering=1===(t.atlas.density??1)?"pixelated":"auto",this.#f=-1}D(t){this.#d||this.host.toggleAttribute("hidden",t)}C(t){if(this.#d)return;let e=this.#n.states[this.#l];if(!e||e.frames.length<2)return;let i=Math.max(0,t-this.#c);if(e.durations?.length===e.frames.length){let t=k(e);if(!e.loop&&i>=t-e.durations.at(-1))return;let s=e.loop?i%t:i,r=0;for(let t of e.durations)if(r+=t,r>s)return r-s;return e.loop?e.durations[0]:void 0}let s=1e3/(e.fps??1);return!e.loop&&i>=s*(e.frames.length-1)?void 0:s-(i%s||0)}U(t,e,i,s=1,r=0){if(this.#d||(this.#p(),this.#d))return;let n=this.#n.states[t];if(!n)throw Error("renderer.state");t!==this.#l&&(this.#l=t,this.#c=e,this.#f=-1,this.host.setAttribute("data-peekling-state",t));let o=((t,e)=>{if(1===t.frames.length)return t.frames[0];if(t.durations?.length===t.frames.length){let i=k(t),s=t.loop?e%i:Math.min(e,i-1),r=0;for(let e=0;e<t.frames.length;e++)if(r+=t.durations[e],s<r)return t.frames[e];return t.frames.at(-1)}let i=Math.floor(e*(t.fps??1)/1e3);return t.frames[t.loop?i%t.frames.length:Math.min(i,t.frames.length-1)]})(n,e-this.#c);if(o!==this.#f){let t=o%this.#n.atlas.columns,e=Math.floor(o/this.#n.atlas.columns);if(!this.#r)throw Error("renderer.styles");this.#r.backgroundPosition=`${-t*this.#a}px ${-e*this.#h}px`,this.#f=o,this.host.setAttribute("data-peekling-frame",o+"")}let a=this.#a*this.#o,h=this.#h*this.#o,l=Et(i.x-a/2,s),c=Et(i.y-h/2-r,s),f=l+"",d=c+"";if(this.host.getAttribute("data-peekling-x")!==f&&this.host.setAttribute("data-peekling-x",f),this.host.getAttribute("data-peekling-y")!==d&&this.host.setAttribute("data-peekling-y",d),!this.#r)throw Error("renderer.styles");let u=`translate3d(${l}px,${c}px,0) scale(${this.#o})`;this.#r.transform!==u&&(this.#r.transform=u)}destroy(){this.#d||(this.#d=!0,this.#s.destroy(),this.host.remove())}#p(){if(!this.#d){if(t(this.host,this.#t,"data-peekling-host"),this.#e.host!==this.host||this.#i.getRootNode()!==this.#e)throw Error("renderer.root");"true"!==this.host.getAttribute("aria-hidden")&&this.host.setAttribute("aria-hidden","true")}}},Oe={click:["waving","happy","alert"],"double-click":["jumping","happy","waving"],"context-click":["alert","waving","idle"],scroll:["alert","waving","idle"],success:["success","happy","jumping","waving"],happy:["happy","success","waving"],error:["error","failed","alert"],sleep:["sleep","idle"]},Se=class{#t;#e;#i=new Map;#s=new Map;#r;#n;#o;#a;#h=!1;#l=!1;#c=!1;#f;#d=0;constructor(t,e,i,s,r,n){this.#t=t,this.#e=e,this.#o=r,this.#a=n;let o=i.map(t=>[t,this.#p(t)]),a=e.IntersectionObserver;a&&(this.#r=new a(t=>{let e=!1;for(let i of t)for(let t of this.#s.get(i.target)??[]){let s=this.#i.get(t);s&&(e=this.#y(t,s,i.isIntersecting?i.intersectionRatio:0)||e)}e&&r()},{threshold:[...s]}));let h=e.MutationObserver;h&&(this.#n=new h(t=>{if(this.#h||this.#l||this.#d||this.#c||t.length>0&&t.every(Ot))return;let e=!1;for(let t of this.#i.values())if(!t[0]?.isConnected){e=!0;break}e&&this.#m()}),this.#n.observe(t.documentElement,{childList:!0,subtree:!0}));for(let[t,e]of o)this.#i.set(t,[void 0,0,0]),this.#u(t,e)}L(){if(this.#f)throw this.#f;if(this.#c&&(this.#c=!1,this.#g(),this.#f))throw this.#f;let t=Object.create(null);for(let[e,i]of this.#i)t[e]={ratio:i[2],S:i[1]};return t}O(t){if(!this.#l&&t!==this.#h){if(this.#h=t,t){this.#b(),this.#c=!1,this.#r?.disconnect(),this.#n?.disconnect();return}if(this.#n?.observe(this.#t.documentElement,{childList:!0,subtree:!0}),this.#c=!1,this.#g())for(let t of this.#s.keys())this.#r?.observe(t)}}destroy(){this.#l||(this.#l=!0,this.#b(),this.#c=!1,this.#r?.disconnect(),this.#n?.disconnect(),this.#s.clear(),this.#i.clear())}#u(t,e=this.#p(t)){let i=this.#i.get(t);if(!e){this.#v(t,i),this.#y(t,i,0);return}if(e===i[0]&&e.isConnected)return;this.#v(t,i),i[0]=e;let s=this.#s.get(e)??new Set;s.size||this.#r?.observe(e),s.add(t),this.#s.set(e,s)}#p(t){try{return this.#t.querySelector(t)}catch{throw new TypeError("section.selector")}}#v(t,e){let i=e[0];if(e[0]=void 0,!i)return;let s=this.#s.get(i);s?.delete(t),s?.size||(this.#r?.unobserve(i),this.#s.delete(i))}#y(t,e,i){let s=e[2];return i!==s&&(e[1]=s,e[2]=i,this.#a?.({selector:t,S:s,ratio:i}),!0)}#w(){for(let[t,e]of this.#i)e[0]?.isConnected||this.#u(t)}#m(){this.#d||this.#h||this.#l||(this.#d=this.#e.setTimeout(()=>{this.#d=0,!(this.#h||this.#l||this.#f||this.#c)&&(this.#c=!0,this.#o())},250))}#b(){this.#d&&this.#e.clearTimeout(this.#d),this.#d=0}#g(){if(this.#f)return!1;try{return this.#w(),!0}catch(t){return this.#f=t instanceof Error?t:Error("section.refresh"),this.#r?.disconnect(),this.#n?.disconnect(),this.#o(),!1}}},xe="peekling:site-preference",Ae="peekling:hidden-session",Ne=[["10 minutes","10-minutes"],["1 hour","1-hour"],["Until tomorrow","until-tomorrow"],["Until I return","session"],["Forever on this site","forever"]],Me=new WeakMap,ze=class{ready;#t;#e;#i=new Set;#s=[];#r=[];#n;#o;#a;#h;#l;#c;#f;#d;#u=0;#p=0;#v=!1;#y=!1;constructor(t,e,i){this.#t=t,this.#e=e;let s=St(e);this.#d=s[0],this.#n=t.createElement("div"),this.#n.dataset.peeklingControls="",this.#o=this.#n.attachShadow({mode:"closed"}),this.#c=`${i.url}\n${i.integrity??""}`,this.#f=i.integrity,this.#l=new Dt(t,this.#o,i),this.ready=this.#l.ready,this.ready.catch(()=>{}),this.#h=t.createElement("button"),this.#h.className="peekling-visibility-trigger",this.#h.type="button",this.#h.setAttribute("aria-label","Open Peekling visibility controls"),this.#h.textContent="🐾",this.#a=t.createElement("section"),this.#a.className="peekling-visibility-panel",this.#a.hidden=!0,this.#a.setAttribute("role","dialog"),this.#a.setAttribute("aria-label","Let Peekling rest");let r=t.createElement("h2");r.textContent="Let Peekling rest?",this.#a.append(r);for(let[e,i]of Ne){let s=t.createElement("button");s.className="peekling-visibility-option",s.type="button",s.textContent=e,s.addEventListener("click",()=>this.hide(i)),this.#a.append(s)}this.#o.append(this.#h,this.#a),this.#N(),this.#E(e,"storage",()=>this.refresh(),this.#s),this.#$(s[0],!1),this.#k(s[1])}#w(){if(!this.#r.length){this.#E(this.#t,"pointermove",t=>{"touch"===t.pointerType||"pen"===t.pointerType||this.#b(t.clientX,t.clientY)},this.#r),this.#E(this.#t,"pointerdown",t=>{let e=t;this.#v&&!this.#n.contains(t.target)&&this.close(),("touch"===e.pointerType||"pen"===e.pointerType)&&this.#b(e.clientX,e.clientY)},this.#r);for(let t of["pointerup","pointercancel","pointerout"])this.#E(this.#t,t,e=>{("pointerout"!==t||null===e.relatedTarget)&&this.#g()},this.#r);this.#E(this.#t,"keydown",t=>{"Escape"===t.key&&this.close(!0)},this.#r);this.#E(this.#h,"click",()=>this.open(!0),this.#r)}}#m(){this.#g(),this.#S(this.#r)}register(t){return this.#i.add(t),t(this.#d),()=>{this.#i.delete(t),this.#i.size||this.destroy()}}assertStyles(t){if(`${t.url}\n${t.integrity??""}`!==this.#c&&(!t.integrity||t.integrity!==this.#f))throw new TypeError("visibility.styles-conflict")}isHidden(){return this.#d}hide(t){let e=xt(this.#e,t);this.#j(!0),this.#k(e),this.close()}show(){At(this.#e),this.refresh()}refresh(){try{this.#N()}catch{let t=[...this.#i];this.destroy();for(let e of t)e(null);return}let t=St(this.#e);this.#j(t[0]),this.#k(t[1])}open(t=!1){this.#d||(this.#g(),this.#v=!0,this.#n.setAttribute("data-open",""),this.#a.hidden=!1,t&&this.#a.querySelector("button")?.focus())}close(t=!1){this.#v&&(this.#v=!1,this.#n.removeAttribute("data-open"),this.#a.hidden=!0,t&&this.#h.focus())}destroy(){this.#y||(this.#y=!0,this.#m(),this.#k(),this.#S(this.#s),this.#l.destroy(),this.#n.remove(),this.#i.clear(),Me.delete(this.#t))}#b(t,e){this.#d||this.#v||t<this.#e.innerWidth-64||e<this.#e.innerHeight-64?this.#g():this.#u||(this.#u=this.#e.setTimeout(()=>this.open(),1e3))}#g(){this.#u&&this.#e.clearTimeout(this.#u),this.#u=0}#k(t){(this.#p&&this.#e.clearTimeout(this.#p),this.#p=0,void 0===t||this.#y)||(this.#p=this.#e.setTimeout(()=>{this.#p=0,this.refresh()},Math.max(0,Math.min(t-Date.now(),2147e6))))}#j(t){t!==this.#d&&this.#$(t,!0)}#$(t,e){if(this.#d=t,this.#n.toggleAttribute("data-hidden",t),this.#h.hidden=t,t?this.#m():this.#w(),e)for(let e of this.#i)e(t)}#E(t,e,i,s){t.addEventListener(e,i,{passive:!0}),s.push([t,e,i])}#S(t){for(let[e,i,s]of t.splice(0))e.removeEventListener(i,s)}#N(){if(t(this.#n,this.#t,"data-peekling-controls"),this.#o.host!==this.#n||this.#h.getRootNode()!==this.#o||this.#a.getRootNode()!==this.#o)throw Error("visibility.root")}},Te=Object.freeze([]),Pe=class t{static hatch(e){return new t((t=>{if(void 0===t)return{};if("string"==typeof t)return{character:t};if(!t||"object"!=typeof t||Array.isArray(t))throw new TypeError("options.input");return t})(e))}W(t){return!this.#e&&(pt(t)?(this.#R="string"==typeof t?t:!0===t?this.#s?.content.displayName??"":void 0,this.#s&&this.#R&&!this.#n?this.#U().ready.then(()=>this.#L(),()=>{this.#e||(this.#W(),this.#Z("failed"))}):this.#L(),!0):(this.#F("config.invalid-name","warning","config"),!0))}ready;finished;#t;#e=!1;#i=new AbortController;#s;#r;#n;#o;#a;#h=0;#l=0;#c=0;#f=0;#d=0;#u=0;#p="";#v={x:0,y:0};#y=0;#w=!1;#m;#b;#g;#k;#j;#$=!1;#E=0;#S;#N;#z;#A;#M;#T=4;#R;#I;#P;#D;#x;#C;#O;#H;#_;#V;#q;#J=0;#B=!1;#K=!1;constructor(t={}){let n=(t=f(t)).document??globalThis.document,o=t.window??globalThis.window;if(!n||!o)throw Error("browser.context");this.#I=n,this.#P=o,this.#C=t,this.#O=o.performance?.now?.bind(o.performance)??Date.now,this.#_=`instance:${Math.floor(this.#O())}:${Math.random().toString(36).slice(2,8)}`,this.#V=new oe({instanceId:this.#_,now:this.#O,...t.logger?{logger:t.logger}:{},...t.onDiagnostic?{messageSink:t.onDiagnostic}:{},...t.diagnostics?.context?{context:t.diagnostics.context}:{},...t.diagnostics?.debug?{debug:!0}:{},...void 0===t.diagnostics?.console?{}:{console:t.diagnostics.console}});let[a,h]=((t,n)=>{let o,a=((t,i)=>{yt(t,ge,"$"),void 0===t.character&&void 0===t.pack&&void 0===t.packUrl&&mt("manifest.selection","$"),void 0!==t.format&&1!==t.format&&mt("unsupported-format","$.format"),void 0!==t.character&&("string"==typeof t.character&&Ht.test(t.character)?void 0===t.pack&&void 0===t.packUrl&&!F(t.character)&&mt("character.unknown","$.character"):mt("invalid-character","$.character")),void 0!==t.scale&&(!Number.isInteger(t.scale)||t.scale<1||t.scale>4)&&mt("out-of-range","$.scale");for(let e of["density","maxDensity"]){let i=t[e];void 0!==i&&1!==i&&2!==i&&4!==i&&mt("invalid-density","$."+e)}void 0!==t.density&&void 0!==t.maxDensity&&t.density>t.maxDensity&&mt("incompatible-density","$.density"),pt(t.name)||mt("invalid-name","$.name");for(let e of["packUrl","atlasUrl"]){let s=t[e];void 0!==s&&!r(s,i)&&mt("invalid-url","$."+e)}let n=t.position;if(void 0!==n&&"bottom-left"!==n&&"bottom-right"!==n&&"center"!==n){let t=vt(n,"invalid-position","$.position",["x","y"]);("number"!=typeof t.x||!Number.isFinite(t.x)||Math.abs(t.x)>1e5||"number"!=typeof t.y||!Number.isFinite(t.y)||Math.abs(t.y)>1e5)&&mt("invalid-position","$.position")}let o,a=t.styles;if(void 0!==a){let t=vt(a,"invalid-styles","$.styles",["url","integrity"]);("string"!=typeof t.url||!r(t.url,i))&&mt("invalid-styles-url","$.styles.url"),e(t.integrity)||mt("invalid-styles-integrity","$.styles.integrity")}try{o=((t,e)=>{if(void 0===t)return{};if(!t||"object"!=typeof t||Array.isArray(t))throw new TypeError("content.object");let i=Object.entries(t);if(i.length>32)throw new TypeError("content.limit");let s={};for(let[t,r]of i){if(!Ht.test(t))throw new TypeError(Rt("content.id"));if(!r||"object"!=typeof r||Array.isArray(r))throw new TypeError(Rt("content.item"));y(r,Ft);let i={};for(let t of Ft){let s=r[t];void 0!==s&&(i[t]=v(s,e))}if(!Object.keys(i).length)throw new TypeError(Rt("content.empty"));s[t]=i}return s})(t.content,i)}catch(t){mt("invalid-content","$.content")}((t,e)=>{let i;if(void 0!==t){let e=vt(t,"invalid-bindings","$.bindings",["mounts"]);if(void 0!==e.mounts){let t=vt(e.mounts,"invalid-bindings","$.bindings.mounts",void 0);{i=t;let e=Object.entries(t);e.length>64&&mt("binding-limit","$.bindings.mounts");for(let[t,i]of e)(!Ht.test(t)||"function"!=typeof i)&&mt("invalid-binding","$.bindings.mounts."+t)}}}for(let[t,s]of Object.entries(e))for(let e of Ft){let r=s[e];r&&"string"!=typeof r&&r.mountId&&!Object.hasOwn(i??{},r.mountId)&&mt("missing-binding",`$.content.${t}.${e}.mountId`)}})(t.bindings,o),(t=>{if(void 0===t)return;let e=vt(t,"invalid-theme","$.theme",["background","color","linkColor","borderColor","radius","width","padding"]);for(let[t,i,s]of[["radius",0,64],["width",120,640],["padding",0,48]]){let r=e[t];void 0!==r&&("number"!=typeof r||!Number.isFinite(r)||r<i||r>s)&&mt("invalid-theme","$.theme."+t)}for(let t of["background","color","linkColor","borderColor"]){let i=e[t];void 0!==i&&!s(i)&&mt("invalid-theme","$.theme."+t)}})(t.theme),(t=>{if(void 0===t)return;let e=vt(t,"invalid-diagnostics","$.diagnostics",["console","debug","context"]);for(let t of["console","debug"])void 0!==e[t]&&"boolean"!=typeof e[t]&&mt("invalid-diagnostics","$.diagnostics."+t);let i=e.context;if(void 0===i)return;let s=vt(i,"invalid-diagnostic-context","$.diagnostics.context",void 0),r=Object.entries(s);r.length>16&&mt("diagnostic-context-limit","$.diagnostics.context");for(let[t,e]of r)(!/^[a-z][a-z0-9_.-]{0,31}$/.test(t)||!["string","number","boolean"].includes(typeof e)||"string"==typeof e&&e.length>64||"number"==typeof e&&!Number.isFinite(e))&&mt("invalid-diagnostic-context","$.diagnostics.context."+t)})(t.diagnostics),(t=>{if(void 0===t)return;let e=vt(t,"invalid-accessibility","$.accessibility",["announceContent","contentLabel"]);void 0!==e.announceContent&&"boolean"!=typeof e.announceContent&&mt("invalid-accessibility","$.accessibility.announceContent"),void 0!==e.contentLabel&&!wt(e.contentLabel,120)&&mt("invalid-accessibility","$.accessibility.contentLabel")})(t.accessibility);for(let e of["onDiagnostic","logger"])void 0!==t[e]&&"function"!=typeof t[e]&&mt("invalid-callback","$."+e);return o})(t,n);try{o=i(t.styles,n)}catch(t){bt("invalid-styles","$.styles")}if(void 0!==t.plan)try{G(t.plan,{contentIds:new Set(Object.keys(a))})}catch(t){bt("invalid-plan","$.plan")}return[a,o]})(t,o.location?.href??n.baseURI);this.#q=h,this.finished=new Promise(t=>{this.#t=t}),this.#R="string"==typeof t.name?t.name:!0===t.name?"":void 0,this.#x=a;let l=((t,e,i,s)=>{let r=Me.get(t);return r?r.assertStyles(s):(r=new ze(t,e,s),Me.set(t,r)),{unregister:r.register(i),ready:r.ready}})(n,o,t=>{null===t?(this.#X("visibility.root-failed","internal.frame-failed","error","internal"),this.#Z("failed")):this.#G(t)},this.#q);this.#N=l.unregister,this.#z=l.ready,this.#A=()=>{n.hidden?(this.#Q(2,!0),this.#F("lifecycle.hidden","info","lifecycle")):(this.#Q(2,!1),this.#F("lifecycle.visible","info","lifecycle"))},n.addEventListener("visibilitychange",this.#A,{passive:!0}),this.#M=()=>this.#Y(),o.addEventListener("pagehide",this.#M,{passive:!0}),n.hidden&&this.#Q(2,!0),this.ready=this.#tt(),this.ready.catch(()=>{})}emit(t,e){if(this.#e)return this.#et("destroyed");if(this.#$)return this.#et("hidden");if("string"!=typeof t||!_t.test(t))return this.#et("invalid-name");if(!this.#a)return this.#et("not-ready");let i;try{i=p(e)}catch{return this.#et("invalid-payload")}let s=this.#a.j(t,i,"application");return s.accepted?(this.#F(s.coalesced?"event.coalesced":"event.accepted","info","event",s.id),s):this.#et(s.reason)}override(t){let e=t=>((t,e)=>Object.freeze({id:t,status:"rejected",finished:Promise.resolve({id:t,reason:e}),cancel(){}}))("override:rejected:"+ ++this.#J,t);if(this.#e)return e("destroyed");if(this.#$)return e("dismissed");if(!this.#H)return this.#K||(this.#K=!0,this.#F("override.not-ready","warning","override")),e("rejected");let i=this.#H.add(t),s=this.#H.browserCompletionFor(i.id),r=s?this.#a?.retainEvent(s):void 0;return i.finished.then(()=>{r?.(),this.#L()}),this.#L(),i}pause(){this.#e||1&this.#E||(this.#Q(1,!0),this.#F("lifecycle.paused","info","lifecycle"))}resume(){this.#e||!(1&this.#E)||(this.#Q(1,!1),this.#F("lifecycle.resumed","info","lifecycle"))}destroy(){this.#Z("destroyed")}#Z(t){if(this.#e)return;this.#e=!0,this.#c+=1,this.#H?.clear("destroyed"),this.#i.abort(),this.#it(),this.#a?.destroy(),this.#D?.reset(),this.#o?.destroy(),this.#n?.destroy(),this.#r?.destroy(),this.#N?.(),this.#N=void 0,this.#A&&(this.#I.removeEventListener("visibilitychange",this.#A),this.#A=void 0),this.#M&&(this.#P.removeEventListener("pagehide",this.#M),this.#M=void 0),this.#s?.release(),this.#m&&this.#b&&this.#m.removeEventListener("change",this.#b),this.#g&&this.#k&&this.#g.removeEventListener("change",this.#k),this.#F("lifecycle.destroyed","info","lifecycle");let e=this.#t;this.#t=void 0,e?.({reason:t})}async#tt(){try{let t=t=>((t,e)=>{try{return t.createDocumentFragment().querySelector(e),!0}catch{return!1}})(this.#I,t);void 0!==this.#C.plan&&G(this.#C.plan,{contentIds:new Set(Object.keys(this.#x)),validateSelector:t});let e,i=this.#P,s=i.navigator.connection;this.#T=this.#C.maxDensity??(s?.saveData?2:4);try{e=await(async t=>{let e=t.resourceTimeoutMs??3e4;void 0===t.pack&&void 0===t.packUrl&&void 0===t.character&&O("manifest.selection");let i,s,n=t.packUrl;if(void 0!==t.pack)i=t.pack;else{if(void 0===n){let e=(t=>{if(!F(t))throw Error("character.unknown");return pe[t]})(t.character);n=e.url,s=e.sha256}let o=((t,e)=>{r(t,e)||O("url.protocol");try{return new URL(t,e).href}catch{O("url.invalid")}})(n,t.baseUrl);n=o;let a=await q(t.signal,e,"manifest.timeout",async e=>{let i=await J(t.fetch,o,e,"manifest.network");if(!i.ok)throw new ae("manifest.http","http","manifest.http");return H(i,["application/json"]),B(i,65536,e,"manifest.network")});s&&!await K(a,s,!0)&&O("manifest.hash");try{i=(t=>((t,e,i=65536)=>{if((new TextEncoder).encode(t).byteLength>i)throw new he([$(e+".size")]);let s,r;try{s=JSON.parse(t)}catch{throw new he([$(e+".json")])}try{r=(t=>{let e,i=0,s=()=>{for(;/\s/.test(t[i]??"");)i++},r=()=>{let e=i++;for(;i<t.length;)if("\\"===t[i])i+=2;else if('"'===t[i++])break;return JSON.parse(t.slice(e,i))},n=(o=0)=>{if(s(),"{"===t[i]){if(o>=64)throw 0;i++;let a=new Set;for(s();"}"!==t[i];){let h=r();if(a.has(h)&&void 0===e&&(e=h),a.add(h),s(),i++,n(o+1),s(),","!==t[i])break;i++,s()}i++;return}if("["!==t[i])if('"'!==t[i])for(;i<t.length&&!/[\s,}\]]/.test(t[i]);)i++;else r();else{if(o>=64)throw 0;for(i++,s();"]"!==t[i]&&(n(o+1),s(),","===t[i]);)i++,s();i++}};return n(),e})(t)}catch(t){throw 0!==t?t:new he([$(e+".depth")])}if(void 0!==r)throw new he([$(e+".duplicate-key",JSON.stringify(r))]);return s})(t,"character.json"))(new TextDecoder("utf-8",{fatal:!0}).decode(a))}catch(t){if(t instanceof he)throw t;O("manifest.utf8")}}try{i=c(i)}catch(t){throw t instanceof Xt?new he([t.message],t.issueCode?[t.issueCode]:[]):t}let o=(t=>{if(!M(t))return!1;let e=Object.getOwnPropertyDescriptor(t,"atlas")?.value,i=Object.getOwnPropertyDescriptor(t,"assets")?.value;return M(e)&&!M(i)})(i),a=o?Z:U,h=a(i),l=t.Z??X(t.devicePixelRatio??1,t.F??h.defaultScale,t.maxDensity),f=a(i,void 0,l),d=!1,u="",p=async s=>{let r=(e=>t.atlasUrl??(n?new URL(e,new URL(n,t.baseUrl)).href:void 0))(s.src);r||O("atlas.url");let[h,l]=await q(t.signal,e,"atlas.timeout",async e=>{let i=await J(t.fetch,r,e,"atlas.network");if(!i.ok)throw new ae("atlas.http","http","atlas.http");return[H(i,o?["image/png","image/webp"]:["image/png"]),await B(i,o?33554432:4194304,e,"atlas.network")]});await K(l,s.sha256)||O("atlas.hash");let c=a(i,void 0,s.density);((t,e,i,s)=>{let r=((t,e)=>{t.byteLength>33554432&&O("resource.size");let i=T(t),s=P(t);return("image/png"===e&&s||"image/webp"===e&&i)&&O("atlas.mime"),"image/png"===e?(t=>{T(t)||O("png.signature");let e=new DataView(t.buffer,t.byteOffset,t.byteLength),i=fe.length,s=0,r=0,n=-1,o=0,a=!1,h=!1,l=!1,c=!1;for(;i<t.byteLength;){t.byteLength-i<12&&O("png.truncated");let f=e.getUint32(i),d=i+8,u=d+f+4;(u>t.byteLength||u<d)&&O("png.chunk");let p=I(t,i+4);if(/^[A-Za-z]{4}$/.test(p)||O("png.chunk-type"),o+=1,o>4096&&O("png.chunks"),!a&&("IHDR"!==p||13!==f)&&O("png.ihdr-first"),"IHDR"===p){(a||13!==f)&&O("png.ihdr"),a=!0,s=e.getUint32(d),r=e.getUint32(d+4);let i=t[d+8];n=t[d+9];let o={0:[1,2,4,8,16],2:[8,16],3:[1,2,4,8],4:[8,16],6:[8,16]};(s<1||r<1||s>ce||r>ce)&&O("png.dimensions"),(!o[n]?.includes(i)||0!==t[d+10]||0!==t[d+11]||0!==t[d+12]&&1!==t[d+12])&&O("png.fields")}else if("PLTE"===p)c&&O("png.palette-order"),h=!0;else if("tRNS"===p)c&&O("png.alpha-order"),l=!0;else if("IDAT"===p)3===n&&!h&&O("png.palette"),c=!0;else{if("IEND"===p)return(0!==f||!c)&&O("png.iend"),u!==t.byteLength&&O("png.trailing"),{width:s,height:r,hasAlpha:4===n||6===n||3===n&&l,mimeType:"image/png"};p.charCodeAt(0)<=90&&O("png.critical")}i=u}O("png.truncated")})(t):(t=>{(t.byteLength<20||!P(t))&&O("webp.header");let e=new DataView(t.buffer,t.byteOffset,t.byteLength);e.getUint32(4,!0)+8!==t.byteLength&&O("webp.size");let i,s,r=12,n=0,o=!1;for(;r<t.byteLength;){t.byteLength-r<8&&O("webp.chunk");let a=I(t,r),h=e.getUint32(r+4,!0),l=r+8,c=l+h+(1&h);if((c<l||c>t.byteLength)&&O("webp.chunk"),n+=1,n>4096&&O("webp.chunks"),"ALPH"===a)o=!0;else if("VP8X"===a)h<10&&O("webp.vp8x"),i=D(1+R(t,l+4),1+R(t,l+7),!!(16&t[l])||o);else if("VP8L"===a){(h<5||47!==t[l])&&O("webp.vp8l");let r=e.getUint32(l+1,!0),n=D(1+(16383&r),1+(r>>>14&16383),!0);s??=i??n}else if("VP8 "===a){(h<10||157!==t[l+3]||1!==t[l+4]||42!==t[l+5])&&O("webp.vp8");let r=D(16383&e.getUint16(l+6,!0),16383&e.getUint16(l+8,!0),o);s??=i??r}else!i&&!s&&"ICCP"!==a&&"EXIF"!==a&&"XMP "!==a&&O("webp.chunk-type");r=c}if(s)return s;O("webp.image")})(t)})(t,e);(r.width!==s.width||r.height!==s.height)&&O("atlas.dimensions"),!i&&!r.hasAlpha&&O("atlas.alpha")})(l,h,o,{width:c.atlas.columns*c.atlas.cellWidth,height:c.atlas.rows*c.atlas.cellHeight});let f=t.createObjectURL(new Blob([l]));try{let e=await(async(t,e,i)=>(await new Promise((s,r)=>{let n=()=>{t.removeEventListener("load",o),t.removeEventListener("error",a),i.removeEventListener("abort",h)},o=()=>{n(),s()},a=()=>{n(),r(new ae("atlas.decode","decode","atlas.decode"))},h=()=>{n(),t.removeAttribute("src"),r(i.reason)};if(t.addEventListener("load",o,{once:!0}),t.addEventListener("error",a,{once:!0}),i.addEventListener("abort",h,{once:!0}),i.aborted)return h();t.src=e}),{width:t.naturalWidth,height:t.naturalHeight}))(t.image(),f,t.signal);return{pack:a(i,{...e,byteLength:l.byteLength},s.density),H:f}}catch(e){throw t.revokeObjectURL(f),e}},v=async(e,i)=>{let s,r=(e=>{let i=h.atlas.variants;if(!i?.length){let e=f.atlas.density??1;return void 0!==t.Z&&t.Z!==e&&O("atlas.override-density"),e>(t.maxDensity??4)&&O("atlas.max-density"),f.atlas.sha256||O("atlas.integrity-declaration"),[{src:f.atlas.src,density:e,sha256:f.atlas.sha256}]}let s=i.filter(e=>e.density<=(t.maxDensity??4));if(s.length||O("atlas.max-density"),void 0!==t.atlasUrl){void 0===t.Z&&O("atlas.override-density");let e=s.find(e=>e.density===t.Z);return e||O("atlas.override-density"),[e]}let r=L(s.map(t=>t.density),e);return s.filter(t=>t.density<=r).sort((t,e)=>e.density-t.density)})(e);for(let[e,n]of r.entries()){if(i&&n.density<=(f.atlas.density??1))return;try{return await p(n)}catch(i){if(t.signal.aborted)throw t.t?.(Rt("atlas.abort"),"abort"),i;s=i;let n=_(i),o=e<r.length-1;t.t?.(Rt(`atlas.${n}.${o?"fallback":"exhausted"}`),n)}}if(!i)throw s??new ae("atlas.unusable","validation","atlas.unusable")},y=await v(l,!1);if(!y)throw new ae("atlas.unusable","validation","atlas.unusable");f=y.pack,u=y.H;let w=f.atlas.density??1,m=0,b={get content(){return f},get _(){return u},get V(){return f.atlas.density??1},async upgrade(e){if(d||void 0!==t.atlasUrl||e<=b.V)return!1;w=Math.max(w,e);let i=++m,s=await v(w,!0),r=s?.pack.atlas.density??1;if(!s||d||r<=b.V||i!==m&&r<w)return s&&t.revokeObjectURL(s.H),!1;let n=u;return f=s.pack,u=s.H,t.revokeObjectURL(n),!0},release(){d||(d=!0,u&&t.revokeObjectURL(u),u="")}};return b})({...void 0===this.#C.character?{}:{character:this.#C.character},baseUrl:this.#P.location.href,...void 0===this.#C.pack?{}:{pack:this.#C.pack},...void 0===this.#C.packUrl?{}:{packUrl:this.#C.packUrl},...void 0===this.#C.atlasUrl?{}:{atlasUrl:this.#C.atlasUrl},...void 0===this.#C.scale?{}:{F:this.#C.scale},devicePixelRatio:this.#P.devicePixelRatio,...void 0===this.#C.density?{}:{Z:this.#C.density},maxDensity:this.#T,fetch:this.#P.fetch.bind(this.#P),image(){return new i.Image},signal:this.#i.signal,createObjectURL:i.URL.createObjectURL.bind(i.URL),revokeObjectURL:i.URL.revokeObjectURL.bind(i.URL),t:(t,e)=>{this.#X(t,e?"config.pack-load-"+e:"config.pack-load","warning","config")}})}catch(t){throw this.#e&&this.#i.signal.aborted||this.#F("config.pack-load-failed","error","config",void 0,void 0,t),t}if(this.#e)throw e.release(),new DOMException("lifecycle.destroyed","AbortError");let n=this.#C.scale??e.content.defaultScale;if(!Number.isInteger(n)||n<1||n>4)throw e.release(),new TypeError("scale.value");this.#s=e;let o=(t=>Wt.every(e=>Object.hasOwn(t.directionalStates??{},e)))(e.content),a=new Set(o?["locomotion"]:[]),h=G(this.#C.plan??(t=>({baseline:{channels:["state"],state:{state:"idle"}},...t?{rules:[{id:"follow-pointer",when:{source:"browser",event:"pointer.move"},effect:{channels:["motion","state"],motion:{type:"follow-pointer",speed:160},state:{capability:"locomotion"}}}]}:{}}))(o),{states:new Set(Object.keys(e.content.states)),capabilities:a,contentIds:new Set(Object.keys(this.#x)),validateSelector:t});this.#D=new me(h),this.#H=new $e({states:new Set(Object.keys(e.content.states)),capabilities:a,contentIds:new Set(Object.keys(this.#x))},this.#O,t=>this.#X(t,"override.rejected","warning","override")),""===this.#R&&(this.#R=e.content.displayName),this.#m=this.#P.matchMedia("(prefers-reduced-motion: reduce)"),this.#w=this.#m.matches,this.#b=t=>{this.#w=t.matches,this.#F(t.matches?"lifecycle.reduced-motion-enabled":"lifecycle.reduced-motion-disabled","info","lifecycle"),this.#L()},this.#m.addEventListener("change",this.#b),this.#st(),this.#v=((t,e,i,s,r)=>{let n;if("center"===t)n={x:e/2,y:i/2};else if("bottom-right"===t||"bottom-left"===t)n={x:"bottom-right"===t?e-s/2-16:s/2+16,y:i-r/2-16};else{if("object"!=typeof t)throw new TypeError("position.value");if(!Number.isFinite(t.x)||!Number.isFinite(t.y))throw new TypeError("position.coordinates");n=t}return Nt(n,{width:e,height:i},s,r)})(this.#C.position??"bottom-right",this.#P.innerWidth,this.#P.innerHeight,(e.content.atlas.logicalWidth??e.content.atlas.cellWidth)*n,(e.content.atlas.logicalHeight??e.content.atlas.cellHeight)*n),this.#r=new Ee(this.#I,e.content,e._,n,this.#q),(Object.keys(this.#x).length||void 0!==this.#R)&&this.#U();try{await Promise.all([this.#z,this.#r.ready,this.#n?.ready])}catch(t){throw this.#W(t),t}let l=(t=>{let e=new Set,i=new Set([0,1]);for(let s of t.rules)"browser"===s.when.source&&"section.visibility"===s.when.event&&(e.add(s.when.selector),i.add(s.when.threshold??.25));return{selectors:[...e],thresholds:[...i].sort((t,e)=>t-e)}})(h);return this.#rt(),l.selectors.length&&(this.#o=new Se(this.#I,this.#P,l.selectors,l.thresholds,()=>this.#L(),t=>this.#a?.j("section.visibility",t,"browser"))),this.#r.D(this.#$),this.#E&&(this.#a?.O(!0),this.#o?.O(!0)),this.#f=this.#O(),this.#nt(this.#f,!0),this}catch(t){throw this.#Z("failed"),t}}#rt(){if(this.#e||this.#a||!this.#D)return;let t=new Set,e=new Map;for(let i of this.#D.plan.rules){let s="browser"===i.when.source;if(s&&t.add(i.when.event),"event"===i.effect.until?.type){let e=d(i.effect.until.name);e&&t.add(e)}if("latest"!==i.when.coalesce)continue;let r=`${i.when.source}:${i.when.event}`;if(s)e.set(r,!0);else{let t=i.effect.surfaces[0].ordering;e.set(r,{sessionField:t.sessionField,revisionField:t.revisionField})}}this.#a=new se(this.#I,this.#P,{events:t,coalesce:e,t:t=>this.#X(t,"event.queue-overflow","warning","event"),now:this.#O,wake:()=>this.#L()}),t.has("page.lifecycle")&&this.#a.j("page.lifecycle",{phase:"show"},"browser")}#U(){return this.#n||this.#e||(this.#n=new ie(this.#I,{t:t=>this.#X(t,"render.host-failed","error","render"),...this.#C.bindings?{bindings:this.#C.bindings}:{},...this.#C.theme?{theme:this.#C.theme}:{},...this.#C.accessibility?.announceContent?{announce:!0}:{},...this.#C.accessibility?.contentLabel?{label:this.#C.accessibility.contentLabel}:{},emit:(t,e)=>this.emit(t,e),wake:()=>this.#L(),styles:this.#q})),this.#n}#X(t,e="runtime.notice",i="warning",s="internal",r,n,o){this.#V.emit({code:e,severity:i,message:t,phase:s,...void 0===r?{}:{eventId:r},...n?{metadata:n}:{},...o?{cause:o}:{}})}#F(t,e="warning",i="internal",s,r,n){this.#X(t,t,e,i,s,r,n)}#W(t){this.#F("config.styles-load-failed","error","config",void 0,void 0,t)}#et(t){if("not-ready"===t){if(this.#B)return{accepted:!1,reason:t};this.#B=!0}return this.#X("event.rejected","event.rejected."+t,"warning","event",void 0,{reason:t}),{accepted:!1,reason:t}}#ot(){void 0===this.#S&&(this.#S=this.#O(),this.#it(),this.#a?.O(!0),this.#o?.O(!0))}#it(){this.#h&&this.#P.cancelAnimationFrame(this.#h),this.#h=0,this.#l&&this.#P.clearTimeout(this.#l),this.#l=0}#at(){if(void 0===this.#S||this.#E||this.#e)return;let t=this.#O(),e=Math.max(0,t-this.#S);this.#S=void 0,this.#H?.T(e),this.#D?.T(e),this.#a?.O(!1),this.#o?.O(!1),this.#f=t,this.#L()}#Q(t,e){let i=this.#E;e?this.#E|=t:this.#E&=~t,i!==this.#E&&(this.#c+=1,!i&&this.#E&&this.#ot(),i&&!this.#E&&this.#at())}#G(t){if(t!==this.#$&&(this.#$=t,this.#r?.D(t),!(this.#e||t&&this.#n&&(this.#n.i([],{},this.#v,{width:this.#P.innerWidth,height:this.#P.innerHeight},{width:0,height:0}),this.#e)))){if(t){this.#H?.clear("dismissed"),this.#Q(4,!0),this.#F("lifecycle.dismissed","info","lifecycle");return}this.#Q(4,!1),this.#r&&this.#s&&!this.#e&&(this.#F("lifecycle.shown","info","lifecycle"),this.#e||this.#L())}}#L(){if(this.#e||this.#E||!this.#r||this.#h)return;this.#l&&this.#P.clearTimeout(this.#l),this.#l=0;let t=this.#c,e=this.#P.requestAnimationFrame(()=>{if(this.#h=0,!this.#e&&!this.#E&&t===this.#c)try{this.#nt(this.#O())}catch(t){this.#F("internal.frame-failed","error","internal",void 0,void 0,t),this.#Z("failed")}});this.#e||this.#E||t!==this.#c?this.#P.cancelAnimationFrame(e):this.#h=e}#ht(t){if(!this.#lt(t))return;this.#l&&this.#P.clearTimeout(this.#l),this.#l=0;let e=t.overrides.N(),i=Number.isFinite(e)?e:void 0,s=t.plan.N(),r=Number.isFinite(s)?s:void 0,n=this.#w?void 0:t.renderer.C(this.#d),o=Number.isFinite(n)?n:void 0,a=void 0===o?void 0:t.now+o,h=void 0===i?r:void 0===r?i:Math.min(i,r),l=void 0===h?a:void 0===a?h:Math.min(h,a);if(void 0===l||!Number.isFinite(l)||!this.#lt(t))return;let c=this.#P.setTimeout(()=>{this.#lt(t)&&(this.#l=0,this.#L())},Math.min(2147483647,Math.max(0,l-t.now)));this.#lt(t)?this.#l=c:this.#P.clearTimeout(c)}#st(){this.#g&&this.#k&&this.#g.removeEventListener("change",this.#k),this.#g=this.#P.matchMedia(`(resolution: ${this.#P.devicePixelRatio}dppx)`),this.#k=()=>{this.#st(),this.#ct(),this.#L()},this.#g.addEventListener("change",this.#k)}#ct(){if(this.#e||!this.#s||!this.#r||this.#j||void 0!==this.#C.density)return;let t=this.#C.scale??this.#s.content.defaultScale,e=X(this.#P.devicePixelRatio,t,this.#T);if(e<=this.#s.V)return;let i=this.#s;this.#j=i.upgrade(e).then(t=>{t&&!this.#e&&this.#s===i&&(this.#r?.R(i.content,i._),this.#L())}).catch(t=>{this.#e||this.#F("render.atlas-upgrade-failed","warning","render",void 0,void 0,t)}).finally(()=>{this.#j=void 0})}#lt(t){return!this.#e&&!this.#E&&t.q===this.#c&&t.renderer===this.#r&&t.loaded===this.#s&&t.input===this.#a&&t.plan===this.#D&&t.overrides===this.#H}#ft(t,e){let i=this.#r,s=this.#s,r=this.#a,n=this.#D,o=this.#H;if(this.#e||this.#E||!i||!s||!r||!n||!o)return;let a=t-this.#f;if(e||!(a<1e3/30))return{q:this.#c,now:t,elapsed:a,stepMs:Math.min(Math.max(0,a)||1e3/30,100),renderer:i,loaded:s,input:r,plan:n,overrides:o};this.#L()}#dt(t){let e=t.loaded.content,i=t.input,s=this.#C.scale??e.defaultScale,r={width:this.#P.innerWidth,height:this.#P.innerHeight},n={width:(e.atlas.logicalWidth??e.atlas.cellWidth)*s,height:(e.atlas.logicalHeight??e.atlas.cellHeight)*s},o=this.#P.devicePixelRatio;this.#ct(),this.#v=Nt(this.#v,r,n.width,n.height);let a=this.#o?.L(),h=i.reaction,l=h&&h.id>this.#y?h:void 0;return{frame:t,devicePixelRatio:o,characterSize:n,world:{now:t.now,pointer:i.pointer,position:this.#v,viewport:r,k:i.k,reducedMotion:this.#w,pageVisible:!this.#I.hidden,sections:a,reaction:l},reaction:l}}#ut(t){let{frame:e,world:i,reaction:s}=t,{plan:r,overrides:n}=e,o=r.evaluate(i),a=s?r.lastEventStatus:void 0,h=s?r.lastEventRejections:[];s&&"invalid"!==a&&"stale"!==a&&"closed"!==a&&n.I(s.name,s.source);let l=n.compose(o,i);this.#w&&(delete l.motion,"locomotion"===l.capability&&delete l.capability,l.state||(l.state="idle"));let c=[];if(s)if(this.#y=s.id,e.input.$(s.id),h.length)for(let t of h)c.push(Object.freeze({message:Rt("event."+t.status),code:"event."+t.status,severity:"invalid"===t.status?"warning":"info",eventId:s.id,metadata:Object.freeze({channel:t.channel})}));else"stale"===a||"closed"===a||"invalid"===a?c.push(Object.freeze({message:"event."+a,code:"event."+a,severity:"invalid"===a?"warning":"info",eventId:s.id})):"matched"!==a&&c.push(Object.freeze({message:"event.unmatched",code:"event.unmatched",severity:"info",eventId:s.id}));return{request:l,diagnostics:c}}#pt(t,e){for(let i of e){if(!this.#lt(t))return!1;this.#X(i.message,i.code,i.severity,"event",i.eventId,i.metadata)}return this.#lt(t)}#vt(t,e){let{frame:i,characterSize:s,world:r}=t,{request:n}=e,o=i.loaded.content;this.#w||(this.#d+=Math.max(0,i.elapsed));let a="locomotion"===n.capability&&n.motion?o.directionalStates?.[((t,e)=>re[(Math.round(Math.atan2(e.y-0,e.x-0)/(Math.PI/4))+8)%8])(0,{x:n.motion.x,y:n.motion.y})]:((t,e)=>{if(t)return e.reactionStates&&Object.hasOwn(e.reactionStates,t)?e.reactionStates[t]:t})(n.state,o),h=((t,e)=>{let i=Object.keys(e);if(0===i.length)throw Error("state.empty");let s=t=>Object.hasOwn(e,t);if(t&&s(t))return{name:t};if(t)for(let e of Object.hasOwn(Oe,t)?Oe[t]:[])if(s(e))return{name:e};return s("idle")?{name:"idle"}:{name:i.sort()[0]}})(a,o.states),l=0;if(n.motion){this.#p!==h.name&&(this.#p=h.name,this.#u=0);let t=k(o.states[h.name]),e=this.#u/t;this.#u+=i.stepMs;let a=this.#u/t,c=a-e,f=((t,e,i)=>(Math.floor(i)-Math.floor(e))*(t?.length?t.at(-1).advance-t[0].advance:1)+j(t,i).advance-j(t,e).advance)(o.locomotionMotion,e,a),d=n.motion.speed*(i.stepMs/1e3)*(c>0?f/c:1),u=Math.min(d,n.motion.maxDistance??d);this.#v=Nt({x:this.#v.x+n.motion.x*u,y:this.#v.y+n.motion.y*u},r.viewport,s.width,s.height),l=j(o.locomotionMotion,a).lift*s.height}else this.#p="",this.#u=0;return{state:h.name,lift:l}}#nt(t,e=!1){let i=this.#ft(t,e);if(!i||!this.#lt(i))return;let s=this.#dt(i);if(!this.#lt(i))return;let r=this.#ut(s);if(!this.#lt(i)||!this.#pt(i,r.diagnostics))return;let n=this.#vt(s,r);this.#lt(i)&&(this.#n?.i(r.request.surfaces??Te,this.#x,this.#v,s.world.viewport,s.characterSize,this.#R),this.#lt(i)&&(i.renderer.U(n.state,this.#d,this.#v,s.devicePixelRatio,n.lift),this.#lt(i)&&(this.#f=i.now,this.#ht(i),this.#lt(i)&&(r.request.motion||i.input.reaction)&&this.#L())))}#Y(){if(!this.#e)try{this.#a&&this.#D&&(this.#yt(this.#O()),this.#a.j("page.lifecycle",{phase:"hide"},"browser"),this.#yt(this.#O())),this.#F("lifecycle.pagehide","info","lifecycle")}finally{this.#Z("pagehide")}}#yt(t){if(!this.#a||!this.#D)return;let e=this.#a.reaction;for(;e;)this.#D.evaluate({now:t,position:this.#v,viewport:{width:this.#P.innerWidth,height:this.#P.innerHeight},k:this.#a.k,reducedMotion:this.#w,pageVisible:!1,reaction:e}),this.#y=e.id,this.#a.$(e.id),e=this.#a.reaction}},Ie="peekling-character",Re=0,De="sha256-w8BENjaJ/B1wtpk3iuh7jT++FlbT5+fx5BBlvePx1qo=",Ce=globalThis.document?.currentScript;Ce?.src&&(t=>{Tt=Object.freeze({...t})})({url:new URL("./peekling.css",Ce.src).href,...De?{integrity:De}:{}});var Ue=Object.freeze({hatch(t){return Pe.hatch(t)},visibility:Object.freeze({hide(t,e=globalThis.document,i=globalThis.window){if(!e||!i)throw Error("browser.context");let s=Me.get(e);s?s.hide(t):xt(i,t)},show(t=globalThis.document,e=globalThis.window){if(!t||!e)throw Error("browser.context");let i=Me.get(t);i?i.show():At(e)},isHidden(t=globalThis.window){return!!((t=globalThis.window)=>{if(!t)throw Error("browser.window");return Me.get(t.document)?.isHidden()??((t,e=Date.now())=>St(t,e)[0])(t)})(t)}})});try{Reflect.has(globalThis,"Peekling")?Mt("Peekling"):Object.defineProperty(globalThis,"Peekling",{configurable:!0,value:Ue,writable:!1})}catch{Mt("Peekling")}(function(){try{let t=globalThis.customElements,e=globalThis.HTMLElement;if(!t||!e)return;let i=t.get(Ie);if(i){i!==It&&Mt(Ie);return}class s extends e{static observedAttributes=["character","pack-url","name","styles-url","styles-integrity"];static{for(let t of["plan","content","bindings","theme","styles","accessibility","diagnostics","logger"])Object.defineProperty(this.prototype,t,{configurable:!0,get(){return this.#s[t]},set(e){this.#l(t,e)}})}#t;#e=Object.create(null);#i;#s=Object.create(null);#r=!1;#n=!1;#o=0;#a=zt();#h=t=>{t.persisted&&this.#c()};get options(){return this.#e}set options(t){try{this.#e=f(t),this.#i=void 0}catch(t){this.#e=Object.create(null),this.#i=t}this.#c()}get instance(){return this.#t}get ready(){return this.#a[0]}emit(t,e){return this.#t?.emit(t,e)??{accepted:!1,reason:"not-ready"}}override(t){if(!this.#t){let t="override:disconnected:"+ ++Re;return{id:t,status:"rejected",finished:Promise.resolve({id:t,reason:"rejected"}),cancel(){}}}return this.#t.override(t)}pause(){this.#t?.pause()}resume(){this.#t?.resume()}connectedCallback(){globalThis.addEventListener?.("pageshow",this.#h),this.#c()}attributeChangedCallback(t){let e=this.getAttribute("name");"name"===t&&this.#t&&this.#t.W(null===e?this.#e.name:e||!0)||this.#c()}disconnectedCallback(){globalThis.removeEventListener?.("pageshow",this.#h),this.#o+=1,this.#r=!1,this.#a[2](new DOMException("element.disconnected","AbortError")),this.#t?.destroy(),this.#t=void 0}#l(t,e){void 0===e?delete this.#s[t]:this.#s[t]=e,this.#c()}#c(){if(!this.isConnected||this.#r)return;this.#r=!0;let t=++this.#o;this.#n?(this.#a[2](new DOMException("element.remounted","AbortError")),this.#a=zt()):this.#n=!0,queueMicrotask(()=>{t===this.#o&&(this.#r=!1,this.isConnected&&(this.#t?.destroy(),this.#t=void 0,this.#f(t)))})}async#f(t){try{if(this.#i)throw this.#i;if(!this.#e||"object"!=typeof this.#e||Array.isArray(this.#e))throw new Xt("$","data.plain");let e=Object.create(null);for(let t of[this.#e,this.#s])for(let i in t)e[i]=t[i];let i=this.getAttribute("character");null!==i&&(e.character=i);let s=this.getAttribute("pack-url");null!==s&&(e.packUrl=s);let r=this.getAttribute("name");null!==r&&(e.name=r||!0);let n=this.getAttribute("styles-url");if(null!==n){let t=this.getAttribute("styles-integrity");e.styles=t?{url:n,integrity:t}:{url:n}}let o=Pe.hatch(e);if(this.#t=o,await o.ready,t!==this.#o||!this.isConnected){o.destroy();return}this.#a[1](o)}catch(e){if(t!==this.#o)return;this.#t?.destroy(),this.#t=void 0,this.#a[2](e)}}}t.define(Ie,s),It=s}catch{Mt(Ie)}})()})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
sha384-iJtnL5uLVg+cNs8qk9f4hwjOyplSaORCqdss7xunkEfv9w1j5rUCkFqBcK1WslGW
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { type Plan, type JsonValue, type PlanCapability, type PlanChannel, type PlanCondition, type PlanDisposition, type PlanEffect, type PlanInterruptLifetime, type PlanMotionEffect, type PlanSurfaceOrdering } from "./types.js";
|
|
2
|
+
export interface PlanCompileContext {
|
|
3
|
+
states?: ReadonlySet<string>;
|
|
4
|
+
capabilities?: ReadonlySet<PlanCapability>;
|
|
5
|
+
contentIds?: ReadonlySet<string>;
|
|
6
|
+
validateSelector?: (selector: string) => boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface CompiledPlanStateSelection {
|
|
9
|
+
readonly kind: "state" | "capability";
|
|
10
|
+
readonly name: string;
|
|
11
|
+
}
|
|
12
|
+
export interface CompiledPlanSurface {
|
|
13
|
+
readonly id: string;
|
|
14
|
+
readonly channel: `surface:${string}`;
|
|
15
|
+
readonly contentId: string;
|
|
16
|
+
readonly dataSource?: "event-payload";
|
|
17
|
+
readonly disposition?: PlanDisposition;
|
|
18
|
+
readonly ordering?: Readonly<PlanSurfaceOrdering>;
|
|
19
|
+
readonly data?: JsonValue;
|
|
20
|
+
}
|
|
21
|
+
export interface CompiledPlanEffect {
|
|
22
|
+
readonly channels: readonly PlanChannel[];
|
|
23
|
+
readonly state?: Readonly<CompiledPlanStateSelection>;
|
|
24
|
+
readonly motion?: Readonly<PlanMotionEffect>;
|
|
25
|
+
readonly surfaces: readonly CompiledPlanSurface[];
|
|
26
|
+
readonly until?: Readonly<PlanInterruptLifetime>;
|
|
27
|
+
}
|
|
28
|
+
export interface CompiledPlanRule {
|
|
29
|
+
readonly id: string;
|
|
30
|
+
readonly when: Readonly<PlanCondition>;
|
|
31
|
+
readonly effect: Readonly<CompiledPlanEffect>;
|
|
32
|
+
}
|
|
33
|
+
export interface CompiledPlan {
|
|
34
|
+
readonly baseline: Readonly<CompiledPlanEffect>;
|
|
35
|
+
readonly rules: readonly Readonly<CompiledPlanRule>[];
|
|
36
|
+
}
|
|
37
|
+
export interface PlanEventState {
|
|
38
|
+
readonly ordering: Map<string, number | true>;
|
|
39
|
+
readonly sessions: Map<string, string[]>;
|
|
40
|
+
}
|
|
41
|
+
export interface PlanEventInput {
|
|
42
|
+
source: "browser" | "application";
|
|
43
|
+
name: string;
|
|
44
|
+
payload?: unknown;
|
|
45
|
+
}
|
|
46
|
+
export interface PlanEventEvaluation {
|
|
47
|
+
readonly status: "matched" | "unmatched" | "stale" | "closed" | "invalid";
|
|
48
|
+
readonly rules: readonly Readonly<CompiledPlanRule>[];
|
|
49
|
+
readonly effects: readonly Readonly<CompiledPlanEffect>[];
|
|
50
|
+
readonly rejectedSurfaces: readonly Readonly<PlanEventSurfaceRejection>[];
|
|
51
|
+
}
|
|
52
|
+
export interface PlanEventSurfaceRejection {
|
|
53
|
+
readonly channel: CompiledPlanSurface["channel"];
|
|
54
|
+
readonly status: "stale" | "closed" | "invalid";
|
|
55
|
+
}
|
|
56
|
+
export interface PlanCompileDiagnostic {
|
|
57
|
+
readonly code: string;
|
|
58
|
+
readonly path: string;
|
|
59
|
+
readonly message: string;
|
|
60
|
+
}
|
|
61
|
+
export type PlanPreflightResult = {
|
|
62
|
+
readonly valid: true;
|
|
63
|
+
readonly plan: CompiledPlan;
|
|
64
|
+
readonly errors: readonly [];
|
|
65
|
+
} | {
|
|
66
|
+
readonly valid: false;
|
|
67
|
+
readonly plan: undefined;
|
|
68
|
+
readonly errors: readonly Readonly<PlanCompileDiagnostic>[];
|
|
69
|
+
};
|
|
70
|
+
export declare class PlanCompileError extends TypeError {
|
|
71
|
+
readonly code: string;
|
|
72
|
+
readonly path: string;
|
|
73
|
+
constructor(code: string, path: string, message: string);
|
|
74
|
+
}
|
|
75
|
+
export declare function compilePlan(input: Plan, context?: PlanCompileContext): CompiledPlan;
|
|
76
|
+
/** Compile one temporary Effect without creating a second Plan evaluator. */
|
|
77
|
+
export declare function compileOverrideEffect(input: PlanEffect, context?: PlanCompileContext): CompiledPlanEffect;
|
|
78
|
+
export declare function preflightPlan(input: Plan, context?: PlanCompileContext): PlanPreflightResult;
|
|
79
|
+
export declare function createPlanEventState(): PlanEventState;
|
|
80
|
+
export declare function evaluatePlanEvent(plan: CompiledPlan, state: PlanEventState, input: PlanEventInput): PlanEventEvaluation;
|
|
81
|
+
export declare function selectCompiledEffectChannels(effect: CompiledPlanEffect, channels: readonly PlanChannel[]): CompiledPlanEffect | undefined;
|
|
82
|
+
//# sourceMappingURL=plan-compiler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-compiler.d.ts","sourceRoot":"","sources":["../src/plan-compiler.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,IAAI,EACT,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EAIrB,KAAK,mBAAmB,EACzB,MAAM,YAAY,CAAC;AAepB,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7B,YAAY,CAAC,EAAE,WAAW,CAAC,cAAc,CAAC,CAAC;IAC3C,UAAU,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACjC,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;CAClD;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,YAAY,CAAC;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,WAAW,MAAM,EAAE,CAAC;IACtC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,CAAC,EAAE,eAAe,CAAC;IACtC,QAAQ,CAAC,WAAW,CAAC,EAAE,eAAe,CAAC;IACvC,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAAC;IAClD,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC;CAC3B;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,SAAS,WAAW,EAAE,CAAC;IAC1C,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,0BAA0B,CAAC,CAAC;IACtD,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAAC;IAC7C,QAAQ,CAAC,QAAQ,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAClD,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,qBAAqB,CAAC,CAAC;CAClD;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,kBAAkB,CAAC,CAAC;CAC/C;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,kBAAkB,CAAC,CAAC;IAChD,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC;CACvD;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;IAC9C,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CAC1C;AAMD,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,SAAS,GAAG,aAAa,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;IAC1E,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC;IACtD,QAAQ,CAAC,OAAO,EAAE,SAAS,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC;IAC1D,QAAQ,CAAC,gBAAgB,EAAE,SAAS,QAAQ,CAAC,yBAAyB,CAAC,EAAE,CAAC;CAC3E;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;IACjD,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;CACjD;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,MAAM,mBAAmB,GAC3B;IACE,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC;CAC9B,GACD;IACE,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,SAAS,QAAQ,CAAC,qBAAqB,CAAC,EAAE,CAAC;CAC7D,CAAC;AAEN,qBAAa,gBAAiB,SAAQ,SAAS;IAC7C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,YAAY,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAKtD;CACF;AAED,wBAAgB,WAAW,CACzB,KAAK,EAAE,IAAI,EACX,OAAO,GAAE,kBAAuB,GAC/B,YAAY,CAkGd;AAED,6EAA6E;AAC7E,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,UAAU,EACjB,OAAO,GAAE,kBAAuB,GAC/B,kBAAkB,CA2BpB;AAED,wBAAgB,aAAa,CAC3B,KAAK,EAAE,IAAI,EACX,OAAO,GAAE,kBAAuB,GAC/B,mBAAmB,CAgCrB;AAED,wBAAgB,oBAAoB,IAAI,cAAc,CAKrD;AAED,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,cAAc,EACrB,KAAK,EAAE,cAAc,GACpB,mBAAmB,CA2FrB;AAksBD,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,kBAAkB,EAC1B,QAAQ,EAAE,SAAS,WAAW,EAAE,GAC/B,kBAAkB,GAAG,SAAS,CAiBhC"}
|