brandfolder-8.x-1.x-dev/js/brandfolder-browser/dist/brandfolder-browser-bundled.js

js/brandfolder-browser/dist/brandfolder-browser-bundled.js
/*! *****************************************************************************
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 t(t,e,s,i){for(var r,o=arguments.length,n=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i,a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,s,n):r(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n
/**
 * @license
 * Copyright 2019 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */}const e=globalThis,s=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),r=new WeakMap;class o{constructor(t,e,s){if(this._$cssResult$=!0,s!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(s&&void 0===t){const s=void 0!==e&&1===e.length;s&&(t=r.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&r.set(e,t))}return t}toString(){return this.cssText}}const n=(t,...e)=>{const s=1===t.length?t[0]:e.reduce(((e,s,i)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[i+1]),t[0]);return new o(s,t,i)},a=s?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return(t=>new o("string"==typeof t?t:t+"",void 0,i))(e)})(t):t
/**
 * @license
 * Copyright 2017 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */,{is:l,defineProperty:c,getOwnPropertyDescriptor:h,getOwnPropertyNames:d,getOwnPropertySymbols:p,getPrototypeOf:u}=Object,b=globalThis,m=b.trustedTypes,_=m?m.emptyScript:"",f=b.reactiveElementPolyfillSupport,g=(t,e)=>t,y={toAttribute(t,e){switch(e){case Boolean:t=t?_:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},v=(t,e)=>!l(t,e),$={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:v};Symbol.metadata??=Symbol("metadata"),b.litPropertyMetadata??=new WeakMap;class w extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=$){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(t,s,e);void 0!==i&&c(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){const{get:i,set:r}=h(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get(){return i?.call(this)},set(e){const o=i?.call(this);r.call(this,e),this.requestUpdate(t,o,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??$}static _$Ei(){if(this.hasOwnProperty(g("elementProperties")))return;const t=u(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(g("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(g("properties"))){const t=this.properties,e=[...d(t),...p(t)];for(const s of e)this.createProperty(s,t[s])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,s]of e)this.elementProperties.set(t,s)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const s=this._$Eu(t,e);void 0!==s&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)e.unshift(a(t))}else void 0!==t&&e.push(a(t));return e}static _$Eu(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,i)=>{if(s)t.adoptedStyleSheets=i.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const s of i){const i=document.createElement("style"),r=e.litNonce;void 0!==r&&i.setAttribute("nonce",r),i.textContent=s.cssText,t.appendChild(i)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$EC(t,e){const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(void 0!==i&&!0===s.reflect){const r=(void 0!==s.converter?.toAttribute?s.converter:y).toAttribute(e,s.type);this._$Em=t,null==r?this.removeAttribute(i):this.setAttribute(i,r),this._$Em=null}}_$AK(t,e){const s=this.constructor,i=s._$Eh.get(t);if(void 0!==i&&this._$Em!==i){const t=s.getPropertyOptions(i),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:y;this._$Em=i,this[i]=r.fromAttribute(e,t.type),this._$Em=null}}requestUpdate(t,e,s){if(void 0!==t){if(s??=this.constructor.getPropertyOptions(t),!(s.hasChanged??v)(this[t],e))return;this.P(t,e,s)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(t,e,s){this._$AL.has(t)||this._$AL.set(t,e),!0===s.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,s]of t)!0!==s.wrapped||this._$AL.has(e)||void 0===this[e]||this.P(e,this[e],s)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EU()}catch(e){throw t=!1,this._$EU(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EC(t,this[t]))),this._$EU()}updated(t){}firstUpdated(t){}}w.elementStyles=[],w.shadowRootOptions={mode:"open"},w[g("elementProperties")]=new Map,w[g("finalized")]=new Map,f?.({ReactiveElement:w}),(b.reactiveElementVersions??=[]).push("2.0.4");
/**
 * @license
 * Copyright 2017 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */
const x=globalThis,S=x.trustedTypes,A=S?S.createPolicy("lit-html",{createHTML:t=>t}):void 0,C="$lit$",E=`lit$${Math.random().toFixed(9).slice(2)}$`,k="?"+E,I=`<${k}>`,U=document,O=()=>U.createComment(""),P=t=>null===t||"object"!=typeof t&&"function"!=typeof t,T=Array.isArray,H="[ \t\n\f\r]",D=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,j=/-->/g,M=/>/g,z=RegExp(`>|${H}(?:([^\\s"'>=/]+)(${H}*=${H}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),L=/'/g,N=/"/g,R=/^(?:script|style|textarea|title)$/i,B=(t=>(e,...s)=>({_$litType$:t,strings:e,values:s}))(1),F=Symbol.for("lit-noChange"),q=Symbol.for("lit-nothing"),K=new WeakMap,V=U.createTreeWalker(U,129);function W(t,e){if(!T(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==A?A.createHTML(e):e}const J=(t,e)=>{const s=t.length-1,i=[];let r,o=2===e?"<svg>":3===e?"<math>":"",n=D;for(let e=0;e<s;e++){const s=t[e];let a,l,c=-1,h=0;for(;h<s.length&&(n.lastIndex=h,l=n.exec(s),null!==l);)h=n.lastIndex,n===D?"!--"===l[1]?n=j:void 0!==l[1]?n=M:void 0!==l[2]?(R.test(l[2])&&(r=RegExp("</"+l[2],"g")),n=z):void 0!==l[3]&&(n=z):n===z?">"===l[0]?(n=r??D,c=-1):void 0===l[1]?c=-2:(c=n.lastIndex-l[2].length,a=l[1],n=void 0===l[3]?z:'"'===l[3]?N:L):n===N||n===L?n=z:n===j||n===M?n=D:(n=z,r=void 0);const d=n===z&&t[e+1].startsWith("/>")?" ":"";o+=n===D?s+I:c>=0?(i.push(a),s.slice(0,c)+C+s.slice(c)+E+d):s+E+(-2===c?e:d)}return[W(t,o+(t[s]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),i]};class Y{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let r=0,o=0;const n=t.length-1,a=this.parts,[l,c]=J(t,e);if(this.el=Y.createElement(l,s),V.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(i=V.nextNode())&&a.length<n;){if(1===i.nodeType){if(i.hasAttributes())for(const t of i.getAttributeNames())if(t.endsWith(C)){const e=c[o++],s=i.getAttribute(t).split(E),n=/([.?@])?(.*)/.exec(e);a.push({type:1,index:r,name:n[2],strings:s,ctor:"."===n[1]?tt:"?"===n[1]?et:"@"===n[1]?st:Q}),i.removeAttribute(t)}else t.startsWith(E)&&(a.push({type:6,index:r}),i.removeAttribute(t));if(R.test(i.tagName)){const t=i.textContent.split(E),e=t.length-1;if(e>0){i.textContent=S?S.emptyScript:"";for(let s=0;s<e;s++)i.append(t[s],O()),V.nextNode(),a.push({type:2,index:++r});i.append(t[e],O())}}}else if(8===i.nodeType)if(i.data===k)a.push({type:2,index:r});else{let t=-1;for(;-1!==(t=i.data.indexOf(E,t+1));)a.push({type:7,index:r}),t+=E.length-1}r++}}static createElement(t,e){const s=U.createElement("template");return s.innerHTML=t,s}}function Z(t,e,s=t,i){if(e===F)return e;let r=void 0!==i?s._$Co?.[i]:s._$Cl;const o=P(e)?void 0:e._$litDirective$;return r?.constructor!==o&&(r?._$AO?.(!1),void 0===o?r=void 0:(r=new o(t),r._$AT(t,s,i)),void 0!==i?(s._$Co??=[])[i]=r:s._$Cl=r),void 0!==r&&(e=Z(t,r._$AS(t,e.values),r,i)),e}class G{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,i=(t?.creationScope??U).importNode(e,!0);V.currentNode=i;let r=V.nextNode(),o=0,n=0,a=s[0];for(;void 0!==a;){if(o===a.index){let e;2===a.type?e=new X(r,r.nextSibling,this,t):1===a.type?e=new a.ctor(r,a.name,a.strings,this,t):6===a.type&&(e=new it(r,this,t)),this._$AV.push(e),a=s[++n]}o!==a?.index&&(r=V.nextNode(),o++)}return V.currentNode=U,i}p(t){let e=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class X{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,i){this.type=2,this._$AH=q,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Z(this,t,e),P(t)?t===q||null==t||""===t?(this._$AH!==q&&this._$AR(),this._$AH=q):t!==this._$AH&&t!==F&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>T(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==q&&P(this._$AH)?this._$AA.nextSibling.data=t:this.T(U.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:s}=t,i="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=Y.createElement(W(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(e);else{const t=new G(i,this),s=t.u(this.options);t.p(e),this.T(s),this._$AH=t}}_$AC(t){let e=K.get(t.strings);return void 0===e&&K.set(t.strings,e=new Y(t)),e}k(t){T(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,i=0;for(const r of t)i===e.length?e.push(s=new X(this.O(O()),this.O(O()),this,this.options)):s=e[i],s._$AI(r),i++;i<e.length&&(this._$AR(s&&s._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class Q{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,r){this.type=1,this._$AH=q,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=r,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=q}_$AI(t,e=this,s,i){const r=this.strings;let o=!1;if(void 0===r)t=Z(this,t,e,0),o=!P(t)||t!==this._$AH&&t!==F,o&&(this._$AH=t);else{const i=t;let n,a;for(t=r[0],n=0;n<r.length-1;n++)a=Z(this,i[s+n],e,n),a===F&&(a=this._$AH[n]),o||=!P(a)||a!==this._$AH[n],a===q?t=q:t!==q&&(t+=(a??"")+r[n+1]),this._$AH[n]=a}o&&!i&&this.j(t)}j(t){t===q?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class tt extends Q{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===q?void 0:t}}class et extends Q{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==q)}}class st extends Q{constructor(t,e,s,i,r){super(t,e,s,i,r),this.type=5}_$AI(t,e=this){if((t=Z(this,t,e,0)??q)===F)return;const s=this._$AH,i=t===q&&s!==q||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,r=t!==q&&(s===q||i);i&&this.element.removeEventListener(this.name,this,s),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class it{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){Z(this,t)}}const rt=x.litHtmlPolyfillSupport;rt?.(Y,X),(x.litHtmlVersions??=[]).push("3.2.1");
/**
 * @license
 * Copyright 2017 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */
class ot extends w{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,s)=>{const i=s?.renderBefore??e;let r=i._$litPart$;if(void 0===r){const t=s?.renderBefore??null;i._$litPart$=r=new X(e.insertBefore(O(),t),t,void 0,s??{})}return r._$AI(t),r})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return F}}ot._$litElement$=!0,ot.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:ot});const nt=globalThis.litElementPolyfillSupport;nt?.({LitElement:ot}),(globalThis.litElementVersions??=[]).push("4.1.1");
/**
 * @license
 * Copyright 2017 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */
const at=2,lt=3,ct=Symbol();class ht{get taskComplete(){return this.t||(1===this.i?this.t=new Promise(((t,e)=>{this.o=t,this.h=e})):3===this.i?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(t,e,s){this.p=0,this.i=0,(this._=t).addController(this);const i="object"==typeof e?e:{task:e,args:s};this.v=i.task,this.j=i.args,this.m=i.argsEqual??dt,this.k=i.onComplete,this.A=i.onError,this.autoRun=i.autoRun??!0,"initialValue"in i&&(this.u=i.initialValue,this.i=2,this.O=this.T?.())}hostUpdate(){!0===this.autoRun&&this.S()}hostUpdated(){"afterUpdate"===this.autoRun&&this.S()}T(){if(void 0===this.j)return;const t=this.j();if(!Array.isArray(t))throw Error("The args function must return an array");return t}async S(){const t=this.T(),e=this.O;this.O=t,t===e||void 0===t||void 0!==e&&this.m(e,t)||await this.run(t)}async run(t){let e,s;t??=this.T(),this.O=t,1===this.i?this.q?.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,"afterUpdate"===this.autoRun?queueMicrotask((()=>this._.requestUpdate())):this._.requestUpdate();const i=++this.p;this.q=new AbortController;let r=!1;try{e=await this.v(t,{signal:this.q.signal})}catch(t){r=!0,s=t}if(this.p===i){if(e===ct)this.i=0;else{if(!1===r){try{this.k?.(e)}catch{}this.i=2,this.o?.(e)}else{try{this.A?.(s)}catch{}this.i=3,this.h?.(s)}this.u=e,this.l=s}this._.requestUpdate()}}abort(t){1===this.i&&this.q?.abort(t)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(t){switch(this.i){case 0:return t.initial?.();case 1:return t.pending?.();case 2:return t.complete?.(this.value);case 3:return t.error?.(this.error);default:throw Error("Unexpected status: "+this.i)}}}const dt=(t,e)=>t===e||t.length===e.length&&t.every(((t,s)=>!v(t,e[s])))
/**
 * @license
 * Copyright 2021 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */;class pt extends Event{constructor(t,e,s){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.callback=e,this.subscribe=s??!1}}
/**
 * @license
 * Copyright 2021 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */
/**
 * @license
 * Copyright 2021 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */
class ut{constructor(t,e,s,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(t,e)=>{this.unsubscribe&&(this.unsubscribe!==e&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=t,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(t,e)),this.unsubscribe=e},this.host=t,void 0!==e.context){const t=e;this.context=t.context,this.callback=t.callback,this.subscribe=t.subscribe??!1}else this.context=e,this.callback=s,this.subscribe=i??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new pt(this.context,this.t,this.subscribe))}}
/**
 * @license
 * Copyright 2021 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */class bt{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){const s=e||!Object.is(t,this.o);this.o=t,s&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(const[t,{disposer:e}]of this.subscriptions)t(this.o,e)},void 0!==t&&(this.value=t)}addCallback(t,e,s){if(!s)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});const{disposer:i}=this.subscriptions.get(t);t(this.value,i)}clearCallbacks(){this.subscriptions.clear()}}
/**
 * @license
 * Copyright 2021 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */class mt extends Event{constructor(t){super("context-provider",{bubbles:!0,composed:!0}),this.context=t}}class _t extends bt{constructor(t,e,s){super(void 0!==e.context?e.initialValue:s),this.onContextRequest=t=>{const e=t.composedPath()[0];t.context===this.context&&e!==this.host&&(t.stopPropagation(),this.addCallback(t.callback,e,t.subscribe))},this.onProviderRequest=t=>{const e=t.composedPath()[0];if(t.context!==this.context||e===this.host)return;const s=new Set;for(const[t,{consumerHost:e}]of this.subscriptions)s.has(t)||(s.add(t),e.dispatchEvent(new pt(this.context,t,!0)));t.stopPropagation()},this.host=t,void 0!==e.context?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new mt(this.context))}}
/**
 * @license
 * Copyright 2017 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */
/**
 * @license
 * Copyright 2022 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */
function ft({context:t,subscribe:e}){return(s,i)=>{"object"==typeof i?i.addInitializer((function(){new ut(this,{context:t,callback:t=>{s.set.call(this,t)},subscribe:e})})):s.constructor.addInitializer((s=>{new ut(s,{context:t,callback:t=>{s[i]=t},subscribe:e})}))}}
/**
 * @license
 * Copyright 2017 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */const gt=t=>(e,s)=>{void 0!==s?s.addInitializer((()=>{customElements.define(t,e)})):customElements.define(t,e)}
/**
 * @license
 * Copyright 2017 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */,yt={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:v},vt=(t=yt,e,s)=>{const{kind:i,metadata:r}=s;let o=globalThis.litPropertyMetadata.get(r);if(void 0===o&&globalThis.litPropertyMetadata.set(r,o=new Map),o.set(s.name,t),"accessor"===i){const{name:i}=s;return{set(s){const r=e.get.call(this);e.set.call(this,s),this.requestUpdate(i,r,t)},init(e){return void 0!==e&&this.P(i,void 0,t),e}}}if("setter"===i){const{name:i}=s;return function(s){const r=this[i];e.call(this,s),this.requestUpdate(i,r,t)}}throw Error("Unsupported decorator location: "+i)};function $t(t){return(e,s)=>"object"==typeof s?vt(t,e,s):((t,e,s)=>{const i=e.hasOwnProperty(s);return e.constructor.createProperty(s,i?{...t,wrapped:!0}:t),i?Object.getOwnPropertyDescriptor(e,s):void 0})(t,e,s)
/**
 * @license
 * Copyright 2017 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */}function wt(t){return $t({...t,state:!0,attribute:!1})}
/**
 * @license
 * Copyright 2017 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */const xt=(t,e,s)=>(s.configurable=!0,s.enumerable=!0,s)
/**
 * @license
 * Copyright 2017 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */;function St(t,e){return(s,i,r)=>{const o=e=>e.renderRoot?.querySelector(t)??null;if(e){const{get:t,set:e}="object"==typeof i?s:r??(()=>{const t=Symbol();return{get(){return this[t]},set(e){this[t]=e}}})();return xt(0,0,{get(){let s=t.call(this);return void 0===s&&(s=o(this),(null!==s||this.hasUpdated)&&e.call(this,s)),s}})}return xt(0,0,{get(){return o(this)}})}}
/**
 * @license
 * Copyright 2017 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */let At;const Ct="brandfolder-browser";class Et extends ot{constructor(){super(...arguments),this.attachmentId=null,this.attachment=null,this.mimetype=null,this.extension=null,this.filename=null,this.size=null,this.width=null,this.height=null,this.thumbnailUrl=null,this.url=null,this.bfCdnUrlBase=null,this.cdnUrl=null,this.imageSrcUrl=null,this._isHovered=!1,this._isSelected=!1}willUpdate(t){if(t.has("attachment")&&this.attachment){this.attachmentId=this.attachment?.id,this.mimetype=this.attachment?.mimetype,this.extension=this.attachment?.extension,this.filename=this.attachment?.filename,this.size=this.attachment?.size,this.width=this.attachment?.width,this.height=this.attachment?.height,this.thumbnailUrl=this.attachment?.thumbnail_url,this.url=this.attachment?.url;let t=null;if(this.attachment?.cdn_url)t=this.attachment?.cdn_url;else if(this.bfCdnUrlBase){let e=this.url?this.url.replace(/^[^?]*\/([^/?]+)(\?.*)?$/,"$1"):null;e?.length||(e="attachment.jpg"),t=`${this.bfCdnUrlBase}/at/${this.attachmentId}/${e}`,this.attachment.cdn_url=t}if(t){this.cdnUrl=t.replace(/^([^?]*)(\?.*)?$/,"$1");let e=this.cdnUrl;this.mimetype&&this.mimetype.includes("svg")||this.extension&&this.extension.includes("svg")||e.match(/\.svg$/)||(e+="?width=480&auto=webp&quality=75"),this.imageSrcUrl=e}else this.imageSrcUrl=this.thumbnailUrl}this?.attachmentId&&this?.browserContext?.selectedAttachments&&(this._isSelected=!!this.browserContext.selectedAttachments[this.attachmentId])}_attachmentSelectionHandler(){this._isSelected=!this._isSelected;const t={detail:{attachmentId:this.attachmentId,attachment:this.attachment,isSelected:this._isSelected},bubbles:!0,composed:!0};this.dispatchEvent(new CustomEvent("bfAttachmentSelection",t))}}t([$t({type:String,attribute:"bf-attachment-id",reflect:!0})],Et.prototype,"attachmentId",void 0),t([$t({type:Object,attribute:!1})],Et.prototype,"attachment",void 0),t([$t({type:String,attribute:!1})],Et.prototype,"mimetype",void 0),t([$t({type:String,attribute:!1})],Et.prototype,"extension",void 0),t([$t({type:String,attribute:!1})],Et.prototype,"filename",void 0),t([$t({type:Number,attribute:!1})],Et.prototype,"size",void 0),t([$t({type:Number,attribute:!1})],Et.prototype,"width",void 0),t([$t({type:Number,attribute:!1})],Et.prototype,"height",void 0),t([$t({type:String,attribute:!1})],Et.prototype,"thumbnailUrl",void 0),t([$t({type:String,attribute:!1})],Et.prototype,"url",void 0),t([$t({type:String,attribute:!1})],Et.prototype,"bfCdnUrlBase",void 0),t([$t({type:String,attribute:!1})],Et.prototype,"cdnUrl",void 0),t([$t({type:String,attribute:!1})],Et.prototype,"imageSrcUrl",void 0),t([wt()],Et.prototype,"_isHovered",void 0),t([wt()],Et.prototype,"_isSelected",void 0),t([ft({context:Ct,subscribe:!0})],Et.prototype,"browserContext",void 0);class kt extends ot{constructor(){super(...arguments),this.assetId=null,this.asset=null,this.name=null,this.thumbnailUrl=null,this.description=null,this.cdnUrl=null,this.attachments=null,this.tags=null,this.labels=null,this.collections=null,this.creationDate=null,this.modificationDate=null,this.publicationDate=null,this.expirationDate=null,this.bfCdnUrlBase=null,this.imagePlaceholderUrl=null}willUpdate(t){if(t.has("asset")&&this.asset){this.assetId=this.asset.id,this.name=this.asset.attributes.name,this.thumbnailUrl=this.asset.attributes.thumbnail_url,this.description=this.asset.attributes.description,this.attachments=this.asset.attachments,this.creationDate=this.asset.attributes.created_at,this.modificationDate=this.asset.attributes.updated_at,this.publicationDate=this.asset.attributes.availability_start,this.expirationDate=this.asset.attributes.availability_end;const t=this.asset.attributes.cdn_url;if(this.cdnUrl=t,this.bfCdnUrlBase=t.replace(/^(.*)\/as\/.*$/,"$1"),t){this.cdnUrl=t.replace(/^([^?]*)(\?.*)?$/,"$1");let e=this.cdnUrl;e.match(/\.svg$/)||(e+="?width=200&height=150&fit=bounds&blur=12p&saturation=50&auto=webp&quality=80"),this.imagePlaceholderUrl=e}else this.imagePlaceholderUrl=this.thumbnailUrl}}}t([$t({type:String,attribute:"bf-asset-id"})],kt.prototype,"assetId",void 0),t([$t({type:Object,attribute:!1})],kt.prototype,"asset",void 0),t([$t({type:String,attribute:!1})],kt.prototype,"name",void 0),t([$t({type:String,attribute:!1})],kt.prototype,"thumbnailUrl",void 0),t([$t({type:String,attribute:!1})],kt.prototype,"description",void 0),t([$t({type:String,attribute:!1})],kt.prototype,"cdnUrl",void 0),t([$t({type:Array,attribute:!1})],kt.prototype,"attachments",void 0),t([$t({type:Array,attribute:!1})],kt.prototype,"tags",void 0),t([$t({type:Array,attribute:!1})],kt.prototype,"labels",void 0),t([$t({type:Object,attribute:!1})],kt.prototype,"collections",void 0),t([$t({type:String,attribute:!1})],kt.prototype,"creationDate",void 0),t([$t({type:String,attribute:!1})],kt.prototype,"modificationDate",void 0),t([$t({type:String,attribute:!1})],kt.prototype,"publicationDate",void 0),t([$t({type:String,attribute:!1})],kt.prototype,"expirationDate",void 0),t([$t({type:String,attribute:!1})],kt.prototype,"bfCdnUrlBase",void 0),t([$t({type:String,attribute:!1})],kt.prototype,"imagePlaceholderUrl",void 0);let It=class extends kt{constructor(){super(...arguments),this.isLink=!1,this.isActive=!1,this.displayFormat="default"}render(){return B`<div class="brandfolder-media-container__inner display-format--${this.displayFormat} ${this.isLink?"is-link":""} ${this.isActive?"is-active":""}"><slot name="media"></slot></div>`}};It.styles=n`.brandfolder-media-container__inner{width:100%;height:100%;min-height:5rem;padding:.5rem;box-sizing:border-box;overflow:hidden;display:flex;justify-content:center;align-items:center;background-image:conic-gradient(var(--color-gray-50) 90deg,var(--color-gray-200) 90deg 180deg,var(--color-gray-50) 180deg 270deg,var(--color-gray-200) 270deg);background-position:top left;background-size:1rem 1rem}.brandfolder-media-container__inner.display-format--large{min-height:12rem}.brandfolder-media-container__inner.display-format--mini{padding:0;min-height:3rem;height:6rem;width:6rem}.brandfolder-media-container__inner.is-link{cursor:pointer}.brandfolder-media-container__inner ::slotted(img){max-width:100%;height:auto;transition:scale .2s}.brandfolder-media-container__inner.display-format--mini ::slotted(img){width:100%;height:100%;object-fit:cover}.brandfolder-media-container__inner.is-active ::slotted(img),.brandfolder-media-container__inner.is-link:hover ::slotted(img){scale:1.1}`,t([$t({type:Boolean,attribute:!1})],It.prototype,"isLink",void 0),t([$t({type:Boolean,attribute:!1})],It.prototype,"isActive",void 0),t([$t({type:String,attribute:!1})],It.prototype,"displayFormat",void 0),It=t([gt("brandfolder-media-container")],It);let Ut=class extends Et{render(){const t=this?.filename??"";return B`<div class="bf-attachment__inner"><div class="bf-attachment__image-wrapper"><brandfolder-media-container .isActive="${this._isHovered}" .displayFormat="${"mini"}">${this?.imageSrcUrl?B`<img slot="media" class="bf-attachment__image" src="${this.imageSrcUrl}" alt="${t}">`:""}</brandfolder-media-container></div><div class="bf-attachment__content"><div class="attachment__deselection" @click="${this._attachmentSelectionHandler}">x</div><div class="bf-attachment__info"><div class="bf-attachment__name">${t}</div></div></div></div>`}};Ut.styles=n`.bf-attachment__inner{display:grid;grid-template:1fr auto/1fr}.bf-attachment__content,.bf-attachment__image-wrapper{grid-area:1/1/2/2}.bf-attachment__content{display:grid;grid-template:1.5rem auto/auto 1.5rem}.attachment__deselection{grid-area:1/2/2/3;padding:.25rem .25rem .5rem;background:var(--color-gray-900-trans);color:var(--color-white);transition:background .2s,font-size .2s;display:flex;justify-content:center;align-items:center;cursor:pointer;font-size:1rem}.attachment__deselection:hover{background:var(--color-gray-900);font-size:1.2rem}.bf-attachment__info{grid-area:2/1/3/3;opacity:0;transition:opacity .2s;font-weight:200;font-size:.7rem;font-style:italic;display:flex;flex-direction:column;justify-content:flex-end}.bf-attachment__content:hover .bf-attachment__info{opacity:1}.bf-attachment__name{background:var(--color-gray-900-trans);color:var(--color-white);padding:.1rem;max-width:var(--selection-item-size);overflow-wrap:break-word;box-sizing:border-box}`,Ut=t([gt("brandfolder-attachment-selection")],Ut);let Ot=class extends ot{constructor(){super(...arguments),this.isOpen=!0}_headerClickHandler(){if(Object.values(this.browserContext.selectedAttachments).length>0){const t=new Event("bfSelectionTrayToggle",{bubbles:!0,composed:!0});this.dispatchEvent(t)}}render(){const t=Object.values(this.browserContext.selectedAttachments),e=t.length,s=this.browserContext?.selectionLimit;return B`<div class="selection-tray__inner ${this.isOpen?"is-open":"is-closed"} ${e>0?"is-openable":"is-not-openable"}"><header class="selection-tray__header" @click="${this._headerClickHandler}"><span class="selection-tray__title">${e}${s?" of "+s:""} item${1==(s??e)?"":"s"} selected </span>${e>0?B`<span class="selection-tray__open-indicator"><svg class="open-indicator__icon ${this.isOpen?"open":"closed"}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 9"><path d="M15 1.57812L7.66667 7.57812"/><path d="M1 1.57812L7.66667 7.57813"/></svg></span>`:""}</header><ul class="selection-tray__attachments-list">${e>0?t.map((t=>B`<li class="selection-tray__attachment-item"><brandfolder-attachment-selection .attachment="${t}"></li>`)):""}</ul></div>`}};Ot.styles=n`:host{--selection-item-size:6rem}.selection-tray__inner{background:var(--color-gray-100)}.selection-tray__header{padding:.25rem;display:flex;gap:.5rem;transition:all .3s}.selection-tray__inner.is-openable .selection-tray__header:hover{cursor:pointer;background:var(--color-gray-200)}.selection-tray__open-indicator,.selection-tray__title{display:flex;align-items:center;justify-content:center;padding:.2rem}.selection-tray__title{font-size:.9rem;font-family:monospace;font-weight:400}.selection-tray__open-indicator{width:1.5rem;padding:0 .2rem}.open-indicator__icon{width:.9rem;transition:transform .3s;transform:scaleY(-1)}.open-indicator__icon path{stroke:var(--color-gray-800);stroke-width:1}.selection-tray__header:hover .open-indicator__icon path{stroke-width:1.5}.open-indicator__icon.open{transform:scaleY(1)}.selection-tray__attachments-list{list-style:none;padding:0 .5rem 0;margin:0;display:grid;grid-template-columns:repeat(auto-fill,var(--selection-item-size));gap:1rem;max-height:0;overflow:hidden;transition:max-height .3s,padding .3s}.selection-tray__inner.is-open .selection-tray__attachments-list{padding:.5rem;max-height:10rem;overflow:scroll}.selection-tray__attachment-item{height:var(--selection-item-size);overflow:hidden}`,t([ft({context:Ct,subscribe:!0})],Ot.prototype,"browserContext",void 0),t([$t({type:Boolean,attribute:!1})],Ot.prototype,"isOpen",void 0),Ot=t([gt("brandfolder-browser-selection-tray")],Ot);
/**
 * @license
 * Copyright 2017 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */
const Pt=1,Tt=2,Ht=3,Dt=4,jt=t=>(...e)=>({_$litDirective$:t,values:e});class Mt{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}
/**
 * @license
 * Copyright 2017 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */class zt extends Mt{constructor(t){if(super(t),this.it=q,t.type!==Tt)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===q||null==t)return this._t=void 0,this.it=t;if(t===F)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}}zt.directiveName="unsafeHTML",zt.resultType=1;const Lt=jt(zt);function Nt(t){return new Intl.DateTimeFormat("en-US",{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric"}).format(new Date(t))}
/**
 * @license
 * Copyright 2020 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */
const Rt={},Bt=jt(class extends Mt{constructor(t){if(super(t),t.type!==Ht&&t.type!==Pt&&t.type!==Dt)throw Error("The `live` directive is not allowed on child or event bindings");if(!(t=>void 0===t.strings)(t))throw Error("`live` bindings can only contain a single expression")}render(t){return t}update(t,[e]){if(e===F||e===q)return e;const s=t.element,i=t.name;if(t.type===Ht){if(e===s[i])return F}else if(t.type===Dt){if(!!e===s.hasAttribute(i))return F}else if(t.type===Pt&&s.getAttribute(i)===e+"")return F;return((t,e=Rt)=>{t._$AH=e;
/**
 * @license
 * Copyright 2020 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */})(t),e}});let Ft=class extends Et{render(){const t=!(!(this.browserContext?.selectionLimit&&Object.keys(this.browserContext.selectedAttachments).length>=this.browserContext.selectionLimit)||this._isSelected),e=this?.filename??"";return B`<div class="bf-attachment__inner"><div class="bf-attachment__image-wrapper"><brandfolder-media-container .isActive="${this._isHovered}"><img slot="media" class="bf-attachment__image" src="${this?.imageSrcUrl??"#"}" alt="${e}"></brandfolder-media-container></div><div class="bf-attachment__info"><div class="bf-attachment__name">${e}</div><div class="bf-attachment__metadata"><div class="bf-attachment__metadata-item">${this?.mimetype}</div><div class="bf-attachment__metadata-item">${this?.width} x ${this?.height}</div><div class="bf-attachment__metadata-item">${function(t){let e="";if(t){const s=["B","KB","MB","GB","TB"];let i=0,r=t;for(;r>=1024&&i<s.length-1;)r/=1024,i++;e=`${r.toFixed(1)} ${s[i]}`}return e}(this?.size)}</div></div></div><div class="attachment__selection"><div class="attachment__selection-status ${t?"disallowed":"allowed"}"><input id="attachment-selection--${this.attachmentId}" name="attachment-selection--${this.attachmentId}" type="checkbox" .checked="${Bt(this._isSelected)}" ?disabled="${t}" @change="${this._attachmentSelectionHandler}"> <label for="attachment-selection--${this.attachmentId}">Select this attachment</label></div></div></div>`}};Ft.styles=n`img{max-width:100%;height:auto;max-height:max(8rem,32vh)}.bf-attachment__info{padding:.25rem 0}.bf-attachment__name{font-weight:700;padding:.25rem}.bf-attachment__metadata{display:flex;flex-wrap:wrap;gap:.5rem;font-size:.75em}.bf-attachment__metadata-item{color:var(--color-gray-500);font-style:italic;padding:.25rem}.attachment__selection{margin:.5rem 0 .25rem}.attachment__selection-status{display:flex;align-items:center;justify-content:flex-start}.attachment__selection-status input,.attachment__selection-status label{cursor:pointer}.attachment__selection-status.disallowed input,.attachment__selection-status.disallowed label{cursor:not-allowed}.attachment__selection-status input{width:1.25rem;height:1.25rem}.attachment__selection-status label{padding:.5rem .25rem;font-style:italic;transition:color .2s;color:var(--color-gray-700)}.attachment__selection-status:hover label{color:var(--color-gray-900)}`,Ft=t([gt("brandfolder-attachment-detail")],Ft);let qt=class extends kt{constructor(){super(...arguments),this._dispatchCloseEvent=()=>{const t=new Event("bfAssetDetailClose",{bubbles:!0,composed:!0});this.dispatchEvent(t)}}render(){let t=this?.thumbnailUrl;if(this?.cdnUrl){t=this.cdnUrl.replace(/^([^?]*)(\?.*)?$/,"$1")+"?width=720&auto=webp&quality=80"}const e=Object.values(this?.attachments??{}).length;return B`<div class="brandfolder-asset__container"><div class="backward-navigation-pane" @click="${this._dispatchCloseEvent}"><div class="back-button"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 19.6 19.6" class="back-button__icon"><path d="M15.7,10.3H2.9M2.9,10.3l4.1,4.6M2.9,10.3l4.1-4.6"/></svg></div></div><div class="brandfolder-asset__content"><header class="brandfolder-asset__header"><h2 class="brandfolder-asset__name">${this?.name??"Asset Detail"}</h2></header><div class="brandfolder-asset__info"><div class="brandfolder-asset__image-wrapper"><brandfolder-media-container .displayFormat="${"large"}"><img slot="media" class="brandfolder-asset__image" src="${t}" alt="${this?.name??""}"></brandfolder-media-container></div><div class="brandfolder-asset__metadata"><div class="brandfolder-asset__metadata-item">Created on ${Nt(this?.creationDate)}</div><div class="brandfolder-asset__metadata-item">Updated on ${Nt(this?.modificationDate)}</div>${this?.publicationDate?B`<div class="brandfolder-asset__metadata-item">Published on ${Nt(this.publicationDate)}</div>`:""} ${this?.expirationDate?B`<div class="brandfolder-asset__metadata-item">Expires on ${Nt(this.expirationDate)}</div>`:""}</div>${this?.description?B`<div class="brandfolder-asset__description">${Lt(this.description)}</div>`:""}</div><div class="brandfolder-asset__attachments"><header class="brandfolder-asset__attachments-header"><span class="attachments__icon-container"><svg class="attachments__icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M364.2 83.8c-24.4-24.4-64-24.4-88.4 0l-184 184c-42.1 42.1-42.1 110.3 0 152.4s110.3 42.1 152.4 0l152-152c10.9-10.9 28.7-10.9 39.6 0s10.9 28.7 0 39.6l-152 152c-64 64-167.6 64-231.6 0s-64-167.6 0-231.6l184-184c46.3-46.3 121.3-46.3 167.6 0s46.3 121.3 0 167.6l-176 176c-28.6 28.6-75 28.6-103.6 0s-28.6-75 0-103.6l144-144c10.9-10.9 28.7-10.9 39.6 0s10.9 28.7 0 39.6l-144 144c-6.7 6.7-6.7 17.7 0 24.4s17.7 6.7 24.4 0l176-176c24.4-24.4 24.4-64 0-88.4z"/></svg> </span><span class="attachments__count">${e} attachment${1==e?"":"s"}</span></header><ul class="brandfolder-asset__attachments-list">${Object.values(this?.attachments).map((t=>B`<li class="brandfolder-asset__attachment-list-item"><brandfolder-attachment-detail .attachment="${t}" .bfCdnUrlBase="${this?.bfCdnUrlBase}"></li>`))}</ul></div></div></div>`}};qt.styles=n`:host{z-index:2;background:var(--color-gray-900-trans);grid-area:1/1/-2/-1}.brandfolder-asset__container{height:100%;display:grid;grid-template-columns:clamp(4rem,20%,10rem) 1fr;container-type:size}.backward-navigation-pane{display:flex;justify-content:center;align-items:center;cursor:pointer}.back-button{width:2rem;height:2rem;padding:.5rem;display:flex;align-items:center;transition:scale .2s}.backward-navigation-pane:hover .back-button{scale:1.25}svg{stroke:var(--color-gray-100);stroke-width:.1rem;stroke-linecap:round}.brandfolder-asset__content{background:var(--color-white);padding:1.5rem;display:grid;grid-template-rows:auto 1fr;grid-template-columns:1fr 1fr;gap:1rem;height:100%;overflow:scroll;box-sizing:border-box}.brandfolder-asset__header{grid-area:1/1/2/-1;padding:1rem 1rem 0}.brandfolder-asset__name{margin:0;font-size:1.5rem}.brandfolder-asset__attachments,.brandfolder-asset__info{padding:1rem}.brandfolder-asset__metadata{display:flex;flex-direction:column;gap:.5em;font-size:.75em;color:var(--color-gray-500);padding:.5rem 0;font-style:italic}.brandfolder-asset__attachments-header{display:flex;align-items:center;gap:.5rem}.attachments__icon-container{display:flex;align-items:center;width:.8rem}.brandfolder-asset__attachments-list{list-style-type:none;padding:0;display:flex;flex-direction:column;gap:1rem;align-items:center}.brandfolder-asset__attachment-list-item{width:100%;box-shadow:.2rem .2rem .5rem var(--color-gray-300);border:1px solid var(--color-gray-50);border-radius:.25rem;box-sizing:border-box;padding:.5rem}`,qt=t([gt("brandfolder-asset-detail")],qt);let Kt=class extends kt{render(){return B`<brandfolder-media-container .isLink="${!0}"><img slot="media" class="brandfolder-asset__image" src="${this?.thumbnailUrl??"#"}" alt="${this?.name??""}"></brandfolder-media-container>`}};Kt=t([gt("brandfolder-asset-preview")],Kt);let Vt=class extends ot{constructor(){super(...arguments),this.label=null}render(){return B`<fieldset class="bf-control-item__inner">${this?.label?B`<legend>${this.label}</legend>`:"No Label Provided"}<div class="bf-control-item__content"><slot></slot></div></fieldset>`}};Vt.styles=n`fieldset.bf-control-item__inner{box-sizing:border-box;border:1px solid var(--color-gray-400);padding:.75rem;flex:1;display:flex}fieldset legend{white-space:nowrap}.bf-control-item__content{display:flex;flex-direction:column;gap:.5rem;width:100%}`,t([$t({type:String,attribute:!0})],Vt.prototype,"label",void 0),Vt=t([gt("brandfolder-browser-control-item")],Vt);class Wt extends ot{constructor(){super(...arguments),this.label=null,this.controlSchema=null,this.controlInput=null,this.controlSchemaKey=null,this.controlInputKey=null}_dispatchChangeEvent(){this.dispatchEvent(new CustomEvent("bfControlInputChange",{detail:{controlInput:this.controlInput},bubbles:!0,composed:!0}))}_dispatchSubmitEvent(){this.dispatchEvent(new CustomEvent("bfControlsSubmit",{bubbles:!0,composed:!0}))}}t([$t({type:String,attribute:!1})],Wt.prototype,"label",void 0),t([$t({type:Object,attribute:!1})],Wt.prototype,"controlSchema",void 0),t([$t({type:Object,attribute:!1})],Wt.prototype,"controlInput",void 0),t([$t({type:String,attribute:!1})],Wt.prototype,"controlSchemaKey",void 0),t([$t({type:String,attribute:!1})],Wt.prototype,"controlInputKey",void 0);let Jt=class extends Wt{connectedCallback(){super.connectedCallback(),this.controlSchemaKey||(this.controlSchemaKey=Object.keys(this.controlSchema)[0]),this.controlInputKey||(this.controlInputKey=Object.keys(this.controlInput)[0])}_changeHandler(){const t=Array.from(this.inputElements).filter((t=>t.checked)).map((t=>t.value));this.controlInput={...this.controlInput,[this.controlInputKey]:t},this._dispatchChangeEvent()}render(){const t=this?.controlSchema,e=this?.controlSchemaKey,s=t&&e?t[e]:null,i=this?.controlInput,r=this?.controlInputKey,o=i&&r?i[r]:null;return s&&r?B`<div class="bf-browser-checkboxes-control__inner">${Object.entries(s).map((([t,e])=>{const s=!(!o||!o.includes(t)),i=`input--${t}`;return B`<span class="input-item"><input type="checkbox" id="${i}" aria-label="${e}" name="${r}" value="${t}" .checked="${Bt(s)}" @change="${this._changeHandler}"> <label for="${i}">${e}</label></span>`}))}</div>`:""}};Jt.styles=n`:host{flex:1;display:flex}.bf-browser-checkboxes-control__inner{display:flex;flex-wrap:wrap;gap:.5rem 1rem}.input-item{display:flex;align-items:center;justify-content:flex-start;gap:.25rem;flex-wrap:nowrap}`,t([function(t){return(e,s)=>xt(0,0,{get(){return(this.renderRoot??(At??=document.createDocumentFragment())).querySelectorAll(t)}})}('input[type="checkbox"]')],Jt.prototype,"inputElements",void 0),Jt=t([gt("brandfolder-browser-control--checkboxes")],Jt);let Yt=class extends Wt{_changeHandler(){const t=Array.from(this.labelsSelect.selectedOptions).reduce(((t,e)=>(t[e.value]=e?.dataset?.labelName,t)),{});this.controlInput.labels=t,this._dispatchChangeEvent()}renderLabelNode(t){const e=t?.label,s=e?.id??"",i=e?.attributes?.depth,r="-".repeat(i-1).replace(/^-/," -"),o=e?.attributes?.name;return B`<option value="${s}" .selected="${!!this?.controlInput?.labels?.[s]}" data-label-name="${o}">${r} ${o}</option>${t?.children?Object.values(t.children).map((t=>this.renderLabelNode(t))):""}`}render(){const t=Object.values(this?.controlSchema?.labels??[]);return B`<select name="brandfolder-browser-controls-labels" class="brandfolder-browser-controls__labels-select" multiple="multiple" size="${Math.max(t.length,5)}" @change="${this._changeHandler}">${t.map((t=>this.renderLabelNode(t)))}</select>`}};Yt.styles=n`.labels-select{max-height:12rem}`,t([St(".brandfolder-browser-controls__labels-select")],Yt.prototype,"labelsSelect",void 0),Yt=t([gt("brandfolder-browser-control--labels")],Yt);let Zt=class extends Wt{_changeHandler(){this.controlInput.searchText=this.searchTextInput.value,this._dispatchChangeEvent()}render(){return B`<input type="text" class="search-text-input" aria-label="Search" name="brandfolder-browser-controls-search" placeholder="Enter search text..." .value="${this.controlInput?.searchText??""}" @change="${this._changeHandler}" @keyup="${t=>{"Enter"===t.key&&this._dispatchSubmitEvent()}}">`}};Zt.styles=n`:host{flex:1;display:flex}.search-text-input{width:100%;font-size:1rem;padding:.3rem .4rem;color:var(--color-gray-900)}`,t([St(".search-text-input")],Zt.prototype,"searchTextInput",void 0),Zt=t([gt("brandfolder-browser-control--search")],Zt);let Gt=class extends Wt{connectedCallback(){super.connectedCallback(),this.controlSchemaKey||(this.controlSchemaKey=Object.keys(this.controlSchema)[0]),this.controlInputKey||(this.controlInputKey=Object.keys(this.controlInput)[0])}_changeHandler(){this.controlInput={...this.controlInput,[this.controlInputKey]:this.selectElement.value},this._dispatchChangeEvent()}render(){const t=this?.controlSchema,e=this?.controlSchemaKey,s=t&&e?t[e]:null,i=this?.controlInput,r=this?.controlInputKey,o=i&&r?i[r]:null,n=`brandfolder-browser-controls-${r}`;return s&&r?B`<div class="bf-browser-select-control__inner">${this?.label?B`<label for="${n}">${this.label}</label>`:""} <select id="${n}" name="${`brandfolder-browser-controls--${r}`}" class="${`brandfolder-browser-controls__${r}`}" @change="${this._changeHandler}">${Object.entries(s).map((([t,e])=>B`<option value="${t}" .selected="${o===t}">${e}</option>`))}</select></div>`:""}};Gt.styles=n`:host{flex:1;display:flex}.bf-browser-select-control__inner{display:flex;align-items:center;gap:.5rem}label{font-size:.875rem}`,t([St("select")],Gt.prototype,"selectElement",void 0),Gt=t([gt("brandfolder-browser-control--select")],Gt);let Xt=class extends Wt{_addTag(){let t=this.tagTextInput.value?this.tagTextInput.value.trim():"";t.length>0&&(t=t.toLowerCase(),this.controlInput.tags.includes(t)||(this.controlInput.tags=[...this.controlInput.tags,t],this._dispatchChangeEvent()),this.tagTextInput.value="")}_removeTag(t){const e=t.target.dataset.tagText;this.controlInput.tags=this.controlInput.tags.filter((t=>t!==e)),this._dispatchChangeEvent()}render(){return B`<div class="bf-browser-tags-control__inner"><div class="tag-input-container"><input class="tag-text-input" type="text" placeholder="Enter a tag name" @keydown="${t=>{"Enter"===t.key&&this._addTag()}}"> <button class="tag-add-button" @click="${this._addTag}" type="button">Add</button></div>${this.controlInput.tags.length>0?B`<div class="tag-list">${this.controlInput.tags.map((t=>B`<span class="tag"><span class="tag-text">${t}</span> <span class="tag-removal" data-tag-text="${t}" @click="${this._removeTag}">X</span></span>`))}</div>`:""} ${this.controlInput.tags.length>1?B`<div class="tag-filter-mode"><span class="tag-filter-mode__intro">Include assets matching:</span> <label class="tag-filter-mode__option"><input type="radio" name="tag-filter-mode" value="any" .checked="${"any"===this.controlInput.tagFilterMode}" @change="${()=>{this.controlInput.tagFilterMode="any",this._dispatchChangeEvent()}}"> <span class="tag-filter-mode__option-text"><em>Any</em> of these tags</span></label> <label class="tag-filter-mode__option"><input type="radio" name="tag-filter-mode" value="all" .checked="${"all"===this.controlInput.tagFilterMode}" @change="${()=>{this.controlInput.tagFilterMode="all",this._dispatchChangeEvent()}}"> <span class="tag-filter-mode__option-text"><em>All</em> of these tags</span></label></div>`:""}</div>`}};Xt.styles=n`.bf-browser-tags-control__inner{display:flex;flex-direction:column;gap:1rem}.tag-input-container{display:flex;gap:.5rem}.tag-text-input{flex-grow:1}.tag-add-button{flex-shrink:0}.tag-list{display:flex;gap:.5rem;flex-wrap:wrap}.tag{display:flex;font-size:.875rem}.tag-text{background-color:var(--color-gray-200);padding:.25rem .5rem;align-items:center}.tag-removal{font-size:.7em;background-color:var(--color-gray-200);border-left:1px solid var(--color-gray-300);color:var(--color-gray-500);padding:.25rem .5rem;cursor:pointer;display:flex;align-items:center}.tag-removal:hover{background-color:var(--color-gray-300)}.tag-filter-mode{display:flex;flex-direction:column;gap:.5rem;font-size:.875rem}.tag-filter-mode__option{padding:0 0 0 .5rem;display:flex;gap:.25rem}`,t([St(".tag-text-input")],Xt.prototype,"tagTextInput",void 0),Xt=t([gt("brandfolder-browser-control--tags")],Xt);let Qt=class extends ot{constructor(){super(),this.controlsInputDefaults={searchText:"",collections:[],sections:[],labels:{},tags:[],tagFilterMode:"any",aspect:[],filetype:[],creationDate:"all",modificationDate:"all",publicationDate:"all",sortCriterion:"created_at",sortOrder:"desc"},this.controlSchema=null,this.browserFetchStatusMessage=null,this._controlsInput={...this.controlsInputDefaults},this._isOpen=!1,this.addEventListener("bfControlInputChange",this._controlInputHandler),this.addEventListener("bfControlsSubmit",this._controlsSubmissionHandler)}_controlsResetHandler(){this._controlsInput={...this.controlsInputDefaults}}_controlsSubmissionHandler(){this._isOpen=!1;const t={detail:{userInput:this._controlsInput},bubbles:!0,composed:!0};this.dispatchEvent(new CustomEvent("bfBrowserControlsSubmission",t))}_controlInputHandler(t){t.detail.controlInput&&(this._controlsInput={...this._controlsInput,...t.detail.controlInput})}render(){return B`<div class="controls__inner ${this._isOpen?"is-open":""}"><header class="controls__header"><span class="browser-fetch-status-message">${this.browserFetchStatusMessage}</span> <span class="controls__toggle" @click="${()=>this._isOpen=!this._isOpen}"><span class="controls__title">Search & Filter</span> <span class="controls__open-indicator"><svg class="open-indicator__icon ${this._isOpen?"open":"closed"}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 9"><path d="M15 1.57812L7.66667 7.57812"/><path d="M1 1.57812L7.66667 7.57813"/></svg></span></span></header><main class="controls__main"><div class="controls__control-items"><brandfolder-browser-control-item label="Search" class="bf-control-item--search-text"><brandfolder-browser-control--search .controlInput="${{searchText:this._controlsInput.searchText}}"></brandfolder-browser-control--search></brandfolder-browser-control-item>${this?.controlSchema?.collections?B`<brandfolder-browser-control-item label="Collections" class="bf-control-item--collections"><brandfolder-browser-control--checkboxes .controlSchema="${{collections:this.controlSchema.collections}}" .controlInput="${{collections:this._controlsInput.collections}}"></brandfolder-browser-control--checkboxes></brandfolder-browser-control-item>`:""} ${this?.controlSchema?.sections?B`<brandfolder-browser-control-item label="Sections" class="bf-control-item--sections"><brandfolder-browser-control--checkboxes .controlSchema="${{sections:this.controlSchema.sections}}" .controlInput="${{sections:this._controlsInput.sections}}"></brandfolder-browser-control--checkboxes></brandfolder-browser-control-item>`:""} ${this?.controlSchema?.labels?B`<brandfolder-browser-control-item label="Labels" class="bf-control-item--labels"><brandfolder-browser-control--labels .controlSchema="${{labels:this.controlSchema.labels}}" .controlInput="${{labels:this._controlsInput?.labels}}"></brandfolder-browser-control--labels></brandfolder-browser-control-item>`:""}<brandfolder-browser-control-item label="Tags" class="bf-control-item--tags"><brandfolder-browser-control--tags .controlInput="${{tags:this._controlsInput.tags,tagFilterMode:this._controlsInput.tagFilterMode}}"></brandfolder-browser-control--tags></brandfolder-browser-control-item>${this?.controlSchema?.aspect?B`<brandfolder-browser-control-item label="Orientation" class="bf-control-item--aspect"><brandfolder-browser-control--checkboxes .controlSchema="${{aspect:this.controlSchema.aspect}}" .controlInput="${{aspect:this._controlsInput.aspect}}"></brandfolder-browser-control--checkboxes></brandfolder-browser-control-item>`:""} ${this?.controlSchema?.filetype&&Object.keys(this.controlSchema.filetype)?.length>1?B`<brandfolder-browser-control-item label="File Type" class="bf-control-item--filetype"><brandfolder-browser-control--checkboxes .controlSchema="${{filetype:this.controlSchema.filetype}}" .controlInput="${{filetype:this._controlsInput.filetype}}"></brandfolder-browser-control--checkboxes></brandfolder-browser-control-item>`:""} ${this?.controlSchema?.creationDate?B`<brandfolder-browser-control-item label="Created/Uploaded" class="bf-control-item--creation-date"><brandfolder-browser-control--select .controlSchema="${{creationDate:this.controlSchema.creationDate}}" .controlInput="${{creationDate:this._controlsInput.creationDate}}"></brandfolder-browser-control--select></brandfolder-browser-control-item>`:""} ${this?.controlSchema?.modificationDate&&Object.keys(this.controlSchema.modificationDate)?.length>1?B`<brandfolder-browser-control-item label="Last Updated" class="bf-control-item--modification-date"><brandfolder-browser-control--select .controlSchema="${{modificationDate:this.controlSchema.modificationDate}}" .controlInput="${{modificationDate:this._controlsInput.modificationDate}}"></brandfolder-browser-control--select></brandfolder-browser-control-item>`:""} ${this?.controlSchema?.publicationDate&&Object.keys(this.controlSchema.publicationDate)?.length>1?B`<brandfolder-browser-control-item label="Published" class="bf-control-item--publication-date"><brandfolder-browser-control--select .controlSchema="${{publicationDate:this.controlSchema.publicationDate}}" .controlInput="${{publicationDate:this._controlsInput.publicationDate}}"></brandfolder-browser-control--select></brandfolder-browser-control-item>`:""} ${this?.controlSchema?.sortCriteria&&Object.keys(this.controlSchema.sortCriteria)?.length>1?B`<brandfolder-browser-control-item label="Sorting" class="bf-control-item--sorting"><brandfolder-browser-control--select .label="${"Sort by"}" .controlSchema="${{sortCriteria:this.controlSchema.sortCriteria}}" .controlInput="${{sortCriterion:this._controlsInput.sortCriterion}}"></brandfolder-browser-control--select><brandfolder-browser-control--select .label="${"Order"}" .controlSchema="${{sortOrder:this.controlSchema.sortOrder}}" .controlInput="${{sortOrder:this._controlsInput.sortOrder}}"></brandfolder-browser-control--select></brandfolder-browser-control-item>`:""}</div><div class="controls__actions"><button @click="${this._controlsSubmissionHandler}">Submit</button> <button @click="${this._controlsResetHandler}">Reset</button></div></main></div>`}};Qt.styles=n`:host{color:var(--color-gray-800)}.controls__header,.controls__main{background:var(--color-gray-100)}.controls__header{display:flex;justify-content:space-between;align-items:center;gap:1rem;padding:.5rem;font-size:1rem}.browser-fetch-status-message{font-family:monospace;padding:0 .1rem;font-size:.9em}.controls__toggle{display:flex;transition:all .3s}.controls__toggle:hover{cursor:pointer;font-weight:bolder}.controls__open-indicator,.controls__title{display:flex;align-items:center;justify-content:center;padding:.2rem}.controls__open-indicator{width:1.5rem;padding:0 .2rem}.open-indicator__icon{width:.9rem;transition:transform .3s}.open-indicator__icon path{stroke:var(--color-gray-800);stroke-width:1}.controls__toggle:hover .open-indicator__icon path{stroke-width:1.5}.open-indicator__icon.open{transform:scaleY(-1)}.controls__main{max-height:0;overflow:hidden;transition:all .3s;padding:0 .25rem}.controls__inner.is-open .controls__main{max-height:100vh;padding:.5rem}.controls__control-items{display:flex;flex-wrap:wrap;gap:1rem .5rem;max-height:calc(var(--bf-browser-height) - 6rem);overflow:scroll}.bf-control-item{flex:1}brandfolder-browser-control-item{flex:1}.bf-control-item--search-text{flex-basis:100%;display:flex}.controls__actions{display:flex;justify-content:space-between;align-items:center;gap:1rem;padding:1rem .25rem .5rem}`,t([$t({type:Object,attribute:!1})],Qt.prototype,"controlSchema",void 0),t([$t({type:String})],Qt.prototype,"browserFetchStatusMessage",void 0),t([wt()],Qt.prototype,"_controlsInput",void 0),t([wt()],Qt.prototype,"_isOpen",void 0),t([St(".brandfolder-browser-controls__creation-date")],Qt.prototype,"creationDateSelect",void 0),t([St(".brandfolder-browser-controls__modification-date")],Qt.prototype,"modificationDateSelect",void 0),t([St(".brandfolder-browser-controls__publication-date")],Qt.prototype,"publicationDateSelect",void 0),t([St(".brandfolder-browser-controls__sort-criterion")],Qt.prototype,"sortCriterionSelect",void 0),t([St(".brandfolder-browser-controls__sort-order")],Qt.prototype,"sortOrderSelect",void 0),Qt=t([gt("brandfolder-browser-controls")],Qt);let te=class extends ot{constructor(){super(),this.bfBrowserId=null,this.settings=null,this.layoutHostSelector=null,this._apiEndpoint="/brandfolder-browser-update",this._assetsPerPage=100,this._height=null,this._activeAsset=null,this._isSelectionTrayOpen=!1,this._assetList=[],this._userInput=null,this._controlSchema=null,this._assetFetchMeta=null,this._browserContext={selectedAttachments:{},selectionLimit:null},this._calibrateSize=()=>{const t=this._determineHeightConstraint();t&&this.style.setProperty("--bf-browser-height",`${t}px`)},this._browserUpdateTask=new ht(this,{task:async([t],{signal:e})=>{const s=await fetch(this._apiEndpoint,{signal:e,method:"POST",headers:{"Content-Type":"application/json; charset=UTF-8"},body:JSON.stringify({bfBrowserId:this.bfBrowserId,userInput:this?._userInput,requestedPage:t,assetsPerPage:this._assetsPerPage})});if(!s.ok)throw new Error(s?.statusText||s?.status.toString());const i=await s.json();return t&&1!==t||(this._assetList=[]),i?.assets?.length&&(this._assetList=this._assetList.concat(i.assets)),i?.meta&&(this._assetFetchMeta=i.meta),i?.controlSchema&&(this._controlSchema=i.controlSchema),i},autoRun:!1}),this._assetDetailCloseHandler=()=>{this._activeAsset=null,this.classList.remove("is-asset-detail-open"),this._isSelectionTrayOpen=!1},this._attachmentSelectionHandler=t=>{const{attachmentId:e,attachment:s,isSelected:i}=t.detail;if(!e?.length)return;const r=this._browserContext.selectedAttachments;i?(r[e]=s,this._isSelectionTrayOpen=!0):delete r[e],this._browserContext={...this._browserContext,selectedAttachments:r},this.dispatchEvent(new CustomEvent("brandfolderBrowserAttachmentSelectionChange",{detail:{selectedAttachmentIds:Object.keys(r),selectionLimit:this._browserContext.selectionLimit},bubbles:!0,composed:!0}))},this.addEventListener("bfAssetDetailClose",this._assetDetailCloseHandler),this.addEventListener("bfAttachmentSelection",this._attachmentSelectionHandler),this.addEventListener("bfBrowserControlsSubmission",this._controlsSubmissionHandler),this.addEventListener("bfSelectionTrayToggle",(()=>{this._isSelectionTrayOpen=!this._isSelectionTrayOpen}))}connectedCallback(){if(super.connectedCallback(),this.settings&&"string"==typeof this.settings){const t=JSON.parse(this.settings);t?.apiEndpoint&&(this._apiEndpoint=t.apiEndpoint),t?.assetsPerPage&&(this._assetsPerPage=t.assetsPerPage),t?.selectedAttachments&&(this._browserContext.selectedAttachments=t.selectedAttachments),t?.selectionLimit&&(this._browserContext.selectionLimit=t.selectionLimit),t?.layoutHostSelector&&!this.layoutHostSelector&&(this.layoutHostSelector=t.layoutHostSelector),t?.height?(this._height=t.height,this.style.setProperty("--bf-browser-height",`${this._height}px`)):this.layoutHostSelector&&(this._calibrateSize(),window.addEventListener("resize",this._calibrateSize))}this._browserUpdateTask.run([1]).then()}disconnectedCallback(){window.removeEventListener("resize",this._calibrateSize),super.disconnectedCallback()}updated(t){this._calibrateSize()}_determineHeightConstraint(){if(!this?.layoutHostSelector)return null;const t=this.closest(this?.layoutHostSelector);if(!t)return null;const e=getComputedStyle(t);return t.offsetHeight-parseInt(e.paddingTop,10)-parseInt(e.paddingBottom,10)}_controlsSubmissionHandler(t){JSON.stringify(this._userInput)!==JSON.stringify(t.detail.userInput)&&(this._assetList=[],this._assetFetchMeta=null,this._userInput={...t.detail.userInput},this._browserUpdateTask.run([1]).then())}_assetSelectionHandler(t){const e=t.target;e?.asset&&(this._activeAsset=e.asset,this.classList.add("is-asset-detail-open"))}render(){const t=this._assetList?.length,e=this._assetFetchMeta?.total_count;let s="fetching assets...";const i=this._browserUpdateTask.status;return i===at?s=t>0?`showing ${t}${e?` of ${(new Intl.NumberFormat).format(e)} `:" "}assets`:"no assets found":i===lt&&(s="there was an error fetching assets"),B`<div class="bf-browser__inner"><div class="bf-browser__controls-container"><brandfolder-browser-controls .controlSchema="${this._controlSchema}" .browserFetchStatusMessage="${s}"></div><div class="bf-browser__results-container"><div class="asset-list">${t>0?this._assetList.map((t=>B`<brandfolder-asset-preview @click="${this._assetSelectionHandler}" bf-asset-id="${t.id}" .asset="${t}">`)):""}</div>${this._assetFetchMeta?.next_page?B`<div class="bf-browser__pagination"><div class="bf-browser__load-more"><button @click="${()=>this._browserUpdateTask.run([this._assetFetchMeta?.next_page])}">Load More</button></div></div>`:""}</div>${this._activeAsset?B`<brandfolder-asset-detail bf-asset-id="${this._activeAsset.id}" .asset="${this._activeAsset}">`:""}<div class="bf-browser__selection-tray-container"><brandfolder-browser-selection-tray .isOpen="${this._isSelectionTrayOpen&&Object.values(this._browserContext.selectedAttachments).length>0}"></brandfolder-browser-selection-tray></div></div>`}};te.styles=n`:host{--color-gray-50:#f9f9fa;--color-gray-100:#f2f2f3;--color-gray-200:#e9e9ea;--color-gray-300:#d9d9da;--color-gray-400:#b5b5b6;--color-gray-500:#959596;--color-gray-600:#6d6d6e;--color-gray-700:#59595a;--color-gray-800:#3b3b3c;--color-gray-900:#1a1a1b;--color-gray-900-trans:#1a1a1bdd;--color-white:#ffffff;--bf-browser-height:100%;display:block;font-family:system-ui;background:#fff;width:100%;height:var(--bf-browser-height);min-height:300px;color:var(--color-gray-800);box-sizing:border-box;overflow:hidden}:host([format=full]){position:fixed;top:0;left:0;z-index:1}:host :focus,:host(:focus){outline:0!important;box-shadow:none!important}.bf-browser__inner{position:relative;display:grid;grid-template-rows:auto 1fr auto;height:100%}.bf-browser__controls-container{grid-area:1/1/span 1/-1}.bf-browser__results-container{grid-area:2/1/span 1/-1;padding:.5rem .5rem 1.5rem;overflow:scroll}.bf-browser__selection-tray-container{grid-area:3/1/span 1/-1;z-index:3}.asset-list{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:1rem}.bf-browser__pagination{display:flex;justify-content:center;padding:2rem 0}`,t([$t({type:String,attribute:"bf-browser-id"})],te.prototype,"bfBrowserId",void 0),t([$t({type:String,attribute:"settings"})],te.prototype,"settings",void 0),t([$t({type:String,attribute:!1})],te.prototype,"layoutHostSelector",void 0),t([wt()],te.prototype,"_apiEndpoint",void 0),t([wt()],te.prototype,"_assetsPerPage",void 0),t([wt()],te.prototype,"_height",void 0),t([wt()],te.prototype,"_activeAsset",void 0),t([wt()],te.prototype,"_isSelectionTrayOpen",void 0),t([wt()],te.prototype,"_assetList",void 0),t([wt()],te.prototype,"_userInput",void 0),t([wt()],te.prototype,"_controlSchema",void 0),t([wt()],te.prototype,"_assetFetchMeta",void 0),t([function({context:t}){return(e,s)=>{const i=new WeakMap;if("object"==typeof s)return s.addInitializer((function(){i.set(this,new _t(this,{context:t}))})),{get(){return e.get.call(this)},set(t){return i.get(this)?.setValue(t),e.set.call(this,t)},init(t){return i.get(this)?.setValue(t),t}};{e.constructor.addInitializer((e=>{i.set(e,new _t(e,{context:t}))}));const r=Object.getOwnPropertyDescriptor(e,s);let o;if(void 0===r){const t=new WeakMap;o={get(){return t.get(this)},set(e){i.get(this).setValue(e),t.set(this,e)},configurable:!0,enumerable:!0}}else{const t=r.set;o={...r,set(e){i.get(this).setValue(e),t?.call(this,e)}}}return void Object.defineProperty(e,s,o)}}}({context:Ct}),wt()],te.prototype,"_browserContext",void 0),te=t([gt("brandfolder-browser")],te);export{te as BrandfolderBrowser};
//# sourceMappingURL=brandfolder-browser-bundled.js.map

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc