mario-education 2.4.404-multi → 2.4.405-multi

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -8026,6 +8026,9 @@ var changeTeacherOfStudent = function changeTeacherOfStudent(id, teacherUserId)
8026
8026
  teacherUserId: teacherUserId
8027
8027
  });
8028
8028
  };
8029
+ var changeMultiTeacherOfStudent = function changeMultiTeacherOfStudent(studentId, params) {
8030
+ return marioCore.api.put(USER_URL$1 + "/change-multi-teacher/" + studentId, params);
8031
+ };
8029
8032
  var getTeachersByStudentId = function getTeachersByStudentId(studentId) {
8030
8033
  return marioCore.api.get(USER_URL$1 + "/teachers/" + studentId);
8031
8034
  };
@@ -8430,7 +8433,8 @@ var initialUserChoice$1 = {
8430
8433
  emailStudent: "",
8431
8434
  teacherUserId: "",
8432
8435
  emailTeacher: "",
8433
- teacherName: ""
8436
+ teacherName: "",
8437
+ teachers: []
8434
8438
  };
8435
8439
  var TITLE$c = "Switch teacher list";
8436
8440
 
@@ -8459,6 +8463,13 @@ var useSwitchTeacher = function useSwitchTeacher() {
8459
8463
  teacherChangeId = _useState5[0],
8460
8464
  setTeacherChangeId = _useState5[1];
8461
8465
 
8466
+ var _useState6 = React.useState({
8467
+ teacher: null,
8468
+ teacherChange: null
8469
+ }),
8470
+ teacherGroupId = _useState6[0],
8471
+ setTeacherGroupId = _useState6[1];
8472
+
8462
8473
  var dispatch = reactRedux.useDispatch();
8463
8474
  var modal = React.useRef();
8464
8475
 
@@ -8588,6 +8599,54 @@ var useSwitchTeacher = function useSwitchTeacher() {
8588
8599
  React.useEffect(function () {
8589
8600
  userChoiced.id && getTeachersOfStudent(parseInt(userChoiced.id));
8590
8601
  }, [userChoiced.id]);
8602
+
8603
+ var updateSwitchTeacher = function updateSwitchTeacher(teachers, studentId) {
8604
+ try {
8605
+ dispatch(marioCore.setModal({
8606
+ isOpen: true,
8607
+ type: "warning",
8608
+ message: "Do you want to change teacher?",
8609
+ onConfirm: function () {
8610
+ try {
8611
+ var _temp13 = function _temp13() {
8612
+ dispatch(marioCore.setLoading(false));
8613
+ };
8614
+
8615
+ dispatch(marioCore.setLoading(true));
8616
+
8617
+ var _temp14 = _catch(function () {
8618
+ return Promise.resolve(changeMultiTeacherOfStudent(studentId, teachers)).then(function () {
8619
+ dispatch(marioCore.setAlert({
8620
+ type: "success",
8621
+ message: "Change teacher successfully"
8622
+ }));
8623
+ openModal();
8624
+ resetData();
8625
+ changeFilters({
8626
+ currentPage: 1
8627
+ });
8628
+ });
8629
+ }, function (err) {
8630
+ var _err$response4, _err$response4$data;
8631
+
8632
+ dispatch(marioCore.setAlert({
8633
+ type: "danger",
8634
+ message: ((_err$response4 = err.response) === null || _err$response4 === void 0 ? void 0 : (_err$response4$data = _err$response4.data) === null || _err$response4$data === void 0 ? void 0 : _err$response4$data.title) || err.message
8635
+ }));
8636
+ });
8637
+
8638
+ return Promise.resolve(_temp14 && _temp14.then ? _temp14.then(_temp13) : _temp13(_temp14));
8639
+ } catch (e) {
8640
+ return Promise.reject(e);
8641
+ }
8642
+ }
8643
+ }));
8644
+ return Promise.resolve();
8645
+ } catch (e) {
8646
+ return Promise.reject(e);
8647
+ }
8648
+ };
8649
+
8591
8650
  return {
8592
8651
  userList: userList,
8593
8652
  totalItems: totalItems,
@@ -8603,7 +8662,10 @@ var useSwitchTeacher = function useSwitchTeacher() {
8603
8662
  setTeacherChangeId: setTeacherChangeId,
8604
8663
  teacherChangeId: teacherChangeId,
8605
8664
  removeData: removeData,
8606
- resetData: resetData
8665
+ resetData: resetData,
8666
+ setTeacherGroupId: setTeacherGroupId,
8667
+ teacherGroupId: teacherGroupId,
8668
+ updateSwitchTeacher: updateSwitchTeacher
8607
8669
  };
8608
8670
  };
8609
8671
 
@@ -8614,7 +8676,10 @@ var SwitchTeacherModal = function SwitchTeacherModal(props, ref) {
8614
8676
  userChoiced = props.userChoiced,
8615
8677
  options = props.options,
8616
8678
  teacherChangeId = props.teacherChangeId,
8617
- setTeacherChangeId = props.setTeacherChangeId;
8679
+ setTeacherChangeId = props.setTeacherChangeId,
8680
+ setTeacherGroupId = props.setTeacherGroupId,
8681
+ teacherGroupId = props.teacherGroupId,
8682
+ updateSwitchTeacher = props.updateSwitchTeacher;
8618
8683
 
8619
8684
  var _useTranslation = marioCore.useTranslation(),
8620
8685
  t = _useTranslation.t;
@@ -8627,7 +8692,7 @@ var SwitchTeacherModal = function SwitchTeacherModal(props, ref) {
8627
8692
  ref: ref,
8628
8693
  confirmText: t("change_save"),
8629
8694
  onConfirm: function onConfirm() {
8630
- return removeData(teacherChangeId, userChoiced.id);
8695
+ userChoiced.teachers.length > 0 ? updateSwitchTeacher(teacherGroupId, userChoiced.id) : removeData(teacherChangeId, userChoiced.id);
8631
8696
  },
8632
8697
  onCancel: function onCancel() {
8633
8698
  resetData();
@@ -8641,14 +8706,64 @@ var SwitchTeacherModal = function SwitchTeacherModal(props, ref) {
8641
8706
  className: "font-weight-bold"
8642
8707
  }, t("student_email")), React__default.createElement("p", null, userChoiced.emailStudent, " "), React__default.createElement("p", {
8643
8708
  className: "font-weight-bold"
8644
- }, t("current_teacher_name")), React__default.createElement("p", null, userChoiced.teacherName, " "), React__default.createElement("p", {
8709
+ }, t("current_teacher_name")), React__default.createElement("p", null, userChoiced.teacherName, " "), userChoiced.teachers.length > 0 && userChoiced.teachers.map(function (e) {
8710
+ return React__default.createElement("p", null, e.mainTeacherName, " ");
8711
+ }), React__default.createElement("p", {
8645
8712
  className: "font-weight-bold"
8646
- }, t("current_teacher_email")), React__default.createElement("p", null, userChoiced.emailTeacher, " "), !!userChoiced && React__default.createElement(marioCore.CustomSelector, {
8647
- options: options,
8648
- value: valueDefault,
8713
+ }, t("current_teacher_email")), React__default.createElement("p", null, userChoiced.emailTeacher, " "), userChoiced.teachers.length > 0 && userChoiced.teachers.map(function (e) {
8714
+ return React__default.createElement("p", null, e.mainTeacherEmail, " ");
8715
+ }), userChoiced.teachers.length > 0 && React__default.createElement("p", null, React__default.createElement("p", {
8716
+ className: "font-weight-bold"
8717
+ }, t("select_teacher")), React__default.createElement(marioCore.CustomSelector, {
8718
+ options: userChoiced.teachers.map(function (record) {
8719
+ return {
8720
+ label: record.mainTeacherName + " - " + record.mainTeacherEmail,
8721
+ value: record.teacherUserId
8722
+ };
8723
+ }),
8724
+ value: userChoiced.teachers.map(function (record) {
8725
+ return {
8726
+ label: record.mainTeacherName + " - " + record.mainTeacherEmail,
8727
+ value: record.teacherUserId
8728
+ };
8729
+ }).find(function (item) {
8730
+ return item.value == teacherGroupId.teacher;
8731
+ }),
8732
+ placeholder: t("select_teacher"),
8733
+ onChange: function onChange(e) {
8734
+ return setTeacherGroupId(function (prev) {
8735
+ return Object.assign(prev, {
8736
+ teacher: e.value
8737
+ });
8738
+ });
8739
+ }
8740
+ })), userChoiced.teachers.length > 0 && React__default.createElement("p", {
8741
+ className: "font-weight-bold"
8742
+ }, t("select_teacher_change")), !!userChoiced && React__default.createElement(marioCore.CustomSelector, {
8743
+ options: userChoiced.teachers.length > 0 ? options.filter(function (r) {
8744
+ return !userChoiced.teachers.map(function (e) {
8745
+ return e.teacherUserId;
8746
+ }).includes(r.value);
8747
+ }) : options,
8748
+ value: userChoiced.teachers.length > 0 ? valueDefault : userChoiced.teachers.map(function (record) {
8749
+ return {
8750
+ label: record.mainTeacherName + " - " + record.mainTeacherEmail,
8751
+ value: record.teacherUserId
8752
+ };
8753
+ }).find(function (item) {
8754
+ return item.value == teacherGroupId.teacherChange;
8755
+ }),
8649
8756
  placeholder: t("select_teacher_change"),
8650
8757
  onChange: function onChange(e) {
8651
- return setTeacherChangeId(e.value);
8758
+ if (userChoiced.teachers.length > 0) {
8759
+ setTeacherGroupId(function (prev) {
8760
+ return Object.assign(prev, {
8761
+ teacherChange: e.value
8762
+ });
8763
+ });
8764
+ } else {
8765
+ setTeacherChangeId(e.value);
8766
+ }
8652
8767
  }
8653
8768
  }))));
8654
8769
  };
@@ -8669,9 +8784,12 @@ var SwitchTeacherList = function SwitchTeacherList() {
8669
8784
  userChoiced = _useSwitchTeacher.userChoiced,
8670
8785
  options = _useSwitchTeacher.options,
8671
8786
  setTeacherChangeId = _useSwitchTeacher.setTeacherChangeId,
8787
+ setTeacherGroupId = _useSwitchTeacher.setTeacherGroupId,
8672
8788
  teacherChangeId = _useSwitchTeacher.teacherChangeId,
8789
+ teacherGroupId = _useSwitchTeacher.teacherGroupId,
8673
8790
  removeData = _useSwitchTeacher.removeData,
8674
- resetData = _useSwitchTeacher.resetData;
8791
+ resetData = _useSwitchTeacher.resetData,
8792
+ updateSwitchTeacher = _useSwitchTeacher.updateSwitchTeacher;
8675
8793
 
8676
8794
  var _useTranslation = marioCore.useTranslation(),
8677
8795
  t = _useTranslation.t;
@@ -8733,9 +8851,17 @@ var SwitchTeacherList = function SwitchTeacherList() {
8733
8851
  className: "align-middle"
8734
8852
  }, record.emailStudent), React__default.createElement("td", {
8735
8853
  className: "align-middle"
8736
- }, record.teacherName), React__default.createElement("td", {
8854
+ }, record.teachers.length > 0 ? record.teachers.map(function (e) {
8855
+ return React__default.createElement("p", {
8856
+ className: "m-0"
8857
+ }, e.mainTeacherName, " ");
8858
+ }) : record.teacherName), React__default.createElement("td", {
8737
8859
  className: "align-middle"
8738
- }, record.emailTeacher));
8860
+ }, record.teachers.length > 0 ? record.teachers.map(function (e) {
8861
+ return React__default.createElement("p", {
8862
+ className: "m-0"
8863
+ }, e.mainTeacherEmail, " ");
8864
+ }) : record.emailTeacher));
8739
8865
  })))) : React__default.createElement(marioCore.EmptyDataAlert, {
8740
8866
  label: t("user")
8741
8867
  })), React__default.createElement(reactstrap.Col, {
@@ -8759,10 +8885,13 @@ var SwitchTeacherList = function SwitchTeacherList() {
8759
8885
  onCancel: function onCancel() {},
8760
8886
  userChoiced: userChoiced,
8761
8887
  removeData: removeData,
8888
+ updateSwitchTeacher: updateSwitchTeacher,
8762
8889
  options: options,
8763
8890
  teacherChangeId: teacherChangeId,
8764
8891
  setTeacherChangeId: setTeacherChangeId,
8765
- resetData: resetData
8892
+ setTeacherGroupId: setTeacherGroupId,
8893
+ resetData: resetData,
8894
+ teacherGroupId: teacherGroupId
8766
8895
  }));
8767
8896
  };
8768
8897
 
@@ -36726,6 +36855,8 @@ function _inherits(subClass, superClass) {
36726
36855
  if (superClass) _setPrototypeOf(subClass, superClass);
36727
36856
  }
36728
36857
 
36858
+ var isDevelopment = false;
36859
+
36729
36860
  /*
36730
36861
 
36731
36862
  Based off glamor's StyleSheet, thanks Sunil ❤️
@@ -36748,10 +36879,9 @@ styleSheet.flush()
36748
36879
  - empties the stylesheet of all its contents
36749
36880
 
36750
36881
  */
36751
- // $FlowFixMe
36882
+
36752
36883
  function sheetForTag(tag) {
36753
36884
  if (tag.sheet) {
36754
- // $FlowFixMe
36755
36885
  return tag.sheet;
36756
36886
  } // this weirdness brought to you by firefox
36757
36887
 
@@ -36760,10 +36890,13 @@ function sheetForTag(tag) {
36760
36890
 
36761
36891
  for (var i = 0; i < document.styleSheets.length; i++) {
36762
36892
  if (document.styleSheets[i].ownerNode === tag) {
36763
- // $FlowFixMe
36764
36893
  return document.styleSheets[i];
36765
36894
  }
36766
- }
36895
+ } // this function should always return with a value
36896
+ // TS can't understand it though so we make it stop complaining here
36897
+
36898
+
36899
+ return undefined;
36767
36900
  }
36768
36901
 
36769
36902
  function createStyleElement(options) {
@@ -36804,7 +36937,7 @@ var StyleSheet = /*#__PURE__*/function () {
36804
36937
  _this.tags.push(tag);
36805
36938
  };
36806
36939
 
36807
- this.isSpeedy = options.speedy === undefined ? process.env.NODE_ENV === 'production' : options.speedy;
36940
+ this.isSpeedy = options.speedy === undefined ? !isDevelopment : options.speedy;
36808
36941
  this.tags = [];
36809
36942
  this.ctr = 0;
36810
36943
  this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets
@@ -36832,18 +36965,6 @@ var StyleSheet = /*#__PURE__*/function () {
36832
36965
 
36833
36966
  var tag = this.tags[this.tags.length - 1];
36834
36967
 
36835
- if (process.env.NODE_ENV !== 'production') {
36836
- var isImportRule = rule.charCodeAt(0) === 64 && rule.charCodeAt(1) === 105;
36837
-
36838
- if (isImportRule && this._alreadyInsertedOrderInsensitiveRule) {
36839
- // this would only cause problem in speedy mode
36840
- // but we don't want enabling speedy to affect the observable behavior
36841
- // so we report this error at all times
36842
- console.error("You're attempting to insert the following rule:\n" + rule + '\n\n`@import` rules must be before all other types of rules in a stylesheet but other rules have already been inserted. Please ensure that `@import` rules are before all other rules.');
36843
- }
36844
- this._alreadyInsertedOrderInsensitiveRule = this._alreadyInsertedOrderInsensitiveRule || !isImportRule;
36845
- }
36846
-
36847
36968
  if (this.isSpeedy) {
36848
36969
  var sheet = sheetForTag(tag);
36849
36970
 
@@ -36852,9 +36973,6 @@ var StyleSheet = /*#__PURE__*/function () {
36852
36973
  // the big drawback is that the css won't be editable in devtools
36853
36974
  sheet.insertRule(rule, sheet.cssRules.length);
36854
36975
  } catch (e) {
36855
- if (process.env.NODE_ENV !== 'production' && !/:(-moz-placeholder|-moz-focus-inner|-moz-focusring|-ms-input-placeholder|-moz-read-write|-moz-read-only|-ms-clear|-ms-expand|-ms-reveal){/.test(rule)) {
36856
- console.error("There was a problem inserting the following rule: \"" + rule + "\"", e);
36857
- }
36858
36976
  }
36859
36977
  } else {
36860
36978
  tag.appendChild(document.createTextNode(rule));
@@ -36864,16 +36982,13 @@ var StyleSheet = /*#__PURE__*/function () {
36864
36982
  };
36865
36983
 
36866
36984
  _proto.flush = function flush() {
36867
- // $FlowFixMe
36868
36985
  this.tags.forEach(function (tag) {
36869
- return tag.parentNode && tag.parentNode.removeChild(tag);
36986
+ var _tag$parentNode;
36987
+
36988
+ return (_tag$parentNode = tag.parentNode) == null ? void 0 : _tag$parentNode.removeChild(tag);
36870
36989
  });
36871
36990
  this.tags = [];
36872
36991
  this.ctr = 0;
36873
-
36874
- if (process.env.NODE_ENV !== 'production') {
36875
- this._alreadyInsertedOrderInsensitiveRule = false;
36876
- }
36877
36992
  };
36878
36993
 
36879
36994
  return StyleSheet;
@@ -36881,6 +36996,21 @@ var StyleSheet = /*#__PURE__*/function () {
36881
36996
 
36882
36997
  var e="-ms-";var r="-moz-";var a="-webkit-";var n="comm";var c="rule";var s="decl";var i="@import";var h="@keyframes";var $="@layer";var g=Math.abs;var k=String.fromCharCode;var m=Object.assign;function x(e,r){return O(e,0)^45?(((r<<2^O(e,0))<<2^O(e,1))<<2^O(e,2))<<2^O(e,3):0}function y(e){return e.trim()}function j(e,r){return (e=r.exec(e))?e[0]:e}function z(e,r,a){return e.replace(r,a)}function C(e,r){return e.indexOf(r)}function O(e,r){return e.charCodeAt(r)|0}function A(e,r,a){return e.slice(r,a)}function M(e){return e.length}function S(e){return e.length}function q(e,r){return r.push(e),e}function B(e,r){return e.map(r).join("")}var D=1;var E=1;var F=0;var G=0;var H=0;var I="";function J(e,r,a,n,c,s,t){return {value:e,root:r,parent:a,type:n,props:c,children:s,line:D,column:E,length:t,return:""}}function K(e,r){return m(J("",null,null,"",null,null,0),e,{length:-e.length},r)}function L(){return H}function N(){H=G>0?O(I,--G):0;if(E--,H===10)E=1,D--;return H}function P(){H=G<F?O(I,G++):0;if(E++,H===10)E=1,D++;return H}function Q(){return O(I,G)}function R(){return G}function T(e,r){return A(I,e,r)}function U(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function V(e){return D=E=1,F=M(I=e),G=0,[]}function W(e){return I="",e}function X(e){return y(T(G-1,re(e===91?e+2:e===40?e+1:e)))}function Z(e){while(H=Q())if(H<33)P();else break;return U(e)>2||U(H)>3?"":" "}function ee(e,r){while(--r&&P())if(H<48||H>102||H>57&&H<65||H>70&&H<97)break;return T(e,R()+(r<6&&Q()==32&&P()==32))}function re(e){while(P())switch(H){case e:return G;case 34:case 39:if(e!==34&&e!==39)re(H);break;case 40:if(e===41)re(e);break;case 92:P();break}return G}function ae(e,r){while(P())if(e+H===47+10)break;else if(e+H===42+42&&Q()===47)break;return "/*"+T(r,G-1)+"*"+k(e===47?e:P())}function ne(e){while(!U(Q()))P();return T(e,G)}function ce(e){return W(se("",null,null,null,[""],e=V(e),0,[0],e))}function se(e,r,a,n,c,s,t,u,i){var f=0;var o=0;var l=t;var v=0;var p=0;var h=0;var b=1;var w=1;var d=1;var $=0;var g="";var m=c;var x=s;var y=n;var j=g;while(w)switch(h=$,$=P()){case 40:if(h!=108&&O(j,l-1)==58){if(C(j+=z(X($),"&","&\f"),"&\f")!=-1)d=-1;break}case 34:case 39:case 91:j+=X($);break;case 9:case 10:case 13:case 32:j+=Z(h);break;case 92:j+=ee(R()-1,7);continue;case 47:switch(Q()){case 42:case 47:q(ue(ae(P(),R()),r,a),i);break;default:j+="/";}break;case 123*b:u[f++]=M(j)*d;case 125*b:case 59:case 0:switch($){case 0:case 125:w=0;case 59+o:if(d==-1)j=z(j,/\f/g,"");if(p>0&&M(j)-l)q(p>32?ie(j+";",n,a,l-1):ie(z(j," ","")+";",n,a,l-2),i);break;case 59:j+=";";default:q(y=te(j,r,a,f,o,c,u,g,m=[],x=[],l),s);if($===123)if(o===0)se(j,r,y,y,m,s,l,u,x);else switch(v===99&&O(j,3)===110?100:v){case 100:case 108:case 109:case 115:se(e,y,y,n&&q(te(e,y,y,0,0,c,u,g,c,m=[],l),x),c,x,l,u,n?m:x);break;default:se(j,y,y,y,[""],x,0,u,x);}}f=o=p=0,b=d=1,g=j="",l=t;break;case 58:l=1+M(j),p=h;default:if(b<1)if($==123)--b;else if($==125&&b++==0&&N()==125)continue;switch(j+=k($),$*b){case 38:d=o>0?1:(j+="\f",-1);break;case 44:u[f++]=(M(j)-1)*d,d=1;break;case 64:if(Q()===45)j+=X(P());v=Q(),o=l=M(g=j+=ne(R())),$++;break;case 45:if(h===45&&M(j)==2)b=0;}}return s}function te(e,r,a,n,s,t,u,i,f,o,l){var v=s-1;var p=s===0?t:[""];var h=S(p);for(var b=0,w=0,d=0;b<n;++b)for(var $=0,k=A(e,v+1,v=g(w=u[b])),m=e;$<h;++$)if(m=y(w>0?p[$]+" "+k:z(k,/&\f/g,p[$])))f[d++]=m;return J(e,r,a,s===0?c:i,f,o,l)}function ue(e,r,a){return J(e,r,a,n,k(L()),A(e,2,-2),0)}function ie(e,r,a,n){return J(e,r,a,s,A(e,0,n),A(e,n+1,-1),n)}function oe(e,r){var a="";var n=S(e);for(var c=0;c<n;c++)a+=r(e[c],c,e,r)||"";return a}function le(e,r,a,t){switch(e.type){case $:if(e.children.length)break;case i:case s:return e.return=e.return||e.value;case n:return "";case h:return e.return=e.value+"{"+oe(e.children,t)+"}";case c:e.value=e.props.join(",");}return M(a=oe(e.children,t))?e.return=e.value+"{"+a+"}":""}function ve(e){var r=S(e);return function(a,n,c,s){var t="";for(var u=0;u<r;u++)t+=e[u](a,n,c,s)||"";return t}}function pe(e){return function(r){if(!r.root)if(r=r.return)e(r);}}
36883
36998
 
36999
+ var weakMemoize = function weakMemoize(func) {
37000
+ var cache = new WeakMap();
37001
+ return function (arg) {
37002
+ if (cache.has(arg)) {
37003
+ // Use non-null assertion because we just checked that the cache `has` it
37004
+ // This allows us to remove `undefined` from the return value
37005
+ return cache.get(arg);
37006
+ }
37007
+
37008
+ var ret = func(arg);
37009
+ cache.set(arg, ret);
37010
+ return ret;
37011
+ };
37012
+ };
37013
+
36884
37014
  function memoize(fn) {
36885
37015
  var cache = Object.create(null);
36886
37016
  return function (arg) {
@@ -36889,6 +37019,8 @@ function memoize(fn) {
36889
37019
  };
36890
37020
  }
36891
37021
 
37022
+ var isBrowser = typeof document !== 'undefined';
37023
+
36892
37024
  var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
36893
37025
  var previous = 0;
36894
37026
  var character = 0;
@@ -37013,114 +37145,6 @@ var removeLabel = function removeLabel(element) {
37013
37145
  }
37014
37146
  }
37015
37147
  };
37016
- var ignoreFlag = 'emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason';
37017
-
37018
- var isIgnoringComment = function isIgnoringComment(element) {
37019
- return element.type === 'comm' && element.children.indexOf(ignoreFlag) > -1;
37020
- };
37021
-
37022
- var createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm(cache) {
37023
- return function (element, index, children) {
37024
- if (element.type !== 'rule' || cache.compat) return;
37025
- var unsafePseudoClasses = element.value.match(/(:first|:nth|:nth-last)-child/g);
37026
-
37027
- if (unsafePseudoClasses) {
37028
- var isNested = !!element.parent; // in nested rules comments become children of the "auto-inserted" rule and that's always the `element.parent`
37029
- //
37030
- // considering this input:
37031
- // .a {
37032
- // .b /* comm */ {}
37033
- // color: hotpink;
37034
- // }
37035
- // we get output corresponding to this:
37036
- // .a {
37037
- // & {
37038
- // /* comm */
37039
- // color: hotpink;
37040
- // }
37041
- // .b {}
37042
- // }
37043
-
37044
- var commentContainer = isNested ? element.parent.children : // global rule at the root level
37045
- children;
37046
-
37047
- for (var i = commentContainer.length - 1; i >= 0; i--) {
37048
- var node = commentContainer[i];
37049
-
37050
- if (node.line < element.line) {
37051
- break;
37052
- } // it is quite weird but comments are *usually* put at `column: element.column - 1`
37053
- // so we seek *from the end* for the node that is earlier than the rule's `element` and check that
37054
- // this will also match inputs like this:
37055
- // .a {
37056
- // /* comm */
37057
- // .b {}
37058
- // }
37059
- //
37060
- // but that is fine
37061
- //
37062
- // it would be the easiest to change the placement of the comment to be the first child of the rule:
37063
- // .a {
37064
- // .b { /* comm */ }
37065
- // }
37066
- // with such inputs we wouldn't have to search for the comment at all
37067
- // TODO: consider changing this comment placement in the next major version
37068
-
37069
-
37070
- if (node.column < element.column) {
37071
- if (isIgnoringComment(node)) {
37072
- return;
37073
- }
37074
-
37075
- break;
37076
- }
37077
- }
37078
-
37079
- unsafePseudoClasses.forEach(function (unsafePseudoClass) {
37080
- console.error("The pseudo class \"" + unsafePseudoClass + "\" is potentially unsafe when doing server-side rendering. Try changing it to \"" + unsafePseudoClass.split('-child')[0] + "-of-type\".");
37081
- });
37082
- }
37083
- };
37084
- };
37085
-
37086
- var isImportRule = function isImportRule(element) {
37087
- return element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64;
37088
- };
37089
-
37090
- var isPrependedWithRegularRules = function isPrependedWithRegularRules(index, children) {
37091
- for (var i = index - 1; i >= 0; i--) {
37092
- if (!isImportRule(children[i])) {
37093
- return true;
37094
- }
37095
- }
37096
-
37097
- return false;
37098
- }; // use this to remove incorrect elements from further processing
37099
- // so they don't get handed to the `sheet` (or anything else)
37100
- // as that could potentially lead to additional logs which in turn could be overhelming to the user
37101
-
37102
-
37103
- var nullifyElement = function nullifyElement(element) {
37104
- element.type = '';
37105
- element.value = '';
37106
- element["return"] = '';
37107
- element.children = '';
37108
- element.props = '';
37109
- };
37110
-
37111
- var incorrectImportAlarm = function incorrectImportAlarm(element, index, children) {
37112
- if (!isImportRule(element)) {
37113
- return;
37114
- }
37115
-
37116
- if (element.parent) {
37117
- console.error("`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles.");
37118
- nullifyElement(element);
37119
- } else if (isPrependedWithRegularRules(index, children)) {
37120
- console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules.");
37121
- nullifyElement(element);
37122
- }
37123
- };
37124
37148
 
37125
37149
  /* eslint-disable no-fallthrough */
37126
37150
 
@@ -37334,22 +37358,46 @@ var prefixer = function prefixer(element, index, children, callback) {
37334
37358
  }
37335
37359
  };
37336
37360
 
37361
+ /* import type { StylisPlugin } from './types' */
37362
+
37363
+ /*
37364
+ export type Options = {
37365
+ nonce?: string,
37366
+ stylisPlugins?: StylisPlugin[],
37367
+ key: string,
37368
+ container?: HTMLElement,
37369
+ speedy?: boolean,
37370
+ prepend?: boolean,
37371
+ insertionPoint?: HTMLElement
37372
+ }
37373
+ */
37374
+
37375
+ var getServerStylisCache = isBrowser ? undefined : weakMemoize(function () {
37376
+ return memoize(function () {
37377
+ var cache = {};
37378
+ return function (name) {
37379
+ return cache[name];
37380
+ };
37381
+ });
37382
+ });
37337
37383
  var defaultStylisPlugins = [prefixer];
37338
37384
 
37339
- var createCache = function createCache(options) {
37385
+ var createCache = function
37386
+ /*: EmotionCache */
37387
+ createCache(options
37388
+ /*: Options */
37389
+ ) {
37340
37390
  var key = options.key;
37341
37391
 
37342
- if (process.env.NODE_ENV !== 'production' && !key) {
37343
- throw new Error("You have to configure `key` for your cache. Please make sure it's unique (and not equal to 'css') as it's used for linking styles to your cache.\n" + "If multiple caches share the same key they might \"fight\" for each other's style elements.");
37344
- }
37345
-
37346
- if (key === 'css') {
37392
+ if (isBrowser && key === 'css') {
37347
37393
  var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration
37348
37394
  // document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)
37349
37395
  // note this very very intentionally targets all style elements regardless of the key to ensure
37350
37396
  // that creating a cache works inside of render of a React component
37351
37397
 
37352
- Array.prototype.forEach.call(ssrStyles, function (node) {
37398
+ Array.prototype.forEach.call(ssrStyles, function (node
37399
+ /*: HTMLStyleElement */
37400
+ ) {
37353
37401
  // we want to only move elements which have a space in the data-emotion attribute value
37354
37402
  // because that indicates that it is an Emotion 11 server-side rendered style elements
37355
37403
  // while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector
@@ -37361,6 +37409,7 @@ var createCache = function createCache(options) {
37361
37409
  if (dataEmotionAttribute.indexOf(' ') === -1) {
37362
37410
  return;
37363
37411
  }
37412
+
37364
37413
  document.head.appendChild(node);
37365
37414
  node.setAttribute('data-s', '');
37366
37415
  });
@@ -37368,23 +37417,20 @@ var createCache = function createCache(options) {
37368
37417
 
37369
37418
  var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
37370
37419
 
37371
- if (process.env.NODE_ENV !== 'production') {
37372
- // $FlowFixMe
37373
- if (/[^a-z-]/.test(key)) {
37374
- throw new Error("Emotion key must only contain lower case alphabetical characters and - but \"" + key + "\" was passed");
37375
- }
37376
- }
37377
-
37378
37420
  var inserted = {};
37379
37421
  var container;
37422
+ /* : Node */
37423
+
37380
37424
  var nodesToHydrate = [];
37381
37425
 
37382
- {
37426
+ if (isBrowser) {
37383
37427
  container = options.container || document.head;
37384
37428
  Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which
37385
37429
  // means that the style elements we're looking at are only Emotion 11 server-rendered style elements
37386
- document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) {
37387
- var attrib = node.getAttribute("data-emotion").split(' '); // $FlowFixMe
37430
+ document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node
37431
+ /*: HTMLStyleElement */
37432
+ ) {
37433
+ var attrib = node.getAttribute("data-emotion").split(' ');
37388
37434
 
37389
37435
  for (var i = 1; i < attrib.length; i++) {
37390
37436
  inserted[attrib[i]] = true;
@@ -37395,31 +37441,19 @@ var createCache = function createCache(options) {
37395
37441
  }
37396
37442
 
37397
37443
  var _insert;
37444
+ /*: (
37445
+ selector: string,
37446
+ serialized: SerializedStyles,
37447
+ sheet: StyleSheet,
37448
+ shouldCache: boolean
37449
+ ) => string | void */
37398
37450
 
37399
- var omnipresentPlugins = [compat, removeLabel];
37400
-
37401
- if (process.env.NODE_ENV !== 'production') {
37402
- omnipresentPlugins.push(createUnsafeSelectorsAlarm({
37403
- get compat() {
37404
- return cache.compat;
37405
- }
37406
37451
 
37407
- }), incorrectImportAlarm);
37408
- }
37452
+ var omnipresentPlugins = [compat, removeLabel];
37409
37453
 
37410
- {
37454
+ if (isBrowser) {
37411
37455
  var currentSheet;
37412
- var finalizingPlugins = [le, process.env.NODE_ENV !== 'production' ? function (element) {
37413
- if (!element.root) {
37414
- if (element["return"]) {
37415
- currentSheet.insert(element["return"]);
37416
- } else if (element.value && element.type !== n) {
37417
- // insert empty rule in non-production environments
37418
- // so @emotion/jest can grab `key` from the (JS)DOM for caches without any rules inserted yet
37419
- currentSheet.insert(element.value + "{}");
37420
- }
37421
- }
37422
- } : pe(function (rule) {
37456
+ var finalizingPlugins = [le, pe(function (rule) {
37423
37457
  currentSheet.insert(rule);
37424
37458
  })];
37425
37459
  var serializer = ve(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
@@ -37428,26 +37462,95 @@ var createCache = function createCache(options) {
37428
37462
  return oe(ce(styles), serializer);
37429
37463
  };
37430
37464
 
37431
- _insert = function insert(selector, serialized, sheet, shouldCache) {
37465
+ _insert = function
37466
+ /*: void */
37467
+ insert(selector
37468
+ /*: string */
37469
+ , serialized
37470
+ /*: SerializedStyles */
37471
+ , sheet
37472
+ /*: StyleSheet */
37473
+ , shouldCache
37474
+ /*: boolean */
37475
+ ) {
37432
37476
  currentSheet = sheet;
37433
37477
 
37434
- if (process.env.NODE_ENV !== 'production' && serialized.map !== undefined) {
37435
- currentSheet = {
37436
- insert: function insert(rule) {
37437
- sheet.insert(rule + serialized.map);
37438
- }
37439
- };
37440
- }
37441
-
37442
37478
  stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
37443
37479
 
37444
37480
  if (shouldCache) {
37445
37481
  cache.inserted[serialized.name] = true;
37446
37482
  }
37447
37483
  };
37484
+ } else {
37485
+ var _finalizingPlugins = [le];
37486
+
37487
+ var _serializer = ve(omnipresentPlugins.concat(stylisPlugins, _finalizingPlugins));
37488
+
37489
+ var _stylis = function _stylis(styles) {
37490
+ return oe(ce(styles), _serializer);
37491
+ };
37492
+
37493
+ var serverStylisCache = getServerStylisCache(stylisPlugins)(key);
37494
+
37495
+ var getRules = function
37496
+ /*: string */
37497
+ getRules(selector
37498
+ /*: string */
37499
+ , serialized
37500
+ /*: SerializedStyles */
37501
+ ) {
37502
+ var name = serialized.name;
37503
+
37504
+ if (serverStylisCache[name] === undefined) {
37505
+ serverStylisCache[name] = _stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
37506
+ }
37507
+
37508
+ return serverStylisCache[name];
37509
+ };
37510
+
37511
+ _insert = function
37512
+ /*: string | void */
37513
+ _insert(selector
37514
+ /*: string */
37515
+ , serialized
37516
+ /*: SerializedStyles */
37517
+ , sheet
37518
+ /*: StyleSheet */
37519
+ , shouldCache
37520
+ /*: boolean */
37521
+ ) {
37522
+ var name = serialized.name;
37523
+ var rules = getRules(selector, serialized);
37524
+
37525
+ if (cache.compat === undefined) {
37526
+ // in regular mode, we don't set the styles on the inserted cache
37527
+ // since we don't need to and that would be wasting memory
37528
+ // we return them so that they are rendered in a style tag
37529
+ if (shouldCache) {
37530
+ cache.inserted[name] = true;
37531
+ }
37532
+
37533
+ return rules;
37534
+ } else {
37535
+ // in compat mode, we put the styles on the inserted cache so
37536
+ // that emotion-server can pull out the styles
37537
+ // except when we don't want to cache it which was in Global but now
37538
+ // is nowhere but we don't want to do a major right now
37539
+ // and just in case we're going to leave the case here
37540
+ // it's also not affecting client side bundle size
37541
+ // so it's really not a big deal
37542
+ if (shouldCache) {
37543
+ cache.inserted[name] = rules;
37544
+ } else {
37545
+ return rules;
37546
+ }
37547
+ }
37548
+ };
37448
37549
  }
37449
37550
 
37450
- var cache = {
37551
+ var cache
37552
+ /*: EmotionCache */
37553
+ = {
37451
37554
  key: key,
37452
37555
  sheet: new StyleSheet({
37453
37556
  key: key,
@@ -37694,7 +37797,8 @@ if (process.env.NODE_ENV === 'production') {
37694
37797
  }
37695
37798
  });
37696
37799
 
37697
- var isBrowser = "object" !== 'undefined';
37800
+ var isBrowser$1 = typeof document !== 'undefined';
37801
+
37698
37802
  function getRegisteredStyles(registered, registeredStyles, classNames) {
37699
37803
  var rawClassName = '';
37700
37804
  classNames.split(' ').forEach(function (className) {
@@ -37718,7 +37822,7 @@ var registerStyles = function registerStyles(cache, serialized, isStringTag) {
37718
37822
  // in node since emotion-server relies on whether a style is in
37719
37823
  // the registered cache to know whether a style is global or not
37720
37824
  // also, note that this check will be dead code eliminated in the browser
37721
- isBrowser === false ) && cache.registered[className] === undefined) {
37825
+ isBrowser$1 === false && cache.compat !== undefined) && cache.registered[className] === undefined) {
37722
37826
  cache.registered[className] = serialized.styles;
37723
37827
  }
37724
37828
  };
@@ -37727,13 +37831,22 @@ var insertStyles = function insertStyles(cache, serialized, isStringTag) {
37727
37831
  var className = cache.key + "-" + serialized.name;
37728
37832
 
37729
37833
  if (cache.inserted[serialized.name] === undefined) {
37834
+ var stylesForSSR = '';
37730
37835
  var current = serialized;
37731
37836
 
37732
37837
  do {
37733
- cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true);
37838
+ var maybeStyles = cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true);
37839
+
37840
+ if (!isBrowser$1 && maybeStyles !== undefined) {
37841
+ stylesForSSR += maybeStyles;
37842
+ }
37734
37843
 
37735
37844
  current = current.next;
37736
37845
  } while (current !== undefined);
37846
+
37847
+ if (!isBrowser$1 && stylesForSSR.length !== 0) {
37848
+ return stylesForSSR;
37849
+ }
37737
37850
  }
37738
37851
  };
37739
37852
 
@@ -37841,8 +37954,16 @@ var unitlessKeys = {
37841
37954
  strokeWidth: 1
37842
37955
  };
37843
37956
 
37844
- var ILLEGAL_ESCAPE_SEQUENCE_ERROR = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences";
37845
- var UNDEFINED_AS_OBJECT_KEY_ERROR = "You have passed in falsy value as style object's key (can happen when in example you pass unexported component as computed key).";
37957
+ function memoize$1(fn) {
37958
+ var cache = Object.create(null);
37959
+ return function (arg) {
37960
+ if (cache[arg] === undefined) cache[arg] = fn(arg);
37961
+ return cache[arg];
37962
+ };
37963
+ }
37964
+
37965
+ var isDevelopment$1 = false;
37966
+
37846
37967
  var hyphenateRegex = /[A-Z]|^ms/g;
37847
37968
  var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g;
37848
37969
 
@@ -37854,7 +37975,7 @@ var isProcessableValue = function isProcessableValue(value) {
37854
37975
  return value != null && typeof value !== 'boolean';
37855
37976
  };
37856
37977
 
37857
- var processStyleName = /* #__PURE__ */memoize(function (styleName) {
37978
+ var processStyleName = /* #__PURE__ */memoize$1(function (styleName) {
37858
37979
  return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase();
37859
37980
  });
37860
37981
 
@@ -37883,34 +38004,6 @@ var processStyleValue = function processStyleValue(key, value) {
37883
38004
  return value;
37884
38005
  };
37885
38006
 
37886
- if (process.env.NODE_ENV !== 'production') {
37887
- var contentValuePattern = /(var|attr|counters?|url|element|(((repeating-)?(linear|radial))|conic)-gradient)\(|(no-)?(open|close)-quote/;
37888
- var contentValues = ['normal', 'none', 'initial', 'inherit', 'unset'];
37889
- var oldProcessStyleValue = processStyleValue;
37890
- var msPattern = /^-ms-/;
37891
- var hyphenPattern = /-(.)/g;
37892
- var hyphenatedCache = {};
37893
-
37894
- processStyleValue = function processStyleValue(key, value) {
37895
- if (key === 'content') {
37896
- if (typeof value !== 'string' || contentValues.indexOf(value) === -1 && !contentValuePattern.test(value) && (value.charAt(0) !== value.charAt(value.length - 1) || value.charAt(0) !== '"' && value.charAt(0) !== "'")) {
37897
- throw new Error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"" + value + "\"'`");
37898
- }
37899
- }
37900
-
37901
- var processed = oldProcessStyleValue(key, value);
37902
-
37903
- if (processed !== '' && !isCustomProperty(key) && key.indexOf('-') !== -1 && hyphenatedCache[key] === undefined) {
37904
- hyphenatedCache[key] = true;
37905
- console.error("Using kebab-case for css properties in objects is not supported. Did you mean " + key.replace(msPattern, 'ms-').replace(hyphenPattern, function (str, _char) {
37906
- return _char.toUpperCase();
37907
- }) + "?");
37908
- }
37909
-
37910
- return processed;
37911
- };
37912
- }
37913
-
37914
38007
  var noComponentSelectorMessage = 'Component selectors can only be used in conjunction with ' + '@emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware ' + 'compiler transform.';
37915
38008
 
37916
38009
  function handleInterpolation(mergedProps, registered, interpolation) {
@@ -37918,12 +38011,11 @@ function handleInterpolation(mergedProps, registered, interpolation) {
37918
38011
  return '';
37919
38012
  }
37920
38013
 
37921
- if (interpolation.__emotion_styles !== undefined) {
37922
- if (process.env.NODE_ENV !== 'production' && interpolation.toString() === 'NO_COMPONENT_SELECTOR') {
37923
- throw new Error(noComponentSelectorMessage);
37924
- }
38014
+ var componentSelector = interpolation;
38015
+
38016
+ if (componentSelector.__emotion_styles !== undefined) {
37925
38017
 
37926
- return interpolation;
38018
+ return componentSelector;
37927
38019
  }
37928
38020
 
37929
38021
  switch (typeof interpolation) {
@@ -37934,17 +38026,21 @@ function handleInterpolation(mergedProps, registered, interpolation) {
37934
38026
 
37935
38027
  case 'object':
37936
38028
  {
37937
- if (interpolation.anim === 1) {
38029
+ var keyframes = interpolation;
38030
+
38031
+ if (keyframes.anim === 1) {
37938
38032
  cursor = {
37939
- name: interpolation.name,
37940
- styles: interpolation.styles,
38033
+ name: keyframes.name,
38034
+ styles: keyframes.styles,
37941
38035
  next: cursor
37942
38036
  };
37943
- return interpolation.name;
38037
+ return keyframes.name;
37944
38038
  }
37945
38039
 
37946
- if (interpolation.styles !== undefined) {
37947
- var next = interpolation.next;
38040
+ var serializedStyles = interpolation;
38041
+
38042
+ if (serializedStyles.styles !== undefined) {
38043
+ var next = serializedStyles.next;
37948
38044
 
37949
38045
  if (next !== undefined) {
37950
38046
  // not the most efficient thing ever but this is a pretty rare case
@@ -37959,11 +38055,7 @@ function handleInterpolation(mergedProps, registered, interpolation) {
37959
38055
  }
37960
38056
  }
37961
38057
 
37962
- var styles = interpolation.styles + ";";
37963
-
37964
- if (process.env.NODE_ENV !== 'production' && interpolation.map !== undefined) {
37965
- styles += interpolation.map;
37966
- }
38058
+ var styles = serializedStyles.styles + ";";
37967
38059
 
37968
38060
  return styles;
37969
38061
  }
@@ -37978,37 +38070,21 @@ function handleInterpolation(mergedProps, registered, interpolation) {
37978
38070
  var result = interpolation(mergedProps);
37979
38071
  cursor = previousCursor;
37980
38072
  return handleInterpolation(mergedProps, registered, result);
37981
- } else if (process.env.NODE_ENV !== 'production') {
37982
- console.error('Functions that are interpolated in css calls will be stringified.\n' + 'If you want to have a css call based on props, create a function that returns a css call like this\n' + 'let dynamicStyle = (props) => css`color: ${props.color}`\n' + 'It can be called directly with props or interpolated in a styled call like this\n' + "let SomeComponent = styled('div')`${dynamicStyle}`");
37983
38073
  }
37984
38074
 
37985
38075
  break;
37986
38076
  }
37987
-
37988
- case 'string':
37989
- if (process.env.NODE_ENV !== 'production') {
37990
- var matched = [];
37991
- var replaced = interpolation.replace(animationRegex, function (match, p1, p2) {
37992
- var fakeVarName = "animation" + matched.length;
37993
- matched.push("const " + fakeVarName + " = keyframes`" + p2.replace(/^@keyframes animation-\w+/, '') + "`");
37994
- return "${" + fakeVarName + "}";
37995
- });
37996
-
37997
- if (matched.length) {
37998
- console.error('`keyframes` output got interpolated into plain string, please wrap it with `css`.\n\n' + 'Instead of doing this:\n\n' + [].concat(matched, ["`" + replaced + "`"]).join('\n') + '\n\nYou should wrap it with `css` like this:\n\n' + ("css`" + replaced + "`"));
37999
- }
38000
- }
38001
-
38002
- break;
38003
38077
  } // finalize string values (regular strings and functions interpolated into css calls)
38004
38078
 
38005
38079
 
38080
+ var asString = interpolation;
38081
+
38006
38082
  if (registered == null) {
38007
- return interpolation;
38083
+ return asString;
38008
38084
  }
38009
38085
 
38010
- var cached = registered[interpolation];
38011
- return cached !== undefined ? cached : interpolation;
38086
+ var cached = registered[asString];
38087
+ return cached !== undefined ? cached : asString;
38012
38088
  }
38013
38089
 
38014
38090
  function createStringFromObject(mergedProps, registered, obj) {
@@ -38019,44 +38095,43 @@ function createStringFromObject(mergedProps, registered, obj) {
38019
38095
  string += handleInterpolation(mergedProps, registered, obj[i]) + ";";
38020
38096
  }
38021
38097
  } else {
38022
- for (var _key in obj) {
38023
- var value = obj[_key];
38098
+ for (var key in obj) {
38099
+ var value = obj[key];
38024
38100
 
38025
38101
  if (typeof value !== 'object') {
38026
- if (registered != null && registered[value] !== undefined) {
38027
- string += _key + "{" + registered[value] + "}";
38028
- } else if (isProcessableValue(value)) {
38029
- string += processStyleName(_key) + ":" + processStyleValue(_key, value) + ";";
38102
+ var asString = value;
38103
+
38104
+ if (registered != null && registered[asString] !== undefined) {
38105
+ string += key + "{" + registered[asString] + "}";
38106
+ } else if (isProcessableValue(asString)) {
38107
+ string += processStyleName(key) + ":" + processStyleValue(key, asString) + ";";
38030
38108
  }
38031
38109
  } else {
38032
- if (_key === 'NO_COMPONENT_SELECTOR' && process.env.NODE_ENV !== 'production') {
38110
+ if (key === 'NO_COMPONENT_SELECTOR' && isDevelopment$1) {
38033
38111
  throw new Error(noComponentSelectorMessage);
38034
38112
  }
38035
38113
 
38036
38114
  if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) {
38037
38115
  for (var _i = 0; _i < value.length; _i++) {
38038
38116
  if (isProcessableValue(value[_i])) {
38039
- string += processStyleName(_key) + ":" + processStyleValue(_key, value[_i]) + ";";
38117
+ string += processStyleName(key) + ":" + processStyleValue(key, value[_i]) + ";";
38040
38118
  }
38041
38119
  }
38042
38120
  } else {
38043
38121
  var interpolated = handleInterpolation(mergedProps, registered, value);
38044
38122
 
38045
- switch (_key) {
38123
+ switch (key) {
38046
38124
  case 'animation':
38047
38125
  case 'animationName':
38048
38126
  {
38049
- string += processStyleName(_key) + ":" + interpolated + ";";
38127
+ string += processStyleName(key) + ":" + interpolated + ";";
38050
38128
  break;
38051
38129
  }
38052
38130
 
38053
38131
  default:
38054
38132
  {
38055
- if (process.env.NODE_ENV !== 'production' && _key === 'undefined') {
38056
- console.error(UNDEFINED_AS_OBJECT_KEY_ERROR);
38057
- }
38058
38133
 
38059
- string += _key + "{" + interpolated + "}";
38134
+ string += key + "{" + interpolated + "}";
38060
38135
  }
38061
38136
  }
38062
38137
  }
@@ -38068,16 +38143,11 @@ function createStringFromObject(mergedProps, registered, obj) {
38068
38143
  }
38069
38144
 
38070
38145
  var labelPattern = /label:\s*([^\s;\n{]+)\s*(;|$)/g;
38071
- var sourceMapPattern;
38072
-
38073
- if (process.env.NODE_ENV !== 'production') {
38074
- sourceMapPattern = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g;
38075
- } // this is the cursor for keyframes
38076
38146
  // keyframes are stored on the SerializedStyles object as a linked list
38077
38147
 
38078
38148
 
38079
38149
  var cursor;
38080
- var serializeStyles = function serializeStyles(args, registered, mergedProps) {
38150
+ function serializeStyles(args, registered, mergedProps) {
38081
38151
  if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) {
38082
38152
  return args[0];
38083
38153
  }
@@ -38091,11 +38161,9 @@ var serializeStyles = function serializeStyles(args, registered, mergedProps) {
38091
38161
  stringMode = false;
38092
38162
  styles += handleInterpolation(mergedProps, registered, strings);
38093
38163
  } else {
38094
- if (process.env.NODE_ENV !== 'production' && strings[0] === undefined) {
38095
- console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR);
38096
- }
38164
+ var asTemplateStringsArr = strings;
38097
38165
 
38098
- styles += strings[0];
38166
+ styles += asTemplateStringsArr[0];
38099
38167
  } // we start at 1 since we've already handled the first arg
38100
38168
 
38101
38169
 
@@ -38103,66 +38171,47 @@ var serializeStyles = function serializeStyles(args, registered, mergedProps) {
38103
38171
  styles += handleInterpolation(mergedProps, registered, args[i]);
38104
38172
 
38105
38173
  if (stringMode) {
38106
- if (process.env.NODE_ENV !== 'production' && strings[i] === undefined) {
38107
- console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR);
38108
- }
38174
+ var templateStringsArr = strings;
38109
38175
 
38110
- styles += strings[i];
38176
+ styles += templateStringsArr[i];
38111
38177
  }
38112
38178
  }
38113
38179
 
38114
- var sourceMap;
38115
-
38116
- if (process.env.NODE_ENV !== 'production') {
38117
- styles = styles.replace(sourceMapPattern, function (match) {
38118
- sourceMap = match;
38119
- return '';
38120
- });
38121
- } // using a global regex with .exec is stateful so lastIndex has to be reset each time
38122
-
38123
38180
 
38124
38181
  labelPattern.lastIndex = 0;
38125
38182
  var identifierName = '';
38126
38183
  var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5
38127
38184
 
38128
38185
  while ((match = labelPattern.exec(styles)) !== null) {
38129
- identifierName += '-' + // $FlowFixMe we know it's not null
38130
- match[1];
38186
+ identifierName += '-' + match[1];
38131
38187
  }
38132
38188
 
38133
38189
  var name = murmur2(styles) + identifierName;
38134
38190
 
38135
- if (process.env.NODE_ENV !== 'production') {
38136
- // $FlowFixMe SerializedStyles type doesn't have toString property (and we don't want to add it)
38137
- return {
38138
- name: name,
38139
- styles: styles,
38140
- map: sourceMap,
38141
- next: cursor,
38142
- toString: function toString() {
38143
- return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).";
38144
- }
38145
- };
38146
- }
38147
-
38148
38191
  return {
38149
38192
  name: name,
38150
38193
  styles: styles,
38151
38194
  next: cursor
38152
38195
  };
38153
- };
38196
+ }
38197
+
38198
+ var isBrowser$2 = typeof document !== 'undefined';
38154
38199
 
38155
38200
  var syncFallback = function syncFallback(create) {
38156
38201
  return create();
38157
38202
  };
38158
38203
 
38159
38204
  var useInsertionEffect = React['useInsertion' + 'Effect'] ? React['useInsertion' + 'Effect'] : false;
38160
- var useInsertionEffectAlwaysWithSyncFallback = useInsertionEffect || syncFallback;
38161
- var useInsertionEffectWithLayoutFallback = useInsertionEffect || React.useLayoutEffect;
38205
+ var useInsertionEffectAlwaysWithSyncFallback = !isBrowser$2 ? syncFallback : useInsertionEffect || syncFallback;
38162
38206
 
38163
- var hasOwn = {}.hasOwnProperty;
38207
+ var isDevelopment$2 = false;
38208
+
38209
+ var isBrowser$3 = typeof document !== 'undefined';
38164
38210
 
38165
- var EmotionCacheContext = /* #__PURE__ */React.createContext( // we're doing this to avoid preconstruct's dead code elimination in this one case
38211
+ /* import { type EmotionCache } from '@emotion/utils' */
38212
+ var EmotionCacheContext
38213
+ /*: React.Context<EmotionCache | null> */
38214
+ = /* #__PURE__ */React.createContext( // we're doing this to avoid preconstruct's dead code elimination in this one case
38166
38215
  // because this module is primarily intended for the browser and node
38167
38216
  // but it's also required in react native and similar environments sometimes
38168
38217
  // and we could have a special build just for that
@@ -38172,77 +38221,70 @@ typeof HTMLElement !== 'undefined' ? /* #__PURE__ */createCache({
38172
38221
  key: 'css'
38173
38222
  }) : null);
38174
38223
 
38175
- if (process.env.NODE_ENV !== 'production') {
38176
- EmotionCacheContext.displayName = 'EmotionCacheContext';
38177
- }
38178
-
38179
- var withEmotionCache = function withEmotionCache(func) {
38180
- // $FlowFixMe
38181
- return /*#__PURE__*/React.forwardRef(function (props, ref) {
38224
+ var withEmotionCache = function withEmotionCache
38225
+ /* <Props, Ref: React.Ref<*>> */
38226
+ (func
38227
+ /*: (props: Props, cache: EmotionCache, ref: Ref) => React.Node */
38228
+ )
38229
+ /*: React.AbstractComponent<Props> */
38230
+ {
38231
+ return /*#__PURE__*/React.forwardRef(function (props
38232
+ /*: Props */
38233
+ , ref
38234
+ /*: Ref */
38235
+ ) {
38182
38236
  // the cache will never be null in the browser
38183
38237
  var cache = React.useContext(EmotionCacheContext);
38184
38238
  return func(props, cache, ref);
38185
38239
  });
38186
38240
  };
38187
38241
 
38188
- var ThemeContext = /* #__PURE__ */React.createContext({});
38189
-
38190
- if (process.env.NODE_ENV !== 'production') {
38191
- ThemeContext.displayName = 'EmotionThemeContext';
38242
+ if (!isBrowser$3) {
38243
+ withEmotionCache = function withEmotionCache
38244
+ /* <Props> */
38245
+ (func
38246
+ /*: (props: Props, cache: EmotionCache) => React.Node */
38247
+ )
38248
+ /*: React.StatelessFunctionalComponent<Props> */
38249
+ {
38250
+ return function (props
38251
+ /*: Props */
38252
+ ) {
38253
+ var cache = React.useContext(EmotionCacheContext);
38254
+
38255
+ if (cache === null) {
38256
+ // yes, we're potentially creating this on every render
38257
+ // it doesn't actually matter though since it's only on the server
38258
+ // so there will only every be a single render
38259
+ // that could change in the future because of suspense and etc. but for now,
38260
+ // this works and i don't want to optimise for a future thing that we aren't sure about
38261
+ cache = createCache({
38262
+ key: 'css'
38263
+ });
38264
+ return /*#__PURE__*/React.createElement(EmotionCacheContext.Provider, {
38265
+ value: cache
38266
+ }, func(props, cache));
38267
+ } else {
38268
+ return func(props, cache);
38269
+ }
38270
+ };
38271
+ };
38192
38272
  }
38193
38273
 
38194
- var getLastPart = function getLastPart(functionName) {
38195
- // The match may be something like 'Object.createEmotionProps' or
38196
- // 'Loader.prototype.render'
38197
- var parts = functionName.split('.');
38198
- return parts[parts.length - 1];
38199
- };
38200
-
38201
- var getFunctionNameFromStackTraceLine = function getFunctionNameFromStackTraceLine(line) {
38202
- // V8
38203
- var match = /^\s+at\s+([A-Za-z0-9$.]+)\s/.exec(line);
38204
- if (match) return getLastPart(match[1]); // Safari / Firefox
38205
-
38206
- match = /^([A-Za-z0-9$.]+)@/.exec(line);
38207
- if (match) return getLastPart(match[1]);
38208
- return undefined;
38209
- };
38210
-
38211
- var internalReactFunctionNames = /* #__PURE__ */new Set(['renderWithHooks', 'processChild', 'finishClassComponent', 'renderToString']); // These identifiers come from error stacks, so they have to be valid JS
38212
- // identifiers, thus we only need to replace what is a valid character for JS,
38213
- // but not for CSS.
38214
-
38215
- var sanitizeIdentifier = function sanitizeIdentifier(identifier) {
38216
- return identifier.replace(/\$/g, '-');
38217
- };
38218
-
38219
- var getLabelFromStackTrace = function getLabelFromStackTrace(stackTrace) {
38220
- if (!stackTrace) return undefined;
38221
- var lines = stackTrace.split('\n');
38222
-
38223
- for (var i = 0; i < lines.length; i++) {
38224
- var functionName = getFunctionNameFromStackTraceLine(lines[i]); // The first line of V8 stack traces is just "Error"
38225
-
38226
- if (!functionName) continue; // If we reach one of these, we have gone too far and should quit
38227
-
38228
- if (internalReactFunctionNames.has(functionName)) break; // The component name is the first function in the stack that starts with an
38229
- // uppercase letter
38230
-
38231
- if (/^[A-Z]/.test(functionName)) return sanitizeIdentifier(functionName);
38232
- }
38274
+ var ThemeContext = /* #__PURE__ */React.createContext({});
38233
38275
 
38234
- return undefined;
38235
- };
38276
+ var hasOwn = {}.hasOwnProperty;
38236
38277
 
38237
38278
  var typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__';
38238
- var labelPropName = '__EMOTION_LABEL_PLEASE_DO_NOT_USE__';
38239
- var createEmotionProps = function createEmotionProps(type, props) {
38240
- if (process.env.NODE_ENV !== 'production' && typeof props.css === 'string' && // check if there is a css declaration
38241
- props.css.indexOf(':') !== -1) {
38242
- throw new Error("Strings are not allowed as css prop values, please wrap it in a css template literal from '@emotion/react' like this: css`" + props.css + "`");
38243
- }
38279
+ var createEmotionProps = function createEmotionProps(type
38280
+ /*: React.ElementType */
38281
+ , props
38282
+ /*: Object */
38283
+ ) {
38244
38284
 
38245
- var newProps = {};
38285
+ var newProps
38286
+ /*: any */
38287
+ = {};
38246
38288
 
38247
38289
  for (var key in props) {
38248
38290
  if (hasOwn.call(props, key)) {
@@ -38250,13 +38292,7 @@ var createEmotionProps = function createEmotionProps(type, props) {
38250
38292
  }
38251
38293
  }
38252
38294
 
38253
- newProps[typePropName] = type; // For performance, only call getLabelFromStackTrace in development and when
38254
- // the label hasn't already been computed
38255
-
38256
- if (process.env.NODE_ENV !== 'production' && !!props.css && (typeof props.css !== 'object' || typeof props.css.name !== 'string' || props.css.name.indexOf('-') === -1)) {
38257
- var label = getLabelFromStackTrace(new Error().stack);
38258
- if (label) newProps[labelPropName] = label;
38259
- }
38295
+ newProps[typePropName] = type; // Runtime labeling is an opt-in feature because:
38260
38296
 
38261
38297
  return newProps;
38262
38298
  };
@@ -38266,14 +38302,32 @@ var Insertion = function Insertion(_ref) {
38266
38302
  serialized = _ref.serialized,
38267
38303
  isStringTag = _ref.isStringTag;
38268
38304
  registerStyles(cache, serialized, isStringTag);
38269
- useInsertionEffectAlwaysWithSyncFallback(function () {
38305
+ var rules = useInsertionEffectAlwaysWithSyncFallback(function () {
38270
38306
  return insertStyles(cache, serialized, isStringTag);
38271
38307
  });
38272
38308
 
38309
+ if (!isBrowser$3 && rules !== undefined) {
38310
+ var _ref2;
38311
+
38312
+ var serializedNames = serialized.name;
38313
+ var next = serialized.next;
38314
+
38315
+ while (next !== undefined) {
38316
+ serializedNames += ' ' + next.name;
38317
+ next = next.next;
38318
+ }
38319
+
38320
+ return /*#__PURE__*/React.createElement("style", (_ref2 = {}, _ref2["data-emotion"] = cache.key + " " + serializedNames, _ref2.dangerouslySetInnerHTML = {
38321
+ __html: rules
38322
+ }, _ref2.nonce = cache.sheet.nonce, _ref2));
38323
+ }
38324
+
38273
38325
  return null;
38274
38326
  };
38275
38327
 
38276
- var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {
38328
+ var Emotion = /* #__PURE__ */withEmotionCache(
38329
+ /* <any, any> */
38330
+ function (props, cache, ref) {
38277
38331
  var cssProp = props.css; // so that using `css` from `emotion` and passing the result to the css prop works
38278
38332
  // not passing the registered cache to serializeStyles because it would
38279
38333
  // make certain babel optimisations not possible
@@ -38294,25 +38348,21 @@ var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {
38294
38348
 
38295
38349
  var serialized = serializeStyles(registeredStyles, undefined, React.useContext(ThemeContext));
38296
38350
 
38297
- if (process.env.NODE_ENV !== 'production' && serialized.name.indexOf('-') === -1) {
38298
- var labelFromStack = props[labelPropName];
38299
-
38300
- if (labelFromStack) {
38301
- serialized = serializeStyles([serialized, 'label:' + labelFromStack + ';']);
38302
- }
38303
- }
38304
-
38305
38351
  className += cache.key + "-" + serialized.name;
38306
38352
  var newProps = {};
38307
38353
 
38308
38354
  for (var key in props) {
38309
- if (hasOwn.call(props, key) && key !== 'css' && key !== typePropName && (process.env.NODE_ENV === 'production' || key !== labelPropName)) {
38355
+ if (hasOwn.call(props, key) && key !== 'css' && key !== typePropName && (!isDevelopment$2 )) {
38310
38356
  newProps[key] = props[key];
38311
38357
  }
38312
38358
  }
38313
38359
 
38314
- newProps.ref = ref;
38315
38360
  newProps.className = className;
38361
+
38362
+ if (ref) {
38363
+ newProps.ref = ref;
38364
+ }
38365
+
38316
38366
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Insertion, {
38317
38367
  cache: cache,
38318
38368
  serialized: serialized,
@@ -38320,10 +38370,6 @@ var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {
38320
38370
  }), /*#__PURE__*/React.createElement(WrappedComponent, newProps));
38321
38371
  });
38322
38372
 
38323
- if (process.env.NODE_ENV !== 'production') {
38324
- Emotion.displayName = 'EmotionCssPropInternal';
38325
- }
38326
-
38327
38373
  var Emotion$1 = Emotion;
38328
38374
 
38329
38375
  var _extends_1 = createCommonjsModule(function (module) {
@@ -38341,143 +38387,18 @@ module.exports = _extends, module.exports.__esModule = true, module.exports["def
38341
38387
 
38342
38388
  unwrapExports(_extends_1);
38343
38389
 
38344
- var pkg = {
38345
- name: "@emotion/react",
38346
- version: "11.11.4",
38347
- main: "dist/emotion-react.cjs.js",
38348
- module: "dist/emotion-react.esm.js",
38349
- browser: {
38350
- "./dist/emotion-react.esm.js": "./dist/emotion-react.browser.esm.js"
38351
- },
38352
- exports: {
38353
- ".": {
38354
- module: {
38355
- worker: "./dist/emotion-react.worker.esm.js",
38356
- browser: "./dist/emotion-react.browser.esm.js",
38357
- "default": "./dist/emotion-react.esm.js"
38358
- },
38359
- "import": "./dist/emotion-react.cjs.mjs",
38360
- "default": "./dist/emotion-react.cjs.js"
38361
- },
38362
- "./jsx-runtime": {
38363
- module: {
38364
- worker: "./jsx-runtime/dist/emotion-react-jsx-runtime.worker.esm.js",
38365
- browser: "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js",
38366
- "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.esm.js"
38367
- },
38368
- "import": "./jsx-runtime/dist/emotion-react-jsx-runtime.cjs.mjs",
38369
- "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.cjs.js"
38370
- },
38371
- "./_isolated-hnrs": {
38372
- module: {
38373
- worker: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.worker.esm.js",
38374
- browser: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.esm.js",
38375
- "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.esm.js"
38376
- },
38377
- "import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.mjs",
38378
- "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.js"
38379
- },
38380
- "./jsx-dev-runtime": {
38381
- module: {
38382
- worker: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.worker.esm.js",
38383
- browser: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.esm.js",
38384
- "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.esm.js"
38385
- },
38386
- "import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.mjs",
38387
- "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.js"
38388
- },
38389
- "./package.json": "./package.json",
38390
- "./types/css-prop": "./types/css-prop.d.ts",
38391
- "./macro": {
38392
- types: {
38393
- "import": "./macro.d.mts",
38394
- "default": "./macro.d.ts"
38395
- },
38396
- "default": "./macro.js"
38397
- }
38398
- },
38399
- types: "types/index.d.ts",
38400
- files: [
38401
- "src",
38402
- "dist",
38403
- "jsx-runtime",
38404
- "jsx-dev-runtime",
38405
- "_isolated-hnrs",
38406
- "types/*.d.ts",
38407
- "macro.*"
38408
- ],
38409
- sideEffects: false,
38410
- author: "Emotion Contributors",
38411
- license: "MIT",
38412
- scripts: {
38413
- "test:typescript": "dtslint types"
38414
- },
38415
- dependencies: {
38416
- "@babel/runtime": "^7.18.3",
38417
- "@emotion/babel-plugin": "^11.11.0",
38418
- "@emotion/cache": "^11.11.0",
38419
- "@emotion/serialize": "^1.1.3",
38420
- "@emotion/use-insertion-effect-with-fallbacks": "^1.0.1",
38421
- "@emotion/utils": "^1.2.1",
38422
- "@emotion/weak-memoize": "^0.3.1",
38423
- "hoist-non-react-statics": "^3.3.1"
38424
- },
38425
- peerDependencies: {
38426
- react: ">=16.8.0"
38427
- },
38428
- peerDependenciesMeta: {
38429
- "@types/react": {
38430
- optional: true
38431
- }
38432
- },
38433
- devDependencies: {
38434
- "@definitelytyped/dtslint": "0.0.112",
38435
- "@emotion/css": "11.11.2",
38436
- "@emotion/css-prettifier": "1.1.3",
38437
- "@emotion/server": "11.11.0",
38438
- "@emotion/styled": "11.11.0",
38439
- "html-tag-names": "^1.1.2",
38440
- react: "16.14.0",
38441
- "svg-tag-names": "^1.1.1",
38442
- typescript: "^4.5.5"
38443
- },
38444
- repository: "https://github.com/emotion-js/emotion/tree/main/packages/react",
38445
- publishConfig: {
38446
- access: "public"
38447
- },
38448
- "umd:main": "dist/emotion-react.umd.min.js",
38449
- preconstruct: {
38450
- entrypoints: [
38451
- "./index.js",
38452
- "./jsx-runtime.js",
38453
- "./jsx-dev-runtime.js",
38454
- "./_isolated-hnrs.js"
38455
- ],
38456
- umdName: "emotionReact",
38457
- exports: {
38458
- envConditions: [
38459
- "browser",
38460
- "worker"
38461
- ],
38462
- extra: {
38463
- "./types/css-prop": "./types/css-prop.d.ts",
38464
- "./macro": {
38465
- types: {
38466
- "import": "./macro.d.mts",
38467
- "default": "./macro.d.ts"
38468
- },
38469
- "default": "./macro.js"
38470
- }
38471
- }
38472
- }
38473
- }
38474
- };
38475
-
38476
- var jsx = function jsx(type, props) {
38390
+ var jsx
38391
+ /*: typeof React.createElement */
38392
+ = function jsx
38393
+ /*: typeof React.createElement */
38394
+ (type
38395
+ /*: React.ElementType */
38396
+ , props
38397
+ /*: Object */
38398
+ ) {
38477
38399
  var args = arguments;
38478
38400
 
38479
38401
  if (props == null || !hasOwn.call(props, 'css')) {
38480
- // $FlowFixMe
38481
38402
  return React.createElement.apply(undefined, args);
38482
38403
  }
38483
38404
 
@@ -38488,95 +38409,16 @@ var jsx = function jsx(type, props) {
38488
38409
 
38489
38410
  for (var i = 2; i < argsLength; i++) {
38490
38411
  createElementArgArray[i] = args[i];
38491
- } // $FlowFixMe
38492
-
38412
+ }
38493
38413
 
38494
38414
  return React.createElement.apply(null, createElementArgArray);
38495
38415
  };
38496
38416
 
38497
- var warnedAboutCssPropForGlobal = false; // maintain place over rerenders.
38498
- // initial render from browser, insertBefore context.sheet.tags[0] or if a style hasn't been inserted there yet, appendChild
38499
- // initial client-side render from SSR, use place of hydrating tag
38500
-
38501
- var Global = /* #__PURE__ */withEmotionCache(function (props, cache) {
38502
- if (process.env.NODE_ENV !== 'production' && !warnedAboutCssPropForGlobal && ( // check for className as well since the user is
38503
- // probably using the custom createElement which
38504
- // means it will be turned into a className prop
38505
- // $FlowFixMe I don't really want to add it to the type since it shouldn't be used
38506
- props.className || props.css)) {
38507
- console.error("It looks like you're using the css prop on Global, did you mean to use the styles prop instead?");
38508
- warnedAboutCssPropForGlobal = true;
38509
- }
38417
+ /* import type { Interpolation, SerializedStyles } from '@emotion/utils' */
38510
38418
 
38511
- var styles = props.styles;
38512
- var serialized = serializeStyles([styles], undefined, React.useContext(ThemeContext));
38513
- // but it is based on a constant that will never change at runtime
38514
- // it's effectively like having two implementations and switching them out
38515
- // so it's not actually breaking anything
38516
-
38517
-
38518
- var sheetRef = React.useRef();
38519
- useInsertionEffectWithLayoutFallback(function () {
38520
- var key = cache.key + "-global"; // use case of https://github.com/emotion-js/emotion/issues/2675
38521
-
38522
- var sheet = new cache.sheet.constructor({
38523
- key: key,
38524
- nonce: cache.sheet.nonce,
38525
- container: cache.sheet.container,
38526
- speedy: cache.sheet.isSpeedy
38527
- });
38528
- var rehydrating = false; // $FlowFixMe
38529
-
38530
- var node = document.querySelector("style[data-emotion=\"" + key + " " + serialized.name + "\"]");
38531
-
38532
- if (cache.sheet.tags.length) {
38533
- sheet.before = cache.sheet.tags[0];
38534
- }
38535
-
38536
- if (node !== null) {
38537
- rehydrating = true; // clear the hash so this node won't be recognizable as rehydratable by other <Global/>s
38538
-
38539
- node.setAttribute('data-emotion', key);
38540
- sheet.hydrate([node]);
38541
- }
38542
-
38543
- sheetRef.current = [sheet, rehydrating];
38544
- return function () {
38545
- sheet.flush();
38546
- };
38547
- }, [cache]);
38548
- useInsertionEffectWithLayoutFallback(function () {
38549
- var sheetRefCurrent = sheetRef.current;
38550
- var sheet = sheetRefCurrent[0],
38551
- rehydrating = sheetRefCurrent[1];
38552
-
38553
- if (rehydrating) {
38554
- sheetRefCurrent[1] = false;
38555
- return;
38556
- }
38557
-
38558
- if (serialized.next !== undefined) {
38559
- // insert keyframes
38560
- insertStyles(cache, serialized.next, true);
38561
- }
38562
-
38563
- if (sheet.tags.length) {
38564
- // if this doesn't exist then it will be null so the style element will be appended
38565
- var element = sheet.tags[sheet.tags.length - 1].nextElementSibling;
38566
- sheet.before = element;
38567
- sheet.flush();
38568
- }
38569
-
38570
- cache.insert("", serialized, sheet, false);
38571
- }, [cache, serialized.name]);
38572
- return null;
38573
- });
38574
-
38575
- if (process.env.NODE_ENV !== 'production') {
38576
- Global.displayName = 'EmotionGlobal';
38577
- }
38578
-
38579
- function css() {
38419
+ function css()
38420
+ /*: SerializedStyles */
38421
+ {
38580
38422
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
38581
38423
  args[_key] = arguments[_key];
38582
38424
  }
@@ -38584,10 +38426,20 @@ function css() {
38584
38426
  return serializeStyles(args);
38585
38427
  }
38586
38428
 
38587
- var keyframes = function keyframes() {
38588
- var insertable = css.apply(void 0, arguments);
38589
- var name = "animation-" + insertable.name; // $FlowFixMe
38429
+ /*
38430
+ type Keyframes = {|
38431
+ name: string,
38432
+ styles: string,
38433
+ anim: 1,
38434
+ toString: () => string
38435
+ |} & string
38436
+ */
38590
38437
 
38438
+ var keyframes = function
38439
+ /*: Keyframes */
38440
+ keyframes() {
38441
+ var insertable = css.apply(void 0, arguments);
38442
+ var name = "animation-" + insertable.name;
38591
38443
  return {
38592
38444
  name: name,
38593
38445
  styles: "@keyframes " + name + "{" + insertable.styles + "}",
@@ -38598,7 +38450,21 @@ var keyframes = function keyframes() {
38598
38450
  };
38599
38451
  };
38600
38452
 
38601
- var classnames = function classnames(args) {
38453
+ /*
38454
+ type ClassNameArg =
38455
+ | string
38456
+ | boolean
38457
+ | { [key: string]: boolean }
38458
+ | Array<ClassNameArg>
38459
+ | null
38460
+ | void
38461
+ */
38462
+
38463
+ var classnames = function
38464
+ /*: string */
38465
+ classnames(args
38466
+ /*: Array<ClassNameArg> */
38467
+ ) {
38602
38468
  var len = args.length;
38603
38469
  var i = 0;
38604
38470
  var cls = '';
@@ -38617,9 +38483,6 @@ var classnames = function classnames(args) {
38617
38483
  if (Array.isArray(arg)) {
38618
38484
  toAdd = classnames(arg);
38619
38485
  } else {
38620
- if (process.env.NODE_ENV !== 'production' && arg.styles !== undefined && arg.name !== undefined) {
38621
- console.error('You have passed styles created with `css` from `@emotion/react` package to the `cx`.\n' + '`cx` is meant to compose class names (strings) so you should convert those styles to a class name by passing them to the `css` received from <ClassNames/> component.');
38622
- }
38623
38486
 
38624
38487
  toAdd = '';
38625
38488
 
@@ -38649,7 +38512,13 @@ var classnames = function classnames(args) {
38649
38512
  return cls;
38650
38513
  };
38651
38514
 
38652
- function merge(registered, css, className) {
38515
+ function merge(registered
38516
+ /*: Object */
38517
+ , css
38518
+ /*: (...args: Array<any>) => string */
38519
+ , className
38520
+ /*: string */
38521
+ ) {
38653
38522
  var registeredStyles = [];
38654
38523
  var rawClassName = getRegisteredStyles(registered, registeredStyles, className);
38655
38524
 
@@ -38663,22 +38532,52 @@ function merge(registered, css, className) {
38663
38532
  var Insertion$1 = function Insertion(_ref) {
38664
38533
  var cache = _ref.cache,
38665
38534
  serializedArr = _ref.serializedArr;
38666
- useInsertionEffectAlwaysWithSyncFallback(function () {
38535
+ var rules = useInsertionEffectAlwaysWithSyncFallback(function () {
38536
+ var rules = '';
38667
38537
 
38668
38538
  for (var i = 0; i < serializedArr.length; i++) {
38669
- insertStyles(cache, serializedArr[i], false);
38539
+ var res = insertStyles(cache, serializedArr[i], false);
38540
+
38541
+ if (!isBrowser$3 && res !== undefined) {
38542
+ rules += res;
38543
+ }
38544
+ }
38545
+
38546
+ if (!isBrowser$3) {
38547
+ return rules;
38670
38548
  }
38671
38549
  });
38672
38550
 
38551
+ if (!isBrowser$3 && rules.length !== 0) {
38552
+ var _ref2;
38553
+
38554
+ return /*#__PURE__*/React.createElement("style", (_ref2 = {}, _ref2["data-emotion"] = cache.key + " " + serializedArr.map(function (serialized) {
38555
+ return serialized.name;
38556
+ }).join(' '), _ref2.dangerouslySetInnerHTML = {
38557
+ __html: rules
38558
+ }, _ref2.nonce = cache.sheet.nonce, _ref2));
38559
+ }
38560
+
38673
38561
  return null;
38674
38562
  };
38675
-
38676
- var ClassNames = /* #__PURE__ */withEmotionCache(function (props, cache) {
38563
+ /*
38564
+ type Props = {
38565
+ children: ({
38566
+ css: (...args: any) => string,
38567
+ cx: (...args: Array<ClassNameArg>) => string,
38568
+ theme: Object
38569
+ }) => React.Node
38570
+ } */
38571
+
38572
+
38573
+ var ClassNames
38574
+ /*: React.AbstractComponent<Props>*/
38575
+ = /* #__PURE__ */withEmotionCache(function (props, cache) {
38677
38576
  var hasRendered = false;
38678
38577
  var serializedArr = [];
38679
38578
 
38680
38579
  var css = function css() {
38681
- if (hasRendered && process.env.NODE_ENV !== 'production') {
38580
+ if (hasRendered && isDevelopment$2) {
38682
38581
  throw new Error('css can only be used during render');
38683
38582
  }
38684
38583
 
@@ -38694,7 +38593,7 @@ var ClassNames = /* #__PURE__ */withEmotionCache(function (props, cache) {
38694
38593
  };
38695
38594
 
38696
38595
  var cx = function cx() {
38697
- if (hasRendered && process.env.NODE_ENV !== 'production') {
38596
+ if (hasRendered && isDevelopment$2) {
38698
38597
  throw new Error('cx can only be used during render');
38699
38598
  }
38700
38599
 
@@ -38718,30 +38617,6 @@ var ClassNames = /* #__PURE__ */withEmotionCache(function (props, cache) {
38718
38617
  }), ele);
38719
38618
  });
38720
38619
 
38721
- if (process.env.NODE_ENV !== 'production') {
38722
- ClassNames.displayName = 'EmotionClassNames';
38723
- }
38724
-
38725
- if (process.env.NODE_ENV !== 'production') {
38726
- var isBrowser$1 = "object" !== 'undefined'; // #1727, #2905 for some reason Jest and Vitest evaluate modules twice if some consuming module gets mocked
38727
-
38728
- var isTestEnv = typeof jest !== 'undefined' || typeof vi !== 'undefined';
38729
-
38730
- if (isBrowser$1 && !isTestEnv) {
38731
- // globalThis has wide browser support - https://caniuse.com/?search=globalThis, Node.js 12 and later
38732
- var globalContext = // $FlowIgnore
38733
- typeof globalThis !== 'undefined' ? globalThis // eslint-disable-line no-undef
38734
- : isBrowser$1 ? window : global;
38735
- var globalKey = "__EMOTION_REACT_" + pkg.version.split('.')[0] + "__";
38736
-
38737
- if (globalContext[globalKey]) {
38738
- console.warn('You are loading @emotion/react when it is already loaded. Running ' + 'multiple instances may cause problems. This can happen if multiple ' + 'versions are used, or if multiple builds of the same version are ' + 'used.');
38739
- }
38740
-
38741
- globalContext[globalKey] = true;
38742
- }
38743
- }
38744
-
38745
38620
  function _taggedTemplateLiteral(strings, raw) {
38746
38621
  if (!raw) {
38747
38622
  raw = strings.slice(0);