OctoSpaccHub/static/MatrixStickerHelper/tgs-player.js

55 lines
378 KiB
JavaScript
Raw Normal View History

2024-01-08 22:15:40 +01:00
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["lottie-player"]={})}(this,(function(exports){"use strict";function ownKeys(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,r)}return i}function _objectSpread2(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(i),!0).forEach((function(e){_defineProperty(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):ownKeys(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function asyncGeneratorStep(t,e,i,r,a,s,n){try{var o=t[s](n),h=o.value}catch(t){return void i(t)}o.done?e(h):Promise.resolve(h).then(r,a)}function _asyncToGenerator(t){return function(){var e=this,i=arguments;return new Promise((function(r,a){var s=t.apply(e,i);function n(t){asyncGeneratorStep(s,r,a,n,o,"next",t)}function o(t){asyncGeneratorStep(s,r,a,n,o,"throw",t)}n(void 0)}))}}function _defineProperty(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function _taggedTemplateLiteral(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */function __decorate(t,e,i,r){var a,s=arguments.length,n=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(n=(s<3?a(n):s>3?a(e,i,n):a(e,i))||n);return s>3&&n&&Object.defineProperty(e,i,n),n
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/}var n$5=t=>e=>"function"==typeof e?((t,e)=>(window.customElements.define(t,e),e))(t,e):((t,e)=>{var{kind:i,elements:r}=e;return{kind:i,elements:r,finisher(e){window.customElements.define(t,e)}}})(t,e)
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/,i$3=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?_objectSpread2(_objectSpread2({},e),{},{finisher(i){i.createProperty(e.key,t)}}):{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(i){i.createProperty(e.key,t)}};function e$3(t){return(e,i)=>void 0!==i?((t,e,i)=>{e.constructor.createProperty(i,t)})(t,e,i):i$3(t,e)}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/var o$4=t=>{var{finisher:e,descriptor:i}=t;return(t,r)=>{var a;if(void 0===r){var s=null!==(a=t.originalKey)&&void 0!==a?a:t.key,n=null!=i?{kind:"method",placement:"prototype",key:s,descriptor:i(t.key)}:_objectSpread2(_objectSpread2({},t),{},{key:s});return null!=e&&(n.finisher=function(t){e(t,s)}),n}var o=t.constructor;void 0!==i&&Object.defineProperty(t,r,i(r)),null==e||e(o,r)}},n$4;
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/function i$2(t,e){return o$4({descriptor:i=>{var r={get(){var e,i;return null!==(i=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelector(t))&&void 0!==i?i:null},enumerable:!0,configurable:!0};if(e){var a="symbol"==typeof i?Symbol():"__"+i;r.get=function(){var e,i;return void 0===this[a]&&(this[a]=null!==(i=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelector(t))&&void 0!==i?i:null),this[a]}}return r}})}
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/null===(n$4=window.HTMLSlotElement)||void 0===n$4||n$4.prototype.assignedElements;
/*! pako 2.0.4 https://github.com/nodeca/pako @license (MIT AND Zlib) */
var Z_FIXED$1=4,Z_BINARY=0,Z_TEXT=1,Z_UNKNOWN$1=2;function zero$1(t){for(var e=t.length;--e>=0;)t[e]=0}var STORED_BLOCK=0,STATIC_TREES=1,DYN_TREES=2,MIN_MATCH$1=3,MAX_MATCH$1=258,LENGTH_CODES$1=29,LITERALS$1=256,L_CODES$1=LITERALS$1+1+LENGTH_CODES$1,D_CODES$1=30,BL_CODES$1=19,HEAP_SIZE$1=2*L_CODES$1+1,MAX_BITS$1=15,Buf_size=16,MAX_BL_BITS=7,END_BLOCK=256,REP_3_6=16,REPZ_3_10=17,REPZ_11_138=18,extra_lbits=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),extra_dbits=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),extra_blbits=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),bl_order=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),DIST_CODE_LEN=512,static_ltree=new Array(2*(L_CODES$1+2));zero$1(static_ltree);var static_dtree=new Array(2*D_CODES$1);zero$1(static_dtree);var _dist_code=new Array(DIST_CODE_LEN);zero$1(_dist_code);var _length_code=new Array(MAX_MATCH$1-MIN_MATCH$1+1);zero$1(_length_code);var base_length=new Array(LENGTH_CODES$1);zero$1(base_length);var base_dist=new Array(D_CODES$1),static_l_desc,static_d_desc,static_bl_desc;function StaticTreeDesc(t,e,i,r,a){this.static_tree=t,this.extra_bits=e,this.extra_base=i,this.elems=r,this.max_length=a,this.has_stree=t&&t.length}function TreeDesc(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}zero$1(base_dist);var d_code=t=>t<256?_dist_code[t]:_dist_code[256+(t>>>7)],put_short=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},send_bits=(t,e,i)=>{t.bi_valid>Buf_size-i?(t.bi_buf|=e<<t.bi_valid&65535,put_short(t,t.bi_buf),t.bi_buf=e>>Buf_size-t.bi_valid,t.bi_valid+=i-Buf_size):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=i)},send_code=(t,e,i)=>{send_bits(t,i[2*e],i[2*e+1])},bi_reverse=(t,e)=>{var i=0;do{i|=1&t,t>>>=1,i<<=1}while(--e>0);return i>>>1},bi_flush=t=>{16===t.bi_valid?(put_short(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)},gen_bitlen=(t,e)=>{var i,r,a,s,n,o,h=e.dyn_tree,l=e.max_code,p=e.stat_desc.static_tree,f=e.stat_desc.has_stree,d=e.stat_desc.extra_bits,c=e.stat_desc.extra_base,m=e.stat_desc.max_length,u=0;for(s=0;s<=MAX_BITS$1;s++)t.bl_count[s]=0;for(h[2*t.heap[t.heap_max]+1]=0,i=t.heap_max+1;i<HEAP_SIZE$1;i++)(s=h[2*h[2*(r=t.heap[i])+1]+1]+1)>m&&(s=m,u++),h[2*r+1]=s,r>l||(t.bl_count[s]++,n=0,r>=c&&(n=d[r-c]),o=h[2*r],t.opt_len+=o*(s+n),f&&(t.static_len+=o*(p[2*r+1]+n)));if(0!==u){do{for(s=m-1;0===t.bl_count[s];)s--;t.bl_count[s]--,t.bl_count[s+1]+=2,t.bl_count[m]--,u-=2}while(u>0);for(s=m;0!==s;s--)for(r=t.bl_count[s];0!==r;)(a=t.heap[--i])>l||(h[2*a+1]!==s&&(t.opt_len+=(s-h[2*a+1])*h[2*a],h[2*a+1]=s),r--)}},gen_codes=(t,e,i)=>{var r,a,s=new Array(MAX_BITS$1+1),n=0;for(r=1;r<=MAX_BITS$1;r++)s[r]=n=n+i[r-1]<<1;for(a=0;a<=e;a++){var o=t[2*a+1];0!==o&&(t[2*a]=bi_reverse(s[o]++,o))}},tr_static_init=()=>{var t,e,i,r,a,s=new Array(MAX_BITS$1+1);for(i=0,r=0;r<LENGTH_CODES$1-1;r++)for(base_length[r]=i,t=0;t<1<<extra_lbits[r];t++)_length_code[i++]=r;for(_length_code[i-1]=r,a=0,r=0;r<16;r++)for(base_dist[r]=a,t=0;t<1<<extra_dbits[r];t++)_dist_code[a++]=r;for(a>>=7;r<D_CODES$1;r++)for(base_dist[r]=a<<7,t=0;t<1<<extra_dbits[r]-7;t++)_dist_code[256+a++]=r;for(e=0;e<=MAX_BITS$1;e++)s[e]=0;for(t=0;t<=143;)static_ltree[2*t+1]=8,t++,s[8]++;for(;t<=255;)static_ltree[2*t+1]=9,t++,s[9]++;for(;t<=279;)static_ltree[2*t+1]=7,t++,s[7]++;for(;t<=287;)static_ltree[2*t+1]=8,t++,s[8]++;for(gen_codes(static_ltree,L_CODES$1+1,s),t=0;t<D_CODES$1;t++)static_dtree[2*t+1]=5,static_dtree[2*t]=bi_reverse(t,5);static_l_desc=new StaticTreeDesc(static_ltree,extra_lbits,LITERALS$1+1,L_CODES$1,MAX_BITS$1),static_d_desc=new StaticTreeDesc(static_dtree,extra_dbits,0,D_CODES$1,MAX_BITS$1),static_bl_desc=new StaticTreeDesc(new Array(0),extra_blbits,0,BL_CODES$1,MAX_BL_BITS)},init_block=t=>{var e;for(e=0;e<L_CODES$1;e++)t.dyn_ltree[2*e]=0;for(e=0;e<D_CODES$1;e++)t.dyn_dtree[2*e]=0;for(e=0;e<BL_CODES$1;e++)t.bl_tree[2*e]=0;t.dyn_ltree[2*END_BLOCK]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0},bi_windup=
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/,s$2,e$1=window.trustedTypes,r$1=e$1?e$1.emptyScript:"",h$1=window.reactiveElementPolyfillSupport,o$2={toAttribute(t,e){switch(e){case Boolean:t=t?r$1:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){var i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},n$2=(t,e)=>e!==t&&(e==e||t==t),l$2={attribute:!0,type:String,converter:o$2,reflect:!1,hasChanged:n$2},t;class a$1 extends HTMLElement{constructor(){super(),this._$Et=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Ei=null,this.o()}static addInitializer(t){var e;null!==(e=this.l)&&void 0!==e||(this.l=[]),this.l.push(t)}static get observedAttributes(){this.finalize();var t=[];return this.elementProperties.forEach(((e,i)=>{var r=this._$Eh(i,e);void 0!==r&&(this._$Eu.set(r,i),t.push(r))})),t}static createProperty(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l$2;if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){var i="symbol"==typeof t?Symbol():"__"+t,r=this.getPropertyDescriptor(t,i,e);void 0!==r&&Object.defineProperty(this.prototype,t,r)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(r){var a=this[t];this[e]=r,this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||l$2}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;var t=Object.getPrototypeOf(this);if(t.finalize(),this.elementProperties=new Map(t.elementProperties),this._$Eu=new Map,this.hasOwnProperty("properties")){var e=this.properties,i=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(var r of i)this.createProperty(r,e[r])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){var e=[];if(Array.isArray(t)){var i=new Set(t.flat(1/0).reverse());for(var r of i)e.unshift(S$1(r))}else void 0!==t&&e.push(S$1(t));return e}static _$Eh(t,e){var i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}o(){var t;this._$Ep=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Em(),this.requestUpdate(),null===(t=this.constructor.l)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$Eg)&&void 0!==e?e:this._$Eg=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$Eg)||void 0===e||e.splice(this._$Eg.indexOf(t)>>>0,1)}_$Em(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Et.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t,e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return i$1(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ES(t,e){var i,r,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l$2,s=this.constructor._$Eh(t,a);if(void 0!==s&&!0===a.reflect){var n=(null!==(r=null===(i=a.converter)||void 0===i?void 0:i.toAttribute)&&void 0!==r?r:o$2.toAttribute)(e,a.type);this._$Ei=t,null==n?this.removeAttribute(s):this.setAttribute(s,n),this._$Ei=null}}_$AK(t,e){var i,r,a,s=this.constructor,n=s._$Eu.get(t);if(void 0!==n&&this._$Ei!==n){var o=s.getPropertyOptions(n),h=o.converter,l=null!==(a=null!==(r=null===(i=h)||void 0===i?void 0:i.fromAttribute)&&void 0!==r?r:"function"==typeof h?h:null)&&void 0!==a?a:o$2.fromAttribute;this._$Ei=n,this[n]=l(e,o.type),this._$Ei=null}}requestUpdate(t,e,
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
console.warn("The main 'lit-element' module entrypoint is deprecated. Please update your imports to use the 'lit' package: 'lit' and 'lit/decorators.ts' or import from 'lit-element/lit-element.ts'. See https://lit.dev/msg/deprecated-import-path for more information.");var styles=r$2(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n ","\n\n :host {\n width: 512px;\n height: 512px;\n }\n"])),styles$1);function fetchPath(t){return _fetchPath.apply(this,arguments)}function _fetchPath(){return _fetchPath=_asyncToGenerator((function*(t){return new Promise(((e,i)=>{var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer",r.send(),r.onreadystatechange=function(){if(4==r.readyState&&200==r.status)try{var t=String.fromCharCode.apply(null,new Uint8Array(r.response));return e(JSON.parse(t))}catch(t){try{var a=inflate_1(r.response,{to:"string"});return e(JSON.parse(a))}catch(t){return i(t)}}}}))})),_fetchPath.apply(this,arguments)}exports.TGSPlayer=class extends LottiePlayer{constructor(){super(...arguments),this.strict=!0}load(t){var e=()=>super.load,i=this;return _asyncToGenerator((function*(){var r=parseSrc(t);if("path"===("string"==typeof r?"path":"animationData")&&(r=yield fetchPath(r)),!0===i.strict){var a=i.formatCheck(r);0!==a.length&&i.dispatchEvent(new CustomEvent(PlayerEvents.Error,{detail:a}))}return delete r.tgs,e().call(i,r)}))()}static get styles(){return styles}formatCheck(t){var e=[];return"tgs"in t&&1===t.tgs||e.push("Must be marked as a TGS Lottie variant"),(t.op-t.ip)/t.fr>3&&e.push("Longer than 3 seconds"),512==t.w&&512==t.h||e.push("Dimensions should be exactly 512pxx512px"),null!=t.ddd&&0!=t.ddd&&e.push("Must not have 3D layers"),"markers"in t&&e.push("Must not have markers"),null!=t.assets&&t.assets.forEach((t=>{e.concat(this.checkLayer(t.layers))})),t.layers.forEach((t=>{e.concat(this.checkLayer(t))})),e}checkLayer(t){var e=[];return null!=t.ddd&&0!=t.ddd&&e.push("Composition should not include any 3D Layers"),null!=t.sr&&1!=t.sr&&e.push("Composition should not include any Time Stretching"),null!=t.tm&&e.push("Composition should not include any Time Remapping"),1===t.ty&&e.push("Composition should not include any Solids"),2===t.ty&&e.push("Composition should not include any Images"),5===t.ty&&e.push("Composition should not include any Texts"),!0!==t.hasMask&&null==t.masksProperties||e.push("Composition should not include any Masks"),null!=t.tt&&e.push("Composition should not include any Mattes"),1===t.ao&&e.push("Composition should not include any Auto-Oriented Layers"),null!=t.ef&&e.push("Composition should not include any Layer Effects"),e.concat(this.checkItems(t.shapes,!0)),e}checkItems(t,e){var i=[];return null!=t&&t.forEach((t=>{"rp"==t.ty&&i.push("Composition should not include any Repeaters"),"sr"==t.ty&&i.push("Composition should not include any Star Shapes"),"mm"==t.ty&&i.push("Composition should not include any Merge Paths"),"gs"==t.ty&&i.push("Composition should not include any Gradient Strokes"),!0===e&&i.concat(this.checkItems(t.it,!1))})),i}},__decorate([e$3({type:Boolean})],exports.TGSPlayer.prototype,"strict",void 0),exports.TGSPlayer=__decorate([n$5("tgs-player")],exports.TGSPlayer),Object.defineProperty(exports,"__esModule",{value:!0})}));
//# sourceMappingURL=tgs-player.js.map