@snk-libs/sankhya-ds 1.0.0-dev.49 → 1.0.0-dev.51

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.
@@ -68,6 +68,9 @@ export interface WidgetFullscreenDetail {
68
68
  declare const REFERRER_POLICIES: readonly ["no-referrer", "origin", "strict-origin", "strict-origin-when-cross-origin", "same-origin"];
69
69
  /** Política de referência do `<iframe>` de `src`. */
70
70
  export type WidgetReferrerPolicy = (typeof REFERRER_POLICIES)[number];
71
+ declare const ALLOW_FEATURES: readonly ["microphone"];
72
+ /** Recurso do navegador que o `<iframe>` pode receber em `allow` (Permissions Policy); os demais são descartados. */
73
+ export type WidgetAllowFeature = (typeof ALLOW_FEATURES)[number];
71
74
  /**
72
75
  * Bloco de painel que renderiza por dentro uma URL (`src`, num `<iframe>` isolado com `sandbox`) ou um Web
73
76
  * Component (filho no slot padrão ou a tag em `component`), com moldura de janela opcional: título e botões de
@@ -127,11 +130,24 @@ export declare class SankhyaDsWidget extends SankhyaDsElement {
127
130
  accessor src: string;
128
131
  /**
129
132
  * Permissões do `<iframe>` (atributo `sandbox` nativo). Padrão sem `allow-same-origin`; vazio aplica o sandbox
130
- * total. Aceita só `allow-scripts`, `allow-forms`, `allow-popups`, `allow-same-origin`, `allow-downloads` e
131
- * `allow-modals`. `allow-scripts` + `allow-same-origin` numa página da mesma origem desfaria o sandbox: nesse caso
132
- * o `allow-same-origin` é descartado (com aviso). Use `allow-same-origin` só para páginas confiáveis de outra origem.
133
+ * total. Aceita só `allow-scripts`, `allow-forms`, `allow-popups`, `allow-same-origin`, `allow-downloads`,
134
+ * `allow-modals`, `allow-popups-to-escape-sandbox` e `allow-storage-access-by-user-activation`. `allow-scripts` +
135
+ * `allow-same-origin` numa página da mesma origem desfaria o sandbox: nesse caso o `allow-same-origin` é descartado
136
+ * (com aviso). `allow-popups-to-escape-sandbox` só vale com `allow-popups` e numa página de outra origem (a aba
137
+ * aberta roda sem sandbox); fora disso é descartado com aviso. `allow-storage-access-by-user-activation` só tem
138
+ * efeito com `allow-same-origin` (sem ele, avisa). Use `allow-same-origin` e `allow-popups-to-escape-sandbox` só
139
+ * para páginas confiáveis de outra origem. Trocar com o iframe carregado vale na próxima navegação dele.
133
140
  */
134
141
  accessor sandbox: string;
142
+ /**
143
+ * Recursos do navegador liberados para a página do `<iframe>` (atributo `allow` nativo, Permissions Policy), uma
144
+ * diretiva por recurso separada por `;` (ou espaço). Padrão vazio: nenhum recurso. Aceita só `microphone`
145
+ * (`WidgetAllowFeature`): a página pode pedir o microfone, e o navegador ainda pergunta ao usuário. O recurso vale
146
+ * só para a origem de `src`: diretiva com lista de origens (`*`, `'self'`, `'none'`, outra origem) é descartada
147
+ * inteira com aviso (`'src'` é aceito, é o mesmo que o nome sozinho). Trocar com o iframe carregado vale na próxima
148
+ * navegação dele (não recarrega). Sem `src`, não tem efeito.
149
+ */
150
+ accessor allow: string;
135
151
  /**
136
152
  * Política de referência do `<iframe>` de `src`: `strict-origin-when-cross-origin` (padrão), `no-referrer`,
137
153
  * `origin`, `strict-origin` ou `same-origin`. Outro valor (ex.: `unsafe-url`) é descartado com aviso e vale o
@@ -1 +1 @@
1
- import{devWarn as e,warnA11y as t}from"../../internal/dev.js";import{SankhyaDsElement as n}from"../../internal/sankhya-ds-element.js";import{HasSlotController as r}from"../../internal/slot.js";import{SlotMotionController as i,cssTimeMs as a,enter as o,fade as s,leave as c,motionTiming as l,reducedMotion as u}from"../../internal/motion.js";import{msg as d,str as f}from"../../internal/localize.js";import{safeFrameSrc as p}from"../../internal/url.js";import{OverflowTipController as m}from"../../internal/overflow-tip.js";import{cssStyle as h}from"../../internal/css-style.js";import{innerSize as g}from"../../internal/box.js";import{loadWidgetMenu as _,widgetMenuReady as v}from"../../internal/widget-menu-loader.js";import{styles as y}from"./widget.styles.js";import{html as b,nothing as x}from"lit";import{property as S,state as C}from"lit/decorators.js";import{classMap as w}from"lit/directives/class-map.js";var T=function(e,t,n,r,i,a){function o(e){if(e!==void 0&&typeof e!=`function`)throw TypeError(`Function expected`);return e}for(var s=r.kind,c=s===`getter`?`get`:s===`setter`?`set`:`value`,l=!t&&e?r.static?e:e.prototype:null,u=t||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),d,f=!1,p=n.length-1;p>=0;p--){var m={};for(var h in r)m[h]=h===`access`?{}:r[h];for(var h in r.access)m.access[h]=r.access[h];m.addInitializer=function(e){if(f)throw TypeError(`Cannot add initializers after decoration has completed`);a.push(o(e||null))};var g=(0,n[p])(s===`accessor`?{get:u.get,set:u.set}:u[c],m);if(s===`accessor`){if(g===void 0)continue;if(typeof g!=`object`||!g)throw TypeError(`Object expected`);(d=o(g.get))&&(u.get=d),(d=o(g.set))&&(u.set=d),(d=o(g.init))&&i.unshift(d)}else(d=o(g))&&(s===`field`?i.unshift(d):u[c]=d)}l&&Object.defineProperty(l,r.name,u),f=!0},E=function(e,t,n){for(var r=arguments.length>2,i=0;i<t.length;i++)n=r?t[i].call(e,n):t[i].call(e);return r?n:void 0},ee=[`framed`,`plain`],te=[`collapse`,`dock`],ne=[`nw`,`ne`,`sw`,`se`],re=[`n`,`s`,`w`,`e`],D=[`none`,`xs`,`sm`,`md`,`lg`],O=[`minimized`,`maximized`,`fullscreen`],k=[`no-referrer`,`origin`,`strict-origin`,`strict-origin-when-cross-origin`,`same-origin`],A=`strict-origin-when-cross-origin`,j=/* @__PURE__ */ new Set([`allow-scripts`,`allow-forms`,`allow-popups`,`allow-same-origin`,`allow-downloads`,`allow-modals`]),ie=/^[a-z][a-z0-9._]*-[a-z0-9._-]*$/,M=/* @__PURE__ */ new Set([`__proto__`,`constructor`,`prototype`]),ae=e=>!M.has(e)&&!(e in HTMLElement.prototype),N=32,oe={ArrowUp:{move:`up`,size:`shorter`},ArrowDown:{move:`down`,size:`taller`},ArrowLeft:{move:`left`,size:`narrower`},ArrowRight:{move:`right`,size:`wider`}},P=e=>typeof e==`number`&&Number.isFinite(e)?e:0,F=(()=>{let M=n,F,L=[],R=[],z,B=[],V=[],H,U=[],W=[],G,K=[],q=[],J,Y=[],X=[],Z,se=[],ce=[],le,ue=[],de=[],fe,pe=[],me=[],he,ge=[],_e=[],ve,ye=[],be=[],xe,Se=[],Ce=[],we,Te=[],Ee=[],De,Oe=[],ke=[],Ae,je=[],Me=[],Ne,Pe=[],Fe=[],Ie,Le=[],Re=[],ze,Be=[],Ve=[],He,Ue=[],We=[],Ge,Ke=[],qe=[],Je,Ye=[],Xe=[],Ze,Qe=[],$e=[],et,tt=[],nt=[],rt,it=[],at=[],ot,st=[],ct=[],lt,ut=[],dt=[],ft,pt=[],mt=[],ht,gt=[],_t=[],vt,yt=[],bt=[],xt,St=[],Ct=[],wt,Tt=[],Et=[],Dt,Ot=[],kt=[],At,jt=[],Mt=[],Nt,Pt=[],Q=[],Ft,It=[],Lt=[],Rt,zt=[],Bt=[],Vt,Ht=[],Ut=[],Wt,Gt=[],Kt=[],qt,Jt=[],$=[];return class extends M{static{let e=typeof Symbol==`function`&&Symbol.metadata?Object.create(M[Symbol.metadata]??null):void 0;F=[S()],z=[S()],H=[S()],G=[S({attribute:`referrerpolicy`})],J=[S()],Z=[S({attribute:!1})],le=[S({reflect:!0})],fe=[S({type:Boolean,reflect:!0})],he=[S({reflect:!0,attribute:`minimize-mode`})],ve=[S({attribute:!1})],xe=[S({type:Boolean,reflect:!0})],we=[S({type:Boolean,reflect:!0})],De=[S({type:Boolean,reflect:!0})],Ae=[S({type:Boolean,reflect:!0,attribute:`hide-move-menu`})],Ne=[S({type:Boolean,reflect:!0,attribute:`hide-resize-menu`})],Ie=[S({type:Boolean,reflect:!0})],ze=[S({type:Boolean,reflect:!0})],He=[S({type:Boolean,reflect:!0})],Ge=[S({type:Boolean,reflect:!0})],Je=[S({type:Boolean,reflect:!0})],Ze=[S({type:Number})],et=[S({type:Number})],rt=[S({type:Boolean,reflect:!0})],ot=[S({type:Number})],lt=[S({type:Number})],ft=[S({reflect:!0})],ht=[S({type:Boolean,reflect:!0})],vt=[S({attribute:`busy-label`})],xt=[C()],wt=[C()],Dt=[C()],At=[C()],Nt=[C()],Ft=[C()],Rt=[C()],Vt=[C()],Wt=[C()],qt=[C()],T(this,null,F,{kind:`accessor`,name:`label`,static:!1,private:!1,access:I(`label`),metadata:e},L,R),T(this,null,z,{kind:`accessor`,name:`src`,static:!1,private:!1,access:I(`src`),metadata:e},B,V),T(this,null,H,{kind:`accessor`,name:`sandbox`,static:!1,private:!1,access:I(`sandbox`),metadata:e},U,W),T(this,null,G,{kind:`accessor`,name:`referrerPolicy`,static:!1,private:!1,access:I(`referrerPolicy`),metadata:e},K,q),T(this,null,J,{kind:`accessor`,name:`component`,static:!1,private:!1,access:I(`component`),metadata:e},Y,X),T(this,null,Z,{kind:`accessor`,name:`componentProps`,static:!1,private:!1,access:I(`componentProps`),metadata:e},se,ce),T(this,null,le,{kind:`accessor`,name:`variant`,static:!1,private:!1,access:I(`variant`),metadata:e},ue,de),T(this,null,fe,{kind:`accessor`,name:`minimizable`,static:!1,private:!1,access:I(`minimizable`),metadata:e},pe,me),T(this,null,he,{kind:`accessor`,name:`minimizeMode`,static:!1,private:!1,access:I(`minimizeMode`),metadata:e},ge,_e),T(this,null,ve,{kind:`accessor`,name:`minimizeTarget`,static:!1,private:!1,access:I(`minimizeTarget`),metadata:e},ye,be),T(this,null,xe,{kind:`accessor`,name:`maximizable`,static:!1,private:!1,access:I(`maximizable`),metadata:e},Se,Ce),T(this,null,we,{kind:`accessor`,name:`fullscreenable`,static:!1,private:!1,access:I(`fullscreenable`),metadata:e},Te,Ee),T(this,null,De,{kind:`accessor`,name:`movable`,static:!1,private:!1,access:I(`movable`),metadata:e},Oe,ke),T(this,null,Ae,{kind:`accessor`,name:`hideMoveMenu`,static:!1,private:!1,access:I(`hideMoveMenu`),metadata:e},je,Me),T(this,null,Ne,{kind:`accessor`,name:`hideResizeMenu`,static:!1,private:!1,access:I(`hideResizeMenu`),metadata:e},Pe,Fe),T(this,null,Ie,{kind:`accessor`,name:`closable`,static:!1,private:!1,access:I(`closable`),metadata:e},Le,Re),T(this,null,ze,{kind:`accessor`,name:`minimized`,static:!1,private:!1,access:I(`minimized`),metadata:e},Be,Ve),T(this,null,He,{kind:`accessor`,name:`maximized`,static:!1,private:!1,access:I(`maximized`),metadata:e},Ue,We),T(this,null,Ge,{kind:`accessor`,name:`fullscreen`,static:!1,private:!1,access:I(`fullscreen`),metadata:e},Ke,qe),T(this,null,Je,{kind:`accessor`,name:`open`,static:!1,private:!1,access:I(`open`),metadata:e},Ye,Xe),T(this,null,Ze,{kind:`accessor`,name:`x`,static:!1,private:!1,access:I(`x`),metadata:e},Qe,$e),T(this,null,et,{kind:`accessor`,name:`y`,static:!1,private:!1,access:I(`y`),metadata:e},tt,nt),T(this,null,rt,{kind:`accessor`,name:`resizable`,static:!1,private:!1,access:I(`resizable`),metadata:e},it,at),T(this,null,ot,{kind:`accessor`,name:`width`,static:!1,private:!1,access:I(`width`),metadata:e},st,ct),T(this,null,lt,{kind:`accessor`,name:`height`,static:!1,private:!1,access:I(`height`),metadata:e},ut,dt),T(this,null,ft,{kind:`accessor`,name:`padding`,static:!1,private:!1,access:I(`padding`),metadata:e},pt,mt),T(this,null,ht,{kind:`accessor`,name:`busy`,static:!1,private:!1,access:I(`busy`),metadata:e},gt,_t),T(this,null,vt,{kind:`accessor`,name:`busyLabel`,static:!1,private:!1,access:I(`busyLabel`),metadata:e},yt,bt),T(this,null,xt,{kind:`accessor`,name:`loaded`,static:!1,private:!1,access:I(`loaded`),metadata:e},St,Ct),T(this,null,wt,{kind:`accessor`,name:`dragging`,static:!1,private:!1,access:I(`dragging`),metadata:e},Tt,Et),T(this,null,Dt,{kind:`accessor`,name:`moving`,static:!1,private:!1,access:I(`moving`),metadata:e},Ot,kt),T(this,null,At,{kind:`accessor`,name:`landed`,static:!1,private:!1,access:I(`landed`),metadata:e},jt,Mt),T(this,null,Nt,{kind:`accessor`,name:`reserve`,static:!1,private:!1,access:I(`reserve`),metadata:e},Pt,Q),T(this,null,Ft,{kind:`accessor`,name:`area`,static:!1,private:!1,access:I(`area`),metadata:e},It,Lt),T(this,null,Rt,{kind:`accessor`,name:`instant`,static:!1,private:!1,access:I(`instant`),metadata:e},zt,Bt),T(this,null,Vt,{kind:`accessor`,name:`fit`,static:!1,private:!1,access:I(`fit`),metadata:e},Ht,Ut),T(this,null,Wt,{kind:`accessor`,name:`announce`,static:!1,private:!1,access:I(`announce`),metadata:e},Gt,Kt),T(this,null,qt,{kind:`accessor`,name:`scrollable`,static:!1,private:!1,access:I(`scrollable`),metadata:e},Jt,$),e&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e})}static css=y;static enums={variant:ee,padding:D,minimizeMode:te};#e=E(this,L,``);get label(){return this.#e}set label(e){this.#e=e}#t=(E(this,R),E(this,B,``));get src(){return this.#t}set src(e){this.#t=e}#n=(E(this,V),E(this,U,`allow-scripts allow-forms allow-popups`));get sandbox(){return this.#n}set sandbox(e){this.#n=e}#r=(E(this,W),E(this,K,A));get referrerPolicy(){return this.#r}set referrerPolicy(e){this.#r=e}#i=(E(this,q),E(this,Y,``));get component(){return this.#i}set component(e){this.#i=e}#a=(E(this,X),E(this,se,{}));get componentProps(){return this.#a}set componentProps(e){this.#a=e}#o=(E(this,ce),E(this,ue,`framed`));get variant(){return this.#o}set variant(e){this.#o=e}#s=(E(this,de),E(this,pe,!1));get minimizable(){return this.#s}set minimizable(e){this.#s=e}#c=(E(this,me),E(this,ge,`collapse`));get minimizeMode(){return this.#c}set minimizeMode(e){this.#c=e}#l=(E(this,_e),E(this,ye,null));get minimizeTarget(){return this.#l}set minimizeTarget(e){this.#l=e}#u=(E(this,be),E(this,Se,!1));get maximizable(){return this.#u}set maximizable(e){this.#u=e}#d=(E(this,Ce),E(this,Te,!1));get fullscreenable(){return this.#d}set fullscreenable(e){this.#d=e}#f=(E(this,Ee),E(this,Oe,!1));get movable(){return this.#f}set movable(e){this.#f=e}#p=(E(this,ke),E(this,je,!1));get hideMoveMenu(){return this.#p}set hideMoveMenu(e){this.#p=e}#m=(E(this,Me),E(this,Pe,!1));get hideResizeMenu(){return this.#m}set hideResizeMenu(e){this.#m=e}#h=(E(this,Fe),E(this,Le,!1));get closable(){return this.#h}set closable(e){this.#h=e}#g=(E(this,Re),E(this,Be,!1));get minimized(){return this.#g}set minimized(e){this.#g=e}#_=(E(this,Ve),E(this,Ue,!1));get maximized(){return this.#_}set maximized(e){this.#_=e}#v=(E(this,We),E(this,Ke,!1));get fullscreen(){return this.#v}set fullscreen(e){this.#v=e}#y=(E(this,qe),E(this,Ye,!0));get open(){return this.#y}set open(e){this.#y=e}#b=(E(this,Xe),E(this,Qe,0));get x(){return this.#b}set x(e){this.#b=e}#x=(E(this,$e),E(this,tt,0));get y(){return this.#x}set y(e){this.#x=e}#S=(E(this,nt),E(this,it,!1));get resizable(){return this.#S}set resizable(e){this.#S=e}#C=(E(this,at),E(this,st,0));get width(){return this.#C}set width(e){this.#C=e}#w=(E(this,ct),E(this,ut,0));get height(){return this.#w}set height(e){this.#w=e}#T=(E(this,dt),E(this,pt,`lg`));get padding(){return this.#T}set padding(e){this.#T=e}#E=(E(this,mt),E(this,gt,!1));get busy(){return this.#E}set busy(e){this.#E=e}#D=(E(this,_t),E(this,yt,``));get busyLabel(){return this.#D}set busyLabel(e){this.#D=e}get#O(){return!!this.querySelector(`:scope > [slot="busy"]`)}#k=(E(this,bt),e=>{this.requestUpdate();let n=e.target.assignedElements(),r=n.some(e=>e.textContent?.trim()||e.hasAttribute(`aria-label`)||[`progressbar`,`status`].includes(e.getAttribute(`role`)??``)||e.localName===`sankhya-ds-brand-loader`||e.localName===`sankhya-ds-spinner`);n.length&&!r&&t(this,`busy-slot-name`,`o conteúdo do slot busy não tem nome acessível: o leitor de tela não ouve o carregamento. Correção: use o sankhya-ds-brand-loader ou dê texto, aria-label ou role="status" ao conteúdo.`)});get frame(){return this.renderRoot?.querySelector(`iframe.frame`)??null}#A=E(this,St,!1);get loaded(){return this.#A}set loaded(e){this.#A=e}#j=(E(this,Ct),E(this,Tt,!1));get dragging(){return this.#j}set dragging(e){this.#j=e}#M=(E(this,Et),E(this,Ot,!1));get moving(){return this.#M}set moving(e){this.#M=e}#N=(E(this,kt),E(this,jt,!1));get landed(){return this.#N}set landed(e){this.#N=e}#P=(E(this,Mt),E(this,Pt,0));get reserve(){return this.#P}set reserve(e){this.#P=e}#F=(E(this,Q),E(this,It,null));get area(){return this.#F}set area(e){this.#F=e}#I=(E(this,Lt),E(this,zt,!1));get instant(){return this.#I}set instant(e){this.#I=e}#L=(E(this,Bt),E(this,Ht,null));get fit(){return this.#L}set fit(e){this.#L=e}#R=(E(this,Ut),E(this,Gt,``));get announce(){return this.#R}set announce(e){this.#R=e}#z=(E(this,Kt),E(this,Jt,!1));get scrollable(){return this.#z}set scrollable(e){this.#z=e}#B=(E(this,$),``);#V(e){this.#B=e,this.announce=``,requestAnimationFrame(()=>this.announce=this.#B)}#H=e=>{let t=e.detail;this.#V(this.#B?`${this.#B}. ${t}`:t)};#U=new m(this);#W=new r(this,`actions`);#G=new i(this,`actions`,`[default]`);get#K(){return this.#W.test(`actions`)||this.#G.leavingFrom(`actions`)}#q=!1;#J=!1;#Y=!1;#X;#Z=null;#Q;#$=!1;#ee;#te;#ne;#re;#ie;#ae;#oe;#se;connectedCallback(){super.connectedCallback(),this.addEventListener(`keydown`,this.#Qe),this.addEventListener(`internal:widget-announce`,this.#H),this.addEventListener(`pointerdown`,this.#de,{capture:!0}),this.addEventListener(`focusin`,this.#pe),document.addEventListener(`focusin`,this.#me),window.addEventListener(`blur`,this.#he),window.addEventListener(`focus`,this.#ge),this.addEventListener(`pointerenter`,this.#Nt),this.addEventListener(`focusin`,this.#Nt),this.#Mt(),this.hasUpdated&&this.fullscreen&&this.#Pe(!0),this.hasUpdated&&this.maximized&&this.#Oe(!0)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`keydown`,this.#Qe),this.removeEventListener(`internal:widget-announce`,this.#H),this.removeEventListener(`pointerdown`,this.#de,{capture:!0}),this.removeEventListener(`focusin`,this.#pe),document.removeEventListener(`focusin`,this.#me),window.removeEventListener(`blur`,this.#he),window.removeEventListener(`focus`,this.#ge),this.removeEventListener(`pointerenter`,this.#Nt),this.removeEventListener(`focusin`,this.#Nt),this.#jt?.(),this.#jt=void 0,this.#Pe(!1),this.#Oe(!1),this.#re?.disconnect(),this.#re=void 0,this.#ie?.disconnect(),this.#ie=void 0,this.#te?.disconnect(),this.#te=void 0,this.#ne=void 0}#ce=!1;#le=!1;#ue(e){this.open&&!this.customStates.has(`leaving`)&&this.emit(`sankhya-ds-activate`,{source:e})}#de=()=>{this.#ue(`pointer`),this.#le=!0,setTimeout(()=>this.#le=!1)};#fe(e){return e instanceof Node&&(e===this||this.contains(e))}#pe=e=>{let t=e.relatedTarget,n=this.#ce&&t!==null?this.#fe(t):this.#ce;if(this.#ce=!0,n||this.#le)return;let r=e.composedPath()[0];this.#ue(r===this.frame?`frame`:`focus`)};#me=e=>{e.composedPath().includes(this)||(this.#ce=!1)};#he=()=>{setTimeout(()=>{let e=this.frame;if(!e||this.shadowRoot?.activeElement!==e)return;let t=this.#ce;this.#ce=!0,!t&&!this.#le&&this.#ue(`frame`)})};#ge=()=>{setTimeout(()=>{this.#ce=this.matches(`:focus-within`)})};get#_e(){return this.renderRoot.querySelector(`.base`)}get#ve(){return p(this.src,this)}#ye(t){let n=(this.sandbox??``).split(/\s+/).filter(Boolean),r=n.filter(e=>j.has(e.toLowerCase())),i=n.filter(e=>!j.has(e.toLowerCase()));i.length&&e(this,`sandbox-token:${i.join(` `)}`,`sandbox: ${i.join(`, `)} não é aceito e foi descartado. Aceitos: ${[...j].join(`, `)}.`);let a=e=>r.some(t=>t.toLowerCase()===e);return a(`allow-scripts`)&&a(`allow-same-origin`)&&new URL(t,location.href).origin===location.origin?(e(this,`sandbox-escape`,`sandbox com allow-scripts e allow-same-origin numa página da mesma origem desfaria o isolamento: allow-same-origin foi descartado.`),r.filter(e=>e.toLowerCase()!==`allow-same-origin`).join(` `)):r.join(` `)}#be(){let t=this.referrerPolicy??A;return k.includes(t)?t:(e(this,`referrerpolicy=${String(t)}`,`referrerpolicy="${String(t).slice(0,40)}" não é aceito: vale "${A}". Aceitos: ${k.join(`, `)}.`),A)}get#xe(){let t=this.component.trim().toLowerCase();if(t){if(ie.test(t))return t;e(this,`component-invalid`,`component="${this.component.slice(0,40)}" não é um Web Component (o nome precisa de hífen, ex.: "meu-grafico"); nada foi renderizado.`)}}get#Se(){return this.parentElement?.localName===`sankhya-ds-widget-area`}get#Ce(){return this.minimized&&this.minimizeMode!==`dock`}get#we(){return this.minimized&&this.minimizeMode===`dock`}get#Te(){return this.variant!==`plain`}willUpdate(t){super.willUpdate(t);let n=(t.has(`minimized`)?!!t.get(`minimized`):this.minimized)&&(t.has(`minimizeMode`)?t.get(`minimizeMode`)===`dock`:this.minimizeMode===`dock`);this.#q=t.has(`open`)&&t.get(`open`)===!1&&this.open||this.hasUpdated&&n&&!this.#we&&this.open,t.has(`src`)&&(this.loaded=!1),this.#Ee(t);let r=t.has(`maximized`)||t.has(`fullscreen`),i=t.has(`minimized`)&&this.maximized&&!r&&this.minimizeMode!==`dock`;if((r||i&&u())&&this.hasUpdated&&(this.#Q=this.#_e.getBoundingClientRect(),this.#$=!r||t.has(`minimized`)||this.#Ce,this.instant=!0),r){let e=this.maximized||this.fullscreen;e&&!this.reserve&&this.hasUpdated&&!this.#Se&&(this.reserve=this.getBoundingClientRect().height),e||(this.reserve=0),this.area=this.maximized&&!this.#Se?this.#De():null}[`src`,`component`,`variant`,`label`,`minimizable`,`maximizable`,`fullscreenable`,`movable`,`closable`,`resizable`].some(e=>t.has(e))&&this.#ke();for(let n of[`x`,`y`,`width`,`height`])t.has(n)&&!Number.isFinite(this[n])&&e(this,`${n}-invalid`,`${n}="${String(this[n])}" não é um número: conta como 0.`)}#Ee(t){let n=O.filter(e=>this[e]);if(n.length<2)return;let r=this.hasUpdated&&t.has(`maximized`)&&!t.get(`maximized`);if(n.length===2&&!this.fullscreen&&!r)return;let i=this.hasUpdated?n.find(e=>t.has(e))??n[0]:n[0];this.hasUpdated||e(this,`size-states`,`${n.join(` e `)} juntos: vale ${i}. Use um só.`);for(let e of n)e!==i&&(this[e]=!1)}#De(){let e=this.parentElement;if(!e)return null;let t=e.getBoundingClientRect(),n=this.getBoundingClientRect(),{width:r,height:i}=g(e);return{left:t.left+e.clientLeft-n.left,top:t.top+e.clientTop-n.top,width:r,height:i}}#Oe(e){this.#ee?.disconnect(),e&&this.parentElement&&(this.#ee??=new ResizeObserver(()=>{this.maximized&&!this.#Se&&(this.area=this.#De())}),this.#ee.observe(this.parentElement))}#ke(){this.src&&this.component&&e(this,`src-component`,`src e component juntos: vale src. Use um só.`);let n=this.minimizable||this.maximizable||this.fullscreenable||this.movable||this.closable||this.resizable;!this.#Te&&n&&e(this,`plain-controls`,`variant="plain" não mostra barra: minimizable, maximizable, fullscreenable, movable, resizable e closable não têm efeito. Use variant="framed".`),!this.label&&(this.#Te&&n||this.src)&&t(this,`no-label`,`widget com controles de janela ou com src sem label: dê um título para a barra, a região e o iframe.`)}updated(t){if(super.updated(t),this.busy&&this.busyLabel&&this.#O&&e(this,`busy-label-slot`,`busy-label é ignorado com o slot busy: o conteúdo do slot traz o próprio texto. Use um só.`),t.has(`open`)||t.has(`minimized`)||t.has(`minimizeMode`)){let e=this.open&&!this.#we;if(e)this.#Ue(),this.#X?.cancel(),this.#X=void 0,this.#q&&this.minimizeMode===`dock`&&t.has(`minimized`)&&this.#He();else if(this.#Y&&!this.#Z&&!this.#J){let e=this.#we&&this.open;this.customStates.set(`leaving`,!0),e&&this.#Ve(),this.#Re(e&&this.matches(`:focus-within`))}this.#J=!e}this.#Y=!0,(t.has(`component`)||t.has(`src`)||t.has(`componentProps`))&&this.#Le(t.has(`component`)||t.has(`src`)),this.#Q&&this.#Ie(this.#Q,this.#$),this.#Q=void 0,this.#$=!1,t.has(`fullscreen`)&&this.#Pe(this.fullscreen),t.has(`maximized`)&&this.#Oe(this.maximized);let n=this.renderRoot.querySelector(`.header`);n&&!this.#te&&(this.#te=new ResizeObserver(()=>this.#Ne(n)),this.#te.observe(n));let r=this.renderRoot.querySelector(`.body`);r&&!this.#ie?(this.#ie=new ResizeObserver(()=>this.#Je(r)),this.#ie.observe(r),this.#qe()):r&&(t.has(`src`)||t.has(`component`)||t.has(`minimized`))&&this.#Je(r),!this.#re&&this.parentElement&&(this.#re=new ResizeObserver(()=>this.#Me()),this.#re.observe(this.parentElement),this.#re.observe(this)),(t.has(`x`)||t.has(`y`)||t.has(`width`)||t.has(`height`))&&this.#Me(),this.#je();let i=[`x`,`y`,`width`,`height`,`maximized`,`fullscreen`,`minimized`,`open`];if(this.#Se&&this.hasUpdated&&u()&&!this.#se&&!this.#oe&&[`x`,`y`,`width`,`height`].some(e=>t.has(e))){let e=Number.parseFloat(getComputedStyle(this).getPropertyValue(`--sankhya-ds-opacity-disabled`));this.#_e.animate([{opacity:P(e)},{opacity:1}],l(this,`micro`))}this.#Se&&this.hasUpdated&&i.some(e=>t.has(e))&&this.dispatchEvent(new CustomEvent(`internal:widget-geometry`,{detail:{final:!this.#se&&!this.#oe}}))}#Ae(){this.customStates.set(`in-area`,this.#Se)}#je(){let e=(e,t)=>t===null?this.style.removeProperty(e):this.style.setProperty(e,t),t=this.#Se;this.#Ae();let n=P(this.x),r=P(this.y);e(`--_widget-x`,t?`${n}px`:null),e(`--_widget-y`,t?`${r}px`:null),e(`--_widget-w`,t&&P(this.width)>0?`${P(this.width)}px`:null),e(`--_widget-h`,t&&P(this.height)>0&&!this.#Ce?`${P(this.height)}px`:null)}#Me(){if(this.#Se){this.fit&&=null;return}let e=P(this.x),t=P(this.y),n=this.#$e(e,t),r=n.x!==e||n.y!==t?n:null;(r?.x!==this.fit?.x||r?.y!==this.fit?.y)&&(this.fit=r)}#Ne(e){let t=e.offsetHeight,n=this.#ne;if(this.#ne=t,this.maximized&&this.requestUpdate(),n===void 0||n===t)return;let r=this.renderRoot.querySelector(`.body-wrap`);if(u()){r.animate([{opacity:0},{opacity:1}],l(this,`micro`));return}let i=[{transform:`translateY(${n-t}px)`},{transform:`none`}];r.animate(i,l(this)),e.animate(i,{...l(this),pseudoElement:`::after`})}#Pe(e){document.removeEventListener(`focusin`,this.#Fe),e&&document.addEventListener(`focusin`,this.#Fe)}#Fe=e=>{e.composedPath().includes(this)||(this.renderRoot.querySelector(`[part="fullscreen-button"]:not([data-leaving])`)??this.#_e).focus()};#Ie(e,t=!1){let n=this.#_e,r=n.getBoundingClientRect(),i={};this.#mt=i,this.customStates.set(`raised`,!0);let o=()=>{this.#mt===i&&(this.instant=!1,this.#mt=null,this.requestUpdate())};if(t||u()||!r.width||!r.height){n.animate([{opacity:0},{opacity:1}],l(this,`micro`)).finished.then(o,o);return}let s=e.left-r.left,c=e.top-r.top,d=e.width/r.width,f=e.height/r.height;n.animate([{transformOrigin:`top left`,transform:`translate(${s}px, ${c}px) scale(${d}, ${f})`},{transformOrigin:`top left`,transform:`none`}],{...l(this),duration:a(getComputedStyle(this).getPropertyValue(`--sankhya-ds-duration-window`))}).finished.then(o,o)}#Le(t){let n=this.renderRoot.querySelector(`.mount`),r=this.#ve?void 0:this.#xe;if(!n||!r){this.#ae=void 0;return}if(t||!this.#ae||this.#ae.localName!==r||!n.contains(this.#ae)){let e=[...n.children].filter(e=>!e.hasAttribute(`data-leaving`));for(let t of e)c(t).then(()=>t.remove());this.#ae=document.createElement(r),n.append(this.#ae),this.#ie?.observe(this.#ae),e.length&&o(this.#ae)}let i=this.#ae;for(let[t,n]of Object.entries(this.componentProps??{}))ae(t)?i[t]=n:e(this,`component-prop-blocked:${t}`,`componentProps.${t.slice(0,40)} é propriedade nativa do DOM e não é atribuída (só propriedades do Web Component).`)}async#Re(e=!1){let n={};if(this.#Z=n,this.customStates.set(`leaving`,!0),await c(this.#_e),this.#Z!==n)return;this.#Ue();let r=document.activeElement;e&&(!r||r===document.body||this.contains(r)||r===this)&&t(this,`dock-focus`,`o widget foi para o dock com o foco dentro dele, e o foco se perdeu. Correção: no sankhya-ds-minimize, leve o foco ao item do dock (dock.focusItem(id)).`)}#ze(){if(u())return null;let e=typeof this.minimizeTarget==`function`?this.minimizeTarget():this.minimizeTarget,t=e instanceof Element?e.getBoundingClientRect():e instanceof DOMRect?e:null;return t&&t.width>0&&t.height>0?t:null}#Be(e,t){let n=Math.min(t.width/e.width,t.height/e.height);return`translate(${t.left+t.width/2-(e.left+e.width*n/2)}px, ${t.top+t.height/2-(e.top+e.height*n/2)}px) scale(${n})`}#Ve(){let e=this.#_e,t=e.getBoundingClientRect(),n=this.#ze();n&&t.width&&t.height&&(this.#X?.cancel(),this.#X=e.animate([{transformOrigin:`top left`,transform:`none`,opacity:1},{transformOrigin:`top left`,opacity:1,offset:.6},{transformOrigin:`top left`,transform:this.#Be(t,n),opacity:0}],{...l(this,`emphasis`),fill:`forwards`}))}#He(){let e=this.#_e,t=e.getBoundingClientRect(),n=this.#ze();n&&t.width&&t.height&&(this.#X=e.animate([{transformOrigin:`top left`,transform:this.#Be(t,n),opacity:0},{transformOrigin:`top left`,opacity:1,offset:.4},{transformOrigin:`top left`,transform:`none`,opacity:1}],l(this,`emphasis`)))}#Ue(){this.#Z=null,this.customStates.set(`leaving`,!1);let e=this.#_e;e.removeAttribute(`data-leaving`),e.inert=!1}#We=()=>{this.emit(`sankhya-ds-close`,void 0,{cancelable:!0}).defaultPrevented||(this.open=!1)};#Ge(e){let t=!this[e];if(t)for(let t of O)t!==e&&this[t]&&(e!==`minimized`||t!==`maximized`)&&(this[t]=!1,this.#Ke(t));this[e]=t,this.#Ke(e)}#Ke(e){e===`minimized`?this.emit(`sankhya-ds-minimize`,{minimized:this.minimized}):e===`maximized`?this.emit(`sankhya-ds-maximize`,{maximized:this.maximized}):this.emit(`sankhya-ds-fullscreen`,{fullscreen:this.fullscreen})}#qe=()=>{let e=this.#ie;if(!e)return;let t=this.renderRoot.querySelector(`.content > slot`);for(let n of t?.assignedElements()??[])e.observe(n);this.#ae&&e.observe(this.#ae)};#Je(e){let t=!this.#Ce&&(e.scrollHeight>e.clientHeight+1||e.scrollWidth>e.clientWidth+1);!t&&this.shadowRoot?.activeElement===e&&this.#_e.focus({preventScroll:!0}),this.scrollable=t}#Ye=()=>this.#Ge(`minimized`);#Xe=()=>this.#Ge(`maximized`);#Ze=()=>this.#Ge(`fullscreen`);#Qe=e=>{if(e.key!==`Escape`||e.defaultPrevented||e.composedPath().some(e=>e.localName===`sankhya-ds-dropdown-menu`&&e.open))return;let t=this.fullscreen?`fullscreen`:this.maximized?`maximized`:void 0;t&&(e.stopPropagation(),this.#Ge(t))};#$e(e,t){let n=this.parentElement;if(!n)return{x:e,y:t};if(this.#Se){let n=this.#it(),r=P(this.width)||this.offsetWidth,i=P(this.height)||this.offsetHeight;return{x:Math.round(Math.max(0,Math.min(e,n.width-r))),y:Math.round(Math.max(0,Math.min(t,n.height-i)))}}let r=n.getBoundingClientRect(),i=this.#et(),a=(e,t,n)=>Math.round(Math.min(Math.max(e,t),Math.max(t,n)));return{x:a(e,r.left-i.left,r.right-i.right),y:a(t,r.top-i.top,r.bottom-i.bottom)}}#et(){let e=this.getBoundingClientRect(),t=P(this.width)||e.width,n=P(this.height)||e.height;return{left:e.left,top:e.top,right:e.left+t,bottom:e.top+n}}#tt(e,t){let n=this.#$e(e,t);return Math.abs(n.x-P(this.x))<1&&Math.abs(n.y-P(this.y))<1?!1:(this.x=n.x,this.y=n.y,!0)}#nt=/* @__PURE__ */ new Map;#rt(e,t){let n=this.#nt.get(e);if(n!==void 0)return n;let r=Number.parseFloat(getComputedStyle(this).getPropertyValue(e)),i=r>0?r:t;return(this.#se||this.#oe)&&this.#nt.set(e,i),i}#it(){return{width:this.#rt(`--_area-bound-w`,1/0),height:this.#rt(`--_area-bound-h`,1/0)}}#at(e,t,n=!1){let r=this.#rt(`--_area-magnet`,0);if(!this.#Se||!r)return e;let i=this.#rt(`--_area-step-${t}`,N),a=n?this.#rt(`--sankhya-ds-gap-field`,0):0,o=Math.round((e+a)/i)*i-a;return o>=+!!n&&Math.abs(e-o)<=r?o:e}#ot(e=`x`,t=!1){if(!this.#Se)return N;let n=getComputedStyle(this),r=e=>Number.parseFloat(n.getPropertyValue(e));return(t?0:r(`--_area-key-${e}`))||r(`--_area-step-${e}`)||N}get#st(){return this.movable&&this.#Te&&!this.maximized&&!this.fullscreen}#ct=e=>{if(!this.#st||e.button!==0)return;let t=e.composedPath(),n=e.currentTarget;for(let e of t){if(e===n)break;if(e.classList?.contains(`controls`)||e.classList?.contains(`actions`))return}e.preventDefault();try{n.setPointerCapture(e.pointerId)}catch{}this.#nt.clear(),this.#se={id:e.pointerId,sx:e.clientX,sy:e.clientY,ox:P(this.x),oy:P(this.y),moved:!1},this.#ft(),this.dragging=!0,this.moving=!0};#lt=e=>{let t=this.#se;if(!t||t.id!==e.pointerId)return;if(e.pointerType&&e.buttons===0){this.#gt(e);return}let n=this.#at(t.ox+e.clientX-t.sx,`x`),r=this.#at(t.oy+e.clientY-t.sy,`y`);this.#tt(n,r)&&(t.moved=!0)};#ut(){this.#Se&&(this.#pt=!0,this.landed=!1,requestAnimationFrame(()=>this.landed=!0),clearTimeout(this.#dt),this.#dt=setTimeout(()=>this.#ft(),1200))}#dt;#ft(){clearTimeout(this.#dt),this.#pt=!1,this.landed=!1}#pt=!1;#mt=null;#ht=e=>{e.animationName===`sankhya-ds-widget-blink`&&this.#ft()};#gt=e=>{let t=this.#se;t&&t.id===e.pointerId&&(this.#se=void 0,this.dragging=!1,this.moving=!1,t.moved&&(this.#ut(),this.emit(`sankhya-ds-move`,{x:P(this.x),y:P(this.y)})))};#_t=e=>{e.stopPropagation(),e.preventDefault(),this.#vt(e.detail.value)};#vt(e,t=!1){if(!this.#st)return;let n=P(this.x),r=P(this.y),i=this.#ot(`x`,t),a=this.#ot(`y`,t),o={up:[n,r-a],down:[n,r+a],left:[n-i,r],right:[n+i,r],home:[0,0]}[e];o&&(this.#tt(...o)?(this.#V(e===`home`?this.#Se?d(`No início da área`):d(`De volta ao lugar`):d(`Movido`)),this.emit(`sankhya-ds-move`,{x:P(this.x),y:P(this.y)})):this.#V(d(`No limite do painel`)))}#yt=e=>{if((e.key===`ContextMenu`||e.key===`F10`&&e.shiftKey)&&e.composedPath()[0]===e.currentTarget&&this.#Gt){e.preventDefault(),this.#Kt(e.currentTarget);return}let t=oe[e.key];!t||e.composedPath()[0]!==e.currentTarget||e.ctrlKey||e.metaKey||(e.shiftKey?!this.#xt:!this.#st)||(e.preventDefault(),e.shiftKey?this.#At(t.size,e.altKey):this.#vt(t.move,e.altKey))};#bt=e=>{this.loaded=!0,this.emit(`sankhya-ds-load`,{frame:e.target})};get#xt(){return this.resizable&&this.#Te&&!this.maximized&&!this.fullscreen}#St(e){return Number.parseFloat(getComputedStyle(this).getPropertyValue(e))||0}#Ct(e,t,n=`se`){let r=this.#St(`--sankhya-ds-column-min-sm`),i=this.#St(`--sankhya-ds-space-64`)*2,a=this.parentElement,o=1/0,s=1/0;if(this.#Se){let e=this.getBoundingClientRect(),t=this.#it();o=n.endsWith(`w`)?P(this.x)+(P(this.width)||e.width):t.width-P(this.x),s=n.startsWith(`n`)?P(this.y)+(P(this.height)||e.height):t.height-P(this.y)}else if(a){let e=a.getBoundingClientRect(),t=this.#et(),r=t.left+P(this.x),i=t.right+P(this.x),c=t.bottom+P(this.y);o=n.endsWith(`w`)?i-(e.left+a.clientLeft):e.left+a.clientLeft+a.clientWidth-r,n.startsWith(`n`)&&(s=c-(e.top+a.clientTop))}return{width:Math.round(Math.min(Math.max(e,r),Math.max(r,o))),height:Math.round(Math.min(Math.max(t,i),Math.max(i,s)))}}#wt(e,t,n=`se`,r){let i=this.#Ct(e,t,n);this.#Ce&&(i.height=P(this.height));let a=r??{w:i.width,h:i.height,x:P(this.x),y:P(this.y)},o=n.endsWith(`w`)?a.x+(a.w-i.width):P(this.x),s=n.startsWith(`n`)?a.y+(a.h-i.height):P(this.y),c=(e,t)=>Math.abs(e-t)<1;return c(i.width,P(this.width))&&c(i.height,P(this.height))&&c(o,P(this.x))&&c(s,P(this.y))?!1:(this.width=i.width,this.height=i.height,this.x=Math.round(o),this.y=Math.round(s),!0)}#Tt(){this.emit(`sankhya-ds-resize`,{width:P(this.width),height:P(this.height)})}#Et=e=>{if(!this.#xt||e.button!==0)return;let t=e.currentTarget,n=this.#_e.getBoundingClientRect();e.preventDefault();try{t.setPointerCapture(e.pointerId)}catch{}this.#nt.clear(),this.#oe={id:e.pointerId,corner:t.dataset.corner,sx:e.clientX,sy:e.clientY,w:P(this.width)||n.width,h:P(this.height)||n.height,x:P(this.x),y:P(this.y),moved:!1},this.dragging=!0};#Dt=e=>{let t=this.#oe;if(!t||t.id!==e.pointerId)return;if(e.pointerType&&e.buttons===0){this.#Ot(e);return}let n=e.clientX-t.sx,r=e.clientY-t.sy;if(!t.moved&&Math.abs(n)+Math.abs(r)<3)return;t.moved=!0;let{corner:i}=t,a=i.endsWith(`w`)?-n:i.endsWith(`e`)?n:0,o=i.startsWith(`n`)?-r:i.startsWith(`s`)?r:0,s=a?this.#at(t.w+a,`x`,!0):t.w,c=o?this.#at(t.h+o,`y`,!0):t.h;this.#wt(s,c,i,t)};#Ot=e=>{let t=this.#oe;t&&t.id===e.pointerId&&(this.#oe=void 0,this.dragging=!1,t.moved&&(this.#Tt(),(t.x!==P(this.x)||t.y!==P(this.y))&&this.emit(`sankhya-ds-move`,{x:P(this.x),y:P(this.y)})))};#kt=e=>{e.stopPropagation(),e.preventDefault(),this.#At(e.detail.value)};#At(e,t=!1){if(!this.#xt||this.#Ce&&(e===`taller`||e===`shorter`))return;if(e===`auto`){if(!P(this.width)&&(this.#Ce||!P(this.height)))return;this.width=0,this.#Ce||(this.height=0),this.#V(d(`Tamanho original`)),this.#Tt();return}let n=this.#_e.getBoundingClientRect(),r={wider:[this.#ot(`x`,t),0],narrower:[-this.#ot(`x`,t),0],taller:[0,this.#ot(`y`,t)],shorter:[0,-this.#ot(`y`,t)]}[e];if(!r)return;let i=P(this.width)||n.width,a=P(this.height)||n.height;this.#wt(i+r[0],a+r[1])?(this.#V(d(`Redimensionado`)),this.#Tt()):this.#V(d(`No limite de tamanho`))}#jt;#Mt(){if(v()||this.#jt)return;let e=()=>{this.#jt=void 0,this.#Nt()};if(typeof requestIdleCallback==`function`){let t=requestIdleCallback(e,{timeout:2e3});this.#jt=()=>cancelIdleCallback(t)}else{let t=setTimeout(e,300);this.#jt=()=>clearTimeout(t)}}#Nt=()=>{v()||_().catch(()=>void 0)};async#Pt(t,n){try{await _()}catch{e(this,`menu-load`,`o menu do widget não carregou (rede?). Tente de novo.`);return}await customElements.whenDefined(`sankhya-ds-dropdown-menu`),await t.updateComplete,t.isConnected&&this.#Ft()&&(n?.(),t.show())}#Ft(){let e=document.activeElement;return!e||e===document.body||this.matches(`:focus-within`)}#It=e=>{if(v())return;let t=e.currentTarget;e.composedPath().some(e=>e instanceof Element&&e.slot===`trigger`)&&this.#Pt(t)};#Lt=e=>{e.key!==`ArrowDown`&&e.key!==`ArrowUp`||v()||(e.preventDefault(),this.#It(e))};#Rt(){return b`<sankhya-ds-dropdown-menu part="resize-menu" class="control" placement="bottom-end" label=${d(`Tamanho do widget`)} @click=${this.#It} @keydown=${this.#Lt} @sankhya-ds-select=${this.#kt} @sankhya-ds-open=${e=>e.stopPropagation()} @sankhya-ds-close=${e=>e.stopPropagation()} > <sankhya-ds-circle-button slot="trigger" part="resize-button" aria-haspopup="menu" aria-expanded="false" variant="tertiary" size="sm" icon="arrow-resize-diagonal" label=${d(`Redimensionar`)} ></sankhya-ds-circle-button> ${this.#zt()} </sankhya-ds-dropdown-menu>`}#zt(e){let t=(t,n,r)=>b`<sankhya-ds-menu-item slot=${e??x} value=${t} icon=${n}>${r}</sankhya-ds-menu-item>`;return b`${t(`wider`,`arrow-right`,d(`Aumentar largura`))}${t(`narrower`,`arrow-left`,d(`Diminuir largura`))}${this.#Ce?x:b`${t(`taller`,`arrow-down`,d(`Aumentar altura`))}${t(`shorter`,`arrow-up`,d(`Diminuir altura`))}`}${e?x:b`<hr />`}${t(`auto`,`history`,d(`Tamanho original`))}`}#Bt(){let e=(e,t)=>b`<div part=${`resize-${e}`} class="${e} ${t}" data-corner=${t} @pointerdown=${this.#Et} @pointermove=${this.#Dt} @pointerup=${this.#Ot} @pointercancel=${this.#Ot} @lostpointercapture=${this.#Ot} ></div>`;return b`<div class="corners" aria-hidden="true"> ${(this.#Ce?[`w`,`e`]:re).map(t=>e(`edge`,t))} ${this.#Ce?x:ne.map(t=>e(`corner`,t))} </div>`}#Vt(e,t,n,r){return b`<sankhya-ds-circle-button class="control" part=${e} variant="tertiary" size="sm" icon=${t} label=${n} @click=${r} ></sankhya-ds-circle-button>`}#Ht(){return b`<sankhya-ds-dropdown-menu part="move-menu" class="control" placement="bottom-end" label=${d(`Mover widget`)} @click=${this.#It} @keydown=${this.#Lt} @sankhya-ds-select=${this.#_t} @sankhya-ds-open=${e=>e.stopPropagation()} @sankhya-ds-close=${e=>e.stopPropagation()} > <sankhya-ds-circle-button slot="trigger" part="move-button" aria-haspopup="menu" aria-expanded="false" variant="tertiary" size="sm" icon="draggabledots" label=${d(`Mover`)} ></sankhya-ds-circle-button> ${this.#Ut()} </sankhya-ds-dropdown-menu>`}#Ut(e){let t=(t,n,r)=>b`<sankhya-ds-menu-item slot=${e??x} value=${t} icon=${n}>${r}</sankhya-ds-menu-item>`;return b`${t(`up`,`arrow-up`,d(`Mover para cima`))}${t(`down`,`arrow-down`,d(`Mover para baixo`))}${t(`left`,`arrow-left`,d(`Mover para a esquerda`))}${t(`right`,`arrow-right`,d(`Mover para a direita`))}${e?x:b`<hr />`}${t(`home`,`history`,this.#Se?d(`Mover para o início`):d(`Voltar ao lugar`))}`}#Wt(e,t){return b`<span id="ctx-anchor" class="ctx-anchor" aria-hidden="true"></span> <sankhya-ds-dropdown-menu part="context-menu" for="ctx-anchor" placement="bottom-start" distance="0" label=${d(`Opções do widget`)} @sankhya-ds-select=${this.#Jt} @sankhya-ds-open=${e=>e.stopPropagation()} @sankhya-ds-close=${this.#Yt} > ${e&&t?b`<sankhya-ds-menu-item icon="draggabledots" >${d(`Mover`)}${this.#Ut(`submenu`)}</sankhya-ds-menu-item ><sankhya-ds-menu-item icon="arrow-resize-diagonal" >${d(`Redimensionar`)}${this.#zt(`submenu`)}</sankhya-ds-menu-item >`:e?this.#Ut():this.#zt()} </sankhya-ds-dropdown-menu>`}get#Gt(){return this.renderRoot.querySelector(`[part="context-menu"]`)}#Kt(e,t,n){let r=this.#Gt,i=e.getBoundingClientRect(),a=()=>{let e=this.renderRoot.querySelector(`.ctx-anchor`);e.style.left=`${t===void 0?0:t-i.left}px`,e.style.top=`${n===void 0?i.height:n-i.top}px`};v()?(a(),r.show()):this.#Pt(r,a)}#qt=e=>{let t=e.composedPath()[0];this.#Gt&&!t.closest?.(`.tools`)&&(e.preventDefault(),this.#Kt(e.currentTarget,e.clientX,e.clientY))};#Jt=e=>{[`up`,`down`,`left`,`right`,`home`].includes(e.detail.value)?this.#_t(e):this.#kt(e)};#Yt=e=>{e.stopPropagation();let t=e.currentTarget,n=this.renderRoot.activeElement;(!n&&(document.activeElement===document.body||document.activeElement===this)||n&&t.contains(n))&&this.renderRoot.querySelector(`[part="header"]`).focus()};#Xt(e){let t=!this.maximized&&!this.fullscreen,n=this.minimizeMode===`dock`,r=b`${s(this.movable&&t&&!this.hideMoveMenu,()=>b`<span class="control-wrap">${this.#Ht()}</span>`)}${s(this.#xt&&!this.hideResizeMenu,()=>b`<span class="control-wrap">${this.#Rt()}</span>`)}${s(this.minimizable,()=>this.#Vt(`minimize-button`,this.minimized?n?`window-restore`:`angle-down`:`minus`,this.minimized?d(n?`Restaurar`:`Expandir`):d(n?`Minimizar`:`Recolher`),this.#Ye))}${s(this.maximizable,()=>this.#Vt(`maximize-button`,this.maximized?`window-restore`:`window-maximize`,this.maximized?d(`Restaurar tamanho`):d(`Maximizar`),this.#Xe))}${s(this.fullscreenable,()=>this.#Vt(`fullscreen-button`,this.fullscreen?`compress-arrows`:`expand-arrows-alt`,this.fullscreen?d(`Sair da tela cheia`):d(`Tela cheia`),this.#Ze))}${s(this.closable,()=>this.#Vt(`close-button`,`times`,d(`Fechar`),this.#We))}`,i=this.#st&&this.hideMoveMenu,a=this.#xt&&this.hideResizeMenu,o=i||a,c=this.#st&&this.#xt?d(`Use as setas para mover e Shift + setas para redimensionar. Shift + F10 abre as opções.`):this.#st?d(`Use as setas para mover. Shift + F10 abre as opções.`):d(`Use Shift + setas para redimensionar. Shift + F10 abre as opções.`),l=this.#Se?`${c} ${d(`Com Alt, uma célula por vez.`)}`:c;return b`<div class=${w({"header-wrap":!0,shown:e})} ?inert=${!e}> <div class="header-clip"> <div part="header" class=${w({header:!0,grab:this.#st})} tabindex=${o?`0`:x} role=${o?`group`:x} aria-labelledby=${o&&this.label?`title`:x} aria-label=${o&&!this.label?d(`Barra do widget`):x} aria-describedby=${o?`keys`:x} @keydown=${this.#yt} @contextmenu=${this.#qt} @pointerdown=${this.#ct} @pointermove=${this.#lt} @pointerup=${this.#gt} @pointercancel=${this.#gt} @lostpointercapture=${this.#gt} > <div class="title-box"> <span class="title-measure" aria-hidden="true">${this.label}</span> <div part="title" id="title" class="title" @pointerenter=${this.#U.check}>${this.label}</div> ${this.#U.render(`title`,this.label)} </div> <div class="tools"> <div part="actions" class="actions" ?hidden=${!this.#K}> <slot name="actions"></slot> </div> <div part="controls" class="controls">${r}</div> </div> ${o?b`<span id="keys" class="visually-hidden">${l}</span>`:x} ${o?this.#Wt(i,a):x} </div> </div> </div>`}#Zt(){let e=this.#ve;return e?b`<iframe part="frame" class="frame" src=${e} title=${this.label||d(`Conteúdo do widget`)} sandbox=${this.#ye(e)} referrerpolicy=${this.#be()} @load=${this.#bt} ></iframe> <div class="loading-layer sankhya-ds-swap" aria-hidden="true"> ${s(!this.loaded,()=>b`<sankhya-ds-skeleton part="loading" class="loading" shape="rect" ></sankhya-ds-skeleton>`)} </div>`:this.#xe?b`<div class="mount"></div>`:b`<slot @slotchange=${this.#qe}></slot>`}render(){let e=this.#Te,t=this.minimizable||this.maximizable||this.fullscreenable||this.movable||this.closable||this.resizable,n=e&&!!(this.label||t||this.#K),r=this.#ve,i=!!r||this.padding===`none`,a=D.includes(this.padding)?this.padding:`lg`,o=this.maximized||this.fullscreen,c=this.fit?.x??P(this.x),l=this.fit?.y??P(this.y),u=this.#Se,p=o||u?`none`:`${c}px ${l}px`,m=this.maximized&&!u&&this.area,g=!o&&!u,_=g&&P(this.width)>0?`${P(this.width)}px`:void 0,v=g&&!this.#Ce&&P(this.height)>0?`${P(this.height)}px`:void 0,y=this.#ne,S=this.maximized&&e&&y!==void 0,C=S&&this.#Ce,T=m?`${m.height}px`:`var(--_area-height, 100%)`;return this.customStates.set(`raised`,this.dragging||this.landed||this.#pt||!!this.#mt),this.customStates.set(`sized`,!!v),b`<section part="base" class=${w({base:!0,framed:e,bare:e&&!n,entering:this.#q,dragging:this.dragging,moving:this.moving,landed:this.landed,instant:this.instant,shifted:!o&&!u&&(c!==0||l!==0)})} style=${h({translate:p,left:m?`${m.left}px`:void 0,top:m?`${m.top}px`:void 0,width:m?`${m.width}px`:_,height:C?`${y}px`:m?`${m.height}px`:v,"--_widget-body":S?`calc(${T} - ${y}px)`:void 0})} @animationend=${this.#ht} tabindex="-1" aria-labelledby=${this.label&&n?`title`:x} aria-label=${this.label&&!n?this.label:x} > ${e?this.#Xt(n):b`<slot name="actions" hidden></slot>`} <div class="body-wrap" ?inert=${this.#Ce&&e}> <div part="body" class="body" ?inert=${this.busy} aria-busy=${this.busy||r&&!this.loaded?`true`:x} tabindex=${this.scrollable?`0`:x} role=${this.scrollable?`group`:x} aria-label=${this.scrollable?this.label?d(f`Conteúdo de ${this.label}`):d(`Conteúdo do widget`):x} > <div class=${w({content:!0,flush:i,[`pad-${a}`]:!0})}> ${this.#Zt()} </div> </div> <div class="busy-layer sankhya-ds-swap"> ${s(this.busy,()=>b`<div part="busy" class=${w({busy:!0,solid:!!r||this.#O})} > <slot name="busy" @slotchange=${this.#k} ><sankhya-ds-spinner size="lg" block label=${this.busyLabel}></sankhya-ds-spinner ></slot> </div>`)} </div> </div> ${this.#xt?this.#Bt():x} <div class="visually-hidden" role="status">${this.announce}</div> </section> ${this.reserve?b`<div class="reserve" style=${h({blockSize:`${this.reserve}px`})}></div>`:x}`}}})();function I(e){return{has:t=>e in t,get:t=>t[e],set:(t,n)=>{t[e]=n}}}export{F as SankhyaDsWidget};
1
+ import{devWarn as e,warnA11y as t}from"../../internal/dev.js";import{SankhyaDsElement as n}from"../../internal/sankhya-ds-element.js";import{HasSlotController as r}from"../../internal/slot.js";import{SlotMotionController as i,cssTimeMs as a,enter as o,fade as s,leave as c,motionTiming as l,reducedMotion as u}from"../../internal/motion.js";import{msg as d,str as f}from"../../internal/localize.js";import{safeFrameSrc as p}from"../../internal/url.js";import{OverflowTipController as m}from"../../internal/overflow-tip.js";import{cssStyle as h}from"../../internal/css-style.js";import{innerSize as g}from"../../internal/box.js";import{loadWidgetMenu as _,widgetMenuReady as v}from"../../internal/widget-menu-loader.js";import{styles as y}from"./widget.styles.js";import{html as b,nothing as x}from"lit";import{property as S,state as C}from"lit/decorators.js";import{classMap as w}from"lit/directives/class-map.js";import{ifDefined as ee}from"lit/directives/if-defined.js";var T=function(e,t,n,r,i,a){function o(e){if(e!==void 0&&typeof e!=`function`)throw TypeError(`Function expected`);return e}for(var s=r.kind,c=s===`getter`?`get`:s===`setter`?`set`:`value`,l=!t&&e?r.static?e:e.prototype:null,u=t||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),d,f=!1,p=n.length-1;p>=0;p--){var m={};for(var h in r)m[h]=h===`access`?{}:r[h];for(var h in r.access)m.access[h]=r.access[h];m.addInitializer=function(e){if(f)throw TypeError(`Cannot add initializers after decoration has completed`);a.push(o(e||null))};var g=(0,n[p])(s===`accessor`?{get:u.get,set:u.set}:u[c],m);if(s===`accessor`){if(g===void 0)continue;if(typeof g!=`object`||!g)throw TypeError(`Object expected`);(d=o(g.get))&&(u.get=d),(d=o(g.set))&&(u.set=d),(d=o(g.init))&&i.unshift(d)}else(d=o(g))&&(s===`field`?i.unshift(d):u[c]=d)}l&&Object.defineProperty(l,r.name,u),f=!0},E=function(e,t,n){for(var r=arguments.length>2,i=0;i<t.length;i++)n=r?t[i].call(e,n):t[i].call(e);return r?n:void 0},te=[`framed`,`plain`],ne=[`collapse`,`dock`],re=[`nw`,`ne`,`sw`,`se`],ie=[`n`,`s`,`w`,`e`],D=[`none`,`xs`,`sm`,`md`,`lg`],O=[`minimized`,`maximized`,`fullscreen`],ae=[`no-referrer`,`origin`,`strict-origin`,`strict-origin-when-cross-origin`,`same-origin`],k=`strict-origin-when-cross-origin`,A=/* @__PURE__ */ new Set([`allow-scripts`,`allow-forms`,`allow-popups`,`allow-same-origin`,`allow-downloads`,`allow-modals`,`allow-popups-to-escape-sandbox`,`allow-storage-access-by-user-activation`]),j=[`microphone`],oe=/^[a-z][a-z0-9._]*-[a-z0-9._-]*$/,M=/* @__PURE__ */ new Set([`__proto__`,`constructor`,`prototype`]),se=e=>!M.has(e)&&!(e in HTMLElement.prototype),N=32,ce={ArrowUp:{move:`up`,size:`shorter`},ArrowDown:{move:`down`,size:`taller`},ArrowLeft:{move:`left`,size:`narrower`},ArrowRight:{move:`right`,size:`wider`}},P=e=>typeof e==`number`&&Number.isFinite(e)?e:0,F=(()=>{let M=n,F,L=[],R=[],z,B=[],V=[],H,U=[],W=[],G,K=[],q=[],J,Y=[],X=[],Z,le=[],ue=[],de,fe=[],pe=[],me,he=[],ge=[],_e,ve=[],ye=[],be,xe=[],Se=[],Ce,we=[],Te=[],Ee,De=[],Oe=[],ke,Ae=[],je=[],Me,Ne=[],Pe=[],Fe,Ie=[],Le=[],Re,ze=[],Be=[],Ve,He=[],Ue=[],We,Ge=[],Ke=[],qe,Je=[],Ye=[],Xe,Ze=[],Qe=[],$e,et=[],tt=[],nt,rt=[],it=[],at,ot=[],st=[],ct,lt=[],ut=[],dt,ft=[],pt=[],mt,ht=[],gt=[],_t,vt=[],yt=[],bt,xt=[],St=[],Ct,wt=[],Tt=[],Et,Dt=[],Ot=[],kt,At=[],jt=[],Mt,Nt=[],Pt=[],Ft,It=[],Lt=[],Rt,zt=[],Bt=[],Vt,Q=[],Ht=[],Ut,Wt=[],Gt=[],Kt,qt=[],Jt=[],Yt,Xt=[],Zt=[],Qt,$t=[],$=[];return class extends M{static{let e=typeof Symbol==`function`&&Symbol.metadata?Object.create(M[Symbol.metadata]??null):void 0;F=[S()],z=[S()],H=[S()],G=[S()],J=[S({attribute:`referrerpolicy`})],Z=[S()],de=[S({attribute:!1})],me=[S({reflect:!0})],_e=[S({type:Boolean,reflect:!0})],be=[S({reflect:!0,attribute:`minimize-mode`})],Ce=[S({attribute:!1})],Ee=[S({type:Boolean,reflect:!0})],ke=[S({type:Boolean,reflect:!0})],Me=[S({type:Boolean,reflect:!0})],Fe=[S({type:Boolean,reflect:!0,attribute:`hide-move-menu`})],Re=[S({type:Boolean,reflect:!0,attribute:`hide-resize-menu`})],Ve=[S({type:Boolean,reflect:!0})],We=[S({type:Boolean,reflect:!0})],qe=[S({type:Boolean,reflect:!0})],Xe=[S({type:Boolean,reflect:!0})],$e=[S({type:Boolean,reflect:!0})],nt=[S({type:Number})],at=[S({type:Number})],ct=[S({type:Boolean,reflect:!0})],dt=[S({type:Number})],mt=[S({type:Number})],_t=[S({reflect:!0})],bt=[S({type:Boolean,reflect:!0})],Ct=[S({attribute:`busy-label`})],Et=[C()],kt=[C()],Mt=[C()],Ft=[C()],Rt=[C()],Vt=[C()],Ut=[C()],Kt=[C()],Yt=[C()],Qt=[C()],T(this,null,F,{kind:`accessor`,name:`label`,static:!1,private:!1,access:I(`label`),metadata:e},L,R),T(this,null,z,{kind:`accessor`,name:`src`,static:!1,private:!1,access:I(`src`),metadata:e},B,V),T(this,null,H,{kind:`accessor`,name:`sandbox`,static:!1,private:!1,access:I(`sandbox`),metadata:e},U,W),T(this,null,G,{kind:`accessor`,name:`allow`,static:!1,private:!1,access:I(`allow`),metadata:e},K,q),T(this,null,J,{kind:`accessor`,name:`referrerPolicy`,static:!1,private:!1,access:I(`referrerPolicy`),metadata:e},Y,X),T(this,null,Z,{kind:`accessor`,name:`component`,static:!1,private:!1,access:I(`component`),metadata:e},le,ue),T(this,null,de,{kind:`accessor`,name:`componentProps`,static:!1,private:!1,access:I(`componentProps`),metadata:e},fe,pe),T(this,null,me,{kind:`accessor`,name:`variant`,static:!1,private:!1,access:I(`variant`),metadata:e},he,ge),T(this,null,_e,{kind:`accessor`,name:`minimizable`,static:!1,private:!1,access:I(`minimizable`),metadata:e},ve,ye),T(this,null,be,{kind:`accessor`,name:`minimizeMode`,static:!1,private:!1,access:I(`minimizeMode`),metadata:e},xe,Se),T(this,null,Ce,{kind:`accessor`,name:`minimizeTarget`,static:!1,private:!1,access:I(`minimizeTarget`),metadata:e},we,Te),T(this,null,Ee,{kind:`accessor`,name:`maximizable`,static:!1,private:!1,access:I(`maximizable`),metadata:e},De,Oe),T(this,null,ke,{kind:`accessor`,name:`fullscreenable`,static:!1,private:!1,access:I(`fullscreenable`),metadata:e},Ae,je),T(this,null,Me,{kind:`accessor`,name:`movable`,static:!1,private:!1,access:I(`movable`),metadata:e},Ne,Pe),T(this,null,Fe,{kind:`accessor`,name:`hideMoveMenu`,static:!1,private:!1,access:I(`hideMoveMenu`),metadata:e},Ie,Le),T(this,null,Re,{kind:`accessor`,name:`hideResizeMenu`,static:!1,private:!1,access:I(`hideResizeMenu`),metadata:e},ze,Be),T(this,null,Ve,{kind:`accessor`,name:`closable`,static:!1,private:!1,access:I(`closable`),metadata:e},He,Ue),T(this,null,We,{kind:`accessor`,name:`minimized`,static:!1,private:!1,access:I(`minimized`),metadata:e},Ge,Ke),T(this,null,qe,{kind:`accessor`,name:`maximized`,static:!1,private:!1,access:I(`maximized`),metadata:e},Je,Ye),T(this,null,Xe,{kind:`accessor`,name:`fullscreen`,static:!1,private:!1,access:I(`fullscreen`),metadata:e},Ze,Qe),T(this,null,$e,{kind:`accessor`,name:`open`,static:!1,private:!1,access:I(`open`),metadata:e},et,tt),T(this,null,nt,{kind:`accessor`,name:`x`,static:!1,private:!1,access:I(`x`),metadata:e},rt,it),T(this,null,at,{kind:`accessor`,name:`y`,static:!1,private:!1,access:I(`y`),metadata:e},ot,st),T(this,null,ct,{kind:`accessor`,name:`resizable`,static:!1,private:!1,access:I(`resizable`),metadata:e},lt,ut),T(this,null,dt,{kind:`accessor`,name:`width`,static:!1,private:!1,access:I(`width`),metadata:e},ft,pt),T(this,null,mt,{kind:`accessor`,name:`height`,static:!1,private:!1,access:I(`height`),metadata:e},ht,gt),T(this,null,_t,{kind:`accessor`,name:`padding`,static:!1,private:!1,access:I(`padding`),metadata:e},vt,yt),T(this,null,bt,{kind:`accessor`,name:`busy`,static:!1,private:!1,access:I(`busy`),metadata:e},xt,St),T(this,null,Ct,{kind:`accessor`,name:`busyLabel`,static:!1,private:!1,access:I(`busyLabel`),metadata:e},wt,Tt),T(this,null,Et,{kind:`accessor`,name:`loaded`,static:!1,private:!1,access:I(`loaded`),metadata:e},Dt,Ot),T(this,null,kt,{kind:`accessor`,name:`dragging`,static:!1,private:!1,access:I(`dragging`),metadata:e},At,jt),T(this,null,Mt,{kind:`accessor`,name:`moving`,static:!1,private:!1,access:I(`moving`),metadata:e},Nt,Pt),T(this,null,Ft,{kind:`accessor`,name:`landed`,static:!1,private:!1,access:I(`landed`),metadata:e},It,Lt),T(this,null,Rt,{kind:`accessor`,name:`reserve`,static:!1,private:!1,access:I(`reserve`),metadata:e},zt,Bt),T(this,null,Vt,{kind:`accessor`,name:`area`,static:!1,private:!1,access:I(`area`),metadata:e},Q,Ht),T(this,null,Ut,{kind:`accessor`,name:`instant`,static:!1,private:!1,access:I(`instant`),metadata:e},Wt,Gt),T(this,null,Kt,{kind:`accessor`,name:`fit`,static:!1,private:!1,access:I(`fit`),metadata:e},qt,Jt),T(this,null,Yt,{kind:`accessor`,name:`announce`,static:!1,private:!1,access:I(`announce`),metadata:e},Xt,Zt),T(this,null,Qt,{kind:`accessor`,name:`scrollable`,static:!1,private:!1,access:I(`scrollable`),metadata:e},$t,$),e&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e})}static css=y;static enums={variant:te,padding:D,minimizeMode:ne};#e=E(this,L,``);get label(){return this.#e}set label(e){this.#e=e}#t=(E(this,R),E(this,B,``));get src(){return this.#t}set src(e){this.#t=e}#n=(E(this,V),E(this,U,`allow-scripts allow-forms allow-popups`));get sandbox(){return this.#n}set sandbox(e){this.#n=e}#r=(E(this,W),E(this,K,``));get allow(){return this.#r}set allow(e){this.#r=e}#i=(E(this,q),E(this,Y,k));get referrerPolicy(){return this.#i}set referrerPolicy(e){this.#i=e}#a=(E(this,X),E(this,le,``));get component(){return this.#a}set component(e){this.#a=e}#o=(E(this,ue),E(this,fe,{}));get componentProps(){return this.#o}set componentProps(e){this.#o=e}#s=(E(this,pe),E(this,he,`framed`));get variant(){return this.#s}set variant(e){this.#s=e}#c=(E(this,ge),E(this,ve,!1));get minimizable(){return this.#c}set minimizable(e){this.#c=e}#l=(E(this,ye),E(this,xe,`collapse`));get minimizeMode(){return this.#l}set minimizeMode(e){this.#l=e}#u=(E(this,Se),E(this,we,null));get minimizeTarget(){return this.#u}set minimizeTarget(e){this.#u=e}#d=(E(this,Te),E(this,De,!1));get maximizable(){return this.#d}set maximizable(e){this.#d=e}#f=(E(this,Oe),E(this,Ae,!1));get fullscreenable(){return this.#f}set fullscreenable(e){this.#f=e}#p=(E(this,je),E(this,Ne,!1));get movable(){return this.#p}set movable(e){this.#p=e}#m=(E(this,Pe),E(this,Ie,!1));get hideMoveMenu(){return this.#m}set hideMoveMenu(e){this.#m=e}#h=(E(this,Le),E(this,ze,!1));get hideResizeMenu(){return this.#h}set hideResizeMenu(e){this.#h=e}#g=(E(this,Be),E(this,He,!1));get closable(){return this.#g}set closable(e){this.#g=e}#_=(E(this,Ue),E(this,Ge,!1));get minimized(){return this.#_}set minimized(e){this.#_=e}#v=(E(this,Ke),E(this,Je,!1));get maximized(){return this.#v}set maximized(e){this.#v=e}#y=(E(this,Ye),E(this,Ze,!1));get fullscreen(){return this.#y}set fullscreen(e){this.#y=e}#b=(E(this,Qe),E(this,et,!0));get open(){return this.#b}set open(e){this.#b=e}#x=(E(this,tt),E(this,rt,0));get x(){return this.#x}set x(e){this.#x=e}#S=(E(this,it),E(this,ot,0));get y(){return this.#S}set y(e){this.#S=e}#C=(E(this,st),E(this,lt,!1));get resizable(){return this.#C}set resizable(e){this.#C=e}#w=(E(this,ut),E(this,ft,0));get width(){return this.#w}set width(e){this.#w=e}#T=(E(this,pt),E(this,ht,0));get height(){return this.#T}set height(e){this.#T=e}#E=(E(this,gt),E(this,vt,`lg`));get padding(){return this.#E}set padding(e){this.#E=e}#D=(E(this,yt),E(this,xt,!1));get busy(){return this.#D}set busy(e){this.#D=e}#O=(E(this,St),E(this,wt,``));get busyLabel(){return this.#O}set busyLabel(e){this.#O=e}get#k(){return!!this.querySelector(`:scope > [slot="busy"]`)}#A=(E(this,Tt),e=>{this.requestUpdate();let n=e.target.assignedElements(),r=n.some(e=>e.textContent?.trim()||e.hasAttribute(`aria-label`)||[`progressbar`,`status`].includes(e.getAttribute(`role`)??``)||e.localName===`sankhya-ds-brand-loader`||e.localName===`sankhya-ds-spinner`);n.length&&!r&&t(this,`busy-slot-name`,`o conteúdo do slot busy não tem nome acessível: o leitor de tela não ouve o carregamento. Correção: use o sankhya-ds-brand-loader ou dê texto, aria-label ou role="status" ao conteúdo.`)});get frame(){return this.renderRoot?.querySelector(`iframe.frame`)??null}#j=E(this,Dt,!1);get loaded(){return this.#j}set loaded(e){this.#j=e}#M=(E(this,Ot),E(this,At,!1));get dragging(){return this.#M}set dragging(e){this.#M=e}#N=(E(this,jt),E(this,Nt,!1));get moving(){return this.#N}set moving(e){this.#N=e}#P=(E(this,Pt),E(this,It,!1));get landed(){return this.#P}set landed(e){this.#P=e}#F=(E(this,Lt),E(this,zt,0));get reserve(){return this.#F}set reserve(e){this.#F=e}#I=(E(this,Bt),E(this,Q,null));get area(){return this.#I}set area(e){this.#I=e}#L=(E(this,Ht),E(this,Wt,!1));get instant(){return this.#L}set instant(e){this.#L=e}#R=(E(this,Gt),E(this,qt,null));get fit(){return this.#R}set fit(e){this.#R=e}#z=(E(this,Jt),E(this,Xt,``));get announce(){return this.#z}set announce(e){this.#z=e}#B=(E(this,Zt),E(this,$t,!1));get scrollable(){return this.#B}set scrollable(e){this.#B=e}#V=(E(this,$),``);#H(e){this.#V=e,this.announce=``,requestAnimationFrame(()=>this.announce=this.#V)}#U=e=>{let t=e.detail;this.#H(this.#V?`${this.#V}. ${t}`:t)};#W=new m(this);#G=new r(this,`actions`);#K=new i(this,`actions`,`[default]`);get#q(){return this.#G.test(`actions`)||this.#K.leavingFrom(`actions`)}#J=!1;#Y=!1;#X=!1;#Z;#Q=null;#$;#ee=!1;#te;#ne;#re;#ie;#ae;#oe;#se;#ce;connectedCallback(){super.connectedCallback(),this.addEventListener(`keydown`,this.#et),this.addEventListener(`internal:widget-announce`,this.#U),this.addEventListener(`pointerdown`,this.#fe,{capture:!0}),this.addEventListener(`focusin`,this.#me),document.addEventListener(`focusin`,this.#he),window.addEventListener(`blur`,this.#ge),window.addEventListener(`focus`,this.#_e),this.addEventListener(`pointerenter`,this.#Ft),this.addEventListener(`focusin`,this.#Ft),this.#Pt(),this.hasUpdated&&this.fullscreen&&this.#Ie(!0),this.hasUpdated&&this.maximized&&this.#Ae(!0)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`keydown`,this.#et),this.removeEventListener(`internal:widget-announce`,this.#U),this.removeEventListener(`pointerdown`,this.#fe,{capture:!0}),this.removeEventListener(`focusin`,this.#me),document.removeEventListener(`focusin`,this.#he),window.removeEventListener(`blur`,this.#ge),window.removeEventListener(`focus`,this.#_e),this.removeEventListener(`pointerenter`,this.#Ft),this.removeEventListener(`focusin`,this.#Ft),this.#Nt?.(),this.#Nt=void 0,this.#Ie(!1),this.#Ae(!1),this.#ie?.disconnect(),this.#ie=void 0,this.#ae?.disconnect(),this.#ae=void 0,this.#ne?.disconnect(),this.#ne=void 0,this.#re=void 0}#le=!1;#ue=!1;#de(e){this.open&&!this.customStates.has(`leaving`)&&this.emit(`sankhya-ds-activate`,{source:e})}#fe=()=>{this.#de(`pointer`),this.#ue=!0,setTimeout(()=>this.#ue=!1)};#pe(e){return e instanceof Node&&(e===this||this.contains(e))}#me=e=>{let t=e.relatedTarget,n=this.#le&&t!==null?this.#pe(t):this.#le;if(this.#le=!0,n||this.#ue)return;let r=e.composedPath()[0];this.#de(r===this.frame?`frame`:`focus`)};#he=e=>{e.composedPath().includes(this)||(this.#le=!1)};#ge=()=>{setTimeout(()=>{let e=this.frame;if(!e||this.shadowRoot?.activeElement!==e)return;let t=this.#le;this.#le=!0,!t&&!this.#ue&&this.#de(`frame`)})};#_e=()=>{setTimeout(()=>{this.#le=this.matches(`:focus-within`)})};get#ve(){return this.renderRoot.querySelector(`.base`)}get#ye(){return p(this.src,this)}#be(t){let n=(this.sandbox??``).split(/\s+/).filter(Boolean),r=n.filter(e=>A.has(e.toLowerCase())),i=n.filter(e=>!A.has(e.toLowerCase()));i.length&&e(this,`sandbox-token:${i.join(` `)}`,`sandbox: ${i.join(`, `)} não é aceito e foi descartado. Aceitos: ${[...A].join(`, `)}.`);let a=e=>r.some(t=>t.toLowerCase()===e),o=e=>{r=r.filter(t=>t.toLowerCase()!==e)},s=new URL(t,location.href).origin===location.origin;return a(`allow-scripts`)&&a(`allow-same-origin`)&&s&&(e(this,`sandbox-escape`,`sandbox com allow-scripts e allow-same-origin numa página da mesma origem desfaria o isolamento: allow-same-origin foi descartado.`),o(`allow-same-origin`)),a(`allow-popups-to-escape-sandbox`)&&(!a(`allow-popups`)||s)&&(e(this,`sandbox-popups-escape:${s?`origin`:`popups`}`,s?`sandbox com allow-popups-to-escape-sandbox numa página da mesma origem abriria abas sem sandbox com acesso a esta página: allow-popups-to-escape-sandbox foi descartado.`:`sandbox: allow-popups-to-escape-sandbox só vale com allow-popups e foi descartado. Acrescente allow-popups.`),o(`allow-popups-to-escape-sandbox`)),a(`allow-storage-access-by-user-activation`)&&!a(`allow-same-origin`)&&e(this,`sandbox-storage-access`,`sandbox: allow-storage-access-by-user-activation não tem efeito sem allow-same-origin (a página fica com origem opaca e o navegador recusa o pedido).`),r.join(` `)}#xe(){let t=(this.allow??``).split(`;`).map(e=>e.trim().toLowerCase()).filter(Boolean).flatMap(e=>/^[a-z-]+(\s+[a-z-]+)+$/.test(e)?e.split(/\s+/):[e]),n=e=>{let[t,...n]=e.split(/\s+/);return j.includes(t)&&(n.length===0||n.length===1&&n[0]===`'src'`)?t:void 0},r=[...new Set(t.map(n).filter(e=>!!e))],i=t.filter(e=>!n(e));return i.length&&e(this,`allow-token:${i.join(`;`)}`,`allow: ${i.join(`; `).slice(0,80)} não é aceito e foi descartado (só o nome do recurso, que vale para a origem de src). Aceitos: ${j.join(`, `)}.`),r.length?r.join(`; `):void 0}#Se(){let t=this.referrerPolicy??k;return ae.includes(t)?t:(e(this,`referrerpolicy=${String(t)}`,`referrerpolicy="${String(t).slice(0,40)}" não é aceito: vale "${k}". Aceitos: ${ae.join(`, `)}.`),k)}get#Ce(){let t=this.component.trim().toLowerCase();if(t){if(oe.test(t))return t;e(this,`component-invalid`,`component="${this.component.slice(0,40)}" não é um Web Component (o nome precisa de hífen, ex.: "meu-grafico"); nada foi renderizado.`)}}get#we(){return this.parentElement?.localName===`sankhya-ds-widget-area`}get#Te(){return this.minimized&&this.minimizeMode!==`dock`}get#Ee(){return this.minimized&&this.minimizeMode===`dock`}get#De(){return this.variant!==`plain`}willUpdate(t){super.willUpdate(t);let n=(t.has(`minimized`)?!!t.get(`minimized`):this.minimized)&&(t.has(`minimizeMode`)?t.get(`minimizeMode`)===`dock`:this.minimizeMode===`dock`);this.#J=t.has(`open`)&&t.get(`open`)===!1&&this.open||this.hasUpdated&&n&&!this.#Ee&&this.open,t.has(`src`)&&(this.loaded=!1),this.#Oe(t);let r=t.has(`maximized`)||t.has(`fullscreen`),i=t.has(`minimized`)&&this.maximized&&!r&&this.minimizeMode!==`dock`;if((r||i&&u())&&this.hasUpdated&&(this.#$=this.#ve.getBoundingClientRect(),this.#ee=!r||t.has(`minimized`)||this.#Te,this.instant=!0),r){let e=this.maximized||this.fullscreen;e&&!this.reserve&&this.hasUpdated&&!this.#we&&(this.reserve=this.getBoundingClientRect().height),e||(this.reserve=0),this.area=this.maximized&&!this.#we?this.#ke():null}[`src`,`component`,`variant`,`label`,`minimizable`,`maximizable`,`fullscreenable`,`movable`,`closable`,`resizable`].some(e=>t.has(e))&&this.#je();for(let n of[`x`,`y`,`width`,`height`])t.has(n)&&!Number.isFinite(this[n])&&e(this,`${n}-invalid`,`${n}="${String(this[n])}" não é um número: conta como 0.`)}#Oe(t){let n=O.filter(e=>this[e]);if(n.length<2)return;let r=this.hasUpdated&&t.has(`maximized`)&&!t.get(`maximized`);if(n.length===2&&!this.fullscreen&&!r)return;let i=this.hasUpdated?n.find(e=>t.has(e))??n[0]:n[0];this.hasUpdated||e(this,`size-states`,`${n.join(` e `)} juntos: vale ${i}. Use um só.`);for(let e of n)e!==i&&(this[e]=!1)}#ke(){let e=this.parentElement;if(!e)return null;let t=e.getBoundingClientRect(),n=this.getBoundingClientRect(),{width:r,height:i}=g(e);return{left:t.left+e.clientLeft-n.left,top:t.top+e.clientTop-n.top,width:r,height:i}}#Ae(e){this.#te?.disconnect(),e&&this.parentElement&&(this.#te??=new ResizeObserver(()=>{this.maximized&&!this.#we&&(this.area=this.#ke())}),this.#te.observe(this.parentElement))}#je(){this.src&&this.component&&e(this,`src-component`,`src e component juntos: vale src. Use um só.`);let n=this.minimizable||this.maximizable||this.fullscreenable||this.movable||this.closable||this.resizable;!this.#De&&n&&e(this,`plain-controls`,`variant="plain" não mostra barra: minimizable, maximizable, fullscreenable, movable, resizable e closable não têm efeito. Use variant="framed".`),!this.label&&(this.#De&&n||this.src)&&t(this,`no-label`,`widget com controles de janela ou com src sem label: dê um título para a barra, a região e o iframe.`)}updated(t){if(super.updated(t),this.busy&&this.busyLabel&&this.#k&&e(this,`busy-label-slot`,`busy-label é ignorado com o slot busy: o conteúdo do slot traz o próprio texto. Use um só.`),t.has(`open`)||t.has(`minimized`)||t.has(`minimizeMode`)){let e=this.open&&!this.#Ee;if(e)this.#Ge(),this.#Z?.cancel(),this.#Z=void 0,this.#J&&this.minimizeMode===`dock`&&t.has(`minimized`)&&this.#We();else if(this.#X&&!this.#Q&&!this.#Y){let e=this.#Ee&&this.open;this.customStates.set(`leaving`,!0),e&&this.#Ue(),this.#Be(e&&this.matches(`:focus-within`))}this.#Y=!e}this.#X=!0,(t.has(`component`)||t.has(`src`)||t.has(`componentProps`))&&this.#ze(t.has(`component`)||t.has(`src`)),this.#$&&this.#Re(this.#$,this.#ee),this.#$=void 0,this.#ee=!1,t.has(`fullscreen`)&&this.#Ie(this.fullscreen),t.has(`maximized`)&&this.#Ae(this.maximized);let n=this.renderRoot.querySelector(`.header`);n&&!this.#ne&&(this.#ne=new ResizeObserver(()=>this.#Fe(n)),this.#ne.observe(n));let r=this.renderRoot.querySelector(`.body`);r&&!this.#ae?(this.#ae=new ResizeObserver(()=>this.#Xe(r)),this.#ae.observe(r),this.#Ye()):r&&(t.has(`src`)||t.has(`component`)||t.has(`minimized`))&&this.#Xe(r),!this.#ie&&this.parentElement&&(this.#ie=new ResizeObserver(()=>this.#Pe()),this.#ie.observe(this.parentElement),this.#ie.observe(this)),(t.has(`x`)||t.has(`y`)||t.has(`width`)||t.has(`height`))&&this.#Pe(),this.#Ne();let i=[`x`,`y`,`width`,`height`,`maximized`,`fullscreen`,`minimized`,`open`];if(this.#we&&this.hasUpdated&&u()&&!this.#ce&&!this.#se&&[`x`,`y`,`width`,`height`].some(e=>t.has(e))){let e=Number.parseFloat(getComputedStyle(this).getPropertyValue(`--sankhya-ds-opacity-disabled`));this.#ve.animate([{opacity:P(e)},{opacity:1}],l(this,`micro`))}this.#we&&this.hasUpdated&&i.some(e=>t.has(e))&&this.dispatchEvent(new CustomEvent(`internal:widget-geometry`,{detail:{final:!this.#ce&&!this.#se}}))}#Me(){this.customStates.set(`in-area`,this.#we)}#Ne(){let e=(e,t)=>t===null?this.style.removeProperty(e):this.style.setProperty(e,t),t=this.#we;this.#Me();let n=P(this.x),r=P(this.y);e(`--_widget-x`,t?`${n}px`:null),e(`--_widget-y`,t?`${r}px`:null),e(`--_widget-w`,t&&P(this.width)>0?`${P(this.width)}px`:null),e(`--_widget-h`,t&&P(this.height)>0&&!this.#Te?`${P(this.height)}px`:null)}#Pe(){if(this.#we){this.fit&&=null;return}let e=P(this.x),t=P(this.y),n=this.#tt(e,t),r=n.x!==e||n.y!==t?n:null;(r?.x!==this.fit?.x||r?.y!==this.fit?.y)&&(this.fit=r)}#Fe(e){let t=e.offsetHeight,n=this.#re;if(this.#re=t,this.maximized&&this.requestUpdate(),n===void 0||n===t)return;let r=this.renderRoot.querySelector(`.body-wrap`);if(u()){r.animate([{opacity:0},{opacity:1}],l(this,`micro`));return}let i=[{transform:`translateY(${n-t}px)`},{transform:`none`}];r.animate(i,l(this)),e.animate(i,{...l(this),pseudoElement:`::after`})}#Ie(e){document.removeEventListener(`focusin`,this.#Le),e&&document.addEventListener(`focusin`,this.#Le)}#Le=e=>{e.composedPath().includes(this)||(this.renderRoot.querySelector(`[part="fullscreen-button"]:not([data-leaving])`)??this.#ve).focus()};#Re(e,t=!1){let n=this.#ve,r=n.getBoundingClientRect(),i={};this.#gt=i,this.customStates.set(`raised`,!0);let o=()=>{this.#gt===i&&(this.instant=!1,this.#gt=null,this.requestUpdate())};if(t||u()||!r.width||!r.height){n.animate([{opacity:0},{opacity:1}],l(this,`micro`)).finished.then(o,o);return}let s=e.left-r.left,c=e.top-r.top,d=e.width/r.width,f=e.height/r.height;n.animate([{transformOrigin:`top left`,transform:`translate(${s}px, ${c}px) scale(${d}, ${f})`},{transformOrigin:`top left`,transform:`none`}],{...l(this),duration:a(getComputedStyle(this).getPropertyValue(`--sankhya-ds-duration-window`))}).finished.then(o,o)}#ze(t){let n=this.renderRoot.querySelector(`.mount`),r=this.#ye?void 0:this.#Ce;if(!n||!r){this.#oe=void 0;return}if(t||!this.#oe||this.#oe.localName!==r||!n.contains(this.#oe)){let e=[...n.children].filter(e=>!e.hasAttribute(`data-leaving`));for(let t of e)c(t).then(()=>t.remove());this.#oe=document.createElement(r),n.append(this.#oe),this.#ae?.observe(this.#oe),e.length&&o(this.#oe)}let i=this.#oe;for(let[t,n]of Object.entries(this.componentProps??{}))se(t)?i[t]=n:e(this,`component-prop-blocked:${t}`,`componentProps.${t.slice(0,40)} é propriedade nativa do DOM e não é atribuída (só propriedades do Web Component).`)}async#Be(e=!1){let n={};if(this.#Q=n,this.customStates.set(`leaving`,!0),await c(this.#ve),this.#Q!==n)return;this.#Ge();let r=document.activeElement;e&&(!r||r===document.body||this.contains(r)||r===this)&&t(this,`dock-focus`,`o widget foi para o dock com o foco dentro dele, e o foco se perdeu. Correção: no sankhya-ds-minimize, leve o foco ao item do dock (dock.focusItem(id)).`)}#Ve(){if(u())return null;let e=typeof this.minimizeTarget==`function`?this.minimizeTarget():this.minimizeTarget,t=e instanceof Element?e.getBoundingClientRect():e instanceof DOMRect?e:null;return t&&t.width>0&&t.height>0?t:null}#He(e,t){let n=Math.min(t.width/e.width,t.height/e.height);return`translate(${t.left+t.width/2-(e.left+e.width*n/2)}px, ${t.top+t.height/2-(e.top+e.height*n/2)}px) scale(${n})`}#Ue(){let e=this.#ve,t=e.getBoundingClientRect(),n=this.#Ve();n&&t.width&&t.height&&(this.#Z?.cancel(),this.#Z=e.animate([{transformOrigin:`top left`,transform:`none`,opacity:1},{transformOrigin:`top left`,opacity:1,offset:.6},{transformOrigin:`top left`,transform:this.#He(t,n),opacity:0}],{...l(this,`emphasis`),fill:`forwards`}))}#We(){let e=this.#ve,t=e.getBoundingClientRect(),n=this.#Ve();n&&t.width&&t.height&&(this.#Z=e.animate([{transformOrigin:`top left`,transform:this.#He(t,n),opacity:0},{transformOrigin:`top left`,opacity:1,offset:.4},{transformOrigin:`top left`,transform:`none`,opacity:1}],l(this,`emphasis`)))}#Ge(){this.#Q=null,this.customStates.set(`leaving`,!1);let e=this.#ve;e.removeAttribute(`data-leaving`),e.inert=!1}#Ke=()=>{this.emit(`sankhya-ds-close`,void 0,{cancelable:!0}).defaultPrevented||(this.open=!1)};#qe(e){let t=!this[e];if(t)for(let t of O)t!==e&&this[t]&&(e!==`minimized`||t!==`maximized`)&&(this[t]=!1,this.#Je(t));this[e]=t,this.#Je(e)}#Je(e){e===`minimized`?this.emit(`sankhya-ds-minimize`,{minimized:this.minimized}):e===`maximized`?this.emit(`sankhya-ds-maximize`,{maximized:this.maximized}):this.emit(`sankhya-ds-fullscreen`,{fullscreen:this.fullscreen})}#Ye=()=>{let e=this.#ae;if(!e)return;let t=this.renderRoot.querySelector(`.content > slot`);for(let n of t?.assignedElements()??[])e.observe(n);this.#oe&&e.observe(this.#oe)};#Xe(e){let t=!this.#Te&&(e.scrollHeight>e.clientHeight+1||e.scrollWidth>e.clientWidth+1);!t&&this.shadowRoot?.activeElement===e&&this.#ve.focus({preventScroll:!0}),this.scrollable=t}#Ze=()=>this.#qe(`minimized`);#Qe=()=>this.#qe(`maximized`);#$e=()=>this.#qe(`fullscreen`);#et=e=>{if(e.key!==`Escape`||e.defaultPrevented||e.composedPath().some(e=>e.localName===`sankhya-ds-dropdown-menu`&&e.open))return;let t=this.fullscreen?`fullscreen`:this.maximized?`maximized`:void 0;t&&(e.stopPropagation(),this.#qe(t))};#tt(e,t){let n=this.parentElement;if(!n)return{x:e,y:t};if(this.#we){let n=this.#ot(),r=P(this.width)||this.offsetWidth,i=P(this.height)||this.offsetHeight;return{x:Math.round(Math.max(0,Math.min(e,n.width-r))),y:Math.round(Math.max(0,Math.min(t,n.height-i)))}}let r=n.getBoundingClientRect(),i=this.#nt(),a=(e,t,n)=>Math.round(Math.min(Math.max(e,t),Math.max(t,n)));return{x:a(e,r.left-i.left,r.right-i.right),y:a(t,r.top-i.top,r.bottom-i.bottom)}}#nt(){let e=this.getBoundingClientRect(),t=P(this.width)||e.width,n=P(this.height)||e.height;return{left:e.left,top:e.top,right:e.left+t,bottom:e.top+n}}#rt(e,t){let n=this.#tt(e,t);return Math.abs(n.x-P(this.x))<1&&Math.abs(n.y-P(this.y))<1?!1:(this.x=n.x,this.y=n.y,!0)}#it=/* @__PURE__ */ new Map;#at(e,t){let n=this.#it.get(e);if(n!==void 0)return n;let r=Number.parseFloat(getComputedStyle(this).getPropertyValue(e)),i=r>0?r:t;return(this.#ce||this.#se)&&this.#it.set(e,i),i}#ot(){return{width:this.#at(`--_area-bound-w`,1/0),height:this.#at(`--_area-bound-h`,1/0)}}#st(e,t,n=!1){let r=this.#at(`--_area-magnet`,0);if(!this.#we||!r)return e;let i=this.#at(`--_area-step-${t}`,N),a=n?this.#at(`--sankhya-ds-gap-field`,0):0,o=Math.round((e+a)/i)*i-a;return o>=+!!n&&Math.abs(e-o)<=r?o:e}#ct(e=`x`,t=!1){if(!this.#we)return N;let n=getComputedStyle(this),r=e=>Number.parseFloat(n.getPropertyValue(e));return(t?0:r(`--_area-key-${e}`))||r(`--_area-step-${e}`)||N}get#lt(){return this.movable&&this.#De&&!this.maximized&&!this.fullscreen}#ut=e=>{if(!this.#lt||e.button!==0)return;let t=e.composedPath(),n=e.currentTarget;for(let e of t){if(e===n)break;if(e.classList?.contains(`controls`)||e.classList?.contains(`actions`))return}e.preventDefault();try{n.setPointerCapture(e.pointerId)}catch{}this.#it.clear(),this.#ce={id:e.pointerId,sx:e.clientX,sy:e.clientY,ox:P(this.x),oy:P(this.y),moved:!1},this.#mt(),this.dragging=!0,this.moving=!0};#dt=e=>{let t=this.#ce;if(!t||t.id!==e.pointerId)return;if(e.pointerType&&e.buttons===0){this.#vt(e);return}let n=this.#st(t.ox+e.clientX-t.sx,`x`),r=this.#st(t.oy+e.clientY-t.sy,`y`);this.#rt(n,r)&&(t.moved=!0)};#ft(){this.#we&&(this.#ht=!0,this.landed=!1,requestAnimationFrame(()=>this.landed=!0),clearTimeout(this.#pt),this.#pt=setTimeout(()=>this.#mt(),1200))}#pt;#mt(){clearTimeout(this.#pt),this.#ht=!1,this.landed=!1}#ht=!1;#gt=null;#_t=e=>{e.animationName===`sankhya-ds-widget-blink`&&this.#mt()};#vt=e=>{let t=this.#ce;t&&t.id===e.pointerId&&(this.#ce=void 0,this.dragging=!1,this.moving=!1,t.moved&&(this.#ft(),this.emit(`sankhya-ds-move`,{x:P(this.x),y:P(this.y)})))};#yt=e=>{e.stopPropagation(),e.preventDefault(),this.#bt(e.detail.value)};#bt(e,t=!1){if(!this.#lt)return;let n=P(this.x),r=P(this.y),i=this.#ct(`x`,t),a=this.#ct(`y`,t),o={up:[n,r-a],down:[n,r+a],left:[n-i,r],right:[n+i,r],home:[0,0]}[e];o&&(this.#rt(...o)?(this.#H(e===`home`?this.#we?d(`No início da área`):d(`De volta ao lugar`):d(`Movido`)),this.emit(`sankhya-ds-move`,{x:P(this.x),y:P(this.y)})):this.#H(d(`No limite do painel`)))}#xt=e=>{if((e.key===`ContextMenu`||e.key===`F10`&&e.shiftKey)&&e.composedPath()[0]===e.currentTarget&&this.#qt){e.preventDefault(),this.#Jt(e.currentTarget);return}let t=ce[e.key];!t||e.composedPath()[0]!==e.currentTarget||e.ctrlKey||e.metaKey||(e.shiftKey?!this.#Ct:!this.#lt)||(e.preventDefault(),e.shiftKey?this.#Mt(t.size,e.altKey):this.#bt(t.move,e.altKey))};#St=e=>{this.loaded=!0,this.emit(`sankhya-ds-load`,{frame:e.target})};get#Ct(){return this.resizable&&this.#De&&!this.maximized&&!this.fullscreen}#wt(e){return Number.parseFloat(getComputedStyle(this).getPropertyValue(e))||0}#Tt(e,t,n=`se`){let r=this.#wt(`--sankhya-ds-column-min-sm`),i=this.#wt(`--sankhya-ds-space-64`)*2,a=this.parentElement,o=1/0,s=1/0;if(this.#we){let e=this.getBoundingClientRect(),t=this.#ot();o=n.endsWith(`w`)?P(this.x)+(P(this.width)||e.width):t.width-P(this.x),s=n.startsWith(`n`)?P(this.y)+(P(this.height)||e.height):t.height-P(this.y)}else if(a){let e=a.getBoundingClientRect(),t=this.#nt(),r=t.left+P(this.x),i=t.right+P(this.x),c=t.bottom+P(this.y);o=n.endsWith(`w`)?i-(e.left+a.clientLeft):e.left+a.clientLeft+a.clientWidth-r,n.startsWith(`n`)&&(s=c-(e.top+a.clientTop))}return{width:Math.round(Math.min(Math.max(e,r),Math.max(r,o))),height:Math.round(Math.min(Math.max(t,i),Math.max(i,s)))}}#Et(e,t,n=`se`,r){let i=this.#Tt(e,t,n);this.#Te&&(i.height=P(this.height));let a=r??{w:i.width,h:i.height,x:P(this.x),y:P(this.y)},o=n.endsWith(`w`)?a.x+(a.w-i.width):P(this.x),s=n.startsWith(`n`)?a.y+(a.h-i.height):P(this.y),c=(e,t)=>Math.abs(e-t)<1;return c(i.width,P(this.width))&&c(i.height,P(this.height))&&c(o,P(this.x))&&c(s,P(this.y))?!1:(this.width=i.width,this.height=i.height,this.x=Math.round(o),this.y=Math.round(s),!0)}#Dt(){this.emit(`sankhya-ds-resize`,{width:P(this.width),height:P(this.height)})}#Ot=e=>{if(!this.#Ct||e.button!==0)return;let t=e.currentTarget,n=this.#ve.getBoundingClientRect();e.preventDefault();try{t.setPointerCapture(e.pointerId)}catch{}this.#it.clear(),this.#se={id:e.pointerId,corner:t.dataset.corner,sx:e.clientX,sy:e.clientY,w:P(this.width)||n.width,h:P(this.height)||n.height,x:P(this.x),y:P(this.y),moved:!1},this.dragging=!0};#kt=e=>{let t=this.#se;if(!t||t.id!==e.pointerId)return;if(e.pointerType&&e.buttons===0){this.#At(e);return}let n=e.clientX-t.sx,r=e.clientY-t.sy;if(!t.moved&&Math.abs(n)+Math.abs(r)<3)return;t.moved=!0;let{corner:i}=t,a=i.endsWith(`w`)?-n:i.endsWith(`e`)?n:0,o=i.startsWith(`n`)?-r:i.startsWith(`s`)?r:0,s=a?this.#st(t.w+a,`x`,!0):t.w,c=o?this.#st(t.h+o,`y`,!0):t.h;this.#Et(s,c,i,t)};#At=e=>{let t=this.#se;t&&t.id===e.pointerId&&(this.#se=void 0,this.dragging=!1,t.moved&&(this.#Dt(),(t.x!==P(this.x)||t.y!==P(this.y))&&this.emit(`sankhya-ds-move`,{x:P(this.x),y:P(this.y)})))};#jt=e=>{e.stopPropagation(),e.preventDefault(),this.#Mt(e.detail.value)};#Mt(e,t=!1){if(!this.#Ct||this.#Te&&(e===`taller`||e===`shorter`))return;if(e===`auto`){if(!P(this.width)&&(this.#Te||!P(this.height)))return;this.width=0,this.#Te||(this.height=0),this.#H(d(`Tamanho original`)),this.#Dt();return}let n=this.#ve.getBoundingClientRect(),r={wider:[this.#ct(`x`,t),0],narrower:[-this.#ct(`x`,t),0],taller:[0,this.#ct(`y`,t)],shorter:[0,-this.#ct(`y`,t)]}[e];if(!r)return;let i=P(this.width)||n.width,a=P(this.height)||n.height;this.#Et(i+r[0],a+r[1])?(this.#H(d(`Redimensionado`)),this.#Dt()):this.#H(d(`No limite de tamanho`))}#Nt;#Pt(){if(v()||this.#Nt)return;let e=()=>{this.#Nt=void 0,this.#Ft()};if(typeof requestIdleCallback==`function`){let t=requestIdleCallback(e,{timeout:2e3});this.#Nt=()=>cancelIdleCallback(t)}else{let t=setTimeout(e,300);this.#Nt=()=>clearTimeout(t)}}#Ft=()=>{v()||_().catch(()=>void 0)};async#It(t,n){try{await _()}catch{e(this,`menu-load`,`o menu do widget não carregou (rede?). Tente de novo.`);return}await customElements.whenDefined(`sankhya-ds-dropdown-menu`),await t.updateComplete,t.isConnected&&this.#Lt()&&(n?.(),t.show())}#Lt(){let e=document.activeElement;return!e||e===document.body||this.matches(`:focus-within`)}#Rt=e=>{if(v())return;let t=e.currentTarget;e.composedPath().some(e=>e instanceof Element&&e.slot===`trigger`)&&this.#It(t)};#zt=e=>{e.key!==`ArrowDown`&&e.key!==`ArrowUp`||v()||(e.preventDefault(),this.#Rt(e))};#Bt(){return b`<sankhya-ds-dropdown-menu part="resize-menu" class="control" placement="bottom-end" label=${d(`Tamanho do widget`)} @click=${this.#Rt} @keydown=${this.#zt} @sankhya-ds-select=${this.#jt} @sankhya-ds-open=${e=>e.stopPropagation()} @sankhya-ds-close=${e=>e.stopPropagation()} > <sankhya-ds-circle-button slot="trigger" part="resize-button" aria-haspopup="menu" aria-expanded="false" variant="tertiary" size="sm" icon="arrow-resize-diagonal" label=${d(`Redimensionar`)} ></sankhya-ds-circle-button> ${this.#Vt()} </sankhya-ds-dropdown-menu>`}#Vt(e){let t=(t,n,r)=>b`<sankhya-ds-menu-item slot=${e??x} value=${t} icon=${n}>${r}</sankhya-ds-menu-item>`;return b`${t(`wider`,`arrow-right`,d(`Aumentar largura`))}${t(`narrower`,`arrow-left`,d(`Diminuir largura`))}${this.#Te?x:b`${t(`taller`,`arrow-down`,d(`Aumentar altura`))}${t(`shorter`,`arrow-up`,d(`Diminuir altura`))}`}${e?x:b`<hr />`}${t(`auto`,`history`,d(`Tamanho original`))}`}#Ht(){let e=(e,t)=>b`<div part=${`resize-${e}`} class="${e} ${t}" data-corner=${t} @pointerdown=${this.#Ot} @pointermove=${this.#kt} @pointerup=${this.#At} @pointercancel=${this.#At} @lostpointercapture=${this.#At} ></div>`;return b`<div class="corners" aria-hidden="true"> ${(this.#Te?[`w`,`e`]:ie).map(t=>e(`edge`,t))} ${this.#Te?x:re.map(t=>e(`corner`,t))} </div>`}#Ut(e,t,n,r){return b`<sankhya-ds-circle-button class="control" part=${e} variant="tertiary" size="sm" icon=${t} label=${n} @click=${r} ></sankhya-ds-circle-button>`}#Wt(){return b`<sankhya-ds-dropdown-menu part="move-menu" class="control" placement="bottom-end" label=${d(`Mover widget`)} @click=${this.#Rt} @keydown=${this.#zt} @sankhya-ds-select=${this.#yt} @sankhya-ds-open=${e=>e.stopPropagation()} @sankhya-ds-close=${e=>e.stopPropagation()} > <sankhya-ds-circle-button slot="trigger" part="move-button" aria-haspopup="menu" aria-expanded="false" variant="tertiary" size="sm" icon="draggabledots" label=${d(`Mover`)} ></sankhya-ds-circle-button> ${this.#Gt()} </sankhya-ds-dropdown-menu>`}#Gt(e){let t=(t,n,r)=>b`<sankhya-ds-menu-item slot=${e??x} value=${t} icon=${n}>${r}</sankhya-ds-menu-item>`;return b`${t(`up`,`arrow-up`,d(`Mover para cima`))}${t(`down`,`arrow-down`,d(`Mover para baixo`))}${t(`left`,`arrow-left`,d(`Mover para a esquerda`))}${t(`right`,`arrow-right`,d(`Mover para a direita`))}${e?x:b`<hr />`}${t(`home`,`history`,this.#we?d(`Mover para o início`):d(`Voltar ao lugar`))}`}#Kt(e,t){return b`<span id="ctx-anchor" class="ctx-anchor" aria-hidden="true"></span> <sankhya-ds-dropdown-menu part="context-menu" for="ctx-anchor" placement="bottom-start" distance="0" label=${d(`Opções do widget`)} @sankhya-ds-select=${this.#Xt} @sankhya-ds-open=${e=>e.stopPropagation()} @sankhya-ds-close=${this.#Zt} > ${e&&t?b`<sankhya-ds-menu-item icon="draggabledots" >${d(`Mover`)}${this.#Gt(`submenu`)}</sankhya-ds-menu-item ><sankhya-ds-menu-item icon="arrow-resize-diagonal" >${d(`Redimensionar`)}${this.#Vt(`submenu`)}</sankhya-ds-menu-item >`:e?this.#Gt():this.#Vt()} </sankhya-ds-dropdown-menu>`}get#qt(){return this.renderRoot.querySelector(`[part="context-menu"]`)}#Jt(e,t,n){let r=this.#qt,i=e.getBoundingClientRect(),a=()=>{let e=this.renderRoot.querySelector(`.ctx-anchor`);e.style.left=`${t===void 0?0:t-i.left}px`,e.style.top=`${n===void 0?i.height:n-i.top}px`};v()?(a(),r.show()):this.#It(r,a)}#Yt=e=>{let t=e.composedPath()[0];this.#qt&&!t.closest?.(`.tools`)&&(e.preventDefault(),this.#Jt(e.currentTarget,e.clientX,e.clientY))};#Xt=e=>{[`up`,`down`,`left`,`right`,`home`].includes(e.detail.value)?this.#yt(e):this.#jt(e)};#Zt=e=>{e.stopPropagation();let t=e.currentTarget,n=this.renderRoot.activeElement;(!n&&(document.activeElement===document.body||document.activeElement===this)||n&&t.contains(n))&&this.renderRoot.querySelector(`[part="header"]`).focus()};#Qt(e){let t=!this.maximized&&!this.fullscreen,n=this.minimizeMode===`dock`,r=b`${s(this.movable&&t&&!this.hideMoveMenu,()=>b`<span class="control-wrap">${this.#Wt()}</span>`)}${s(this.#Ct&&!this.hideResizeMenu,()=>b`<span class="control-wrap">${this.#Bt()}</span>`)}${s(this.minimizable,()=>this.#Ut(`minimize-button`,this.minimized?n?`window-restore`:`angle-down`:`minus`,this.minimized?d(n?`Restaurar`:`Expandir`):d(n?`Minimizar`:`Recolher`),this.#Ze))}${s(this.maximizable,()=>this.#Ut(`maximize-button`,this.maximized?`window-restore`:`window-maximize`,this.maximized?d(`Restaurar tamanho`):d(`Maximizar`),this.#Qe))}${s(this.fullscreenable,()=>this.#Ut(`fullscreen-button`,this.fullscreen?`compress-arrows`:`expand-arrows-alt`,this.fullscreen?d(`Sair da tela cheia`):d(`Tela cheia`),this.#$e))}${s(this.closable,()=>this.#Ut(`close-button`,`times`,d(`Fechar`),this.#Ke))}`,i=this.#lt&&this.hideMoveMenu,a=this.#Ct&&this.hideResizeMenu,o=i||a,c=this.#lt&&this.#Ct?d(`Use as setas para mover e Shift + setas para redimensionar. Shift + F10 abre as opções.`):this.#lt?d(`Use as setas para mover. Shift + F10 abre as opções.`):d(`Use Shift + setas para redimensionar. Shift + F10 abre as opções.`),l=this.#we?`${c} ${d(`Com Alt, uma célula por vez.`)}`:c;return b`<div class=${w({"header-wrap":!0,shown:e})} ?inert=${!e}> <div class="header-clip"> <div part="header" class=${w({header:!0,grab:this.#lt})} tabindex=${o?`0`:x} role=${o?`group`:x} aria-labelledby=${o&&this.label?`title`:x} aria-label=${o&&!this.label?d(`Barra do widget`):x} aria-describedby=${o?`keys`:x} @keydown=${this.#xt} @contextmenu=${this.#Yt} @pointerdown=${this.#ut} @pointermove=${this.#dt} @pointerup=${this.#vt} @pointercancel=${this.#vt} @lostpointercapture=${this.#vt} > <div class="title-box"> <span class="title-measure" aria-hidden="true">${this.label}</span> <div part="title" id="title" class="title" @pointerenter=${this.#W.check}>${this.label}</div> ${this.#W.render(`title`,this.label)} </div> <div class="tools"> <div part="actions" class="actions" ?hidden=${!this.#q}> <slot name="actions"></slot> </div> <div part="controls" class="controls">${r}</div> </div> ${o?b`<span id="keys" class="visually-hidden">${l}</span>`:x} ${o?this.#Kt(i,a):x} </div> </div> </div>`}#$t(){let e=this.#ye;return e?b`<iframe part="frame" class="frame" src=${e} title=${this.label||d(`Conteúdo do widget`)} sandbox=${this.#be(e)} allow=${ee(this.#xe())} referrerpolicy=${this.#Se()} @load=${this.#St} ></iframe> <div class="loading-layer sankhya-ds-swap" aria-hidden="true"> ${s(!this.loaded,()=>b`<sankhya-ds-skeleton part="loading" class="loading" shape="rect" ></sankhya-ds-skeleton>`)} </div>`:this.#Ce?b`<div class="mount"></div>`:b`<slot @slotchange=${this.#Ye}></slot>`}render(){let e=this.#De,t=this.minimizable||this.maximizable||this.fullscreenable||this.movable||this.closable||this.resizable,n=e&&!!(this.label||t||this.#q),r=this.#ye,i=!!r||this.padding===`none`,a=D.includes(this.padding)?this.padding:`lg`,o=this.maximized||this.fullscreen,c=this.fit?.x??P(this.x),l=this.fit?.y??P(this.y),u=this.#we,p=o||u?`none`:`${c}px ${l}px`,m=this.maximized&&!u&&this.area,g=!o&&!u,_=g&&P(this.width)>0?`${P(this.width)}px`:void 0,v=g&&!this.#Te&&P(this.height)>0?`${P(this.height)}px`:void 0,y=this.#re,S=this.maximized&&e&&y!==void 0,C=S&&this.#Te,ee=m?`${m.height}px`:`var(--_area-height, 100%)`;return this.customStates.set(`raised`,this.dragging||this.landed||this.#ht||!!this.#gt),this.customStates.set(`sized`,!!v),b`<section part="base" class=${w({base:!0,framed:e,bare:e&&!n,entering:this.#J,dragging:this.dragging,moving:this.moving,landed:this.landed,instant:this.instant,shifted:!o&&!u&&(c!==0||l!==0)})} style=${h({translate:p,left:m?`${m.left}px`:void 0,top:m?`${m.top}px`:void 0,width:m?`${m.width}px`:_,height:C?`${y}px`:m?`${m.height}px`:v,"--_widget-body":S?`calc(${ee} - ${y}px)`:void 0})} @animationend=${this.#_t} tabindex="-1" aria-labelledby=${this.label&&n?`title`:x} aria-label=${this.label&&!n?this.label:x} > ${e?this.#Qt(n):b`<slot name="actions" hidden></slot>`} <div class="body-wrap" ?inert=${this.#Te&&e}> <div part="body" class="body" ?inert=${this.busy} aria-busy=${this.busy||r&&!this.loaded?`true`:x} tabindex=${this.scrollable?`0`:x} role=${this.scrollable?`group`:x} aria-label=${this.scrollable?this.label?d(f`Conteúdo de ${this.label}`):d(`Conteúdo do widget`):x} > <div class=${w({content:!0,flush:i,[`pad-${a}`]:!0})}> ${this.#$t()} </div> </div> <div class="busy-layer sankhya-ds-swap"> ${s(this.busy,()=>b`<div part="busy" class=${w({busy:!0,solid:!!r||this.#k})} > <slot name="busy" @slotchange=${this.#A} ><sankhya-ds-spinner size="lg" block label=${this.busyLabel}></sankhya-ds-spinner ></slot> </div>`)} </div> </div> ${this.#Ct?this.#Ht():x} <div class="visually-hidden" role="status">${this.announce}</div> </section> ${this.reserve?b`<div class="reserve" style=${h({blockSize:`${this.reserve}px`})}></div>`:x}`}}})();function I(e){return{has:t=>e in t,get:t=>t[e],set:(t,n)=>{t[e]=n}}}export{F as SankhyaDsWidget};