@prefecthq/prefab-ui 0.18.2 → 0.18.4

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.
@@ -71,7 +71,12 @@ from typing import Any
71
71
  import pydantic_core
72
72
  from pydantic import BaseModel, Field, PrivateAttr, model_validator
73
73
 
74
- from prefab_ui.renderer import _get_origin, get_renderer_csp, get_renderer_head
74
+ from prefab_ui.renderer import (
75
+ RendererMode,
76
+ _get_origin,
77
+ get_renderer_csp,
78
+ get_renderer_head,
79
+ )
75
80
  from prefab_ui.rx import _sanitize_floats
76
81
  from prefab_ui.themes import Theme
77
82
 
@@ -342,6 +347,9 @@ class PrefabApp(BaseModel):
342
347
  def html(
343
348
  self,
344
349
  *,
350
+ renderer_mode: RendererMode | None = None,
351
+ cdn_version: str | None = None,
352
+ pretty: bool = False,
345
353
  tool_resolver: Callable[[Any], ResolvedTool] | None = None,
346
354
  ) -> str:
347
355
  """Produce a complete, self-contained HTML page.
@@ -349,8 +357,16 @@ class PrefabApp(BaseModel):
349
357
  The page includes the Prefab renderer (JS/CSS), any user-specified
350
358
  stylesheets and scripts, and the application data baked in as a
351
359
  JSON \`<script>\` tag.
360
+
361
+ \`renderer_mode\` controls how the renderer is delivered: \`"cdn"\`
362
+ (lightweight stub loading JS from jsDelivr, pinned to the installed
363
+ version) or \`"bundled"\` (all JS/CSS inlined, no network needed).
364
+ When \`None\`, the mode is resolved automatically.
365
+
366
+ \`cdn_version\` overrides the version pinned in CDN URLs. Ignored
367
+ in bundled mode.
352
368
  """
353
- head_parts = [get_renderer_head()]
369
+ head_parts = [get_renderer_head(mode=renderer_mode, cdn_version=cdn_version)]
354
370
 
355
371
  if self.stylesheets:
356
372
  for entry in self.stylesheets:
@@ -380,10 +396,16 @@ class PrefabApp(BaseModel):
380
396
  f" <script>\\nwindow.__prefab_handlers = {{\\n{obj}\\n}};\\n <\/script>"
381
397
  )
382
398
 
383
- data_json = json.dumps(
384
- self.to_json(tool_resolver=tool_resolver),
385
- separators=(",", ":"),
386
- )
399
+ if pretty:
400
+ data_json = json.dumps(
401
+ self.to_json(tool_resolver=tool_resolver),
402
+ indent=2,
403
+ )
404
+ else:
405
+ data_json = json.dumps(
406
+ self.to_json(tool_resolver=tool_resolver),
407
+ separators=(",", ":"),
408
+ )
387
409
  # Escape </ to prevent premature closing of the script tag
388
410
  safe_json = data_json.replace("</", r"<\\/")
389
411
 
@@ -393,13 +415,20 @@ class PrefabApp(BaseModel):
393
415
  data=safe_json,
394
416
  )
395
417
 
396
- def csp(self) -> dict[str, list[str]]:
418
+ def csp(
419
+ self,
420
+ *,
421
+ renderer_mode: RendererMode | None = None,
422
+ ) -> dict[str, list[str]]:
397
423
  """Compute CSP domains from the app's asset configuration.
398
424
 
399
425
  Merges the renderer's base CSP with origins extracted from
400
426
  \`stylesheets\`, \`scripts\`, and \`connect_domains\`.
427
+
428
+ \`renderer_mode\` should match the mode passed to \`html()\` so
429
+ the CSP allows the same resources the page actually loads.
401
430
  """
402
- result = get_renderer_csp()
431
+ result = get_renderer_csp(mode=renderer_mode)
403
432
 
404
433
  if self.connect_domains:
405
434
  result["connect_domains"] = list(self.connect_domains)
@@ -2690,7 +2719,8 @@ class Carousel(ContainerComponent):
2690
2719
  effect: Visual transition effect.
2691
2720
  dim_inactive: Reduce opacity of non-active slides.
2692
2721
  show_controls: Show navigation arrows.
2693
- controls_position: Position controls over slides or outside the viewport.
2722
+ controls_position: Position controls over slides, outside the viewport,
2723
+ or in the same gutter as pagination dots.
2694
2724
  show_dots: Show pagination dots.
2695
2725
  pause_on_hover: Pause auto-advance/continuous scroll on hover.
2696
2726
  align: Slide alignment within the viewport.
@@ -2755,10 +2785,10 @@ class Carousel(ContainerComponent):
2755
2785
  alias="showControls",
2756
2786
  description="Show previous/next navigation arrows",
2757
2787
  )
2758
- controls_position: Literal["overlay", "outside"] = Field(
2788
+ controls_position: Literal["overlay", "outside", "gutter"] = Field(
2759
2789
  default="outside",
2760
2790
  alias="controlsPosition",
2761
- description="Position controls over slides (overlay) or outside the viewport",
2791
+ description="Position controls over slides (overlay), outside the viewport, or in the dots gutter",
2762
2792
  )
2763
2793
  show_dots: bool = Field(
2764
2794
  default=False,
@@ -9175,7 +9205,6 @@ _CDN_TEMPLATE = """\\
9175
9205
  _CDN_HEAD = """\\
9176
9206
  <meta charset="UTF-8">
9177
9207
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
9178
- <title>Prefab</title>
9179
9208
  <link rel="stylesheet" crossorigin href="{base_url}/renderer.css">
9180
9209
  <script type="module" crossorigin src="{base_url}/renderer.js"><\/script>"""
9181
9210
 
@@ -9198,7 +9227,6 @@ _EXTERNAL_TEMPLATE = """\\
9198
9227
  _EXTERNAL_HEAD = """\\
9199
9228
  <meta charset="UTF-8">
9200
9229
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
9201
- <title>Prefab</title>
9202
9230
  <link rel="stylesheet" crossorigin href="{base_url}/renderer.css">
9203
9231
  <script type="module" crossorigin src="{base_url}/renderer.js"><\/script>"""
9204
9232
 
@@ -9262,18 +9290,28 @@ def _get_bundled_html() -> str:
9262
9290
  return _BUNDLED_HTML.read_text(encoding="utf-8")
9263
9291
 
9264
9292
 
9265
- def get_renderer_head(mode: RendererMode | None = None) -> str:
9293
+ def get_renderer_head(
9294
+ mode: RendererMode | None = None,
9295
+ *,
9296
+ cdn_version: str | None = None,
9297
+ ) -> str:
9266
9298
  """Return the renderer \`\`<head>\`\` content (JS, CSS, meta tags).
9267
9299
 
9268
9300
  For CDN mode, returns \`\`<link>\`\`/\`\`<script>\`\` tags pointing at
9269
9301
  jsDelivr. For bundled mode, extracts everything between \`\`<head>\`\`
9270
9302
  and \`\`</head>\`\` from the self-contained HTML. For external URL
9271
9303
  overrides, returns tags pointing at that URL.
9304
+
9305
+ \`cdn_version\` overrides the version used in CDN URLs. When \`None\`,
9306
+ defaults to the installed version (or \`"latest"\` for dev builds).
9272
9307
  """
9273
9308
  resolved = _resolve_mode(mode)
9274
9309
 
9275
9310
  if resolved == "cdn":
9276
- base_url = _cdn_base_url(_get_version())
9311
+ version = cdn_version or _get_version()
9312
+ if cdn_version is None and _is_dev_version(version):
9313
+ version = "latest"
9314
+ base_url = _cdn_base_url(version)
9277
9315
  return _CDN_HEAD.format(base_url=base_url)
9278
9316
 
9279
9317
  if resolved == "bundled":
@@ -9620,6 +9658,7 @@ _OP_PREC: dict[str, int] = {
9620
9658
  "-": _PREC_ADD,
9621
9659
  "*": _PREC_MUL,
9622
9660
  "/": _PREC_MUL,
9661
+ "%": _PREC_MUL,
9623
9662
  "==": _PREC_COMP,
9624
9663
  "!=": _PREC_COMP,
9625
9664
  ">": _PREC_COMP,
@@ -9783,6 +9822,12 @@ class Rx:
9783
9822
  def __rtruediv__(self, other: object) -> Rx:
9784
9823
  return Rx(_BinOp("/", other, self), _PREC_MUL)
9785
9824
 
9825
+ def __mod__(self, other: object) -> Rx:
9826
+ return Rx(_BinOp("%", self, other), _PREC_MUL)
9827
+
9828
+ def __rmod__(self, other: object) -> Rx:
9829
+ return Rx(_BinOp("%", other, self), _PREC_MUL)
9830
+
9786
9831
  def __neg__(self) -> Rx:
9787
9832
  return Rx(_UnaryOp("-", self), _PREC_UNARY)
9788
9833
 
@@ -0,0 +1 @@
1
+ import{r as K,g as Tt,j as H,c as Jt,h as dn,i as pn,k as gn,l as mn}from"./renderer.js";function hn(t){return Object.prototype.toString.call(t)==="[object Object]"}function qt(t){return hn(t)||Array.isArray(t)}function yn(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function Ct(t,n){const e=Object.keys(t),i=Object.keys(n);if(e.length!==i.length)return!1;const o=JSON.stringify(Object.keys(t.breakpoints||{})),r=JSON.stringify(Object.keys(n.breakpoints||{}));return o!==r?!1:e.every(s=>{const c=t[s],l=n[s];return typeof c=="function"?`${c}`==`${l}`:!qt(c)||!qt(l)?c===l:Ct(c,l)})}function Yt(t){return t.concat().sort((n,e)=>n.name>e.name?1:-1).map(n=>n.options)}function Sn(t,n){if(t.length!==n.length)return!1;const e=Yt(t),i=Yt(n);return e.every((o,r)=>{const s=i[r];return Ct(o,s)})}function Ft(t){return typeof t=="number"}function Pt(t){return typeof t=="string"}function wt(t){return typeof t=="boolean"}function Kt(t){return Object.prototype.toString.call(t)==="[object Object]"}function X(t){return Math.abs(t)}function kt(t){return Math.sign(t)}function ht(t,n){return X(t-n)}function bn(t,n){if(t===0||n===0||X(t)<=X(n))return 0;const e=ht(X(t),X(n));return X(e/t)}function xn(t){return Math.round(t*100)/100}function yt(t){return St(t).map(Number)}function it(t){return t[xt(t)]}function xt(t){return Math.max(0,t.length-1)}function jt(t,n){return n===xt(t)}function Xt(t,n=0){return Array.from(Array(t),(e,i)=>n+i)}function St(t){return Object.keys(t)}function Zt(t,n){return[t,n].reduce((e,i)=>(St(i).forEach(o=>{const r=e[o],s=i[o],c=Kt(r)&&Kt(s);e[o]=c?Zt(r,s):s}),e),{})}function At(t,n){return typeof n.MouseEvent<"u"&&t instanceof n.MouseEvent}function vn(t,n){const e={start:i,center:o,end:r};function i(){return 0}function o(l){return r(l)/2}function r(l){return n-l}function s(l,a){return Pt(t)?e[t](l):t(n,l,a)}return{measure:s}}function bt(){let t=[];function n(o,r,s,c={passive:!0}){let l;if("addEventListener"in o)o.addEventListener(r,s,c),l=()=>o.removeEventListener(r,s,c);else{const a=o;a.addListener(s),l=()=>a.removeListener(s)}return t.push(l),i}function e(){t=t.filter(o=>o())}const i={add:n,clear:e};return i}function En(t,n,e,i){const o=bt(),r=1e3/60;let s=null,c=0,l=0;function a(){o.add(t,"visibilitychange",()=>{t.hidden&&p()})}function y(){x(),o.clear()}function f(m){if(!l)return;s||(s=m,e(),e());const u=m-s;for(s=m,c+=u;c>=r;)e(),c-=r;const S=c/r;i(S),l&&(l=n.requestAnimationFrame(f))}function d(){l||(l=n.requestAnimationFrame(f))}function x(){n.cancelAnimationFrame(l),s=null,c=0,l=0}function p(){s=null,c=0}return{init:a,destroy:y,start:d,stop:x,update:e,render:i}}function On(t,n){const e=n==="rtl",i=t==="y",o=i?"y":"x",r=i?"x":"y",s=!i&&e?-1:1,c=y(),l=f();function a(p){const{height:g,width:m}=p;return i?g:m}function y(){return i?"top":e?"right":"left"}function f(){return i?"bottom":e?"left":"right"}function d(p){return p*s}return{scroll:o,cross:r,startEdge:c,endEdge:l,measureSize:a,direction:d}}function ut(t=0,n=0){const e=X(t-n);function i(a){return a<t}function o(a){return a>n}function r(a){return i(a)||o(a)}function s(a){return r(a)?i(a)?t:n:a}function c(a){return e?a-e*Math.ceil((a-n)/e):a}return{length:e,max:n,min:t,constrain:s,reachedAny:r,reachedMax:o,reachedMin:i,removeOffset:c}}function Wt(t,n,e){const{constrain:i}=ut(0,t),o=t+1;let r=s(n);function s(d){return e?X((o+d)%o):i(d)}function c(){return r}function l(d){return r=s(d),f}function a(d){return y().set(c()+d)}function y(){return Wt(t,c(),e)}const f={get:c,set:l,add:a,clone:y};return f}function wn(t,n,e,i,o,r,s,c,l,a,y,f,d,x,p,g,m,u,S){const{cross:v,direction:A}=t,F=["INPUT","SELECT","TEXTAREA"],D={passive:!1},M=bt(),P=bt(),w=ut(50,225).constrain(x.measure(20)),h={mouse:300,touch:400},L={mouse:500,touch:600},U=p?43:25;let G=!1,b=0,O=0,T=!1,I=!1,C=!1,k=!1;function N(E){if(!S)return;function z(W){(wt(S)||S(E,W))&&ot(W)}const q=n;M.add(q,"dragstart",W=>W.preventDefault(),D).add(q,"touchmove",()=>{},D).add(q,"touchend",()=>{}).add(q,"touchstart",z).add(q,"mousedown",z).add(q,"touchcancel",V).add(q,"contextmenu",V).add(q,"click",nt,!0)}function j(){M.clear(),P.clear()}function R(){const E=k?e:n;P.add(E,"touchmove",Z,D).add(E,"touchend",V).add(E,"mousemove",Z,D).add(E,"mouseup",V)}function $(E){const z=E.nodeName||"";return F.includes(z)}function _(){return(p?L:h)[k?"mouse":"touch"]}function J(E,z){const q=f.add(kt(E)*-1),W=y.byDistance(E,!p).distance;return p||X(E)<w?W:m&&z?W*.5:y.byIndex(q.get(),0).distance}function ot(E){const z=At(E,i);k=z,C=p&&z&&!E.buttons&&G,G=ht(o.get(),s.get())>=2,!(z&&E.button!==0)&&($(E.target)||(T=!0,r.pointerDown(E),a.useFriction(0).useDuration(0),o.set(s),R(),b=r.readPoint(E),O=r.readPoint(E,v),d.emit("pointerDown")))}function Z(E){if(!At(E,i)&&E.touches.length>=2)return V(E);const q=r.readPoint(E),W=r.readPoint(E,v),rt=ht(q,b),st=ht(W,O);if(!I&&!k&&(!E.cancelable||(I=rt>st,!I)))return V(E);const ct=r.pointerMove(E);rt>g&&(C=!0),a.useFriction(.3).useDuration(.75),c.start(),o.add(A(ct)),E.preventDefault()}function V(E){const q=y.byDistance(0,!1).index!==f.get(),W=r.pointerUp(E)*_(),rt=J(A(W),q),st=bn(W,rt),ct=U-10*st,lt=u+st/50;I=!1,T=!1,P.clear(),a.useDuration(ct).useFriction(lt),l.distance(rt,!p),k=!1,d.emit("pointerUp")}function nt(E){C&&(E.stopPropagation(),E.preventDefault(),C=!1)}function Q(){return T}return{init:N,destroy:j,pointerDown:Q}}function In(t,n){let i,o;function r(f){return f.timeStamp}function s(f,d){const p=`client${(d||t.scroll)==="x"?"X":"Y"}`;return(At(f,n)?f:f.touches[0])[p]}function c(f){return i=f,o=f,s(f)}function l(f){const d=s(f)-s(o),x=r(f)-r(i)>170;return o=f,x&&(i=f),d}function a(f){if(!i||!o)return 0;const d=s(o)-s(i),x=r(f)-r(i),p=r(f)-r(o)>170,g=d/x;return x&&!p&&X(g)>.1?g:0}return{pointerDown:c,pointerMove:l,pointerUp:a,readPoint:s}}function Dn(){function t(e){const{offsetTop:i,offsetLeft:o,offsetWidth:r,offsetHeight:s}=e;return{top:i,right:o+r,bottom:i+s,left:o,width:r,height:s}}return{measure:t}}function Ln(t){function n(i){return t*(i/100)}return{measure:n}}function Tn(t,n,e,i,o,r,s){const c=[t].concat(i);let l,a,y=[],f=!1;function d(m){return o.measureSize(s.measure(m))}function x(m){if(!r)return;a=d(t),y=i.map(d);function u(S){for(const v of S){if(f)return;const A=v.target===t,F=i.indexOf(v.target),D=A?a:y[F],M=d(A?t:i[F]);if(X(M-D)>=.5){m.reInit(),n.emit("resize");break}}}l=new ResizeObserver(S=>{(wt(r)||r(m,S))&&u(S)}),e.requestAnimationFrame(()=>{c.forEach(S=>l.observe(S))})}function p(){f=!0,l&&l.disconnect()}return{init:x,destroy:p}}function Mn(t,n,e,i,o,r){let s=0,c=0,l=o,a=r,y=t.get(),f=0;function d(){const D=i.get()-t.get(),M=!l;let P=0;return M?(s=0,e.set(i),t.set(i),P=D):(e.set(t),s+=D/l,s*=a,y+=s,t.add(s),P=y-f),c=kt(P),f=y,F}function x(){const D=i.get()-n.get();return X(D)<.001}function p(){return l}function g(){return c}function m(){return s}function u(){return v(o)}function S(){return A(r)}function v(D){return l=D,F}function A(D){return a=D,F}const F={direction:g,duration:p,velocity:m,seek:d,settled:x,useBaseFriction:S,useBaseDuration:u,useFriction:A,useDuration:v};return F}function Pn(t,n,e,i,o){const r=o.measure(10),s=o.measure(50),c=ut(.1,.99);let l=!1;function a(){return!(l||!t.reachedAny(e.get())||!t.reachedAny(n.get()))}function y(x){if(!a())return;const p=t.reachedMin(n.get())?"min":"max",g=X(t[p]-n.get()),m=e.get()-n.get(),u=c.constrain(g/s);e.subtract(m*u),!x&&X(m)<r&&(e.set(t.constrain(e.get())),i.useDuration(25).useBaseFriction())}function f(x){l=!x}return{shouldConstrain:a,constrain:y,toggleActive:f}}function An(t,n,e,i,o){const r=ut(-n+t,0),s=f(),c=y(),l=d();function a(p,g){return ht(p,g)<=1}function y(){const p=s[0],g=it(s),m=s.lastIndexOf(p),u=s.indexOf(g)+1;return ut(m,u)}function f(){return e.map((p,g)=>{const{min:m,max:u}=r,S=r.constrain(p),v=!g,A=jt(e,g);return v?u:A||a(m,S)?m:a(u,S)?u:S}).map(p=>parseFloat(p.toFixed(3)))}function d(){if(n<=t+o)return[r.max];if(i==="keepSnaps")return s;const{min:p,max:g}=c;return s.slice(p,g)}return{snapsContained:l,scrollContainLimit:c}}function Cn(t,n,e){const i=n[0],o=e?i-t:it(n);return{limit:ut(o,i)}}function Fn(t,n,e,i){const r=n.min+.1,s=n.max+.1,{reachedMin:c,reachedMax:l}=ut(r,s);function a(d){return d===1?l(e.get()):d===-1?c(e.get()):!1}function y(d){if(!a(d))return;const x=t*(d*-1);i.forEach(p=>p.add(x))}return{loop:y}}function kn(t){const{max:n,length:e}=t;function i(r){const s=r-n;return e?s/-e:0}return{get:i}}function jn(t,n,e,i,o){const{startEdge:r,endEdge:s}=t,{groupSlides:c}=o,l=f().map(n.measure),a=d(),y=x();function f(){return c(i).map(g=>it(g)[s]-g[0][r]).map(X)}function d(){return i.map(g=>e[r]-g[r]).map(g=>-X(g))}function x(){return c(a).map(g=>g[0]).map((g,m)=>g+l[m])}return{snaps:a,snapsAligned:y}}function Nn(t,n,e,i,o,r){const{groupSlides:s}=o,{min:c,max:l}=i,a=y();function y(){const d=s(r),x=!t||n==="keepSnaps";return e.length===1?[r]:x?d:d.slice(c,l).map((p,g,m)=>{const u=!g,S=jt(m,g);if(u){const v=it(m[0])+1;return Xt(v)}if(S){const v=xt(r)-it(m)[0]+1;return Xt(v,it(m)[0])}return p})}return{slideRegistry:a}}function Bn(t,n,e,i,o){const{reachedAny:r,removeOffset:s,constrain:c}=i;function l(p){return p.concat().sort((g,m)=>X(g)-X(m))[0]}function a(p){const g=t?s(p):c(p),m=n.map((S,v)=>({diff:y(S-g,0),index:v})).sort((S,v)=>X(S.diff)-X(v.diff)),{index:u}=m[0];return{index:u,distance:g}}function y(p,g){const m=[p,p+e,p-e];if(!t)return p;if(!g)return l(m);const u=m.filter(S=>kt(S)===g);return u.length?l(u):it(m)-e}function f(p,g){const m=n[p]-o.get(),u=y(m,g);return{index:p,distance:u}}function d(p,g){const m=o.get()+p,{index:u,distance:S}=a(m),v=!t&&r(m);if(!g||v)return{index:u,distance:p};const A=n[u]-S,F=p+y(A,0);return{index:u,distance:F}}return{byDistance:d,byIndex:f,shortcut:y}}function Rn(t,n,e,i,o,r,s){function c(f){const d=f.distance,x=f.index!==n.get();r.add(d),d&&(i.duration()?t.start():(t.update(),t.render(1),t.update())),x&&(e.set(n.get()),n.set(f.index),s.emit("select"))}function l(f,d){const x=o.byDistance(f,d);c(x)}function a(f,d){const x=n.clone().set(f),p=o.byIndex(x.get(),d);c(p)}return{distance:l,index:a}}function zn(t,n,e,i,o,r,s,c){const l={passive:!0,capture:!0};let a=0;function y(x){if(!c)return;function p(g){if(new Date().getTime()-a>10)return;s.emit("slideFocusStart"),t.scrollLeft=0;const S=e.findIndex(v=>v.includes(g));Ft(S)&&(o.useDuration(0),i.index(S,0),s.emit("slideFocus"))}r.add(document,"keydown",f,!1),n.forEach((g,m)=>{r.add(g,"focus",u=>{(wt(c)||c(x,u))&&p(m)},l)})}function f(x){x.code==="Tab"&&(a=new Date().getTime())}return{init:y}}function mt(t){let n=t;function e(){return n}function i(l){n=s(l)}function o(l){n+=s(l)}function r(l){n-=s(l)}function s(l){return Ft(l)?l:l.get()}return{get:e,set:i,add:o,subtract:r}}function tn(t,n){const e=t.scroll==="x"?s:c,i=n.style;let o=null,r=!1;function s(d){return`translate3d(${d}px,0px,0px)`}function c(d){return`translate3d(0px,${d}px,0px)`}function l(d){if(r)return;const x=xn(t.direction(d));x!==o&&(i.transform=e(x),o=x)}function a(d){r=!d}function y(){r||(i.transform="",n.getAttribute("style")||n.removeAttribute("style"))}return{clear:y,to:l,toggleActive:a}}function Hn(t,n,e,i,o,r,s,c,l){const y=yt(o),f=yt(o).reverse(),d=u().concat(S());function x(M,P){return M.reduce((w,h)=>w-o[h],P)}function p(M,P){return M.reduce((w,h)=>x(w,P)>0?w.concat([h]):w,[])}function g(M){return r.map((P,w)=>({start:P-i[w]+.5+M,end:P+n-.5+M}))}function m(M,P,w){const h=g(P);return M.map(L=>{const U=w?0:-e,G=w?e:0,b=w?"end":"start",O=h[L][b];return{index:L,loopPoint:O,slideLocation:mt(-1),translate:tn(t,l[L]),target:()=>c.get()>O?U:G}})}function u(){const M=s[0],P=p(f,M);return m(P,e,!1)}function S(){const M=n-s[0]-1,P=p(y,M);return m(P,-e,!0)}function v(){return d.every(({index:M})=>{const P=y.filter(w=>w!==M);return x(P,n)<=.1})}function A(){d.forEach(M=>{const{target:P,translate:w,slideLocation:h}=M,L=P();L!==h.get()&&(w.to(L),h.set(L))})}function F(){d.forEach(M=>M.translate.clear())}return{canLoop:v,clear:F,loop:A,loopPoints:d}}function Un(t,n,e){let i,o=!1;function r(l){if(!e)return;function a(y){for(const f of y)if(f.type==="childList"){l.reInit(),n.emit("slidesChanged");break}}i=new MutationObserver(y=>{o||(wt(e)||e(l,y))&&a(y)}),i.observe(t,{childList:!0})}function s(){i&&i.disconnect(),o=!0}return{init:r,destroy:s}}function $n(t,n,e,i){const o={};let r=null,s=null,c,l=!1;function a(){c=new IntersectionObserver(p=>{l||(p.forEach(g=>{const m=n.indexOf(g.target);o[m]=g}),r=null,s=null,e.emit("slidesInView"))},{root:t.parentElement,threshold:i}),n.forEach(p=>c.observe(p))}function y(){c&&c.disconnect(),l=!0}function f(p){return St(o).reduce((g,m)=>{const u=parseInt(m),{isIntersecting:S}=o[u];return(p&&S||!p&&!S)&&g.push(u),g},[])}function d(p=!0){if(p&&r)return r;if(!p&&s)return s;const g=f(p);return p&&(r=g),p||(s=g),g}return{init:a,destroy:y,get:d}}function Vn(t,n,e,i,o,r){const{measureSize:s,startEdge:c,endEdge:l}=t,a=e[0]&&o,y=p(),f=g(),d=e.map(s),x=m();function p(){if(!a)return 0;const S=e[0];return X(n[c]-S[c])}function g(){if(!a)return 0;const S=r.getComputedStyle(it(i));return parseFloat(S.getPropertyValue(`margin-${l}`))}function m(){return e.map((S,v,A)=>{const F=!v,D=jt(A,v);return F?d[v]+y:D?d[v]+f:A[v+1][c]-S[c]}).map(X)}return{slideSizes:d,slideSizesWithGaps:x,startGap:y,endGap:f}}function Gn(t,n,e,i,o,r,s,c,l){const{startEdge:a,endEdge:y,direction:f}=t,d=Ft(e);function x(u,S){return yt(u).filter(v=>v%S===0).map(v=>u.slice(v,v+S))}function p(u){return u.length?yt(u).reduce((S,v,A)=>{const F=it(S)||0,D=F===0,M=v===xt(u),P=o[a]-r[F][a],w=o[a]-r[v][y],h=!i&&D?f(s):0,L=!i&&M?f(c):0,U=X(w-L-(P+h));return A&&U>n+l&&S.push(v),M&&S.push(u.length),S},[]).map((S,v,A)=>{const F=Math.max(A[v-1]||0);return u.slice(F,S)}):[]}function g(u){return d?x(u,e):p(u)}return{groupSlides:g}}function _n(t,n,e,i,o,r,s){const{align:c,axis:l,direction:a,startIndex:y,loop:f,duration:d,dragFree:x,dragThreshold:p,inViewThreshold:g,slidesToScroll:m,skipSnaps:u,containScroll:S,watchResize:v,watchSlides:A,watchDrag:F,watchFocus:D}=r,M=2,P=Dn(),w=P.measure(n),h=e.map(P.measure),L=On(l,a),U=L.measureSize(w),G=Ln(U),b=vn(c,U),O=!f&&!!S,T=f||!!S,{slideSizes:I,slideSizesWithGaps:C,startGap:k,endGap:N}=Vn(L,w,h,e,T,o),j=Gn(L,U,m,f,w,h,k,N,M),{snaps:R,snapsAligned:$}=jn(L,b,w,h,j),_=-it(R)+it(C),{snapsContained:J,scrollContainLimit:ot}=An(U,_,$,S,M),Z=O?J:$,{limit:V}=Cn(_,Z,f),nt=Wt(xt(Z),y,f),Q=nt.clone(),B=yt(e),E=({dragHandler:ft,scrollBody:Dt,scrollBounds:Lt,options:{loop:Et}})=>{Et||Lt.constrain(ft.pointerDown()),Dt.seek()},z=({scrollBody:ft,translate:Dt,location:Lt,offsetLocation:Et,previousLocation:on,scrollLooper:sn,slideLooper:rn,dragHandler:cn,animation:ln,eventHandler:Ht,scrollBounds:an,options:{loop:Ut}},$t)=>{const Vt=ft.settled(),un=!an.shouldConstrain(),Gt=Ut?Vt:Vt&&un,_t=Gt&&!cn.pointerDown();_t&&ln.stop();const fn=Lt.get()*$t+on.get()*(1-$t);Et.set(fn),Ut&&(sn.loop(ft.direction()),rn.loop()),Dt.to(Et.get()),_t&&Ht.emit("settle"),Gt||Ht.emit("scroll")},q=En(i,o,()=>E(gt),ft=>z(gt,ft)),W=.68,rt=Z[nt.get()],st=mt(rt),ct=mt(rt),lt=mt(rt),et=mt(rt),at=Mn(st,lt,ct,et,d,W),dt=Bn(f,Z,_,V,et),pt=Rn(q,nt,Q,at,dt,et,s),tt=kn(V),Y=bt(),zt=$n(n,e,s,g),{slideRegistry:vt}=Nn(O,S,Z,ot,j,B),It=zn(t,e,vt,pt,at,Y,s,D),gt={ownerDocument:i,ownerWindow:o,eventHandler:s,containerRect:w,slideRects:h,animation:q,axis:L,dragHandler:wn(L,t,i,o,et,In(L,o),st,q,pt,at,dt,nt,s,G,x,p,u,W,F),eventStore:Y,percentOfView:G,index:nt,indexPrevious:Q,limit:V,location:st,offsetLocation:lt,previousLocation:ct,options:r,resizeHandler:Tn(n,s,o,e,L,v,P),scrollBody:at,scrollBounds:Pn(V,lt,et,at,G),scrollLooper:Fn(_,V,lt,[st,lt,ct,et]),scrollProgress:tt,scrollSnapList:Z.map(tt.get),scrollSnaps:Z,scrollTarget:dt,scrollTo:pt,slideLooper:Hn(L,U,_,I,C,R,Z,lt,e),slideFocus:It,slidesHandler:Un(n,s,A),slidesInView:zt,slideIndexes:B,slideRegistry:vt,slidesToScroll:j,target:et,translate:tn(L,n)};return gt}function qn(){let t={},n;function e(a){n=a}function i(a){return t[a]||[]}function o(a){return i(a).forEach(y=>y(n,a)),l}function r(a,y){return t[a]=i(a).concat([y]),l}function s(a,y){return t[a]=i(a).filter(f=>f!==y),l}function c(){t={}}const l={init:e,emit:o,off:s,on:r,clear:c};return l}const Yn={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function Kn(t){function n(r,s){return Zt(r,s||{})}function e(r){const s=r.breakpoints||{},c=St(s).filter(l=>t.matchMedia(l).matches).map(l=>s[l]).reduce((l,a)=>n(l,a),{});return n(r,c)}function i(r){return r.map(s=>St(s.breakpoints||{})).reduce((s,c)=>s.concat(c),[]).map(t.matchMedia)}return{mergeOptions:n,optionsAtMedia:e,optionsMediaQueries:i}}function Xn(t){let n=[];function e(r,s){return n=s.filter(({options:c})=>t.optionsAtMedia(c).active!==!1),n.forEach(c=>c.init(r,t)),s.reduce((c,l)=>Object.assign(c,{[l.name]:l}),{})}function i(){n=n.filter(r=>r.destroy())}return{init:e,destroy:i}}function Ot(t,n,e){const i=t.ownerDocument,o=i.defaultView,r=Kn(o),s=Xn(r),c=bt(),l=qn(),{mergeOptions:a,optionsAtMedia:y,optionsMediaQueries:f}=r,{on:d,off:x,emit:p}=l,g=L;let m=!1,u,S=a(Yn,Ot.globalOptions),v=a(S),A=[],F,D,M;function P(){const{container:B,slides:E}=v;D=(Pt(B)?t.querySelector(B):B)||t.children[0];const q=Pt(E)?D.querySelectorAll(E):E;M=[].slice.call(q||D.children)}function w(B){const E=_n(t,D,M,i,o,B,l);if(B.loop&&!E.slideLooper.canLoop()){const z=Object.assign({},B,{loop:!1});return w(z)}return E}function h(B,E){m||(S=a(S,B),v=y(S),A=E||A,P(),u=w(v),f([S,...A.map(({options:z})=>z)]).forEach(z=>c.add(z,"change",L)),v.active&&(u.translate.to(u.location.get()),u.animation.init(),u.slidesInView.init(),u.slideFocus.init(Q),u.eventHandler.init(Q),u.resizeHandler.init(Q),u.slidesHandler.init(Q),u.options.loop&&u.slideLooper.loop(),D.offsetParent&&M.length&&u.dragHandler.init(Q),F=s.init(Q,A)))}function L(B,E){const z=j();U(),h(a({startIndex:z},B),E),l.emit("reInit")}function U(){u.dragHandler.destroy(),u.eventStore.clear(),u.translate.clear(),u.slideLooper.clear(),u.resizeHandler.destroy(),u.slidesHandler.destroy(),u.slidesInView.destroy(),u.animation.destroy(),s.destroy(),c.clear()}function G(){m||(m=!0,c.clear(),U(),l.emit("destroy"),l.clear())}function b(B,E,z){!v.active||m||(u.scrollBody.useBaseFriction().useDuration(E===!0?0:v.duration),u.scrollTo.index(B,z||0))}function O(B){const E=u.index.add(1).get();b(E,B,-1)}function T(B){const E=u.index.add(-1).get();b(E,B,1)}function I(){return u.index.add(1).get()!==j()}function C(){return u.index.add(-1).get()!==j()}function k(){return u.scrollSnapList}function N(){return u.scrollProgress.get(u.offsetLocation.get())}function j(){return u.index.get()}function R(){return u.indexPrevious.get()}function $(){return u.slidesInView.get()}function _(){return u.slidesInView.get(!1)}function J(){return F}function ot(){return u}function Z(){return t}function V(){return D}function nt(){return M}const Q={canScrollNext:I,canScrollPrev:C,containerNode:V,internalEngine:ot,destroy:G,off:x,on:d,emit:p,plugins:J,previousScrollSnap:R,reInit:g,rootNode:Z,scrollNext:O,scrollPrev:T,scrollProgress:N,scrollSnapList:k,scrollTo:b,selectedScrollSnap:j,slideNodes:nt,slidesInView:$,slidesNotInView:_};return h(n,e),setTimeout(()=>l.emit("init"),0),Q}Ot.globalOptions=void 0;function Nt(t={},n=[]){const e=K.useRef(t),i=K.useRef(n),[o,r]=K.useState(),[s,c]=K.useState(),l=K.useCallback(()=>{o&&o.reInit(e.current,i.current)},[o]);return K.useEffect(()=>{Ct(e.current,t)||(e.current=t,l())},[t,l]),K.useEffect(()=>{Sn(i.current,n)||(i.current=n,l())},[n,l]),K.useEffect(()=>{if(yn()&&s){Ot.globalOptions=Nt.globalOptions;const a=Ot(s,e.current,i.current);return r(a),()=>a.destroy()}else r(void 0)},[s,r]),[c,o]}Nt.globalOptions=void 0;const Qn={active:!0,breakpoints:{},delay:4e3,jump:!1,playOnInit:!0,stopOnFocusIn:!0,stopOnInteraction:!0,stopOnMouseEnter:!1,stopOnLastSnap:!1,rootNode:null};function Jn(t,n){const e=t.scrollSnapList();return typeof n=="number"?e.map(()=>n):n(e,t)}function Zn(t,n){const e=t.rootNode();return n&&n(e)||e}function Bt(t={}){let n,e,i,o,r=null,s=0,c=!1,l=!1,a=!1,y=!1;function f(b,O){e=b;const{mergeOptions:T,optionsAtMedia:I}=O,C=T(Qn,Bt.globalOptions),k=T(C,t);if(n=I(k),e.scrollSnapList().length<=1)return;y=n.jump,i=!1,o=Jn(e,n.delay);const{eventStore:N,ownerDocument:j}=e.internalEngine(),R=!!e.internalEngine().options.watchDrag,$=Zn(e,n.rootNode);N.add(j,"visibilitychange",u),R&&e.on("pointerDown",v),R&&!n.stopOnInteraction&&e.on("pointerUp",A),n.stopOnMouseEnter&&N.add($,"mouseenter",F),n.stopOnMouseEnter&&!n.stopOnInteraction&&N.add($,"mouseleave",D),n.stopOnFocusIn&&e.on("slideFocusStart",m),n.stopOnFocusIn&&!n.stopOnInteraction&&N.add(e.containerNode(),"focusout",g),n.playOnInit&&g()}function d(){e.off("pointerDown",v).off("pointerUp",A).off("slideFocusStart",m),m(),i=!0,c=!1}function x(){const{ownerWindow:b}=e.internalEngine();b.clearTimeout(s),s=b.setTimeout(L,o[e.selectedScrollSnap()]),r=new Date().getTime(),e.emit("autoplay:timerset")}function p(){const{ownerWindow:b}=e.internalEngine();b.clearTimeout(s),s=0,r=null,e.emit("autoplay:timerstopped")}function g(){if(!i){if(S()){a=!0;return}c||e.emit("autoplay:play"),x(),c=!0}}function m(){i||(c&&e.emit("autoplay:stop"),p(),c=!1)}function u(){if(S())return a=c,m();a&&g()}function S(){const{ownerDocument:b}=e.internalEngine();return b.visibilityState==="hidden"}function v(){l||m()}function A(){l||g()}function F(){l=!0,m()}function D(){l=!1,g()}function M(b){typeof b<"u"&&(y=b),g()}function P(){c&&m()}function w(){c&&g()}function h(){return c}function L(){const{index:b}=e.internalEngine(),O=b.clone().add(1).get(),T=e.scrollSnapList().length-1,I=n.stopOnLastSnap&&O===T;if(e.canScrollNext()?e.scrollNext(y):e.scrollTo(0,y),e.emit("autoplay:select"),I)return m();g()}function U(){if(!r)return null;const b=o[e.selectedScrollSnap()],O=new Date().getTime()-r;return b-O}return{name:"autoplay",options:t,init:f,destroy:d,play:M,stop:P,reset:w,isPlaying:h,timeUntilNext:U}}Bt.globalOptions=void 0;const Wn={direction:"forward",speed:2,startDelay:1e3,active:!0,breakpoints:{},playOnInit:!0,stopOnFocusIn:!0,stopOnInteraction:!0,stopOnMouseEnter:!1,rootNode:null};function te(t,n){const e=t.rootNode();return n&&n(e)||e}function Rt(t={}){let n,e,i,o,r=0,s=!1,c=!1,l;function a(w,h){e=w;const{mergeOptions:L,optionsAtMedia:U}=h,G=L(Wn,Rt.globalOptions),b=L(G,t);if(n=U(b),e.scrollSnapList().length<=1)return;o=n.startDelay,i=!1,l=e.internalEngine().scrollBody;const{eventStore:O}=e.internalEngine(),T=!!e.internalEngine().options.watchDrag,I=te(e,n.rootNode);T&&e.on("pointerDown",p),T&&!n.stopOnInteraction&&e.on("pointerUp",g),n.stopOnMouseEnter&&O.add(I,"mouseenter",m),n.stopOnMouseEnter&&!n.stopOnInteraction&&O.add(I,"mouseleave",u),n.stopOnFocusIn&&e.on("slideFocusStart",d),n.stopOnFocusIn&&!n.stopOnInteraction&&O.add(e.containerNode(),"focusout",f),n.playOnInit&&f()}function y(){e.off("pointerDown",p).off("pointerUp",g).off("slideFocusStart",d).off("settle",S),d(),i=!0,s=!1}function f(){if(i||s)return;e.emit("autoScroll:play");const w=e.internalEngine(),{ownerWindow:h}=w;r=h.setTimeout(()=>{w.scrollBody=x(w),w.animation.start()},o),s=!0}function d(){if(i||!s)return;e.emit("autoScroll:stop");const w=e.internalEngine(),{ownerWindow:h}=w;w.scrollBody=l,h.clearTimeout(r),r=0,s=!1}function x(w){const{location:h,previousLocation:L,offsetLocation:U,target:G,scrollTarget:b,index:O,indexPrevious:T,limit:{reachedMin:I,reachedMax:C,constrain:k},options:{loop:N}}=w,j=n.direction==="forward"?-1:1,R=()=>nt;let $=0,_=0,J=h.get(),ot=0,Z=!1;function V(){let Q=0;L.set(h),$=j*n.speed,J+=$,h.add($),G.set(h),Q=J-ot,_=Math.sign(Q),ot=J;const B=b.byDistance(0,!1).index;O.get()!==B&&(T.set(O.get()),O.set(B),e.emit("select"));const E=n.direction==="forward"?I(U.get()):C(U.get());if(!N&&E){Z=!0;const z=k(h.get());h.set(z),G.set(h),d()}return nt}const nt={direction:()=>_,duration:()=>-1,velocity:()=>$,settled:()=>Z,seek:V,useBaseFriction:R,useBaseDuration:R,useFriction:R,useDuration:R};return nt}function p(){c||d()}function g(){c||v()}function m(){c=!0,d()}function u(){c=!1,f()}function S(){e.off("settle",S),f()}function v(){e.on("settle",S)}function A(w){typeof w<"u"&&(o=w),f()}function F(){s&&d()}function D(){s&&(d(),v())}function M(){return s}return{name:"autoScroll",options:t,init:a,destroy:y,play:A,stop:F,reset:D,isPlaying:M}}Rt.globalOptions=void 0;function Qt(t,n,e){return Math.min(Math.max(t,n),e)}function Mt(t){return typeof t=="number"&&!isNaN(t)}function nn(t={}){let o,r=[],s,c=0,l=0,a=0,y=!1,f,d;function x(b){o=b;const O=o.selectedScrollSnap(),{scrollBody:T,containerRect:I,axis:C}=o.internalEngine(),k=C.measureSize(I);s=Qt(k*.75,200,500),y=!1,r=o.scrollSnapList().map((N,j)=>j===O?1:0),f=T.settled,d=o.scrollProgress,T.settled=L,o.scrollProgress=U,o.on("select",S).on("slideFocus",g).on("pointerDown",u).on("pointerUp",m),A(),g()}function p(){const{scrollBody:b}=o.internalEngine();b.settled=f,o.scrollProgress=d,o.off("select",S).off("slideFocus",g).off("pointerDown",u).off("pointerUp",m),o.slideNodes().forEach(O=>{const T=O.style;T.opacity="",T.transform="",T.pointerEvents="",O.getAttribute("style")||O.removeAttribute("style")})}function g(){const b=o.selectedScrollSnap();D(b,1)}function m(){y=!1}function u(){y=!1,c=0,l=0}function S(){const b=o.internalEngine().scrollBody.duration();l=b?0:1,y=!0,b||g()}function v(b){const{axis:O}=o.internalEngine();return`translate${O.scroll.toUpperCase()}(${O.direction(b)}px)`}function A(){const{translate:b,slideLooper:O}=o.internalEngine();b.clear(),b.toggleActive(!1),O.loopPoints.forEach(({translate:T})=>{T.clear(),T.toggleActive(!1)})}function F(b){const{scrollSnaps:O,location:T,target:I}=o.internalEngine();!Mt(b)||r[b]<.5||(T.set(O[b]),I.set(T))}function D(b,O){o.scrollSnapList().forEach((I,C)=>{const k=Math.abs(O),N=r[C],j=C===b,R=j?N+k:N-k,$=Qt(R,0,1);r[C]=$;const _=j&&y,J=o.previousScrollSnap();_&&(r[J]=1-$),j&&P(b,$),M(C)})}function M(b){const O=o.internalEngine().slideRegistry[b],{scrollSnaps:T,containerRect:I}=o.internalEngine(),C=r[b];O.forEach(k=>{const N=o.slideNodes()[k].style,j=parseFloat(C.toFixed(2)),R=j>0,$=R?T[b]:I.width+2,_=v($);R&&(N.transform=_),N.opacity=j.toString(),N.pointerEvents=C>.5?"auto":"none",R||(N.transform=_)})}function P(b,O){const{index:T,dragHandler:I,scrollSnaps:C}=o.internalEngine(),k=I.pointerDown(),N=1/(C.length-1);let j=b,R=k?o.selectedScrollSnap():o.previousScrollSnap();if(k&&j===R){const J=Math.sign(c)*-1;j=R,R=T.clone().set(R).add(J).get()}const $=R*N,_=(j-R)*N;a=$+_*O}function w(){const{dragHandler:b,index:O,scrollBody:T}=o.internalEngine(),I=o.selectedScrollSnap();if(!b.pointerDown())return I;const C=Math.sign(T.velocity()),k=Math.sign(c),N=O.clone().set(I).add(C*-1).get();return!C||!k?null:k===C?N:I}function h(b){const{dragHandler:O,scrollBody:T}=b.internalEngine(),I=O.pointerDown(),C=T.velocity(),k=T.duration(),N=w(),j=!Mt(N);if(I){if(!C)return;c+=C,l=Math.abs(C/s),F(N)}if(!I){if(!k||j)return;l+=(1-r[N])/k,l*=.68}j||D(N,l)}function L(){const{target:b,location:O}=o.internalEngine(),T=b.get()-O.get(),I=Math.abs(T)>=1,C=w(),k=!Mt(C);return h(o),k||I?!1:r[C]>.999}function U(){return a}return{name:"fade",options:t,init:x,destroy:p}}nn.globalOptions=void 0;function ne(t,n,e){return e==="fade"?1:t!==void 0?t:n?null:1}function ee(t,n,e){return n==="fade"&&e===1?0:t}function en(t){return t==null||t<=1?0:Math.ceil(t)-1}function oe(t,n,e){if(t!=null)return n==null||n<=0?t:t*n+en(n)*e}function se(t,n,e){return(t-en(n)*e)/n}function re({loop:t,continuous:n,visibleCount:e,childCount:i}){if(!t||n||e==null||e<=1||i<=0)return 1;const o=Math.ceil(e)+1;return i>=o?1:Math.ceil(o/i)}function ie(t,n){const[e,i]=K.useState(void 0);return[K.useCallback(r=>{if(!r||!t||n!=null)return;const s=r.firstElementChild;s&&s.offsetHeight>0?i(s.offsetHeight):requestAnimationFrame(()=>{const c=r.firstElementChild;c&&c.offsetHeight>0&&i(c.offsetHeight)})},[t,n]),n??e]}function ae({visible:t,gap:n=0,height:e,direction:i="left",loop:o=!0,autoAdvance:r=0,continuous:s=!1,speed:c=2,effect:l="slide",dimInactive:a=!1,showControls:y=!0,controlsPosition:f="outside",showDots:d=!1,pauseOnHover:x=!0,align:p="start",slidesToScroll:g=1,drag:m=!0,className:u,cssClass:S,children:v}){const A=i==="up"||i==="down",F=ne(t,s,l),D=K.Children.toArray(v).filter(I=>I!=null&&I!==""),[M,P]=ie(A,e),w=!A||P!=null,h=F!=null&&F>0?F:null,L=ee(n,l,h),U=A?e??oe(P,h,L):void 0,G=L>0?L/2:0,b=h!=null?A&&U!=null?`${se(U,h,L)}px`:`${100/h}%`:void 0;let O=D;if(o&&s)O=[...D,...D.map((I,C)=>Tt.cloneElement(I,{key:`dup1-${C}`})),...D.map((I,C)=>Tt.cloneElement(I,{key:`dup2-${C}`}))];else if(o&&h!=null&&h>1&&D.length>0){const I=re({loop:o,continuous:s,visibleCount:h,childCount:D.length});I>1&&(O=Array.from({length:I},(C,k)=>D.map((N,j)=>Tt.cloneElement(N,{key:`loopdup-${k}-${j}`}))).flat())}const T=D.length;return w?H.jsx(ce,{isVertical:A,viewportHeight:U,validChildren:O,realSlideCount:T,slideBasis:b,effectiveGap:L,halfGap:G,loop:o,align:p,slidesToScroll:g,continuous:s,drag:m,effect:l,autoAdvance:r,speed:c,direction:i,pauseOnHover:x,dimInactive:a,showControls:y,controlsPosition:f,showDots:d,className:u,cssClass:S}):H.jsx("div",{ref:M,className:Jt(u,S),style:{overflow:"hidden",height:0,position:"relative"},children:D[0]})}function ce({isVertical:t,viewportHeight:n,validChildren:e,realSlideCount:i,slideBasis:o,effectiveGap:r,halfGap:s,loop:c,align:l,slidesToScroll:a,continuous:y,drag:f,effect:d,autoAdvance:x,speed:p,direction:g,pauseOnHover:m,dimInactive:u,showControls:S,controlsPosition:v,showDots:A,className:F,cssClass:D}){const M={axis:t?"y":"x",loop:c,align:l,slidesToScroll:a,dragFree:y,watchDrag:f},P=[];d==="fade"&&P.push(nn()),y?P.push(Rt({speed:p,direction:g==="right"||g==="down"?"backward":"forward",playOnInit:!0,stopOnMouseEnter:m,stopOnInteraction:!1})):x>0&&P.push(Bt({delay:x,playOnInit:!0,stopOnMouseEnter:m,stopOnInteraction:!1}));const[w,h]=Nt(M,P);K.useEffect(()=>{if(!h)return;const tt=window;tt.__emblaDebug||(tt.__emblaDebug=[]),tt.__emblaDebug.push(h),console.log("[Carousel] init axis="+(t?"y":"x")+" snaps="+h.scrollSnapList().length+" canNext="+h.canScrollNext()+" canPrev="+h.canScrollPrev()+" slides="+h.slideNodes().length)},[h]);const[L,U]=K.useState(!1),[G,b]=K.useState(!1),[O,T]=K.useState(0),[I,C]=K.useState(0),[k,N]=K.useState([]),j=K.useCallback(()=>h==null?void 0:h.scrollPrev(),[h]),R=K.useCallback(()=>h==null?void 0:h.scrollNext(),[h]),$=K.useCallback(tt=>h==null?void 0:h.scrollTo(tt),[h]),_=K.useCallback(()=>{if(!h)return;U(h.canScrollPrev()),b(h.canScrollNext());const tt=h.selectedScrollSnap();T(i>0?tt%i:tt)},[h,i]),J=K.useCallback(tt=>{const Y=tt.scrollProgress(),vt=tt.scrollSnapList().map(It=>{const gt=Math.abs(Y-It);return Math.max(.3,1-gt*2)});N(vt)},[]);K.useEffect(()=>{if(h)return C(i),_(),h.on("select",_),h.on("reInit",_),u&&(J(h),h.on("scroll",J),h.on("reInit",J)),()=>{h.off("select",_),h.off("reInit",_),u&&(h.off("scroll",J),h.off("reInit",J))}},[h,_,u,J,i]);const ot=t?dn:pn,Z=t?gn:mn,V=S&&!y,nt=v==="outside",Q=v==="gutter",B=A&&I>1,E=B&&t&&!Q,z=B&&!t&&!Q,q=32,W=q+8,st=Q&&(V||B)?q+12:20,ct=t&&Q&&(V||B),lt=!t&&Q&&(V||B),et={zIndex:10,display:"flex",alignItems:"center",justifyContent:"center",width:q,height:q,borderRadius:"50%",border:"1px solid var(--border, #e5e7eb)",background:"var(--background, #fff)",boxShadow:"0 1px 3px rgba(0,0,0,.1)",cursor:"pointer",transition:"opacity 150ms"},at={position:"relative",...V&&nt?t?{paddingTop:W,paddingBottom:W}:{paddingLeft:W,paddingRight:W}:{},...t&&(E||ct)?{paddingRight:st}:{}},dt=nt?t?{top:0,left:"50%",transform:"translateX(-50%)"}:{left:0,top:"50%",transform:"translateY(-50%)"}:t?{top:8,right:8}:{left:8,top:"50%",transform:"translateY(-50%)"},pt=nt?t?{bottom:0,left:"50%",transform:"translateX(-50%)"}:{right:0,top:"50%",transform:"translateY(-50%)"}:t?{bottom:8,right:8}:{right:8,top:"50%",transform:"translateY(-50%)"};return H.jsxs("div",{className:Jt(F,D),style:{position:"relative"},children:[H.jsxs("div",{style:at,children:[H.jsx("div",{ref:w,style:{overflow:"hidden",...t&&n!=null?{height:n}:{}},children:H.jsx("div",{style:{display:"flex",flexDirection:t?"column":"row",...t&&n!=null?{height:n}:{},touchAction:t?"pan-x pinch-zoom":"pan-y pinch-zoom",...r>0?t?{marginTop:-r}:{marginLeft:-s,marginRight:-s}:{},...d==="fade"?{position:"relative"}:{}},children:e.map((tt,Y)=>H.jsx("div",{role:"group","aria-roledescription":"slide",style:{flexShrink:0,flexGrow:0,...t?{minHeight:0,boxSizing:"content-box"}:{minWidth:0},...o!=null?{flexBasis:o}:{},...r>0?t?{paddingTop:r}:{paddingLeft:s,paddingRight:s}:{},...u&&k[Y]!=null?{opacity:k[Y],transition:"opacity 300ms ease"}:{}},children:tt},Y))})}),V&&!Q&&H.jsxs(H.Fragment,{children:[H.jsx("button",{onClick:j,disabled:!c&&!L,style:{...et,position:"absolute",opacity:!c&&!L?0:1,...dt},children:H.jsx(ot,{style:{width:16,height:16}})}),H.jsx("button",{onClick:R,disabled:!c&&!G,style:{...et,position:"absolute",opacity:!c&&!G?0:1,...pt},children:H.jsx(Z,{style:{width:16,height:16}})})]}),E&&H.jsx("div",{style:{position:"absolute",top:"50%",right:0,transform:"translateY(-50%)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:6},children:Array.from({length:I},(tt,Y)=>H.jsx("button",{onClick:()=>$(Y),style:{width:8,height:8,borderRadius:"50%",border:"none",cursor:"pointer",transition:"opacity 150ms",background:"var(--foreground, #000)",opacity:Y===O?1:.2}},Y))}),ct&&H.jsxs("div",{style:{position:"absolute",top:"50%",right:0,transform:"translateY(-50%)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,width:st},children:[V&&H.jsx("button",{onClick:j,disabled:!c&&!L,style:{...et,opacity:!c&&!L?0:1},children:H.jsx(ot,{style:{width:16,height:16}})}),B&&Array.from({length:I},(tt,Y)=>H.jsx("button",{onClick:()=>$(Y),style:{width:8,height:8,borderRadius:"50%",border:"none",cursor:"pointer",transition:"opacity 150ms",background:"var(--foreground, #000)",opacity:Y===O?1:.2}},Y)),V&&H.jsx("button",{onClick:R,disabled:!c&&!G,style:{...et,opacity:!c&&!G?0:1},children:H.jsx(Z,{style:{width:16,height:16}})})]})]}),z&&H.jsx("div",{style:{display:"flex",justifyContent:"center",gap:6,marginTop:12},children:Array.from({length:I},(tt,Y)=>H.jsx("button",{onClick:()=>$(Y),style:{width:8,height:8,borderRadius:"50%",border:"none",cursor:"pointer",transition:"opacity 150ms",background:"var(--foreground, #000)",opacity:Y===O?1:.2}},Y))}),lt&&H.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:12,marginTop:12},children:[V&&H.jsx("button",{onClick:j,disabled:!c&&!L,style:{...et,opacity:!c&&!L?0:1},children:H.jsx(ot,{style:{width:16,height:16}})}),B&&H.jsx("div",{style:{display:"flex",justifyContent:"center",gap:6},children:Array.from({length:I},(tt,Y)=>H.jsx("button",{onClick:()=>$(Y),style:{width:8,height:8,borderRadius:"50%",border:"none",cursor:"pointer",transition:"opacity 150ms",background:"var(--foreground, #000)",opacity:Y===O?1:.2}},Y))}),V&&H.jsx("button",{onClick:R,disabled:!c&&!G,style:{...et,opacity:!c&&!G?0:1},children:H.jsx(Z,{style:{width:16,height:16}})})]})]})}export{ae as PrefabCarousel};